/* ================================================================
   INTRINSICIQ — Frontend Stylesheet
   Aesthetic: Deep Night · Golden Terminal
   ================================================================ */

/* Reset, design tokens, and shared helpers now live in css/tokens.css +
   css/base.css (loaded before this file). This stylesheet holds the
   workspace/valuation-specific styles only. */

/* ── Light theme ("Ivory") ──
   Token values live in css/tokens.css; the base `body` rule in css/base.css.
   The rules below are the app-specific light-mode component overrides. ── */

/* State tints: the dark theme's bright-color washes go muddy on paper —
   re-tint from the light semantic set. */
[data-theme="light"] #verdict-card.undervalued  { background: rgba(26,122,74,0.06);  border-color: rgba(26,122,74,0.35); }
[data-theme="light"] #verdict-card.overvalued   { background: rgba(178,53,39,0.05);  border-color: rgba(178,53,39,0.32); }
[data-theme="light"] #verdict-card.fairly-valued{ background: rgba(138,106,23,0.06); border-color: rgba(138,106,23,0.30); }
[data-theme="light"] #verdict-card.no-value     { background: rgba(90,86,78,0.06);   border-color: rgba(90,86,78,0.30); }
[data-theme="light"] .no-value .verdict-badge   { background: rgba(90,86,78,0.10);   color: var(--text-muted); border-color: rgba(90,86,78,0.30); }
[data-theme="light"] .undervalued .verdict-badge{ background: rgba(26,122,74,0.10);  color: var(--green); border-color: rgba(26,122,74,0.35); }
[data-theme="light"] .overvalued  .verdict-badge{ background: rgba(178,53,39,0.09);  color: var(--red);   border-color: rgba(178,53,39,0.32); }

/* Growth badges carried literal bright text colours — unreadable on ivory. */
[data-theme="light"] .growth-profile-badge[data-rule="A"] { background: rgba(26,122,74,0.09);  border-color: rgba(26,122,74,0.35);  color: var(--green); }
[data-theme="light"] .growth-profile-badge[data-rule="B"] { background: rgba(143,91,18,0.09);  border-color: rgba(143,91,18,0.35);  color: var(--warn); }
[data-theme="light"] .growth-profile-badge[data-rule="C"] { background: rgba(166,84,25,0.09);  border-color: rgba(166,84,25,0.35);  color: #a6541a; }

/* Bull/bear column washes */
[data-theme="light"] .bbb-col.bear { background: rgba(178,53,39,0.05); }
[data-theme="light"] .bbb-col.bull { background: rgba(26,122,74,0.05); }

/* Keyboard hint chip: parchment, not charcoal */
[data-theme="light"] .sl-keys kbd { background: var(--surface); border-color: var(--border); }

/* Root element defaults (html/body) and typography/colour helpers
   (.mono .serif .amber .label .hidden …) moved to css/base.css. */

/* ═══════════════════════════════════════════════════════════════
   LAYOUT: SIDEBAR + MAIN CONTENT
   ═══════════════════════════════════════════════════════════════ */

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
#sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
  overflow: hidden;
}

.sidebar-brand {
  padding: 18px 16px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
}

.sidebar-brand-text h1 {
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.025em;
}

.sidebar-brand-text h1 span { color: var(--gold); }

.sidebar-brand-text .tagline {
  max-width: 135px;
  font-size: 8px;
  color: var(--text-dim);
  letter-spacing: .015em;
  line-height: 1.35;
  display: block;
  margin-top: 3px;
  font-family: var(--sans);
}

.sidebar-home-link {
  display: flex; align-items: center; gap: 9px;
  margin: 4px 10px 0; padding: 9px 12px;
  border: 1px solid var(--border-zinc); border-radius: var(--r-ctl);
  color: var(--text-muted); text-decoration: none;
  font-size: 13px; font-weight: 600; letter-spacing: .02em;
  transition: background .15s, border-color .15s, color .15s;
}
.sidebar-home-link:hover { background: var(--gold-bg); border-color: var(--border-light); color: var(--gold); }
.sidebar-home-link.active { background: var(--gold-bg); border-color: var(--border-light); color: var(--gold); cursor: default; }
.sidebar-home-icon { font-size: 15px; line-height: 1; }

#sidebar-nav {
  flex: 1;
  padding: var(--s2) 10px;
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  overflow-y: auto;
  scrollbar-width: none;
}
#sidebar-nav::-webkit-scrollbar { display: none; }

/* ── Workspace rail: the session's research (rail.js) ───────────────
   Tabs (top bar) switch views of the current company; these switch
   which company you are looking at. */
.rail-h {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 10px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-dim);
  padding: 0 var(--s2) var(--s1);
  border-bottom: 1px solid var(--border-zinc);
  margin-bottom: var(--s1);
}
.rail-h-note { font-family: var(--mono); font-size: 9px; text-transform: none; letter-spacing: 0; }
.rail-empty { padding: var(--s2); font-size: 10px; color: var(--text-dim); line-height: 1.5; }

.tk {
  display: flex; align-items: center; gap: var(--s2);
  width: 100%;
  padding: 6px var(--s2);
  background: none; border: 1px solid transparent; border-radius: var(--r-ctl);
  font-family: var(--mono); font-size: 12px;
  color: var(--text); cursor: pointer; text-align: left;
  transition: background .12s, border-color .12s;
}
.tk:hover { background: var(--surface-hover); }
.tk.tk-active {
  background: var(--gold-bg);
  border-color: rgba(212,175,55,0.22);
}
.tk .tk-sym { font-weight: 500; letter-spacing: .04em; }
.tk.tk-active .tk-sym { color: var(--gold); }
.tk .tk-chg { margin-left: auto; font-size: 10px; }
.tk .tk-chg.up { color: var(--green); }
.tk .tk-chg.dn { color: var(--red); }
.tk .tk-chg.na { color: var(--text-dim); }

.rail-scen {
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--s2);
  width: 100%;
  padding: 5px var(--s2);
  background: none; border: none; border-radius: var(--r-ctl);
  font-size: 11px; color: var(--text-muted); cursor: pointer; text-align: left;
  transition: background .12s, color .12s;
}
.rail-scen:hover { background: var(--surface-hover); color: var(--text); }
.rail-scen .v { font-family: var(--mono); font-size: 10px; color: var(--text-dim); white-space: nowrap; }

.sidebar-footer {
  padding: 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.workspace-theme-toggle {
  width: 100%;
  min-height: 32px;
  margin-bottom: 7px;
  padding: 6px 9px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-zinc);
  border-radius: var(--r-ctl);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}
.workspace-theme-toggle:hover {
  border-color: var(--border-light);
  background: var(--surface);
  color: var(--text);
}
.workspace-theme-icon { width: 14px; color: var(--gold); text-align: center; }
.sidebar-upgrade-btn {
  width: 100%;
  background: var(--gold-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--r-ctl);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: background .15s;
  text-align: left;
  text-decoration: none;
}
.sidebar-upgrade-btn:hover { background: rgba(242,202,80,0.15); }
.sidebar-upgrade-icon { font-size: 14px; }
.sidebar-upgrade-title { font-size: 12px; font-weight: 700; color: var(--gold); display: block; }
.sidebar-upgrade-sub   { font-size: 10px; color: var(--text-muted); margin-top: 1px; }

/* ── Main content ── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.workspace-mobile-nav { display: none; }

/* ═══════════════════════════════════════════════════════════════
   TOP BAR (slim header)
   ═══════════════════════════════════════════════════════════════ */
#app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 var(--s4);
  min-height: 58px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;   /* true centre for the search */
  align-items: stretch;
  position: sticky;
  top: 0;
  z-index: 100;
}

/* ── Inline ticker search (the centered hero is gone) ── */
.header-search {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: var(--s2);
}
#ticker-input {
  width: 280px;
  background: var(--surface-alt);
  border: 1px solid var(--border-zinc);
  border-radius: var(--r-ctl);
  padding: 10px 14px;
  font-family: var(--mono);
  font-size: 15px;
  color: var(--text);
  letter-spacing: .04em;
  text-transform: uppercase;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
#ticker-input:focus {
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px var(--gold-bg);
}
#ticker-input::placeholder { color: var(--text-dim); text-transform: none; }

#analyze-btn {
  background: var(--gilt-button);
  border: 1px solid rgba(148,116,23,.8);
  box-shadow: inset 0 1px 0 rgba(255,246,214,.55);
  border-radius: var(--r-ctl);
  padding: 10px 18px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #111;
  cursor: pointer;
  transition: filter .15s, transform .1s;
  white-space: nowrap;
}
#analyze-btn:hover   { filter: brightness(1.05); }
#analyze-btn:active  { transform: scale(.97); }
#analyze-btn:disabled{ filter: grayscale(.7) brightness(.8); cursor: not-allowed; }

/* Tabs live in the bar: right-aligned, full bar height, underline active */
#app-header .dash-tabs { grid-column: 3; justify-self: end; border-bottom: none; align-self: stretch; }
#app-header .dash-tab  { padding: 0 var(--s4); margin-bottom: 0; display: inline-flex; align-items: center; }

/* ── Fetch feedback under the bar ── */
#feedback-strip { padding: 0 var(--s4); }
#feedback-strip .error-msg { margin: var(--s3) 0 0; max-width: 560px; }
#feedback-strip .loader    { margin: var(--s3) 0 0; }

