/* ===== Themes ===== */
:root, :root[data-theme="midnight"] {
  --bg: #0e1116; --panel: #161b22; --panel2: #1c2230; --line: #2a3140;
  --text: #e6edf3; --muted: #8b96a5; --accent: #4c9aff; --oncolor: #06122a;
  --up: #3fb950; --down: #f85149; --flat: #d29922;
}
:root[data-theme="carbon"] {
  --bg: #101011; --panel: #191919; --panel2: #212123; --line: #333336;
  --text: #ededed; --muted: #9a9a9e; --accent: #c9a227; --oncolor: #1a1500;
  --up: #4caf6d; --down: #e5605b; --flat: #d0a83a;
}
:root[data-theme="light"] {
  --bg: #f5f7fa; --panel: #ffffff; --panel2: #eef1f6; --line: #d7dde6;
  --text: #1a2230; --muted: #667085; --accent: #2563eb; --oncolor: #ffffff;
  --up: #1a8f43; --down: #d1352c; --flat: #b5820a;
}
:root[data-theme="amber"] {
  --bg: #0b0a06; --panel: #14110a; --panel2: #1c1810; --line: #352c18;
  --text: #ffd68a; --muted: #b7965a; --accent: #ffb000; --oncolor: #1a1200;
  --up: #7ec46b; --down: #ff6a5a; --flat: #ffb000;
}
:root[data-theme="ocean"] {
  --bg: #071417; --panel: #0c1e22; --panel2: #12292e; --line: #1e3a41;
  --text: #d6f0ee; --muted: #79a2a4; --accent: #22d3c5; --oncolor: #04231f;
  --up: #34d399; --down: #fb7185; --flat: #fbbf24;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 24px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.brand {
  display: flex; gap: 14px; align-items: center;
  color: inherit; text-decoration: none; cursor: pointer;
  border-radius: 8px; padding: 2px 6px; margin: -2px -6px;   /* hit area, no layout shift */
}
.brand:hover .logo { filter: brightness(1.25); }
.brand:hover h1 { color: var(--accent); }
.brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.logo { font-size: 30px; color: var(--accent); }
h1 { margin: 0; font-size: 20px; letter-spacing: .3px; }
.tag { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.meta { color: var(--muted); font-size: 12px; text-align: right; }
.topright { display: flex; align-items: center; gap: 14px; }
.themepick { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); }

/* Tabs */
.tabs { display: flex; gap: 4px; padding: 0 24px; background: var(--panel); border-bottom: 1px solid var(--line); }
.tab {
  background: transparent; color: var(--muted); border: 0; border-bottom: 2px solid transparent;
  border-radius: 0; padding: 12px 18px; font-weight: 600; font-size: 13.5px; cursor: pointer;
}
.tab:hover { color: var(--text); filter: none; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab .tabx { margin-left: 6px; opacity: .6; }
.tab .tabx:hover { opacity: 1; }
.tabcount { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px;
  padding: 0 7px; font-size: 11px; margin-left: 4px; color: var(--muted); }

/* Watchlist stars */
.star-h { width: 30px; }
.starcell { text-align: center; width: 30px; }
.star { cursor: pointer; font-size: 15px; line-height: 1; user-select: none; transition: transform .1s; display: inline-block; }
.star:hover { transform: scale(1.25); }
.star.on { color: var(--flat); }
.star.off { color: var(--muted); opacity: .5; }
.star.off:hover { opacity: 1; color: var(--flat); }
.watchbtn { background: transparent; border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 8px 14px; margin: 4px 0 16px 12px; font-weight: 600; }
.watchbtn.on { border-color: var(--flat); color: var(--flat); }
#detailBasket { margin-left: 6px; }
#detailBasket.on { border-color: var(--accent); color: var(--accent); }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-star { font-size: 52px; color: var(--flat); opacity: .5; margin-bottom: 8px; }
.empty p { margin: 6px 0; }
.view.hidden, .hidden { display: none !important; }
.search {
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 7px; padding: 8px 11px; font-size: 13px; min-width: 200px; align-self: end;
}
.hint { color: var(--muted); font-size: 12px; align-self: center; }
/* Standalone note under a control bar — .hint alone assumes it's a flex child. */
.colnote {
  align-self: auto; padding: 10px 2px 0; line-height: 1.5; max-width: 110ch;
}
.colnote b { color: var(--fg); font-weight: 600; }
.tablewrap { overflow-x: auto; }

.controls {
  display: flex; gap: 14px; flex-wrap: wrap; align-items: end;
  padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.controls label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--muted); }
