/* Hold My IO design system, direction B: soft lavender to peach background, white cards with soft shadows,
   a color strip per metric, pill deltas, line icons and line charts. Series colors validated for color blindness
   (indigo and coral, light and dark).
   Served at /assets/ui.css; every page links it. */

:root {
  color-scheme: light;
  --bg: linear-gradient(160deg, #eef0ff 0%, #f7f3ff 45%, #fff6f0 100%);
  --page: #f4f2fc;
  --surface: #ffffff;
  --surface-2: #f3f2fb;
  --ink: #1b1a2e;
  --ink-2: #4c4a66;
  --muted: #7d7b96;
  --grid: #ebe9f5;
  --axis: #cfcce3;
  --ring: rgba(60, 40, 140, 0.08);
  --ring-strong: rgba(60, 40, 140, 0.16);
  --shadow: 0 8px 24px rgba(60, 40, 140, 0.07), 0 1px 2px rgba(60, 40, 140, 0.05);
  --accent: #5b5bf7;
  --accent-2: #b14ef0;
  --accent-ink: #ffffff;
  --s1: #5b5bf7;
  --s2: #f0673f;
  --s3: #17b890;
  --seq-100: #e4e4fe;
  --seq-250: #b3b3fb;
  --seq-400: #7070f8;
  --seq-550: #4141c9;
  --on-seq-400: #ffffff;
  --on-seq-550: #ffffff;
  --good: #0b7a4b;
  --good-bg: #ddf6ea;
  --bad: #b3361b;
  --bad-bg: #ffe4dc;
  --strip-1: linear-gradient(90deg, #5b5bf7, #8b7bff);
  --strip-2: linear-gradient(90deg, #ff7a59, #ffb259);
  --strip-3: linear-gradient(90deg, #17b890, #63d6b4);
  --strip-4: linear-gradient(90deg, #b14ef0, #e37bf5);
  --radius: 18px;
  --radius-sm: 11px;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: linear-gradient(160deg, #121128 0%, #17142d 50%, #1f1622 100%);
    --page: #141228;
    --surface: #1d1b2f;
    --surface-2: #26243c;
    --ink: #eeedf8;
    --ink-2: #c4c2da;
    --muted: #8f8ca9;
    --grid: #2b2942;
    --axis: #3d3a58;
    --ring: rgba(200, 190, 255, 0.08);
    --ring-strong: rgba(200, 190, 255, 0.16);
    --shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
    --accent: #7b7bff;
    --accent-2: #c77bf5;
    --s1: #7b7bff;
    --s2: #e5603a;
    --s3: #2cc79f;
    --seq-100: #2a2860;
    --seq-250: #3b3a8c;
    --seq-400: #6262e6;
    --seq-550: #a9a9ff;
    --on-seq-400: #ffffff;
    --on-seq-550: #14132a;
    --good: #5fe0a5;
    --good-bg: rgba(95, 224, 165, 0.14);
    --bad: #ff8f73;
    --bad-bg: rgba(255, 143, 115, 0.14);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); background-image: var(--bg); background-attachment: fixed; color: var(--ink); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.01em; }
code, pre { font: 12.5px/1.5 ui-monospace, "SF Mono", Menlo, monospace; }
pre { background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; overflow-x: auto; margin: 6px 0 12px; }
code { overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.icon { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* --- Top bar */
.topbar { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--surface) 70%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--ring); }
.topbar-inner { max-width: 1280px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 15px; color: var(--ink); letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.brand .mark { width: 26px; height: 26px; padding: 4px; border-radius: 8px; color: #fff; stroke-width: 2.2; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 35%, transparent); }
.nav { display: flex; gap: 4px; }
.nav a { color: var(--ink-2); padding: 6px 10px; border-radius: var(--radius-sm); font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--surface-2); }
.topbar .spacer { flex: 1; }
.who { color: var(--muted); font-size: 12px; }

/* --- Controls */
button, .btn { font: inherit; font-size: 13px; color: var(--ink); background: var(--surface); border: 1px solid var(--ring-strong); border-radius: var(--radius-sm); padding: 6px 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; line-height: 1.4; }
button:hover, .btn:hover { background: var(--surface-2); text-decoration: none; }
button.primary, .btn.primary { background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--accent-2))); color: var(--accent-ink); border-color: transparent; font-weight: 600; box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 30%, transparent); }
button.primary:hover, .btn.primary:hover { filter: brightness(1.06); background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--accent-2))); }
button.ghost { background: none; border-color: transparent; color: var(--ink-2); }
button.ghost:hover { background: var(--surface-2); color: var(--ink); }
button.danger { color: var(--bad); }
button[disabled] { opacity: 0.55; cursor: default; }
input, select, textarea { font: inherit; font-size: 13px; color: var(--ink); background: var(--surface); border: 1px solid var(--ring-strong); border-radius: var(--radius-sm); padding: 7px 10px; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label { color: var(--ink-2); font-size: 13px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: color-mix(in srgb, var(--surface) 70%, transparent); border-radius: 12px; box-shadow: 0 1px 2px rgba(30, 20, 80, 0.06); }
.seg button { border: 0; background: none; padding: 5px 12px; color: var(--ink-2); border-radius: 9px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 4px rgba(30, 20, 80, 0.12); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* --- Layout */
.page { max-width: 1280px; margin: 0 auto; padding: 24px 24px 64px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 30px; letter-spacing: -0.02em; margin: 0; }
.page-head .sub { color: var(--muted); font-size: 13px; margin: 2px 0 0; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--ring); border-radius: var(--radius); padding: 20px 22px; grid-column: span 12; min-width: 0; box-shadow: var(--shadow); }
.card.half { grid-column: span 6; }
.card.third { grid-column: span 4; }
@media (max-width: 960px) { .card.half, .card.third { grid-column: span 12; } }
.card-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { font-size: 15px; margin: 0; }
.card-head .sub { color: var(--muted); font-size: 12px; margin: 0; }
.card-head .end { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.empty { color: var(--muted); padding: 16px 0; font-size: 13px; }
.banner { background: color-mix(in srgb, var(--accent) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13px; color: var(--ink-2); margin-bottom: 16px; }
.err { color: var(--bad); font-size: 13px; }
.ok { color: var(--good); font-size: 13px; }
.loading .card .body { opacity: 0.5; transition: opacity 0.2s; }

/* --- Stat tiles */
.tiles { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); grid-column: span 12; }
.tile { background: var(--surface); border: 1px solid var(--ring); border-radius: var(--radius); padding: 18px 18px 12px; min-width: 0; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.tile::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--strip-1); }
.tile:nth-child(4n + 2)::before { background: var(--strip-2); }
.tile:nth-child(4n + 3)::before { background: var(--strip-3); }
.tile:nth-child(4n + 4)::before { background: var(--strip-4); }
.tile .label { color: var(--ink-2); font-size: 12px; }
.tile .value { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; margin-top: 2px; }
.tile .delta { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; min-height: 18px; }
.tile .delta .up, .tile .delta .down { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; }
.tile .delta .up { color: var(--good); background: var(--good-bg); }
.tile .delta .down { color: var(--bad); background: var(--bad-bg); }
.tile svg.spark { display: block; width: 100%; height: 36px; margin-top: 8px; overflow: visible; }

/* Report tabs */
.tabs { display: flex; gap: 4px; margin: -4px 0 18px; border-bottom: 1px solid var(--grid); overflow-x: auto; }
.tabs button { border: 0; background: none; border-radius: 0; padding: 10px 14px; color: var(--ink-2); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button:hover { background: none; color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--s1); }

/* What to look at: rule findings and Claude's read */
ul.look { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
ul.look li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 10px 0; border-top: 1px solid var(--grid); }
ul.look li:first-child { border-top: 0; }
ul.look .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; background: var(--muted); }
ul.look .look-bad .dot { background: var(--s2); }
ul.look .look-good .dot { background: var(--s3); }
ul.look .look-ai .dot { background: var(--s1); }
ul.look b { font-size: 14px; }
ul.look p { margin: 2px 0 0; font-size: 13px; color: var(--ink-2); }
ul.look button { font-size: 12px; padding: 4px 10px; }
.claude { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--grid); }
.claude h3 { margin: 0 0 4px; font-size: 13px; color: var(--s1); }
.claude .small { font-size: 12px; margin: 8px 0 0; }

