/* Dark trading-desk theme. One theme only; colours are tokens so charts and UI stay in step. */
:root {
  color-scheme: dark;
  --page: #0a0d12;
  --surface: #11151c;
  --surface-2: #171c25;
  --text: #e8ebf0;
  --text-2: #8d96a7;
  --grid: #1f2530;
  --axis: #3a4252;
  --border: rgba(255, 255, 255, 0.08);
  --hover: rgba(255, 255, 255, 0.045);
  --up: #2ebd85;
  --down: #f6465d;
  --good: #0aac23;
  --warning: #fbb315;
  --critical: #dc3c3d;
  --neutral: #5c6577;
  --accent: #338ced;
  /* categorical series, fixed order (validated for colour-blind separation on --surface) */
  --s1: #338ced; --s2: #e76624; --s3: #00a888; --s4: #d28e05;
  --s5: #e24d8b; --s6: #0aac23; --s7: #9887ef; --s8: #eb6263;
  --track: #1b3f6e;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--page); }
body { margin: 0; background: var(--page); color: var(--text); font: 13.5px/1.45 system-ui, -apple-system, "Segoe UI", Inter, sans-serif; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-2); }
a { color: inherit; }
.muted { color: var(--text-2); }
.pad { padding: 48px 24px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.up { color: var(--up); }
.down { color: var(--down); }
.link { color: var(--text-2); text-decoration: none; font-size: 12.5px; }
.link:hover { color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: rgba(51, 140, 237, 0.35); }

/* ---- shell ---- */
.shell { display: grid; grid-template-columns: 200px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; padding: 16px 10px; background: var(--surface); border-right: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; text-decoration: none; padding: 4px 10px 16px; }
.brand img { border-radius: 6px; }
#nav { display: flex; flex-direction: column; gap: 2px; }
#nav a { padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--text-2); border-left: 2px solid transparent; }
#nav a:hover { background: var(--hover); color: var(--text); }
#nav a[aria-current="page"] { background: var(--surface-2); color: var(--text); font-weight: 600; border-left-color: var(--accent); border-radius: 0 8px 8px 0; }
.side-foot { margin-top: auto; padding: 8px 10px; color: var(--text-2); text-decoration: none; font-size: 12.5px; }
.side-foot:hover { color: var(--text); }

.bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 10px 24px; background: rgba(10, 13, 18, 0.88); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.ticker { display: flex; gap: 28px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.stat { display: flex; flex-direction: column; line-height: 1.25; }
.stat span:first-child { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; }
.stat span:last-child { font-family: var(--mono); font-size: 13.5px; font-weight: 600; }
.bar-actions { display: flex; align-items: center; gap: 12px; font-size: 12.5px; }

#view { max-width: 1440px; padding: 20px 24px 48px; display: grid; gap: 14px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; padding: 8px 12px; gap: 8px; border-right: 0; border-bottom: 1px solid var(--border); overflow-x: auto; }
  .brand { padding: 4px 6px; }
  .brand span { display: none; }
  #nav { flex-direction: row; }
  #nav a, #nav a[aria-current="page"] { border-left: 0; border-radius: 8px; white-space: nowrap; padding: 6px 10px; }
  .side-foot { margin: 0 0 0 auto; white-space: nowrap; }
  .bar { padding: 10px 16px; position: static; }
  .ticker { gap: 18px; }
  #asof { display: none; }
  #view { padding: 14px 16px 40px; }
}

/* ---- building blocks ---- */
.btn { font: inherit; font-size: 12.5px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px; padding: 6px 12px; cursor: pointer; text-decoration: none; line-height: 1.3; display: inline-block; }
.btn:hover { background: #1e2531; }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; font-weight: 600; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 18px 18px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; min-height: 26px; }
.grid.two { display: grid; gap: 14px; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
@media (max-width: 1100px) { .grid.two { grid-template-columns: minmax(0, 1fr); } }

.hero { display: flex; gap: 28px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; padding: 6px 2px 4px; }
.label { color: var(--text-2); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; }
.hero-value { font-size: 50px; font-weight: 600; line-height: 1.1; letter-spacing: -0.02em; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; flex: 1 1 560px; min-width: 0; max-width: 820px; }
.tile { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px 12px; }
.tile .value { font-family: var(--mono); font-size: 18px; font-weight: 600; margin-top: 4px; }
.tile .delta { font-size: 12px; margin-top: 2px; font-variant-numeric: tabular-nums; }
@media (max-width: 700px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); flex-basis: 100%; } .hero-value { font-size: 38px; } .hero { gap: 14px; } }

.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; background: var(--page); }
.seg button { font: inherit; font-size: 12px; color: var(--text-2); background: none; border: 0; padding: 4px 10px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface-2); color: var(--text); font-weight: 600; }

