:root {
  color-scheme: light;
  --page: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f4f1;
  --border: rgba(11, 11, 11, 0.12);
  --grid: #e1e0d9;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #898781;
  --accent: #2a78d6;
  --up: #006300;
  --down: #c62f2f;
  /* Stance: diverging blue (bullish) <-> red (bearish) with a gray midpoint */
  --s-n2: #c93434;
  --s-n1: #f0a09f;
  --s-0: #e1e0d9;
  --s-p1: #86b6ef;
  --s-p2: #2a78d6;
  --s-ink-strong: #ffffff;
  --s-ink-soft: #0b0b0b;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);
  --radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--page); color: var(--text); font-size: 14px; line-height: 1.5; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.up { color: var(--up); }
.down { color: var(--down); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.logo {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  background: var(--accent); color: #fff; font-weight: 800; font-size: 15px; letter-spacing: -0.04em;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 17px; letter-spacing: -0.01em; }
.brand-text small { color: var(--muted); font-size: 11px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: var(--text-2); padding: 6px 12px; border-radius: 8px; font-weight: 550; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--surface-2); color: var(--text); }
.status { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-2); font-size: 12px; white-space: nowrap;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.dot.live { background: #0ca30c; box-shadow: 0 0 0 3px rgba(12, 163, 12, 0.18); }
.dot.warn { background: #fab219; }

/* ---------- Layout ---------- */
.page { max-width: 1320px; margin: 0 auto; padding: 24px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 6px 0 0; color: var(--text-2); max-width: 760px; }
.section { margin: 28px 0 12px; display: flex; align-items: baseline; gap: 12px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px;
}
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.two-col { display: grid; gap: 16px; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.footer { max-width: 1320px; margin: 24px auto 40px; padding: 0 24px; color: var(--muted); font-size: 12px; }
.btn {
  appearance: none; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 8px 14px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); color: #fff; border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 2px; }
.seg button { border: 0; background: none; color: var(--text-2); padding: 4px 10px; border-radius: 6px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- Market tiles ---------- */
.tile { display: flex; flex-direction: column; gap: 10px; color: var(--text); transition: border-color .15s; }
.tile:hover { text-decoration: none; border-color: var(--accent); }
.tile-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.tile-name { font-weight: 650; }
.tile-sym { color: var(--muted); font-size: 12px; }
.tile-price { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; }
.tile-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; }
.spark { display: block; }
.spark path { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linejoin: round; }
.spark .area { fill: var(--accent); opacity: 0.08; stroke: none; }

/* ---------- Stance ---------- */
.stance {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 650; white-space: nowrap;
}
.st-n2 { background: var(--s-n2); color: var(--s-ink-strong); }
.st-n1 { background: var(--s-n1); color: var(--s-ink-soft); }
.st-0 { background: var(--s-0); color: var(--s-ink-soft); }
.st-p1 { background: var(--s-p1); color: var(--s-ink-soft); }
.st-p2 { background: var(--s-p2); color: var(--s-ink-strong); }
.cbar { display: flex; gap: 2px; height: 8px; border-radius: 4px; overflow: hidden; background: var(--surface-2); }
.cbar span { display: block; height: 100%; }
.cbar-legend { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }
.conv { display: inline-flex; gap: 2px; vertical-align: middle; }
.conv i { width: 6px; height: 6px; border-radius: 50%; background: var(--grid); }
.conv i.on { background: var(--text-2); }

/* ---------- Investor panel (heatmap) ---------- */
.panel-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 24px; flex-wrap: wrap; margin-bottom: 10px; }
.panel-head p { margin: 4px 0 0; }
.matrix-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 8px 8px 0; margin-bottom: 8px; }
.matrix { border-collapse: separate; border-spacing: 2px; }
.matrix th { font-weight: 550; color: var(--text-2); background: var(--surface); }
.matrix th.cat { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); text-align: left; padding: 10px 4px 2px; position: sticky; left: 0; }
.matrix tr.cat-row:first-child th.cat { padding-top: 2px; }
.matrix th.row { position: sticky; left: 0; z-index: 1; text-align: left; padding: 0 12px 0 4px; white-space: nowrap; font-size: 13px; }
.matrix td.cell { width: 24px; height: 24px; min-width: 24px; border-radius: 5px; text-align: center; font-size: 10px; cursor: pointer; padding: 0; }
.matrix td.cell.empty { background: var(--surface-2); cursor: default; }
.matrix td.cell:not(.empty):hover { outline: 2px solid var(--text); }
.matrix td.consensus-col { box-shadow: -6px 0 0 var(--surface); position: relative; left: 4px; }
/* Investor names along the bottom, angled 45 degrees for easy reading */
.matrix tfoot th.xlab { height: 150px; vertical-align: top; position: relative; padding: 0; min-width: 24px; }
.matrix tfoot th.xlab > a, .matrix tfoot th.xlab > span {
  position: absolute; top: 6px; right: 50%; transform-origin: right top; transform: rotate(-45deg);
  white-space: nowrap; font-size: 12px; font-weight: 500; color: var(--text-2);
}
.matrix tfoot th.xlab > a:hover { color: var(--accent); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--text-2); }
.legend span.sw { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -3px; margin-right: 5px; }

