:root {
  color-scheme: light;
  --bg: #f4f4f2; --surface: #fcfcfb; --hair: #e3e2dd; --track: #ebeae6;
  --ink: #0b0b0b; --ink-2: #52514e; --ink-3: #6b6a65;
  --good: #0ca30c; --warn: #fab219; --crit: #d03b3b; --none: #9a998f;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211; --surface: #1a1a19; --hair: #2e2d2b; --track: #262624;
    --ink: #f0efec; --ink-2: #c3c2b7; --ink-3: #a09f95;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --surface: #1a1a19; --hair: #2e2d2b; --track: #262624;
  --ink: #f0efec; --ink-2: #c3c2b7; --ink-3: #a09f95;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
main { max-width: 880px; margin: 0 auto; padding: 24px 16px 48px; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 17px; margin: 0; }
h3 { font-size: 14px; margin: 0; font-weight: 600; }
.muted { color: var(--ink-3); }
header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 16px; margin-bottom: 16px; }
header p { margin: 0; font-size: 13px; }

.dot { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; font-size: 12px; font-weight: 700; line-height: 1; flex: none; color: #fff; }
.dot.up { background: var(--good); } .dot.degraded { background: var(--warn); color: #3a2a00; }
.dot.down { background: var(--crit); } .dot.unknown { background: var(--none); }
.state { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }

.banner { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--hair); border-radius: 10px; padding: 14px 16px; font-size: 17px; font-weight: 600; }
.banner .dot { width: 24px; height: 24px; font-size: 15px; }
.filters { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 16px 0; }
.filters button { font: inherit; font-size: 13px; color: var(--ink-2); background: transparent; border: 1px solid var(--hair); border-radius: 8px; padding: 4px 10px; cursor: pointer; }
.filters button:hover { background: var(--track); }
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.filters button:focus-visible, .link:focus-visible { outline: 2px solid var(--series-1); outline-offset: 2px; }

.group { background: var(--surface); border: 1px solid var(--hair); border-radius: 10px; margin-bottom: 16px; overflow: hidden; }
.group > header { margin: 0; padding: 12px 16px; border-bottom: 1px solid var(--hair); align-items: center; }
.row { padding: 12px 16px; border-bottom: 1px solid var(--hair); }
.row:last-of-type { border-bottom: 0; }
.row-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.row-head .name { font-weight: 600; flex: 1 1 140px; }
.row-head .detail { color: var(--ink-3); font-size: 13px; flex: 2 1 200px; }
.row-head .figures { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.strip { display: grid; grid-template-columns: repeat(90, 1fr); gap: 2px; height: 22px; margin-top: 8px; }
.strip i { border-radius: 2px; background: var(--none); opacity: .35; }
.strip i.good { background: var(--good); opacity: 1; } .strip i.warn { background: var(--warn); opacity: 1; }
.strip i.crit { background: var(--crit); opacity: 1; }
.strip-note { display: flex; justify-content: space-between; font-size: 12px; margin-top: 2px; }

.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; padding: 16px; border-top: 1px solid var(--hair); }
.chart { min-width: 0; transition: opacity .15s; }
.chart.loading { opacity: .6; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink-2); margin: 2px 0 4px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.key { width: 14px; height: 0; border-top: 2px solid var(--c); display: inline-block; }
.key.outage { height: 8px; border: 0; background: var(--crit); opacity: .25; width: 10px; }
.link { font: inherit; font-size: 12px; color: var(--ink-3); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }
.chart svg { display: block; width: 100%; touch-action: pan-y; }
.chart .grid { stroke: var(--hair); stroke-width: 1; }
.chart text { fill: var(--ink-3); font-size: 11px; }
.chart .empty { padding: 36px 0; text-align: center; font-size: 13px; }
.chart table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.chart th, .chart td { text-align: right; padding: 3px 6px; border-bottom: 1px solid var(--hair); }
.chart th:first-child, .chart td:first-child { text-align: left; }
.chart .tablewrap { max-height: 220px; overflow: auto; }

.tip { position: fixed; z-index: 10; pointer-events: none; background: var(--surface); color: var(--ink); border: 1px solid var(--hair); border-radius: 8px; padding: 6px 10px; font-size: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.18); max-width: 260px; }
.tip .when { color: var(--ink-3); margin-bottom: 2px; }
.tip .line { display: flex; align-items: center; gap: 6px; }
.tip .line b { font-variant-numeric: tabular-nums; }
footer { font-size: 12px; margin-top: 24px; }
@media (prefers-reduced-motion: reduce) { .chart { transition: none; } }