/* Story: the period told in a sentence, on a dark card with two soft glows (dark in both modes) */
.story { grid-column: span 12; position: relative; overflow: hidden; border-radius: 22px; padding: 26px 30px; color: #fff;
  background: radial-gradient(420px 220px at 88% 0%, rgba(91, 91, 247, 0.5), transparent 70%),
    radial-gradient(360px 200px at 70% 110%, rgba(240, 103, 63, 0.35), transparent 70%), #1b1a2e;
  display: flex; flex-wrap: wrap; gap: 18px 36px; align-items: flex-end; justify-content: space-between; box-shadow: var(--shadow); }
@media (prefers-color-scheme: dark) { .story { background-color: #221f3d; border: 1px solid var(--ring-strong); } }
.story .kicker { margin: 0 0 8px; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: #c4c2da; }
.story h2 { margin: 0; font-size: clamp(22px, 3vw, 32px); line-height: 1.15; font-weight: 650; letter-spacing: -0.02em; max-width: 820px; }
.story p.more { margin: 10px 0 0; color: #c4c2da; font-size: 14px; max-width: 760px; }
.story .pills { display: flex; flex-wrap: wrap; gap: 8px; }
.story .pill { padding: 6px 13px; border-radius: 999px; font-size: 13px; font-weight: 600; background: rgba(255, 255, 255, 0.1); color: #eeedf8; }
.story .pill.up { background: rgba(95, 224, 165, 0.16); color: #5fe0a5; }
.story .pill.down { background: rgba(255, 143, 115, 0.16); color: #ff8f73; }

/* Live pulse: people right now, the last hour by minute and where they are */
.pulse-grid { display: grid; grid-template-columns: minmax(200px, 280px) minmax(0, 1fr); gap: 20px 40px; align-items: start; }
@media (max-width: 720px) { .pulse-grid { grid-template-columns: minmax(0, 1fr); } }
.pulse .live { display: flex; gap: 10px; align-items: center; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.pulse .beat { position: relative; width: 10px; height: 10px; border-radius: 50%; background: var(--s3); flex: none; }
.pulse .beat::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--s3); animation: beat 2.6s ease-out infinite; }
.pulse .beat.idle { background: var(--muted); }
.pulse .beat.idle::after { display: none; }
@keyframes beat { 0% { transform: scale(1); opacity: 0.6; } 80%, 100% { transform: scale(3); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pulse .beat::after { display: none; } }
.pulse .big { font-size: clamp(56px, 7vw, 88px); font-weight: 650; line-height: 0.95; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; margin: 10px 0 8px; }
.pulse .say { margin: 0; color: var(--ink-2); font-size: 14px; }
.pulse .plats { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.pulse .plats i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.pulse .plats b { font-variant-numeric: tabular-nums; }
.pulse .label { font-size: 12px; color: var(--muted); margin: 0 0 6px; }
.pulse .minutes { display: flex; align-items: flex-end; gap: 2px; height: 64px; }
.pulse .minutes span { flex: 1; min-height: 2px; border-radius: 2px; background: var(--seq-250); }
.pulse .minutes span.now { background: var(--s3); }
.pulse .axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }
.pulse .screens { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.pulse .scr { display: grid; grid-template-columns: minmax(70px, 150px) minmax(0, 1fr) auto; gap: 12px; align-items: center; font-size: 13px; }
.pulse .scr .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.pulse .scr .dots { display: flex; flex-wrap: wrap; gap: 4px; }
.pulse .scr .dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--s1); }
.pulse .scr b { font-variant-numeric: tabular-nums; }

/* Today as a clock: one petal per hour, an average day as a dashed line */
.clock-grid { display: grid; grid-template-columns: minmax(0, 420px) minmax(200px, 1fr); gap: 20px 40px; align-items: center; }
@media (max-width: 720px) { .clock-grid { grid-template-columns: minmax(0, 1fr); } }
.clock-face svg { display: block; width: 100%; height: auto; max-width: 420px; margin: 0 auto; }
.clock-face text.tick { font-size: 13px; font-weight: 600; fill: var(--ink-2); }
.clock-face text.small { font-size: 12px; fill: var(--muted); }
.clock-face text.time { font-size: 26px; font-weight: 650; fill: var(--ink); font-variant-numeric: tabular-nums; }
.clock-face .petal:hover { filter: brightness(1.12); }
.clock-side { display: flex; flex-direction: column; gap: 20px; }
.clock-side .stat span { display: block; font-size: 12px; color: var(--muted); }
.clock-side .stat b { display: block; font-size: 36px; font-weight: 650; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.clock-side .stat small { color: var(--ink-2); font-size: 13px; }
.clock-legend { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--ink-2); }
.clock-legend span { display: flex; align-items: center; gap: 8px; }
.clock-legend i { width: 14px; height: 14px; border-radius: 4px; flex: none; }

/* Weekly rhythm: weekday by hour, sequential cells */
.rhythm { display: grid; grid-template-columns: 34px repeat(24, minmax(12px, 1fr)); gap: 3px; min-width: 440px; }
.rhythm .d { font-size: 12px; color: var(--muted); align-self: center; }
.rhythm .h { font-size: 11px; color: var(--muted); text-align: center; }
.rhythm .c { height: 24px; border-radius: 5px; background: var(--surface-2); }
.rhythm-legend { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; margin-top: 12px; color: var(--ink-2); font-size: 13px; }
.rhythm-legend .scale { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.rhythm-legend .scale i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* --- Tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; font-size: 13px; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.scroll { overflow-x: auto; }
.meter { position: relative; min-width: 90px; }
.meter i { display: block; height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--seq-250), var(--seq-400)); }
.cell-name { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }

/* --- Charts */
.chart { position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart text { fill: var(--muted); font: 11px var(--font); font-variant-numeric: tabular-nums; }
.chart .lbl { fill: var(--ink-2); font-size: 12px; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-2); margin: -4px 0 10px; flex-wrap: wrap; }
.legend .key { display: inline-block; width: 14px; height: 2px; border-radius: 1px; vertical-align: middle; margin-right: 6px; }
details.table-view { margin-top: 10px; }
details.table-view summary { color: var(--muted); cursor: pointer; font-size: 12px; list-style: none; display: inline-flex; gap: 6px; align-items: center; }
details.table-view summary::-webkit-details-marker { display: none; }
details.table-view[open] summary { margin-bottom: 6px; }

/* Funnel: one horizontal bar per step, 4px rounded data end */
/* Retention curve with its half-life */
.ret-head { display: flex; gap: 12px 24px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-bottom: 8px; }
.ret-say { margin: 0; font-size: 14px; color: var(--ink-2); max-width: 640px; }
.ret-half { text-align: right; }
.ret-half b { display: block; font-size: 26px; font-weight: 650; letter-spacing: -0.02em; color: var(--s1); line-height: 1.1; }
.ret-half span { font-size: 12px; color: var(--muted); }
.ret-chart svg { display: block; width: 100%; }
.ret-chart text { font-size: 11px; fill: var(--muted); }
.ret-chart text.ret-mark { font-size: 12px; font-weight: 600; fill: var(--s1); }
.ret-chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.ret-chip { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.ret-chip span { display: block; font-size: 12px; color: var(--muted); }
.ret-chip b { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .ret-chips { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ret-half { text-align: left; } }

/* Last week as a story: headline, chapters with small pictures, one thing worth a look */
.week .wk-kicker { margin: 0 0 6px; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--s1); }
.week .wk-headline { margin: 0 0 16px; font-size: clamp(20px, 2.4vw, 26px); line-height: 1.2; font-weight: 650; letter-spacing: -0.02em; max-width: 820px; }
.wk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.wk-ch { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.wk-ch b { font-size: 15px; font-weight: 650; }
.wk-ch p { margin: 0; font-size: 13px; color: var(--ink-2); }
.wk-bars { display: flex; align-items: flex-end; gap: 4px; height: 56px; margin-bottom: 8px; }
.wk-bars span { flex: 1; position: relative; border-radius: 4px 4px 2px 2px; background: var(--seq-250); min-height: 4px; }
.wk-bars span.top { background: var(--s2); }
.wk-bars i { position: absolute; bottom: -16px; left: 0; right: 0; text-align: center; font-style: normal; font-size: 10px; color: var(--muted); }
.wk-best .wk-bars { margin-bottom: 20px; }
.wk-ring { width: 56px; height: 56px; margin-bottom: 6px; }
.wk-share { height: 10px; border-radius: 5px; background: var(--seq-100); overflow: hidden; margin: 6px 0 10px; }
.wk-share span { display: block; height: 100%; background: var(--s1); border-radius: 5px; }
.wk-worth { display: flex; gap: 14px; align-items: flex-start; margin-top: 14px; padding: 14px 16px; border-radius: var(--radius-sm); border: 1px solid var(--bad-bg); }
.wk-worth .wk-icon { flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--bad-bg); color: var(--bad); display: flex; align-items: center; justify-content: center; }
.wk-worth b { font-size: 14px; }
.wk-worth p { margin: 2px 0 0; font-size: 13px; color: var(--ink-2); }

/* How people move: metro lines between screen stations */
.metro-head { display: flex; gap: 10px 20px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-bottom: 8px; }
.metro-say { margin: 0; font-size: 14px; color: var(--ink-2); max-width: 720px; }
.pill-bad { padding: 5px 12px; border-radius: 999px; background: var(--bad-bg); color: var(--bad); font-weight: 600; font-size: 13px; white-space: nowrap; }
.metro svg { display: block; min-width: 640px; width: 100%; }
.metro text.col { font-size: 11px; fill: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
.metro text.name { font-size: 12px; font-weight: 600; fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.metro text.n { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; }
.metro .stn { cursor: default; }
.metro-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--ink-2); margin-top: 6px; }
.metro-legend span { display: flex; align-items: center; gap: 6px; }
.metro-legend i { width: 18px; height: 6px; border-radius: 3px; }

/* Funnel as a river: width is people at each step; step columns under the river line up with it */
.river-note { margin: 0 0 12px; font-size: 13px; color: var(--ink-2); }
.river-note b { color: var(--ink); font-weight: 600; }
.river svg { display: block; width: 100%; height: 130px; }
.river .steps { display: grid; gap: 6px; margin-top: 8px; }
.river .step { min-width: 0; padding: 6px 8px; border-radius: var(--radius-sm); text-align: center; }
.river .step:hover, .river .step:focus-visible { background: var(--surface-2); outline: none; }
.river .step .name { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.river .step .n { font-size: 20px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.river .step .loss { font-size: 12px; font-weight: 600; color: var(--muted); }
.river .step .loss.worst { color: var(--bad); }
.river-inner { min-width: var(--min); }
@media (max-width: 640px) {
  .river-inner { min-width: 0; }
  .river svg { height: 96px; }
  .river .steps { grid-template-columns: minmax(0, 1fr) !important; gap: 0; }
  .river .step { display: grid; grid-template-columns: minmax(0, 1fr) auto 76px; gap: 12px; align-items: baseline; text-align: left; padding: 8px 4px; border-top: 1px solid var(--grid); border-radius: 0; }
  .river .step .name { font-size: 13px; color: var(--ink-2); }
  .river .step .n { font-size: 15px; }
  .river .step .loss { text-align: right; }
}

/* Retention heat cells */
td.heat { text-align: center; font-variant-numeric: tabular-nums; border-bottom: 2px solid var(--surface); border-left: 2px solid var(--surface); border-radius: 4px; }

/* Tooltip */
#tip { position: fixed; pointer-events: none; background: var(--surface); color: var(--ink); border: 1px solid var(--ring-strong); box-shadow: 0 10px 30px rgba(40, 30, 110, 0.18); padding: 9px 11px; border-radius: 12px; font-size: 12px; line-height: 1.55; display: none; z-index: 20; min-width: 120px; }
#tip .t-head { color: var(--muted); margin-bottom: 2px; }
#tip .t-row { display: flex; align-items: center; gap: 8px; }
#tip .t-row b { font-weight: 600; font-variant-numeric: tabular-nums; }
#tip .t-row .key { width: 12px; height: 2px; border-radius: 1px; }
#tip .t-row span { color: var(--ink-2); }

/* --- Forms in cards */
.form-grid { display: grid; gap: 10px; max-width: 520px; }
.field { display: grid; gap: 4px; }
.hint { color: var(--muted); font-size: 12px; }

/* --- Auth pages */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth main { width: 100%; max-width: 380px; }
.auth .brand { margin: 0 0 22px; justify-content: center; }
.auth .panel { background: var(--surface); border: 1px solid var(--ring); border-radius: 22px; padding: 30px; box-shadow: var(--shadow); }
.auth h1 { font-size: 20px; margin: 0 0 18px; }
.auth form { display: grid; gap: 12px; }
.auth input { width: 100%; padding: 9px 11px; font-size: 14px; }
.auth button.primary, .auth .btn.wide { width: 100%; justify-content: center; padding: 9px; font-size: 14px; }
.auth .or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 14px 0; }
.auth .or::before, .auth .or::after { content: ""; height: 1px; background: var(--grid); flex: 1; }
.auth .providers { display: grid; gap: 8px; }
.auth .links { margin-top: 16px; font-size: 13px; color: var(--ink-2); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.auth .msg { margin: 12px 0 0; font-size: 13px; }
.auth footer { margin-top: 18px; display: flex; gap: 14px; justify-content: center; font-size: 12px; }
.auth footer a { color: var(--muted); }

/* --- Long-form (legal) */
.prose { max-width: 720px; margin: 0 auto; padding: 32px 24px 80px; font-size: 15px; line-height: 1.65; }
.prose h1 { font-size: 34px; letter-spacing: -0.02em; margin: 8px 0 4px; }
.prose h2 { font-size: 18px; margin: 36px 0 8px; }
.prose h3 { font-size: 15px; margin: 22px 0 4px; }
.prose p, .prose li { color: var(--ink-2); }
.prose table td, .prose table th { white-space: normal; vertical-align: top; font-size: 14px; }