/* ── Loading spinner ── */
.loader {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--text-muted);
  font-size: 11px;
}
.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border-zinc);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════════
   COMPANY STRIP
   ═══════════════════════════════════════════════════════════════ */
#company-strip {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: var(--s2) var(--s5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.co-name {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}
.co-meta { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.co-tag { display: flex; flex-direction: column; gap: 1px; }
.co-tag .val { font-family: var(--mono); font-size: 12px; color: var(--text); }
.model-badge {
  padding: 3px 10px;
  border-radius: var(--r-ctl);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  background: var(--gold-bg);
  border: 1px solid var(--gold-dim);
  color: var(--gold);
}
.price-display { font-family: var(--mono); font-size: 22px; color: var(--text); }
.price-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .07em; }
.growth-profile-badge {
  padding: 3px 10px; border-radius: var(--r-ctl);
  font-size: 10px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  border: 1px solid; cursor: default;
}
.growth-profile-badge[data-rule="A"] { background: rgba(34,197,94,.10); border-color: rgba(34,197,94,.35); color: #4ade80; }
.growth-profile-badge[data-rule="B"] { background: rgba(251,191,36,.10); border-color: rgba(251,191,36,.35); color: var(--warn); }
.growth-profile-badge[data-rule="C"] { background: rgba(249,115,22,.10); border-color: rgba(249,115,22,.35); color: #fb923c; }
.growth-profile-badge[data-rule="D"] { background: var(--surface-alt); border-color: var(--border-zinc); color: var(--text-muted); }

/* ── About: company description folded into the strip ── */
.co-about-btn {
  font-size: 10px; color: var(--gold-dim);
  background: none; border: 1px solid var(--border-zinc);
  border-radius: var(--r-ctl); padding: 3px 9px; cursor: pointer;
  transition: color .12s, border-color .12s;
}
.co-about-btn:hover { color: var(--gold); border-color: var(--border-light); }
.co-about-panel { flex-basis: 100%; display: none; padding: var(--s2) 0 var(--s1); }
.co-about-panel.about-open { display: block; }
/* Opening the panel was the opt-in — clamping inside it would just cut the
   text mid-word (the old card's 4-line clamp did exactly that). Full text. */
.co-about-panel .co-description {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
  text-align: left;
  /* Long descriptions flow into newspaper columns: full strip width, ~42ch
     per column, a third of the height of one narrow tower of text. The
     browser adds/removes columns as the viewport allows. */
  max-width: none;
  column-width: 42ch;
  column-gap: var(--s6);
  column-rule: 1px solid var(--border-zinc);
}
.co-about-panel .co-readmore { display: none; }

/* ═══════════════════════════════════════════════════════════════
   DATA PROVENANCE STRIP — statement periods behind the valuation
   ═══════════════════════════════════════════════════════════════ */
#prov-strip {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: var(--s1) var(--s5);
}
.prov-line {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.prov-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .1em;
  white-space: nowrap;
}
.prov-summary {
  font-size: 11px;
  color: var(--text-muted);
}
.prov-chip {
  padding: 2px 9px;
  border-radius: var(--r-ctl);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  background: rgba(251,191,36,.10);
  border: 1px solid rgba(251,191,36,.35);
  color: var(--warn);
  cursor: pointer;
}
.prov-chip.prov-chip-info {
  background: var(--surface-alt);
  border-color: var(--border-zinc);
  color: var(--text-muted);
  font-weight: 500;
}
.prov-toggle {
  margin-left: auto;
  padding: 2px 8px;
  background: none;
  border: 1px solid var(--border-zinc);
  border-radius: var(--r-ctl);
  font-size: 10px;
  color: var(--text-muted);
  cursor: pointer;
}
.prov-toggle:hover, .prov-chip:hover { border-color: var(--border-light); }
.prov-detail {
  margin-top: 8px;
  padding: var(--s3);
  background: var(--surface-alt);
  border: 1px solid var(--border-zinc);
  border-radius: var(--r-panel);
}
.prov-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 3px 0;
  border-bottom: 1px solid var(--border-zinc);
  font-size: 11px;
}
.prov-row .k { color: var(--text-muted); }
.prov-row .v { color: var(--text); }
.prov-adj-title {
  margin-top: 10px;
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .1em;
}
.prov-adj {
  display: grid;
  /* Full-width panel: give the field and old->new columns room to state the
     change without wrapping; the reason prose takes the rest. */
  grid-template-columns: 160px minmax(240px, 30%) 1fr;
  gap: var(--s4);
  padding: 5px 0;
  border-bottom: 1px solid var(--border-zinc);
  font-size: 11px;
  border-left: 2px solid var(--border-zinc);
  padding-left: 8px;
  margin-top: 4px;
}
.prov-adj[data-severity="warning"]  { border-left-color: var(--warn); }
.prov-adj[data-severity="critical"] { border-left-color: var(--red); }
.prov-adj-field  { color: var(--text); overflow-wrap: anywhere; }
.prov-adj-change { color: var(--text); overflow-wrap: anywhere; min-width: 0; }
.prov-adj-reason { color: var(--text-muted); }
.prov-adj-none   { font-size: 11px; color: var(--text-muted); padding: 5px 0; }
@media (max-width: 720px) {
  .prov-adj { grid-template-columns: 1fr; gap: 2px; }
}

/* ═══════════════════════════════════════════════════════════════
   MAIN DASHBOARD
   ═══════════════════════════════════════════════════════════════ */
#dashboard {
  max-width: 1340px;
  margin: 0 auto;
  padding: var(--s4) var(--s5) var(--s6);
  display: grid;
  gap: var(--s3);
}

/* ── Card shell ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-panel);
  padding: var(--s3) var(--s4);
}
.card-title {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .015em;
  color: var(--text);
  margin-bottom: 4px;
}
.card-subtitle { font-size: 11px; color: var(--text-muted); margin-bottom: var(--s2); }
.card-divider { height: 1px; background: var(--border); margin: 10px 0; }

/* ═══════════════════════════════════════════════════════════════
   VERDICT CARD
   ═══════════════════════════════════════════════════════════════ */
#verdict-card {
  position: relative;
  border-radius: var(--r-panel);
  padding: var(--s4) var(--s5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border: 1px solid var(--border);
  transition: border-color .3s, background .3s;
  flex-wrap: wrap;
}
#verdict-card.undervalued {
  background: rgba(34,197,94,0.05);
  border-color: rgba(34,197,94,0.3);
}
#verdict-card.overvalued {
  background: rgba(239,68,68,0.05);
  border-color: rgba(239,68,68,0.3);
}
#verdict-card.fairly-valued {
  background: rgba(242,202,80,0.04);
  border-color: rgba(242,202,80,0.25);
}
/* Neutral state when no reliable valuation is available (suppressed / low coverage). */
#verdict-card.no-value {
  background: rgba(148,163,184,0.05);
  border-color: rgba(148,163,184,0.3);
}
.no-value .verdict-badge { background: rgba(148,163,184,.14); color: var(--text-muted); border: 1px solid rgba(148,163,184,.3); }
.no-value .verdict-label { color: var(--text-muted); }
.verdict-left { display: flex; flex-direction: column; gap: 6px; }
.verdict-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--r-ctl);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  margin-bottom: 4px;
  width: fit-content;
}
.undervalued  .verdict-badge { background: rgba(34,197,94,.14);  color: var(--green); border: 1px solid rgba(34,197,94,.3); }
.overvalued   .verdict-badge { background: rgba(239,68,68,.14);  color: var(--red);   border: 1px solid rgba(239,68,68,.3); }
.fairly-valued .verdict-badge{ background: var(--gold-bg);       color: var(--gold);  border: 1px solid var(--gold-dim); }

.verdict-label {
  font-family: var(--display);
  font-size: 42px;
  font-weight: 500;
  letter-spacing: .01em;
  line-height: 1;
}
.undervalued  .verdict-label { color: var(--green); }
.overvalued   .verdict-label { color: var(--red); }
.fairly-valued .verdict-label{ color: var(--gold); }

.verdict-summary { font-size: 12px; color: var(--text-muted); line-height: 1.55; max-width: 340px; }
.verdict-right { display: flex; gap: 32px; flex-wrap: wrap; }
.verdict-stat { display: flex; flex-direction: column; gap: 4px; }
.verdict-stat .slbl {
  font-size: 10px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-dim);
}
.verdict-stat .sval {
  font-family: var(--mono);
  font-size: 22px;
  color: var(--gold);
  line-height: 1;
}
.verdict-stat .sval.up   { color: var(--green); }
.verdict-stat .sval.down { color: var(--red); }
.verdict-ci { font-family: var(--mono); font-size: 12px; color: var(--text-muted); }

/* ── Floored-to-zero verdicts (FE): a DCF value of $0 is the limited-liability
   equity floor (max(EV − net_debt, 0)), not a price. Two honest, state-specific
   verdicts replace the misleading red "−100% Overvalued". ──────────────────── */
#verdict-card.floored.over-levered,
#verdict-card.floored.unreliable {
  background: var(--gold-bg);
  border-color: rgba(242,202,80,0.30);
}
#verdict-card.floored.negative-fcf {
  background: rgba(148,163,184,0.05);
  border-color: rgba(148,163,184,0.30);
}
.floored.over-levered .verdict-badge,
.floored.unreliable   .verdict-badge { background: var(--gold-bg);          color: var(--gold);       border: 1px solid var(--gold-dim); }
.floored.negative-fcf .verdict-badge { background: rgba(148,163,184,.14);   color: var(--text-muted); border: 1px solid rgba(148,163,184,.3); }
.floored.over-levered .verdict-label,
.floored.unreliable   .verdict-label { color: var(--gold); }
.floored.negative-fcf .verdict-label { color: var(--text); }

