:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  color: #e9eff6;
  background: #101419;
  --surface: #181e26;
  --edge: #293340;
  --muted: #a0aebf;
  --accent: #73e5be;
  --blue: #85abff;
  --green: #76e3ad;
  --amber: #ffd185;
  --red: #ff9898;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select { font: inherit; }
button, select {
  background: #202a35; color: inherit; border: 1px solid var(--edge);
  border-radius: 9px; padding: 8px 12px; min-height: 39px; cursor: pointer;
}
button:hover, select:hover { border-color: #61748d; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.layout { display: grid; min-height: 100vh; grid-template-columns: 217px minmax(0,1fr); }
.sidebar {
  min-height: 100vh; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 29px 17px 20px; border-right: 1px solid var(--edge); background: #141a21;
}
.brand { text-decoration: none; display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 1.13rem; }
.brand-icon {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: var(--accent); color: #102d27; font-size: 1.8rem; line-height: 1;
}
.sidebar nav { margin-top: 40px; display: grid; gap: 7px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--muted);
  border: 1px solid transparent; padding: 10px 11px; border-radius: 8px; white-space: nowrap;
  transition: color .15s, background .15s;
}
.sidebar nav a span { width: 19px; text-align: center; font-size: 1.2rem; line-height: 1; }
.sidebar nav a:hover { background: #1d2631; color: #fff; }
.sidebar nav a[aria-current] { background: #20352f; color: var(--accent); border-color: #2b4840; }
.quiet { color: var(--muted); margin-top: auto; align-self: flex-start; background: transparent; }
main { max-width: 1680px; width: 100%; margin: 0 auto; padding: 30px clamp(16px, 3vw, 46px) 45px; }
.topbar { display:flex; justify-content:space-between; gap:16px; align-items:center; margin-bottom:25px; }
.eyebrow { color: var(--accent); font-weight: 650; font-size: .83rem; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 6px; }
h1 { margin: 0; font-size: clamp(1.55rem, 3vw, 2.25rem); line-height: 1.1; letter-spacing: -.027em; }
h2 { font-size: 1.04rem; margin: 0 0 13px; font-weight: 690; }
h3 { margin: 0; font-size: 1rem; }
.top-tools { display: flex; align-items: center; gap: 8px; }
#updated { color: var(--muted); font-size: .84rem; white-space: nowrap; }
.grid { display:grid; gap: 14px; grid-template-columns: repeat(2,minmax(0,1fr)); margin-bottom: 14px; }
.grid.metrics { grid-template-columns: repeat(4,minmax(0,1fr)); }
.card {
  min-width: 0; border: 1px solid var(--edge); border-radius: 14px; padding: 17px 18px;
  background: var(--surface); box-shadow: 0 2px 3px #06090c35;
}
.card.full { grid-column: 1/-1; }
.metric { min-height: 125px; display:flex; flex-direction:column; gap:8px; }
.label { font-size: .89rem; color: var(--muted); }
.value { font-weight: 720; font-size: clamp(1.32rem,2.3vw,1.95rem); letter-spacing: -.035em; margin-top: auto; }
.sub { color: var(--muted); font-size: .87rem; line-height: 1.45; overflow-wrap: anywhere; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.detail { display: grid; gap: 10px; margin-top: 12px; }
.detail > div { padding-bottom: 8px; border-bottom: 1px solid #2a3441; }
.badge { border-radius: 99px; font-size: .81rem; font-weight: 650; padding: 4px 9px; background: #2a3442; color: #c8d5e5; display: inline-block; }
.good { color: var(--green); background: #1f3b31; }
.warn { color: var(--amber); background: #3c3227; }
.bad { color: var(--red); background: #3e2931; }
.notice { background: #3b292c; border: 1px solid #71454d; padding: 12px 14px; border-radius: 9px; color: #ffb5b5; }
.table-frame { overflow: auto; max-height: 505px; }
table { border-collapse: collapse; width: 100%; text-align: left; font-size: .91rem; font-variant-numeric: tabular-nums; }
th { position: sticky; top: 0; background: var(--surface); color: var(--muted); font-weight: 580; }
th, td { padding: 10px 9px; border-bottom: 1px solid #2a3441; vertical-align: top; }
td:first-child, th:first-child { padding-left: 0; }
time { white-space: nowrap; }
.chart { display: grid; gap: 7px; min-height: 244px; }
canvas { width: 100%; height: 174px; display: block; touch-action: pan-y; }
.legend { display: flex; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: .83rem; }
.legend button { min-height: 31px; padding: 3px 9px; font-size: .82rem; }
.legend button[aria-pressed=false] { opacity: .53; }
.chart-readout { min-height: 1.25em; color: var(--muted); font-size: .84rem; }
details summary { cursor:pointer; color: var(--muted); }
pre { padding: 10px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); background: #11161c; border-radius: 8px; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 18px; background: radial-gradient(ellipse at 58% 29%, #203632, transparent 48%); }
.login-card { width: min(100%,405px); display: grid; gap: 11px; padding: 29px; border: 1px solid var(--edge); border-radius: 16px; background: var(--surface); }
.login-card h1 { margin: 10px 0; font-size: 1.6rem; }
.login-card label { color: var(--muted); }
input { width: 100%; color: inherit; min-height: 44px; border: 1px solid #3b4a5c; border-radius: 8px; padding: 9px; background: #10171f; }
.primary { background: var(--accent); color: #102c25; font-weight: 750; margin-top: 10px; }
#login-error { color: var(--red); margin: 0; }
.initial { margin: 36px; color: var(--muted); }
.visually-hidden { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
@media (max-width: 1000px) {
  .layout { grid-template-columns: 166px minmax(0,1fr); }
  .sidebar { padding-inline: 12px; }
  .grid.metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 700px) {
  .layout { display: block; }
  .sidebar { position: relative; height: auto; min-height: 0; padding: 12px 14px; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; border-right: 0; border-bottom: 1px solid var(--edge); }
  .sidebar nav { order: 3; width: 100%; display: flex; gap: 5px; overflow-x: auto; margin-top: 4px; }
  .sidebar nav a { padding: 8px; gap: 5px; font-size: .85rem; }
  .sidebar nav a span { display: none; }
  .quiet { margin-left: auto; align-self: center; min-height: 35px; }
  main { padding-top: 20px; }
  .topbar { flex-wrap: wrap; }
  .grid:not(.metrics) { grid-template-columns: minmax(0,1fr); }
  .card { padding: 13px; }
  table { min-width: max-content; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}