select {
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 7px; padding: 7px 9px; font-size: 13px;
}
button {
  background: var(--accent); color: var(--oncolor); border: 0; border-radius: 7px;
  padding: 9px 16px; font-weight: 600; cursor: pointer; font-size: 13px;
}
button:disabled { opacity: .6; cursor: default; }
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
button:hover { filter: brightness(1.08); }

main { padding: 8px 24px 60px; }
.status { color: var(--muted); padding: 10px 2px; font-size: 12.5px; }
table { width: 100%; border-collapse: collapse; }
thead th {
  position: sticky; top: 0; background: var(--bg); text-align: left;
  padding: 10px 10px; border-bottom: 1px solid var(--line);
  font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted);
}
th.num, td.num { text-align: right; }
tbody td { padding: 9px 10px; border-bottom: 1px solid var(--line); }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--panel2); }
.tk { font-weight: 700; color: var(--accent); }
.ret-up { color: var(--up); } .ret-down { color: var(--down); } .ret-flat { color: var(--flat); }
.na { color: var(--muted); }
.badge {
  display: inline-block; min-width: 22px; text-align: center; padding: 2px 7px;
  border-radius: 20px; font-weight: 700; font-size: 12px;
  background: var(--panel2); border: 1px solid var(--line);
}
.badge.s5 { background: #4a1216; color: #ff8a80; border-color: #6e1c22; }
.badge.s4 { background: #3a1e10; color: #ffb27a; border-color: #5a2f18; }

/* Status pills + reference column */
.pill { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.pill.grow { background: #10331a; color: var(--up); border: 1px solid #1c5a2e; }
.pill.stall { background: #3a1414; color: var(--down); border: 1px solid #5e1c1c; }
th.refcol, td.refcol { background: rgba(76,154,255,.07); }
th.refcol { color: var(--accent); }
button.small { padding: 5px 11px; font-size: 12px; }

/* ===== Spreadsheet-style column sort/filter (Individual stocks + Watchlist) ===== */
.tablehint { padding: 12px 2px 2px; line-height: 1.5; align-self: auto; }
.tablehint b { color: var(--text); font-weight: 600; }
th.colh { padding: 0; }
.colhead {
  width: 100%; background: transparent; border: 0; border-radius: 0;
  color: var(--muted); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .5px;
  padding: 10px 10px; cursor: pointer; display: flex; align-items: center; gap: 5px;
}
th.num .colhead { justify-content: flex-end; }
.colhead:hover { color: var(--text); background: var(--panel2); filter: none; }
.colhead .ch-ind { font-size: 9px; line-height: 1; }
.colhead .ch-ind::after { content: "▾"; opacity: .3; }
.colhead.filtered { color: var(--accent); }
.colhead.filtered .ch-ind::after { content: "⏷"; opacity: 1; }
.colhead.up   .ch-ind::after { content: "▲"; opacity: 1; color: var(--accent); }
.colhead.down .ch-ind::after { content: "▼"; opacity: 1; color: var(--accent); }

.colpop {
  position: fixed; z-index: 250; min-width: 208px; max-width: 300px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 14px 36px rgba(0,0,0,.45); padding: 8px;
}
.colpop.hidden { display: none !important; }
.cp-sort { display: flex; flex-direction: column; gap: 2px; }
.cp-s {
  background: transparent; border: 0; color: var(--text); text-align: left;
  padding: 7px 9px; border-radius: 6px; font-size: 12.5px; font-weight: 500; cursor: pointer;
}
.cp-s:hover { background: var(--panel2); filter: none; }
.cp-s.on { color: var(--accent); font-weight: 700; }
.cp-div { height: 1px; background: var(--line); margin: 6px 2px; }
.cp-l {
  display: flex; flex-direction: column; gap: 3px; padding: 4px; min-width: 0;
  font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px;
}
.cp-in {
  width: 100%; min-width: 0; box-sizing: border-box;
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 8px; font-size: 13px; text-transform: none; letter-spacing: 0;
}
.cp-in[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.cp-in::-webkit-outer-spin-button,
.cp-in::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cp-range { display: flex; gap: 6px; min-width: 0; }
.cp-range .cp-l { flex: 1 1 0; }
.cp-list { max-height: 220px; overflow-y: auto; padding: 2px; }
.cp-chk {
  display: flex; align-items: center; gap: 7px; padding: 5px 6px; border-radius: 5px;
  font-size: 12.5px; color: var(--text); cursor: pointer;
}
.cp-chk:hover { background: var(--panel2); }
.cp-chk input { accent-color: var(--accent); flex: none; }
.cp-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
.cp-clear, .cp-done {
  background: transparent; border: 1px solid var(--line); color: var(--text);
  border-radius: 6px; padding: 5px 12px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.cp-done { background: var(--accent); color: var(--oncolor); border-color: var(--accent); }
.linkbtn { color: var(--accent); cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }

/* Sector overview panel */
.sectorpanel { margin: 12px 0 16px; }
.sp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.sp-head h3 { margin: 0; }
.sechead, .secrow {
  display: grid; grid-template-columns: 210px 1fr 78px 150px; gap: 12px; align-items: center;
}
.sechead { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.sechead .secmid { text-align: center; }
.secrow { padding: 6px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.secrow:hover { background: var(--panel2); }
.secname { font-weight: 600; font-size: 13px; }
.secbar { position: relative; height: 18px; background: var(--bg); border-radius: 4px; }
.seczero { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--line); }
.secfill { position: absolute; top: 3px; bottom: 3px; border-radius: 3px; }
.secval { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; }
.secmix { font-size: 12px; text-align: right; }

.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 460px; max-width: 92vw;
  background: var(--panel); border-left: 1px solid var(--line); padding: 22px;
  overflow-y: auto; box-shadow: -18px 0 40px rgba(0,0,0,.4); transition: transform .18s ease;
}
.drawer.hidden { transform: translateX(105%); }
.close { position: absolute; top: 14px; right: 14px; background: transparent; color: var(--muted); border: 0; font-size: 16px; }
.drawer h2 { margin: 0 0 2px; }
.drawer .sub { color: var(--muted); font-size: 12.5px; margin-bottom: 16px; }
.card { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-bottom: 14px; }
.card h3 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.kv { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); }
.filing { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.filing:last-child { border-bottom: 0; }
.filing .form { font-weight: 700; color: var(--accent); min-width: 56px; }
.filing a { color: var(--text); text-decoration: none; }
.filing a:hover { text-decoration: underline; }
.why li { margin-bottom: 7px; }
.loading { color: var(--muted); }
a.ext { color: var(--accent); text-decoration: none; font-size: 12.5px; }

/* Drawer -> pitchbook button */
.pitchbtn {
  display: inline-block; margin: 4px 0 16px; padding: 9px 14px; border-radius: 8px;
  background: var(--accent); color: #06122a; font-weight: 700; text-decoration: none; font-size: 13px;
}
.pitchbtn:hover { filter: brightness(1.08); }

/* ======================= Pitchbook page ======================= */
body.pb { background: var(--bg); }
.pb-wrap { max-width: 1080px; margin: 0 auto; padding: 20px 22px 70px; }
.back { color: var(--muted); text-decoration: none; font-size: 13px; }
.back:hover { color: var(--text); }

.hero {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 20px;
  margin: 14px 0 22px; padding-bottom: 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.hero-tk { font-size: 34px; font-weight: 800; letter-spacing: .5px; color: var(--accent); line-height: 1; }
.hero-name { font-size: 18px; margin: 4px 0 12px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 20px;
  padding: 4px 11px; font-size: 12px; color: var(--muted); text-decoration: none;
}
.chip.link { color: var(--accent); }
.hero-px { text-align: right; }
.hero-px .px { font-size: 30px; font-weight: 700; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.tk-k { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.tk-v { font-size: 20px; font-weight: 700; margin-top: 6px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.card.wide { grid-column: auto; }
.chart { width: 100%; height: auto; display: block; margin-top: 2px; }
.gauge { width: 100%; height: auto; margin-bottom: 12px; }
.ratingbar { width: 100%; height: 24px; overflow: visible; display: block; }
/* Data marks lift on hover so the pointer sees them respond; the <title> in each
   mark is the value readout. Not on touch (no hover). */
.chart .mk { transition: filter .12s ease; }
@media (hover: hover) {
  .chart .mk:hover { filter: brightness(1.14) saturate(1.05); }
}
.legend { display: flex; gap: 8px 16px; margin-top: 12px; font-size: 12px; color: var(--muted); flex-wrap: wrap; align-items: center; }
.legend.wrap { gap: 8px 16px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: 0; }
.legend i.line { width: 15px; height: 3px; border-radius: 2px; vertical-align: 2px; }
.legend .legend-note { color: var(--muted); }
.thesis .why { margin: 0; padding-left: 18px; }
.summary { line-height: 1.6; color: var(--text); margin: 0; }
.sub2 { color: var(--muted); font-size: 12.5px; margin-top: 10px; }
.disclaimer { color: var(--muted); font-size: 11.5px; margin-top: 24px; text-align: center; }

/* Dashboard footer: the same standing disclaimer the detail pages carry, plus
   data provenance, so it is visible on the front door and not only after a click. */
.appfoot { padding: 8px 20px 32px; }
.appfoot .disclaimer { margin: 0 auto; max-width: 760px; line-height: 1.6; }
.appfoot .disclaimer a { color: var(--muted); text-decoration: underline; }
.appfoot .disclaimer code { font-size: 11px; }

@media (max-width: 820px) {
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .grid2 { grid-template-columns: 1fr; }
}

/* ======================= SPA detail view ======================= */
#detailBody { max-width: 1080px; }
#detailBody .pblink { float: right; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 700; }

/* Sector heatmap */
.heattable { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.heattable th { position: sticky; top: 0; background: var(--bg); text-align: left; padding: 8px 10px;
  border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.heattable td { padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.heattable td.heat { text-align: right; font-variant-numeric: tabular-nums; }
.heattable tr.secrow2 { cursor: pointer; }
.heattable tr.secrow2:hover td { filter: brightness(1.12); }
.heattable .secname { font-weight: 600; }

/* Long-horizon returns strip */
.longret { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 10px; }
.lr { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; font-weight: 600;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; }
.lr-w { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .5px; }

/* Fundamentals */
.secdiv { font-size: 15px; margin: 26px 0 10px; padding-bottom: 8px; border-bottom: 2px solid var(--accent);
  display: inline-block; text-transform: uppercase; letter-spacing: .5px; }
.fundtable { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.fundtable th { position: sticky; top: 0; background: var(--bg); text-align: right; padding: 8px 12px;
  border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.fundtable th:first-child { text-align: left; }
.fundtable td { padding: 7px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
.fundtable td.metric { color: var(--muted); font-weight: 600; }
.fundtable tbody tr:hover { background: var(--panel2); }

/* ===== Command palette (Cmd/Ctrl-K, /) ===== */
.cmdk-btn { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-weight: 500; }
.cmdk-btn:hover { color: var(--text); }
.cmdk-btn kbd { background: var(--panel2); border: 1px solid var(--line); border-radius: 4px;
  padding: 0 5px; font: inherit; font-size: 11px; color: var(--muted); }
.cmdk { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.5);
  display: flex; align-items: flex-start; justify-content: center; padding-top: 11vh; }
.cmdk.hidden { display: none !important; }
.cmdk-panel { width: 660px; max-width: 92vw; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden; box-shadow: 0 24px 70px rgba(0,0,0,.55); }
.cmdk-inputrow { display: flex; align-items: center; gap: 11px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.cmdk-icon { color: var(--muted); font-size: 18px; }
.cmdk-input { flex: 1; background: transparent; border: 0; outline: none; color: var(--text); font-size: 17px; }
.cmdk-input::placeholder { color: var(--muted); }
.cmdk-esc { color: var(--muted); font-size: 11px; border: 1px solid var(--line); border-radius: 5px; padding: 2px 6px; }
.cmdk-list { max-height: 52vh; overflow-y: auto; padding: 6px; }
.cmdk-item { display: grid; grid-template-columns: 22px 64px 1fr auto; gap: 11px; align-items: center;
  padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.cmdk-item.sel { background: var(--panel2); box-shadow: inset 2px 0 0 var(--accent); }
.cmdk-item .ci-star { text-align: center; font-size: 14px; }
.cmdk-item .ci-star.on { color: var(--flat); }
.cmdk-item .ci-star.off { color: var(--muted); opacity: .5; }
.cmdk-item .ci-tk { font-weight: 700; color: var(--accent); }
.cmdk-item .ci-name { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-item .ci-sec { color: var(--muted); font-size: 12px; }
.cmdk-item .ci-ret { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.cmdk-item.nav .ci-star { color: var(--muted); }
.cmdk-empty { padding: 24px; text-align: center; color: var(--muted); }
.cmdk-foot { display: flex; gap: 16px; padding: 9px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11.5px; }
.cmdk-foot kbd { background: var(--panel2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; font: inherit; margin-right: 2px; }

/* Keyboard row cursor in the stocks / watchlist tables */
tbody tr.rowsel { background: var(--panel2); box-shadow: inset 3px 0 0 var(--accent); }

/* ===== Weights view (index-weight visualizer) ===== */
.numin { background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 7px; padding: 7px 9px; font-size: 13px; width: 72px; }
.wtcmp { width: 100%; border-collapse: collapse; font-size: 13px; }
.wtcmp th { text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--line);
  color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.wtcmp th:first-child { text-align: left; }
.wtcmp td { padding: 6px 8px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.wtcmp td.wcw { font-weight: 700; color: var(--muted); }
.wtcmp tbody tr:last-child td { border-bottom: 0; }
.wtsec { display: grid; grid-template-columns: 200px 1fr 64px 64px 84px; gap: 12px; align-items: center;
  padding: 7px 6px; border-bottom: 1px solid var(--line); }
.wtsec:last-child { border-bottom: 0; }
.wtsec:hover:not(.wtsec-head) { background: var(--panel); }
.wtsec-head { padding-top: 0; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.wtsec-head .wtsec-w { font-weight: 600; font-size: 11px; }
.wtsec-name { font-weight: 600; font-size: 13px; }
.wtsec-bar { position: relative; height: 14px; background: var(--bg); border-radius: 4px; }
.wtsec-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); opacity: .85; border-radius: 0 4px 4px 0; }
.wtsec-then { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--text); border-radius: 1px; }
.legend i.tick { width: 2px; height: 12px; border-radius: 1px; background: var(--text); vertical-align: -1px; }
.wtsec-w { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; }
.wthead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin: -4px 0 10px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.seg button { background: transparent; color: var(--muted); border: 0; padding: 5px 12px; font-size: 12px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent); color: var(--oncolor); font-weight: 700; }
.wtchartwrap { position: relative; }
.wtchart { display: block; max-width: 100%; font-family: inherit; }
.wtchart .wthit { cursor: crosshair; }
.wttip { position: absolute; pointer-events: none; z-index: 5; min-width: 170px; max-width: 280px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,.25); font-size: 12px; }
.wttip-d { color: var(--muted); font-size: 11px; margin-bottom: 5px; }
.wttip-r { display: grid; grid-template-columns: 10px 1fr auto; gap: 7px; align-items: center; padding: 1px 0; }
.wttip-r i { width: 9px; height: 9px; border-radius: 50%; }
.wttip-r span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wttip-r b { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.wtpick { display: grid; grid-template-columns: 110px 1fr; gap: 12px 14px; align-items: start; }
.wtpick-k { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; padding-top: 7px; }
.wtadd { display: flex; flex-direction: column; gap: 8px; }
.wtadd .search { width: 100%; max-width: 320px; margin-left: 0; align-self: flex-start; }
.wtchip { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 5px 12px;
  font-size: 12.5px; color: var(--text); cursor: pointer; font-family: inherit; }
.wtchip:hover:not(:disabled) { border-color: var(--accent); }
.wtchip.some { border-color: var(--accent); border-style: dashed; }
.wtchip.on { background: var(--accent); color: var(--oncolor); border-color: var(--accent); font-weight: 600; }
.wtchip.sm { padding: 3px 9px; font-size: 12px; }
.wtchip-n { opacity: .7; font-weight: 400; margin-left: 2px; }
.wtchip.clear { color: var(--muted); }
.wtchip:disabled { opacity: .4; cursor: default; }
.wtchip .x { margin-left: 3px; opacity: .8; }
.wtsum { font-size: 12.5px; padding: 4px 6px 0 0; }
.wtcmp tr.cur td { background: var(--panel); }
.spyintro { margin: -2px 0 12px; color: var(--muted); font-size: 13px; }
.spyrange { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin-bottom: 14px; }
.spyrange .seg { max-width: 100%; overflow-x: auto; }
.spyrange .seg button { flex: 0 0 auto; }
.spylist button { white-space: nowrap; }
.spydate { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.spydate input { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 7px;
  padding: 5px 8px; font: inherit; font-size: 12.5px; color-scheme: dark; }
[data-theme="light"] .spydate input { color-scheme: light; }
.spystats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0 6px; }
.spytile { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; border-top: 3px solid var(--line); }
.spytile.a { border-top-color: #3987e5; } .spytile.b { border-top-color: #d95926; } .spytile.c { border-top-color: var(--muted); }
.spytile-s { font-size: 12px; color: var(--muted); margin-top: 4px; }
.spyverdict { grid-column: 1 / -1; margin: 4px 0 0; font-size: 13.5px; line-height: 1.55; }
.spywarn { color: var(--flat); font-weight: 600; }
.spyalone { display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; cursor: pointer; color: var(--text); }
.spyfind { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0 8px; flex-wrap: wrap; }
.spyfind h4 { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.spyfind .search { width: 100%; max-width: 340px; margin-left: 0; }
.spylist td { vertical-align: middle; }
.spylist th:nth-child(2), .spylist td:nth-child(2) { text-align: left; }
.spynm { color: var(--muted); font-size: 12px; }
.spylist tr.isout td { opacity: .5; }
.spylist tr.isout td:last-child { opacity: 1; }
.spybarcell { width: 22%; min-width: 120px; }
.spybar { position: relative; display: block; height: 10px; }
.spybar::before { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--line); }
.spybar-f { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.spybar-f.pos { background: var(--up); } .spybar-f.neg { background: var(--down); }
.spysep td { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding-top: 12px; }
@media (max-width: 720px) {
  .spystats { grid-template-columns: 1fr; }
  .spylist th:nth-child(1), .spylist td:nth-child(1), .spylist th:nth-child(3), .spylist td:nth-child(3),
  .spylist th:nth-child(5), .spylist td:nth-child(5), .spynm { display: none; }
  .spylist td, .spylist th { padding: 6px 5px; }
}
.wtdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 7px; vertical-align: -1px; }
.wtchip.cmp-on { border-color: var(--text); font-weight: 600; }
.wtcmp-pick { display: flex; gap: 10px; align-items: flex-start; flex: 1; min-width: 0; }
.wtcmp-pick .wtpick-k { padding-top: 4px; white-space: nowrap; }
.wtcmp-sum { margin-top: 10px; }
.wtcmp-sum td { vertical-align: middle; }
.wtcmp-sum th:first-child, .wtcmp-sum td:first-child { text-align: left; }
.wtcmp-sum tr.spyrow td { color: var(--muted); }
.wtsmall { font-size: 11.5px; margin: 2px 0 0 17px; }
.wtvs { font-size: 11px; margin-left: 4px; }
#wtCompare .wthead { margin-top: 0; }
@media (max-width: 720px) {
  .wtcmp-pick { flex-direction: column; gap: 4px; } .wthead { flex-wrap: wrap; }
  .wtcmp-sum th:nth-child(2), .wtcmp-sum td:nth-child(2), .wtlong { display: none; }
  .wtcmp-sum td, .wtcmp-sum th { padding: 6px 5px; }
  .wtcmp-sum button { white-space: nowrap; }
}
@media (max-width: 720px) {
  .wtsec { grid-template-columns: 1fr 58px 58px 70px; }
  .wtsec-bar { display: none; }
  .wtpick { grid-template-columns: 1fr; gap: 6px; }
  .wtpick-k { padding-top: 6px; }
}
.bchk { display: inline-block; width: 18px; height: 18px; line-height: 17px; text-align: center;
  border-radius: 5px; font-weight: 800; font-size: 12px; border: 1px solid var(--line); }
.bchk.on { background: var(--accent); color: var(--oncolor); border-color: var(--accent); }
.bchk.off { color: var(--muted); }

/* ===== Intro splash overlay (first arrival in a tab; auto-dismisses) ===== */
.ss-intro {
  position: fixed; inset: 0; z-index: 300;
  background: radial-gradient(70% 60% at 50% 46%, var(--panel2) 0%, var(--bg) 60%, var(--bg) 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 34px;
  transition: opacity .3s ease;
}
.ss-intro.gone { opacity: 0; pointer-events: none; }
.ss-lockup { display: flex; align-items: center; justify-content: center; gap: clamp(14px, 3vw, 26px); }
.ss-mark {
  --sz: clamp(46px, 11vw, 82px);
  position: relative; flex: none; width: var(--sz); height: var(--sz);
  border-radius: 50%; overflow: hidden;
  border: 3px solid var(--accent); box-shadow: 0 0 22px -2px var(--accent);
  opacity: 0; animation: ss-appear 220ms ease-out forwards;
}
@keyframes ss-appear { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
.ss-sweep { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ss-prog { fill: none; stroke: var(--accent); stroke-width: 19; stroke-dasharray: 56.549; stroke-dashoffset: 56.549; }
/* Kept in step with index.html's inline timings: .load lands as ss-appear ends
   (220ms), the ring runs 550ms, and the name starts typing just after (780ms). */
.ss-mark.load .ss-sweep { animation: ss-spin 550ms cubic-bezier(.3,.45,.2,1) forwards; }
.ss-mark.load .ss-prog  { animation: ss-fill 550ms cubic-bezier(.3,.45,.2,1) forwards; }
@keyframes ss-spin { from { transform: rotate(-450deg); } to { transform: rotate(-90deg); } }
@keyframes ss-fill { from { stroke-dashoffset: 56.549; } to { stroke-dashoffset: 28.274; } }
.ss-word { display: inline-flex; align-items: center; margin: 0; color: var(--text); font-weight: 600; letter-spacing: .5px; font-size: clamp(30px, 8vw, 62px); white-space: nowrap; }
.ss-caret { display: inline-block; width: 2px; height: 1em; margin-left: 3px; background: var(--accent); vertical-align: -.08em; animation: ss-blink 1s steps(1) infinite; }
.ss-caret.done { animation: ss-fadeout 200ms ease forwards; }
@keyframes ss-blink { 50% { opacity: 0; } }
@keyframes ss-fadeout { to { opacity: 0; } }
.ss-sub { display: flex; flex-direction: column; align-items: center; gap: 16px; opacity: 0; transform: translateY(6px); transition: opacity .25s ease, transform .25s ease; }
.ss-sub.on { opacity: 1; transform: none; }
.ss-tag { margin: 0; color: var(--muted); font-size: clamp(11px, 2.6vw, 13px); letter-spacing: 3px; text-transform: uppercase; }
@media (prefers-reduced-motion: reduce) {
  .ss-mark { animation: none; opacity: 1; }
  .ss-sweep { animation: none !important; }
  .ss-prog { stroke-dashoffset: 28.274; animation: none !important; }
  .ss-caret { animation: none; opacity: 0; }
  .ss-intro { transition: none; }
}

/* News */
.newsmix { display: flex; gap: 14px; font-size: 12.5px; margin-bottom: 10px; flex-wrap: wrap; }
.sent-pos { color: var(--up); } .sent-neg { color: var(--down); } .sent-neu { color: var(--muted); }
.newsrow { display: flex; align-items: baseline; gap: 9px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.newsrow:last-child { border-bottom: 0; }
.newsrow a { color: var(--text); text-decoration: none; flex: 1; }
.newsrow a:hover { text-decoration: underline; color: var(--accent); }
.sentdot { font-weight: 800; width: 14px; text-align: center; }
.newsmeta { font-size: 11.5px; white-space: nowrap; }
