/* =========================================================================
   MeritX — Terminal, master-detail. Two flush button rails (left = 4, right = 3)
   flank a center panel; clicking a button opens that tool's graphic in the
   middle ("opens sideways, between the two lists"). Both rails span the SAME
   height, so the 4-stack has shorter rows and the 3-stack has taller rows — each
   button flex-fills its rail equally, with no gaps or borders between buttons.
   Self-contained .tvert* classes; theme-aware via the landing tokens.
   ========================================================================= */

/* =========================================================================
   INTRO LINE above the terminal
   Same shape as the hero — a bold sans line with the accent phrase in the
   purple serif pill underneath — but deliberately a third of the size, so it
   reads as a caption introducing the terminal rather than a second headline.
   ========================================================================= */
.tintro {
  text-align: center;
  max-width: 34ch;
  /* .terminal carries a decorative parallax drift (script.js, speed .05) that
     lifts it up to ~10px as it enters view, so the gap has to absorb that
     rather than sit at a hairline */
  margin: 0 auto clamp(52px, 11vw, 76px);
  font-family: var(--font-display, inherit);
  font-weight: 700;
  letter-spacing: -.02em;
  /* identical to .gg__h2 ("One Platform. Six Intelligence Engines.") so the two
     section intros read at the same weight — same clamp, not a lookalike, so
     they stay matched at every width */
  line-height: 1.06;
  font-size: clamp(22px, 3vw, 37px);
  color: var(--text);
}
.tintro__w { display: block; }
/* the pill: its own centred line, matching the hero's serif italic. The height
   is roomier than the 1.08em base so the italic descenders are not clipped. */
.tintro .mx-fx-rot {
  display: block; width: fit-content; margin: .34em auto 0;
  font-family: 'PP Editorial', var(--font-serif);
  font-style: italic; font-weight: 500; letter-spacing: 0;
  /* matched to the fund-workspace hero pill (.mx-hero h1 .mx-rot), which
     renders at 32px on a phone. Kept as a vw clamp rather than a flat 32px so
     it steps down on a 320px screen instead of pushing past the container. */
  font-size: clamp(24px, 8.53vw, 32px); height: 1.42em; line-height: 1.42em;
  /* default roll is 1.3em, which would leave a sliver of the outgoing phrase
     showing above a box this tall — clear the full height instead */
  --pr-roll-out: 1.55em; --pr-roll-in: 1.5em;
}
.tintro .mx-fx-rot .pr-stage { font-family: inherit; }
/* Desktop: size this intro to match the Fund-Workspace headline
   "Build your own whitelist." The heading there is .feat__copy .section-title
   = clamp(1.8rem, 3.6vw, 2.7rem) and its pill inherits the same size, so both
   the black heading and the rolling pill adopt that one formula (43.2px at the
   2.7rem cap) and render at the same size as that section. Scoped to >=641px so
   the phone sizing above (22px heading / 32px pill) is left exactly as-is. */
@media (min-width: 640px) {
  .tintro,
  .tintro .mx-fx-rot { font-size: clamp(1.8rem, 3.6vw, 2.7rem); }
}

.tvert {
  --rail: clamp(158px, 15.5vw, 216px);
  /* MeritX brand accents (theme-aware) — navy / blue / violet / gold */
  --b-navy: #2708A0; --b-blue: #4969FF; --b-violet: #4225c3; --b-goldd: #C9A227; --b-gold: #ffd700;
  display: grid;
  grid-template-columns: var(--rail) 1fr var(--rail);
  height: clamp(560px, 82vh, 860px);
  min-height: 0;
  background: var(--surface);
}
/* dark theme: lift the dark accents so they read on the dark panel */
[data-theme="dark"] .tvert { --b-navy: #8d9dff; --b-violet: #a08dff; --b-goldd: #ffd700; }

/* ---------------- button rails ---------------- */
.tvert__rail { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.tvert__rail--left  { border-right: 1px solid var(--border); }
.tvert__rail--right { border-left:  1px solid var(--border); }

/* each button flex-fills its rail equally -> 4 shorter, 3 taller. No gaps/borders between. */
.tvert__btn {
  flex: 1 1 0; min-height: 0; min-width: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border: 0; background: var(--surface);
  color: var(--text); text-align: left; cursor: pointer; position: relative;
  transition: background .25s ease, color .25s ease;
}
.tvert__btn:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--pc, var(--accent)); }

