:root {
  color-scheme: light;
  --page: #f9f9f7; --surface: #fcfcfb; --ink: #0b0b0b; --ink-2: #52514e; --muted: #898781;
  --grid: #e1e0d9; --axis: #c3c2b7; --border: rgba(11,11,11,0.10);
  --series-1: #2a78d6; --series-2: #eb6834;
  --good: #006300; --bad: #d03b3b; --accent: #2a78d6;
  --down-bg: #e6f0fc; --up-bg: #fdece4;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --ink: #ffffff; --ink-2: #c3c2b7; --muted: #898781;
    --grid: #2c2c2a; --axis: #383835; --border: rgba(255,255,255,0.10);
    --series-1: #3987e5; --series-2: #d95926;
    --good: #0ca30c; --bad: #e66767; --accent: #3987e5;
    --down-bg: #14263c; --up-bg: #3a1f14;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --ink: #ffffff; --ink-2: #c3c2b7; --muted: #898781;
  --grid: #2c2c2a; --axis: #383835; --border: rgba(255,255,255,0.10);
  --series-1: #3987e5; --series-2: #d95926;
  --good: #0ca30c; --bad: #e66767; --accent: #3987e5;
  --down-bg: #14263c; --up-bg: #3a1f14;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
main { max-width: 1280px; margin: 0 auto; padding: 16px 24px 64px; }
h1 { font-size: 24px; margin: 8px 0 12px; }
h1 .sub { font-size: 16px; font-weight: 400; color: var(--ink-2); }
h2 { font-size: 16px; margin: 28px 0 8px; }
.card h2 { margin-top: 0; }
.muted { color: var(--muted); }
.sub { color: var(--muted); font-size: 12px; font-weight: 400; }
.hint { color: var(--ink-2); font-size: 13px; margin: 0 0 10px; max-width: 80ch; }
.good { color: var(--good); font-weight: 600; }
.bad { color: var(--bad); font-weight: 600; }
.nowrap { white-space: nowrap; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { font-weight: 700; font-size: 17px; color: var(--ink); }
.brand span { font-weight: 400; color: var(--muted); font-size: 13px; margin-left: 8px; }
.top nav { display: flex; gap: 4px; flex-wrap: wrap; }
.top nav a { padding: 6px 10px; border-radius: 6px; color: var(--ink-2); }
.top nav a.on { background: var(--page); color: var(--ink); font-weight: 600; }
.top nav a:hover { text-decoration: none; background: var(--page); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 12px 0; }
.tile, .card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.card { margin: 16px 0; }
.tile .label { color: var(--ink-2); font-size: 12px; }
.tile .value { font-size: 22px; font-weight: 600; margin-top: 2px; }

.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
table.data { border-collapse: collapse; width: 100%; font-size: 13px; }
table.data th, table.data td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--grid); vertical-align: top; }
table.data thead th { color: var(--ink-2); font-weight: 600; font-size: 12px; white-space: nowrap; }
table.data tbody tr:last-child td, table.data tbody tr:last-child th { border-bottom: 0; }
table.data tbody tr[onclick] { cursor: pointer; }
table.data tbody tr[onclick]:hover { background: var(--page); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data td.msg { font-family: ui-monospace, monospace; font-size: 12px; color: var(--ink-2); white-space: pre-wrap; max-width: 60ch; }
table.data .empty, p.empty { color: var(--muted); text-align: center; padding: 24px; }
table.perf th[scope=row] { font-weight: 500; white-space: nowrap; }
table.perf tr.group td { background: var(--page); color: var(--ink-2); font-size: 12px; font-weight: 600; padding: 6px 10px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; color: var(--ink); }
.badge.down { background: var(--down-bg); }
.badge.up { background: var(--up-bg); }

.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0 14px; }
select, input, button { font: inherit; padding: 6px 10px; border-radius: 6px; border: 1px solid var(--axis);
  background: var(--surface); color: var(--ink); }
button { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; cursor: pointer; }
.pager { display: flex; gap: 16px; justify-content: center; margin: 16px 0; }
.crumbs { margin: 4px 0; font-size: 13px; }
.callout { background: var(--surface); border-left: 3px solid var(--axis); padding: 10px 14px; border-radius: 4px; max-width: 90ch; font-size: 13px; color: var(--ink-2); }

.login { max-width: 340px; margin: 12vh auto; display: flex; flex-direction: column; gap: 12px; }
.login h1 { margin: 0 0 4px; }
.login label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-2); }
.error { color: var(--bad); margin: 0; }

.chart { position: relative; height: 320px; }
.chart.short { height: 240px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.chart .legend i { display: inline-block; width: 14px; height: 2px; vertical-align: middle; margin-right: 6px; border-radius: 1px; }
.chart .tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0,0,0,.12); border-radius: 8px; padding: 8px 10px; font-size: 12px; white-space: nowrap; display: none; z-index: 2; }
.chart .tip b { display: block; margin-bottom: 2px; }
.chart .tip i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }

@media (max-width: 700px) {
  main { padding: 12px 16px 48px; }
  .top { padding: 10px 16px; }
  .brand span { display: none; }
}
