:root {
  color-scheme: dark;
  --bg: #0a0a0c;
  --panel: #121216;
  --panel2: #18181d;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f4f4f5;
  --muted: #8b8b96;
  --accent: #7c6af7;
  --accent2: #a79cf8;
  --good: #3dd68c;
  --bad: #f07178;
  --warn: #e6b450;
  --touch: 40px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI Variable", "Segoe UI", Candara, Calibri, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: var(--accent2);
  text-decoration: none;
}

.app {
  padding: 28px clamp(16px, 3vw, 32px) 32px;
  max-width: 1180px;
  margin: 0 auto;
  width: 100%;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  gap: 13px;
  align-items: center;
  min-width: 0;
}

.logo-mark {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-kicker {
  margin: 0 0 1px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.status {
  border: 1px solid var(--border);
  background: transparent;
  padding: 0 12px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  height: var(--touch);
  color: var(--muted);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bad);
  flex-shrink: 0;
}

.dot.online {
  background: var(--good);
}

.dot.warn {
  background: var(--warn);
}

.btn {
  height: var(--touch);
  min-width: var(--touch);
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.2s ease, transform 0.15s ease;
}

.btn:hover {
  background: #6d5ce8;
}

.btn:active {
  transform: scale(0.98);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--panel2);
  border-color: #3a3a48;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 16px 14px;
  min-height: 118px;
  min-width: 0;
}

.card .label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.value {
  font-size: 26px;
  font-weight: 600;
  margin: 10px 0 6px;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}

.detail {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  word-break: break-word;
}

.bar {
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 14px;
}

.bar > div {
  height: 100%;
  width: 0%;
  background: var(--accent2);
  transition: width 0.35s ease;
}

.charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.chart-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  min-width: 0;
}

.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 10px;
}

.chart-head strong {
  color: var(--text);
  font-weight: 650;
}

svg.chart {
  width: 100%;
  height: 130px;
  display: block;
  overflow: visible;
}

.gridline {
  stroke: #24242d;
  stroke-width: 1;
}

.line {
  fill: none;
  stroke: var(--accent2);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.line.ram {
  stroke: #8f86e8;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 12px;
  flex-wrap: wrap;
}

/* Login */
.login-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.login-card {
  width: min(100%, 400px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 24px 24px;
  overflow: hidden;
}

.login-card img {
  max-width: 100%;
  height: auto;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 22px;
}

.login-mark {
  width: 96px;
  max-width: 40%;
  height: auto;
  display: block;
  margin: 0 auto 8px;
}

.login-brand h1 {
  margin: 0;
  line-height: 0;
}

.login-wordmark {
  width: 220px;
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.login-product {
  margin: 14px 0 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.login-brand p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 7px;
}

.field input {
  width: 100%;
  height: var(--touch);
  border: 1px solid var(--border);
  background: #0c0c0f;
  color: var(--text);
  border-radius: 8px;
  padding: 0 12px;
  outline: none;
  font-size: 15px;
}

.field input:focus {
  border-color: var(--accent);
}

.login-card .btn {
  width: 100%;
  margin-top: 8px;
  text-decoration: none;
}

.btn-discord {
  background: #5865f2;
}

.btn-discord:hover {
  background: #4752c4;
}

.form-error {
  min-height: 20px;
  margin: 0 0 10px;
  color: var(--bad);
  font-size: 13px;
}

.form-error:empty {
  display: none;
}

@media (max-width: 1050px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .charts {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .app {
    padding: 14px 12px 24px;
  }

  header {
    margin-bottom: 14px;
  }

  .status {
    width: 100%;
    justify-content: center;
  }

  .header-actions {
    width: 100%;
  }

  .header-actions .btn {
    flex: 1;
  }

  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .card {
    padding: 14px 12px;
    min-height: 110px;
    border-radius: 14px;
  }

  .value {
    margin: 8px 0 6px;
  }

  svg.chart {
    height: 120px;
  }
}