/* accent bar on the inner edge (pointing into the detail) when active */
.tvert__btn::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 3px;
  background: var(--pc, var(--accent)); opacity: 0; transition: opacity .25s ease;
}
.tvert__rail--left  .tvert__btn::after { right: -1px; }
.tvert__rail--right .tvert__btn::after { left:  -1px; }
.tvert__btn.is-active { background: var(--bg-elev); }
.tvert__btn.is-active::after { opacity: 1; }
.tvert__btn:not(.is-active):hover { background: var(--bg-elev); }

.tvert__ico {
  flex: 0 0 auto; width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--border); color: var(--pc, var(--accent));
  transition: border-color .25s ease;
}
.tvert__btn.is-active .tvert__ico,
.tvert__btn:hover .tvert__ico { border-color: var(--pc, var(--accent)); }
.tvert__ico svg { width: 18px; height: 18px; }

.tvert__htxt { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.tvert__title { font-family: var(--font-display); font-weight: 700; font-size: 16px; letter-spacing: -.01em; line-height: 1.15; color: var(--text); }
.tvert__btn.is-active .tvert__title { color: var(--pc, var(--accent)); }
.tvert__desc { font-size: 12px; line-height: 1.45; color: var(--text-2); }

/* ---------------- center detail ---------------- */
.tvert__detail { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: var(--bg-elev); }
.tvert__panel {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  padding: 20px 22px;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .18s ease;
}
.tvert__panel.is-active { opacity: 1; visibility: visible; pointer-events: auto; }

.tvert__open {
  position: absolute; top: 18px; right: 20px; z-index: 3;
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; color: var(--pc, var(--accent)); text-decoration: none;
}
.tvert__open svg { transition: transform .25s ease; }
.tvert__open:hover svg { transform: translateX(3px); }

/* graphic fills the panel; charts flex-fill the leftover height */
.tvert__gfx { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.tvert__gfx .term-card { flex: 1 1 auto; min-height: 0; border: 0; background: transparent; padding: 0; display: flex; flex-direction: column; }
.tvert__gfx .term-panel__head { flex: none; padding-right: 70px; }   /* clear the floating "Open" link */
.tvert__gfx .mx-chart { flex: 1 1 auto; height: auto; min-height: 130px; }

/* ---- ported KPI strip (was defined only under .pacc--term) ---- */
.tvert .pacc__kpis { flex: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.tvert .pacc__kpi { min-width: 0; background: var(--surface); border: 1px solid var(--border); padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; box-shadow: 0 1px 3px rgba(15, 20, 40, .06); }
.tvert .pacc__kpi-k { font-size: 10px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tvert .pacc__kpi-v { font-family: var(--font-mono); font-size: 16px; font-weight: 700; color: var(--text); letter-spacing: -.01em; line-height: 1.1; }
.tvert .pacc__kpi-d { font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: var(--muted); }
.tvert .pacc__kpi .up   { color: var(--green); }
.tvert .pacc__kpi .down { color: var(--red); }
.tvert .pacc__kpi .warn { color: var(--gold); }

/* ---- Sector Pulse fills the panel height ---- */
.tvert .term-card--sp { gap: 13px; }
.tvert .sp-heat { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.tvert .sp-heat .s-terminal__heat { flex: 1; grid-auto-rows: 1fr; gap: 6px; }
.tvert .sp-lbl { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; }
.tvert .sp-lbl span { color: var(--text-2); font-family: var(--font-mono); font-weight: 600; letter-spacing: 0; }

/* ---- Smart Money flow fills the panel height ---- */
.tvert__panel[data-panel="smt"] .s-flow { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: space-between; }

@media (prefers-reduced-motion: reduce) {
  .tvert__panel, .tvert__btn, .tvert__ico, .tvert__open svg { transition: none; }
}

/* ---------------- responsive ---------------- */
@media (max-width: 639px) {
  .tvert { --rail: 142px; }
  .tvert .pacc__kpis { grid-template-columns: 1fr 1fr; }
  .tvert__desc { display: none; }               /* narrow rails: icon + title only */
}
/* =========================================================================
   PHONES — vertical accordion
   The master-detail idea does not survive a 375px screen: two rails plus a
   centre panel becomes a grid of six cards with the detail marooned below.
   Here each tool's button sits directly ON TOP of its own panel and opens
   downwards, one at a time.

   `display:contents` dissolves the two rails and the detail wrapper so their
   children become flex items of .tvert itself — which is what lets `order`
   interleave button/panel pairs. The DOM is untouched, so desktop keeps its
   left-rail / detail / right-rail structure.
   ========================================================================= */
@media (max-width: 639px) {
  .tvert { display: flex; flex-direction: column; height: auto; }
  .tvert__rail, .tvert__detail { display: contents; }

  .tvert__btn[data-target="cmd"] { order: 1 }  .tvert__panel[data-panel="cmd"] { order: 2 }
  .tvert__btn[data-target="scr"] { order: 3 }  .tvert__panel[data-panel="scr"] { order: 4 }
  .tvert__btn[data-target="sec"] { order: 5 }  .tvert__panel[data-panel="sec"] { order: 6 }
  .tvert__btn[data-target="stk"] { order: 7 }  .tvert__panel[data-panel="stk"] { order: 8 }
  .tvert__btn[data-target="lab"] { order: 9 }  .tvert__panel[data-panel="lab"] { order: 10 }
  .tvert__btn[data-target="smt"] { order: 11 } .tvert__panel[data-panel="smt"] { order: 12 }

  /* headers — full-width bars, title only; the open panel carries the blurb */
  .tvert__btn { flex: none; min-height: 56px; padding: 13px 16px; border-top: 1px solid var(--border); }
  .tvert__desc { display: none; }
  .tvert__htxt { flex: 1 1 auto; }
  /* the accent bar moves to the leading edge — there is no "inner edge"
     pointing at a centre panel any more */
  .tvert__btn::after { top: 0; bottom: 0; left: 0; right: auto; width: 3px; }

  /* chevron: ::after is already the accent bar, so the affordance is ::before,
     ordered last so it sits at the trailing edge of the bar */
  .tvert__btn::before {
    content: ""; order: 3; flex: 0 0 auto; margin-left: auto;
    width: 9px; height: 9px; margin-right: 3px;
    border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
    transform: rotate(45deg) translate(-2px, -2px);
    transition: transform .3s ease, border-color .3s ease;
  }
  .tvert__btn.is-active::before {
    transform: rotate(-135deg) translate(-2px, -2px);
    border-color: var(--pc, var(--accent));
  }

  /* panels — in flow, closed by default, opening under their own header.
     position:relative keeps the absolutely-placed "Open →" link anchored to
     the panel now that .tvert__detail no longer generates a box. */
  .tvert__panel {
    position: relative; inset: auto;
    display: none; opacity: 1; visibility: visible; pointer-events: auto;
    padding: 16px 16px 22px; border-top: 1px solid var(--border);
  }
  .tvert__panel.is-active { display: flex; animation: tvertOpen .34s ease both; }
  .tvert__open { top: 14px; right: 16px; }
  .tvert__gfx .mx-chart { min-height: 150px; }

  /* Breadth: legend on the left, donut on the right, trend chart on its own row
     underneath. The pair fits exactly — the legend's 168px plus the donut's
     126px plus this 10px gap is 304px inside a 306px card — so it is laid out
     with `order` rather than row-reverse, which would drag the trend chart over
     to the left as well. */
  /* centred as a unit: the legend+donut pair is 290 of the card's 306, so this
     splits the 16px remainder evenly instead of banking it all on the right */
  .tvert .tv-breadth-row { flex-direction: row; flex-wrap: wrap; align-items: center;
    justify-content: center; gap: 16px; }
  /* A fixed legend width does two jobs: the values right-align to a common
     edge so they read as a column, and it sets how far the donut sits in from
     the card's right edge (306 - 148 - 16 - 126 = 16px of breathing room). */
  .tvert .tv-donut-legend { order: 1; flex: 0 0 148px; min-width: 0; }
  .tvert .tv-donut-legend b { margin-left: auto; }
  .tvert .tv-donut { order: 2; flex: 0 0 auto; margin-inline: 0; }
  .tvert .tv-bd-col { order: 3; flex: 1 1 100%; width: 100%; min-width: 0; }
  .tvert .tv-mretcol { flex: none; width: 100%; min-width: 0; }
  /* anything still wider than the card (inline SVG with an intrinsic width)
     scrolls inside its own box rather than escaping the panel */
  .tvert .tv-area { max-width: 100%; overflow-x: auto; }

  /* Chart toolbar on a single line. Two things bought the room: the head
     reserves 70px on the right to clear the floating "Open →" link, but that
     link sits ~120px higher up the panel so the reserve is dead space here;
     and the seg chips carried 7px of side padding each across 8 buttons.
     Together that is ~100px back, enough for Line/Candle + change + all six
     timeframes on one row (285px used of 306px). The extra vertical padding
     also makes these 19px-tall controls a slightly better touch target. */
  .tvert__gfx .term-panel__head { padding-right: 0; }
  /* The title only fills ~174px, so Line/Candle used to ride up beside it and
     leave the change + timeframes stranded on a row of their own. Giving the
     title the whole first line keeps all three control groups together on the
     second, where they need 283px of the 306 available. */
  .tvert .mx-chart-card .term-panel__title { flex: 1 1 100%; }
  .tvert .mx-chart-ctrls { gap: 6px; flex-wrap: nowrap; margin-left: 0; }
  .tvert .mx-seg { padding: 1px; }
  .tvert .mx-seg__btn { padding: 6px 4px; }

  /* the four KPI labels are all short — one row instead of the 2x2 the
     tablet rule gives them saves a whole row inside every open panel */
  .tvert .pacc__kpis { grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0; }
  .tvert .pacc__kpi { padding: 8px; gap: 2px; }
  .tvert .pacc__kpi-v { font-size: 14px; }
  .tvert .pacc__kpi-k { font-size: 9.5px; }
}
@keyframes tvertOpen { from { opacity: 0; transform: translateY(-8px) } to { opacity: 1; transform: none } }

/* =============== enriched panels: chart + a distinct side module =============== */
.tvert__lower { display: flex; gap: 16px; flex: 1 1 auto; min-height: 0; margin-top: 4px; }
.tvert__lower .mx-chart { flex: 1 1 auto; min-height: 150px; height: auto; }
.tvert__side { flex: 0 0 clamp(200px, 25%, 248px); min-width: 0; display: flex; }
.tvert__mod { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; border-left: 1px solid var(--border); padding-left: 16px; }
.tvert__mod-h { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 7px; margin-bottom: 10px; }
.tvert__mod-n { font-family: var(--font-mono); font-weight: 700; color: var(--text-2); letter-spacing: 0; }
.tvert__mod-n--warn { color: var(--gold); }

/* holdings / matches list */
.tvert__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.tvert__list li { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.tvert__list b { font-weight: 700; color: var(--text); }
.tvert__list span { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.tvert__list i { font-family: var(--font-mono); font-size: 11px; font-weight: 600; font-style: normal; width: 44px; text-align: right; }
.tvert__list i.up { color: var(--green); }
.tvert__list i.down { color: var(--red); }
.tvert__list--match .q { color: var(--accent); font-weight: 600; }

/* factor X-ray bars */
.tvert__fac { display: flex; flex-direction: column; gap: 11px; }
.tvert__fac-row { display: flex; align-items: center; gap: 9px; font-size: 11.5px; }
.tvert__fac-row .k { flex: 0 0 60px; color: var(--text-2); }
.tvert__fac-row .t { flex: 1 1 auto; height: 6px; background: var(--border); position: relative; overflow: hidden; }
.tvert__fac-row .t i { position: absolute; inset: 0 auto 0 0; background: var(--accent); }
.tvert__fac-row .v { flex: 0 0 22px; text-align: right; font-family: var(--font-mono); font-weight: 700; color: var(--text); }

/* strategy rule chips + monthly P&L squares */
.tvert__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tvert__chips span { font-size: 10.5px; font-weight: 600; color: var(--text-2); border: 1px solid var(--border); padding: 4px 8px; white-space: nowrap; }
.tvert__months { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; }
.tvert__months i { aspect-ratio: 1 / 1; display: block; }
.tvert__months i.up { background: var(--green); opacity: .82; }
.tvert__months i.down { background: var(--red); opacity: .82; }

/* ---- layered gradient area chart (shadcn-style) + radar chart ---- */
.tv-area { border: 1px solid var(--border); border-left: 2px solid var(--pc, var(--accent)); padding: 8px 0 4px; }
.tv-area svg { display: block; width: 100%; }
.tv-area__x { display: flex; justify-content: space-between; padding: 3px 10px 0;
  font: 600 9.5px/1 var(--font-mono, monospace); letter-spacing: .06em; color: var(--muted); }
.tv-legend { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 18px; margin-top: 7px;
  font-size: 11px; font-weight: 600; color: var(--text-2); }
.tv-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.tv-radar { display: block; width: 100%; max-width: 220px; margin: 0 auto; }
.tv-radar .grid { fill: none; stroke: var(--border); stroke-width: 1; }
.tv-radar .lbl { fill: var(--muted); font: 600 8.5px/1 var(--font-mono, monospace); letter-spacing: .04em; text-transform: uppercase; }

/* red-flags list */
.tvert__flags { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.tvert__flags li { display: flex; gap: 9px; align-items: flex-start; }
.tvert__flags .dot { flex: 0 0 auto; width: 8px; height: 8px; background: var(--gold); margin-top: 3px; }
.tvert__flags b { display: block; color: var(--text); font-weight: 700; font-size: 12px; line-height: 1.2; }
.tvert__flags em { font-style: normal; color: var(--muted); font-size: 11px; }

/* narrower screens: drop the module below the chart so the chart stays usable.
   The .tvert__lower--flip variant re-declares both the direction and the border
   side FURTHER DOWN this sheet, so it has to be out-specified here (.tvert ...)
   or it keeps its row-reverse and pins the module beside the chart — which on a
   phone squeezed the chart column to zero width and pushed the module ~350px
   out past the card. */
@media (max-width: 639px) {
  .tvert__lower, .tvert .tvert__lower--flip { flex-direction: column; gap: 12px; }
  .tvert__side { flex: none; min-width: 0; }
  .tvert__mod,
  .tvert .tvert__lower--flip .tvert__mod {
    border-left: 0; border-right: 0; padding-left: 0; padding-right: 0;
    border-top: 1px solid var(--border); padding-top: 12px;
  }
  /* breadth row is donut + legend + trend chart — it needs ~640px to sit in
     one line, so let the chart wrap onto its own row instead of spilling */
  .tvert .tv-breadth-row { flex-wrap: wrap; }
  .tvert .tv-bd-col, .tvert .tv-mretcol { min-width: 0; flex: 1 1 100%; }
}

/* ===== new feature panels: timeframe chip · note · pine code · copilot chat · drawing overlay · "soon" pill ===== */
.tvert__chips span.on { color: #fff; background: var(--pc, #3f7dfb); border-color: var(--pc, #3f7dfb); }
[data-theme="dark"] .tvert__chips span.on { color: #0b1020; }
.tv-note { margin: 0; font-size: 11px; line-height: 1.5; color: var(--muted); }

.tv-code { margin: 0; font-family: var(--font-mono); font-size: 10.5px; line-height: 1.6; color: var(--text);
  background: rgba(127,127,127,.07); border: 1px solid var(--border); border-left: 2px solid var(--pc, #1f9d57);
  padding: 8px 10px; overflow-x: auto; white-space: pre;
  /* clean scrollbar: no dark case/arrows, just a slim grey rounded thumb */
  scrollbar-width: thin; scrollbar-color: #9aa0a9 transparent; }
.tv-code::-webkit-scrollbar { height: 8px; width: 8px; }
.tv-code::-webkit-scrollbar-track { background: transparent; }
.tv-code::-webkit-scrollbar-thumb { background: #9aa0a9; border-radius: 8px;
  border: 2px solid transparent; background-clip: content-box; }
.tv-code::-webkit-scrollbar-thumb:hover { background: #7b7b7b; background-clip: content-box; }
.tv-code .k { color: var(--pc, #1f9d57); font-weight: 700; }
.tv-code .c { color: var(--muted); }

.tv-chat { display: flex; flex-direction: column; gap: 9px; padding: 2px 2px 11px; }
.tv-chat__q { align-self: flex-end; max-width: 84%; background: var(--pc, #d9a400); color: #111; font-size: 11.5px; font-weight: 600;
  padding: 7px 11px; border-radius: 12px 12px 3px 12px; }
.tv-chat__a { align-self: flex-start; max-width: 90%; display: flex; gap: 8px; }
.tv-chat__a > div { background: rgba(127,127,127,.08); border: 1px solid var(--border); color: var(--text);
  font-size: 11.5px; line-height: 1.5; padding: 7px 11px; border-radius: 12px 12px 12px 3px; }
.tv-chat__ai { flex: 0 0 auto; width: 21px; height: 21px; border-radius: 50%; background: var(--pc, #d9a400); color: #111;
  font-size: 8.5px; font-weight: 800; display: flex; align-items: center; justify-content: center; }

.tv-draw { position: relative; flex: 1 1 auto; min-width: 0; display: flex; }
.tv-draw > .mx-chart { flex: 1 1 auto; width: 100%; }
.tv-draw__ov { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.tv-draw__ov line { vector-effect: non-scaling-stroke; }
.tv-draw__ov .tl { stroke: var(--pc, #ef7d3a); stroke-width: 1.7; }
.tv-draw__ov .fib { stroke: var(--pc, #ef7d3a); stroke-width: 1; stroke-dasharray: 3 3; opacity: .5; }

.tv-soon { display: inline-block; margin-left: 6px; font-size: 8px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  color: var(--pc, #7c45e8); border: 1px solid currentColor; border-radius: 999px; padding: 1px 5px; vertical-align: middle; opacity: .9; }

/* ===== brand accents on the panels + layout variation + extra content ===== */
/* every KPI card wears its panel's brand colour on the top edge */
.tvert .pacc__kpi { border-top: 2px solid var(--pc, var(--accent)); }
/* panel title gets a small brand tick before it */
.tvert__gfx .term-panel__title { display: inline-flex; align-items: center; gap: 8px; }
.tvert__gfx .term-panel__title::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: var(--pc, var(--accent)); flex: none; }
/* active-oscillator bars + fac bars pick up the brand colour */
.tvert .tvert__fac-row .t i { background: var(--pc, var(--accent)); }
.tvert .s-terminal__bar span { background: var(--pc, var(--accent)); }

/* layout variation: flip the module to the LEFT of the chart on some panels */
.tvert__lower--flip { flex-direction: row-reverse; }
.tvert__lower--flip .tvert__mod { border-left: 0; border-right: 1px solid var(--border); padding-left: 0; padding-right: 15px; }

/* volume / oscillator histogram strip below a chart */
.tv-strip { flex: none; margin-top: 9px; }
.tv-strip__h { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; display: flex; justify-content: space-between; }
.tv-strip__h span { color: var(--text-2); font-family: var(--font-mono); font-weight: 600; letter-spacing: 0; }
.tv-bars { display: grid; grid-template-columns: repeat(30, 1fr); gap: 2px; align-items: end; height: 68px; }
.tv-bars i { display: block; background: var(--pc, var(--accent)); opacity: .6; border-radius: 1px; }
.tv-bars i.dn { background: var(--muted); opacity: .35; }
.tv-osc { position: relative; height: 64px; border: 1px solid var(--border); border-left: 2px solid var(--pc, var(--accent)); }
.tv-osc svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.tv-osc__band { position: absolute; left: 0; right: 0; background: var(--pc, var(--accent)); opacity: .07; }

/* chat bubble: readable on any dark brand accent */
.tv-chat__q { color: #fff; }
[data-theme="dark"] .tv-chat__q { color: #0b1020; }
.tv-chat__ai { color: #fff; }
[data-theme="dark"] .tv-chat__ai { color: #0b1020; }

/* ===== panel heading + product info ===== */
.tv-head { flex: none; margin-bottom: 13px; padding-right: 78px; }
.tv-head__t { font-family: var(--font-display); font-weight: 800; font-size: 19px; line-height: 1.15; letter-spacing: -.02em; color: var(--text); margin: 0 0 6px; display: flex; align-items: center; gap: 9px; }
.tv-badge { font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.tv-badge--live { color: var(--pc, var(--accent)); background: color-mix(in srgb, var(--pc, var(--accent)) 15%, transparent); }
.tv-badge--soon { color: var(--pc, var(--accent)); border: 1px solid currentColor; }
.tv-head__p { margin: 0; font-size: 12px; line-height: 1.5; color: var(--text-2); max-width: 66ch; }

/* ===== screener table ===== */
.tv-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.tv-table th { text-align: right; font-size: 9.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 7px 9px; border-bottom: 1px solid var(--border); }
.tv-table th:first-child, .tv-table td:first-child { text-align: left; }
.tv-table td { text-align: right; padding: 8px 9px; border-bottom: 1px solid var(--border); color: var(--text); font-family: var(--font-mono); }
.tv-table td:first-child { font-weight: 700; font-family: var(--font-sans); }
.tv-table tbody tr:last-child td { border-bottom: 0; }
.tv-table .up { color: var(--green); } .tv-table .down { color: var(--red); }
.tv-table .q { color: var(--pc, var(--accent)); font-weight: 700; }

/* ===== breadth donut =====
   A real circular donut (the global sharp-corner reset is beaten with !important —
   same trick as .mx-rot) with three true segments: advancing / declining / unchanged. */
.tv-breadth-row { display: flex; align-items: center; gap: 24px; margin: 6px 0 2px; }
.tv-donut { --adv: 59.6; --dec: 34.4; width: 126px; height: 126px; flex: none; border-radius: 50% !important; position: relative;
  background: conic-gradient(var(--green) 0 calc(var(--adv) * 1%),
    var(--red) calc(var(--adv) * 1%) calc((var(--adv) + var(--dec)) * 1%),
    var(--muted) calc((var(--adv) + var(--dec)) * 1%) 100%);
  box-shadow: 0 2px 12px rgba(15, 20, 40, .12); }
.tv-donut::after { content: ""; position: absolute; inset: 16px; border-radius: 50% !important; background: var(--bg-elev); }
.tv-donut__c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 1; }
.tv-donut__c b { font-family: var(--font-mono); font-size: 23px; font-weight: 800; color: var(--text); line-height: 1; }
.tv-donut__c span { font-size: 9.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }
.tv-donut-legend { display: flex; flex-direction: column; gap: 11px; font-size: 12px; flex: none; min-width: 168px; }
.tv-donut-legend div { white-space: nowrap; }
.tv-donut-legend b { margin-left: auto; }
.tv-donut-legend div { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.tv-donut-legend b { color: var(--text); font-family: var(--font-mono); }
.tv-donut-legend i { width: 11px; height: 11px; border-radius: 2px; flex: none; }

/* ===== monthly-returns diverging bars ===== */
.tv-mret { position: relative; flex: 1 1 auto; display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; min-height: 128px; margin-top: 6px; }
.tv-mret::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--border); }
.tv-mret__c { position: relative; }
.tv-mret__c i { position: absolute; left: 0; right: 0; border-radius: 2px; }
.tv-mret__c i.up { bottom: 50%; margin-bottom: 1px; background: var(--green); }
.tv-mret__c i.down { top: 50%; margin-top: 1px; background: var(--red); }