/* "NM" (not meaningful) value + a one-line reason inside the stat slot */
.verdict-stat .sval.verdict-ivps-nm       { color: var(--gold); }
.floored.negative-fcf .sval.verdict-ivps-nm { color: var(--text-muted); }
.nm-cap {
  display: block;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  color: var(--text-dim);
  line-height: 1.35;
  margin-top: 6px;
  max-width: 18ch;
}

/* Back-Solver call-to-action — the primary action when the model abstains */
.verdict-cta {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  padding: 8px 14px;
  border-radius: var(--r-ctl);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .01em;
  text-decoration: none;
  cursor: pointer;
  color: var(--bg);
  background: var(--gold);
  border: none;
  transition: filter .12s ease, transform .12s ease;
}
.verdict-cta:hover        { filter: brightness(1.08); transform: translateY(-1px); }
.verdict-cta:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.floored.negative-fcf .verdict-cta { background: var(--text-muted); }
.verdict-cta .arw        { transition: transform .15s ease; }
.verdict-cta:hover .arw  { transform: translateX(3px); }
@media (prefers-reduced-motion: reduce) {
  .verdict-cta, .verdict-cta .arw { transition: none; }
  .verdict-cta:hover { transform: none; }
}

/* ═══════════════════════════════════════════════════════════════
   BULL / BASE / BEAR PANEL
   ═══════════════════════════════════════════════════════════════ */
.bbb-panel {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  border-radius: var(--r-panel);
  overflow: hidden;
  border: 1px solid var(--border);
}
.bbb-col {
  padding: var(--s3) var(--s4);
  text-align: center;
  border-right: 1px solid var(--border);
}
.bbb-col:last-child { border-right: none; }
.bbb-col.bear { background: rgba(239,68,68,0.04); }
.bbb-col.base { background: var(--surface-alt); }
.bbb-col.bull { background: rgba(34,197,94,0.04); }
.bbb-label {
  font-size: 10px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; margin-bottom: var(--s2);
}
.bbb-col.bear .bbb-label { color: var(--red); }
.bbb-col.base .bbb-label { color: var(--gold); }
.bbb-col.bull .bbb-label { color: var(--green); }
.bbb-value {
  font-family: var(--mono);
  font-size: 26px;
  color: var(--text);
  line-height: 1;
  margin-bottom: 6px;
}
.bbb-upside { font-family: var(--mono); font-size: 12px; }
.bbb-col.bear .bbb-upside { color: var(--red); }
.bbb-col.base .bbb-upside { color: var(--text-muted); }
.bbb-col.bull .bbb-upside { color: var(--green); }
.bbb-desc { font-size: 10px; color: var(--text-dim); margin-top: 6px; line-height: 1.4; }

/* Range bar */
.range-bar-wrap { margin: 16px 12px 4px; }
.range-bar-track {
  height: 6px; background: var(--border-zinc); border-radius: var(--r-ctl);
  position: relative; margin: 14px 0 8px;
}
.range-bar-gradient {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: var(--r-ctl);
  background: linear-gradient(90deg,
    rgba(239,68,68,0.5) 0%,
    rgba(212,175,55,0.65) 50%,
    rgba(34,197,94,0.5) 100%);
}
.range-price-pin {
  position: absolute; top: -10px;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; z-index: 2;
}
.range-price-needle { width: 2px; height: 26px; background: var(--text); border-radius: 1px; }
.range-price-tag {
  font-size: 10px; font-family: var(--mono); color: var(--text);
  background: var(--surface-alt); padding: 1px 5px;
  border: 1px solid var(--border-light); border-radius: 2px;
  white-space: nowrap; margin-top: 3px;
}
.range-bar-endpoints {
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 10px; color: var(--text-muted); margin-top: 4px;
}

/* ── Metric grid ── */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.metric-card {
  background: var(--surface-alt);
  border: 1px solid var(--border-zinc);
  border-radius: var(--r-panel);
  padding: var(--s2) var(--s3);
}
.metric-card .lbl { margin-bottom: 4px; }
.metric-card .val { font-family: var(--mono); font-size: 18px; color: var(--text); }
.metric-card .sub { font-size: 10px; color: var(--text-dim); margin-top: 2px; }

/* ── Top row: financials + WACC ── */
#top-row {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: var(--s3);
}

/* ── WACC breakdown ── */
.wacc-big { font-family: var(--mono); font-size: 32px; color: var(--text); margin-bottom: 8px; }
.wacc-row {
  display: flex; justify-content: space-between;
  padding: 5px 0; border-bottom: 1px solid var(--border-zinc); font-size: 11px;
}
.wacc-row .k { color: var(--text-muted); }
.wacc-row .v { font-family: var(--mono); color: var(--text); }

/* ── Assumptions panel ── */
#assumptions-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-panel);
  display: flex;
  flex-direction: column;
}
.panel-header {
  padding: 12px 14px 8px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.panel-body { padding: var(--s3); overflow-y: auto; flex: 1; }
.model-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.model-tab {
  background: none;
  border: 1px solid var(--border-zinc);
  border-radius: var(--r-ctl);
  padding: 3px 10px;
  font-family: var(--sans);
  font-size: 10px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-muted);
  cursor: pointer; transition: all .15s;
}
.model-tab.active {
  background: var(--gold-bg);
  border-color: var(--gold-dim);
  color: var(--gold);
}
.input-group { margin-bottom: 16px; }
.input-group-label {
  font-size: 10px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-muted);
  padding-bottom: var(--s1); margin-bottom: var(--s2);
  border-bottom: 1px solid var(--border);
}
.input-row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.input-row .lbl { flex: 1; font-size: 11px; color: var(--text-muted); line-height: 1.3; }
.input-row .hint { font-size: 10px; color: var(--text-dim); display: block; margin-top: 1px; }
.num-input {
  width: 78px;
  background: var(--surface-alt);
  border: 1px solid var(--border-zinc);
  border-radius: var(--r-ctl);
  padding: 3px 6px;
  text-align: right;
  font-family: var(--mono); font-size: 12px; color: var(--text);
  outline: none; transition: border-color .15s;
  -moz-appearance: textfield;
}
.num-input::-webkit-inner-spin-button,
.num-input::-webkit-outer-spin-button { display: none; }
.num-input:focus { border-color: var(--gold-dim); }

/* ── Custom +/− spinner ── */
.num-spinner { display: flex; align-items: stretch; gap: 2px; }
.num-spinner .num-input { flex: 1; min-width: 0; text-align: center; }
.spinner-btn {
  width: 22px;
  background: var(--surface-alt);
  border: 1px solid var(--border-zinc);
  border-radius: 2px;
  color: var(--text-muted); font-size: 14px; line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  transition: background .12s, color .12s, border-color .12s;
  user-select: none; font-family: var(--mono);
}
.spinner-btn:hover {
  background: var(--surface-hover);
  color: var(--gold);
  border-color: var(--gold-dim);
}
.spinner-btn:active { opacity: .65; }
.input-suffix { font-family: var(--mono); font-size: 10px; color: var(--text-muted); width: 16px; }

.run-btn {
  width: 100%;
  margin-top: 16px;
  background: var(--gilt-button);
  border: 1px solid rgba(148,116,23,.8);
  box-shadow: inset 0 1px 0 rgba(255,246,214,.55);
  border-radius: var(--r-ctl);
  padding: 10px;
  font-family: var(--sans); font-size: 10px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: #0D0B09;
  cursor: pointer; transition: background .2s;
}
.run-btn:hover { background: linear-gradient(180deg, #fae48f 0%, #f0d068 55%, #ddb841 100%); }
.growth-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }

/* ── Result panel ── */
#result-panel { display: flex; flex-direction: column; gap: 12px; }
.ivps-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-panel);
  padding: var(--s4);
  display: flex; align-items: center; gap: 28px;
}
.ivps-main .lbl { margin-bottom: 6px; }
.ivps-main .value {
  font-family: var(--mono);
  font-size: 42px;
  color: var(--gold);
  background: var(--gilt);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -.02em;
  line-height: 1;
}
.ivps-main .upside { margin-top: 6px; font-family: var(--mono); font-size: 14px; }
.ivps-divider { width: 1px; background: var(--border); align-self: stretch; }
.ivps-meta { display: flex; flex-direction: column; gap: 10px; }
.ivps-stat .slbl { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 2px; }
.ivps-stat .sval { font-family: var(--mono); font-size: 14px; color: var(--text); }

/* Value bridge */
.bridge-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 0; border-bottom: 1px solid var(--border-zinc);
}
.bridge-row:last-child { border-bottom: none; border-top: 2px solid var(--border); font-weight: 700; }

/* ── Model Breakdown rows ──
   These reuse .bridge-row but are a LIST, not a computation — the last row
   must not inherit the bridge's bold "total" treatment (it made the final
   model, often a 0%-weight cross-check, look like the headline number). */
