/* Colours are the dataviz reference palette: one accent, one grey, ink and
   hairlines in light and dark. Roles, not hex, below the token block. */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --ink-3: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;
  --muted: #898781;
  --error: #d03b3b;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --ink-3: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --accent: #3987e5;
    --muted: #898781;
    --error: #e66767;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
h1 { font-size: 22px; margin: 0 0 12px; }
h2 { font-size: 15px; margin: 0; font-weight: 600; }
a { color: var(--accent); }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.error { color: var(--error); font-weight: 600; }

.top {
  display: flex; justify-content: space-between; align-items: center;
  max-width: 1100px; margin: 0 auto; padding: 12px 16px 0;
}
.brand { color: var(--ink); font-weight: 700; text-decoration: none; }
button {
  font: inherit; padding: 8px 16px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--accent); color: #fff; cursor: pointer;
}
button.link { background: none; color: var(--ink-2); border: none; padding: 4px; text-decoration: underline; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; margin: 0;
}
.narrow { max-width: 420px; margin: 48px auto; }
label { display: block; margin: 12px 0; color: var(--ink-2); }
input[type=password] {
  display: block; width: 100%; margin-top: 4px; padding: 8px; font: inherit;
  border: 1px solid var(--axis); border-radius: 8px; background: var(--surface); color: var(--ink);
}

.filters { display: flex; gap: 8px; margin: 8px 0 16px; flex-wrap: wrap; }
.filters a {
  padding: 4px 12px; border-radius: 999px; border: 1px solid var(--border);
  color: var(--ink-2); text-decoration: none; background: var(--surface);
}
.filters a[aria-current] { color: var(--ink); font-weight: 600; border-color: var(--axis); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; }
.tile-label { color: var(--ink-2); font-size: 13px; }
.tile-value { font-size: 28px; font-weight: 600; }
.tile-note { color: var(--ink-3); font-size: 12px; }

.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 16px; margin-top: 16px; }
figcaption { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.legend { display: flex; gap: 12px; list-style: none; margin: 0; padding: 0; font-size: 12px; color: var(--ink-2); }
.legend li { display: flex; align-items: center; gap: 4px; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.key.accent { background: var(--accent); }
.key.muted { background: var(--muted); }
.key.nodata { height: 2px; background: var(--ink-3); }
.empty { color: var(--ink-3); padding: 24px 0; text-align: center; }

/* Charts. Text wears ink, never the data colour. */
.chart { display: block; width: 100%; height: auto; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .tick { fill: var(--ink-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .accent { fill: var(--accent); }
.chart .muted { fill: var(--muted); }
.chart .nodata { stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart .hit-area { fill: transparent; }
.chart .hit:hover .accent, .chart .hit:hover .muted, .chart .hit:hover .dot { opacity: 0.75; }
/* The SVG scales with its card, its text with it: on a phone the chart is
   about two thirds of its drawn width, so the ticks get bigger units to stay
   readable at around 10px. */
@media (max-width: 560px) {
  .chart .tick { font-size: 16px; }
}

details { margin-top: 8px; font-size: 13px; color: var(--ink-2); }
summary { cursor: pointer; }
table { border-collapse: collapse; margin-top: 8px; width: 100%; }
th, td { text-align: left; padding: 2px 8px; border-bottom: 1px solid var(--grid); font-variant-numeric: tabular-nums; }