.chart { position: relative; min-height: 240px; }
.chart svg, .range-plot svg { display: block; width: 100%; overflow: visible; }
.chart text, .range-plot text { fill: var(--text-2); font-size: 11px; font-variant-numeric: tabular-nums; }
.range-plot .name { fill: var(--text); font-size: 12.5px; font-weight: 600; font-family: var(--mono); }
.range-plot .strong { fill: var(--text); }
.empty { color: var(--text-2); padding: 36px 8px; text-align: center; }
.key { display: flex; gap: 16px; flex-wrap: wrap; color: var(--text-2); font-size: 12px; margin-top: 10px; }
.key span { display: inline-flex; align-items: center; gap: 6px; }
.key i { width: 14px; height: 2px; border-radius: 1px; display: inline-block; }

.segbar { display: flex; gap: 2px; height: 28px; margin-bottom: 12px; }
.segbar > div { border-radius: 4px; min-width: 2px; color: #fff; font-size: 12px; font-weight: 600; padding: 0 6px; line-height: 28px; white-space: nowrap; }
.legend { display: grid; gap: 1px; }
.legend-row { display: grid; grid-template-columns: 14px 1fr auto auto; gap: 8px; align-items: center; padding: 4px 6px; border-radius: 6px; }
.legend-row:hover { background: var(--hover); }
.legend-row .num:last-child { font-family: var(--mono); font-size: 12.5px; min-width: 84px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; margin: 0 -8px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 7px 8px; text-align: left; border-bottom: 1px solid var(--grid); white-space: nowrap; }
th { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-2); user-select: none; }
th.sortable { cursor: pointer; }
th.sortable:hover { color: var(--text); }
td.num { font-family: var(--mono); font-size: 12.5px; }
td.wrap { white-space: normal; min-width: 240px; max-width: 420px; font-size: 12.5px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: var(--hover); }
tfoot td { font-weight: 600; border-top: 1px solid var(--axis); border-bottom: 0; }
.sym { font-weight: 600; font-family: var(--mono); font-size: 12.5px; }
.sub { color: var(--text-2); font-size: 11.5px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: system-ui, sans-serif; }
.pill { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 999px; padding: 1px 8px; font-size: 11.5px; white-space: nowrap; font-family: system-ui, sans-serif; }
.pill.gap { margin-left: 8px; }
.pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--neutral); }
.pill.buy i, .pill.accumulate i { background: var(--good); }
.pill.trim i, .pill.sell i { background: var(--critical); }
.pill.hold i, .pill.watch i { background: var(--warning); }
.meter { height: 4px; border-radius: 2px; background: var(--track); width: 56px; display: inline-block; vertical-align: middle; margin-left: 8px; }
.meter > i { display: block; height: 100%; border-radius: 2px; background: var(--s1); }

.tooltip { position: fixed; z-index: 50; pointer-events: none; background: #1b212c; color: var(--text); border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 8px; padding: 8px 10px; font-size: 12px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5); max-width: 280px; }
.tooltip .t-title { font-weight: 600; margin-bottom: 2px; }
.tooltip .t-row { display: flex; justify-content: space-between; gap: 16px; font-variant-numeric: tabular-nums; }
.tooltip .t-row span:first-child { color: var(--text-2); }

.banner { border: 1px solid var(--border); border-left: 3px solid var(--warning); background: var(--surface); border-radius: 8px; padding: 8px 12px; }

/* ---- detail pages ---- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; padding: 2px 2px 4px; }
.page-head h1 { margin: 6px 0 2px; }
.page-head h1 .muted { font-weight: 400; font-size: 16px; }
.quote { text-align: right; font-variant-numeric: tabular-nums; }
.quote-price { font-family: var(--mono); font-size: 26px; font-weight: 600; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px 18px; padding: 14px 18px; }
.facts.stack { grid-template-columns: 1fr 1fr; }
.fact .value { font-family: var(--mono); font-size: 14.5px; font-weight: 600; margin-top: 3px; }
.prose-plain { max-width: 80ch; display: grid; gap: 10px; white-space: pre-wrap; font-size: 14px; line-height: 1.6; }
.prose-plain h3 { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-2); font-weight: 600; }

.sym.plain { font-family: system-ui, sans-serif; font-size: 13.5px; }
.sub.note { color: #b9c0cd; max-width: 420px; }
.note-edit { display: grid; gap: 6px; max-width: 720px; }
.note-edit + .note-edit { margin-top: 14px; }
.note-edit textarea { font: inherit; color: var(--text); background: var(--page); border: 1px solid var(--axis); border-radius: 8px; padding: 8px 10px; resize: vertical; width: 100%; }
.note-actions { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }

.pick { display: inline-flex; align-items: center; gap: 6px; }
.pick select { font: inherit; font-size: 12.5px; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px; padding: 5px 8px; }
.tiles.wide { max-width: none; flex: none; }
.caption { color: var(--text-2); font-size: 12.5px; max-width: 90ch; margin-top: 12px; }

/* ---- report reader ---- */
.reader { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 14px; align-items: start; }
.reader-side { position: sticky; top: 64px; display: grid; gap: 14px; }
.toc { display: grid; gap: 2px; max-height: 50vh; overflow-y: auto; }
.toc .label { margin-bottom: 6px; }
.toc a { color: var(--text-2); text-decoration: none; font-size: 12.5px; padding: 3px 0; }
.toc a:hover { color: var(--text); }
@media (max-width: 1100px) { .reader { grid-template-columns: minmax(0, 1fr); } .reader-side { position: static; order: -1; } .toc { display: none; } .facts.stack { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); } }