.model-row:last-child,
.bridge-row--plain:last-child { border-top: none; font-weight: inherit; border-bottom: none; }
.model-row--primary { box-shadow: inset 2px 0 0 var(--gold-dim); padding-left: var(--s2); }
.model-tag {
  display: inline-block; margin-left: 6px; padding: 1px 7px;
  border: 1px solid var(--border-zinc); border-radius: var(--r-ctl);
  font-size: 10px; letter-spacing: .04em; color: var(--text-dim);
  vertical-align: middle;
}
.model-tag--primary {
  background: var(--gold-bg); border-color: var(--gold-dim); color: var(--gold);
  font-weight: 600;
}
.bridge-row .bk { font-size: 11px; color: var(--text-muted); }
.bridge-row .bn { font-size: 10px; color: var(--text-dim); }
.bridge-row .bv { font-family: var(--mono); font-size: 12px; }

/* ── Data tables ── */
.data-table-wrap { overflow-x: auto; }
.data-table {
  width: 100%; border-collapse: collapse;
  font-family: var(--mono); font-size: 11px;
}
.data-table th {
  text-align: right; padding: var(--s1) var(--s2);
  font-family: var(--sans); font-size: 10px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.data-table th:first-child { text-align: left; }
.data-table td {
  text-align: right; padding: 5px 10px;
  color: var(--text); border-bottom: 1px solid var(--border-zinc); white-space: nowrap;
}
.data-table td:first-child { text-align: left; color: var(--text); }
.data-table tr:nth-child(even) td { background: rgba(255,255,255,.022); }
/* Hover marks the row with a rule rather than washing it with a tint — the
   figures stay on the same background, so the eye compares them honestly. */
.data-table tbody tr:hover td { background: rgba(255,255,255,.05); }
.data-table tbody tr:hover td:first-child { box-shadow: inset 2px 0 0 var(--gold); }

/* ── Per-year editor ── */
.th-editable { cursor: pointer; user-select: none; position: relative; white-space: nowrap; }
.th-label { vertical-align: middle; }
.th-edit-pill {
  display: inline-block; margin-left: 5px;
  padding: 1px 5px; border: 1px solid var(--gold-dim);
  border-radius: var(--r-ctl); font-size: 10px; font-weight: 600; letter-spacing: .04em;
  color: var(--gold-dim); opacity: 0.55;
  transition: opacity .15s, border-color .15s, color .15s; vertical-align: middle;
}
.th-editable:hover .th-edit-pill, .th-edit-pill--open {
  opacity: 1 !important; border-color: var(--gold); color: var(--gold);
}
.th-edit-pill--open { background: var(--gold-bg); }
.th-custom-badge {
  display: inline-flex; align-items: center; gap: 4px;
  margin-left: 5px; padding: 1px 5px 1px 6px;
  border-radius: var(--r-ctl); background: var(--gold-bg);
  border: 1px solid var(--gold-dim); font-size: 10px; font-weight: 700;
  letter-spacing: .06em; color: var(--gold); vertical-align: middle;
}
.th-custom-clear {
  cursor: pointer; font-size: 10px; color: var(--gold-dim);
  line-height: 1; padding: 0 1px; border-radius: 2px;
  transition: color .12s, background .12s;
}
.th-custom-clear:hover { color: var(--text); background: rgba(255,255,255,.08); }
.td-overridden {
  color: var(--gold) !important;
  border-left: 2px solid var(--gold-dim);
  background: var(--gold-bg) !important;
}
.row-analyst-anchored td {
  background: rgba(96,165,250,0.06) !important;
}
.row-analyst-anchored td:first-child::after {
  content: " ★";
  font-size: 10px;
  color: var(--blue);
  opacity: 0.8;
}

/* ── Year editor panel ── */
.year-editor-panel {
  background: var(--surface); border: 1px solid var(--gold-dim);
  border-radius: var(--r-panel); padding: var(--s3); margin-top: var(--s2);
}
.year-editor-hdr {
  display: flex; justify-content: space-between;
  align-items: flex-start; margin-bottom: 12px;
}
.year-editor-title-wrap { display: flex; flex-direction: column; gap: 3px; }
.year-editor-title { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); }
.year-editor-status { font-size: 10px; font-weight: 700; letter-spacing: .06em; color: var(--gold); opacity: .75; }
.year-editor-hint { font-size: 10px; color: var(--text-muted); font-family: var(--sans); }
.year-editor-close {
  cursor: pointer; font-size: 12px; color: var(--text-muted);
  line-height: 1; padding: 2px 4px; border-radius: var(--r-ctl);
  transition: color .12s, background .12s;
}
.year-editor-close:hover { color: var(--text); background: rgba(255,255,255,.06); }
.year-inputs-grid { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.year-cell { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.year-cell label { font-size: 10px; font-family: var(--mono); font-weight: 700; color: var(--text-muted); letter-spacing: .05em; }
.year-cell .num-input { width: 44px; }
.year-cell .num-spinner { width: 90px; }
.num-input--overridden { border-color: var(--gold-dim); color: var(--gold); background: var(--gold-bg); }
.num-input--changed { border-color: var(--gold); color: var(--gold); }
.year-cell-default { font-size: 10px; font-family: var(--mono); color: var(--text-dim); opacity: .7; }
.year-editor-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.year-editor-btn {
  padding: 5px 14px; border-radius: var(--r-ctl); font-size: 11px; font-weight: 600;
  cursor: pointer; border: 1px solid; transition: background .15s, color .15s, border-color .15s;
}
.year-editor-btn:disabled { opacity: .55; cursor: not-allowed; }
.year-editor-btn--apply { background: var(--gold); border-color: var(--gold); color: #111; }
.year-editor-btn--apply:not(:disabled):hover { background: #e6c25c; border-color: #e6c25c; }
.year-editor-btn--clear { background: transparent; border-color: var(--red); color: var(--red); }
.year-editor-btn--clear:hover { background: var(--red-bg); }
.year-editor-btn--reset { background: transparent; border-color: var(--border-zinc); color: var(--text-muted); }
.year-editor-btn--reset:hover { border-color: var(--text-muted); color: var(--text); }

/* ═══════════════════════════════════════════════════════════════
   SENSITIVITY MATRIX
   ═══════════════════════════════════════════════════════════════ */
#sensitivity-section .sens-controls {
  display: flex; gap: 12px; margin-bottom: 12px;
  align-items: center; flex-wrap: wrap;
}
.sens-run-btn {
  background: var(--surface-alt);
  border: 1px solid var(--border-zinc);
  border-radius: var(--r-ctl); padding: 6px 16px;
  font-family: var(--sans); font-size: 10px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--text);
  cursor: pointer; transition: background .15s;
}
.sens-run-btn:hover { background: var(--gold-bg); }
.sens-table-wrap { overflow-x: auto; }
.sens-table { border-collapse: collapse; font-family: var(--mono); font-size: 11px; }
.sens-table th {
  padding: var(--s1) var(--s3); font-family: var(--sans); font-size: 10px;
  font-weight: 600; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
}
.sens-table th.row-header { text-align: left; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.sens-table th.col-header { text-align: center; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.sens-table td { padding: 7px 14px; text-align: center; white-space: nowrap; border: 1px solid transparent; }
.sens-table td.row-label {
  text-align: left; font-family: var(--sans); font-size: 10px;
  color: var(--text-muted); letter-spacing: .08em; border-right: 1px solid var(--border);
}
.sens-legend {
  display: flex; gap: 16px; margin-top: 12px; padding-top: 10px;
  border-top: 1px solid var(--border); flex-wrap: wrap;
}
.sens-legend-item { display: flex; align-items: center; gap: 6px; font-size: 10px; color: var(--text-muted); }
.swatch { width: 12px; height: 12px; border-radius: 2px; }
.sens-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }

/* ═══════════════════════════════════════════════════════════════
   MONTE CARLO
   ═══════════════════════════════════════════════════════════════ */
#monte-carlo-section .mc-controls { display: flex; gap: 12px; margin-bottom: 12px; align-items: center; }
#mc-run-btn {
  background: var(--surface-alt); border: 1px solid var(--border-zinc);
  border-radius: var(--r-ctl); padding: 6px 16px;
  font-size: 10px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text); cursor: pointer; transition: background .15s;
}
#mc-run-btn:hover { background: var(--gold-bg); }
.mc-chart-wrap { position: relative; height: 200px; margin-top: 8px; }
.mc-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 14px; }
.mc-stat { text-align: center; }
.mc-stat .mlbl { font-size: 10px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 4px; }
.mc-stat .mval { font-family: var(--mono); font-size: 14px; color: var(--text); }
.mc-prob {
  margin-top: 10px; padding: 10px 14px;
  background: var(--gold-bg); border: 1px solid var(--gold-dim);
  border-radius: var(--r-panel); font-size: 12px; color: var(--gold); text-align: center;
}

/* ═══════════════════════════════════════════════════════════════
   NEWS FEED
   ═══════════════════════════════════════════════════════════════ */
#news-section .news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px; margin-top: 4px;
}
.news-card {
  background: var(--surface-alt);
  border: 1px solid var(--border-zinc);
  border-radius: var(--r-ctl);
  padding: var(--s3);
  display: flex; flex-direction: column; gap: 8px;
  transition: border-color .15s; text-decoration: none;
}
.news-card:hover { border-color: var(--border); }
.news-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.news-impact-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 3px; }
.news-title { font-size: 12px; color: var(--text); line-height: 1.45; flex: 1; }
.news-meta { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-dim); }
.news-publisher { font-weight: 700; }

/* ═══════════════════════════════════════════════════════════════
   PRICE ALERTS
   ═══════════════════════════════════════════════════════════════ */
