:root {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #222220;
  --text: #ffffff;
  --text-2: #c3c2b7;
  --muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --link: #86b6ef;
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --accent: #3987e5;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--text); font-size: 15px; line-height: 1.5; }
a { color: var(--link); }
code { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 0.86em; color: var(--text-2); overflow-wrap: anywhere; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 0.85em; }
h1 { font-size: 1.45rem; margin: 20px 0 14px; }
h2 { font-size: 1.1rem; margin: 30px 0 10px; color: var(--text-2); }
h3 { font-size: 1rem; margin: 0 0 6px; }
.note { color: var(--muted); font-size: 0.87rem; max-width: 80ch; }

.top { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.top__row { display: flex; align-items: center; justify-content: space-between; height: 48px; }
.brand { font-weight: 700; letter-spacing: 0.02em; }
.logout button, .btn, button {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 12px; font: inherit; cursor: pointer; text-decoration: none; display: inline-block;
}
button:hover, .btn:hover { border-color: var(--accent); }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-bottom: 8px; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: var(--text-2); text-decoration: none; padding: 6px 12px; border-radius: 999px; white-space: nowrap; font-size: 0.92rem; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--accent); color: #fff; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.tile__label { color: var(--text-2); font-size: 0.9rem; }
.tile__value { font-size: 2rem; font-weight: 700; line-height: 1.2; margin: 2px 0; }
.tile__sub { color: var(--muted); font-size: 0.85rem; }

.tscroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--grid); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
td { font-variant-numeric: tabular-nums; }
table.dense td { padding: 6px 10px; white-space: nowrap; }

.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 0.82rem; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--text); white-space: nowrap; }
.pill span { font-size: 0.7rem; }
.pill--good span { color: var(--good); }
.pill--warning span { color: var(--warning); }
.pill--critical span { color: var(--critical); }
.pill--muted span { color: var(--muted); }

.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; align-items: end; }
.filters > a { color: var(--text-2); text-decoration: none; border: 1px solid var(--border); padding: 4px 12px; border-radius: 999px; font-size: 0.88rem; }
.filters > a[aria-current="true"] { background: var(--surface-2); color: var(--text); border-color: var(--accent); }
.filters--form label { display: flex; flex-direction: column; font-size: 0.8rem; color: var(--muted); gap: 2px; }
select, input { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; font: inherit; }

.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); gap: 12px; }
.chart { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; min-width: 0; }
.chart figcaption { font-size: 0.92rem; margin-bottom: 6px; }
.chart__canvas { position: relative; height: 260px; }

.meter { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.meter__head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; margin-bottom: 8px; }
.meter__bar { height: 10px; background: var(--grid); border-radius: 999px; overflow: hidden; }
.meter__fill { display: block; height: 100%; border-radius: 999px; }
.meter__fill--good { background: var(--good); }
.meter__fill--warning { background: var(--warning); }
.meter__fill--critical { background: var(--critical); }
.w0 { width: 0 } .w5 { width: 5% } .w10 { width: 10% } .w15 { width: 15% } .w20 { width: 20% } .w25 { width: 25% }
.w30 { width: 30% } .w35 { width: 35% } .w40 { width: 40% } .w45 { width: 45% } .w50 { width: 50% } .w55 { width: 55% }
.w60 { width: 60% } .w65 { width: 65% } .w70 { width: 70% } .w75 { width: 75% } .w80 { width: 80% } .w85 { width: 85% }
.w90 { width: 90% } .w95 { width: 95% } .w100 { width: 100% }

.change { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.change p { margin: 4px 0; }
details { margin-top: 16px; }
summary { cursor: pointer; color: var(--text-2); }
ul.cols { columns: 3 260px; font-size: 0.85rem; padding-left: 18px; }

.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login__box { width: 100%; max-width: 340px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 24px; }
.login__box h1 { margin-top: 0; }
.login__box form { display: flex; flex-direction: column; gap: 12px; }
.login__box label { display: flex; flex-direction: column; gap: 4px; color: var(--text-2); font-size: 0.9rem; }
.login__box button { background: var(--accent); border-color: var(--accent); color: #fff; padding: 9px; font-weight: 600; }
.login__err { color: #fff; background: rgba(208, 59, 59, 0.25); border: 1px solid var(--critical); border-radius: 6px; padding: 8px 10px; font-size: 0.9rem; }

@media (max-width: 600px) {
  body { font-size: 14px; }
  .tile__value { font-size: 1.6rem; }
  .chart__canvas { height: 220px; }
  th, td { padding: 7px 9px; }
}

details.sub { margin: 12px 0 0; }
details.sub > summary { padding: 6px 0; }
details.sub .tscroll { margin-top: 8px; }
.legend-list { list-style: none; padding: 0; margin: 10px 0 0; font-size: 0.85rem; color: var(--text-2); display: grid; gap: 4px; }
.legend-list strong { display: inline-block; min-width: 5.5em; color: var(--text); }
abbr[title] { text-decoration: none; cursor: help; }

.alert { border: 1px solid var(--border); border-left-width: 4px; border-radius: 8px; padding: 10px 14px; margin: 0 0 14px; background: var(--surface); line-height: 1.5; }
.alert--critical { border-left-color: var(--critical); background: rgba(208, 59, 59, 0.12); }
.alert--warning { border-left-color: var(--warning); background: rgba(250, 178, 25, 0.10); }
.alert a { margin-left: 4px; }
td:first-child { white-space: nowrap; }
td code { overflow-wrap: normal; white-space: nowrap; }
.tile__sub .pill { margin-top: 2px; }

.alert { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; }
.alert__text { flex: 1 1 320px; min-width: 0; }
.alert__new { display: inline-block; margin-left: 6px; font-size: 0.85rem; color: var(--text); background: rgba(255,255,255,0.08); border-radius: 999px; padding: 0 8px; }
.alert__ack { margin: 0; flex: 0 0 auto; }
