/* Tokens. Chart colours follow the dataviz reference palette; status colours are reserved. */
:root {
  --surface-0: #f6f6f4;
  --surface-1: #fcfcfb;
  --line: #e4e4e0;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #8a8984;
  --series-1: #2a78d6;
  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-serious: #ec835a;
  --status-critical: #d03b3b;
  --band: rgba(11, 11, 11, 0.06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface-0: #121211;
    --surface-1: #1a1a19;
    --line: #2d2d2b;
    --text-primary: #f0efec;
    --text-secondary: #c3c2b7;
    --text-muted: #8c8b84;
    --series-1: #3987e5;
    --band: rgba(240, 239, 236, 0.08);
  }
}
:root[data-theme="dark"] {
  --surface-0: #121211; --surface-1: #1a1a19; --line: #2d2d2b;
  --text-primary: #f0efec; --text-secondary: #c3c2b7; --text-muted: #8c8b84;
  --series-1: #3987e5; --band: rgba(240, 239, 236, 0.08);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--surface-0); color: var(--text-primary);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; line-height: 1.2; margin: 0 0 .25rem; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
code { font-size: .9em; }
.container { max-width: 1040px; margin: 0 auto; padding: 16px; }
.topbar {
  display: flex; gap: 18px; align-items: center; padding: 10px 16px;
  background: var(--surface-1); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.topbar .brand { font-weight: 700; margin-right: auto; }
.topbar form.inline { margin: 0; }
button.link { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 0; }
.page-head { margin: 8px 0 16px; }
.crumbs { margin: 0 0 4px; color: var(--text-muted); font-size: .85rem; }
.card { background: var(--surface-1); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); font-size: .85em; }
.block { display: block; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th { text-align: left; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-secondary); padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.data th.num { text-align: right; }
table.data td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
@media (max-width: 640px) {
  table.data th:nth-child(5), table.data td:nth-child(5) { display: none; }
  .container { padding: 12px; }
}

.pill { display: inline-block; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; color: var(--text-primary); }
.pill-ok { border-color: var(--status-good); }
.pill-warning { border-color: var(--status-warning); background: color-mix(in srgb, var(--status-warning) 18%, transparent); }
.pill-serious { border-color: var(--status-serious); background: color-mix(in srgb, var(--status-serious) 22%, transparent); }
.change { font-variant-numeric: tabular-nums; }
.change-better { color: var(--text-primary); }
.change-worse { color: var(--text-primary); font-weight: 600; }

.hero { margin: 4px 0; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.hero-value { font-size: 2.6rem; font-weight: 600; line-height: 1; }

.chart-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.chart-card h2 { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 2px; }
.chart-sub { margin: 0 0 6px; font-size: .9rem; }
.trend-chart { position: relative; width: 100%; height: 300px; }
.trend-chart-small { height: 170px; }
.trend-chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.trend-chart .tick { font-size: 11px; fill: var(--text-secondary); }
.trend-chart .grid { stroke: var(--line); stroke-width: 1; }
.trend-chart .band { fill: var(--band); }
.trend-chart .band-label { font-size: 10px; fill: var(--text-muted); }
.trend-chart .target { stroke: var(--text-secondary); stroke-width: 1; stroke-dasharray: 4 3; }
.trend-chart .series { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.trend-chart .dot { fill: var(--series-1); stroke: var(--surface-1); stroke-width: 2; }
.trend-chart .dot-out { fill: var(--status-serious); }
.trend-chart .flag-label { font-size: 10px; font-weight: 600; fill: var(--text-primary); }
.trend-chart .end-label { font-size: 11px; font-weight: 600; fill: var(--text-primary); }
.trend-chart .note-mark { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 2 2; }
.trend-chart .crosshair { stroke: var(--text-muted); stroke-width: 1; pointer-events: none; }
.trend-chart .hit { fill: transparent; cursor: crosshair; }
.trend-tip {
  position: absolute; pointer-events: none; background: var(--surface-1); color: var(--text-primary);
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font-size: .8rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.12); white-space: nowrap; display: none; z-index: 2;
}
.trend-tip strong { font-size: .95rem; }
.trend-tip .key { display: inline-block; width: 12px; height: 2px; background: var(--series-1); vertical-align: middle; margin-right: 6px; }

.sibling-nav { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: .9rem; }
.notes { padding-left: 1.1rem; }
.login { max-width: 380px; margin: 48px auto; }
.login label { display: block; margin: 12px 0 4px; font-size: .9rem; }
.login input { width: 100%; padding: 10px; font: inherit; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-0); color: inherit; }
.btn { display: inline-block; margin-top: 14px; padding: 9px 16px; border-radius: 6px; border: 0; background: var(--series-1); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.error { color: var(--status-critical); }
.messages { list-style: none; padding: 0; }
