:root {
  color-scheme: dark;
  --bg: #0a111d;
  --surface: #111c2d;
  --raised: #16243a;
  --line: #2b3b54;
  --text: #edf4fc;
  --muted: #a1b3cb;
  --accent: #59e6bf;
  font: 16px/1.55 system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.95rem, 4.5vw, 2.65rem); letter-spacing: -.045em; line-height: 1.15; }
h2 { font-size: 1.02rem; letter-spacing: -.01em; }
.muted { color: var(--muted); font-size: .875rem; }

.shell { width: min(1180px, calc(100% - 56px)); margin-inline: auto; }
.topbar { background: #101a2a; border-bottom: 1px solid var(--line); }
.topbar-inner { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 680; letter-spacing: -.025em; }
.brand-icon { display: grid; flex: none; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: #123b3b; border: 1px solid #2b685c; }
.brand-icon::before { content: ""; width: 12px; height: 14px; border-block: 2px solid var(--accent); background: linear-gradient(var(--accent), var(--accent)) center / 100% 2px no-repeat; }

button, input { font: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--raised); color: var(--text); border-radius: 8px; padding: 7px 13px; font-weight: 600; font-size: .875rem; }
button:hover { border-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.dashboard { display: grid; gap: 20px; padding-block: 38px 56px; }
.heading { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin-bottom: 4px; }
.heading p { margin-top: 8px; }
.live-status { display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 99px; padding: 5px 12px; font-size: .82rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.live-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.live-status[data-tone="ok"] { color: var(--accent); }
.live-status[data-tone="warn"] { color: #ffd28c; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; min-width: 0; }
.metric { padding: 20px; display: grid; gap: 10px; align-content: start; }
.metric h2 { color: var(--muted); }
.metric-value { font-size: clamp(1.65rem, 3.2vw, 2.25rem); font-weight: 700; line-height: 1.2; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
progress { display: block; width: 100%; height: 7px; appearance: none; border: 0; border-radius: 99px; overflow: hidden; background: #283950; accent-color: var(--accent); }
progress::-webkit-progress-bar { background: #283950; border-radius: 99px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 99px; }

.section-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 16px; }
.chart { padding: 19px 21px 16px; }
canvas { display: block; width: 100%; height: 182px; margin-top: 13px; }
.data-section .section-heading { padding: 16px 20px; }
.table-scroll { overflow-x: auto; border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .875rem; }
thead { background: #152238; color: var(--muted); }
th, td { padding: 10px 20px; vertical-align: top; }
thead th { font-weight: 620; white-space: nowrap; }
tbody th { font-weight: 650; }
tbody tr + tr { border-top: 1px solid var(--line); }
tbody small { display: block; font-weight: 400; overflow-wrap: anywhere; }
.badge { display: inline-block; border-radius: 6px; padding: 2px 8px; font-size: .77rem; font-weight: 620; white-space: nowrap; background: #233248; color: var(--muted); }
.badge.ok { background: #173c38; color: #8df4d5; }
.badge.bad { background: #47293a; color: #ffc1cf; }
.badge.warn { background: #453725; color: #ffdb9e; }
.nowrap { white-space: nowrap; }
.log-message { min-width: 240px; overflow-wrap: anywhere; color: var(--muted); font-family: ui-monospace, monospace; font-size: .81rem; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 22px; background: radial-gradient(ellipse at 50% 0%, #182c45, var(--bg) 65%); }
.login-card { width: min(100%, 430px); padding: clamp(24px, 6vw, 38px); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 20px 75px #050a1280; }
.login-card h1 { margin: 27px 0 22px; }
.login-card label { display: block; font-size: .88rem; font-weight: 640; margin: 0 0 6px; }
.login-card input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); margin-bottom: 17px; }
.primary { width: 100%; background: var(--accent); color: #092620; border-color: transparent; padding-block: 11px; }
.primary:hover { background: #8df4d5; }
.form-error { border: 1px solid #784355; border-radius: 8px; padding: 8px 12px; margin-bottom: 15px; color: #ffc1cf; font-size: .875rem; }
.form-error:empty { display: none; }

@media (max-width: 690px) {
  .shell { width: calc(100% - 28px); }
  .topbar-inner { min-height: 62px; }
  .brand { font-size: .93rem; gap: 8px; }
  .dashboard { padding-top: 28px; gap: 15px; }
  .metrics { grid-template-columns: 1fr; gap: 10px; }
  .metric { padding: 14px 16px; gap: 7px; }
  .chart { padding-inline: 14px; }
  .data-section .section-heading, th, td { padding-inline: 13px; }
}