#alerts-section .alerts-form {
  display: grid;
  grid-template-columns: minmax(150px, .8fr) minmax(230px, 1.25fr) minmax(130px, .65fr) auto;
  gap: 8px; margin-bottom: 16px; align-items: end;
}
.form-field { display: flex; flex-direction: column; gap: 4px; }
.form-label { font-size: 10px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--text-dim); }
.form-label span { font-weight: 400; letter-spacing: .03em; text-transform: none; }
.form-input {
  background: var(--surface-alt); border: 1px solid var(--border-zinc);
  border-radius: var(--r-ctl); padding: 7px 10px;
  font-family: var(--mono); font-size: 12px; color: var(--text);
  outline: none; transition: border-color .15s;
}
.form-input:focus { border-color: var(--gold-dim); }
.form-select {
  background: var(--surface-alt); border: 1px solid var(--border-zinc);
  border-radius: var(--r-ctl); padding: 7px 10px;
  font-family: var(--mono); font-size: 12px; color: var(--text);
  outline: none; cursor: pointer;
}
.form-select:focus { border-color: var(--gold-dim); }
.alert-add-btn {
  background: var(--gold); border: none; border-radius: var(--r-ctl);
  padding: 8px 16px; font-size: 10px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: #0D0B09; cursor: pointer; white-space: nowrap;
  transition: background .15s; height: 36px;
}
.alert-add-btn:hover { background: #e6c25c; }
.alert-add-btn:disabled,
.alert-action-btn:disabled { cursor: wait; opacity: .6; }
.monitor-kind {
  display: inline-flex; margin-left: 8px; padding: 2px 6px;
  border: 1px solid color-mix(in srgb, var(--gold) 42%, transparent);
  border-radius: 999px; color: var(--gold); font-family: var(--mono);
  font-size: 8px; letter-spacing: .1em; vertical-align: middle;
}
.alert-preview {
  grid-column: 1 / -1; min-height: 30px; padding: 7px 10px;
  border-left: 2px solid var(--border); background: var(--surface-alt);
  color: var(--text-dim); font-size: 10px; line-height: 1.5;
}
.alert-preview.met { border-left-color: var(--gold); color: var(--gold); }
.alert-form-status {
  min-height: 18px; margin: -7px 0 10px; color: var(--green);
  font-size: 10px; line-height: 1.45;
}
.alert-form-status.error { color: var(--red); }
.alerts-list { display: flex; flex-direction: column; gap: 6px; }
.alert-empty { padding: 8px 0; color: var(--text-dim); font-size: 11px; }
.alert-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 10px 12px; background: var(--surface-alt);
  border: 1px solid var(--border-zinc); border-radius: var(--r-panel); font-size: 11px;
}
.alert-row-info { min-width: 0; color: var(--text-muted); }
.alert-row-info strong { color: var(--text); }
.alert-rule-line { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.alert-observed { margin-top: 4px; color: var(--text-dim); font-size: 9px; }
.alert-status {
  padding: 2px 6px; border: 1px solid var(--border); border-radius: 999px;
  color: var(--text-dim); font-size: 8px; letter-spacing: .08em; text-transform: uppercase;
}
.alert-status.armed { border-color: color-mix(in srgb, var(--gold) 45%, transparent); color: var(--gold); }
.alert-status.triggered { border-color: color-mix(in srgb, var(--green) 45%, transparent); color: var(--green); }
.alert-status.failed { border-color: color-mix(in srgb, var(--red) 45%, transparent); color: var(--red); }
.alert-row-actions { display: flex; align-items: center; gap: 5px; flex: 0 0 auto; }
.alert-action-btn,
.alert-del-btn {
  background: transparent; border: 1px solid var(--border-zinc); color: var(--text-dim);
  font-family: var(--mono); font-size: 9px; cursor: pointer; padding: 4px 7px; border-radius: var(--r-ctl);
  transition: color .15s, background .15s;
}
.alert-action-btn:hover { color: var(--gold); border-color: var(--gold-dim); }
.alert-del-btn:hover { color: var(--red); background: var(--red-bg); }

@media (max-width: 840px) {
  #alerts-section .alerts-form { grid-template-columns: 1fr 1fr; }
  .alert-add-btn { width: 100%; }
}

@media (max-width: 560px) {
  #alerts-section .alerts-form { grid-template-columns: 1fr; }
  .alert-preview { grid-column: 1; }
  .alert-row { align-items: flex-start; flex-direction: column; }
  .alert-row-actions { width: 100%; justify-content: flex-end; }
}

/* ═══════════════════════════════════════════════════════════════
   ASSUMPTION BENCHMARKS
   ═══════════════════════════════════════════════════════════════ */
.benchmark-bar-wrap { margin-top: 3px; display: flex; align-items: center; gap: 6px; }
.benchmark-track { flex: 1; height: 3px; background: var(--border-zinc); border-radius: 2px; position: relative; }
.benchmark-sector-tick { position: absolute; top: -2px; width: 2px; height: 7px; border-radius: 1px; background: var(--text-dim); transform: translateX(-50%); }
.benchmark-current-tick { position: absolute; top: -3px; width: 2px; height: 9px; border-radius: 1px; background: var(--gold); transform: translateX(-50%); }
.benchmark-deviant { animation: pulse-amber .8s ease-in-out infinite alternate; }
@keyframes pulse-amber { from { border-color: var(--gold-dim); } to { border-color: var(--gold); } }
.benchmark-label-row { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-dim); margin-top: 1px; }
.benchmark-sector-val { color: var(--text-dim); }
.benchmark-warning {
  font-size: 10px; color: var(--gold); background: var(--gold-bg);
  border-left: 2px solid var(--gold-dim); padding: 2px 6px;
  border-radius: 0 2px 2px 0; margin-top: 3px;
}

/* ═══════════════════════════════════════════════════════════════
   PEER COMPARISON
   ═══════════════════════════════════════════════════════════════ */
.peer-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.peer-table th {
  text-align: right; padding: 5px 8px;
  color: var(--text-dim); font-weight: 600;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.peer-table th:first-child { text-align: left; }
.peer-table td {
  text-align: right; padding: 6px 8px;
  border-bottom: 1px solid var(--border-zinc);
  color: var(--text-muted); white-space: nowrap;
}
.peer-table td:first-child { text-align: left; color: var(--text); }
.peer-table tr:last-child td { border-bottom: none; }
.peer-table tr.peer-subject td { color: var(--gold); font-weight: 600; }
.peer-table tr.peer-subject td:first-child { color: var(--gold); }
.peer-na { color: var(--text-dim); }
.peer-positive { color: var(--green); }
.peer-negative { color: var(--red); }

/* ═══════════════════════════════════════════════════════════════
   STATUS LINE — fixed bottom chrome, tmux/vim register.
   Dense, monospaced, one line. Carries live state on the left and
   affordances on the right. Deliberately the only element on the page
   allowed to be this small: it is glanceable reference, not reading matter.
   ═══════════════════════════════════════════════════════════════ */
.statusline {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-w);
  right: 0;
  z-index: 150;
  height: 26px;
  display: flex;
  align-items: stretch;
  background: var(--sidebar-bg);
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1;
  user-select: none;
  overflow: hidden;
}
.sl-seg {
  display: flex;
  align-items: center;
  gap: var(--s1);
  padding: 0 10px;
  border-right: 1px solid var(--border-zinc);
  white-space: nowrap;
  color: var(--text-dim);
  text-decoration: none;
}
.sl-seg:empty { display: none; }
.sl-seg b { color: var(--text); font-weight: 500; }
.sl-quiet, .sl-quiet b { color: var(--text-dim); font-weight: 400; }

/* The subject of the whole page. The one gold thing down here. */
.sl-subject { border-right-color: var(--border); }
.sl-subject b { color: var(--gold); letter-spacing: .06em; }

.sl-neg { color: var(--red) !important; }
.sl-pos { color: var(--green) !important; }

.sl-spacer { flex: 1; }

.sl-keys { color: var(--text-dim); border-right: none; }
.sl-keys kbd {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
  background: var(--surface-alt);
  border: 1px solid var(--border-zinc);
  border-bottom-width: 2px;
  border-radius: 2px;
  padding: 1px 5px;
  line-height: 1;
}
.sl-link { color: var(--text-dim); flex-shrink: 0; }
/* The theme toggle is a <button> wearing link clothes — strip the UA chrome. */
button.sl-seg { background: none; border-top: none; border-bottom: none; border-left: none;
  font: inherit; color: var(--text-dim); cursor: pointer; }
.sl-link:hover, button.sl-seg:hover { color: var(--gold); background: var(--surface); }

/* ── Priority ──────────────────────────────────────────────────────────
   A status line that overflows is worse than a shorter one: the segments
   at the end (the links) are the ones that get clipped, and a clipped link
   is a broken control. So the bar drops segments in reverse priority as it
   narrows rather than letting anything spill.

     always      ticker · model · ivps · upside · disclaimer · methodology
     >= 1280px   + fetched · "/" hint
     >= 1560px   + as-of provenance · legal note
   ────────────────────────────────────────────────────────────────────── */
