:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #1c1c1a;
  --muted: #6b6b66;
  --grid: #e6e6e1;
  --reference: #a9a9a2;
  --border: #e2e2dc;
  --s1: #2f6fdb;
  --s2: #d9622b;
  --s3: #1f9e74;
  --s4: #b0399a;
  --s5: #c49a0c;
  --total: #1c1c1a;
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141413;
    --surface: #1e1e1c;
    --text: #ececea;
    --muted: #a3a39d;
    --grid: #2f2f2c;
    --reference: #5c5c57;
    --border: #2f2f2c;
    --s1: #6b9bf0;
    --s2: #f08a55;
    --s3: #3fc496;
    --s4: #d86cc3;
    --s5: #e3bb3a;
    --total: #ececea;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.5; }
main, .page-head, .page-foot { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

.page-head { padding-top: 40px; padding-bottom: 8px; }
.eyebrow { margin: 0; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
h1 { margin: 4px 0 8px; font-size: 32px; font-weight: 650; }
.lede { margin: 0; color: var(--muted); max-width: 70ch; }
h2 { margin: 0; font-size: 18px; font-weight: 600; }
.hint { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 24px 0; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; border-top: 4px solid var(--c); }
.tile .name { font-size: 13px; color: var(--muted); }
.tile .value { font-size: 26px; font-weight: 650; font-variant-numeric: tabular-nums; }
.tile .sub { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.panel-head { margin-bottom: 12px; }

.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart .gridline { stroke: var(--grid); }
.chart .ref { stroke: var(--reference); stroke-dasharray: 4 3; }
.chart .crosshair { stroke: var(--reference); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 12px; }
.legend button {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px;
  border: 1px solid var(--border); border-radius: 999px; background: transparent;
  color: var(--text); font: inherit; font-size: 14px; cursor: pointer;
}
.legend button[aria-pressed="false"] { opacity: .4; }
.legend .swatch { width: 12px; height: 12px; border-radius: 3px; background: var(--c); }
.legend .end { color: var(--muted); font-variant-numeric: tabular-nums; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.card { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.card h3 { margin: 0 0 2px; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card h3::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.card .meta { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.card .tickers { margin: 8px 0 0; font-size: 12px; color: var(--muted); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-weight: 600; color: var(--muted); font-size: 13px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
td .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); margin-right: 6px; }

.tooltip {
  position: fixed; z-index: 10; pointer-events: none; min-width: 180px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; font-size: 13px; box-shadow: 0 6px 20px rgb(0 0 0 / .15);
}
.tooltip .t-head { font-weight: 600; margin-bottom: 4px; }
.tooltip .t-row { display: flex; justify-content: space-between; gap: 16px; font-variant-numeric: tabular-nums; }
.tooltip .t-row span:first-child::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--c); margin-right: 6px; }

.page-foot { padding-top: 8px; padding-bottom: 48px; color: var(--muted); font-size: 13px; }
.page-foot p { max-width: 80ch; }
.error { color: #c0392b; }