.report { max-width: 84ch; margin: 0 auto; padding: 14px 8px 24px; font-size: 15px; line-height: 1.7; color: #d5dae3; overflow-wrap: break-word; }
.report > :first-child { margin-top: 0; }
.report h1 { font-size: 28px; line-height: 1.25; color: var(--text); margin: 0 0 18px; letter-spacing: -0.015em; }
.report h2 { font-size: 20px; text-transform: none; letter-spacing: -0.005em; color: var(--text); margin: 40px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); scroll-margin-top: 72px; }
.report h3 { font-size: 16px; color: var(--text); margin: 28px 0 8px; scroll-margin-top: 72px; }
.report h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-2); margin: 22px 0 6px; }
.report p, .report ul, .report ol, .report blockquote, .report pre, .report .table-wrap { margin: 0 0 16px; }
.report ul, .report ol { padding-left: 22px; }
.report li { margin: 4px 0; }
.report li > ul, .report li > ol { margin: 4px 0 0; }
.report strong { color: var(--text); font-weight: 600; }
.report a { color: #6fb0f5; text-underline-offset: 2px; }
.report hr { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }
.report blockquote { border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 8px 8px 0; padding: 12px 16px; color: var(--text); }
.report blockquote > :last-child { margin-bottom: 0; }
.report code { font-family: var(--mono); font-size: 0.88em; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; }
.report pre { background: var(--page); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; overflow-x: auto; line-height: 1.5; }
.report pre code { background: none; border: 0; padding: 0; font-size: 12.5px; }
.report .table-wrap { margin-left: 0; margin-right: 0; border: 1px solid var(--border); border-radius: 8px; }
.report table { font-size: 13px; line-height: 1.45; }
.report th { background: var(--surface-2); color: var(--text); text-transform: none; letter-spacing: 0; font-size: 12.5px; padding: 8px 12px; }
.report td { padding: 7px 12px; white-space: normal; font-variant-numeric: tabular-nums; }
.report td[align="right"], .report th[align="right"] { text-align: right; }
.report td:first-child { min-width: 130px; }
.report td { min-width: 90px; vertical-align: top; }
.report td[align="center"], .report th[align="center"] { text-align: center; }
.report tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.02); }
.report input[type="checkbox"] { margin-right: 6px; }

/* ---- login (only used when Cloudflare Access is not configured) ---- */
body.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(340px, 100%); display: grid; gap: 10px; padding: 28px; }
.login-card h1 { font-size: 20px; margin-bottom: 8px; }
.login-card label { font-size: 12.5px; color: var(--text-2); }
.login-card input { font: inherit; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--axis); background: var(--page); color: var(--text); }
.login-card .error { color: var(--down); font-size: 13px; }
.login-card .btn { padding: 9px 12px; margin-top: 6px; text-align: center; }

/* ---- public share site ---- */
.reader-main { display: grid; gap: 14px; min-width: 0; }
.section-intro { margin: 0 0 12px; max-width: 80ch; }
.summary { padding: 4px 4px 2px; max-width: 84ch; }
.summary + .summary { margin-top: 14px; }
.summary p { margin: 4px 0 0; line-height: 1.6; }
.disclaimer { font-size: 12.5px; padding: 0 2px; }