.sl-seg          { flex-shrink: 0; }
.sl-prov, .sl-legal { display: none; }
.sl-legal { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

@media (min-width: 1280px) {
  .sl-fetched, .sl-keys { display: flex; }
}
@media (min-width: 1560px) {
  .sl-prov  { display: flex; min-width: 0; flex-shrink: 1; overflow: hidden; }
  .sl-legal { display: flex; flex-shrink: 1; }
}
@media (max-width: 1279px) {
  .sl-fetched, .sl-keys { display: none; }
}

/* Keep the last row of content clear of the bar — only on pages that have
   one. The static pages share this stylesheet but keep a normal footer. */
body:has(.statusline) .main-content { padding-bottom: 26px; }

@media (max-width: 600px) {
  .statusline { left: 0; }
}

/* ═══════════════════════════════════════════════════════════════
   FOOTER — static pages only (about / methodology / pricing / disclaimer /
   insights / landing). index.html replaced its footer with the status line;
   these pages are reading matter and still want a conventional one.
   ═══════════════════════════════════════════════════════════════ */
footer {
  border-top: 1px solid var(--border);
  padding: var(--s2) var(--s5);
  display: flex; justify-content: space-between; gap: var(--s4);
  font-size: 10px; color: var(--text-dim);
}
footer a { color: var(--text-dim); text-decoration: none; }
footer a:hover { color: var(--text-muted); }

/* ── Utility ── */
.tv-warning {
  padding: 8px 12px; background: var(--gold-bg);
  border: 1px solid rgba(212,175,55,.2);
  border-radius: var(--r-ctl); font-size: 10px; color: var(--gold-dim);
}
.description-box {
  padding: 10px 14px; background: var(--surface-alt);
  border-radius: var(--r-ctl); font-size: 10px; color: var(--text-muted);
  line-height: 1.6; margin-top: 8px;
  border-left: 2px solid var(--border);
  display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden;
}

/* ── Override indicators ── */
.override-dot { color: var(--gold); font-size: 8px; vertical-align: super; margin-left: 3px; }
.num-input.overridden { border-left: 2px solid var(--gold); color: var(--gold); }

/* ── Explanation flags ── */
.flag { font-size: 10px; padding: 6px 10px; border-radius: var(--r-ctl); margin-bottom: 4px; line-height: 1.5; }
.flag-amber { background: rgba(242,202,80,0.1); border-left: 3px solid var(--gold);  color: var(--gold); }
.flag-red   { background: rgba(239,68,68,0.1);  border-left: 3px solid var(--red);   color: var(--red); }
.flag-green { background: rgba(34,197,94,0.1);  border-left: 3px solid var(--green); color: var(--green); }
/* Neutral informational note — for "review this" cautions that shouldn't read as errors. */
.flag-slate { background: rgba(161,161,170,0.08); border-left: 3px solid var(--text-muted); color: var(--text-muted); }

/* ── Street-implied lever Apply/Reset controls ── */
.lever-btn { font-size: 0.68rem; padding: 3px 8px; border-radius: var(--r-ctl); cursor: pointer; white-space: nowrap;
  background: var(--surface-alt); border: 1px solid var(--border-zinc); color: var(--text-muted);
  transition: background 0.15s, border-color 0.15s, color 0.15s; }
.lever-btn:hover { border-color: var(--text-muted); color: var(--text); }
.lever-btn--applied  { background: var(--gold-bg); border-color: var(--gold); color: var(--gold); font-weight: 600; }
.lever-btn--reset-on { background: transparent;    border-color: var(--gold); color: var(--gold); }
.lever-btn--off      { background: transparent;    border-color: var(--border-zinc); color: var(--text-dim); opacity: 0.4; cursor: default; }
.lever-row--active   { box-shadow: inset 3px 0 0 var(--gold); background: var(--gold-bg); }

/* ── Street-implied card — full width, left-aligned (the original layout) ── */
.implied-card {
  border: 1px solid var(--border-zinc); border-radius: 6px; padding: 12px 14px;
}
.implied-head    { margin-bottom: 12px; }
.implied-eyebrow { font-size: .68rem; color: var(--text-dim); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 4px; }
.implied-sub     { font-size: .70rem; color: var(--text-dim); line-height: 1.5; }

.lever-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  align-items: center; gap: 8px;
}
.lever-grid--head { padding: 0 8px 6px; border-bottom: 1px solid var(--border-zinc); }
.lever-grid--head span {
  font-size: .65rem; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: .05em;
}
.lever-num  { font-family: var(--mono); font-size: .82rem; white-space: nowrap; }
.lever-acts { display: flex; gap: 6px; justify-content: flex-end; }

/* A lever whose Apply commits several rows at once (DCF growth schedule, bank
   ROTCE curve). The controls sit on the group header — never on one member row —
   so nothing reads as "this Apply only touches Y1–Y3". */
.lever-group        { border-bottom: 1px solid var(--border-zinc); padding: 4px 0 6px; }
.lever-group--active{ box-shadow: inset 3px 0 0 var(--gold); background: var(--gold-bg); }
.lever-group-head   { padding: 7px 8px 2px; }
.lever-group-title  { font-size: .74rem; color: var(--text); font-weight: 600; }
.lever-scope        { display: block; margin-top: 3px; font-size: .63rem; color: var(--text-dim); line-height: 1.45; }
.lever-sub          { padding: 4px 8px 4px 20px; }
.lever-sub-label    { font-size: .68rem; color: var(--text-muted); }
.lever-chip {
  font-size: .62rem; border-radius: 3px; padding: 1px 5px; margin-left: 6px;
  white-space: nowrap;
}
.lever-chip--primary { color: var(--gold); background: var(--gold-bg); }
.lever-chip--applied { color: var(--gold); border: 1px solid var(--gold); }

/* ── Joint implied ──
   Same bordered card as Street Debate / the sanity checks, so the stack reads as
   one column of boxes. The iso-value table fills the card's full width rather
   than hugging its content on the left. */
.joint-card {
  margin-top: 12px;
  border: 1px solid var(--border-zinc); border-radius: 6px; padding: 12px 14px;
}
.joint-head    { margin-bottom: 12px; }
.joint-hero    { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.joint-hero-val{ font-family: var(--mono); font-size: 1.05rem; font-weight: 600; color: var(--gold); line-height: 1.2; text-align: center; }
.joint-hero-lab{ font-size: .65rem; color: var(--text-dim); margin-top: 3px; text-align: center; }
.joint-amp     { font-size: 1.1rem; color: var(--text-dim); align-self: center; }
.iso-wrap      { margin-top: 14px; overflow-x: auto; }
.iso-cap       { font-size: .65rem; color: var(--text-dim); margin-bottom: 6px; }
.iso-table     { width: 100%; border-collapse: collapse; min-width: 560px; table-layout: fixed; }
.iso-table td  { padding: 5px 8px; text-align: right; white-space: nowrap; }
.iso-lbl       { font-size: .65rem; color: var(--text-dim); text-align: left !important; width: 120px; }
.iso-val       { font-family: var(--mono); font-size: .74rem; color: var(--text); }
.iso-table tr + tr td { border-top: 1px solid var(--border-zinc); }
.iso-best      { background: var(--gold-bg); }
.iso-best .iso-val { color: var(--gold); font-weight: 600; }

@media (max-width: 620px) {
  /* Buttons drop under the numbers rather than squeezing the label to nothing. */
  .lever-grid { grid-template-columns: 1fr 84px 108px; }
  .lever-grid .lever-acts { grid-column: 1 / -1; justify-content: flex-start; }
  .lever-grid--head span:last-child { display: none; }
}

/* ── Tooltips ── */
.tooltip-wrap { position: relative; display: inline-flex; align-items: center; gap: 3px; }
.tooltip-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--border-zinc); color: var(--text-dim);
  font-size: 8px; font-weight: 700; cursor: default; flex-shrink: 0; line-height: 1;
}
.tooltip-bubble {
  visibility: hidden; opacity: 0;
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--surface-alt); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-ctl);
  padding: 7px 10px; font-size: 10px; line-height: 1.5;
  white-space: normal; width: 200px; z-index: 200;
  pointer-events: none; transition: opacity .15s;
  box-shadow: 0 4px 14px rgba(0,0,0,.5);
}
.tooltip-bubble::after {
  content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: var(--surface-alt);
}
.tooltip-wrap:hover .tooltip-bubble,
.tooltip-wrap:focus-within .tooltip-bubble { visibility: visible; opacity: 1; }

/* ── Range sliders ── */
.slider-row {
  display: flex; flex-direction: column; gap: 2px;
  margin-bottom: 10px; padding: 6px 8px;
  border-radius: var(--r-ctl); border: 1px solid transparent; transition: border-color .15s;
}
.slider-row.slider-overridden {
  border-color: var(--gold-dim);
  background: var(--gold-bg);
}
/* Locked while a street-implied back-solver lever drives the assumption.
   Full brightness by design — no dimming, no 🔒. The lock is communicated by
   the per-row "street-implied" chip and one .slider-group-note sentence per
   group; only the cursor betrays that dragging is disabled. */
.slider-row.slider-locked .slider { cursor: not-allowed; }
.slider-row.slider-locked .slider::-webkit-slider-thumb { cursor: not-allowed; }
/* Defeat the browser's default dimming of disabled inputs — locked must not
   read as greyed-out. */
