:root {
  --paper: #EEF1F6;
  --sheet: #F8F9FC;
  --ink: #1E2240;
  --ink-2: #5B6283;
  --rule: #CDD3E3;
  --accent: #3A3FB8;
  --accent-soft: #DDE0F7;
  --gain: #1F7A4D;
  --loss: #C2412D;
  --bench-1: #8A6D1F;
  --bench-2: #2F7F8F;
  --bench-3: #9A4F86;
  --bench-4: #6B7280;
  --display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --text: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14172B; --sheet: #1B1F38; --ink: #E6E8F2; --ink-2: #A3A9C6; --rule: #2E3456;
    --accent: #9EA3FF; --accent-soft: #2A2F5C; --gain: #5BC48C; --loss: #F07A63;
    --bench-1: #D9B65A; --bench-2: #6CC3D3; --bench-3: #D88CC4; --bench-4: #9CA3AF;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 15px/1.5 var(--text); font-variant-numeric: tabular-nums;
}
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* header */
.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--rule); }
.top-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-top: max(10px, env(safe-area-inset-top)); }
.brand { font: 700 18px/1.2 var(--display); margin: 0; letter-spacing: -0.01em; }
.status { margin: 0; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.status .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-2); margin-right: 6px; vertical-align: 1px; }
.status .dot.live { background: var(--gain); box-shadow: 0 0 0 0 var(--gain); animation: pulse 2s ease-out 3; }
@keyframes pulse { to { box-shadow: 0 0 0 7px transparent; } }
@media (prefers-reduced-motion: reduce) { .status .dot.live { animation: none; } }

.accounts { display: flex; gap: 6px; padding: 10px 0 12px; overflow-x: auto; scrollbar-width: none; }
.accounts button {
  border: 1px solid var(--rule); background: transparent; padding: 6px 14px; border-radius: 999px;
  font-weight: 500; white-space: nowrap; cursor: pointer;
}
.accounts button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* hero sentence: the one loud thing on the page */
.hero { padding: 28px 0 20px; }
.hero-text { font: 500 clamp(26px, 6vw, 44px)/1.15 var(--display); letter-spacing: -0.02em; margin: 0; max-width: 28ch; text-wrap: balance; }
.hero-text .up { color: var(--gain); }
.hero-text .down { color: var(--loss); }
.hero-sub { margin: 12px 0 0; color: var(--ink-2); max-width: 60ch; }

/* key figures as a ruled grid, not a pile of cards */
.figures { display: grid; grid-template-columns: repeat(2, 1fr); margin: 0 0 28px; border-top: 1px solid var(--rule); }
@media (min-width: 640px) { .figures { grid-template-columns: repeat(4, 1fr); } }
.figures div { padding: 12px 12px 12px 0; border-bottom: 1px solid var(--rule); }
.figures dt { font-size: 13px; color: var(--ink-2); }
.figures dd { margin: 2px 0 0; font: 500 20px/1.25 var(--text); }
.figures dd small { display: block; font-size: 12px; font-weight: 400; color: var(--ink-2); }

/* tabs */
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--rule); margin-bottom: 18px; }
.tabs button { border: 0; background: none; padding: 10px 12px; cursor: pointer; color: var(--ink-2); font-weight: 500; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }

.panel { min-height: 240px; }
.panel h2 { font: 700 20px/1.3 var(--display); margin: 26px 0 8px; letter-spacing: -0.01em; }
.panel h2:first-child { margin-top: 4px; }
.panel p.lead { color: var(--ink-2); margin: 0 0 14px; max-width: 70ch; }

/* tables */
.table-scroll { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 10px 9px 0; text-align: right; border-bottom: 1px solid var(--rule); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; white-space: normal; min-width: 150px; }
th { font-weight: 500; color: var(--ink-2); font-size: 12.5px; position: sticky; top: 0; background: var(--paper); }
th[data-sort] { cursor: pointer; }
th[data-sort]:hover { color: var(--ink); }
td .sub { display: block; font-size: 12px; color: var(--ink-2); }
tfoot td { font-weight: 600; border-bottom: 0; }
.gain { color: var(--gain); }
.loss { color: var(--loss); }
.muted { color: var(--ink-2); }
.tag { display: inline-block; font-size: 11.5px; padding: 1px 7px; border-radius: 4px; background: var(--accent-soft); color: var(--ink); margin-left: 6px; vertical-align: 1px; }

/* charts */
.chart { position: relative; height: 300px; margin: 6px 0 8px; }
@media (min-width: 720px) { .chart { height: 360px; } }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--ink-2); margin: 0 0 6px; }
.legend label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }

.bars { display: grid; gap: 8px; margin: 8px 0 4px; max-width: 640px; }
.bar { display: grid; grid-template-columns: 110px 1fr 90px; align-items: center; gap: 10px; font-size: 14px; }
.bar span:last-child { text-align: right; }
.bar .track { display: block; height: 10px; background: var(--accent-soft); border-radius: 5px; overflow: hidden; }
.bar .fill { display: block; height: 100%; background: var(--accent); border-radius: 5px; }

.split { display: grid; gap: 8px 32px; }
@media (min-width: 820px) { .split { grid-template-columns: 1fr 1fr; } }

.controls { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; font-size: 13.5px; color: var(--ink-2); margin: 4px 0 10px; }
.controls input { width: 64px; font: inherit; color: var(--ink); background: var(--sheet); border: 1px solid var(--rule); border-radius: 6px; padding: 3px 6px; }

.notes { margin: 40px 0 calc(40px + env(safe-area-inset-bottom)); padding-top: 14px; border-top: 1px solid var(--rule); color: var(--ink-2); font-size: 13px; }
.notes p { margin: 0 0 6px; max-width: 80ch; }
.error { padding: 14px 16px; border: 1px solid var(--loss); border-radius: 8px; color: var(--loss); }