/* ---------- Topic page ---------- */
.price-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-top: 8px; }
.price-big { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; }
.chart { height: 380px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-top: 14px; }
.stat .k { color: var(--muted); font-size: 12px; }
.stat .v { font-size: 16px; font-weight: 600; }
.view { display: flex; flex-direction: column; gap: 8px; }
.view-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.view ul { margin: 0; padding-left: 18px; color: var(--text-2); }
.view li { margin: 2px 0; }
.view .meta { display: flex; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 12px; align-items: center; }
.kv { color: var(--text-2); }
.kv b { color: var(--text); font-weight: 600; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); }

/* ---------- Investor pages ---------- */
.inv-card { display: flex; flex-direction: column; gap: 10px; color: var(--text); }
.inv-card:hover { text-decoration: none; border-color: var(--accent); }
.inv-card p { margin: 0; color: var(--text-2); font-size: 13px; }
.vtable { width: 100%; border-collapse: collapse; }
.vtable td, .vtable th { padding: 9px 8px; border-bottom: 1px solid var(--grid); text-align: left; vertical-align: top; }
.vtable th { font-size: 12px; color: var(--muted); font-weight: 550; }
.vtable tr.detail td { background: var(--surface-2); }
.vtable tr.row { cursor: pointer; }
.vtable tr.row:hover td { background: var(--surface-2); }
details.box { margin-top: 12px; }
details.box summary { cursor: pointer; font-weight: 650; padding: 4px 0; }
details.box ul { color: var(--text-2); padding-left: 18px; }
details.box li { margin: 4px 0; }

/* ---------- Settings ---------- */
.form { display: grid; gap: 14px; max-width: 640px; }
.form label { display: grid; gap: 6px; font-weight: 600; }
.form select, .form input {
  font: inherit; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
}
.radio-list { display: grid; gap: 8px; }
.radio-list label { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.radio-list label:has(input:checked) { border-color: var(--accent); }
.progress { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); transition: width .4s; }
.note { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); color: var(--text-2); font-size: 13px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

/* ---------- Tooltip ---------- */
.tooltip {
  position: fixed; z-index: 50; pointer-events: none; max-width: 300px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16); padding: 10px 12px; font-size: 12px;
}
.tooltip .t-title { font-weight: 650; margin-bottom: 4px; }

@media (max-width: 640px) {
  .topbar { padding: 10px 16px; gap: 10px; }
  .page { padding: 16px; }
  .status { margin-left: 0; }
}
.tile-chg { white-space: nowrap; color: var(--text-2); }
.vtable { table-layout: fixed; }
.stat-head { margin: 18px 0 0; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.stat-head + .stats { margin-top: 8px; }

/* ---------- Disclaimer ---------- */
.disclaimer-bar { background: var(--surface-2); border-bottom: 1px solid var(--border); }
.disclaimer-inner { max-width: 1320px; margin: 0 auto; padding: 10px 24px; display: flex; gap: 10px; align-items: flex-start; }
.disclaimer-inner p { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.5; }
.disclaimer-inner strong { color: var(--text); }
.disc-icon { color: #b57d00; font-size: 15px; line-height: 1.3; }
.sim-tag { font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-2); }
.prose { max-width: 820px; }
.prose h2 { margin: 22px 0 6px; }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose li { color: var(--text-2); font-size: 14px; line-height: 1.6; }
.prose ul { padding-left: 20px; }
@media (max-width: 640px) { .disclaimer-inner { padding: 10px 16px; } }

/* ---------- Fundamental catalysts ---------- */
.stack { display: grid; gap: 16px; min-width: 0; }
.catalysts { list-style: none; margin: 10px 0 0; padding: 0; display: grid; }
.catalysts li { display: grid; grid-template-columns: 116px minmax(0, 1fr) auto; gap: 4px 12px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--grid); }
.catalysts li:first-child { border-top: 0; }
.c-date { color: var(--muted); font-size: 12px; white-space: nowrap; }
.catalysts li.upcoming .c-date { color: var(--accent); font-weight: 600; }
.c-text { font-size: 14px; color: var(--text); }
.c-meta { display: flex; gap: 8px; align-items: center; font-size: 12px; white-space: nowrap; }
@media (max-width: 640px) {
  .catalysts li { grid-template-columns: 1fr; }
}

/* ---------- Disclaimer lines ---------- */
.disc-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: 13px; color: var(--text-2); line-height: 1.45; }
.disc-lines strong { color: var(--text); }
/* The bottom-left corner stays transparent so the first angled investor names aren't covered */
.matrix tfoot th.row { position: static; background: transparent; }
.matrix tfoot th.xlab { z-index: 2; }
.c-up { display: block; font-size: 11px; font-weight: 600; color: var(--accent); }
.panel-block { margin-top: 28px; }
.spark-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.spark-label { font-size: 10px; color: var(--muted); letter-spacing: 0.04em; }

/* ---------- Language switcher ---------- */
.seg.lang button { min-width: 40px; }
.topbar .status { margin-left: auto; }
.topbar .lang { flex: none; }
.refresh-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