.slider:disabled { opacity: 1; background: var(--border-zinc); }
.slider:disabled::-webkit-slider-thumb { background: var(--gold); }
.slider:disabled::-moz-range-thumb    { background: var(--gold); }
.slider-lock-tag {
  font-size: 10px; color: var(--gold); margin-left: auto;
  border: 1px solid var(--gold-dim); border-radius: var(--r-ctl); padding: 0 4px; white-space: nowrap;
}
.slider-group-note {
  font-size: 10px; color: var(--text-dim); margin: 2px 0 8px; line-height: 1.5;
}
.slider-label { display: flex; align-items: center; gap: var(--s1); flex-wrap: wrap; font-size: 11px; color: var(--text-muted); }
/* The hint gets its own line. Sharing one with the label only ever fit because
   the hint was 8px — i.e. too small to read. At a legible size it must wrap,
   so wrap it deliberately rather than letting the label break mid-phrase. */
.slider-label .hint {
  flex-basis: 100%; margin-left: 0; margin-top: 1px;
  font-size: 10px; line-height: 1.35; color: var(--text-dim);
}
.slider-val { font-family: var(--mono); font-size: 12px; color: var(--text); text-align: right; line-height: 1; }
.slider-val.amber { color: var(--gold); }
.slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 3px;
  background: var(--border-zinc); border-radius: 2px;
  outline: none; cursor: pointer; margin: 4px 0;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px;
  border-radius: 50%; background: var(--gold);
  cursor: pointer; border: none; box-shadow: 0 0 0 2px var(--surface);
}
.slider::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--gold); cursor: pointer; border: none;
}
.slider-bounds { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 10px; color: var(--text-dim); }
/* FE-H1: inline WACC>TGR guard warning under a slider */
.slider-warn { margin-top: 6px; font-size: 10px; line-height: 1.4; color: var(--gold); background: rgba(242,202,80,0.12); border-left: 3px solid var(--gold); padding: 5px 8px; border-radius: var(--r-ctl); }

/* ── Sensitivity axis selectors ── */
.sens-axis-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sens-axis-label { font-size: 10px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted); }
.sens-select {
  background: var(--surface-alt); border: 1px solid var(--border-zinc);
  border-radius: var(--r-ctl); padding: 4px 8px;
  font-family: var(--mono); font-size: 10px; color: var(--text);
  cursor: pointer; outline: none;
}
.sens-select:focus { border-color: var(--gold-dim); }

/* ── Scenario save row ── */
.scenario-save-row { display: flex; gap: 6px; padding: 8px 14px; border-bottom: 1px solid var(--border); }
.scenario-name-input {
  flex: 1; background: var(--surface-alt); border: 1px solid var(--border-zinc);
  border-radius: 2px; padding: 5px 8px;
  font-family: var(--mono); font-size: 11px; color: var(--text); outline: none;
}
.scenario-name-input:focus { border-color: var(--gold-dim); }
.scenario-name-input::placeholder { color: var(--text-dim); }
.scenario-save-btn {
  background: var(--gold-bg); border: 1px solid var(--gold-dim);
  border-radius: 2px; padding: 5px 12px;
  font-family: var(--sans); font-size: 10px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--gold);
  cursor: pointer; white-space: nowrap; transition: background .15s;
}
.scenario-save-btn:hover { background: var(--gold-glow); }
.scenario-save-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Scenario compare cards ── */
.scenarios-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-top: 4px; }
.scenario-card {
  background: var(--surface-alt); border: 1px solid var(--border-zinc);
  border-radius: var(--r-panel); padding: var(--s3); position: relative;
}
.scenario-card .scenario-name { font-family: var(--serif); font-size: 12px; color: var(--text); margin-bottom: 2px; padding-right: 20px; display: flex; align-items: center; gap: 5px; }
.scenario-lock { font-size: 9px; opacity: .65; line-height: 1; }
.scenario-date { font-family: var(--mono); font-size: 9px; color: var(--text-dim); letter-spacing: .03em; margin-bottom: 6px; text-transform: uppercase; }
.scenario-value { font-family: var(--mono); font-size: 22px; color: var(--text); line-height: 1; margin-bottom: 2px; }
.scenario-upside { font-family: var(--mono); font-size: 11px; margin-bottom: 8px; }
.scenario-row { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; border-top: 1px solid var(--border-zinc); font-size: 10px; }
.scenario-key { color: var(--text-muted); }
.scenario-val { font-family: var(--mono); }
.scenario-del-btn {
  position: absolute; top: 8px; right: 8px;
  background: none; border: none; color: var(--text-dim);
  font-size: 10px; cursor: pointer; line-height: 1;
  padding: 2px 4px; border-radius: 2px; transition: color .15s, background .15s;
}
.scenario-del-btn:hover { color: var(--red); background: var(--red-bg); }
.scenario-override-btn {
  width: 100%; margin-top: 10px;
  background: transparent; border: 1px solid var(--border); border-radius: 2px;
  padding: 6px 8px; font-family: var(--sans); font-size: 9px; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase; color: var(--gold-dim);
  cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.scenario-override-btn:hover { background: var(--gold-bg); border-color: var(--gold-dim); color: var(--gold); }
.scenario-override-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Scrollbar ── */
::-webkit-scrollbar              { width: 6px; height: 6px; }
::-webkit-scrollbar-track        { background: var(--bg); }
::-webkit-scrollbar-thumb        { background: rgba(212,175,55,0.2); border-radius: var(--r-ctl); }
::-webkit-scrollbar-thumb:hover  { background: rgba(212,175,55,0.35); }

/* ================================================================
   TERMINAL SECTIONS — shared wrapper
   ================================================================ */
.terminal-section { scroll-margin-top: 20px; }
.loading-msg { font-size: 11px; color: var(--text-muted); padding: 12px 0; }

/* ── Toggle button groups ── */
.toggle-group {
  display: inline-flex; gap: 2px;
  background: var(--surface-2); border: 1px solid var(--border-zinc);
  border-radius: var(--r-ctl); padding: 3px;
}
.toggle-btn {
  padding: 5px 12px; border-radius: var(--r-ctl); border: none;
  background: transparent; color: var(--text-muted);
  font-size: 11px; font-weight: 600; cursor: pointer;
  transition: background .12s, color .12s;
}
.toggle-btn:hover  { color: var(--text); }
.toggle-btn.active { background: var(--surface-3); color: var(--gold); }

/* ================================================================
   FINANCIAL STATEMENTS TABLE
   ================================================================ */
.stmt-tabs {
  display: flex; gap: 2px; margin-bottom: 16px;
  border-bottom: 1px solid var(--border-zinc);
}
.stmt-tab {
  padding: 8px 18px; border: none; background: transparent;
  color: var(--text-muted); font-size: 12px; font-weight: 600;
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: color .12s, border-color .12s;
}
.stmt-tab:hover  { color: var(--text); }
.stmt-tab.active { color: var(--gold); border-bottom-color: var(--gold); }

.stmt-table-wrap { overflow-x: auto; }

.stmt-table {
  width: 100%; border-collapse: collapse;
  font-size: 11px;
}
.stmt-section-hdr {
  background: var(--surface-3);
  color: var(--text-dim); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  padding: 7px 12px; text-align: left;
}
.stmt-section-hdr td { padding: 7px 12px; }

.stmt-col-hdr {
  position: sticky; top: 0; z-index: 3;
  background: var(--surface-2);
}
.stmt-col-hdr th {
  padding: 8px 16px; text-align: right;
  font-size: 10px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1px solid var(--border-zinc);
  white-space: nowrap;
}
.stmt-col-hdr th:first-child { text-align: left; }

.stmt-row td {
  padding: 6px 16px; border-bottom: 1px solid rgba(255,255,255,0.07);
  white-space: nowrap;
}
.stmt-row:hover td { background: rgba(255,255,255,0.025); }
.stmt-row .stmt-lbl {
  position: sticky; left: 0; z-index: 1;
  background: var(--surface); color: var(--text-muted);
  font-size: 11px;
  min-width: 180px;
}
.stmt-row:hover .stmt-lbl { background: var(--surface-2); }
.stmt-row .stmt-val {
  text-align: right; font-family: var(--mono);
  color: var(--text); font-size: 11px;
}
.stmt-row .stmt-val.ttm { color: var(--gold); }
.stmt-row .stmt-val.neg  { color: var(--red); }

/* ================================================================
   KEY METRICS — KPI GRID
   ================================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 4px;
}
.kpi-card {
  background: var(--surface-2); border: 1px solid var(--border-zinc);
  border-radius: var(--r-panel); padding: var(--s3);
  transition: border-color .12s;
}
.kpi-card:hover { border-color: var(--border); }
.kpi-card.null-card { opacity: .5; }
.kpi-label {
  font-size: 10px; color: var(--text-dim); text-transform: uppercase;
  letter-spacing: .07em; margin-bottom: 6px;
}
.kpi-value {
  font-size: 1.25rem; font-weight: 700;
  font-family: var(--mono); color: var(--text);
  margin-bottom: 3px;
}
.kpi-value.positive { color: var(--green); }
.kpi-value.negative { color: var(--red); }
.kpi-value.na { color: var(--text-dim); font-size: .9rem; font-family: var(--sans); }
.kpi-sub { font-size: 10px; color: var(--text-dim); }

/* ================================================================
   HISTORICAL DATA TABLE
   ================================================================ */
.hist-controls {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px;
}

.hist-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
}
.hist-table th {
  padding: 8px 14px; text-align: right;
  background: var(--surface-2); color: var(--text-muted);
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; border-bottom: 1px solid var(--border-zinc);
  white-space: nowrap;
}
.hist-table th:first-child { text-align: left; }
.hist-table td {
  padding: 6px 14px; border-bottom: 1px solid rgba(255,255,255,0.07);
  text-align: right; font-family: var(--mono); color: var(--text);
  font-size: 11px; white-space: nowrap;
}
.hist-table td:first-child { text-align: left; color: var(--text-muted); }
.hist-table tr:hover td    { background: rgba(255,255,255,0.025); }
.hist-chg.pos { color: var(--green); }
.hist-chg.neg { color: var(--red); }

.pagination-bar {
  display: flex; align-items: center; gap: 12px;
  justify-content: center; padding: 14px 0 2px;
}
.page-btn {
  padding: 6px 16px; border-radius: var(--r-ctl); border: 1px solid var(--border-zinc);
  background: transparent; color: var(--text-muted);
  font-size: 11px; font-weight: 600; cursor: pointer;
  transition: border-color .12s, color .12s;
}
.page-btn:hover:not(:disabled) { border-color: var(--border); color: var(--text); }
.page-btn:disabled { opacity: .35; cursor: default; }
.page-info { font-size: 11px; color: var(--text-muted); min-width: 90px; text-align: center; }

/* ================================================================
   CHARTS SECTION — TradingView
   ================================================================ */
.chart-toolbar {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: center;
}
#tv-chart-container {
  border: 1px solid var(--border-zinc); border-radius: var(--r-panel);
  overflow: hidden;
}

/* ================================================================
   ENHANCED NEWS CARDS
   ================================================================ */
.news-card {
  display: flex; gap: 12px;
  background: var(--surface-2); border: 1px solid var(--border-zinc);
  border-radius: var(--r-ctl); padding: 14px; transition: border-color .12s;
  text-decoration: none; color: inherit;
}
.news-card:hover { border-color: var(--border); text-decoration: none; }
.news-thumb {
  width: 72px; height: 54px; flex-shrink: 0;
  object-fit: cover; border-radius: var(--r-ctl);
  background: var(--surface-3);
}
.news-thumb-placeholder {
  width: 72px; height: 54px; flex-shrink: 0;
  border-radius: var(--r-ctl); background: var(--surface-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--text-dim);
}
.news-body { flex: 1; min-width: 0; }
.news-headline {
  font-size: 12px; font-weight: 600; color: var(--text);
  line-height: 1.45; margin-bottom: 5px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.news-meta {
  font-size: 10px; color: var(--text-dim);
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.news-impact { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.news-impact.positive { background: var(--green); }
.news-impact.negative { background: var(--red); }
.news-impact.neutral  { background: var(--text-dim); }
.news-related { font-size: 10px; color: var(--text-dim); font-family: var(--mono); }

/* ═══════════════════════════════════════════════════════════════
   COMPANY OVERVIEW  (own full-width card)
   ═══════════════════════════════════════════════════════════════ */
.co-description {
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--text-muted);
  text-align: justify;
  display: -webkit-box;
  -webkit-line-clamp: 4;  /* collapse to 4 lines; clamps at a line boundary (no mid-word cut) */
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.co-description.expanded {
  display: block;         /* remove the clamp; let the card grow */
  -webkit-line-clamp: unset;
  overflow: visible;
}
.co-readmore {
  margin-top: 8px;
  background: none;
  border: none;
  padding: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--gold);
  cursor: pointer;
}
.co-readmore:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════════
   DASHBOARD SHELL  — section tabs · center panels · assumptions rail
   ═══════════════════════════════════════════════════════════════ */
.dash-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.dash-tabs::-webkit-scrollbar { display: none; }
.dash-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 10px 18px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .03em;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.dash-tab:hover { color: var(--text); }
.dash-tab.active { color: var(--gold); border-bottom-color: var(--gold); }

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: var(--s3);
  align-items: start;
}
.dash-center { display: flex; flex-direction: column; gap: var(--s3); min-width: 0; }

.tab-panel { display: none; }
.tab-panel.active { display: flex; flex-direction: column; gap: var(--s3); }

.tab-intro { font-size: 11px; color: var(--text-dim); line-height: 1.5; padding: 2px 2px 0; }

/* Sticky assumptions rail — stays in view while the center scrolls */
.dash-rail {
  position: sticky;
  top: 60px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 72px);
}
.rail-result {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-panel);
  padding: var(--s3);
  text-align: center;
}
.rail-result-lbl {
  font-size: 10px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-muted); margin-bottom: var(--s1);
}
.rail-result-val {
  font-family: var(--mono); font-size: 26px; color: var(--gold); line-height: 1;
  background: var(--gilt);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.rail-result-sub { font-family: var(--mono); font-size: 12px; margin-top: 5px; color: var(--text-muted); }
.dash-rail #assumptions-panel { flex: 1 1 auto; min-height: 0; }

/* "Assumptions changed — refresh" badge on Sensitivity / Monte Carlo titles */
.stale-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: var(--r-ctl);
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  vertical-align: middle;
  color: var(--gold);
  background: var(--gold-bg);
  border: 1px solid var(--gold-dim);
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE  — progressive collapse: laptop → tablet → phone
   Base layout is a fixed 220px sidebar + multi-column grids; these
   breakpoints collapse the grids and, on small screens, shrink the
   sidebar to an icon rail (and finally hide it on phones).
   ═══════════════════════════════════════════════════════════════ */

/* Small laptop — stack the Financial Summary / WACC row */
@media (max-width: 1180px) {
  #top-row { grid-template-columns: 1fr; }
}

/* Tablet landscape — drop the rail under the center, assumptions on top */
@media (max-width: 1024px) {
  .dash-grid  { grid-template-columns: 1fr; }
  .dash-rail  { position: static; max-height: none; order: -1; }
  #dashboard  { padding: 16px 18px 48px; }
  .sens-stats { grid-template-columns: repeat(2, 1fr); }
  .mc-stats   { grid-template-columns: repeat(3, 1fr); }
}

/* Tablet portrait — collapse the sidebar to an icon rail */
@media (max-width: 860px) {
  :root { --sidebar-w: 60px; }
  .sidebar-brand-text   { display: none; }
  .sidebar-brand        { justify-content: center; padding: 16px 0; gap: 0; }
  .sidebar-upgrade-btn       { justify-content: center; }
  .sidebar-upgrade-btn div   { display: none; }   /* keep only the ⚡ icon */
  .sidebar-footer > .workspace-theme-toggle { justify-content: center; padding-inline: 0; }
  .sidebar-footer > .workspace-theme-toggle .workspace-theme-label { display: none; }
  .rail-sec { display: none; }   /* no room for the research trail on an icon rail */
  #ticker-input { width: 150px; }
  .bbb-panel    { grid-template-columns: 1fr; }
  .metrics-row  { grid-template-columns: repeat(2, 1fr); }
  .ivps-card    { flex-direction: column; align-items: flex-start; gap: 16px; }
  .ivps-divider { display: none; }
  #company-strip { padding: 10px 18px; }
}

/* Phone — single column, drop the sidebar entirely */
@media (max-width: 600px) {
  #sidebar      { display: none; }
  .main-content { margin-left: 0; padding-top: 52px; }
  .workspace-mobile-nav {
    position: fixed;
    inset: 0 0 auto;
    z-index: 240;
    min-height: 52px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: var(--chrome-bg);
    border-bottom: 1px solid var(--chrome-border);
    backdrop-filter: blur(14px);
  }
  .workspace-mobile-brand {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
    color: var(--text);
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -.02em;
    text-decoration: none;
    white-space: nowrap;
  }
  .workspace-mobile-brand .logo-icon { width: 25px; height: 25px; }
  .workspace-mobile-brand > span { display: inline; }
  .workspace-mobile-brand > span > span { color: var(--gold); }
  .workspace-mobile-links {
    min-width: 0;
    margin-left: auto;
    display: flex;
    flex: 0 1 auto;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
  }
  .workspace-mobile-link {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 4px;
    padding: 7px 6px;
    border: 1px solid transparent;
    border-radius: var(--r-ctl);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    text-decoration: none;
  }
  .workspace-mobile-link.active {
    border-color: var(--gold-line);
    background: var(--gold-bg);
    color: var(--gold);
  }
  .workspace-mobile-theme {
    width: 30px;
    min-height: 30px;
    margin: 0 0 0 2px;
    padding: 6px;
    justify-content: center;
    flex: 0 0 auto;
  }
  .workspace-mobile-theme .workspace-theme-icon { width: auto; }
  #app-header {
    top: 52px;
    min-height: auto;
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
    padding: 8px 12px 0;
  }
  .header-search { grid-column: 1; width: 100%; }
  #ticker-input { width: auto; min-width: 0; flex: 1; }
  #app-header .dash-tabs {
    grid-column: 1;
    width: 100%;
    justify-self: stretch;
    justify-content: stretch;
  }
  #app-header .dash-tab { flex: 1; justify-content: center; padding: 8px 6px; }
  #dashboard    { padding: 12px 12px 40px; }
  .metrics-row, .sens-stats, .mc-stats { grid-template-columns: 1fr 1fr; }
  .verdict-card, #verdict-card { padding: 18px; }
  .verdict-label    { font-size: 22px; }
  .ivps-main .value { font-size: 32px; }
}

@media (max-width: 380px) {
  .workspace-mobile-brand > span { display: none; }
  .workspace-mobile-link {
    gap: 3px;
    padding-inline: 4px;
    font-size: 9px;
  }
}
