/* ════════════════════════════════════════════════
   MERIDIAN Terminal — self-contained dark styles.
   Does NOT depend on the homepage styles.css.
   ════════════════════════════════════════════════ */

:root {
  --ink: #0a0c10;
  --ink-2: #11151c;
  --ink-3: #151a21;
  --hairline: #232a33;
  --fg: #e8eaed;
  --muted: #8a93a0;
  --muted-ink: #6b7280;
  --amber: #c8862a;
  --amber-bright: #e8a33d;
  --up: #2e9e6b;
  --down: #c84b3c;
  --serif: "Source Serif 4", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  /* Data font: Inter with tabular numerals — far more legible at small sizes
     than a mono face, while tnum keeps every column of digits aligned.
     IBM Plex Mono is retained as --code for genuinely monospaced contexts. */
  --mono: "Inter", "IBM Plex Mono", ui-monospace, monospace;
  --code: "IBM Plex Mono", ui-monospace, monospace;
  --r: 6px;      /* card / panel radius */
  --r-sm: 4px;   /* pills, inputs, small buttons */
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { background: var(--ink); color: var(--fg); font-family: var(--sans); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
::selection { background: var(--amber); color: var(--ink); }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.up { color: var(--up); }
.down { color: var(--down); }

/* brand + live dot (used in the top bar) */
.wordmark { font-family: var(--mono); font-weight: 600; font-size: 16px; letter-spacing: 0.22em; color: var(--fg); }
.wordmark.small { font-size: 14px; }
.wordmark-tick { color: var(--amber); animation: blink 1.4s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.live-dot { font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em; color: var(--muted); display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.live-dot i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); display: inline-block; }
.live-dot.on { color: var(--up); }
.live-dot.on i { background: var(--up); box-shadow: 0 0 8px var(--up); animation: pulse 2.4s ease infinite; }
@keyframes pulse { 50% { opacity: 0.45; } }

/* buttons */
.btn { display: inline-block; font-size: 13px; font-weight: 600; letter-spacing: 0.02em; padding: 10px 22px; border: 1px solid var(--hairline); transition: all 0.18s ease; }
.btn-amber { background: var(--amber); border-color: var(--amber); color: var(--ink); }
.btn-amber:hover { background: var(--amber-bright); border-color: var(--amber-bright); }

/* command bar dropdown (shared shape) */
.cmd-prompt { font-family: var(--mono); color: var(--amber); }
.cmd-results { position: absolute; background: var(--ink-2); border: 1px solid var(--hairline); z-index: 10; max-height: 300px; overflow-y: auto; left: 0; right: 0; }
.cmd-result { display: flex; gap: 14px; align-items: baseline; width: 100%; text-align: left; padding: 11px 18px; border-bottom: 1px solid var(--hairline); }
.cmd-result:last-child { border-bottom: none; }
.cmd-result:hover, .cmd-result.active { background: var(--ink-3); }
.cmd-result .sym { font-family: var(--mono); font-weight: 600; min-width: 110px; color: var(--amber-bright); }
.cmd-result .nm { flex: 1; color: var(--fg); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd-result .ex { font-family: var(--mono); font-size: 11px; color: var(--muted-ink); }

/* MERIDIAN Terminal — dense workstation layer on top of the base design system */

.term-body { background: var(--ink); padding-top: 0; font-size: 13.5px; }

/* top bar */
.tbar { position: sticky; top: 0; z-index: 90; display: flex; align-items: center; gap: 20px; padding: 0 20px; height: 52px; background: var(--ink-2); border-bottom: 1px solid var(--hairline); }
.tcmd { position: relative; flex: 1; max-width: 640px; display: flex; align-items: center; background: var(--ink); border: 1px solid var(--hairline); height: 34px; padding: 0 12px; }
.tcmd:focus-within { border-color: var(--amber); }
.tcmd input { flex: 1; background: none; border: none; outline: none; color: var(--fg); font-family: var(--mono); font-size: 12.5px; }
.tcmd .cmd-prompt { font-size: 14px; margin-right: 10px; }
.tcmd .cmd-results { top: calc(100% + 4px); }

/* tabs */
.ttabs { position: sticky; top: 52px; z-index: 89; display: flex; background: var(--ink-2); border-bottom: 1px solid var(--hairline); overflow-x: auto; }
.ttabs button { font-size: 12.5px; font-weight: 500; color: var(--muted); padding: 11px 18px; border-right: 1px solid var(--hairline); white-space: nowrap; }
.ttabs button:hover { color: var(--fg); }
.ttabs button.active { color: var(--fg); background: var(--ink); box-shadow: inset 0 2px 0 var(--amber); }

/* layout */
.tmain { padding: 16px 20px 60px; max-width: 1600px; margin: 0 auto; }
.trow { display: flex; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.panel { background: var(--ink-2); border: 1px solid var(--hairline); min-width: 0; }
.panel.grow { flex: 1; }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 16px; border-bottom: 1px solid var(--hairline); flex-wrap: wrap; }
.panel-h h3 { font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: 0.2em; color: var(--amber); }
.panel-sub { font-size: 10px; color: var(--muted-ink); letter-spacing: 0.06em; }
.panel-tools { display: flex; gap: 8px; align-items: center; }
.panel-tools input, .panel-tools select { background: var(--ink); border: 1px solid var(--hairline); color: var(--fg); font-family: var(--mono); font-size: 11px; padding: 5px 8px; min-width: 0; }
.panel-tools input { width: 320px; max-width: 40vw; }
.mini-btn { font-family: var(--mono); font-size: 11px; color: var(--fg); border: 1px solid var(--hairline); padding: 5px 12px; background: var(--ink); }
.mini-btn:hover { border-color: var(--amber); color: var(--amber-bright); }
.loading, .empty-mini { padding: 24px 16px; color: var(--muted-ink); font-size: 12px; }
.dim { color: var(--muted-ink); }

/* tape */
.tape { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.tape-cell { padding: 10px 14px; border-right: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.tape-cell .tl { font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: 0.08em; }
.tape-cell .tp { font-family: var(--mono); font-size: 15px; font-weight: 600; margin-top: 2px; }
.tape-cell .tc { font-family: var(--mono); font-size: 10.5px; }

/* breadth / stat list */
.breadth { padding: 8px 0; }
.brow { display: flex; justify-content: space-between; padding: 8px 16px; border-bottom: 1px solid color-mix(in srgb, var(--hairline) 55%, transparent); font-size: 12px; }
.brow:last-child { border-bottom: none; }
.brow .bl { color: var(--muted); }
.brow .bv { font-family: var(--mono); font-weight: 600; }
.adbar { display: flex; height: 8px; margin: 10px 16px; }
.adbar .a { background: var(--up); } .adbar .d { background: var(--down); } .adbar .u { background: var(--hairline); }

/* heatmap */
.heatmap { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1px; background: var(--hairline); border-top: none; }
.hm-cell { background: var(--ink-2); padding: 14px; min-height: 86px; display: flex; flex-direction: column; justify-content: space-between; cursor: default; }
.hm-cell .hl { font-size: 12px; font-weight: 600; }
.hm-cell .hv { font-family: var(--mono); font-size: 12px; }
.hm-cell .hp { font-family: var(--mono); font-size: 16px; font-weight: 600; }

/* data tables */
.table-wrap { overflow-x: auto; }
.dt { width: 100%; border-collapse: collapse; font-size: 12px; }
.dt th { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; color: var(--muted); text-align: right; padding: 9px 12px; border-bottom: 1px solid var(--hairline); cursor: pointer; user-select: none; white-space: nowrap; position: sticky; top: 0; background: var(--ink-2); }
.dt th:first-child, .dt td:first-child { text-align: left; }
.dt td { font-family: var(--mono); text-align: right; padding: 8px 12px; border-bottom: 1px solid color-mix(in srgb, var(--hairline) 50%, transparent); white-space: nowrap; }
.dt tr:hover td { background: var(--ink-3); }
.dt .nm { color: var(--fg); font-family: var(--sans); }
.dt a { color: var(--amber-bright); }

/* matrix */
.mx { border-collapse: collapse; font-family: var(--mono); font-size: 10.5px; margin: 14px 16px; }
.mx th, .mx td { padding: 7px 10px; border: 1px solid var(--hairline); text-align: center; }
.mx th { color: var(--muted); font-weight: 500; }
.mx td { min-width: 58px; }

/* commentary */
.commentary { padding: 16px 18px; font-size: 13.5px; line-height: 1.8; color: var(--fg); max-width: 980px; }
.commentary p + p { margin-top: 10px; }
.commentary .tagline { font-family: var(--mono); font-size: 10px; color: var(--muted-ink); letter-spacing: 0.1em; margin-bottom: 10px; }

/* research workstation */
.empty-state { padding: 90px 24px; text-align: center; }
.empty-state p.mono { font-size: 11px; letter-spacing: 0.3em; color: var(--amber); }
.empty-state h2 { font-family: var(--serif); font-size: 30px; margin: 14px 0 10px; }
.empty-state .dim { max-width: 520px; margin: 0 auto; }
.chip-row { display: flex; gap: 8px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }
.chip { font-family: var(--mono); font-size: 11.5px; border: 1px solid var(--hairline); padding: 6px 14px; color: var(--amber-bright); }
.chip:hover { border-color: var(--amber); }

.co-head { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; padding: 18px 4px 14px; }
.co-head h2 { font-family: var(--serif); font-size: 28px; }
.co-head .co-sym { font-family: var(--mono); color: var(--muted); font-size: 12px; letter-spacing: 0.08em; }
.co-head .co-px { font-family: var(--mono); font-size: 26px; font-weight: 600; margin-left: auto; }
.co-head .co-chg { font-family: var(--mono); font-size: 13px; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.kv > div { padding: 10px 16px; border-right: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.kv .k { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.14em; color: var(--muted-ink); }
.kv .v { font-family: var(--mono); font-size: 13.5px; font-weight: 600; margin-top: 3px; }
.prose { padding: 14px 18px; font-size: 13px; line-height: 1.75; color: var(--muted); max-width: 920px; }
.prose strong { color: var(--fg); }
canvas.chart { display: block; width: 100%; height: 230px; }
canvas.chart.sm { height: 130px; }

.ratio-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1px; background: var(--hairline); }
.ratio-card { background: var(--ink-2); padding: 13px 15px; }
.ratio-card .rg { font-family: var(--mono); font-size: 9px; letter-spacing: 0.16em; color: var(--muted-ink); }
.ratio-card .rn { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.ratio-card .rv { font-family: var(--mono); font-size: 19px; font-weight: 600; margin-top: 2px; }
.ratio-card canvas { width: 100%; height: 26px; margin-top: 6px; }
.ratio-card .ri { font-size: 10.5px; color: var(--muted-ink); margin-top: 6px; line-height: 1.5; }

.drv { display: flex; gap: 10px; flex-wrap: wrap; padding: 12px 16px; }
.drv-chip { font-family: var(--mono); font-size: 11px; border: 1px solid var(--hairline); padding: 6px 12px; }
.drv-chip b { font-weight: 600; }

.swot { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--hairline); }
.swot > div { background: var(--ink-2); padding: 14px 16px; }
.swot h5 { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.18em; color: var(--amber); margin-bottom: 8px; }
.swot li { font-size: 12px; color: var(--muted); margin-left: 16px; padding: 2px 0; }

.dcf-form { padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.dcf-form label { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.dcf-form input { width: 110px; background: var(--ink); border: 1px solid var(--hairline); color: var(--fg); font-family: var(--mono); font-size: 12px; padding: 6px 8px; text-align: right; }
.dcf-form input:focus { border-color: var(--amber); outline: none; }
.dcf-form .note { font-size: 10.5px; color: var(--muted-ink); line-height: 1.5; }
.dcf-big { padding: 18px; display: flex; gap: 36px; flex-wrap: wrap; align-items: baseline; }
.dcf-big .n { font-family: var(--mono); font-size: 34px; font-weight: 600; }
.dcf-big .l { font-family: var(--mono); font-size: 10px; color: var(--muted-ink); letter-spacing: 0.12em; }
.sens { margin: 0 18px 18px; border-collapse: collapse; font-family: var(--mono); font-size: 11px; }
.sens th, .sens td { border: 1px solid var(--hairline); padding: 6px 12px; text-align: center; }
.sens th { color: var(--muted); font-weight: 500; }

/* report engine */
.report-controls { display: flex; gap: 10px; padding: 14px 16px; flex-wrap: wrap; align-items: center; }
.report-controls input, .report-controls select { background: var(--ink); border: 1px solid var(--hairline); color: var(--fg); padding: 9px 12px; font-size: 12.5px; }
.report-controls input { font-family: var(--mono); width: 220px; }
.report-actions { display: flex; gap: 10px; margin: 0 0 12px; }
.report-canvas { max-width: 860px; }

/* white-page report */
.rpt { background: #fff; color: #14161a; padding: 52px 58px; border: 1px solid var(--hairline); font-family: var(--serif); line-height: 1.7; font-size: 13.5px; }
.rpt-band { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 3px solid #14161a; padding-bottom: 12px; font-family: var(--mono); }
.rpt-band .f { font-weight: 600; letter-spacing: 0.2em; font-size: 13px; }
.rpt-band .t { font-size: 9px; color: #6b7280; letter-spacing: 0.14em; margin-top: 4px; }
.rpt-rec { text-align: right; }
.rpt-rec .r { display: inline-block; color: #fff; font-weight: 600; font-size: 13px; letter-spacing: 0.1em; padding: 3px 12px; }
.rpt-rec .r.BUY { background: #2e9e6b; } .rpt-rec .r.HOLD { background: #b08328; } .rpt-rec .r.SELL { background: #c84b3c; }
.rpt-rec .tp { display: block; font-size: 11px; margin-top: 5px; }
.rpt h1 { font-size: 24px; line-height: 1.25; margin: 18px 0 4px; letter-spacing: -0.01em; }
.rpt .meta { font-family: var(--mono); font-size: 9.5px; color: #6b7280; letter-spacing: 0.12em; margin-bottom: 18px; }
.rpt h2 { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.22em; color: #b07015; margin: 26px 0 8px; }
.rpt p { margin: 8px 0; }
.rpt ul { margin: 6px 0 6px 20px; }
.rpt li { margin: 4px 0; }
.rpt table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 10.5px; margin: 10px 0; }
.rpt th { text-align: right; border-bottom: 1.5px solid #14161a; padding: 6px 8px; font-weight: 600; }
.rpt td { text-align: right; border-bottom: 1px solid #e2dfd6; padding: 6px 8px; }
.rpt th:first-child, .rpt td:first-child { text-align: left; }
.rpt .swot { background: #e2dfd6; margin: 8px 0; }
.rpt .swot > div { background: #fff; }
.rpt .swot h5 { color: #b07015; }
.rpt .swot li { color: #3c4350; }
.rpt .disc { margin-top: 28px; padding-top: 12px; border-top: 1px solid #e2dfd6; font-family: var(--mono); font-size: 8.5px; color: #6b7280; line-height: 1.7; }

/* screener */
.screen-filters { display: flex; gap: 14px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--hairline); align-items: center; font-size: 11px; color: var(--muted); }
.screen-filters input { width: 70px; background: var(--ink); border: 1px solid var(--hairline); color: var(--fg); font-family: var(--mono); padding: 5px 7px; }
.screen-filters select { background: var(--ink); border: 1px solid var(--hairline); color: var(--fg); font-family: var(--mono); font-size: 11px; padding: 5px; }
.ideas { padding: 12px 16px; border-bottom: 1px solid var(--hairline); }
.ideas .tagline { font-family: var(--mono); font-size: 10px; color: var(--muted-ink); letter-spacing: 0.1em; margin-bottom: 8px; }

/* portfolio */
.pf-add { display: flex; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--hairline); flex-wrap: wrap; }
.pf-add input { background: var(--ink); border: 1px solid var(--hairline); color: var(--fg); font-family: var(--mono); font-size: 12px; padding: 7px 10px; width: 140px; }
.alloc-row { display: grid; grid-template-columns: 130px 1fr 90px; gap: 12px; align-items: center; padding: 7px 16px; font-family: var(--mono); font-size: 11.5px; }
.alloc-bar { height: 10px; background: var(--ink); border: 1px solid var(--hairline); position: relative; }
.alloc-bar i { position: absolute; inset: 0; right: auto; background: var(--amber); }


/* library */
.lib-item { display: flex; gap: 16px; align-items: baseline; padding: 13px 16px; border-bottom: 1px solid color-mix(in srgb, var(--hairline) 55%, transparent); }
.lib-item .lt { flex: 1; font-size: 13px; }
.lib-item .lm { font-family: var(--mono); font-size: 10px; color: var(--muted-ink); }

.section-block { margin-bottom: 14px; opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .5s ease; }
.section-block.vis { opacity: 1; transform: none; }

@media (max-width: 900px) {
  .trow { flex-direction: column; }
  .tmain { padding: 12px 10px 60px; }
  .rpt { padding: 28px 22px; }
  .panel-tools input { width: 100%; max-width: none; }
}

/* print: only the report */
@media print {
  body * { visibility: hidden; }
  .report-canvas, .report-canvas * { visibility: visible; }
  .report-canvas { position: absolute; left: 0; top: 0; width: 100%; max-width: none; }
  .rpt { border: none; padding: 0; }
}

/* ════════════════════════════════════════════════
   INSTITUTIONAL REPORT (DBS-style) — white-page output
   ════════════════════════════════════════════════ */
.ir { background: #fff; color: #1a1c20; font-family: "Inter", -apple-system, sans-serif; font-size: 12px; line-height: 1.55; max-width: 920px; }
.ir-crimson { color: #c2181b; }

/* cover */
.ir-cover { padding: 0 0 26px; border-bottom: 2px solid #1a1c20; }
.ir-band { display: flex; justify-content: space-between; align-items: center; padding: 14px 40px; border-bottom: 1px solid #d8d5cc; }
.ir-firm { font-family: var(--mono); font-weight: 600; font-size: 13px; letter-spacing: 0.18em; color: #1a1c20; }
.ir-region { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.16em; color: #888; }
.ir-cover-main { display: grid; grid-template-columns: 1fr 300px; gap: 40px; padding: 30px 40px 0; }
.ir-co { font-family: "Inter", sans-serif; font-weight: 600; font-size: 38px; letter-spacing: -0.03em; line-height: 1.04; color: #111; }
.ir-tagline { color: #c2181b; font-size: 13px; font-weight: 500; margin-top: 8px; letter-spacing: 0.01em; }
.ir-thesis-lead { margin-top: 22px; font-size: 13px; line-height: 1.7; color: #33363b; }
.ir-cover-right { }
.ir-rec-box { padding: 14px 18px; color: #fff; margin-bottom: 14px; }
.ir-rec-box.BUY { background: #2e9e6b; } .ir-rec-box.HOLD { background: #b08328; } .ir-rec-box.SELL { background: #c2181b; }
.ir-rec-box.STRONG_BUY { background: #1d6f48; border-top: 3px solid #65d99c; } .ir-rec-box.STRONG_SELL { background: #8a0e10; border-top: 3px solid #ff5a5e; }
.ir-rec-label { font-family: var(--mono); font-size: 9px; letter-spacing: 0.18em; opacity: .85; }
.ir-rec { font-family: var(--mono); font-size: 26px; font-weight: 600; letter-spacing: 0.06em; }
.ir-keyfin { width: 100%; border-collapse: collapse; }
.ir-keyfin td { padding: 6px 4px; border-bottom: 1px solid #ece9e1; font-family: var(--mono); font-size: 11px; }
.ir-keyfin td:first-child { color: #777; font-family: "Inter", sans-serif; }
.ir-keyfin td:last-child { text-align: right; }
.ir-up { color: #2e9e6b; } .ir-down { color: #c2181b; }
.ir-unit { margin-top: 12px; font-size: 9.5px; font-style: italic; color: #888; }

/* body pages */
.ir-page { padding: 30px 40px 44px; }
.ir h1 { font-size: 30px; }
.ir h2 { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 0.12em; color: #c2181b; text-transform: uppercase; margin: 30px 0 10px; padding-bottom: 6px; border-bottom: 1px solid #ece9e1; }
.ir p { margin: 8px 0; color: #2a2d32; }
.ir ul { margin: 8px 0 8px 18px; } .ir li { margin: 4px 0; color: #2a2d32; }
.ir b { color: #111; }

/* tables */
.ir-fin { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 10.5px; margin: 8px 0; }
.ir-fin .ir-hd td, .ir-fin .ir-hd th { border-bottom: 1.5px solid #1a1c20; font-weight: 600; padding: 7px 8px; color: #1a1c20; }
.ir-fin th { text-align: right; padding: 6px 8px; }
.ir-fin td { text-align: right; padding: 5px 8px; border-bottom: 1px solid #f0ede5; }
.ir-fin td:first-child, .ir-fin .ir-hd td:first-child { text-align: left; font-family: "Inter", sans-serif; color: #33363b; }
.ir-fin .ir-yoy td { color: #9a9a96; font-style: italic; border-bottom: 1px solid #f6f4ee; padding-top: 2px; padding-bottom: 6px; }
.ir-fin .ir-yoy td:first-child { font-family: var(--mono); }
.ir-fin .ir-sep td { border-top: 1px solid #d8d5cc; padding-top: 8px; }
.ir-fin .ir-tot td { border-top: 1px solid #1a1c20; font-weight: 600; }
.ir-fin .ir-base td { background: #fbf3e8; }
.ir-src { font-size: 9px; color: #999; font-style: italic; margin: 4px 0 6px; }

/* DCF working — wide table scrolls on small screens */
.ir-dcf { font-size: 9.5px; }
.ir-dcf th, .ir-dcf td { padding: 5px 6px; }
.ir-dcf-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 10px 0; }
.ir-half { margin: 0; }
.ir-sens td, .ir-sens th { text-align: center; padding: 6px 8px; }
.ir-sens th:first-child { text-align: right; }

/* football field */
.ir-ff { margin: 10px 0; }
.ir-ff-row { display: grid; grid-template-columns: 180px 1fr 60px; gap: 14px; align-items: center; margin: 8px 0; }
.ir-ff-lbl { font-size: 10px; color: #33363b; }
.ir-ff-track { position: relative; height: 14px; background: #f0ede5; }
.ir-ff-track i { position: absolute; top: 0; bottom: 0; background: #c2181b; opacity: .82; }
.ir-ff-track b { position: absolute; top: -2px; width: 2px; height: 18px; background: #1a1c20; }
.ir-ff-val { font-family: var(--mono); font-size: 10px; text-align: right; }

/* SWOT */
.ir-swot { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: #ece9e1; margin: 8px 0; }
.ir-swot > div { background: #fff; padding: 12px 14px; }
.ir-swot h5 { font-family: var(--mono); font-size: 9px; letter-spacing: 0.16em; color: #c2181b; margin-bottom: 6px; }
.ir-swot li { font-size: 11px; color: #33363b; }

/* conclusion + verdict */
.ir-concl p { font-size: 12px; }
.ir-verdict { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: #ece9e1; margin: 16px 0; border: 1px solid #ece9e1; }
.ir-verdict > div { background: #fbf9f5; padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.ir-v-l { font-family: var(--mono); font-size: 9px; letter-spacing: 0.14em; color: #888; }
.ir-v-v { font-family: var(--mono); font-size: 22px; font-weight: 600; color: #111; }
.ir-rationale { font-style: italic; color: #555; }
.ir-disc { font-size: 9px; color: #888; line-height: 1.7; }

@media (max-width: 720px) {
  .ir-cover-main { grid-template-columns: 1fr; gap: 24px; }
  .ir-dcf-summary { grid-template-columns: 1fr; }
  .ir-verdict { grid-template-columns: 1fr; }
  .ir-band, .ir-cover-main, .ir-page { padding-left: 20px; padding-right: 20px; }
}
@media print {
  .ir h2 { break-after: avoid; }
  .ir-fin, .ir-ff, .ir-verdict { break-inside: avoid; }
}

/* ════════ INSTITUTIONAL DCF (17-section model) ════════ */
.idcf { display: flex; flex-direction: column; gap: 2px; }
.idcf-sec { background: var(--ink-2); padding: 16px 18px 18px; border-left: 2px solid transparent; }
.idcf-sec:hover { border-left-color: var(--amber); }
.idcf-sh { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.idcf-sn { font-family: var(--mono); font-size: 9px; letter-spacing: 0.16em; color: var(--amber); }
.idcf-sh h4 { font-family: var(--sans); font-size: 14px; font-weight: 600; color: var(--fg); }
.idcf-ssub { font-family: var(--mono); font-size: 10px; color: var(--muted-ink); margin-left: auto; }
.idcf-t { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 11px; }
.idcf-t th { text-align: right; padding: 6px 8px; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--hairline); white-space: nowrap; }
.idcf-t th:first-child { text-align: left; }
.idcf-t td { text-align: right; padding: 5px 8px; border-bottom: 1px solid rgba(35,42,51,.5); color: var(--fg); }
.idcf-t td.nm { text-align: left; font-family: var(--sans); color: var(--muted); }
.idcf-t tr.sub td { color: var(--muted-ink); font-style: italic; border-bottom: none; padding-top: 1px; }
.idcf-t tr.tot td { border-top: 1px solid var(--amber); font-weight: 600; color: var(--fg); }
.idcf-t.two td:last-child { font-family: var(--mono); }
.idcf-t.sens th, .idcf-t.sens td { text-align: center; padding: 6px; }
.idcf-t.sens th:first-child { text-align: right; }
.idcf-kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--hairline); }
.idcf-kv > div { background: var(--ink-2); padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.idcf-kv .k { font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; color: var(--muted); text-transform: uppercase; }
.idcf-kv .v { font-family: var(--mono); font-size: 15px; color: var(--fg); }
.idcf-note { font-size: 11px; color: var(--muted-ink); margin-top: 8px; line-height: 1.5; }
.idcf-warn { font-size: 11px; color: var(--amber-bright); background: rgba(200,134,42,.1); border: 1px solid rgba(200,134,42,.3); padding: 10px 12px; margin-top: 10px; line-height: 1.5; }
.idcf-verdict { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1px; background: var(--hairline); }
.idcf-verdict > div { background: var(--ink-3); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.idcf-verdict .l { font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em; color: var(--muted); }
.idcf-verdict .n { font-family: var(--mono); font-size: 18px; color: var(--fg); }
.idcf-verdict .big { background: var(--ink); box-shadow: inset 2px 0 0 var(--amber); }
.idcf-verdict .big .n { font-size: 24px; }
.idcf-pe { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 10px; }
.idcf-pe b { color: var(--amber-bright); font-size: 14px; }
.idcf-prose p { font-size: 12.5px; line-height: 1.65; color: var(--fg); margin: 8px 0; }
.idcf-prose b { color: var(--fg); }
.idcf-side .dcf-form label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.idcf-side .dcf-form input { background: var(--ink); border: 1px solid var(--hairline); color: var(--fg); padding: 7px 9px; font-family: var(--mono); font-size: 12px; }
.idcf-side .dcf-form input:focus { outline: none; border-color: var(--amber); }
.idcf-side .dcf-form .note { font-size: 10px; color: var(--muted-ink); line-height: 1.5; margin-top: 6px; }
/* dcfForm fills its panel with no padding — the ap-rows grid handles all internal spacing */
.idcf-side #dcfForm { overflow: visible; width: 100%; box-sizing: border-box; padding: 0; }
/* On laptop/tablet the sidebar should be slightly wider to avoid column clipping */
@media (min-width: 769px) and (max-width: 1200px) {
  .panel.idcf-side { min-width: 320px !important; max-width: 360px !important; }
}
@media (min-width: 1201px) {
  .panel.idcf-side { min-width: 300px !important; max-width: 340px !important; }
}

/* ── Report: Page-1 highlights, moat scorecard, forensic grid (print-on-white .ir context) ── */
.ir-highlights { border-left: 3px solid var(--accent, #c2181b); padding: 4px 0 4px 18px; margin: 8px 0 18px; }
.ir-h-title { margin: 0 0 8px !important; font-size: 17px; }
.ir-lead { font-size: 13px; line-height: 1.6; margin: 0 0 10px; }
.ir-hi-list { margin: 0; padding-left: 18px; }
.ir-hi-list li { font-size: 12.5px; line-height: 1.6; margin-bottom: 7px; }
.ir-moat-tag { display: inline-block; padding: 1px 9px; border-radius: 2px; font-size: 11px; font-weight: 600; }
.ir-moat-tag.Wide { background: #1f7a4d; color: #fff; }
.ir-moat-tag.Narrow { background: #c8862a; color: #fff; }
.ir-moat-tag.None { background: #999; color: #fff; }
.ir-forensic-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 760px) { .ir-forensic-grid { grid-template-columns: 1fr; } }

/* ════════ FORENSIC ANALYSIS MODULE ════════ */
.frc { display: flex; flex-direction: column; gap: 2px; }
.frc-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--hairline); }
.frc-card { background: var(--ink-2); padding: 18px 16px; border-top: 2px solid var(--hairline); }
.frc-card.frc-a { border-top-color: #1f7a4d; } .frc-card.frc-b { border-top-color: #6a9a3a; }
.frc-card.frc-c { border-top-color: var(--amber); } .frc-card.frc-d { border-top-color: var(--down); }
.frc-c-l { font-family: var(--mono); font-size: 9px; letter-spacing: 0.14em; color: var(--muted); }
.frc-c-v { font-family: var(--serif); font-size: 30px; color: var(--fg); margin: 6px 0 2px; }
.frc-c-v small { font-size: 14px; color: var(--muted); }
.frc-c-s { font-size: 11px; color: var(--muted-ink); }
.frc-sec { background: var(--ink-2); padding: 16px 18px; }
.frc-sh { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.frc-sh h4 { font-family: var(--sans); font-size: 14px; font-weight: 600; color: var(--fg); }
.frc-sh span { font-family: var(--mono); font-size: 10px; color: var(--muted-ink); margin-left: auto; }
.frc-t { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 11px; }
.frc-t th { text-align: right; padding: 6px 8px; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--hairline); }
.frc-t th:first-child, .frc-t th:last-child { text-align: left; }
.frc-t td { text-align: right; padding: 5px 8px; border-bottom: 1px solid rgba(35,42,51,.5); color: var(--fg); }
.frc-t td:first-child { text-align: left; font-family: var(--sans); color: var(--muted); }
.frc-t td:last-child { text-align: left; color: var(--muted-ink); }
.frc-t tr.frc-tot td { border-top: 1px solid var(--amber); font-weight: 600; color: var(--fg); }
.frc-note { font-size: 10px; color: var(--muted-ink); margin-top: 8px; }
.frc-flags { display: flex; flex-direction: column; gap: 7px; }
.frc-flag { display: flex; align-items: flex-start; gap: 9px; font-size: 12px; color: var(--fg); line-height: 1.5; padding: 8px 11px; background: var(--ink); border-left: 2px solid var(--hairline); }
.frc-flag-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.frc-flag.high { border-left-color: var(--down); } .frc-flag.high .frc-flag-dot { background: var(--down); }
.frc-flag.med { border-left-color: var(--amber); } .frc-flag.med .frc-flag-dot { background: var(--amber); }
.frc-flag.low { border-left-color: #1f7a4d; } .frc-flag.low .frc-flag-dot { background: #1f7a4d; }
.frc-pio { display: grid; grid-template-columns: 1fr 1fr; gap: 1px 16px; }
.frc-pio-row { display: flex; align-items: center; gap: 9px; font-size: 12px; padding: 6px 0; color: var(--fg); border-bottom: 1px solid rgba(35,42,51,.4); }
.frc-pio-mark { font-weight: 700; width: 14px; }
.frc-pio-row.ok .frc-pio-mark { color: #2e9e6b; } .frc-pio-row.no .frc-pio-mark { color: var(--down); }
.frc-pio-row.no { color: var(--muted); }
@media (max-width: 900px) { .frc-cards { grid-template-columns: repeat(2, 1fr); } .frc-pio { grid-template-columns: 1fr; } }

/* ── forensic detail: figures, calc-backup, benchmarks, red-flag reasoning ── */
.frc-scroll { overflow-x: auto; }
.frc-fig td, .frc-fig th { white-space: nowrap; }
.frc-fig td:first-child { color: var(--muted); }
.frc-fig td:not(:first-child) { font-family: var(--mono); color: var(--fg); text-align: right; }
.frc-fig td:last-child, .frc-fig th:last-child { text-align: right; color: var(--fg); }
.frc-bm { color: var(--muted-ink) !important; font-size: 10px; }
.frc-calc { color: var(--muted) !important; font-family: var(--mono); font-size: 10.5px; }
.frc-pio-t td:last-child, .frc-pio-t th:last-child { text-align: center; }
.frc-pio-t .frc-calc { white-space: nowrap; }
.frc-pass td { background: color-mix(in srgb, var(--up) 6%, transparent); }
.frc-fail td { background: color-mix(in srgb, var(--down) 6%, transparent); }
.frc-mark { font-weight: 700; text-align: center !important; }
.frc-pass .frc-mark { color: #2e9e6b; }
.frc-fail .frc-mark { color: var(--down); }
.frc-z td:last-child, .frc-z th:last-child { text-align: right !important; color: var(--fg) !important; font-family: var(--mono); }
.frc-flag > div { min-width: 0; }
.frc-flag-t { font-weight: 500; color: var(--fg); }
.frc-flag-why { font-size: 11px; color: var(--muted); line-height: 1.5; margin-top: 3px; font-family: var(--sans); }

/* ════════ RISK CENTER MODULE ════════ */
.rsk { display: flex; flex-direction: column; gap: 2px; }
.rsk-head { display: grid; grid-template-columns: 240px 1fr; gap: 1px; background: var(--hairline); }
.rsk-gauge { background: var(--ink-2); padding: 20px 18px; display: flex; flex-direction: column; gap: 8px; border-top: 3px solid var(--hairline); }
.rsk-gauge.rsk-a { border-top-color: #1f7a4d; } .rsk-gauge.rsk-b { border-top-color: #6a9a3a; }
.rsk-gauge.rsk-c { border-top-color: var(--amber); } .rsk-gauge.rsk-d { border-top-color: var(--down); }
.rsk-g-score { font-family: var(--serif); font-size: 40px; line-height: 1; color: var(--fg); }
.rsk-g-score small { font-size: 16px; color: var(--muted); }
.rsk-g-band { font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em; color: var(--muted); }
.rsk-g-bar { height: 6px; background: var(--ink); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.rsk-g-bar i { display: block; height: 100%; background: linear-gradient(90deg, #1f7a4d, var(--amber), var(--down)); }
.rsk-cats { background: var(--ink-2); padding: 14px 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
.rsk-cat { display: flex; flex-direction: column; gap: 4px; }
.rsk-cat-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; color: var(--muted); }
.rsk-cat-top b { font-family: var(--mono); font-size: 14px; }
.rsk-cat-bar { height: 4px; background: var(--ink); border-radius: 2px; overflow: hidden; }
.rsk-cat-bar i { display: block; height: 100%; }
.rsk-cat-sub { font-size: 10px; color: var(--muted-ink); }
.rsk-a, .rsk-cat-bar i.rsk-a, b.rsk-a { color: #2e9e6b; } .rsk-cat-bar i.rsk-a { background: #2e9e6b; }
.rsk-b, b.rsk-b { color: #6a9a3a; } .rsk-cat-bar i.rsk-b { background: #6a9a3a; }
.rsk-c, b.rsk-c { color: var(--amber); } .rsk-cat-bar i.rsk-c { background: var(--amber); }
.rsk-d, b.rsk-d { color: var(--down); } .rsk-cat-bar i.rsk-d { background: var(--down); }
.rsk-sec { background: var(--ink-2); padding: 16px 18px; }
.rsk-sh { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.rsk-sh h4 { font-family: var(--sans); font-size: 14px; font-weight: 600; color: var(--fg); }
.rsk-sh span { font-family: var(--mono); font-size: 10px; color: var(--muted-ink); margin-left: auto; }
/* matrix */
.rsk-matrix { position: relative; padding-left: 18px; }
.rsk-m-ylabel { position: absolute; left: -8px; top: 50%; transform: rotate(-90deg); transform-origin: left; font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; color: var(--muted-ink); white-space: nowrap; }
.rsk-m-row { display: grid; grid-template-columns: 96px repeat(5, 1fr); gap: 3px; margin-bottom: 3px; align-items: stretch; }
.rsk-m-axis { font-size: 10px; color: var(--muted); display: flex; align-items: center; justify-content: flex-end; padding-right: 8px; text-align: right; }
.rsk-m-cell { min-height: 46px; border-radius: 3px; display: flex; flex-wrap: wrap; gap: 3px; align-items: center; justify-content: center; padding: 4px; }
.rsk-m-cell.rsk-a { background: rgba(46,158,107,.18); } .rsk-m-cell.rsk-b { background: rgba(106,154,58,.22); }
.rsk-m-cell.rsk-c { background: rgba(200,134,42,.25); } .rsk-m-cell.rsk-d { background: rgba(200,75,60,.3); }
.rsk-m-dot { width: 22px; height: 22px; border-radius: 50%; background: var(--ink); border: 1px solid var(--hairline); color: var(--fg); font-family: var(--mono); font-size: 11px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.rsk-m-xlabel { font-size: 10px; color: var(--muted); text-align: center; padding-top: 4px; }
.rsk-m-xtitle { font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; color: var(--muted-ink); text-align: center; margin-top: 6px; }
/* register */
.rsk-register { display: flex; flex-direction: column; gap: 16px; }
.rsk-reg-cat h5 { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; color: var(--amber); margin-bottom: 8px; text-transform: uppercase; }
.rsk-reg-row { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(35,42,51,.5); }
.rsk-reg-sev { width: 34px; height: 34px; flex-shrink: 0; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 14px; font-weight: 700; color: #fff; }
.rsk-reg-sev.rsk-a { background: #1f7a4d; } .rsk-reg-sev.rsk-b { background: #6a9a3a; }
.rsk-reg-sev.rsk-c { background: var(--amber); } .rsk-reg-sev.rsk-d { background: var(--down); }
.rsk-reg-t { font-size: 13px; color: var(--fg); font-weight: 600; margin-bottom: 3px; }
.rsk-reg-pi { font-family: var(--mono); font-size: 10px; color: var(--muted); font-weight: 400; margin-left: 6px; }
.rsk-reg-e { font-size: 12px; color: var(--muted); line-height: 1.5; margin-bottom: 3px; }
.rsk-reg-m { font-size: 11.5px; color: var(--muted-ink); line-height: 1.5; }
.rsk-reg-m b { color: var(--muted); }
.rsk-var { font-size: 12px; color: var(--fg); margin-top: 10px; padding: 10px 12px; background: var(--ink); border-left: 2px solid var(--amber); }
.rsk-var b { font-family: var(--mono); }
@media (max-width: 900px) { .rsk-head { grid-template-columns: 1fr; } .rsk-cats { grid-template-columns: 1fr; } .rsk-m-row { grid-template-columns: 70px repeat(5, 1fr); } }

/* ════════ EQUITY RESEARCH new panels: Business / Management / Moat / Ownership ════════ */
.bq-score { margin-top: 12px; background: var(--ink); padding: 14px 16px; border-left: 2px solid var(--amber); }
.bq-l { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; color: var(--muted); }
.bq-v { font-family: var(--serif); font-size: 22px; color: var(--fg); margin: 4px 0 10px; }
.bq-v small { font-size: 13px; color: var(--muted); }
.bq-bars { display: flex; flex-direction: column; gap: 7px; }
.bq-bar { display: grid; grid-template-columns: 120px 1fr 130px; align-items: center; gap: 10px; font-size: 11px; }
.bq-bn { color: var(--muted); } .bq-bd { color: var(--muted-ink); font-family: var(--mono); font-size: 10px; text-align: right; }
.bq-track { height: 6px; background: var(--ink-2); border-radius: 3px; overflow: hidden; }
.bq-track i { display: block; height: 100%; background: var(--amber); }
.moat-tag { display: inline-block; padding: 1px 9px; border-radius: 2px; font-size: 10px; font-weight: 600; color: #fff; }
.moat-tag.Wide { background: #1f7a4d; } .moat-tag.Narrow { background: var(--amber); } .moat-tag.None { background: #888; }
.own-split { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.own-seg .own-bar { height: 10px; background: var(--ink-2); border-radius: 5px; overflow: hidden; }
.own-seg .own-bar i { display: block; height: 100%; background: #3a6ea5; }
.own-seg .own-bar.amber i { background: var(--amber); }
.own-lbl { font-size: 11px; color: var(--muted); margin-top: 4px; }
.own-lbl b { color: var(--fg); font-family: var(--mono); }
.own-score { font-size: 12px; color: var(--muted); padding: 8px 0; }
.own-score b { color: var(--fg); }

/* ════════ MODELING LAB: valuation methods + Monte Carlo ════════ */
.vm-verdict { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--hairline); }
.vm-verdict > div { background: var(--ink-3); padding: 12px 16px; display: flex; flex-direction: column; gap: 4px; }
.vm-verdict .l { font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em; color: var(--muted); }
.vm-verdict .n { font-family: var(--mono); font-size: 20px; color: var(--fg); }
.vf { padding: 6px 4px; }
.vf-row { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 12px; margin-bottom: 9px; }
.vf-name { font-size: 11px; color: var(--muted); text-align: right; }
.vf-track { position: relative; height: 20px; background: linear-gradient(90deg, rgba(35,42,51,.4), rgba(35,42,51,.7)); border-radius: 3px; }
.vf-dot { position: absolute; top: 50%; width: 11px; height: 11px; border-radius: 50%; background: var(--amber); transform: translate(-50%, -50%); }
.vf-dot.blend { background: var(--up); width: 13px; height: 13px; }
.vf-val { position: absolute; top: 50%; transform: translate(-50%, -50%); font-family: var(--mono); font-size: 9px; color: var(--fg); margin-top: -16px; white-space: nowrap; }
.vf-val.blend { color: var(--up); font-weight: 700; }
.vf-val.cur { color: #e8e6e1; }
.vf-mark { position: absolute; top: 0; bottom: 0; width: 2px; background: #e8e6e1; transform: translateX(-50%); }
.vf-blend .vf-track { background: linear-gradient(90deg, rgba(46,158,107,.15), rgba(46,158,107,.3)); }
.vf-axis { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 9px; color: var(--muted-ink); padding: 0 0 0 132px; margin-top: 2px; }
.vm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1px; background: var(--hairline); }
.vm-card { background: var(--ink-2); padding: 12px 14px; }
.vm-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.vm-h span { font-size: 12px; color: var(--fg); font-weight: 600; } .vm-h b { font-family: var(--mono); font-size: 14px; color: var(--amber-bright); }
.vm-t { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 10px; }
.vm-t td { padding: 3px 0; color: var(--muted); border-bottom: 1px solid rgba(35,42,51,.4); }
.vm-t td:last-child { text-align: right; color: var(--fg); }
.vm-note { font-size: 10px; color: var(--muted-ink); line-height: 1.5; margin-top: 8px; }
.vm-disc { font-size: 10.5px; color: var(--muted-ink); line-height: 1.55; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--hairline); }
.mc-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; background: var(--hairline); margin-bottom: 14px; }
.mc-stats > div { background: var(--ink-2); padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.mc-stats .l { font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; color: var(--muted); }
.mc-stats .n { font-family: var(--mono); font-size: 15px; color: var(--fg); }
.mc-stats .mc-hl { background: var(--ink-3); box-shadow: inset 2px 0 0 var(--amber); }
.mc-canvas { width: 100%; height: 180px; display: block; }
.mc-range { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 10px; color: var(--muted); margin-top: 6px; }
.mc-range b { color: var(--fg); }
@media (max-width: 900px) { .mc-stats { grid-template-columns: repeat(2, 1fr); } .vm-verdict { grid-template-columns: 1fr; } }
/* ════════════════════════════════════════════════════════════════════════
   SECTION 2 EXPANDED — year-wise assumption recap + Integrated Forecast
   Financial Model (Income / Balance / Cash-flow tabs).
   Sits inside Section 2 of renderInstitutionalDCF when expanded mode is on.
   ════════════════════════════════════════════════════════════════════════ */

/* Wrapper — outlines the block as a single unit per the reference screenshot */
.s2-expanded { display: flex; flex-direction: column; gap: 14px; }

/* ── 1. Forecast Assumptions (Future Years) ───────────────────────── */

.ifa-block{
    border:1px solid var(--hairline);
    background:var(--ink-2);
    overflow-x:auto;
}

.ifa-block-hdr{
    display:flex;
    align-items:center;
    gap:8px;
    padding:10px 14px;
    border-bottom:1px solid var(--hairline);
    background:var(--ink-3);
}

.ifa-block-ttl{
    font-family:var(--sans);
    font-size:12.5px;
    font-weight:600;
    color:var(--fg);
}

.ifa-foot-icon{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    width:13px;
    height:13px;
    border:1px solid var(--muted-ink);
    border-radius:50%;
    font-size:9px;
    color:var(--muted);
    cursor:help;
}

/* ---------- Table ---------- */

.ifa-table{
    width:100%;
    min-width:980px;
    border-collapse:collapse;
    table-layout:fixed;
    font-family:var(--mono);
    font-size:10.5px;
}

.ifa-table th,
.ifa-table td{
    padding:6px 6px;
    text-align:right;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.ifa-table th:first-child,
.ifa-table td:first-child{
    width:220px;
    min-width:220px;
    text-align:left;
    white-space:normal;
}

.ifa-table thead th{
    font-size:9px;
    font-weight:600;
    letter-spacing:.08em;
    color:var(--muted);
    border-bottom:1px solid var(--hairline);
}

.ifa-table tbody td{
    border-bottom:1px solid rgba(35,42,51,.4);
    transition:background .12s;
}

.ifa-table tbody tr:hover td{
    background:var(--ink-3);
}

.ifa-lbl{
    text-align:left!important;
    color:var(--fg);
    font-weight:500;
    font-family:var(--mono);
}

.ifa-fc-y3{
    color:var(--amber-bright);
    font-weight:500;
}

.ifa-fc,
.ifa-fc-muted,
.ifa-term,
.ifa-term-cell{
    color:var(--muted);
}

.ifa-muted{
    color:var(--muted-ink);
}

.ifa-yr-tag{
    display:block;
    margin-top:2px;
    font-size:8px;
    color:var(--muted-ink);
    font-weight:400;
}
/* ── 2. Integrated Forecast Financial Model ─────────────────────────── */
.iffm-block { border: 1px solid var(--hairline); background: var(--ink-2); }

/* Tab strip */
.iffm-tabs { display: flex; border-bottom: 1px solid var(--hairline);
  background: var(--ink-2); padding: 0 14px; }
.iffm-tab { font-family: var(--sans); font-size: 12.5px; font-weight: 500;
  color: var(--muted); padding: 12px 18px; cursor: pointer;
  border-bottom: 2px solid transparent; transition: all 0.15s;
  background: transparent; letter-spacing: 0; }
.iffm-tab:hover { color: var(--amber-bright); }
.iffm-tab.is-active { color: var(--amber-bright); font-weight: 600;
  border-bottom-color: var(--amber); }

/* Pane visibility */
.iffm-pane { display: none; padding: 10px 14px 14px; }
.iffm-pane.is-active { display: block; }

/* ── Horizontal scroll containment ───────────────────────────────────────
   Root-cause fix for the Balance Sheet overflowing its card on long
   forecast horizons: previously the <table> sat directly inside .iffm-pane
   with nothing declaring overflow, so once the table's content-driven width
   (many forecast-year columns × long Yahoo-native line-item labels)
   exceeded the pane, the browser let it spill out past the card edge
   instead of clipping or scrolling it.
   This wrapper is the single fix point, applied identically to ALL THREE
   statements (Income / Balance / Cash Flow) — not just Balance Sheet — so
   the same latent bug can't resurface on Income or Cash Flow once either
   gets enough forecast columns. It scrolls on its own; the pane, the block
   and the page never do. When the table's natural width fits the pane (the
   common case at 3/5/7-year horizons), no scrollbar appears at all — the
   table simply renders at its normal width, exactly like Excel/Bloomberg. */
.iffm-table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  position: relative;
  -webkit-overflow-scrolling: touch;
}
.iffm-table-scroll::-webkit-scrollbar { height: 8px; }
.iffm-table-scroll::-webkit-scrollbar-track { background: var(--ink-2); }
.iffm-table-scroll::-webkit-scrollbar-thumb { background: var(--hairline); border-radius: 4px; }
.iffm-table-scroll::-webkit-scrollbar-thumb:hover { background: var(--muted-ink); }
/* Firefox */
.iffm-table-scroll { scrollbar-width: thin; scrollbar-color: var(--hairline) var(--ink-2); }

/* Statement tables — match Section 1 historical foundation density */
.iffm-table { width: 100%; border-collapse: collapse; font-family: var(--mono);
  font-size: 11px; }
.iffm-table th, .iffm-table td { padding: 5px 10px; text-align: right;
  white-space: nowrap; }
.iffm-table thead th { font-size: 9.5px; font-weight: 600; letter-spacing: 0.08em;
  color: var(--muted); border-bottom: 1px solid var(--hairline); padding-top: 10px; }
.iffm-table thead th.iffm-unit { text-align: left; letter-spacing: 0;
  color: var(--muted); font-weight: 500; }
.iffm-table thead th.iffm-fc-hdr { color: var(--amber-bright); }
.iffm-table tbody tr { transition: background 0.12s; }
.iffm-table tbody tr:hover td { background: var(--ink-3); }
.iffm-table tbody td { border-bottom: 1px solid rgba(35,42,51,0.35); color: var(--muted); }
.iffm-lbl { text-align: left !important; color: var(--fg); font-weight: 400;
  font-family: var(--mono); font-size: 11px; }
/* Label column gets a fixed, comfortable width and is allowed to wrap onto a
   second line for the longer Yahoo-native BS line items (e.g. "Cash, Cash
   Equivalents & ST Investments"). This keeps the label column from being the
   thing that forces horizontal scrolling at short forecast horizons — only
   genuinely many year-columns (10-Year+) should trigger the scrollbar. */
.iffm-table td.iffm-lbl, .iffm-table th.iffm-lbl {
  white-space: normal; max-width: 250px;
  line-height: 1.4;
}
.iffm-fc-cell { color: var(--amber-bright); }

/* Strong rows — section totals (Revenue, EBITDA, EBIT, PBT, PAT, Total Assets etc.) */
.iffm-table tbody tr.iffm-row-strong td { color: var(--fg); font-weight: 600; }
.iffm-table tbody tr.iffm-row-strong .iffm-fc-cell { color: var(--amber-bright); font-weight: 600; }
.iffm-table tbody tr.iffm-row-strong .iffm-lbl { color: var(--fg); font-weight: 600; }

/* Sub rows — derived ratios (margin %, growth %) — slightly muted */
.iffm-table tbody tr.iffm-row-sub td { color: var(--muted); font-style: normal; }
.iffm-table tbody tr.iffm-row-sub .iffm-lbl { color: var(--muted); }
.iffm-table tbody tr.iffm-row-sub .iffm-fc-cell { color: var(--amber); }

/* Section banner row (ASSETS / LIABILITIES & EQUITY in BS) */
.iffm-table tbody tr.iffm-sec-row td { background: var(--ink-3);
  color: var(--amber); font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;align-items: right;
  padding: 8px 10px 6px; border-bottom: 1px solid var(--hairline); }

.iffm-muted { color: var(--muted-ink); }




/* ════════════════════════════════════════════════════════════════════════
   BALANCE SHEET — Yahoo-native tree with expand/collapse
   Mirrors the fundamentalsTimeSeries hierarchy. Each parent row has a
   chevron; clicking toggles the .bs-hidden class on its descendants.
   ════════════════════════════════════════════════════════════════════════ */
.iffm-bs-tree .bs-row.bs-hidden { display: none; }
.iffm-bs-tree .bs-chev {
  display: inline-block; width: 13px; margin-right: 6px;
  color: var(--muted); cursor: pointer;
  transform: rotate(0deg); transition: transform 0.15s, color 0.12s;
  user-select: none; text-align: center;
}
.iffm-bs-tree .bs-chev.is-open { transform: rotate(90deg); color: var(--amber-bright); }
.iffm-bs-tree .bs-chev:hover   { color: var(--amber-bright); }
.iffm-bs-tree .bs-chev-spacer  { display: inline-block; width: 13px; margin-right: 6px; }
/* Children get slightly muted colour to reinforce hierarchy */
.iffm-bs-tree .bs-row.level-2 .iffm-lbl,
.iffm-bs-tree .bs-row.level-3 .iffm-lbl,
.iffm-bs-tree .bs-row.level-4 .iffm-lbl { color: var(--muted); }
.iffm-bs-tree .bs-row.level-2.iffm-row-strong .iffm-lbl,
.iffm-bs-tree .bs-row.level-3.iffm-row-strong .iffm-lbl { color: var(--fg); }
/* Level-3+ rows get a subtle left border to show nesting */
.iffm-bs-tree .bs-row.level-3 .iffm-lbl,
.iffm-bs-tree .bs-row.level-4 .iffm-lbl {
  border-left: 1px dotted rgba(106,118,138,0.25);
  margin-left: 6px;
}
/* ════════ MARKET INTELLIGENCE: Industry Analysis + Macro ════════ */
.ind-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--hairline); margin-bottom: 14px; }
.ind-card { background: var(--ink-2); padding: 12px 14px; }
.ind-l { font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em; color: var(--muted); }
.ind-v { font-size: 16px; color: var(--fg); margin: 5px 0 2px; font-weight: 600; }
.ind-s { font-size: 10px; color: var(--muted-ink); }
.ind-sub { font-size: 10px; letter-spacing: 0.1em; color: var(--amber); margin: 16px 0 8px; }
.ind-share { display: flex; flex-direction: column; gap: 6px; }
.ind-sh-row { display: grid; grid-template-columns: 160px 1fr 50px; align-items: center; gap: 10px; font-size: 11px; }
.ind-sh-row.self .ind-sh-n { color: var(--amber-bright); font-weight: 600; }
.ind-sh-n { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ind-sh-track { height: 12px; background: var(--ink-2); border-radius: 3px; overflow: hidden; }
.ind-sh-track i { display: block; height: 100%; background: #3a6ea5; }
.ind-sh-row.self .ind-sh-track i { background: var(--amber); }
.ind-sh-v { font-family: var(--mono); color: var(--fg); text-align: right; }
.ind-porter { display: flex; flex-direction: column; gap: 10px; }
.ind-pf-top { display: flex; justify-content: space-between; font-size: 12px; color: var(--fg); margin-bottom: 4px; }
.ind-pf-score { font-family: var(--mono); font-size: 11px; padding: 0 6px; border-radius: 2px; }
.ind-pf-score.s1, .ind-pf-score.s2 { color: #2e9e6b; } .ind-pf-score.s3 { color: var(--amber); } .ind-pf-score.s4, .ind-pf-score.s5 { color: var(--down); }
.ind-pf-bar { height: 5px; background: var(--ink-2); border-radius: 3px; overflow: hidden; }
.ind-pf-bar i.s1, .ind-pf-bar i.s2 { background: #2e9e6b; } .ind-pf-bar i.s3 { background: var(--amber); } .ind-pf-bar i.s4, .ind-pf-bar i.s5 { background: var(--down); }
.ind-pf-bar i { display: block; height: 100%; }
.ind-pf-note { font-size: 10.5px; color: var(--muted-ink); line-height: 1.5; margin-top: 4px; }
.ind-note { font-size: 10px; color: var(--muted-ink); line-height: 1.5; margin-top: 8px; }
.macro-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1px; background: var(--hairline); }
.macro-grp { background: var(--ink-2); padding: 10px 14px; }
.macro-gl { font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em; color: var(--amber); margin-bottom: 8px; }
.macro-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: baseline; padding: 4px 0; font-size: 12px; border-bottom: 1px solid rgba(35,42,51,.4); }
.macro-n { color: var(--muted); } .macro-p { font-family: var(--mono); color: var(--fg); }
.macro-c { font-family: var(--mono); font-size: 10px; min-width: 52px; text-align: right; }
@media (max-width: 900px) { .ind-cards { grid-template-columns: repeat(2, 1fr); } .ind-sh-row { grid-template-columns: 110px 1fr 44px; } }


/* ════════ EARNINGS CALL MODULE ════════ */
.ec-calls { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; max-height: 280px; overflow-y: auto; }
.ec-call { display: flex; justify-content: space-between; align-items: center; width: 100%; background: var(--ink); border: 1px solid var(--hairline); color: var(--fg); padding: 7px 10px; font-family: var(--mono); font-size: 11px; cursor: pointer; text-align: left; }
.ec-call:hover { border-color: var(--amber); background: var(--ink-2); }
.ec-call span { color: var(--muted-ink); font-size: 10px; }
.ec { display: flex; flex-direction: column; gap: 2px; }
.ec-head { display: grid; grid-template-columns: 220px 1fr; gap: 1px; background: var(--hairline); }
.ec-gauge { background: var(--ink-2); padding: 18px 16px; }
.ec-g-score { font-family: var(--serif); font-size: 36px; line-height: 1; color: var(--fg); }
.ec-g-score small { font-size: 15px; color: var(--muted); }
.ec-g-l { font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em; color: var(--muted); margin-top: 6px; }
.ec-g-tag { font-size: 14px; color: var(--amber-bright); font-weight: 600; margin-top: 2px; }
.ec-g-meta { font-family: var(--mono); font-size: 10px; color: var(--muted-ink); margin-top: 8px; }
.ec-insights { background: var(--ink-2); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.ec-ins { font-size: 12px; color: var(--fg); line-height: 1.5; padding-left: 12px; border-left: 2px solid var(--hairline); }
.ec-ins b { color: var(--amber-bright); }
.ec-sec { background: var(--ink-2); padding: 16px 18px; }
.ec-sh { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.ec-sh h4 { font-family: var(--sans); font-size: 14px; font-weight: 600; color: var(--fg); }
.ec-sh span { font-family: var(--mono); font-size: 10px; color: var(--muted-ink); margin-left: auto; }
.ec-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.ec-list li { font-size: 12px; color: var(--muted); line-height: 1.5; }
.ec-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ec-chip { background: var(--ink); border: 1px solid var(--hairline); border-radius: 3px; padding: 3px 9px; font-size: 11px; color: var(--muted); text-transform: capitalize; }
.ec-chip b { color: var(--amber-bright); font-family: var(--mono); }
.ec-topics { display: flex; flex-direction: column; gap: 7px; }
.ec-topic { display: grid; grid-template-columns: 100px 1fr 34px; align-items: center; gap: 10px; font-size: 11px; }
.ec-tn { color: var(--muted); } .ec-tc { font-family: var(--mono); color: var(--fg); text-align: right; }
.ec-tbar { height: 7px; background: var(--ink); border-radius: 4px; overflow: hidden; }
.ec-tbar i { display: block; height: 100%; background: var(--amber); }
.ec-prose { font-size: 12px; color: var(--muted); line-height: 1.6; margin-top: 10px; padding: 10px 12px; background: var(--ink); border-left: 2px solid var(--amber); }
.ec-api-score { font-size: 13px; color: var(--fg); }
.ec-disc { font-size: 10px; color: var(--muted-ink); line-height: 1.55; margin-top: 8px; padding: 10px 0; }
@media (max-width: 900px) { .ec-head { grid-template-columns: 1fr; } .ec-topic { grid-template-columns: 80px 1fr 30px; } }

/* Earnings estimates panel */
.ec-est-next { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--hairline); margin-bottom: 12px; }
.ec-est-next > div { background: var(--ink); padding: 10px 14px; display: flex; flex-direction: column; gap: 3px; }
.ec-est-next .l { font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em; color: var(--muted); }
.ec-est-next .v { font-family: var(--mono); font-size: 15px; color: var(--fg); }
.ec-est td, .ec-est th { font-variant-numeric: tabular-nums; }

/* ════════ LIVE PRICE AUTO-REFRESH ════════ */
/* Flash animation when a price cell updates */
@keyframes priceFlash { 0% { background: rgba(200,134,42,.25); } 100% { background: transparent; } }
.price-flash { animation: priceFlash 0.8s ease-out; }
/* Live dot spinning arrow during market hours */
.live-dot .refresh-spin { display: inline-block; margin-left: 2px; font-size: 10px; }
/* Pulse the open company price slightly when updated */
#wsPriceLive, #wsChangeLive { transition: color 0.3s ease; }

/* ════════════════════ CALCULATORS ════════════════════ */
.calc-nav { display: flex; flex-direction: column; gap: 1px; background: var(--hairline); }
.calc-grp { background: var(--ink-2); padding: 10px 12px; }
.calc-gl { font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em; color: var(--amber); margin-bottom: 8px; }
.calc-link { display: block; width: 100%; background: transparent; border: none; border-left: 2px solid transparent; color: var(--muted); padding: 7px 10px; text-align: left; cursor: pointer; transition: all 0.15s; }
.calc-link:hover { background: var(--ink); border-left-color: var(--hairline); }
.calc-link.active { background: var(--ink); border-left-color: var(--amber); }
.calc-link b { display: block; font-size: 12px; color: var(--fg); font-weight: 500; }
.calc-link span { display: block; font-size: 10px; color: var(--muted-ink); margin-top: 2px; }

.cal { padding: 14px 18px; }
.cal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1px; background: var(--hairline); margin-bottom: 14px; }
.cal-card { background: var(--ink-2); padding: 14px 16px; }
.cal-h { font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em; color: var(--amber); margin-bottom: 10px; }
.cal-output { background: var(--ink-3); }
.cal-field { margin-bottom: 10px; }
.cal-field label { font-size: 11px; color: var(--muted); display: block; margin-bottom: 4px; }
.cal-input-row { display: flex; align-items: center; gap: 6px; }
.cal-input-row input { flex: 1; background: var(--ink); border: 1px solid var(--hairline); color: var(--fg); padding: 7px 10px; font-family: var(--mono); font-size: 12px; }
.cal-input-row input:focus { outline: none; border-color: var(--amber); }
.cal-suffix { font-family: var(--mono); font-size: 11px; color: var(--muted); min-width: 40px; }
.cal-note { font-size: 10px; color: var(--muted-ink); line-height: 1.4; margin-top: 6px; }
.cal-kv { display: flex; flex-direction: column; gap: 7px; }
.cal-kv > div { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; }
.cal-kv span { color: var(--muted); }
.cal-kv b { font-family: var(--mono); color: var(--fg); font-weight: 500; }
.cal-kv .cal-big { padding-top: 10px; border-top: 1px solid var(--hairline); margin-top: 4px; }
.cal-kv .cal-big span { font-size: 11px; }
.cal-kv .cal-big b { font-size: 18px; color: var(--amber-bright); }
.cal-formula { background: var(--ink-2); padding: 12px 16px; margin-bottom: 14px; }
.cal-fcode { font-family: var(--mono); font-size: 11px; color: var(--fg); padding: 8px 12px; background: var(--ink); border-left: 2px solid var(--amber); line-height: 1.6; }
.cal-fnote { font-size: 10.5px; color: var(--muted-ink); margin-top: 6px; line-height: 1.5; }
.cal-chart-wrap { background: var(--ink-2); padding: 12px 16px; margin-bottom: 14px; }
.cal-chart { width: 100%; height: 240px; display: block; }
.cal-legend { display: flex; gap: 16px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.cal-leg { display: flex; align-items: center; gap: 6px; }
.cal-leg i { width: 10px; height: 2px; display: inline-block; }
.cal-scenario { background: var(--ink-2); padding: 12px 16px; margin-bottom: 14px; }
.cal-stable { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 11px; }
.cal-stable th, .cal-stable td { padding: 6px 8px; border-bottom: 1px solid var(--hairline); text-align: right; }
.cal-stable th { color: var(--muted); font-weight: 500; text-transform: uppercase; font-size: 9px; letter-spacing: 0.1em; }
.cal-stable th:first-child, .cal-stable td:first-child { text-align: left; color: var(--muted); }
.cal-stable tr.self { background: rgba(200,134,42,.08); }
.cal-stable tr.self td { color: var(--amber-bright); }
.cal-explain { padding: 14px 18px; background: var(--ink-2); }
.cal-explain p { font-size: 12px; color: var(--muted); line-height: 1.7; margin: 0 0 10px; }
.cal-explain b { color: var(--fg); }

/* ════════════════════ LEARNING CENTER ════════════════════ */
.learn-nav { display: flex; flex-direction: column; gap: 1px; background: var(--hairline); }
.learn-grp { background: var(--ink-2); padding: 10px 12px; }
.learn-gl { font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em; color: var(--amber); margin-bottom: 8px; }
.learn-link { display: block; width: 100%; background: transparent; border: none; border-left: 2px solid transparent; color: var(--muted); padding: 7px 10px; text-align: left; cursor: pointer; }
.learn-link:hover { background: var(--ink); border-left-color: var(--hairline); }
.learn-link.active { background: var(--ink); border-left-color: var(--amber); }
.learn-link b { display: block; font-size: 12px; color: var(--fg); font-weight: 500; }
.learn-link span { display: block; font-size: 10px; color: var(--muted-ink); margin-top: 2px; }

.learn-doc { padding: 18px 22px; max-width: 880px; }
.learn-sec { margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--hairline); }
.learn-sec:last-child { border-bottom: 0; }
.learn-sh { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.learn-sn { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: var(--amber); color: var(--ink); font-family: var(--mono); font-size: 11px; font-weight: 600; }
.learn-sh h4 { font-size: 16px; font-weight: 600; color: var(--fg); margin: 0; }
.learn-sb { color: var(--muted); font-size: 13px; line-height: 1.75; }
.learn-sb p { margin: 0 0 10px; }
.learn-sb b { color: var(--fg); font-weight: 600; }
.learn-sb i { color: var(--fg); font-style: italic; }
.learn-sb ul { margin: 0 0 10px; padding-left: 22px; }
.learn-sb li { margin-bottom: 5px; }
.learn-sb code { font-family: var(--mono); font-size: 11px; background: var(--ink); padding: 2px 6px; border-radius: 2px; color: var(--amber-bright); }
.learn-viz { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.lv-row { display: grid; grid-template-columns: 90px 1fr 1fr 130px; align-items: center; gap: 8px; font-size: 11px; }
.lv-yr { color: var(--muted); font-family: var(--mono); }
.lv-bar { height: 14px; border-radius: 2px; }
.lv-future { background: var(--amber); }
.lv-today { background: #3a6ea5; }
.lv-empty { background: var(--ink); border: 1px solid var(--hairline); }
.lv-v { color: var(--fg); font-family: var(--mono); font-size: 11px; text-align: right; }
.learn-cap { font-size: 10.5px; color: var(--muted-ink); margin-top: 8px; }
.learn-table { display: flex; flex-direction: column; gap: 1px; background: var(--hairline); margin: 12px 0; }
.lt-row { display: grid; grid-template-columns: 1fr 2fr 1.5fr; gap: 8px; padding: 8px 12px; background: var(--ink-2); font-size: 12px; }
.lt-row > span:first-child { color: var(--fg); font-weight: 500; }
.lt-row.lt-h { background: var(--ink-3); color: var(--amber); font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; }
.lt-row.lt-h > span:first-child { color: var(--amber); }
.learn-rel { display: flex; flex-wrap: wrap; gap: 8px; }
.learn-rel a { display: inline-block; padding: 5px 10px; background: var(--ink); border: 1px solid var(--hairline); color: var(--muted); font-size: 11px; cursor: pointer; transition: all 0.15s; }
.learn-rel a:hover { border-color: var(--amber); color: var(--amber-bright); }
.btn-amber { background: var(--amber); color: var(--ink); border: 0; padding: 8px 14px; font-size: 11px; font-weight: 600; cursor: pointer; }
.btn-amber:hover { background: var(--amber-bright); }

/* ════════════════════ PRICE CHART COMPONENT ════════════════════ */
.pc-wrap { padding: 14px 18px; }
.pc-wrap.pc-compact { padding: 0; }
.pc-title { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.pc-title b { font-size: 14px; color: var(--fg); font-weight: 600; }
.pc-meta { font-size: 10px; color: var(--muted-ink); }
.pc-search { display: flex; gap: 6px; margin-bottom: 12px; position: relative; }
.pc-search input { flex: 1; background: var(--ink); border: 1px solid var(--hairline); color: var(--fg); padding: 8px 12px; font-family: var(--mono); font-size: 12px; }
.pc-search input:focus { outline: none; border-color: var(--amber); }
.pc-suggest { position: absolute; top: 100%; left: 0; right: 70px; background: var(--ink-2); border: 1px solid var(--hairline); border-top: 0; z-index: 50; max-height: 280px; overflow-y: auto; }
.pc-sugg-item { display: grid; grid-template-columns: 90px 1fr 60px; gap: 8px; padding: 6px 10px; cursor: pointer; font-size: 11px; border-bottom: 1px solid var(--hairline); }
.pc-sugg-item:hover { background: var(--ink); }
.pc-sugg-item b { color: var(--amber-bright); font-family: var(--mono); }
.pc-sugg-item span { color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-sugg-item i { color: var(--muted-ink); font-style: normal; text-align: right; font-family: var(--mono); font-size: 10px; }
.pc-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 10px; gap: 10px; flex-wrap: wrap; }
.pc-px-block { display: flex; align-items: baseline; gap: 12px; }
.pc-px { font-family: var(--mono); font-size: 22px; color: var(--fg); font-weight: 500; }
.pc-compact .pc-px { font-size: 16px; }
.pc-chg { font-family: var(--mono); font-size: 13px; }
.pc-compact .pc-chg { font-size: 11px; }
.pc-chg.up { color: #2e9e6b; }
.pc-chg.down { color: #c84b3c; }
.pc-ranges { display: flex; gap: 1px; background: var(--hairline); padding: 1px; }
.pc-rb { background: var(--ink-2); border: 0; color: var(--muted); padding: 5px 10px; font-family: var(--mono); font-size: 10px; cursor: pointer; min-width: 32px; }
.pc-rb:hover { background: var(--ink); color: var(--fg); }
.pc-rb.active { background: var(--amber); color: var(--ink); font-weight: 600; }
.pc-compact .pc-rb { padding: 3px 7px; font-size: 9px; min-width: 26px; }
.pc-canvas { width: 100%; display: block; cursor: crosshair; }
.pc-status { font-size: 10px; color: var(--muted-ink); margin-top: 6px; min-height: 14px; }

/* Equity Research overview side-chart layout */
.co-overview-row { display: grid; grid-template-columns: 1fr 420px; gap: 1px; background: var(--hairline); }
.co-overview-row .co-text { background: var(--ink-2); padding: 14px 18px; }
.co-overview-row .co-chart { background: var(--ink-2); padding: 14px 16px; }
@media (max-width: 980px) { .co-overview-row { grid-template-columns: 1fr; } }

/* ════════ REPORT — multi-factor composite framework styles ════════ */
.ir-comp-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: #d9d4c3; margin: 14px 0 18px; border: 1px solid #d9d4c3; }
.ir-comp-summary > div { background: #faf7f0; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.ir-cs-l { font-size: 9px; letter-spacing: 0.1em; color: #6b6557; text-transform: uppercase; font-family: var(--mono); }
.ir-cs-v { font-size: 18px; font-weight: 600; color: #1a1815; font-family: var(--mono); }
.ir-cs-v.ir-up { color: #1d6f48; }
.ir-cs-v.ir-down { color: #8a0e10; }

.ir-val-rationale { background: #fbf7eb; border-left: 3px solid #b08328; padding: 12px 16px; margin: 12px 0 16px; }
.ir-val-rationale h4 { margin: 0 0 8px; font-size: 11px; letter-spacing: 0.1em; color: #b08328; text-transform: uppercase; font-family: var(--mono); }
.ir-val-rationale p { margin: 0; font-size: 12.5px; line-height: 1.7; color: #2a2722; }

.ir-factor-tbl tr td:first-child { width: 22%; }
.ir-factor-tbl tr th:nth-child(2), .ir-factor-tbl tr td:nth-child(2) { width: 8%; }
.ir-factor-tbl tr th:nth-child(3), .ir-factor-tbl tr td:nth-child(3) { width: 14%; }
.ir-factor-score { display: inline-block; padding: 3px 10px; background: #b08328; color: #fff; font-family: var(--mono); font-size: 11px; font-weight: 600; border-radius: 2px; min-width: 60px; }

/* 5-level recommendation badge colors for the report cover */
.ir-verdict.STRONG_BUY { background: #cfe9d8; border-color: #1d6f48; }
.ir-verdict.STRONG_BUY .ir-v-v { color: #1d6f48; }
.ir-verdict.STRONG_SELL { background: #f4cdd0; border-color: #8a0e10; }
.ir-verdict.STRONG_SELL .ir-v-v { color: #8a0e10; }
.ir-verdict.BUY { background: #e0f0e6; }
.ir-verdict.BUY .ir-v-v { color: #2e9e6b; }
.ir-verdict.SELL { background: #f6dcdc; }
.ir-verdict.SELL .ir-v-v { color: #c2181b; }
.ir-verdict.HOLD .ir-v-v { color: #b08328; }

/* ════════════════════════════════════════════════════════════════════
   VALUATION MODEL STATE — status bar tags
   Uses the real design-system variables: --amber, --hairline, --fg, --muted
   ════════════════════════════════════════════════════════════════════ */
.vms-tag { display: inline-block; font-family: var(--mono); font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.12em; padding: 2px 8px; text-transform: uppercase; vertical-align: middle; }
.vms-ev  { background: rgba(46,158,107,0.18); color: var(--up); border: 1px solid rgba(46,158,107,0.35); }
.vms-adj { background: rgba(200,134,42,0.18); color: var(--amber-bright); border: 1px solid rgba(200,134,42,0.35); }
.vms-ts  { font-family: var(--mono); font-size: 10.5px; color: var(--muted); margin-left: 8px; }

/* ════════════════════════════════════════════════════════════════════
   ENHANCED ASSUMPTION PANEL — Bloomberg / FactSet terminal style
   2-column compact grid. All text on dark background uses --fg / --muted.
   ════════════════════════════════════════════════════════════════════ */

/* Model Quality Score bar at top of sidebar */
/* ── Model Quality Score — always full-width across both grid columns ── */
.ap-mqs { background: var(--ink-3); border: 1px solid var(--hairline);
  border-top: 2px solid var(--amber); padding: 10px 12px; margin-bottom: 0;
  grid-column: 1 / -1; }
.ap-mqs-row { display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 4px; font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em;
  color: var(--muted); text-transform: uppercase; }
.ap-mqs-score { font-weight: 700; font-size: 14px; letter-spacing: 0; }
.ap-mqs-score.mqs-high     { color: var(--up); }
.ap-mqs-score.mqs-moderate { color: var(--amber-bright); }
.ap-mqs-score.mqs-low      { color: var(--down); }
.ap-mqs-bar { height: 3px; background: var(--hairline); overflow: hidden; margin-bottom: 3px; }
.ap-mqs-bar i { display: block; height: 100%; background: var(--amber); }
.ap-mqs-label { font-family: var(--mono); font-size: 9px; color: var(--muted); }

/* ── Badge legend — always full-width across both grid columns ── */
.ap-legend { font-family: var(--mono); font-size: 9px; color: var(--muted); letter-spacing: 0.06em;
  padding: 5px 12px; background: var(--ink-3); border-bottom: 1px solid var(--hairline);
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  grid-column: 1 / -1; }

/* ── Main assumption grid — fills panel edge-to-edge, no padding on container ── */
.ap-rows { display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  background: var(--hairline); width: 100%; box-sizing: border-box; }

/* MQS + legend + WACC placed inside .ap-rows span both columns */
.ap-rows > .ap-mqs,
.ap-rows > .ap-legend,
.ap-rows > .ap-wacc-derived { grid-column: 1 / -1; }

/* Individual parameter card */
.ap-row { background: var(--ink-2); padding: 7px 10px; transition: background 0.12s; }
.ap-row:hover { background: var(--ink-3); }
.ap-row.ap-override { border-left: 2px solid var(--amber); background: rgba(200,134,42,0.06); }

/* Label row — parameter name + confidence/source micro-badges */
.ap-row-top { display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 4px; gap: 4px; }
.ap-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0em;
  color: var(--muted); text-transform: none; line-height: 1.3; }
.ap-badges { display: flex; gap: 3px; align-items: center; flex-shrink: 0; }

/* Value input row */
.ap-row-mid { display: flex; align-items: center; gap: 5px; }
.ap-input { flex: 1; background: var(--ink); border: 1px solid var(--hairline);
  color: var(--fg); font-family: var(--mono); font-size: 11px; font-weight: 600;
  padding: 4px 6px; text-align: right; outline: none; width: 100%;
  transition: border-color 0.15s; -moz-appearance: textfield; }
.ap-input::-webkit-inner-spin-button,
.ap-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.ap-input:focus { border-color: var(--amber); }
.ap-input[data-override="1"] { color: var(--amber-bright); }

/* Recommended value badge shown beside the input */
.ap-rec { font-family: var(--mono); font-size: 9px; color: var(--amber);
  background: rgba(200,134,42,0.12); border: 1px solid rgba(200,134,42,0.25);
  padding: 1px 4px; white-space: nowrap; flex-shrink: 0; }

/* Historical range shown beneath the input */
.ap-row-bot { margin-top: 3px; }
.ap-hist-range { font-family: var(--mono); font-size: 9px; color: var(--muted);
  background: rgba(255,255,255,0.04); padding: 1px 4px; }

/* ── Confidence dots and Source chips ─────────────────────────────── */
.ap-conf { display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 50%;
  font-family: var(--mono); font-size: 8px; font-weight: 700; flex-shrink: 0; }
.conf-h { background: rgba(46,158,107,0.25); color: var(--up); }
.conf-m { background: rgba(200,134,42,0.25); color: var(--amber-bright); }
.conf-l { background: rgba(200,75,60,0.25);  color: var(--down); }

.ap-src { display: inline-block; font-family: var(--mono); font-size: 8px; font-weight: 700;
  padding: 0px 3px; letter-spacing: 0.04em; }
.src-ev { background: rgba(46,158,107,0.18); color: var(--up); }
.src-vr { background: rgba(58,110,165,0.22); color: #6ba4d8; }
.src-ae { background: rgba(200,134,42,0.18); color: var(--amber-bright); }
.src-sp { background: rgba(200,75,60,0.18);  color: var(--down); }

/* WACC derived — full-width row at the bottom of the .ap-rows grid */
.ap-wacc-derived { background: var(--ink-3); border-left: 2px solid var(--amber);
  padding: 10px 12px; grid-column: 1 / -1; }
.ap-wacc-derived .ap-label { display: block; margin-bottom: 4px; }
.ap-wacc-val { font-family: var(--mono); font-size: 16px; font-weight: 700;
  color: var(--amber-bright); margin-right: 6px; }
.ap-wacc-formula { font-family: var(--mono); font-size: 9px; color: var(--muted); }

/* Reset button */
.btn-reset-assumptions { background: transparent; border: 1px solid var(--hairline);
  color: var(--muted); font-family: var(--mono); font-size: 9.5px; padding: 7px 10px;
  cursor: pointer; letter-spacing: 0.06em; transition: all 0.15s;
  width: 100%; display: block; }
.btn-reset-assumptions:hover { border-color: var(--amber); color: var(--amber-bright); }

/* Full-width spanning helper for any direct .ap-rows child */
.ap-rows > .ap-full,
.ap-rows > .btn-reset-assumptions,
.ap-rows > .note { grid-column: 1 / -1; }

/* Utility note text — inside ap-rows grid, spans both columns */
.dcf-form .note { font-family: var(--mono); font-size: 9.5px; color: var(--muted);
  line-height: 1.55; padding: 8px 12px; background: var(--ink-3); }

/* ════════════════════════════════════════════════════════════════════
   ASSUMPTION INTELLIGENCE & EVIDENCE LAYER
   All colours use the real terminal design-system tokens.
   ════════════════════════════════════════════════════════════════════ */
.ai-layer { border: 1px solid var(--hairline); margin-bottom: 14px; overflow: hidden; background: var(--ink-2); }
.ai-layer-err { padding: 20px; font-family: var(--mono); font-size: 11px;
  color: var(--muted); display: flex; gap: 16px; align-items: center; }

/* Header bar — same pattern as .panel-h */
.ai-layer-hdr { background: var(--ink-3); border-bottom: 1px solid var(--hairline);
  padding: 10px 18px; display: flex; justify-content: space-between;
  align-items: center; flex-wrap: wrap; gap: 8px; }
.ai-layer-ttl { font-family: var(--mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.2em; color: var(--amber); text-transform: uppercase; }
.ai-layer-sub { font-family: var(--mono); font-size: 10px; color: var(--muted); }

/* Model Status card */
.ai-status-card { display: flex; justify-content: space-between; align-items: flex-start;
  padding: 12px 18px; border-bottom: 1px solid var(--hairline); gap: 20px; flex-wrap: wrap; }
.ai-sc-left { display: flex; flex-direction: column; gap: 5px; }
.ai-sc-row { display: flex; gap: 12px; font-family: var(--mono); font-size: 11px; align-items: center; }
.ai-sc-lbl { color: var(--muted); font-size: 9px; letter-spacing: 0.1em;
  text-transform: uppercase; min-width: 88px; }
.ai-sc-right { display: flex; flex-direction: column; align-items: flex-end; }
.ai-mqs-big { text-align: center; min-width: 96px; }
.ai-mqs-num { font-family: var(--mono); font-size: 30px; font-weight: 700; line-height: 1; }
.mqs-h { color: var(--up); }
.mqs-m { color: var(--amber-bright); }
.mqs-l { color: var(--down); }
.ai-mqs-lbl { font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em;
  color: var(--muted); text-transform: uppercase; margin: 3px 0 1px; }
.ai-mqs-sub { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.ai-mqs-bar { height: 3px; background: var(--hairline); overflow: hidden; margin-top: 5px; }
.ai-mqs-bar i { display: block; height: 100%; background: var(--amber); }

/* MQS strengths / weaknesses chips */
.ai-mqs-detail { padding: 8px 18px; border-bottom: 1px solid var(--hairline);
  display: flex; flex-wrap: wrap; gap: 5px; }
.ai-mqs-item { font-family: var(--mono); font-size: 9.5px; padding: 2px 8px; }
.ai-mqs-str { background: rgba(46,158,107,0.12); color: var(--up); }
.ai-mqs-wk  { background: rgba(200,134,42,0.12); color: var(--amber-bright); }

/* ── Diagnostics / Red Flags ───────────────────────────────────────── */
.ai-diag { padding: 10px 18px; border-bottom: 1px solid var(--hairline); }
.ai-diag-hdr { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.ai-sec-ttl { font-family: var(--mono); font-size: 11px; font-weight: 700;
  letter-spacing: 0.16em; text-transform: none; color: var(--fg); }
.ai-sec-sub { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.ai-sec-hdr { margin-bottom: 8px; }

.ai-diag-row { display: flex; gap: 10px; padding: 7px 10px;
  margin-bottom: 4px; border-left: 2px solid; background: var(--ink); }
.diag-crit { border-color: var(--down); }
.diag-high { border-color: #c85000; }
.diag-med  { border-color: var(--amber); }
.diag-low  { border-color: var(--hairline); }

.ai-diag-sev { font-family: var(--mono); font-size: 8.5px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; min-width: 46px;
  padding-top: 1px; flex-shrink: 0; }
.diag-crit .ai-diag-sev { color: var(--down); }
.diag-high .ai-diag-sev { color: #c85000; }
.diag-med  .ai-diag-sev { color: var(--amber-bright); }
.diag-low  .ai-diag-sev { color: var(--muted); }

.ai-diag-body { flex: 1; min-width: 0; }
.ai-diag-title  { font-family: var(--mono); font-size: 11px; font-weight: 600;
  color: var(--fg); margin-bottom: 2px; }
.ai-diag-detail { font-size: 10.5px; color: var(--muted); line-height: 1.5; margin-bottom: 2px; }
.ai-diag-fix    { font-size: 10px; color: var(--muted); }
.ai-diag-fix b  { color: var(--fg); }

/* ── Evidence Table ─────────────────────────────────────────────────── */
.ai-evidence { padding: 10px 18px 14px; }
.ai-table-wrap { overflow-x: auto; }
.aie-table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 11px; }
.aie-table thead tr { border-bottom: 2px solid var(--amber); }
.aie-table thead th { padding: 5px 8px; text-align: left; font-size: 9px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }

.aie-row td { padding: 6px 8px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
.aie-row:hover td { background: var(--ink-3); }
.aie-returns td { color: var(--muted); font-size: 10px; }

.aie-label { font-weight: 600; color: var(--fg); white-space: nowrap; }
.aie-base  { font-weight: 600; color: var(--amber-bright); }
.aie-hist  { color: var(--muted); white-space: nowrap; }
.aie-range { font-size: 9.5px; color: var(--muted); }
.aie-rec   { color: var(--up); font-weight: 600; }

.aie-detail-row td { padding: 0; background: var(--ink); }
.aie-detail-body { padding: 8px 12px; border-left: 2px solid var(--amber); margin: 3px 6px 6px; }
.aie-detail-lbl { display: inline-block; min-width: 90px; color: var(--muted);
  font-size: 9px; text-transform: uppercase; letter-spacing: 0.06em; }
.aie-detail-formula { font-size: 10.5px; color: var(--fg); margin-bottom: 4px; }
.aie-detail-method  { font-size: 10.5px; color: var(--muted); line-height: 1.6; margin-bottom: 2px; }

.aie-btn { background: transparent; border: 1px solid var(--mono); color: var(--amber-bright);
  font-family: var(--mono); font-size: 10px; padding: 2px 7px; cursor: pointer;
  transition: all 0.15s; white-space: nowrap; }
.aie-btn:hover { border-color: var(--amber); color: var(--amber-bright); }

.aie-wacc-decomp { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.aie-wacc-decomp span { font-size: 10px; color: var(--muted); }
.aie-wacc-decomp b { color: var(--amber-bright); }

.ai-legend-row { margin-top: 8px; font-family: var(--mono); font-size: 9.5px;
  color: var(--muted); display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }

/* ════════════════════════════════════════════════════════════════════════
   EXPANDED YEAR-WISE ASSUMPTIONS PANEL  (Modeling Lab — expanded mode)
   Sits inside the Assumption Intelligence layer between Model Diagnostics
   and the Assumption Evidence Table. Uses existing design tokens only.
   ════════════════════════════════════════════════════════════════════════ */

/* ── Expand & Edit pill (lives in the left assumption sidebar) ──────────── */
.ap-expand-pill { display: flex; align-items: center; justify-content: space-between;
  background: var(--ink-3); border: 1px solid var(--hairline); color: var(--muted);
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em;
  padding: 8px 12px; cursor: pointer; transition: all 0.15s;
  grid-column: 1 / -1; }
.ap-expand-pill:hover { border-color: var(--amber); color: var(--amber-bright); background: rgba(200,134,42,0.06); }
.ap-expand-pill[data-expanded="1"] { border-color: var(--amber); color: var(--amber-bright);
  background: rgba(200,134,42,0.08); }
.ap-expand-pill-lbl { font-weight: 600; }
.ap-expand-pill-icon { font-size: 12px; line-height: 1; opacity: 0.7; }

/* ── Block wrapper — same skin as other ai-* blocks ─────────────────────── */
.ape-block { padding: 10px 18px 14px; border-bottom: 1px solid var(--hairline);
  background: var(--ink-2); }

/* ── Header — title + horizon selector ─────────────────────────────────── */
.ape-hdr { display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.ape-hdr-sub { color: var(--muted); font-weight: 400; font-size: 10px;
  letter-spacing: 0.12em; margin-left: 4px; }
.ape-hdr-right { display: flex; align-items: center; gap: 10px; }
.ape-hdr-lbl { font-family: var(--mono); font-size: 9.5px; color: var(--muted);
  letter-spacing: 0.1em; text-transform: uppercase; }
.ape-horiz-grp { display: flex; border: 1px solid var(--hairline); background: var(--ink); }
.ape-horiz-btn { font-family: var(--mono); font-size: 10px; font-weight: 600;
  color: var(--muted); padding: 4px 10px; cursor: pointer;
  border-right: 1px solid var(--hairline); letter-spacing: 0.06em;
  transition: all 0.12s; background: transparent; }
.ape-horiz-btn:last-child { border-right: none; }
.ape-horiz-btn:hover { color: var(--amber-bright); background: var(--ink-3); }
.ape-horiz-btn.is-active { color: var(--amber-bright); background: var(--ink-3);
  box-shadow: inset 0 -2px 0 var(--amber); }

/* ── Legend strip ───────────────────────────────────────────────────────── */
.ape-legend { display: flex; flex-wrap: wrap; gap: 14px; padding: 6px 0 10px;
  border-bottom: 1px solid var(--hairline); margin-bottom: 8px;
  font-family: var(--mono); font-size: 9.5px; color: var(--muted); }
.ape-leg-item { display: inline-flex; align-items: center; gap: 4px; }
.ape-leg-edit { width: 10px; height: 10px; border: 1px solid var(--amber);
  background: rgba(200,134,42,0.08); display: inline-block; }
.ape-leg-lock { font-size: 9px; opacity: 0.65; }

/* ── Table — institutional density, monospace numerics ─────────────────── */
.ape-table-wrap { overflow-x: auto; }
.ape-table { width: 100%; border-collapse: collapse; font-family: var(--mono);
  font-size: 11px; min-width: 720px; }

/* Group header row (Actuals / Forecast / Terminal banner) */
.ape-table .ape-grp-hdr th { padding: 4px 6px; font-size: 8.5px; font-weight: 600;
  letter-spacing: 0.14em; color: var(--muted-ink); text-transform: uppercase;
  border-bottom: 1px solid var(--hairline); text-align: center; }
.ape-table .ape-grp-actuals { color: var(--muted); }
.ape-table .ape-grp-forecast { color: var(--amber); }
.ape-table .ape-grp-terminal { color: var(--muted); }

/* Per-year header row */
.ape-table .ape-yr-hdr th { padding: 5px 6px; font-size: 9px; font-weight: 600;
  letter-spacing: 0.08em; color: var(--muted); text-align: right; white-space: nowrap;
  border-bottom: 2px solid var(--amber); background: var(--ink-2); }
.ape-table .ape-yr-hdr .ape-row-lbl { text-align: left; letter-spacing: 0.1em;
  text-transform: uppercase; min-width: 220px; }
.ape-table .ape-yr-hdr .ape-fc { color: var(--amber-bright); }
.ape-table .ape-yr-hdr .ape-fc .ape-yr-tag { color: var(--muted); font-weight: 400; }
.ape-table .ape-yr-hdr .ape-term { color: var(--muted); }
.ape-table .ape-yr-hdr .ape-conf-hdr { color: var(--muted-ink); text-align: center; }

/* Section header row — full-width band */
.ape-table .ape-sec-hdr td { padding: 8px 6px 4px; font-size: 9.5px;
  font-weight: 700; letter-spacing: 0.16em; color: var(--amber);
  text-transform: uppercase; border-bottom: 1px solid var(--hairline);
  background: var(--ink-3); }

/* Assumption rows */
.ape-table .ape-row { transition: background 0.12s; }
.ape-table .ape-row:hover td { background: var(--ink-3); }
.ape-table .ape-row td { padding: 4px 6px; border-bottom: 1px solid var(--hairline);
  text-align: right; vertical-align: middle; white-space: nowrap; }
.ape-table .ape-row .ape-row-lbl { text-align: left; color: var(--fg);
  font-weight: 500; font-size: 11px; }
.ape-table .ape-row-derived .ape-row-lbl { color: var(--muted); }
.ape-row-suffix { color: var(--muted-ink); font-size: 10px; font-weight: 400; }

/* Actuals cell — muted, read-only */
.ape-cell { font-family: var(--mono); font-size: 11px; }
.ape-act-cell { color: var(--muted); }
.ape-act-cell .ape-cell-suffix { color: var(--muted-ink); margin-left: 1px; font-size: 10px; }

/* Locked (auto-derived Y4+ or Terminal) — distinct but consistent */
.ape-lock { color: var(--muted); position: relative; }
.ape-lock .ape-cell-suffix { color: var(--muted-ink); margin-left: 1px; font-size: 10px; }
.ape-lock.ape-derived { color: var(--muted); font-style: normal; }

/* Editable (Y1-Y3) — amber outline, pencil icon, input */
.ape-edit { color: var(--amber-bright); padding: 2px 4px;
  border: 1px solid rgba(200,134,42,0.45); background: rgba(200,134,42,0.06);
  position: relative; }
.ape-edit.is-override { border-color: var(--amber); background: rgba(200,134,42,0.12); }
.ape-cell-icon { display: inline-block; color: var(--amber); font-size: 9px;
  margin-right: 2px; opacity: 0.55; vertical-align: middle; }
.ape-cell-input { background: transparent; border: none; outline: none;
  color: var(--amber-bright); font-family: var(--mono); font-size: 11px;
  font-weight: 600; text-align: right; width: 40px;
  padding: 0; -moz-appearance: textfield; }
.ape-cell-input::-webkit-outer-spin-button,
.ape-cell-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ape-cell-input:focus { color: var(--amber-bright); outline: none; }
.ape-edit:focus-within { background: rgba(200,134,42,0.16); border-color: var(--amber); }
.ape-cell-suffix { color: var(--muted-ink); font-size: 10px; margin-left: 1px;
  display: inline-block; }
.ape-edit .ape-cell-suffix { color: var(--muted); }

/* Confidence/source mini-column */
.ape-conf-cell { display: flex; gap: 3px; align-items: center; justify-content: center;
  padding: 4px 6px !important; min-width: 56px; }

/* Terminal Method row — dropdown spans the forecast columns */
.ape-row-method .ape-method-cell { text-align: left; padding: 4px 6px; }
.ape-select { background: var(--ink); border: 1px solid var(--hairline);
  color: var(--amber-bright); font-family: var(--mono); font-size: 11px;
  padding: 3px 8px; min-width: 200px; outline: none; cursor: pointer; }
.ape-select:hover { border-color: var(--amber); }
.ape-select:focus { border-color: var(--amber); }

/* Footer note */
.ape-footer { display: flex; align-items: center; gap: 6px; padding: 10px 0 0;
  font-family: var(--mono); font-size: 10px; color: var(--muted);
  border-top: 1px solid var(--hairline); margin-top: 10px; }
.ape-foot-icon { display: inline-flex; align-items: center; justify-content: center;
  width: 13px; height: 13px; border: 1px solid var(--muted-ink);
  border-radius: 50%; font-size: 9px; color: var(--muted); }

/* Compact density on narrow viewports — keep institutional feel */
@media (max-width: 1280px) {
  .ape-table { font-size: 10.5px; }
  .ape-cell-input { width: 36px; font-size: 10.5px; }
  .ape-table .ape-row .ape-row-lbl { min-width: 180px; font-size: 10.5px; }
}


/* ════════════════════════════════════════════════════════════════════════
   PORTFOLIO · INSTITUTIONAL TECHNICAL SCREENER (v2)
   ────────────────────────────────────────────────────────────────────────
   One cohesive workspace: header → toolbar → chips → screener → analytics
   → alerts/changes. Bloomberg/Refinitiv-class hierarchy on Meridian tokens.
   Custom modals, popovers, skeletons, scrollbars — zero native chrome.   */

/* ── global scrollbars (thin, dark, rounded — everywhere) ─────────────── */
* { scrollbar-width: thin; scrollbar-color: #2c3440 transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: #2c3440; border-radius: 8px;
  border: 2px solid transparent; background-clip: padding-box;
  transition: background 0.25s ease;
}
*::-webkit-scrollbar-thumb:hover { background: #3a4553; background-clip: padding-box; }
*::-webkit-scrollbar-corner { background: transparent; }

/* ── EMPTY STATE ──────────────────────────────────────────────────────── */
.pfe { display: flex; justify-content: center; padding: 72px 24px 96px; animation: pfe-in 0.4s ease; }
/* `hidden` must always win over the class display rules above/below — see the
   pfModalRoot note. This one line prevents the empty-state and workspace from
   ever rendering on top of each other, and future-proofs every toggled panel. */
[hidden] { display: none !important; }
@keyframes pfe-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.pfe-card { max-width: 660px; text-align: center; }
.pfe-eyebrow { font-size: 10px; letter-spacing: 0.22em; color: var(--amber); margin-bottom: 18px; }
.pfe-card h2 { font-family: var(--serif); font-size: 34px; font-weight: 500; color: var(--fg); line-height: 1.2; margin-bottom: 16px; }
.pfe-card p { font-size: 14px; color: var(--muted); line-height: 1.75; max-width: 560px; margin: 0 auto 36px; }
.pfe-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--hairline); border: 1px solid var(--hairline); margin-bottom: 36px; text-align: left; }
.pfe-step { background: var(--ink-2); padding: 18px 16px; display: flex; gap: 12px; align-items: flex-start; }
.pfe-step-n { font-family: var(--mono); font-size: 12px; color: var(--amber); border: 1px solid var(--amber); width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pfe-step-b { display: flex; flex-direction: column; gap: 3px; }
.pfe-step-b strong { font-size: 12.5px; color: var(--fg); font-weight: 600; }
.pfe-step-b span { font-size: 11px; color: var(--muted-ink); line-height: 1.5; }
.pfe-cta {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em;
  background: var(--amber); color: var(--ink); border: 1px solid var(--amber);
  padding: 12px 28px; font-weight: 600; transition: all 0.2s ease;
}
.pfe-cta:hover { background: var(--amber-bright); border-color: var(--amber-bright); transform: translateY(-1px); }

/* ── WORKSPACE shell ──────────────────────────────────────────────────── */
.pfw { animation: pfw-in 0.35s ease; }
@keyframes pfw-in { from { opacity: 0; } to { opacity: 1; } }

/* ── HEADER ──────────────────────────────────────────────────────────── */
.pfh {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 24px; padding: 20px 22px 18px;
  background: linear-gradient(180deg, var(--ink-2), color-mix(in srgb, var(--ink-2) 82%, var(--ink)));
  border: 1px solid var(--hairline); border-bottom: none;
}
.pfh-bread { font-size: 9.5px; letter-spacing: 0.16em; color: var(--muted-ink); margin-bottom: 8px; }
.pfh-bread .pfh-bsep { margin: 0 7px; color: var(--hairline); }
.pfh-bread #pfhBread { color: var(--amber); }
.pfh-titlerow { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.pfh-switcher { position: relative; }
.pfh-switch-btn {
  display: inline-flex; align-items: baseline; gap: 10px;
  background: none; border: none; padding: 0; cursor: pointer;
}
.pfh-title { font-family: var(--serif); font-size: 27px; font-weight: 500; color: var(--fg); line-height: 1.1; }
.pfh-caret { font-size: 12px; color: var(--muted); transition: transform 0.2s ease; }
.pfh-switch-btn:hover .pfh-caret { color: var(--amber); }
.pfh-switch-menu {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 60;
  min-width: 280px; max-height: 340px; overflow-y: auto;
  background: var(--ink-3); border: 1px solid var(--hairline);
  box-shadow: 0 12px 36px rgba(0,0,0,0.5);
  animation: pf-pop 0.16s ease;
}
@keyframes pf-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.pfh-switch-item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  width: 100%; text-align: left; padding: 11px 14px;
  background: none; border: none; border-bottom: 1px solid color-mix(in srgb, var(--hairline) 50%, transparent);
  font-size: 12.5px; color: var(--fg); transition: background 0.14s ease;
}
.pfh-switch-item:hover { background: var(--ink-2); }
.pfh-switch-item.on { background: color-mix(in srgb, var(--amber) 8%, var(--ink-3)); }
.pfh-switch-item.on .pfh-switch-nm { color: var(--amber-bright); }
.pfh-switch-nm { font-weight: 500; }
.pfh-switch-sub { font-size: 10px; color: var(--muted-ink); }
.pfh-switch-sep { height: 1px; background: var(--hairline); }
.pfh-switch-new span { color: var(--amber); font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; }
.pfh-meta { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.pfh-pill {
  display: inline-flex; align-items: baseline; gap: 8px;
  border: 1px solid var(--hairline); padding: 5px 11px;
  background: color-mix(in srgb, var(--ink) 60%, transparent);
}
.pfh-pill-l { font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.14em; color: var(--muted-ink); }
.pfh-pill-v { font-family: var(--mono); font-size: 11.5px; color: var(--fg); }
.pfh-vitals { display: flex; gap: 0; border: 1px solid var(--hairline); width: fit-content; }
.pfh-vital {
  display: flex; flex-direction: column; gap: 3px;
  padding: 8px 16px; border-right: 1px solid var(--hairline);
  background: color-mix(in srgb, var(--ink) 55%, transparent);
}
.pfh-vital:last-child { border-right: none; }
.pfh-vital-l { font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.13em; color: var(--muted-ink); }
.pfh-vital-v { font-family: var(--mono); font-size: 16px; font-weight: 600; color: var(--fg); }
.pfh-vital-sb .pfh-vital-v { color: var(--up); }
.pfh-vital-b  .pfh-vital-v { color: #5fb88a; }
.pfh-vital-w  .pfh-vital-v { color: var(--amber-bright); }
.pfh-vital-av .pfh-vital-v { color: var(--down); }
.pfh-actions { display: flex; gap: 8px; align-items: flex-start; flex-shrink: 0; padding-top: 24px; }
.pfh-btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em;
  background: var(--ink); border: 1px solid var(--hairline); color: var(--fg);
  padding: 8px 14px; transition: all 0.18s ease; white-space: nowrap;
}
.pfh-btn:hover { border-color: var(--amber); color: var(--amber-bright); }
.pfh-btn-i { font-size: 12px; line-height: 1; }
.pfh-btn-icon { padding: 8px 12px; font-size: 14px; }
.pfh-btn-loading .pfh-btn-i { display: inline-block; animation: pf-spin 0.9s linear infinite; }
@keyframes pf-spin { to { transform: rotate(360deg); } }
.pfh-settings-wrap { position: relative; }
.pfh-settings-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 60;
  width: 290px; max-height: 460px; overflow-y: auto;
  background: var(--ink-3); border: 1px solid var(--hairline);
  box-shadow: 0 12px 36px rgba(0,0,0,0.5); animation: pf-pop 0.16s ease;
}
.pfs-menu-group { padding: 12px 14px; border-bottom: 1px solid color-mix(in srgb, var(--hairline) 60%, transparent); }
.pfs-menu-group:last-child { border-bottom: none; }
.pfs-menu-h { font-family: var(--mono); font-size: 9px; letter-spacing: 0.16em; color: var(--muted-ink); margin-bottom: 9px; }
.pfs-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: none; text-align: left;
  font-size: 12px; color: var(--fg); padding: 8px 6px; transition: all 0.14s ease;
}
.pfs-menu-item:hover { background: var(--ink-2); color: var(--amber-bright); }
.pfs-menu-danger:hover { color: var(--down); }
.pfs-menu-i { font-size: 12px; width: 16px; text-align: center; }
.pfs-menu-select {
  width: 100%; background: var(--ink); border: 1px solid var(--hairline); color: var(--fg);
  font-family: var(--mono); font-size: 11px; padding: 7px 9px;
}
.pfs-menu-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; }
.pfs-menu-check {
  display: flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 10.5px; color: var(--muted);
  padding: 4px 2px; cursor: pointer; transition: color 0.12s ease;
}
.pfs-menu-check:hover { color: var(--fg); }
.pfs-menu-check input { accent-color: var(--amber); width: 12px; height: 12px; }

/* ── ADD-COMPANIES popover ───────────────────────────────────────────── */
.pf-addpop {
  position: absolute; right: 22px; margin-top: -6px; z-index: 55;
  width: 320px; background: var(--ink-3); border: 1px solid var(--hairline);
  box-shadow: 0 12px 36px rgba(0,0,0,0.5); padding: 16px;
  animation: pf-pop 0.16s ease;
}
.pfw { position: relative; }
.pf-addpop-h { font-family: var(--serif); font-size: 16px; color: var(--fg); margin-bottom: 4px; }
.pf-addpop-sub { font-size: 10px; color: var(--muted-ink); letter-spacing: 0.08em; margin-bottom: 14px; }
.pf-addpop-label { display: block; font-family: var(--mono); font-size: 9px; letter-spacing: 0.14em; color: var(--muted-ink); margin-bottom: 6px; }
.pf-addpop-select { width: 100%; background: var(--ink); border: 1px solid var(--hairline); color: var(--fg); font-family: var(--mono); font-size: 11px; padding: 8px 10px; margin-bottom: 12px; }
.pf-addpop-row { display: flex; gap: 8px; margin-bottom: 12px; }
.pf-addpop-btn {
  flex: 1; font-family: var(--mono); font-size: 10.5px;
  background: var(--ink); border: 1px solid var(--hairline); color: var(--fg);
  padding: 8px 6px; transition: all 0.16s ease;
}
.pf-addpop-btn:hover:not(:disabled) { border-color: var(--amber); color: var(--amber-bright); }
.pf-addpop-btn:disabled { opacity: 0.4; }
.pf-addpop-hint { font-size: 10px; color: var(--muted-ink); line-height: 1.6; }

/* ── TOOLBAR ─────────────────────────────────────────────────────────── */
.pft {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 12px 22px; background: var(--ink-2);
  border: 1px solid var(--hairline); border-top: 1px solid color-mix(in srgb, var(--hairline) 55%, transparent); border-bottom: none;
  flex-wrap: wrap;
}
.pft-search { position: relative; display: flex; align-items: center; gap: 9px; flex: 0 1 340px; min-width: 240px; border: 1px solid var(--hairline); background: var(--ink); padding: 0 12px; transition: border-color 0.18s ease; }
.pft-search:focus-within { border-color: var(--amber); }
.pft-search-i { color: var(--muted-ink); font-size: 14px; }
.pft-search input {
  flex: 1; background: none; border: none; outline: none; color: var(--fg);
  font-family: var(--mono); font-size: 11.5px; padding: 9px 0;
}
.pft-search input::placeholder { color: var(--muted-ink); }
.pft-search-results { top: calc(100% + 6px); left: 0; right: 0; z-index: 50; }
.pft-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex: 1; justify-content: flex-end; }
.pft-filter-wrap { position: relative; }
.pft-filter-btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em;
  background: var(--ink); border: 1px solid var(--hairline); color: var(--fg);
  padding: 8px 14px; transition: all 0.18s ease;
}
.pft-filter-btn:hover { border-color: var(--amber); color: var(--amber-bright); }
.pft-fi { font-size: 12px; }
.pft-fc { font-size: 9px; color: var(--muted); }
.pft-filter-badge {
  font-size: 9.5px; background: var(--amber); color: var(--ink);
  min-width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; font-weight: 700; padding: 0 4px;
}
.pft-filter-panel {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 58;
  width: 300px; background: var(--ink-3); border: 1px solid var(--hairline);
  box-shadow: 0 12px 36px rgba(0,0,0,0.5); animation: pf-pop 0.16s ease;
  display: flex; flex-direction: column; max-height: 480px;
}
.pft-fp-h {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 15px; border-bottom: 1px solid var(--hairline);
  font-family: var(--serif); font-size: 14.5px; color: var(--fg);
}
.pft-fp-clear { background: none; border: none; font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: 0.06em; transition: color 0.14s ease; }
.pft-fp-clear:hover { color: var(--amber-bright); }
.pft-fp-b { overflow-y: auto; padding: 4px 0; flex: 1; }
.pft-fg { padding: 10px 15px 6px; }
.pft-fg-h { font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.18em; color: var(--amber); margin-bottom: 8px; }
.pft-fg-list { display: flex; flex-direction: column; }
.pft-fg-item {
  display: flex; align-items: center; gap: 9px;
  font-size: 12px; color: var(--muted); padding: 6px 2px;
  cursor: pointer; transition: color 0.12s ease;
}
.pft-fg-item:hover { color: var(--fg); }
.pft-fg-item input { accent-color: var(--amber); width: 13px; height: 13px; }
.pft-fp-f {
  display: flex; gap: 8px; padding: 12px 15px; border-top: 1px solid var(--hairline);
}
.pft-fp-reset {
  flex: 0 0 auto; font-family: var(--mono); font-size: 10.5px;
  background: none; border: 1px solid var(--hairline); color: var(--muted);
  padding: 8px 16px; transition: all 0.16s ease;
}
.pft-fp-reset:hover { color: var(--fg); border-color: var(--muted); }
.pft-fp-apply {
  flex: 1; font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: 0.05em;
  background: var(--amber); border: 1px solid var(--amber); color: var(--ink);
  padding: 8px 16px; transition: all 0.16s ease;
}
.pft-fp-apply:hover { background: var(--amber-bright); }
.pft-active { display: flex; gap: 7px; flex-wrap: wrap; }
.pft-af-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.03em;
  background: color-mix(in srgb, var(--amber) 10%, var(--ink));
  border: 1px solid color-mix(in srgb, var(--amber) 55%, transparent);
  color: var(--amber-bright); padding: 5px 6px 5px 10px;
  animation: pf-chip-in 0.18s ease;
}
@keyframes pf-chip-in { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: none; } }
.pft-af-x {
  background: none; border: none; color: var(--amber); font-size: 12px; line-height: 1;
  padding: 1px 3px; transition: color 0.12s ease;
}
.pft-af-x:hover { color: var(--fg); }
.pft-clear { background: none; border: none; font-family: var(--mono); font-size: 10.5px; color: var(--muted); letter-spacing: 0.05em; text-decoration: underline; text-underline-offset: 3px; transition: color 0.14s ease; }
.pft-clear:hover { color: var(--amber-bright); }

/* ── COMPANY CHIPS ───────────────────────────────────────────────────── */
.pfc {
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
  padding: 10px 22px; background: var(--ink-2);
  border: 1px solid var(--hairline); border-top: none; border-bottom: none;
}
.pfc-empty { font-size: 11px; color: var(--muted-ink); padding: 4px 0; }
.pfc-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.02em;
  background: var(--ink); border: 1px solid color-mix(in srgb, var(--hairline) 80%, transparent);
  color: var(--muted); padding: 4px 5px 4px 9px;
  transition: all 0.16s ease; cursor: default;
}
.pfc-chip:hover { border-color: var(--amber); color: var(--fg); }
.pfc-chip-sym { color: var(--amber-bright); font-weight: 500; }
.pfc-chip-x {
  background: none; border: none; color: var(--muted-ink); font-size: 12px; line-height: 1;
  padding: 0 2px; transition: color 0.12s ease;
}
.pfc-chip-x:hover { color: var(--down); }
.pfc-more {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.04em;
  background: none; border: 1px dashed var(--hairline); color: var(--muted);
  padding: 4px 12px; transition: all 0.16s ease;
}
.pfc-more:hover { color: var(--amber-bright); border-color: var(--amber); }

/* modal list of all companies */
.pfc-modal-list { display: flex; flex-direction: column; max-height: 420px; overflow-y: auto; }
.pfc-modal-row {
  display: grid; grid-template-columns: 110px 1fr 46px 90px 70px; gap: 12px; align-items: center;
  padding: 9px 4px; border-bottom: 1px solid color-mix(in srgb, var(--hairline) 50%, transparent);
  font-size: 12px;
}
.pfc-modal-sym { font-family: var(--mono); font-size: 11px; color: var(--amber-bright); font-weight: 600; }
.pfc-modal-nm { color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pfc-modal-sec { display: block; font-family: var(--mono); font-size: 9.5px; color: var(--muted-ink); margin-top: 1px; }
.pfc-modal-sc { text-align: right; color: var(--fg); font-weight: 600; }
.pfc-modal-sig { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.pfc-modal-rm {
  font-family: var(--mono); font-size: 9.5px; background: none;
  border: 1px solid var(--hairline); color: var(--muted); padding: 4px 8px; transition: all 0.14s ease;
}
.pfc-modal-rm:hover { color: var(--down); border-color: var(--down); }

/* ── SCREENER ────────────────────────────────────────────────────────── */
.pfs { border: 1px solid var(--hairline); border-bottom: none; background: var(--ink-2); }
.pfs-wrap { overflow: auto; max-height: 620px; scroll-behavior: smooth; }
.pfs-table { border-collapse: separate; border-spacing: 0; font-size: 11.5px; width: max-content; min-width: 100%; }
.pfs-table thead th {
  position: sticky; top: 0; z-index: 4;
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.13em;
  color: var(--muted); text-align: right; padding: 11px 14px; white-space: nowrap;
  background: var(--ink-3); border-bottom: 1px solid var(--hairline);
  cursor: pointer; user-select: none; transition: color 0.14s ease;
}
.pfs-table thead th:hover { color: var(--amber-bright); }
.pfs-table thead th.pfs-sticky {
  position: sticky; left: 0; z-index: 6; text-align: left;
  background: var(--ink-3); border-right: 1px solid var(--hairline); min-width: 210px;
}
.pfs-table td {
  font-family: var(--mono); text-align: right; padding: 10px 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--hairline) 40%, transparent);
  white-space: nowrap; background: var(--ink-2); transition: background 0.14s ease;
}
.pfs-table tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--ink) 32%, var(--ink-2)); }
.pfs-table tbody tr:hover td { background: var(--ink-3); }
.pfs-table td.pfs-sticky {
  position: sticky; left: 0; z-index: 2; text-align: left;
  border-right: 1px solid var(--hairline); background: var(--ink-2);
}
.pfs-table tbody tr:nth-child(even) td.pfs-sticky { background: color-mix(in srgb, var(--ink) 32%, var(--ink-2)); }
.pfs-table tbody tr:hover td.pfs-sticky { background: var(--ink-3); }
.pfs-name { min-width: 210px; max-width: 250px; }
.pfs-name-b { display: flex; flex-direction: column; gap: 2px; }
.pfs-name-a { display: flex; flex-direction: column; gap: 1px; text-decoration: none; }
.pfs-name-sym { font-family: var(--mono); font-size: 11.5px; font-weight: 600; color: var(--amber-bright); letter-spacing: 0.02em; }
.pfs-name-a:hover .pfs-name-sym { text-decoration: underline; text-underline-offset: 2px; }
.pfs-name-nm { font-size: 10.5px; color: var(--fg); font-family: var(--sans); max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pfs-name-sec { font-size: 9px; color: var(--muted-ink); letter-spacing: 0.06em; }
.pfs-dim { color: var(--muted-ink); }
.pfs-srpair { font-size: 11px; }
.pfs-empty-row { padding: 40px 20px !important; text-align: center !important; color: var(--muted-ink); font-size: 12px; }
.pfs-err-cell { color: var(--down); text-align: left !important; }
.pfs-row-err td { background: color-mix(in srgb, var(--down) 4%, var(--ink-2)) !important; }
.pfs-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 16px; border-top: 1px solid var(--hairline);
  background: var(--ink-3);
}
.pfs-count, .pfs-status { font-size: 10px; color: var(--muted-ink); letter-spacing: 0.06em; }

/* skeleton rows */
.pfs-sk { display: inline-block; height: 11px; width: 70%; min-width: 34px; border-radius: 2px;
  background: linear-gradient(90deg, var(--ink-3) 25%, #222933 45%, var(--ink-3) 65%);
  background-size: 200% 100%; animation: pfs-shimmer 1.4s ease infinite; }
@keyframes pfs-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.pfs-sk-row td { padding: 13px 14px; }

/* signal-change flash */
@keyframes pfs-flash-kf { 0% { background-color: color-mix(in srgb, var(--amber) 20%, var(--ink-2)); } 100% { background-color: transparent; } }
.pfs-flash td { animation: pfs-flash-kf 1.8s ease-out 1; }

/* indicator badges — refined tinted pills (soft fill, hairline tint border, rounded) */
.tbadge {
  display: inline-flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 10.5px;
  font-weight: 500; letter-spacing: 0.01em; padding: 2.5px 7px; border: 1px solid transparent; border-radius: 4px;
  white-space: nowrap; line-height: 1.35;
}
.tb-good    { color: #4ecb8d; background: color-mix(in srgb, var(--up) 13%, transparent);    border-color: color-mix(in srgb, var(--up) 22%, transparent); }
.tb-neutral { color: var(--amber-bright); background: color-mix(in srgb, var(--amber) 12%, transparent); border-color: color-mix(in srgb, var(--amber) 24%, transparent); }
.tb-bad     { color: #e07d6f; background: color-mix(in srgb, var(--down) 13%, transparent);  border-color: color-mix(in srgb, var(--down) 23%, transparent); }

/* signal badges — outline/tint style (not solid fills), graded by conviction */
.sigbadge {
  display: inline-flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 10px;
  font-weight: 600; letter-spacing: 0.06em; padding: 3.5px 11px; border: 1px solid; border-radius: 4px;
  min-width: 74px; white-space: nowrap; line-height: 1.3;
}
.sig-sbuy  { color: #5fe0a6; background: color-mix(in srgb, var(--up) 17%, transparent);   border-color: color-mix(in srgb, var(--up) 46%, transparent); }
.sig-buy   { color: #4ecb8d; background: color-mix(in srgb, var(--up) 11%, transparent);   border-color: color-mix(in srgb, var(--up) 32%, transparent); }
.sig-acc   { color: var(--amber-bright); background: color-mix(in srgb, var(--amber) 11%, transparent); border-color: color-mix(in srgb, var(--amber) 34%, transparent); }
.sig-watch { color: var(--amber-bright); background: transparent; border-color: color-mix(in srgb, var(--amber) 44%, transparent); }
.sig-hold  { color: var(--muted); background: color-mix(in srgb, var(--muted) 7%, transparent); border-color: var(--hairline); }
.sig-avoid { color: #e58275; background: color-mix(in srgb, var(--down) 13%, transparent); border-color: color-mix(in srgb, var(--down) 40%, transparent); }

/* colored plain-text cells (directional metrics — no box, matches reference) */
.pfs-amber { color: var(--amber-bright); }
.pfs-pos { color: #4ecb8d; }
.pfs-neg { color: #e07d6f; }

.pfs-score { display: inline-flex; align-items: center; gap: 8px; }
.pfs-score-bar { position: relative; width: 58px; height: 7px; background: var(--ink); border: 1px solid var(--hairline); }
.pfs-score-bar i { position: absolute; inset: 0 auto 0 0; background: var(--amber); transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1); }
.pfs-score-num { font-family: var(--mono); font-size: 11.5px; font-weight: 600; color: var(--fg); min-width: 22px; text-align: right; }

/* ── company logo (monogram) in the name cell ── */
.pfs-name .pfs-name-b { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 9px; row-gap: 0; }
.pfs-logo { grid-row: 1 / span 2; width: 26px; height: 26px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-family: var(--sans); font-weight: 700; font-size: 12px; color: #fff; flex-shrink: 0; text-shadow: 0 1px 2px rgba(0, 0, 0, .45); }
.pfs-name .pfs-name-a { grid-column: 2; }
.pfs-name .pfs-name-sec { grid-column: 2; }

/* ── header: refresh on the Updated pill ── */
.pfh-pill-ref { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 12px; padding: 0 0 0 6px; line-height: 1; }
.pfh-pill-ref:hover { color: var(--amber-bright); }

/* ══ STATS STRIP ══ */
.pfstat { display: grid; grid-template-columns: 1.5fr 1.5fr repeat(5, 0.82fr) 1.7fr; border: 1px solid var(--hairline); background: var(--ink-2); margin: 0 0 14px; }
.pfstat-cell { padding: 13px 16px; border-right: 1px solid var(--hairline); display: flex; flex-direction: column; justify-content: center; gap: 7px; min-width: 0; }
.pfstat-cell:last-child { border-right: 0; }
.pfstat-k { font-family: var(--sans); font-size: 11px; color: var(--muted); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pfstat-metricrow { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pfstat-big { font-family: var(--serif); font-size: 29px; font-weight: 700; line-height: 1; letter-spacing: -0.02em; white-space: nowrap; }
.pfstat-unit { font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--muted-ink); margin-left: 1px; }
.pfstat-spark { width: 108px; height: 32px; flex-shrink: 0; }
.pfstat-sparksvg { width: 100%; height: 100%; display: block; }
.pfstat-band { font-family: var(--sans); font-size: 12px; font-weight: 600; }
.pfstat-cval { font-family: var(--serif); font-size: 26px; font-weight: 700; line-height: 1; color: var(--fg); }
.pfstat-cpct { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.pfstat-count .pfstat-cval.pfstat-pos, .pfstat-count .pfstat-cpct.pfstat-pos { color: #3fbf7f; }
.pfstat-count .pfstat-cval.pfstat-neg, .pfstat-count .pfstat-cpct.pfstat-neg { color: #d15b4a; }
.pfstat-count .pfstat-cval.pfstat-amber, .pfstat-count .pfstat-cpct.pfstat-amber { color: var(--amber-bright); }
.pfstat-count .pfstat-cval.pfstat-blue { color: #5b8fd6; }
.pfstat-pos { color: #3fbf7f; } .pfstat-neg { color: #d15b4a; } .pfstat-amber { color: var(--amber-bright); }
.pfstat-dash { color: var(--muted-ink); }
.pfstat-bbbar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--ink-3); }
.pfstat-bbbar > span { height: 100%; }
.pfstat-bblabels { display: flex; justify-content: space-between; }
.pfstat-bbl { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.pfstat-bbl b { font-family: var(--mono); font-size: 14px; font-weight: 600; color: var(--fg); }
.pfstat-bbl span { font-family: var(--sans); font-size: 10px; color: var(--muted-ink); }
.pfstat-bb-empty { color: var(--muted-ink); font-size: 12px; }

/* ══ PORTFOLIO INSIGHTS ══ */
.pfi { border: 1px solid var(--hairline); background: var(--ink-2); margin-top: 16px; }
.pfi-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--hairline); }
.pfi-title { font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; color: var(--fg); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.pfi-title-ic { color: var(--amber-bright); }
.pfi-collapse { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 15px; padding: 2px 6px; line-height: 1; }
.pfi-collapse:hover { color: var(--fg); }
.pfi-body { padding: 18px 18px 16px; }
.pfi-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.pfi-card { padding: 0 22px; border-right: 1px solid var(--hairline); min-width: 0; }
.pfi-card:first-child { padding-left: 0; }
.pfi-card:last-child { border-right: 0; padding-right: 0; }
.pfi-card-h { font-family: var(--sans); font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 18px; }
.pfi-card-hsub { color: var(--muted-ink); font-size: 11px; font-weight: 400; }
.pfi-card-b { min-height: 150px; }
.pfi-empty { padding: 18px 4px; color: var(--muted-ink); font-size: 11.5px; line-height: 1.5; }

/* score distribution bars */
.pfi-bars { display: flex; align-items: flex-end; gap: 12px; }
.pfi-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; }
.pfi-bar-track { width: 100%; height: 132px; display: flex; align-items: flex-end; justify-content: center; }
.pfi-bar-fill { width: 100%; max-width: 46px; border-radius: 3px 3px 0 0; position: relative; min-height: 2px; transition: height .55s cubic-bezier(.22, 1, .36, 1); }
.pfi-bar-v { position: absolute; top: -18px; left: 0; right: 0; text-align: center; font-size: 12px; font-weight: 600; color: var(--fg); }
.pfi-bar-l { margin-top: 9px; font-size: 10px; color: var(--muted-ink); }

/* composition log */
.pfi-log { display: flex; flex-direction: column; }
.pfi-log-row { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 6.5px 0; }
.pfi-log-time { color: var(--muted-ink); font-size: 11px; white-space: nowrap; }
.pfi-log-badge { font-family: var(--mono); font-size: 8.5px; font-weight: 600; letter-spacing: 0.04em; padding: 2.5px 6px; border-radius: 3px; border: 1px solid; white-space: nowrap; }
.pfi-log-amber { color: var(--amber-bright); border-color: color-mix(in srgb, var(--amber) 40%, transparent); }
.pfi-log-up { color: #4ecb8d; border-color: color-mix(in srgb, var(--up) 38%, transparent); }
.pfi-log-down { color: #e07d6f; border-color: color-mix(in srgb, var(--down) 40%, transparent); }
.pfi-log-muted { color: var(--muted); border-color: var(--hairline); }
.pfi-log-primary { color: var(--fg); font-family: var(--sans); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pfi-log-secondary { color: var(--muted-ink); font-family: var(--sans); font-size: 11px; text-align: right; white-space: nowrap; }
.pfi-log-more { display: block; margin: 12px 0 0 auto; background: none; border: 0; color: #5b8fd6; font-family: var(--sans); font-size: 12px; cursor: pointer; }
.pfi-log-more:hover { text-decoration: underline; }

/* active technical alerts */
.pfi-alerts { border-top: 1px solid var(--hairline); margin-top: 22px; padding-top: 18px; position: relative; }
.pfi-alerts-h { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; color: var(--muted); font-weight: 600; margin-bottom: 16px; }
.pfi-alerts-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 26px; }
.pfi-alert { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pfi-alert-ic { width: 38px; height: 38px; border-radius: 50%; border: 1px solid; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.pfi-alert-tx { min-width: 0; flex: 1; }
.pfi-alert-t { font-family: var(--sans); font-size: 13px; font-weight: 600; color: var(--fg); }
.pfi-alert-s { font-family: var(--sans); font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pfi-alert-spark { width: 88px; height: 30px; flex-shrink: 0; }
.pfi-alerts-all { position: absolute; top: 14px; right: 0; background: none; border: 0; color: #5b8fd6; font-family: var(--sans); font-size: 12px; cursor: pointer; }
.pfi-alerts-all:hover { text-decoration: underline; }
.pfi-alerts-detail { margin-top: 14px; border-top: 1px solid var(--hairline); padding-top: 12px; }

.pfi-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--hairline); margin-top: 18px; padding-top: 12px; flex-wrap: wrap; }
.pfi-foot-note { font-family: var(--sans); font-size: 11px; color: var(--muted-ink); }
.pfi-foot-time { font-family: var(--mono); font-size: 11px; color: var(--muted-ink); }

@media (max-width: 1160px) {
  .pfstat { grid-template-columns: repeat(4, 1fr); }
  .pfstat-cell { border-bottom: 1px solid var(--hairline); }
  .pfstat-cell:nth-child(4n) { border-right: 0; }
  .pfi-grid { grid-template-columns: repeat(2, 1fr); row-gap: 20px; }
  .pfi-card { border-bottom: 0; }
  .pfi-card:nth-child(2) { border-right: 0; padding-right: 0; }
  .pfi-card:nth-child(3) { padding-left: 0; }
  .pfi-alerts-row { grid-template-columns: repeat(2, 1fr); gap: 18px 26px; }
}
@media (max-width: 640px) {
  .pfstat { grid-template-columns: repeat(2, 1fr); }
  .pfstat-cell:nth-child(2n) { border-right: 0; }
  .pfstat-spark { display: none; }
  .pfstat-big { font-size: 26px; }
  .pfi-grid, .pfi-alerts-row { grid-template-columns: 1fr; }
  .pfi-card { border-right: 0; padding: 0 0 16px !important; border-bottom: 1px solid var(--hairline); margin-bottom: 4px; }
  .pfi-alerts-all { position: static; display: block; margin: 14px 0 0 auto; }
}

/* ── ANALYTICS DASHBOARD ─────────────────────────────────────────────── */
.pfa { border: 1px solid var(--hairline); border-bottom: none; background: var(--ink-2); }
.pfa-row { display: grid; gap: 1px; background: var(--hairline); }
.pfa-top { grid-template-columns: 2.55fr 1fr; }
.pfa-mid { grid-template-columns: 1.1fr 1fr 1fr; border-top: 1px solid var(--hairline); }
.pfa-tile { background: var(--ink-2); padding: 16px 18px; min-height: 132px; }
.pfa-tile-l { font-family: var(--mono); font-size: 9px; letter-spacing: 0.15em; color: var(--muted-ink); margin-bottom: 10px; }
.pfa-tile-v { font-family: var(--mono); font-size: 34px; font-weight: 600; color: var(--fg); line-height: 1; }
.pfa-tile-sub { font-size: 9.5px; color: var(--muted-ink); letter-spacing: 0.09em; margin-top: 8px; }
.pfa-card { background: var(--ink-2); padding: 16px 18px; }
.pfa-card-h { font-family: var(--mono); font-size: 9px; letter-spacing: 0.15em; color: var(--muted-ink); margin-bottom: 14px; }
.pfa-card-body { min-height: 170px; }

/* mini gauge */
.pfa-gauge-wrap { display: flex; flex-direction: column; align-items: center; }
.pfa-gauge { width: 100%; max-width: 190px; height: auto; }
.pfa-gauge-meta { display: flex; align-items: baseline; gap: 10px; margin-top: -30px; }
.pfa-gauge-num { font-family: var(--mono); font-size: 30px; font-weight: 600; line-height: 1; }
.pfa-gauge-lbl { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.16em; }
.pfa-gauge-empty, .pfa-donut-empty { padding: 32px 12px; text-align: center; color: var(--muted-ink); font-size: 10.5px; }

/* mini donut (bullish vs bearish tile) */
.pfa-mini-donut-wrap { display: flex; align-items: center; gap: 16px; }
.pfa-mini-donut-svg { width: 86px; height: 86px; flex-shrink: 0; }
.pfa-mini-donut-leg { display: flex; flex-direction: column; gap: 4px; }
.pfa-mini-leg { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); }
.pfa-mini-leg .mono { color: var(--fg); margin-left: auto; }
.pfa-mini-sw { width: 9px; height: 9px; flex-shrink: 0; }

/* large donuts */
.pfa-donut { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.pfa-donut-svg { width: 150px; height: 150px; flex-shrink: 0; }
.pfa-donut-leg { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 130px; }
.pfa-leg { display: grid; grid-template-columns: 12px 1fr auto; gap: 8px; align-items: center; font-size: 11px; }
.pfa-leg-sw { width: 10px; height: 10px; }
.pfa-leg-l { color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pfa-leg-v { color: var(--muted-ink); font-size: 10px; }

/* histogram */
.pfa-hist { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; align-items: end; padding-top: 4px; }
.pfa-hist-col { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.pfa-hist-bar { width: 100%; height: 110px; background: var(--ink); border: 1px solid color-mix(in srgb, var(--hairline) 70%, transparent); display: flex; align-items: flex-end; }
.pfa-hist-bar i { display: block; width: 100%; transition: height 0.6s cubic-bezier(0.22, 1, 0.36, 1); }
.pfa-hist-v { font-size: 12px; color: var(--fg); font-weight: 600; }
.pfa-hist-l { font-size: 8.5px; color: var(--muted-ink); letter-spacing: 0.06em; }

/* ── ALERTS + CHANGES ───────────────────────────────────────────────── */
.pfx { display: grid; grid-template-columns: 1.5fr 1fr; gap: 1px; background: var(--hairline); border: 1px solid var(--hairline); }
.pfx-col { background: var(--ink-2); display: flex; flex-direction: column; }
.pfx-h {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 13px 18px 11px; border-bottom: 1px solid var(--hairline);
}
.pfx-h h3 { font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; color: var(--fg); font-weight: 600; }
.pfx-sub { font-size: 9px; color: var(--muted-ink); letter-spacing: 0.09em; }
.pfx-body { flex: 1; }
.pfx-empty { padding: 26px 18px; color: var(--muted-ink); font-size: 10.5px; line-height: 1.7; }
.pfx-list { display: flex; flex-direction: column; max-height: 320px; overflow-y: auto; }
.pfx-row {
  display: grid; grid-template-columns: 66px 78px 88px 1fr; gap: 12px; align-items: center;
  padding: 8px 18px; border-bottom: 1px solid color-mix(in srgb, var(--hairline) 45%, transparent);
  font-size: 11px; transition: background 0.14s ease;
}
.pfx-row:hover { background: var(--ink-3); }
.pfx-time { font-size: 9.5px; color: var(--muted-ink); }
.pfx-kind { font-family: var(--mono); font-size: 8px; letter-spacing: 0.13em; padding: 3px 6px; border: 1px solid var(--hairline); text-align: center; color: var(--muted); }
.pfx-row-signal .pfx-kind, .pfx-row-momentum .pfx-kind, .pfx-row-volume .pfx-kind { color: var(--amber-bright); border-color: color-mix(in srgb, var(--amber) 55%, transparent); }
.pfx-row-trend .pfx-kind, .pfx-row-breakout .pfx-kind, .pfx-row-price .pfx-kind { color: var(--up); border-color: color-mix(in srgb, var(--up) 50%, transparent); }
.pfx-chg-up .pfx-kind { color: var(--up); border-color: color-mix(in srgb, var(--up) 50%, transparent); }
.pfx-chg-down .pfx-kind { color: var(--down); border-color: color-mix(in srgb, var(--down) 50%, transparent); }
.pfx-chg-amber .pfx-kind { color: var(--amber-bright); border-color: color-mix(in srgb, var(--amber) 55%, transparent); }
.pfx-sym { color: var(--amber-bright); font-weight: 600; font-size: 10.5px; }
.pfx-txt { color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── MODALS ─────────────────────────────────────────────────────────── */
/* The global `[hidden]{display:none!important}` rule keeps this full-screen
   fixed z-index:400 layer hidden when idle (otherwise it silently swallows
   every click over the portfolio tab). pointer-events is a second belt. */
.pfm-root { position: fixed; inset: 0; z-index: 400; display: flex; align-items: center; justify-content: center; }
.pfm-root:not(.pfm-open) { pointer-events: none; }
.pfm-root.pfm-open { pointer-events: auto; }
.pfm-overlay { position: absolute; inset: 0; background: rgba(4, 6, 9, 0.72); backdrop-filter: blur(2px); opacity: 0; transition: opacity 0.16s ease; }
.pfm-root.pfm-open .pfm-overlay { opacity: 1; }
.pfm-dialog {
  position: relative; z-index: 1; width: min(440px, calc(100vw - 40px));
  background: var(--ink-2); border: 1px solid var(--hairline);
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
  opacity: 0; transform: translateY(10px) scale(0.98);
  transition: all 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}
.pfm-size-l { width: min(640px, calc(100vw - 40px)); }
.pfm-root.pfm-open .pfm-dialog { opacity: 1; transform: none; }
.pfm-danger { border-color: color-mix(in srgb, var(--down) 40%, var(--hairline)); }
.pfm-h {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px 14px; border-bottom: 1px solid var(--hairline);
}
.pfm-h h4 { font-family: var(--serif); font-size: 17px; font-weight: 500; color: var(--fg); }
.pfm-x { background: none; border: none; color: var(--muted); font-size: 20px; line-height: 1; padding: 2px 6px; transition: color 0.14s ease; }
.pfm-x:hover { color: var(--fg); }
.pfm-b { padding: 18px 20px; }
.pfm-body-text { font-size: 13px; color: var(--muted); line-height: 1.7; }
.pfm-label { display: block; font-family: var(--mono); font-size: 9px; letter-spacing: 0.15em; color: var(--muted-ink); margin-bottom: 7px; }
.pfm-input {
  width: 100%; background: var(--ink); border: 1px solid var(--hairline); color: var(--fg);
  font-family: var(--mono); font-size: 13px; padding: 10px 12px; transition: border-color 0.16s ease;
}
.pfm-input:focus { border-color: var(--amber); outline: none; }
.pfm-error { font-size: 11px; color: var(--down); margin-top: 8px; font-family: var(--mono); }
.pfm-f { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 20px 16px; border-top: 1px solid var(--hairline); }
.pfm-btn {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.05em;
  background: none; border: 1px solid var(--hairline); color: var(--muted);
  padding: 9px 18px; transition: all 0.16s ease;
}
.pfm-btn:hover { color: var(--fg); border-color: var(--muted); }
.pfm-btn-primary { background: var(--amber); border-color: var(--amber); color: var(--ink); font-weight: 600; }
.pfm-btn-primary:hover { background: var(--amber-bright); border-color: var(--amber-bright); color: var(--ink); }
.pfm-btn-danger { background: var(--down); border-color: var(--down); color: #fff; font-weight: 600; }
.pfm-btn-danger:hover { background: #d6604f; border-color: #d6604f; color: #fff; }

/* toast */
.pf-toast {
  position: fixed; bottom: 26px; left: 50%; transform: translate(-50%, 12px); z-index: 500;
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.03em;
  background: var(--ink-3); border: 1px solid var(--hairline); color: var(--fg);
  padding: 10px 20px; box-shadow: 0 12px 32px rgba(0,0,0,0.5);
  opacity: 0; transition: all 0.22s cubic-bezier(0.22, 1, 0.36, 1); pointer-events: none;
}
.pf-toast-in { opacity: 1; transform: translate(-50%, 0); }
.pf-toast-success { border-color: color-mix(in srgb, var(--up) 50%, transparent); color: var(--up); }
.pf-toast-info { border-color: color-mix(in srgb, var(--amber) 50%, transparent); color: var(--amber-bright); }

/* ── mobile adjustments (scoped; desktop untouched) ─────────────────── */
@media (max-width: 768px) {
  .pfe { padding: 40px 16px 60px; }
  .pfe-card h2 { font-size: 24px; }
  .pfe-steps { grid-template-columns: 1fr 1fr; }
  .pfh { flex-direction: column; padding: 16px; gap: 14px; }
  .pfh-actions { padding-top: 0; width: 100%; flex-wrap: wrap; }
  .pfh-btn { flex: 1; justify-content: center; }
  .pfh-vitals { width: 100%; overflow-x: auto; }
  .pfh-vital { padding: 7px 12px; }
  .pfh-title { font-size: 22px; }
  .pft { padding: 10px 14px; }
  .pft-search { flex: 1 1 100%; }
  .pft-right { justify-content: flex-start; }
  .pft-filter-panel { right: auto; left: 0; width: min(300px, calc(100vw - 40px)); }
  .pfc { padding: 8px 14px; }
  .pf-addpop { right: 14px; left: 14px; width: auto; }
  .pfa-top { grid-template-columns: 1fr; }
  .pfa-mid { grid-template-columns: 1fr; }
  .pfx { grid-template-columns: 1fr; }
  .pfx-row { grid-template-columns: 58px 66px 70px 1fr; gap: 8px; padding: 8px 12px; font-size: 10.5px; }
  .pfs-wrap { max-height: 520px; }
  .pfs-table thead th.pfs-sticky { min-width: 150px; }
  .pfs-name { min-width: 150px; max-width: 170px; }
  .pfc-modal-row { grid-template-columns: 84px 1fr 60px; }
  .pfc-modal-sc, .pfc-modal-sig { display: none; }
}

/* ════════ EQUITY RESEARCH — v43 workstation enhancements ════════
   Statement tabs reuse .iffm-tab/.iffm-pane (Modeling Lab parity).
   Everything below derives from the existing token set only. */

/* statement tables with YoY + variance commentary columns */
.ers-t td.ers-note, .ers-t th.ers-note-h { text-align: left; font-family: var(--sans); font-size: 11px; color: var(--muted); line-height: 1.45; white-space: normal; min-width: 230px; max-width: 340px; }
.ers-t th.ers-note-h { font-family: var(--mono); }
.ers-t td.ers-yoy { font-weight: 600; }
.ers-t tr.ers-strong td { color: var(--fg); font-weight: 600; }
.ers-t tr.ers-strong td.ers-note { color: var(--muted); font-weight: 400; }
.ers-t tr.ers-sec td { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.14em; color: var(--amber); background: var(--ink-3); padding: 7px 12px; text-align: left; border-bottom: 1px solid var(--hairline); }
.ers-t tr.ers-sec:hover td { background: var(--ink-3); }

/* year-wise KPI strip under each statement */
.ers-kpi { margin-top: 10px; border-top: 1px solid var(--hairline); }
.ers-kpi-t td, .ers-kpi-t th { padding: 6px 12px; }
.ers-kpi-t td.nm { color: var(--muted); font-size: 11.5px; }

/* expandable prose — full business description, never truncated */
.ers-xp .xp-full p { margin: 0 0 10px; }
.ers-xp .xp-full p:last-child { margin-bottom: 0; }
.xp-toggle { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; color: var(--amber-bright); border: none; background: none; padding: 0; cursor: pointer; }
.xp-toggle:hover { color: var(--amber); text-decoration: underline; }

/* investment highlights / growth drivers bullets */
.ih-list { list-style: none; padding: 14px 18px; margin: 0; }
.ih-list li { position: relative; padding: 6px 0 6px 20px; font-size: 12.5px; line-height: 1.6; color: var(--muted); border-bottom: 1px solid color-mix(in srgb, var(--hairline) 45%, transparent); }
.ih-list li:last-child { border-bottom: none; }
.ih-list li::before { content: "▸"; position: absolute; left: 2px; color: var(--amber); font-size: 11px; }
.ih-list li b { color: var(--fg); font-weight: 600; }

/* key risks — four-quadrant institutional grid */
.risk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1px; background: var(--hairline); }
.risk-cell { background: var(--ink-2); padding: 12px 16px; }
.risk-h { font-size: 9.5px; letter-spacing: 0.14em; color: var(--amber); margin-bottom: 8px; }
.risk-b p { font-size: 11.5px; line-height: 1.6; color: var(--muted); margin: 0 0 7px; }
.risk-b p:last-child { margin-bottom: 0; }

/* peer group customisation — minimal search + chips */
.peer-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--hairline); }
.peer-search { position: relative; display: flex; align-items: center; gap: 7px; min-width: 250px; flex: 0 1 300px; border: 1px solid var(--hairline); background: var(--ink); padding: 6px 10px; }
.peer-search:focus-within { border-color: var(--amber); }
.peer-search-i { color: var(--muted-ink); font-size: 12px; }
.peer-search input { flex: 1; background: none; border: none; outline: none; color: var(--fg); font-family: var(--mono); font-size: 11.5px; }
.peer-search input::placeholder { color: var(--muted-ink); }
.peer-search .cmd-results { top: calc(100% + 4px); }
.peer-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.peer-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; letter-spacing: 0.04em; color: var(--amber-bright); border: 1px solid var(--hairline); padding: 4px 6px 4px 10px; background: var(--ink-2); }
.peer-x { color: var(--muted-ink); font-size: 13px; line-height: 1; padding: 0 3px; }
.peer-x:hover { color: var(--down); }
.peer-count { font-size: 10px; color: var(--muted-ink); letter-spacing: 0.08em; margin-left: 2px; }

/* historical-performance sparklines reuse .ratio-card canvas sizing */
.ratio-card .hp-spark { width: 100%; height: 26px; margin-top: 6px; }


/* ── v43: composite Health/Score/Breakouts tile + index line ─────────── */
.pfa-tile-composite { min-height: 152px; }
.pfa-composite { display: grid; grid-template-columns: 190px 210px 1fr; gap: 20px; align-items: center; }
.pfa-comp-gauge .pfa-gauge-wrap { align-items: center; }
.pfa-comp-stats { display: flex; flex-direction: column; gap: 16px; border-left: 1px solid var(--hairline); padding-left: 20px; }
.pfa-comp-stat { display: flex; flex-direction: column; gap: 4px; }
.pfa-comp-k { font-size: 8.5px; letter-spacing: 0.16em; color: var(--muted-ink); }
.pfa-comp-v { font-size: 27px; font-weight: 600; color: var(--fg); line-height: 1; }
.pfa-comp-s { font-size: 9px; letter-spacing: 0.09em; color: var(--muted-ink); }
.pfa-comp-chart { border-left: 1px solid var(--hairline); padding-left: 20px; min-width: 0; }
.pfa-line { display: block; width: 100%; height: 96px; }
.pfa-line-head, .pfa-line-foot { display: flex; justify-content: space-between; font-size: 8.5px; letter-spacing: 0.14em; color: var(--muted-ink); }
.pfa-line-head { margin-bottom: 6px; }
.pfa-line-foot { margin-top: 6px; }
.pfa-line-empty { padding: 34px 10px; text-align: center; color: var(--muted-ink); font-size: 10px; letter-spacing: 0.08em; }
@media (max-width: 1180px) {
  .pfa-composite { grid-template-columns: 170px 1fr; }
  .pfa-comp-chart { grid-column: 1 / -1; border-left: none; border-top: 1px solid var(--hairline); padding: 14px 0 0; }
}
@media (max-width: 640px) {
  .pfa-composite { grid-template-columns: 1fr; }
  .pfa-comp-stats { border-left: none; padding-left: 0; flex-direction: row; gap: 26px; }
}

/* ══ ANDROID / MOBILE OPTIMIZATION — portfolio ══════════════════════════
   Applies below 720px, with a tighter phone breakpoint at 480px. */
@media (max-width: 720px) {
  #tab-portfolio { padding: 8px; }
  #pfWorkspace { padding: 0; }

  /* header stack */
  .pfh { flex-direction: column; align-items: flex-start; gap: 10px; padding: 10px 0; }
  .pfh-l { flex-wrap: wrap; }
  .pfh-r { width: 100%; justify-content: flex-start; flex-wrap: wrap; gap: 6px; }
  .pfh-r button { flex: 1; min-width: calc(50% - 3px); }
  .pfh-meta { flex-wrap: wrap; gap: 6px 10px; }
  .pfh-pill { font-size: 10px; padding: 3px 7px; }
  .pfh-title { font-size: 17px; }

  /* stats strip → 2×4 grid on tablet, 2 cols on phone */
  .pfstat { grid-template-columns: repeat(2, 1fr); }
  .pfstat-cell { padding: 10px 11px; border-bottom: 1px solid var(--hairline); }
  .pfstat-cell:nth-child(2n) { border-right: 0; }
  .pfstat-cell:nth-last-child(-n+2) { border-bottom: 0; }
  .pfstat-big { font-size: 22px; }
  .pfstat-cval { font-size: 20px; }
  .pfstat-spark { width: 82px; height: 26px; }
  .pfstat-k { font-size: 10px; }

  /* insights cards → 2 up, then 1 up */
  .pfi-grid { grid-template-columns: repeat(2, 1fr); }
  .pfi-card { padding: 12px 12px; border-right: 0; border-bottom: 1px solid var(--hairline); }
  .pfi-card:nth-child(2n) { border-right: 0; }
  .pfi-card:last-child, .pfi-card:nth-last-child(2) { border-bottom: 0; }
  .pfi-body { padding: 12px; }
  .pfi-card-h { font-size: 12px; margin-bottom: 12px; }
  .pfi-bars { gap: 6px; }
  .pfi-bar-track { height: 108px; }
  .pfi-bar-l { font-size: 9px; }

  /* alert cards */
  .pfi-alerts-row { grid-template-columns: 1fr; gap: 12px; }
  .pfi-alerts-all { position: static; margin-top: 12px; }

  /* composition log — collapse secondary onto its own line */
  .pfi-log-row { grid-template-columns: auto auto 1fr; gap: 8px; }
  .pfi-log-secondary { grid-column: 1 / -1; text-align: left; padding-left: 4px; }

  /* toolbar → wrap */
  .pf-tb { flex-wrap: wrap; gap: 8px; padding: 8px; }
  .pf-tb-l, .pf-tb-r { width: 100%; }
  .pf-tb-r { justify-content: flex-start; }
  .pf-tb input[type="search"] { flex: 1; min-width: 0; }
  .pf-tb select, .pf-tb .mini-btn { font-size: 11px; }

  /* screener table — horizontal scroll with sticky first col */
  #pfScreenerWrap, .pfs-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .pfs { font-size: 11.5px; }
  .pfs th, .pfs td { padding: 8px 9px; }
  .pfs-sticky { position: sticky; left: 0; z-index: 3; background: var(--ink-2); }
  .pfs-name { min-width: 170px; max-width: 220px; }
  .pfs-name .pfs-logo { width: 22px; height: 22px; font-size: 11px; }
  .pfs-name-sym { font-size: 10.5px; }
  .pfs-name-nm { font-size: 10px; }
  .pfs-name-sec { font-size: 9px; }

  /* chip strip */
  .pf-chips { padding: 8px; gap: 6px; }
  .pf-chips .pf-chip { font-size: 10px; padding: 4px 8px; }

  /* stats strip footer */
  .pfstat-bbbar { height: 8px; }
  .pfstat-bblabels { font-size: 10px; }
  .pfstat-bbl b { font-size: 12px; }

  .pfi-foot { flex-direction: column; align-items: flex-start; gap: 4px; }
  .pfi-foot-note, .pfi-foot-time { font-size: 10px; }
}
@media (max-width: 480px) {
  .pfstat-big { font-size: 19px; }
  .pfstat-cval { font-size: 17px; }
  .pfstat-spark { display: none; }
  .pfh-r button { min-width: 100%; }
  .pfi-card-b { min-height: 130px; }
  .pfi-bar-track { height: 92px; }
}

/* ── v43: explicit run-scan prompt ────────────────────────────────────── */
.pfs-scan-cell { padding: 0 !important; }
.pfs-scan-cta { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 44px 24px 46px; text-align: center; }
.pfs-scan-t { font-size: 9.5px; letter-spacing: 0.22em; color: var(--amber); }
.pfs-scan-b { max-width: 520px; font-size: 12.5px; line-height: 1.6; color: var(--muted); font-family: var(--sans); }
.pfs-scan-btn { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 0.1em; color: var(--ink); background: var(--amber); border: none; padding: 12px 26px; cursor: pointer; transition: filter .2s, transform .2s; }
.pfs-scan-btn:hover { filter: brightness(1.12); transform: translateY(-1px); }
.pfs-scan-n { font-size: 9px; letter-spacing: 0.12em; color: var(--muted-ink); }


/* ════════════════════════════════════════════════════════════════════
   UI REFINEMENT LAYER — professional polish pass
   Typography scale-up on dense data, soft radii, tinted change pills,
   consistent interactive states. Pure presentation; zero functionality.
   ════════════════════════════════════════════════════════════════════ */

/* ── surfaces: soft radius + subtle depth ── */
.panel, .pfstat, .pfi, .pa, .frc-card, .pfi-card, .pf-tb, .pfh-pill,
.pf-addpop, .pf-popover, .settings-pop, .pa-drawer { border-radius: var(--r); }
.panel { box-shadow: 0 1px 0 rgba(0,0,0,.22); }
.panel-h { padding: 11px 16px; }
.panel-h h3 { font-size: 11px; letter-spacing: 0.16em; color: var(--amber-bright); }
.panel-sub { font-size: 10.5px; }

/* ── top bar + tabs: crisper hierarchy ── */
.tbar { height: 54px; }
.ttabs button { font-size: 13px; font-weight: 500; padding: 12px 18px; letter-spacing: 0.01em; transition: color .14s ease, background .14s ease; }
.ttabs button.active { font-weight: 600; }

/* ── buttons: consistent height, radius, hover ── */
.mini-btn { border-radius: var(--r-sm); padding: 6px 13px; font-size: 11.5px; font-weight: 500; transition: border-color .15s ease, color .15s ease, background .15s ease; }
.mini-btn:hover { background: var(--ink-3); }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid color-mix(in srgb, var(--amber) 55%, transparent); outline-offset: 1px; border-radius: var(--r-sm); }

/* ── inputs / selects: uniform styling ── */
input[type="text"], input[type="search"], input:not([type]), select, textarea {
  border-radius: var(--r-sm);
  transition: border-color .15s ease;
}

/* ── data tables: bigger, calmer, easier to scan ── */
.pfs { font-size: 12.5px; }
.pfs th { font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em; padding: 10px 12px; }
.pfs td { padding: 10.5px 12px; }
.pfs tbody tr { transition: background .12s ease; }
.pfs-name-sym { font-size: 12px; font-weight: 600; }
.pfs-name-nm { font-size: 11px; }
.pfs-name-sec { font-size: 10px; }
.pfs-score-num { font-size: 13px; font-weight: 700; }

.frc-t { font-size: 12.5px; }
.frc-t th { font-size: 10.5px; letter-spacing: 0.07em; }
.frc-t td, .frc-t th { padding: 9px 12px; }
.frc-calc { font-size: 11px; }
.frc-bm { font-size: 10.5px; }
.frc-c-v { font-size: 26px; font-weight: 700; }

/* metric rows / definition tables across modules */
td.mono, th.mono, .kv-v, .metric-v { font-size: 12.5px; }
.ind-note { font-size: 11px; line-height: 1.55; }
.loading, .empty-mini { font-size: 12.5px; }

/* ── tinted change pills (reference style: +3.34% on green tint) ── */
.up { color: #34b877; }
.down { color: #e05c4b; }
.chg-pill, .pct-pill { display: inline-block; padding: 2px 8px; border-radius: var(--r-sm); font-weight: 600; font-size: 11.5px; }
.chg-pill.up, .pct-pill.up { background: color-mix(in srgb, var(--up) 14%, transparent); }
.chg-pill.down, .pct-pill.down { background: color-mix(in srgb, var(--down) 14%, transparent); }

/* refined badges — larger, tinted, readable */
.tbadge { font-size: 10.5px; font-weight: 600; padding: 3px 8px; border-radius: var(--r-sm); letter-spacing: 0.02em; }
.sigbadge { font-size: 10.5px; font-weight: 600; padding: 3px 9px; border-radius: var(--r-sm); letter-spacing: 0.03em; }

/* ── stats strip: bigger numbers, clearer bands ── */
.pfstat-big { font-size: 31px; letter-spacing: -0.025em; }
.pfstat-cval { font-size: 27px; letter-spacing: -0.02em; }
.pfstat-k { font-size: 11.5px; }
.pfstat-band { font-size: 12.5px; }
.pfstat-cpct { font-size: 12.5px; font-weight: 500; }
.pfstat-cell { transition: background .15s ease; }
.pfstat-cell:hover { background: color-mix(in srgb, var(--ink-3) 70%, transparent); }

/* ── portfolio insights ── */
.pfi-card-h { font-size: 13.5px; font-weight: 500; }
.pfi-log-primary { font-size: 12.5px; }
.pfi-log-secondary { font-size: 11.5px; }
.pfi-alert-t { font-size: 13.5px; }
.pfi-alert-s { font-size: 11.5px; }
.pfi-bar-v { font-size: 12.5px; }
.pfi-bar-l { font-size: 10.5px; }
.pfi-foot-note, .pfi-foot-time { font-size: 11.5px; }

/* ── price-action workspace ── */
.pa-co-main b { font-size: 12px; }
.pa-co-main small { font-size: 10.5px; }
.pa-co-px b { font-size: 12px; }
.pa-co-px small { font-size: 10.5px; }
.pa-head-id b { font-size: 14px; }
.pa-head-px b { font-size: 17px; font-weight: 700; }
.pa-cur-tx b { font-size: 14px; }
.pa-tl-n { font-size: 11.5px; }
.pa-lv span { font-size: 11.5px; }
.pa-lv b { font-size: 12px; }
.pa-insight p { font-size: 12px; }
.pa-mini b { font-size: 12.5px; }
.pa-mini small { font-size: 10px; }
.pa-d-sec p { font-size: 12.5px; line-height: 1.7; }
.pa-chk { font-size: 12px; }
.pa-tf button { font-weight: 500; }
.pa-tl-item, .pa-conf, .pa-fs, .pa-draw { border-radius: var(--r-sm); }
.pa-full-btn { border-radius: var(--r-sm); font-weight: 600; }

/* ── header pills / meta ── */
.pfh-pill { border-radius: var(--r-sm); }
.pfh-pill-l { font-size: 9.5px; font-weight: 600; }
.pfh-pill-v { font-size: 11.5px; font-weight: 500; }
.pfh-title { letter-spacing: -0.015em; }

/* ── thin, unobtrusive scrollbars ── */
* { scrollbar-width: thin; scrollbar-color: #2c3542 transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: #2c3542; border-radius: 4px; }
*::-webkit-scrollbar-thumb:hover { background: #3a4553; }
*::-webkit-scrollbar-track { background: transparent; }

/* ── selection tint ── */
::selection { background: color-mix(in srgb, var(--amber) 30%, transparent); }

/* ════════════════════════════════════════════════════════════════════════
   TRANCHE 1 ADDITIONS — live experience · palette · watchlist · S18/S19 ·
   DuPont · NSE ownership · common-size. Appended; nothing above modified.
   ════════════════════════════════════════════════════════════════════════ */

/* ── premium gold flash (value-change pulse) ── */
@keyframes goldFlash {
  0%   { background: rgba(200,134,42,.34); box-shadow: 0 0 0 1px rgba(200,134,42,.5), 0 0 14px rgba(200,134,42,.28); }
  55%  { background: rgba(200,134,42,.14); box-shadow: 0 0 0 1px rgba(200,134,42,.22), 0 0 8px rgba(200,134,42,.12); }
  100% { background: transparent; box-shadow: none; }
}
.gold-flash { animation: goldFlash 1.05s cubic-bezier(.22,.61,.36,1); border-radius: 2px; }

/* ── ☆ Watch button (research header) ── */
.ws-watch {
  align-self: center; margin-left: 14px; padding: 5px 12px; font-size: 11px; letter-spacing: .06em;
  background: transparent; border: 1px solid var(--hairline); color: var(--muted);
  cursor: pointer; transition: color .15s, border-color .15s;
}
.ws-watch:hover { color: var(--amber); border-color: var(--amber); }
.ws-watch.on { color: var(--amber); border-color: var(--amber); }

/* ── Watchlist strip (Market Intelligence) ── */
.watchlist { display: flex; flex-direction: column; }
.wl-row { display: flex; align-items: center; gap: 10px; padding: 7px 14px; border-bottom: 1px solid var(--hairline); }
.wl-row:last-child { border-bottom: none; }
.wl-open { display: flex; align-items: baseline; gap: 10px; background: none; border: none; cursor: pointer; padding: 0; flex: 1; min-width: 0; text-align: left; }
.wl-sym { font-family: var(--mono); font-size: 12px; color: var(--amber); letter-spacing: .04em; }
.wl-nm { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl-px { font-size: 12px; color: var(--fg); min-width: 84px; text-align: right; padding: 1px 4px; }
.wl-chg { font-size: 11px; min-width: 64px; text-align: right; }
.wl-del { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 0 2px; opacity: .45; }
.wl-del:hover { opacity: 1; color: var(--down, #c84b3c); }

/* ── Command palette (Ctrl/Cmd+K) ── */
#mrdPalette { position: fixed; inset: 0; z-index: 400; display: none; }
#mrdPalette.open { display: block; }
#mrdPalette .pal-backdrop { position: absolute; inset: 0; background: rgba(6,8,10,.68); backdrop-filter: blur(2px); }
#mrdPalette .pal-box {
  position: relative; width: min(620px, calc(100vw - 32px)); margin: 12vh auto 0;
  background: var(--ink-2, #101418); border: 1px solid var(--hairline);
  box-shadow: 0 18px 60px rgba(0,0,0,.5), 0 0 0 1px rgba(200,134,42,.12);
}
#palInput {
  width: 100%; box-sizing: border-box; padding: 15px 18px; font-family: var(--mono); font-size: 13px;
  background: transparent; border: none; border-bottom: 1px solid var(--hairline); color: var(--fg); outline: none;
}
#palInput::placeholder { color: var(--muted); }
.pal-list { max-height: 46vh; overflow-y: auto; }
.pal-grp { padding: 8px 18px 3px; font-size: 9px; letter-spacing: .14em; color: var(--muted); }
.pal-item {
  display: flex; justify-content: space-between; align-items: baseline; gap: 14px; width: 100%;
  padding: 8px 18px; background: none; border: none; cursor: pointer; text-align: left;
}
.pal-item .pal-l { font-family: var(--mono); font-size: 12px; color: var(--fg); white-space: nowrap; }
.pal-item .pal-s { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-item:hover, .pal-item.active { background: rgba(200,134,42,.10); }
.pal-item.active .pal-l { color: var(--amber); }
.pal-hint { padding: 8px 18px; border-top: 1px solid var(--hairline); font-size: 10px; color: var(--muted); letter-spacing: .05em; }
.pal-empty { padding: 20px 18px; font-size: 11px; color: var(--muted); }

/* ── S18 Reverse DCF cards ── */
.rvd-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--hairline); margin: 4px 0 10px; }
.rvd-card { background: var(--ink-2, #101418); padding: 14px 16px; }
.rvd-card .l { font-family: var(--mono); font-size: 9px; letter-spacing: .12em; color: var(--muted); }
.rvd-card .n { font-family: var(--mono); font-size: 20px; color: var(--amber); margin-top: 5px; }
.rvd-card .s { font-size: 10px; color: var(--muted); margin-top: 4px; }
@media (max-width: 1024px) { .rvd-grid { grid-template-columns: 1fr; } }

/* ── S19 Tornado ── */
.tor { padding: 6px 0 2px; }
.tor-row { display: grid; grid-template-columns: 220px 1fr 64px; align-items: center; gap: 12px; padding: 7px 0; }
.tor-l { font-size: 11px; color: var(--fg); }
.tor-l small { color: var(--muted); font-family: var(--mono); font-size: 9px; margin-left: 4px; }
.tor-track { position: relative; height: 16px; background: rgba(255,255,255,.03); border: 1px solid var(--hairline); }
.tor-bar { position: absolute; top: 2px; bottom: 2px; background: linear-gradient(90deg, rgba(200,134,42,.55), rgba(200,134,42,.85)); }
.tor-base { position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--fg); opacity: .85; z-index: 2; }
.tor-lo, .tor-hi { position: absolute; top: -14px; font-size: 9px; color: var(--muted); transform: translateX(-50%); white-space: nowrap; }
.tor-hi { top: auto; bottom: -15px; }
.tor-sw { font-family: var(--mono); font-size: 11px; text-align: right; color: var(--fg); }
.tor-axis { display: flex; justify-content: space-between; font-size: 9px; color: var(--muted); margin-top: 12px; border-top: 1px dashed var(--hairline); padding-top: 5px; }
@media (max-width: 900px) { .tor-row { grid-template-columns: 130px 1fr 52px; } .tor-l { font-size: 10px; } }

/* ── Common-size toggle ── */
.ers-cs-btn { margin-left: auto; opacity: .8; }
.ers-cs-btn.is-on { color: var(--amber); border-color: var(--amber); opacity: 1; }

/* ── NSE announcements list ── */
.nse-ann { display: flex; flex-direction: column; }
.nse-ann-row { display: flex; gap: 14px; align-items: baseline; padding: 7px 2px; border-bottom: 1px solid var(--hairline); }
.nse-ann-row:last-child { border-bottom: none; }
.nse-ann-d { font-size: 10px; color: var(--muted); white-space: nowrap; min-width: 118px; }
.nse-ann-s { font-size: 12px; color: var(--fg); line-height: 1.45; }

/* ── Tranche 2: Scenario Manager · Valuation Bands · Transactions ── */

/* Scenario Manager (DCF sidebar) */
.scn-add { display: flex; gap: 6px; padding: 6px 16px 10px; }
.scn-add input { flex: 1; min-width: 0; background: transparent; border: 1px solid var(--hairline); color: var(--fg); font-family: var(--mono); font-size: 11px; padding: 6px 8px; outline: none; }
.scn-add input:focus { border-color: var(--amber); }
.scn-row { display: flex; align-items: center; gap: 8px; padding: 7px 16px; border-top: 1px solid var(--hairline); }
.scn-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.scn-n { font-size: 11.5px; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scn-m { font-size: 9.5px; color: var(--muted); }
.scn-del { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 0 2px; opacity: .5; }
.scn-del:hover { opacity: 1; color: var(--down, #c84b3c); }

/* Historical valuation bands */
.bands { padding: 8px 0 2px; }
.band-row { display: grid; grid-template-columns: 120px 1fr 200px; align-items: center; gap: 14px; padding: 14px 0 4px; }
.band-l { font-size: 11.5px; color: var(--fg); }
.band-track { position: relative; height: 14px; background: rgba(255,255,255,.03); border: 1px solid var(--hairline); }
.band-iqr { position: absolute; top: 0; bottom: 0; background: rgba(200,134,42,.18); border-left: 1px solid rgba(200,134,42,.4); border-right: 1px solid rgba(200,134,42,.4); }
.band-med { position: absolute; top: -2px; bottom: -2px; width: 1px; background: var(--muted); }
.band-cur { position: absolute; top: -4px; bottom: -4px; width: 3px; background: var(--amber); box-shadow: 0 0 8px rgba(200,134,42,.55); }
.band-v { font-size: 12px; color: var(--fg); }
.band-v small { display: block; font-size: 9.5px; color: var(--muted); letter-spacing: .04em; }
.band-v small.up { color: var(--up); } .band-v small.down { color: var(--down); }
.band-scale { display: grid; grid-template-columns: repeat(5, 1fr); font-size: 9px; color: var(--muted); padding: 3px 0 6px 134px; }
.band-scale span:nth-child(2), .band-scale span:nth-child(3), .band-scale span:nth-child(4) { text-align: center; }
.band-scale span:last-child { text-align: right; }
@media (max-width: 900px) { .band-row { grid-template-columns: 84px 1fr 130px; } .band-scale { padding-left: 98px; } }

/* Transactions & Performance */
.txn-add { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 0 12px; align-items: center; }
.txn-add input, .txn-add select { background: transparent; border: 1px solid var(--hairline); color: var(--fg); font-family: var(--mono); font-size: 11.5px; padding: 7px 9px; outline: none; }
.txn-add input:focus, .txn-add select:focus { border-color: var(--amber); }
.txn-add input[type="number"] { width: 96px; } .txn-add input[type="date"] { width: 138px; }
.txn-add #txnSym { width: 190px; }
.txn-add select { appearance: none; min-width: 74px; }
.txp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--hairline); margin: 2px 0 8px; }
.txp-card { background: var(--ink-2, #101418); padding: 12px 14px; }
.txp-card .l { font-family: var(--mono); font-size: 8.5px; letter-spacing: .12em; color: var(--muted); }
.txp-card .n { font-family: var(--mono); font-size: 17px; color: var(--fg); margin-top: 5px; padding: 1px 3px; }
.txp-card .n.up { color: var(--up); } .txp-card .n.down { color: var(--down); }
.txp-card .s { font-size: 9.5px; color: var(--muted); margin-top: 3px; }
@media (max-width: 1280px) { .txp-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 760px) { .txp-grid { grid-template-columns: repeat(2, 1fr); } }

/* ════════════════════════════════════════════════════════════════════════
   PORTFOLIO COMMAND SURFACE — application-grade refinement of the upper
   section (header · meta · actions · stat strip). Pure override layer:
   every ID/class/handler untouched; scoped to desktop so mobile rendering
   stays pixel-identical.
   ════════════════════════════════════════════════════════════════════════ */
@media (min-width: 1025px) {

  /* ── unified elevated surface with a brand accent edge ── */
  .pfh {
    position: relative;
    padding: 18px 24px 16px;
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--ink-2) 92%, var(--amber) 2%), var(--ink-2) 42%, color-mix(in srgb, var(--ink-2) 86%, var(--ink)));
    border: 1px solid var(--hairline);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    box-shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 14px 34px -22px rgba(0,0,0,.65);
  }
  .pfh::before {
    content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, transparent, rgba(200,134,42,.75) 18%, rgba(200,134,42,.75) 82%, transparent);
    border-radius: 6px 6px 0 0;
  }

  .pfh-bread { font-size: 9px; letter-spacing: .2em; margin-bottom: 10px; opacity: .85; }

  /* portfolio switcher reads as a real control */
  .pfh-titlerow { margin-bottom: 14px; }
  .pfh-switch-btn {
    padding: 4px 12px 5px 10px; margin-left: -10px;
    border-radius: 6px; border: 1px solid transparent;
    transition: background .16s ease, border-color .16s ease;
  }
  .pfh-switch-btn:hover { background: color-mix(in srgb, var(--ink) 65%, transparent); border-color: var(--hairline); }
  .pfh-switch-btn:hover .pfh-caret { transform: translateY(1px); }
  .pfh-title { font-size: 25px; letter-spacing: -0.01em; }
  .pfh-switch-menu { border-radius: 8px; overflow: hidden; border-color: color-mix(in srgb, var(--amber) 22%, var(--hairline)); }

  /* meta pills → one cohesive segmented bar */
  .pfh-meta { gap: 0; margin-bottom: 0; border: 1px solid var(--hairline); border-radius: 6px; width: fit-content; overflow: hidden; background: color-mix(in srgb, var(--ink) 66%, transparent); }
  .pfh-pill { border: none; border-right: 1px solid var(--hairline); border-radius: 0; padding: 7px 14px; background: transparent; }
  .pfh-pill:last-child { border-right: none; }
  .pfh-pill-l { font-size: 8px; letter-spacing: .18em; }
  .pfh-pill-v { font-size: 11.5px; font-variant-numeric: tabular-nums; }
  .pfh-pill-ref { padding-left: 8px; transition: transform .3s ease, color .15s ease; }
  .pfh-pill-ref:hover { transform: rotate(120deg); }

  /* action bar — clear hierarchy: primary (Add) + quiet secondaries */
  .pfh-actions { padding-top: 30px; gap: 8px; }
  .pfh-btn {
    height: 34px; padding: 0 15px; border-radius: 6px;
    background: color-mix(in srgb, var(--ink) 80%, transparent);
    box-shadow: 0 1px 0 rgba(255,255,255,.03) inset;
    transition: border-color .16s ease, color .16s ease, background .16s ease, transform .08s ease;
  }
  .pfh-btn:hover { background: color-mix(in srgb, var(--amber) 7%, var(--ink)); }
  .pfh-btn:active { transform: translateY(1px); }
  .pfh-btn:focus-visible { outline: 1px solid var(--amber); outline-offset: 1px; }
  #pfActAdd {
    background: linear-gradient(180deg, color-mix(in srgb, var(--amber) 22%, var(--ink)), color-mix(in srgb, var(--amber) 12%, var(--ink)));
    border-color: color-mix(in srgb, var(--amber) 55%, var(--hairline));
    color: var(--amber-bright); font-weight: 600;
  }
  #pfActAdd:hover { background: linear-gradient(180deg, color-mix(in srgb, var(--amber) 30%, var(--ink)), color-mix(in srgb, var(--amber) 16%, var(--ink))); border-color: var(--amber); }
  .pfh-btn-icon { width: 34px; padding: 0; justify-content: center; }
  .pfh-settings-menu { border-radius: 8px; overflow: hidden; }

  /* ── stat strip fuses with the header into one command block ── */
  .pfstat {
    border: 1px solid var(--hairline); border-top: 1px solid color-mix(in srgb, var(--hairline) 70%, transparent);
    border-radius: 0 0 6px 6px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--ink-2) 94%, var(--ink)), color-mix(in srgb, var(--ink-2) 82%, var(--ink)));
    box-shadow: 0 14px 34px -24px rgba(0,0,0,.6);
    overflow: hidden;
  }
  .pfstat-cell { position: relative; transition: background .18s ease; }
  .pfstat-cell:hover { background: color-mix(in srgb, var(--amber) 3.5%, transparent); }
  .pfstat-cell + .pfstat-cell::before {
    content: ""; position: absolute; left: 0; top: 14%; bottom: 14%;
    width: 1px; background: color-mix(in srgb, var(--hairline) 85%, transparent);
  }
  .pfstat-k { font-size: 8.5px; letter-spacing: .18em; opacity: .8; }
  .pfstat-big { font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
  .pfstat-band { font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }

  /* empty-state card gets the same product polish */
  .pfe-card { border-radius: 8px; box-shadow: 0 24px 60px -30px rgba(0,0,0,.7), 0 1px 0 rgba(255,255,255,.03) inset; }
  .pfe-cta { border-radius: 6px; transition: transform .1s ease, box-shadow .2s ease; }
  .pfe-cta:hover { box-shadow: 0 6px 22px -8px rgba(200,134,42,.45); }
  .pfe-cta:active { transform: translateY(1px); }
}

/* ════════════════════════════════════════════════════════════════════════
   MACRO COMMAND styles
   ════════════════════════════════════════════════════════════════════════ */
.mc { display: flex; flex-direction: column; gap: 14px; padding: 4px 0 2px; }

/* regime bar */
.mc-regime { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--hairline); background: color-mix(in srgb, var(--ink) 55%, transparent); border-radius: 4px; }
.mc-reg-chip { font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: .14em; padding: 6px 14px; border-radius: 3px; border: 1px solid; }
.mc-reg-chip.on  { color: var(--up); border-color: color-mix(in srgb, var(--up) 55%, transparent); background: color-mix(in srgb, var(--up) 10%, transparent); }
.mc-reg-chip.off { color: var(--down); border-color: color-mix(in srgb, var(--down) 55%, transparent); background: color-mix(in srgb, var(--down) 10%, transparent); }
.mc-reg-chip.mid { color: var(--amber-bright); border-color: color-mix(in srgb, var(--amber) 55%, transparent); background: color-mix(in srgb, var(--amber) 8%, transparent); }
.mc-reg-reads { display: flex; gap: 6px; flex-wrap: wrap; }
.mc-read { font-family: var(--mono); font-size: 10px; padding: 3px 8px; border: 1px solid var(--hairline); border-radius: 3px; color: var(--muted); }
.mc-read.up { color: var(--up); border-color: color-mix(in srgb, var(--up) 40%, transparent); }
.mc-read.down { color: var(--down); border-color: color-mix(in srgb, var(--down) 40%, transparent); }
.mc-reg-key { margin-left: auto; font-size: 10.5px; color: var(--muted); }

/* heatmap */
.mc-heat { display: flex; flex-direction: column; gap: 8px; }
.mc-hgrp { display: grid; grid-template-columns: 110px 1fr; gap: 10px; align-items: start; }
.mc-hgl { font-size: 8.5px; letter-spacing: .16em; color: var(--muted-ink); padding-top: 9px; }
.mc-hrow { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 4px; }
.mc-tile {
  display: flex; flex-direction: column; gap: 1px; align-items: flex-start;
  padding: 7px 9px; border: 1px solid color-mix(in srgb, var(--hairline) 70%, transparent);
  border-radius: 3px; cursor: pointer; text-align: left;
  transition: border-color .15s ease, transform .1s ease;
}
.mc-tile:hover { border-color: var(--amber); transform: translateY(-1px); }
.mc-tl { font-size: 10px; color: var(--fg); font-weight: 500; letter-spacing: .02em; }
.mc-tp { font-size: 11.5px; color: var(--fg); padding: 0 2px; }
.mc-tc { font-size: 9.5px; color: rgba(255,255,255,.75); }

/* charts + curve layout */
.mc-mid { display: grid; grid-template-columns: 1fr 240px; gap: 14px; align-items: start; }
.mc-deck { display: grid; grid-template-columns: 1fr; gap: 14px; min-width: 0; }
.mc-station { border: 1px solid var(--hairline); border-radius: 4px; background: color-mix(in srgb, var(--ink) 45%, transparent); padding: 10px 12px 8px; }
.mc-ctl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.mc-sym, .mc-vs {
  background: var(--ink); border: 1px solid var(--hairline); color: var(--fg);
  font-family: var(--mono); font-size: 11px; padding: 5px 8px; border-radius: 3px; outline: none; max-width: 190px;
}
.mc-sym:focus, .mc-vs:focus { border-color: var(--amber); }
.mc-tf { display: flex; border: 1px solid var(--hairline); border-radius: 3px; overflow: hidden; }
.mc-tfb { background: none; border: none; border-right: 1px solid var(--hairline); color: var(--muted); font-family: var(--mono); font-size: 10px; padding: 5px 10px; cursor: pointer; }
.mc-tfb:last-child { border-right: none; }
.mc-tfb.on { color: var(--amber-bright); background: color-mix(in srgb, var(--amber) 10%, transparent); }
.mc-hint { margin-left: auto; font-size: 9px; color: var(--muted-ink); }
.mc-cv { width: 100%; height: 240px; display: block; cursor: crosshair; }
.mc-stats { display: flex; gap: 14px; flex-wrap: wrap; padding: 8px 2px 4px; border-top: 1px solid color-mix(in srgb, var(--hairline) 60%, transparent); margin-top: 6px; }
.mc-st { display: flex; flex-direction: column; gap: 1px; }
.mc-st small { font-family: var(--mono); font-size: 7.5px; letter-spacing: .14em; color: var(--muted-ink); }
.mc-st b { font-family: var(--mono); font-size: 12px; color: var(--fg); font-weight: 600; }
.mc-st b.up { color: var(--up); } .mc-st b.down { color: var(--down); }
.mc-note { font-size: 11px; line-height: 1.55; color: var(--muted); padding: 6px 2px 2px; }
.mc-curve { border: 1px solid var(--hairline); border-radius: 4px; padding: 12px; background: color-mix(in srgb, var(--ink) 45%, transparent); }
.mc-curve-svg { width: 100%; height: auto; }
.mc-spread { font-size: 10.5px; line-height: 1.5; color: var(--muted); margin-top: 8px; }
.mc-spread b { color: var(--fg); font-family: var(--mono); }
.mc-spread.down b { color: var(--down); }

@media (max-width: 1200px) { .mc-mid { grid-template-columns: 1fr; } .mc-curve { max-width: 380px; } }
@media (max-width: 1024px) {
  .mc-hgrp { grid-template-columns: 1fr; gap: 4px; }
  .mc-hgl { padding-top: 0; }
  .mc-reg-key { margin-left: 0; width: 100%; }
  .mc-cv { height: 200px; }
  .mc-hint { display: none; }
}

/* ── MACRO COMMAND v2: panels · tables · FII/DII · strength · lazy cards ── */
.mc-panel { border: 1px solid var(--hairline); border-radius: 4px; background: color-mix(in srgb, var(--ink) 45%, transparent); padding: 12px 14px; }
.mc-ph { font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; color: var(--fg); margin-bottom: 10px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.mc-ps { font-size: 8.5px; letter-spacing: .08em; color: var(--muted-ink); }
.mc-t th { font-size: 8.5px; letter-spacing: .1em; }
.mc-t td { font-variant-numeric: tabular-nums; }
.mc-link { background: none; border: none; padding: 0; color: var(--fg); font: inherit; cursor: pointer; border-bottom: 1px dotted color-mix(in srgb, var(--amber) 45%, transparent); }
.mc-link:hover { color: var(--amber); }
.mc-spark { width: 84px; height: 22px; display: block; }
.mc-src { font-size: 7.5px; color: var(--muted-ink); letter-spacing: .08em; border: 1px solid var(--hairline); padding: 1px 4px; border-radius: 2px; margin-left: 4px; }
/* GLOBAL INDICATORS per-row trend chart (GDP · inflation · unemployment) */
.mc-econ-trend { padding: 3px 6px !important; }
.mc-mspark { width: 128px; height: 30px; display: block; }
.mc-econ-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 8px; font-size: 10.5px; color: var(--muted-ink); letter-spacing: .04em; }
.mc-econ-legend span { display: inline-flex; align-items: center; gap: 6px; }
.mc-econ-legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.mc-row2col { display: grid; grid-template-columns: 3fr 2fr; gap: 14px; align-items: start; }
@media (max-width: 1200px) { .mc-row2col { grid-template-columns: 1fr; } }

/* FII / DII */
.mc-fii-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--hairline); margin-bottom: 12px; border: 1px solid var(--hairline); }
.mc-fii-card { background: var(--ink-2); padding: 10px 12px; }
.mc-fii-card .l { font-family: var(--mono); font-size: 7.5px; letter-spacing: .14em; color: var(--muted-ink); }
.mc-fii-card .n { font-family: var(--mono); font-size: 14px; margin-top: 4px; font-weight: 600; }
@media (max-width: 700px) { .mc-fii-grid { grid-template-columns: repeat(2, 1fr); } }
.mc-fii-chart { display: flex; align-items: flex-end; gap: 3px; height: 44px; padding: 4px 2px 2px; border-bottom: 1px solid var(--hairline); overflow: hidden; }
.mc-fgrp { display: flex; align-items: flex-end; gap: 1px; }
.mc-fb { width: 4px; border-radius: 1px 1px 0 0; display: inline-block; }
.mc-fb.fii.pos { background: var(--amber); } .mc-fb.fii.neg { background: color-mix(in srgb, var(--amber) 45%, var(--down)); }
.mc-fb.dii.pos { background: var(--up); } .mc-fb.dii.neg { background: var(--down); }
.mc-fii-legend { font-size: 8.5px; color: var(--muted-ink); padding: 5px 2px; display: flex; align-items: center; gap: 4px; }

/* currency strength */
.mc-str { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.mc-str-row { display: grid; grid-template-columns: 40px 1fr 52px; align-items: center; gap: 10px; }
.mc-str-c { font-size: 10.5px; color: var(--fg); }
.mc-str-track { position: relative; height: 10px; background: rgba(255,255,255,.03); border: 1px solid var(--hairline); }
.mc-str-mid { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: rgba(255,255,255,.18); }
.mc-str-bar { position: absolute; top: 1px; bottom: 1px; }
.mc-str-bar.up { background: linear-gradient(90deg, rgba(47,124,84,.4), rgba(47,124,84,.85)); }
.mc-str-bar.down { background: linear-gradient(270deg, rgba(178,58,44,.4), rgba(178,58,44,.85)); }
.mc-str-v { font-size: 10px; text-align: right; }

/* rates grid */
.mc-rates-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .mc-rates-grid { grid-template-columns: 1fr; } }

/* inflation / india cards */
.mc-infl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1px; background: var(--hairline); border: 1px solid var(--hairline); }
.mc-infl-card { background: var(--ink-2); padding: 12px 14px; }
.mc-infl-card .l { font-family: var(--mono); font-size: 7.5px; letter-spacing: .12em; color: var(--muted-ink); }
.mc-infl-card .n { font-family: var(--mono); font-size: 19px; color: var(--fg); margin: 5px 0 2px; font-weight: 600; }
.mc-infl-card .n.up { color: var(--up); } .mc-infl-card .n.down { color: var(--down); }
.mc-infl-card .s { font-size: 8.5px; color: var(--muted); margin-bottom: 6px; }
.mc-infl-card .mc-spark { width: 100%; height: 26px; }

/* briefing — two-column institutional layout (narrative + sidebar) */
.mc-brief2 { display: grid; grid-template-columns: 1.62fr 1fr; gap: 22px; align-items: start; }
@media (max-width: 1080px) { .mc-brief2 { grid-template-columns: 1fr; } }
.mc-brief-main { display: flex; flex-direction: column; gap: 16px; }
.mc-brief-sec { display: flex; gap: 13px; align-items: flex-start; }
.mc-bs-ic { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: var(--amber); background: rgba(200, 134, 42, .10); border: 1px solid rgba(200, 134, 42, .28); margin-top: 2px; }
.mc-bs-ic svg { width: 18px; height: 18px; display: block; }
.mc-bs-body { min-width: 0; }
.mc-bs-body h4 { font-size: 12.5px; font-weight: 700; color: var(--amber-bright); letter-spacing: .01em; margin: 2px 0 4px; }
.mc-bs-body p { font-size: 12px; line-height: 1.62; color: var(--fg); margin: 0; }

.mc-brief-side { display: flex; flex-direction: column; gap: 14px; }
.mc-brief-card { border: 1px solid var(--hairline); border-radius: var(--r); background: var(--ink-2); padding: 13px 15px; }
.mc-bc-head { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 11px; font-weight: 700;
  letter-spacing: .11em; color: var(--fg); text-transform: uppercase; margin-bottom: 10px; }
.mc-bc-ic { font-size: 12px; line-height: 1; }
.mc-bc-ic.star { color: var(--amber-bright); }
.mc-bc-ic.up { color: var(--up); font-size: 10px; }
.mc-bc-ic.warn { color: var(--down); font-size: 11px; }
.mc-bc-list { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.mc-bc-list li { position: relative; padding-left: 16px; font-size: 11.5px; line-height: 1.5; color: var(--fg); }
.mc-bc-list li::before { content: ""; position: absolute; left: 3px; top: 7px; width: 5px; height: 5px; border-radius: 50%; background: var(--up); }
.mc-bc-list.risk li::before { background: var(--down); }
.mc-bc-list.opp li::before { background: var(--up); }

.mc-netread .mc-nr-body { display: flex; align-items: center; gap: 12px; }
.mc-nr-gauge { flex: 0 0 132px; }
.mc-gauge { width: 132px; height: auto; display: block; }
.mc-nr-meta { flex: 1 1 auto; }
.mc-nr-label { font-size: 17px; font-weight: 700; line-height: 1.1; }
.mc-nr-score { font-family: var(--mono); font-size: 13px; color: var(--muted); margin-top: 3px; }
.mc-nr-score b { font-size: 26px; color: var(--amber-bright); font-weight: 700; }
.mc-nr-desc { font-size: 11.5px; line-height: 1.5; color: var(--muted); margin-top: 10px; }

.mc-brief-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; margin-top: 16px;
  padding-top: 10px; border-top: 1px solid var(--hairline); }
.mc-brief-foot .idcf-note { margin-top: 0; }
.mc-asof { color: var(--muted-ink); white-space: nowrap; }

/* ════════════════════════════════════════════════════════════════════════
   PRODUCT FINISH SYSTEM
   A single refinement layer over the shared primitives every tab is built
   from — top bar, tab rail, panels, tables, buttons, fields, loading and
   empty states, overlays. No new theme, no layout changes: MERIDIAN's own
   identity (ink · amber · hairlines · serif display · tabular data), taken
   to production finish. Appended last so it wins the cascade cleanly.
   ════════════════════════════════════════════════════════════════════════ */

/* ── scrollbars: thin, ink-toned, amber on grab — the fastest "real product"
      signal there is. Firefox + WebKit. ── */
* { scrollbar-width: thin; scrollbar-color: #2b333e transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #2b333e; border-radius: 5px; border: 2px solid var(--ink); }
*::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--amber) 55%, #2b333e); }
*::-webkit-scrollbar-corner { background: transparent; }

/* ── app frame: top bar with real depth, not a flat strip ── */
.tbar {
  background: linear-gradient(180deg, color-mix(in srgb, var(--ink-2) 96%, var(--amber) 1.5%), var(--ink-2) 55%, color-mix(in srgb, var(--ink-2) 88%, var(--ink)));
  border-bottom: 1px solid color-mix(in srgb, var(--amber) 14%, var(--hairline));
  box-shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 24px -18px rgba(0,0,0,.8);
}
.tcmd {
  border-radius: var(--r-sm);
  background: linear-gradient(180deg, color-mix(in srgb, var(--ink) 92%, #000), var(--ink));
  box-shadow: 0 1px 2px rgba(0,0,0,.35) inset;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.tcmd:focus-within { border-color: var(--amber); box-shadow: 0 1px 2px rgba(0,0,0,.35) inset, 0 0 0 3px color-mix(in srgb, var(--amber) 14%, transparent); }
.tcmd input::placeholder { color: var(--muted-ink); }
.tcmd-kbd {
  font-family: var(--code); font-size: 9px; letter-spacing: .08em; color: var(--muted);
  border: 1px solid var(--hairline); border-bottom-width: 2px; border-radius: 4px;
  padding: 2px 7px 1px; margin-left: 10px; white-space: nowrap; cursor: pointer; user-select: none;
  background: color-mix(in srgb, var(--ink-2) 80%, transparent);
  transition: color .15s ease, border-color .15s ease;
}
.tcmd-kbd:hover { color: var(--amber-bright); border-color: var(--amber); }
.settings-btn { transition: color .18s ease, transform .35s ease; }
.settings-btn:hover { color: var(--amber-bright); transform: rotate(40deg); }
.cmd-results {
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  box-shadow: 0 22px 44px -18px rgba(0,0,0,.75), 0 0 0 1px color-mix(in srgb, var(--amber) 10%, transparent);
}
.cmd-result { transition: background .12s ease; }
.cmd-result:hover, .cmd-result.active { background: color-mix(in srgb, var(--amber) 9%, transparent); }
.cmd-result:hover .sym, .cmd-result.active .sym { color: var(--amber-bright); }

/* ── tab rail: quiet by default, unmistakable when active ── */
.ttabs { scrollbar-width: none; box-shadow: 0 6px 16px -14px rgba(0,0,0,.7); }
.ttabs::-webkit-scrollbar { display: none; }
.ttabs button { position: relative; transition: color .16s ease, background .16s ease; }
.ttabs button:hover { color: var(--fg); background: color-mix(in srgb, var(--amber) 4%, transparent); }
.ttabs button.active {
  color: var(--amber-bright);
  background: linear-gradient(180deg, color-mix(in srgb, var(--amber) 9%, var(--ink)), var(--ink));
  box-shadow: inset 0 2px 0 var(--amber), inset 0 -14px 20px -20px color-mix(in srgb, var(--amber) 55%, transparent);
}

/* ── panel system: layered surface, inset top light, soft depth ── */
.panel {
  background: linear-gradient(180deg, color-mix(in srgb, var(--ink-2) 97%, #fff 0.6%), var(--ink-2) 40%, color-mix(in srgb, var(--ink-2) 93%, var(--ink)));
  border-radius: 3px;
  box-shadow: 0 1px 0 rgba(255,255,255,.028) inset, 0 12px 28px -24px rgba(0,0,0,.75);
}
.panel-h {
  background: linear-gradient(180deg, rgba(255,255,255,.012), transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--hairline) 92%, var(--amber) 6%);
}
.panel-h h3 { text-shadow: 0 0 18px color-mix(in srgb, var(--amber) 30%, transparent); }

/* ── data tables: header depth, row hover wash, aligned digits everywhere ── */
.dt th {
  background: linear-gradient(180deg, color-mix(in srgb, var(--ink-2) 94%, #fff 0.8%), var(--ink-2));
  border-bottom: 1px solid color-mix(in srgb, var(--hairline) 85%, var(--amber) 10%);
  transition: color .14s ease;
}
.dt th:hover { color: var(--fg); }
.dt td { font-variant-numeric: tabular-nums; }
.dt tr:hover td { background: color-mix(in srgb, var(--amber) 3.5%, transparent); }
.dt tr.ers-sec:hover td, .dt tr:first-child:hover th { background: none; }
.dt td.nm { color: color-mix(in srgb, var(--fg) 94%, var(--amber)); }
.table-wrap { border-radius: 3px; }

/* ── controls: one physical language for every small button ── */
.mini-btn {
  border-radius: var(--r-sm);
  transition: border-color .15s ease, color .15s ease, background .15s ease, transform .08s ease;
  box-shadow: 0 1px 0 rgba(255,255,255,.03) inset;
}
.mini-btn:hover { background: color-mix(in srgb, var(--amber) 8%, var(--ink)); }
.mini-btn:active { transform: translateY(1px); }
.mini-btn:disabled { opacity: .5; cursor: default; transform: none; }
.iffm-tab, .mc-tfb, .pal-item, .ws-watch { transition: color .15s ease, background .15s ease, border-color .15s ease; }
.ws-watch { border-radius: var(--r-sm); }
.ws-watch:active { transform: translateY(1px); }

/* ── loading & empty states: alive, not apologetic ── */
.loading { display: flex; align-items: center; gap: 10px; }
.loading::before {
  content: ""; width: 26px; height: 3px; border-radius: 2px; flex: none;
  background: linear-gradient(90deg, transparent, var(--amber), transparent);
  background-size: 200% 100%;
  animation: mrdShimmer 1.1s linear infinite;
}
@keyframes mrdShimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }
.empty-mini { border-left: 2px solid color-mix(in srgb, var(--amber) 35%, var(--hairline)); padding-left: 14px; }

/* ── module entrance: a 180ms settle when switching tabs — content arrives,
      it doesn't pop. Opacity + 3px rise only (canvas-safe). ── */
@keyframes mrdTabIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.tab:not([hidden]) { animation: mrdTabIn .18s ease; }
@media (prefers-reduced-motion: reduce) {
  .tab:not([hidden]) { animation: none; }
  .loading::before { animation: none; background: var(--amber); }
}

/* ── overlays: the palette lands with intent ── */
@keyframes mrdPalIn { from { opacity: 0; transform: translateY(-6px) scale(.985); } to { opacity: 1; transform: none; } }
#mrdPalette.open .pal-box { animation: mrdPalIn .16s cubic-bezier(.2,.7,.3,1); border-radius: var(--r-sm); }
#mrdPalette .pal-backdrop { animation: mrdFade .16s ease; }
@keyframes mrdFade { from { opacity: 0; } to { opacity: 1; } }
.pfh-switch-menu, .pfh-settings-menu, .settings-pop { box-shadow: 0 24px 56px -20px rgba(0,0,0,.8), 0 0 0 1px color-mix(in srgb, var(--amber) 8%, transparent); }

/* ── screener + watchlist rows join the hover language ── */
#pfScreener tbody tr:hover td { background: color-mix(in srgb, var(--amber) 3.5%, transparent); }
.wl-row { transition: background .14s ease; }
.wl-row:hover { background: color-mix(in srgb, var(--amber) 4%, transparent); }
.mc-tile:active { transform: translateY(0); }

/* ── keyboard hint chips anywhere (palette footer etc.) ── */
kbd {
  font-family: var(--code); font-size: 9.5px; color: var(--muted);
  border: 1px solid var(--hairline); border-bottom-width: 2px; border-radius: 4px; padding: 1px 6px;
}
@media (max-width: 1024px) { .tcmd-kbd { display: none; } }

/* ── Macro v3: packed heatmap · compare chips · legend · event popup ── */
.mc-heat { display: flex; flex-wrap: wrap; gap: 12px 16px; }
.mc-hgrp { display: flex; flex-direction: column; gap: 5px; flex: 1 1 auto; min-width: 0; flex-grow: var(--tiles, 1); }
.mc-hgl { padding-top: 0; }
.mc-hrow { display: flex; flex-wrap: wrap; gap: 4px; }
.mc-tile { flex: 1 1 108px; min-width: 96px; }

.mc-chips { display: flex; gap: 5px; flex-wrap: wrap; }
.mc-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 10px; color: var(--fg);
  border: 1px solid color-mix(in srgb, var(--c, var(--amber)) 60%, var(--hairline));
  border-left: 3px solid var(--c, var(--amber));
  padding: 3px 6px 3px 8px; border-radius: 3px;
  background: color-mix(in srgb, var(--c, var(--amber)) 8%, transparent);
}
.mc-chip button { color: var(--muted); font-size: 12px; padding: 0 1px; line-height: 1; }
.mc-chip button:hover { color: var(--down); }
.mc-add { max-width: 170px; background: var(--ink); border: 1px solid var(--hairline); color: var(--muted); font-family: var(--mono); font-size: 10.5px; padding: 5px 8px; border-radius: 3px; outline: none; }
.mc-add:focus { border-color: var(--amber); }

.mc-cvwrap { position: relative; }
.mc-legend { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; padding: 6px 2px 0; }
.mc-lg { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 9.5px; color: var(--muted); }
.mc-lg i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.mc-lg-note { color: var(--muted-ink); margin-left: auto; }

.mc-pop {
  position: absolute; z-index: 30; max-width: 330px;
  background: rgba(12,15,19,.97); border: 1px solid color-mix(in srgb, var(--amber) 45%, var(--hairline));
  border-radius: 4px; padding: 10px 12px 11px;
  box-shadow: 0 18px 44px -14px rgba(0,0,0,.85);
  animation: mrdPalIn .14s ease;
}
.mc-pop-t { font-size: 9.5px; letter-spacing: .12em; color: var(--amber-bright); margin-bottom: 6px; }
.mc-pop-b { font-size: 11px; line-height: 1.6; color: var(--fg); }
.mc-pop-x { position: absolute; top: 4px; right: 7px; color: var(--muted); font-size: 13px; }
.mc-pop-x:hover { color: var(--fg); }

/* FII/DII grid grows to 3 rows and the panel stretches to match its neighbour */
.mc-row2col { align-items: stretch; }
.mc-row2col .mc-panel { display: flex; flex-direction: column; }
.mc-fii-card .s { font-size: 8px; color: var(--muted-ink); margin-top: 3px; }

/* ── Market Intelligence: Cross-Asset Matrix (65%) + Watchlist (35%) share
      one row on desktop; watchlist scrolls within the matrix's height so the
      row never staggers. Stacks naturally on smaller screens. ── */
@media (min-width: 1025px) {
  .mtx-watch-row { align-items: stretch; flex-wrap: nowrap; }
  .mtx-watch-row .mtx-col { flex: 1 1 65%; max-width: 65%; min-width: 0; }
  .mtx-watch-row .watch-col { flex: 1 1 35%; max-width: 35%; min-width: 0; display: flex; flex-direction: column; }
  .mtx-watch-row .watch-col .watchlist { flex: 1; overflow-y: auto; min-height: 0; max-height: 560px; }
  .mtx-watch-row .mtx-col #matrix { overflow-x: auto; }
}
@media (max-width: 1024px) {
  .mtx-watch-row { flex-direction: column; }
  .mtx-watch-row .mtx-col, .mtx-watch-row .watch-col { max-width: 100%; }
}

/* ── Macro v4: single-line heatmap rows · FII chart · Chart Analysis · modal ── */
.mc-hrow { flex-wrap: nowrap; }
.mc-hrow .mc-tile { flex: 1 1 0; min-width: 0; }
.mc-tile .mc-tl, .mc-tile .mc-tp { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
@media (max-width: 1200px) { .mc-hrow { flex-wrap: wrap; } .mc-hrow .mc-tile { flex: 1 1 108px; } }

.mc-fii-ctl { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 2px 0 8px; }
.mc-fii-legend { display: inline-flex; align-items: center; gap: 5px; font-size: 8.5px; color: var(--muted-ink); }
.mc-lgd { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.mc-lgd.fii { background: #c8862a; } .mc-lgd.dii { background: #2e9e6b; } .mc-lgd.all { background: #e8e3d8; height: 3px; }
.mc-fii-cvwrap { flex: 1; min-height: 170px; }
#mcFiiCv { width: 100%; height: 100%; min-height: 170px; display: block; }

.cx-ctl { position: relative; z-index: 6; }
.cx-search { position: relative; flex: 0 1 340px; min-width: 200px; }
.cx-search.cx-cmp { flex: 0 1 190px; min-width: 150px; }
.cx-search input {
  width: 100%; background: var(--ink); border: 1px solid var(--hairline); color: var(--fg);
  font-family: var(--mono); font-size: 11px; padding: 6px 9px; border-radius: 3px; outline: none;
}
.cx-search input:focus { border-color: var(--amber); }
.cx-drop {
  position: absolute; top: calc(100% + 3px); left: 0; right: 0; z-index: 40;
  background: rgba(12,15,19,.98); border: 1px solid color-mix(in srgb, var(--amber) 30%, var(--hairline));
  border-radius: 4px; max-height: 300px; overflow-y: auto;
  box-shadow: 0 20px 44px -14px rgba(0,0,0,.85);
}
.cx-dh { font-size: 7.5px; letter-spacing: .16em; color: var(--muted-ink); padding: 7px 10px 3px; }
.cx-di { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; text-align: left; padding: 6px 10px; border-bottom: 1px solid color-mix(in srgb, var(--hairline) 55%, transparent); }
.cx-di b { font-size: 11px; color: var(--fg); font-weight: 600; }
.cx-di span { font-size: 9px; color: var(--muted); }
.cx-di:hover { background: color-mix(in srgb, var(--amber) 9%, transparent); }
.cx-di:hover b { color: var(--amber-bright); }
.cx-cv { height: 380px; }

.mcx-modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; }
.mcx-back { position: absolute; inset: 0; background: rgba(5,7,9,.72); backdrop-filter: blur(2px); animation: mrdFade .16s ease; }
.mcx-box {
  position: relative; width: min(880px, 94vw); max-height: 86vh; display: flex; flex-direction: column;
  background: var(--ink-2); border: 1px solid color-mix(in srgb, var(--amber) 30%, var(--hairline));
  border-radius: 6px; box-shadow: 0 40px 90px -30px rgba(0,0,0,.9);
  animation: mrdPalIn .18s cubic-bezier(.2,.7,.3,1);
}
.mcx-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--hairline); }
.mcx-head span { font-size: 10px; letter-spacing: .14em; color: var(--amber-bright); }
.mcx-x { color: var(--muted); font-size: 18px; line-height: 1; padding: 0 4px; }
.mcx-x:hover { color: var(--fg); }
.mcx-body { overflow-y: auto; padding: 6px 16px 16px; }

/* ── Watchlist add box + taller zoomable FII/DII chart ── */
.wl-add { padding: 8px 0 4px; }
.wl-add .cx-search { flex: none; width: 100%; }
.mc-fii-cvwrap { flex: 1; min-height: 230px; cursor: crosshair; }
#mcFiiCv { width: 100%; height: 100%; min-height: 230px; display: block; }

/* ── Market Intelligence: consistent panel rhythm + chart canvases inset from
      the panel edge so axis labels never touch the frame ── */
#tab-markets .mc { gap: 16px; }
#tab-markets .mc-panel { padding: 14px 16px 16px; }
.mc-cvwrap { padding: 2px 4px 0; }
.cx-cv, .mc-cv { padding-right: 2px; }
.mc-fii-cvwrap { padding: 2px 2px 0; }
/* the chart-analysis station gets a touch more breathing room on the right */
#miPriceChart .cx { padding-right: 2px; }

/* ── Watchlist column header (matches the flex proportions of .wl-row) ── */
.wl-head {
  display: flex; align-items: center; gap: 10px; padding: 6px 14px;
  font-size: 8.5px; letter-spacing: .14em; color: var(--muted-ink);
  border-bottom: 1px solid var(--hairline); text-transform: uppercase;
}
.wl-head > span:first-child { flex: 1; min-width: 0; }        /* Symbol — shares .wl-open flex:1 */
.wl-head > span:nth-child(2) { display: none; }               /* Name label folded into the Symbol column on this width */
.wl-head .wl-h-px { min-width: 84px; text-align: right; padding: 1px 4px; }
.wl-head .wl-h-chg { min-width: 64px; text-align: right; }
.wl-head .wl-h-x { width: 14px; }

/* ════════════════════════════════════════════════════════════════════════
   EARNINGS CALL — schedule + recent calls (50/50) and analysis input
   ════════════════════════════════════════════════════════════════════════ */
.ec-page { display: flex; flex-direction: column; gap: 14px; }
.ec-loadbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  border: 1px solid var(--hairline); background: var(--ink-2); border-radius: var(--r); padding: 10px 14px; }
.ec-loadbar-in { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 260px; }
.ec-slash { color: var(--amber); font-size: 16px; }
.ec-loadbar-in input { flex: 1; background: var(--ink); border: 1px solid var(--hairline); color: var(--fg);
  padding: 9px 12px; font-family: var(--mono); font-size: 12.5px; border-radius: var(--r-sm); text-transform: uppercase; }
.ec-loadbar-in input::placeholder { text-transform: none; color: var(--muted-ink); }

/* 50/50 core grid — both columns stretch to equal height, no trailing gap */
.ec-core { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: stretch; }
@media (max-width: 960px) { .ec-core { grid-template-columns: 1fr; } }
.ec-core-empty { grid-column: 1 / -1; padding: 34px; text-align: center; }
.ec-panel { border: 1px solid var(--hairline); background: var(--ink-2); border-radius: var(--r);
  display: flex; flex-direction: column; min-width: 0; }
.ec-ph { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 11px 15px;
  border-bottom: 1px solid var(--hairline); }
.ec-ph h4 { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--fg); }
.ec-ph .ec-ph-sub { font-family: var(--mono); font-size: 10px; color: var(--muted-ink); }
.ec-pbody { padding: 14px 15px; display: flex; flex-direction: column; gap: 13px; flex: 1; }

/* recent-calls stat chips */
.ec-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ec-stat { border: 1px solid var(--hairline); border-radius: var(--r-sm); padding: 8px 10px; background: var(--ink); }
.ec-stat .l { font-size: 8.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-ink); }
.ec-stat .v { font-family: var(--mono); font-size: 17px; font-weight: 700; margin-top: 3px; }

/* surprise bar chart */
.ec-surp { display: flex; align-items: flex-end; gap: 6px; height: 70px; padding-top: 6px; }
.ec-surp-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 3px; min-width: 0; }
.ec-surp-bar { width: 68%; min-height: 2px; border-radius: 2px 2px 0 0; }
.ec-surp-bar.up { background: var(--up); } .ec-surp-bar.down { background: var(--down); }
.ec-surp-x { font-family: var(--mono); font-size: 8px; color: var(--muted-ink); white-space: nowrap; }

/* tables shared in the earnings panels */
.ec-tbl { width: 100%; border-collapse: collapse; font-size: 11px; }
.ec-tbl th { font-size: 8.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-ink);
  text-align: right; padding: 5px 6px; border-bottom: 1px solid var(--hairline); font-weight: 600; }
.ec-tbl th:first-child, .ec-tbl td:first-child { text-align: left; }
.ec-tbl td { font-family: var(--mono); padding: 6px; border-bottom: 1px solid rgba(255,255,255,.04); text-align: right; }
.ec-tbl tr:last-child td { border-bottom: 0; }
.ec-tbl .ec-mini-link { color: var(--amber); text-decoration: none; }
.ec-tbl .ec-mini-link:hover { color: var(--amber-bright); }

/* schedule: next-call hero */
.ec-next { border: 1px solid rgba(200,134,42,.30); background: rgba(200,134,42,.06); border-radius: var(--r); padding: 13px 15px; }
.ec-next-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.ec-next-date { font-size: 20px; font-weight: 700; color: var(--amber-bright); }
.ec-next-cd { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.ec-next-tag { font-size: 8.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-ink); margin-top: 2px; }
.ec-next-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 11px; }
.ec-next-cell .l { font-size: 8.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-ink); }
.ec-next-cell .v { font-family: var(--mono); font-size: 14px; font-weight: 600; margin-top: 2px; }

/* transcript / IR links */
.ec-links { display: flex; flex-wrap: wrap; gap: 7px; }
.ec-link { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--hairline); background: var(--ink); color: var(--fg); text-decoration: none; }
.ec-link:hover { border-color: var(--amber); color: var(--amber-bright); }
.ec-lbl { font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-ink); margin-bottom: 2px; }

/* analysis input panel */
.ec-analysis { border: 1px solid var(--hairline); background: var(--ink-2); border-radius: var(--r); }
.ec-an-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--hairline); }
.ec-an-head h3 { font-size: 12px; letter-spacing: .12em; }
.ec-inpanel { padding: 14px 16px; border-bottom: 1px solid var(--hairline); }
.ec-tabs { display: inline-flex; gap: 4px; background: var(--ink); border: 1px solid var(--hairline); border-radius: var(--r-sm); padding: 3px; margin-bottom: 10px; }
.ec-tab { font-size: 11px; padding: 6px 14px; border-radius: 4px; color: var(--muted); }
.ec-tab.active { background: rgba(200,134,42,.14); color: var(--amber-bright); }
#ecPaste { width: 100%; height: 190px; background: var(--ink); border: 1px solid var(--hairline); color: var(--fg);
  padding: 10px; font-family: var(--mono); font-size: 11px; line-height: 1.5; resize: vertical; border-radius: var(--r-sm); }
.ec-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  height: 190px; border: 1.5px dashed var(--hairline); border-radius: var(--r-sm); background: var(--ink); cursor: pointer; transition: border-color .15s, background .15s; }
.ec-drop:hover, .ec-drop.drag { border-color: var(--amber); background: rgba(200,134,42,.05); }
.ec-drop-ic { font-size: 26px; color: var(--amber); }
.ec-drop-t { font-size: 12px; color: var(--fg); }
.ec-drop-s { font-size: 10px; color: var(--muted-ink); }
.ec-drop-file { font-size: 11px; color: var(--amber-bright); margin-top: 4px; }
.ec-btnrow { display: flex; gap: 8px; margin-top: 10px; }
.ec-btnrow .btn-amber { flex: 1; }
.ec-btnrow #ecDocx { flex: 0 0 auto; background: var(--ink); border: 1px solid var(--hairline); color: var(--fg); }
.ec-btnrow #ecDocx:hover { border-color: var(--amber); color: var(--amber-bright); }
.ec-an-note { font-size: 10px; color: var(--muted-ink); line-height: 1.6; margin-top: 10px; }
#ecOut { padding: 16px; }

/* PDF / analysis progress animation */
.ec-anim { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 54px 20px; }
.ec-anim-ring { width: 60px; height: 60px; border-radius: 50%; border: 3px solid var(--hairline); border-top-color: var(--amber);
  animation: ec-spin .8s linear infinite; }
@keyframes ec-spin { to { transform: rotate(360deg); } }
.ec-anim-steps { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 380px; }
.ec-anim-step { display: flex; align-items: center; gap: 10px; font-size: 11.5px; color: var(--muted-ink); transition: color .3s; }
.ec-anim-step.done { color: var(--up); } .ec-anim-step.active { color: var(--amber-bright); }
.ec-anim-step .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--hairline); flex: 0 0 auto; }
.ec-anim-step.done .dot { background: var(--up); } .ec-anim-step.active .dot { background: var(--amber-bright); animation: ec-pulse 1s ease-in-out infinite; }
@keyframes ec-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.ec-anim-bar { width: 100%; max-width: 380px; height: 4px; background: var(--hairline); border-radius: 2px; overflow: hidden; }
.ec-anim-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--amber), var(--amber-bright)); width: 0; transition: width .4s ease; }

/* AI institutional report (.ecr) */
.ecr-badge { display: inline-block; font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--amber-bright);
  border: 1px solid rgba(200,134,42,.4); background: rgba(200,134,42,.08); border-radius: 999px; padding: 4px 12px; margin-bottom: 14px; }
.ecr { display: flex; flex-direction: column; gap: 16px; }
.ecr-sec { border: 1px solid var(--hairline); background: var(--ink-2); border-radius: var(--r); padding: 13px 15px; }
.ecr-sec > h4 { font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--amber-bright); margin-bottom: 10px; }
.ecr-sec p { font-size: 12px; line-height: 1.6; color: var(--fg); margin: 0 0 8px; }
.ecr-sec ul, .ecr-sec ol { margin: 4px 0 8px 18px; }
.ecr-sec li { font-size: 12px; line-height: 1.55; color: var(--fg); margin-bottom: 4px; }
.ecr-t { width: 100%; border-collapse: collapse; font-size: 11px; margin: 4px 0; }
.ecr-t th { font-size: 8.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-ink); text-align: left; padding: 5px 7px; border-bottom: 1px solid var(--hairline); }
.ecr-t td { padding: 6px 7px; border-bottom: 1px solid rgba(255,255,255,.05); color: var(--fg); vertical-align: top; }
.ecr-t tr:last-child td { border-bottom: 0; }
.ecr-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 9px; margin: 4px 0; }
.ecr-card { border: 1px solid var(--hairline); background: var(--ink); border-radius: var(--r-sm); padding: 9px 11px; }
.ecr-card b, .ecr-card strong { display: block; font-family: var(--mono); font-size: 16px; color: var(--fg); }
.ecr-bar { height: 6px; background: var(--hairline); border-radius: 3px; overflow: hidden; margin: 5px 0; }
.ecr-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--amber), var(--amber-bright)); }
.ecr-tag { display: inline-block; font-size: 9.5px; letter-spacing: .04em; text-transform: uppercase; padding: 2px 7px; border-radius: 3px; border: 1px solid var(--hairline); }
.ecr-tag.up { color: var(--up); border-color: rgba(46,158,107,.4); background: rgba(46,158,107,.08); }
.ecr-tag.down { color: var(--down); border-color: rgba(200,75,60,.4); background: rgba(200,75,60,.08); }
.ecr-tag.mid { color: var(--amber-bright); border-color: rgba(200,134,42,.4); background: rgba(200,134,42,.08); }
.ecr-ev { font-family: var(--mono); font-size: 9.5px; color: var(--muted-ink); }
.ecr-src { font-style: normal; font-size: 9.5px; letter-spacing: .03em; color: var(--muted-ink); background: var(--ink); border: 1px solid var(--hairline); border-radius: 3px; padding: 1px 5px; margin-right: 4px; }
.ecr-det { border-top: 1px dashed var(--hairline); margin-top: 6px; }

/* ════════ deterministic earnings dashboard (.ecd) ════════ */
.ecd { display: flex; flex-direction: column; gap: 14px; }
.ecd-sec { border: 1px solid var(--hairline); background: var(--ink-2); border-radius: var(--r); overflow: hidden; }
.ecd-h { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--hairline); background: rgba(200,134,42,.05); }
.ecd-n { flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; background: var(--amber); color: var(--ink); font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.ecd-h h4 { font-size: 12px; font-weight: 700; letter-spacing: .1em; color: var(--fg); }
.ecd-sub { margin-left: auto; font-family: var(--mono); font-size: 10px; color: var(--muted-ink); }
.ecd-body { padding: 14px; }
.ecd-grid { display: grid; gap: 18px; align-items: start; }
.ecd-2c { grid-template-columns: 1fr 1fr; }
@media (max-width: 820px) { .ecd-2c { grid-template-columns: 1fr; } }
.ecd-lbl { font-size: 9px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-ink); margin-bottom: 8px; }
.ecd-lbl.up-l { color: var(--up); } .ecd-lbl.down-l { color: var(--down); }

.ecd-assess { border: 1px solid var(--hairline); border-radius: var(--r-sm); padding: 13px 15px; background: var(--ink); }
.ecd-assess.up { border-color: rgba(46,158,107,.4); background: rgba(46,158,107,.06); }
.ecd-assess.down { border-color: rgba(200,75,60,.4); background: rgba(200,75,60,.06); }
.ecd-assess.mid { border-color: rgba(200,134,42,.4); background: rgba(200,134,42,.06); }
.ecd-assess-l { font-size: 9px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-ink); }
.ecd-assess-v { font-size: 24px; font-weight: 800; color: var(--fg); line-height: 1.1; margin: 2px 0; }
.ecd-assess.up .ecd-assess-v { color: var(--up); } .ecd-assess.down .ecd-assess-v { color: var(--down); } .ecd-assess.mid .ecd-assess-v { color: var(--amber-bright); }
.ecd-assess-m { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.ecd-mini { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; padding: 4px 0; border-top: 1px solid rgba(255,255,255,.05); }
.ecd-mini span { color: var(--muted); } .ecd-mini b { font-family: var(--mono); color: var(--fg); }
.ecd-mini2 { font-size: 10.5px; color: var(--muted-ink); line-height: 1.5; margin-top: 3px; max-width: 60ch; }

.ecd-t { width: 100%; border-collapse: collapse; font-size: 11px; }
.ecd-t th { font-size: 8.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-ink); text-align: left; padding: 5px 7px; border-bottom: 1px solid var(--hairline); font-weight: 600; }
.ecd-t td { padding: 6px 7px; border-bottom: 1px solid rgba(255,255,255,.05); color: var(--fg); vertical-align: top; line-height: 1.45; }
.ecd-t tr:last-child td { border-bottom: 0; }
.ecd-t td.b { font-weight: 700; } .ecd-t td.mono { font-family: var(--mono); }
.ecd-note { color: var(--muted); font-size: 10.5px; }
.ecd-src { font-size: 8px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-ink); border: 1px solid var(--hairline); border-radius: 3px; padding: 0 4px; }

.ecd-bar { height: 6px; background: var(--hairline); border-radius: 3px; overflow: hidden; display: inline-block; width: 100%; vertical-align: middle; }
.ecd-bar i { display: block; height: 100%; border-radius: 3px; }
.ecd-score { display: grid; grid-template-columns: 150px 1fr 30px; align-items: center; gap: 10px; margin-bottom: 8px; }
.ecd-score-l { font-size: 11px; color: var(--fg); white-space: nowrap; }
.ecd-score-v { font-family: var(--mono); font-size: 11px; color: var(--fg); text-align: right; }
.ecd-conf { font-family: var(--mono); font-size: 9.5px; color: var(--muted); margin-left: 6px; }

.ecd-check { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.ecd-check li { position: relative; padding-left: 18px; font-size: 11.5px; line-height: 1.5; color: var(--fg); }
.ecd-check li::before { content: "✓"; position: absolute; left: 0; top: 0; font-size: 11px; color: var(--up); font-weight: 700; }
.ecd-check.neg li::before { content: "!"; color: var(--down); }
.ecd-quotes { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.ecd-quotes li { font-size: 11.5px; line-height: 1.5; color: var(--fg); border-left: 2px solid var(--amber); padding-left: 10px; font-style: italic; }
.ecd-qs { display: block; font-style: normal; font-size: 10px; color: var(--muted-ink); margin-top: 2px; }

.ecd-line { width: 100%; max-width: 480px; height: auto; display: block; }
.ecd-scatter { width: 100%; max-width: 480px; height: auto; display: block; }
.ecd-rn { color: var(--muted-ink); text-align: center; }
/* full-width tone scorecard (2 columns) below sentiment/messages */
.ecd-scorecard { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 28px; }
@media (max-width: 700px) { .ecd-scorecard { grid-template-columns: 1fr; } }
.ecd-qtag { display: inline-block; font-size: 8px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-ink); border: 1px solid var(--hairline); border-radius: 3px; padding: 0 4px; margin-right: 6px; vertical-align: middle; font-style: normal; }
.ecd-quotes li.q-pos { border-left-color: var(--up); }
.ecd-quotes li.q-neg { border-left-color: var(--down); }
/* give the risk heat-map its extra width vs the details table */
.ecd-risk2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 820px) { .ecd-risk2 { grid-template-columns: 1fr; } }
.ecd-risknotes { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.ecd-risknotes li { font-size: 10.5px; line-height: 1.5; color: var(--muted); padding-left: 10px; border-left: 2px solid var(--hairline); }
.ecd-risknotes li b { color: var(--fg); }
.ecd-gauge { text-align: right; min-width: 130px; }
.ecd-gauge-v { font-family: var(--mono); font-size: 26px; font-weight: 800; line-height: 1; margin-bottom: 6px; }
.ecd-gauge-v small { font-size: 13px; color: var(--muted); }
.ecd-momentum { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--hairline); }
.ecd-disc { font-size: 10px; color: var(--muted-ink); line-height: 1.6; padding: 4px 2px; }

/* ════ EARNINGS CALL — structured initial state (v67 polish) ════
   The empty tab now reads as a workflow: a 3-step strip where the data
   panels will appear, and a balanced input row with the report contents
   listed beside the transcript input instead of floating hint sentences. */
.ec-start {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--hairline);
  border: 1px solid var(--hairline); border-radius: var(--r); overflow: hidden;
}
.ec-start-step { background: var(--ink-2); padding: 20px 22px; display: flex; gap: 14px; align-items: flex-start; }
.ec-start-step .n { font-size: 22px; color: var(--amber); line-height: 1; padding-top: 1px; }
.ec-start-step h4 { font-size: 11px; letter-spacing: .12em; color: var(--fg); margin-bottom: 6px; }
.ec-start-step p { font-size: 11px; color: var(--muted-ink); line-height: 1.6; }
@media (max-width: 960px) { .ec-start { grid-template-columns: 1fr; } }

/* input row: transcript input (left) · report contents (right) */
.ec-inrow { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
@media (max-width: 960px) { .ec-inrow { grid-template-columns: 1fr; } }
.ec-includes { border: 1px solid var(--hairline); border-radius: var(--r-sm); background: var(--ink); padding: 12px 14px 10px; display: flex; flex-direction: column; }
.ec-includes-t { font-size: 10px; letter-spacing: .16em; color: var(--muted); margin-bottom: 6px; }
.ec-includes ul { list-style: none; margin: 0; padding: 0; flex: 1; }
.ec-includes li { font-size: 10.5px; color: var(--muted-ink); line-height: 1.5; padding: 4px 0 4px 15px; position: relative; border-bottom: 1px dashed rgba(138,147,160,.14); }
.ec-includes li:last-child { border-bottom: 0; }
.ec-includes li::before { content: "▸"; position: absolute; left: 0; top: 4px; color: var(--amber); font-size: 9px; }
.ec-includes-foot { font-size: 8.5px; letter-spacing: .1em; color: var(--muted); border-top: 1px solid var(--hairline); padding-top: 8px; margin-top: 8px; }

/* balanced controls: the primary action no longer spans the full panel */
.ec-btnrow .btn-amber { flex: 0 0 auto; padding: 9px 28px; }
#ecPaste { height: 150px; }
.ec-drop { height: 150px; }

/* the report area only takes space once there is a report */
.ec-inpanel { border-bottom: 0; }
#ecOut:empty { display: none; }
#ecOut:not(:empty) { border-top: 1px solid var(--hairline); }

/* ════════════════════════════════════════════════════════════════════════════
   UNIFIED CONTROL SYSTEM  (v67)
   One design language for every input, select, textarea and button in the
   terminal — so a control looks identical on desktop Chrome, Android Chrome
   and iOS Safari instead of inheriting each platform's native widget chrome.

   Two rules make that possible:
     · appearance:none everywhere — Android/iOS stop drawing their own field
       backgrounds, bevels, dropdown arrows and inner shadows.
     · one font-size token — controls no longer scale with viewport width, so
       a filter on a phone is the same size as a filter on a desktop.
   ════════════════════════════════════════════════════════════════════════════ */
:root {
  --ctl-h: 34px;            /* standard control height */
  --ctl-h-sm: 28px;         /* compact (in-panel tools, mini buttons) */
  --ctl-fs: 12px;           /* the ONE control font-size — never viewport-scaled */
  --ctl-fs-sm: 11px;
  --ctl-px: 11px;           /* horizontal padding */
  --ctl-ring: 0 0 0 3px color-mix(in srgb, var(--amber) 16%, transparent);
}

/* ── strip native platform chrome ── */
.tcmd input, .panel-tools input, .panel-tools select,
input[type="text"], input[type="search"], input[type="number"],
input[type="email"], input[type="tel"], input:not([type]),
select, textarea, button, .btn, .mini-btn {
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  font-family: var(--mono);
}
/* number spinners: hidden globally (they break the mono grid on touch) */
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
/* iOS renders search fields with its own cancel affordance + rounding */
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }

/* ── fields: text inputs, selects, textareas ── */
input[type="text"], input[type="search"], input[type="number"],
input[type="email"], input[type="tel"], input:not([type]),
select, textarea {
  height: var(--ctl-h);
  padding: 0 var(--ctl-px);
  background: var(--ink);
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  color: var(--fg);
  font-size: var(--ctl-fs);
  line-height: calc(var(--ctl-h) - 2px);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
textarea { height: auto; padding: 9px var(--ctl-px); line-height: 1.6; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted-ink); }
input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover:not(:disabled) { border-color: color-mix(in srgb, var(--amber) 40%, var(--hairline)); }
input:focus, select:focus, textarea:focus {
  /* background-COLOR, not the `background` shorthand: the shorthand also
     resets background-repeat/size/position, which would leave the select
     chevron (and the search magnifier) tiling across the whole field on
     focus. Only the colour should change here. */
  outline: none; border-color: var(--amber); background-color: var(--ink-2);
  box-shadow: var(--ctl-ring);
}
input:disabled, select:disabled, textarea:disabled { opacity: .5; cursor: not-allowed; }

/* ── selects: our own chevron, since the native one is gone ── */
select {
  padding-right: 28px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%238a93a0' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 11px;
}
select:focus, select:hover {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23e8a33d' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
/* the dropdown list itself is OS-drawn — at least keep it dark */
select option { background: var(--ink-2); color: var(--fg); }

/* ── search fields in panel tools: magnifier glyph inside the field ── */
.panel-tools input[type="text"], .panel-tools input[type="search"],
.panel-tools input:not([type]), input.ctl-search {
  padding-left: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='6.8' cy='6.8' r='4.6' fill='none' stroke='%238a93a0' stroke-width='1.5'/%3E%3Cpath d='M10.4 10.4 14 14' stroke='%238a93a0' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 9px center;
  background-size: 13px;
}
.panel-tools input:focus {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='6.8' cy='6.8' r='4.6' fill='none' stroke='%23e8a33d' stroke-width='1.5'/%3E%3Cpath d='M10.4 10.4 14 14' stroke='%23e8a33d' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
}
.panel-tools { gap: 8px; flex-wrap: wrap; }
.panel-tools input, .panel-tools select { height: var(--ctl-h-sm); font-size: var(--ctl-fs-sm); line-height: calc(var(--ctl-h-sm) - 2px); }
.panel-tools select { padding-right: 26px; background-position: right 8px center; }

/* ── buttons: one shape, three weights ── */
.btn, .btn-amber, .mini-btn, button.ctl {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: var(--ctl-h); padding: 0 18px;
  border-radius: var(--r-sm);
  font-size: var(--ctl-fs); font-weight: 600; letter-spacing: .02em;
  cursor: pointer; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .12s ease;
}
.btn { background: var(--ink-3); border: 1px solid var(--hairline); color: var(--fg); }
.btn:hover:not(:disabled) { border-color: var(--amber); color: var(--amber-bright); background: var(--ink-2); }
.btn-amber { background: var(--amber); border: 1px solid var(--amber); color: var(--ink); }
.btn-amber:hover:not(:disabled) { background: var(--amber-bright); border-color: var(--amber-bright); }
.mini-btn { height: var(--ctl-h-sm); padding: 0 12px; font-size: var(--ctl-fs-sm); font-weight: 500;
  background: var(--ink-3); border: 1px solid var(--hairline); color: var(--muted); }
.mini-btn:hover:not(:disabled) { background: var(--ink-2); border-color: var(--amber); color: var(--amber-bright); }
/* press feedback replaces the tap-highlight we removed */
.btn:active:not(:disabled), .btn-amber:active:not(:disabled), .mini-btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled, .btn-amber:disabled, .mini-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.active, .mini-btn.active { border-color: var(--amber); color: var(--amber-bright); background: color-mix(in srgb, var(--amber) 12%, var(--ink-3)); }

@media (prefers-reduced-motion: reduce) {
  .btn, .btn-amber, .mini-btn, input, select, textarea { transition: none; }
  .btn:active, .btn-amber:active, .mini-btn:active { transform: none; }
}

/* ── exemptions: controls that are deliberately bare inside a styled shell.
   These come AFTER the block above so they win on source order, keeping
   their bespoke look while still benefiting from appearance:none. ── */
.tcmd input, .peer-search input {
  height: auto; padding: 0; border: none; background: none; box-shadow: none;
  border-radius: 0; line-height: normal;
}
.tcmd input:focus, .peer-search input:focus { border: none; background: none; box-shadow: none; }
/* the shell owns the height on mobile too, so the bar never grows */
.tcmd { height: var(--ctl-h); }
.peer-search input { font-size: 11.5px; }

/* compact grid/inline editors keep their own tighter metrics */
.ap-input, .ape-cell-input, .scn-add input, .txn-add input, .txn-add select {
  height: auto; line-height: normal;
}
.ape-cell-input { padding: 0; }

/* ── chevron/magnifier re-application at panel specificity.
   Pre-existing rules like `.panel-tools select` use the `background`
   SHORTHAND, which resets background-image to none and outranks a bare
   `select` selector. Tokenising the glyphs and restating them at equal
   specificity keeps every select looking the same wherever it lives. ── */
:root {
  --ctl-chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%238a93a0' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --ctl-chev-on: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23e8a33d' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
select, .panel-tools select, .report-controls select, .txn-add select {
  background-image: var(--ctl-chev);
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 11px;
  padding-right: 28px;
}
select:hover, select:focus,
.panel-tools select:hover, .panel-tools select:focus,
.report-controls select:hover, .report-controls select:focus,
.txn-add select:hover, .txn-add select:focus { background-image: var(--ctl-chev-on); }

/* the top-bar search shell tracks the control token on every viewport */
.tbar > .tcmd, .tcmd { height: var(--ctl-h); }

/* ── tab-bar overflow arrows (sticky inside the scrolling bar) ── */
.ttabs .ttabs-arrow {
  position: sticky; z-index: 2; flex: 0 0 auto; display: none;
  width: 34px; padding: 0; border: 0; font-size: 18px; line-height: 1;
  color: var(--amber-bright); cursor: pointer;
}
.ttabs .ttabs-arrow.show { display: block; }
.ttabs .ttabs-arrow.l { left: 0; background: linear-gradient(90deg, var(--ink-2) 62%, transparent); }
.ttabs .ttabs-arrow.r { right: 0; margin-left: auto; background: linear-gradient(270deg, var(--ink-2) 62%, transparent); }
.ttabs .ttabs-arrow:hover { color: var(--fg); background-color: transparent; }

/* ── select hardening (final word — loaded rules above and mobile.css below
   cannot break these). Two recurring bugs came from module rules such as
   `.pfs-menu-select`, `.pf-addpop-select`, `.ape-select`, `.report-controls
   select` that use the `background:` SHORTHAND and vertical padding:
     1. the shorthand resets background-repeat → on hover/focus the chevron
        image tiled across the whole field (and at rest it vanished);
     2. vertical padding + the tall control line-height left less room than
        the line box → the option text was pushed down and clipped.
   Selects centre their own text, so vertical padding is never needed. ── */
select, select:hover, select:focus {
  background-repeat: no-repeat !important;
  background-position: right 9px center !important;
  background-size: 11px !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  padding-right: 28px !important;
  line-height: normal !important;
}
select { background-image: var(--ctl-chev) !important; min-height: var(--ctl-h-sm); }
select:hover, select:focus { background-image: var(--ctl-chev-on) !important; }
/* height:auto selects would collapse to text height without their padding */
.txn-add select { height: var(--ctl-h-sm); }

/* ════════════════════════════════════════════════════════════════════════════
   MARKET INTELLIGENCE — grid redesign
   One 12-column grid; panels in a row stretch to the same height and their
   bodies grow to fill it (tables distribute rows, card grids use 1fr rows),
   so every row closes flush with no dead space under shorter panels.
   Everything is scoped to #tab-markets so other tabs are untouched.
   ════════════════════════════════════════════════════════════════════════════ */
#tab-markets .mi-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; align-items: stretch; }
#tab-markets .s12 { grid-column: span 12; } #tab-markets .s9 { grid-column: span 9; }
#tab-markets .s6 { grid-column: span 6; }   #tab-markets .s4 { grid-column: span 4; }
#tab-markets .s3 { grid-column: span 3; }
#tab-markets .mi-p { display: flex; flex-direction: column; min-width: 0; margin: 0; border-radius: 6px; overflow: hidden; }
#tab-markets .mi-p > .panel-h { flex: 0 0 auto; flex-wrap: nowrap; min-height: 44px; padding: 9px 14px; gap: 10px; }
#tab-markets .mi-p > .panel-h h3 { display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
#tab-markets .mi-p > .panel-h > .panel-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; text-align: right; }
#tab-markets .mi-ic { width: 14px; height: 14px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#tab-markets .mi-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: 0 0 auto; }
#tab-markets .mi-tools .panel-sub { white-space: nowrap; }
#tab-markets .mi-tools select { height: var(--ctl-h-sm); font-size: var(--ctl-fs-sm); min-width: 64px; }
#tab-markets .panel-h .mc-tf .mc-tfb { padding: 4px 9px; }
#tab-markets .mi-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
#tab-markets .mi-body > .loading, #tab-markets .mi-body > .empty-mini { margin: auto; padding: 18px; text-align: center; }
/* tables grow to fill the panel: extra height is shared across the rows */
#tab-markets .mi-body > .table-wrap { flex: 1 1 auto; overflow: auto; }
#tab-markets .mi-t { width: 100%; height: 100%; }
#tab-markets .mi-t th, #tab-markets .mi-t td { padding: 6px 10px; white-space: nowrap; }
#tab-markets .mi-t th { position: sticky; top: 0; background: var(--ink-2); z-index: 1; }
#tab-markets .mi-sp, #tab-markets .mi-sp-h { width: 92px; }
#tab-markets .mi-sp .mc-spark { width: 84px; height: 20px; margin-left: auto; }
#tab-markets .mi-foot { flex: 0 0 auto; margin: 0; padding: 8px 14px 10px; border-top: 1px solid color-mix(in srgb, var(--hairline) 60%, transparent); }
#tab-markets details.mi-more { flex: 0 0 auto; border-top: 1px solid color-mix(in srgb, var(--hairline) 60%, transparent); padding: 7px 14px; }
#tab-markets details.mi-more > summary { cursor: pointer; font-size: 9.5px; letter-spacing: .1em; color: var(--muted-ink); list-style: none; }
#tab-markets details.mi-more > summary::before { content: "▸ "; }
#tab-markets details.mi-more[open] > summary::before { content: "▾ "; }
#tab-markets details.mi-more > summary:hover { color: var(--amber-bright); }
#tab-markets details.mi-more .mc-note, #tab-markets details.mi-more .idcf-note { padding: 6px 0 2px; margin: 0; }

/* ── chart analysis: chart left, 12-metric grid right ── */
#tab-markets #miPriceChart { padding: 12px 14px 10px; }
#tab-markets .mi-cx-body { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 14px; align-items: stretch; }
#tab-markets .mi-cx-main { min-width: 0; display: flex; flex-direction: column; }
#tab-markets .mi-cx-stats { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; gap: 1px; background: var(--hairline); border: 1px solid var(--hairline); border-radius: 4px; overflow: hidden; }
#tab-markets .mi-st { background: var(--ink-2); padding: 10px 12px; display: flex; flex-direction: column; justify-content: center; gap: 4px; min-width: 0; }
#tab-markets .mi-st small { font-family: var(--mono); font-size: 8.5px; letter-spacing: .12em; color: var(--muted-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tab-markets .mi-st b { font-family: var(--mono); font-size: 15px; font-weight: 600; color: var(--fg); white-space: nowrap; }
#tab-markets .mi-st b.up { color: var(--up); } #tab-markets .mi-st b.down { color: var(--down); }
#tab-markets .cx-ctl { flex-wrap: wrap; }
#tab-markets .mi-fs { margin-left: auto; }
#tab-markets .mi-cx-hint { display: block; text-align: right; margin: 2px 0 0; }
#tab-markets #cxNote { padding: 8px 0 0; }
#miChartPanel:fullscreen { background: var(--ink); padding: 16px; overflow: auto; }

/* ── global tape: cards with sparkline ── */
#tab-markets #tape { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); grid-auto-rows: 1fr; gap: 1px; background: var(--hairline); flex: 1 1 auto; }
#tab-markets .mi-tc { background: var(--ink-2); border: 0; text-align: left; padding: 10px 14px; display: flex; flex-direction: column; justify-content: space-between; gap: 3px; cursor: pointer; color: inherit; font: inherit; min-width: 0; }
#tab-markets .mi-tc:hover { background: color-mix(in srgb, var(--amber) 5%, var(--ink-2)); }
#tab-markets .mi-tc .tl, #tab-markets .mi-tc .tp { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tab-markets .mi-tc-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
#tab-markets .mi-tc .mc-spark { width: 72px; height: 24px; flex: 0 1 auto; }

/* ── market breadth ── */
#tab-markets #breadth { padding: 12px 14px; justify-content: space-between; gap: 6px; }
#tab-markets .mi-adbar { margin: 0 0 4px; height: 9px; border-radius: 2px; overflow: hidden; }
#tab-markets .mi-br-row { display: grid; grid-template-columns: 12px 1fr auto 58px; align-items: center; gap: 8px; font-size: 12px; }
#tab-markets .mi-br-row .bl { color: var(--muted); }
#tab-markets .mi-br-row .bv { font-family: var(--mono); font-weight: 600; text-align: right; }
#tab-markets .mi-br-pc { text-align: right; color: var(--muted-ink); font-size: 11px; }
#tab-markets .mi-dot { width: 9px; height: 9px; border-radius: 50%; }
#tab-markets .mi-dot.a { background: var(--up); } #tab-markets .mi-dot.d { background: var(--down); } #tab-markets .mi-dot.u { background: var(--muted-ink); }
#tab-markets .mi-br-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--hairline); border: 1px solid var(--hairline); margin-top: 4px; }
#tab-markets .mi-br-grid > div { background: var(--ink-2); padding: 6px 8px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
#tab-markets .mi-br-grid small { font-family: var(--mono); font-size: 7.5px; letter-spacing: .1em; color: var(--muted-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tab-markets .mi-br-grid b { font-family: var(--mono); font-size: 12.5px; }

/* ── sector heatmap: 4 × 3 tiles that fill the panel ── */
#tab-markets #heatmap { display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: minmax(66px, 1fr); gap: 4px; padding: 10px; }
#tab-markets .hm-cell { border: 1px solid rgba(255,255,255,.05); border-radius: 4px; padding: 9px 11px; display: flex; flex-direction: column; justify-content: space-between; text-align: left; cursor: pointer; color: var(--fg); font: inherit; min-width: 0; }
#tab-markets .hm-cell:hover { border-color: var(--amber); }
#tab-markets .hm-cell .hl { font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tab-markets .hm-cell .hp { font-family: var(--mono); font-size: 15px; font-weight: 700; color: #fff; }
#tab-markets .hm-cell .hv { font-family: var(--mono); font-size: 10px; color: rgba(255,255,255,.7); }

/* ── cross-asset matrix ── */
#tab-markets .mi-mx-edit { display: flex; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--hairline); }
#tab-markets .mi-mx-edit[hidden] { display: none; }
#tab-markets .mi-mx-edit input { flex: 1; min-width: 0; height: var(--ctl-h-sm); font-size: var(--ctl-fs-sm); }
#tab-markets #matrix { padding: 10px; overflow: auto; }
#tab-markets .mi-mx { width: 100%; height: 100%; margin: 0; border-collapse: collapse; table-layout: fixed; }
#tab-markets .mi-mx th, #tab-markets .mi-mx td { padding: 5px 4px; text-align: center; font-family: var(--mono); font-size: 11px; border: 1px solid color-mix(in srgb, var(--hairline) 70%, transparent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tab-markets .mi-mx th { color: var(--muted); font-size: 10px; font-weight: 500; background: var(--ink-2); }

/* ── watchlist: symbol · price · chg · sparkline ── */
#tab-markets .wl-add { flex: 0 0 auto; padding: 8px 14px; border-bottom: 1px solid var(--hairline); }
#tab-markets .wl-add input { width: 100%; }
#tab-markets #watchList { overflow: auto; max-height: 360px; }
#tab-markets .wl-head, #tab-markets .wl-row { display: grid; grid-template-columns: minmax(0, 1fr) 92px 70px 76px 22px; align-items: center; gap: 8px; padding: 6px 14px; }
#tab-markets .wl-head { position: sticky; top: 0; background: var(--ink-2); z-index: 1; font-size: 9px; letter-spacing: .1em; color: var(--muted-ink); border-bottom: 1px solid var(--hairline); }
#tab-markets .wl-head > span:nth-child(2) { display: none; }
#tab-markets .wl-head .wl-h-px, #tab-markets .wl-head .wl-h-chg { min-width: 0; text-align: right; padding: 0; }
#tab-markets .wl-row .wl-open { display: flex; align-items: baseline; gap: 8px; min-width: 0; text-align: left; }
#tab-markets .wl-row .wl-sym { flex: 0 0 auto; }
#tab-markets .wl-row .wl-nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tab-markets .wl-row .wl-px, #tab-markets .wl-row .wl-chg { min-width: 0; text-align: right; }
#tab-markets .wl-sp .mc-spark { width: 72px; height: 20px; }
#tab-markets .watchlist > .empty-mini { margin: auto; padding: 18px; text-align: center; }

/* ── market analysis engine ── */
#tab-markets .mi-eng { list-style: none; margin: 0; padding: 6px 14px; display: flex; flex-direction: column; justify-content: space-around; flex: 1 1 auto; }
#tab-markets .mi-eng li { display: flex; align-items: flex-start; gap: 11px; padding: 8px 0; font-size: 12px; line-height: 1.5; color: var(--fg); border-bottom: 1px solid color-mix(in srgb, var(--hairline) 50%, transparent); }
#tab-markets .mi-eng li:last-child { border-bottom: none; }
#tab-markets .mi-eng strong { color: var(--amber-bright); font-weight: 600; }
#tab-markets .mi-eng-ic { width: 26px; height: 26px; flex: 0 0 auto; padding: 5px; border: 1px solid var(--hairline); border-radius: 50%; fill: none; stroke: var(--amber); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ── industry & competitive ── */
#tab-markets .panel-tools input#indSym { width: 190px; max-width: 18vw; }
#tab-markets #industryOut { padding: 10px 14px; overflow: hidden; }
#tab-markets .mi-ind { display: flex; flex-direction: column; gap: 8px; min-height: 0; flex: 1 1 auto; }
#tab-markets .mi-ind .ind-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin: 0; }
#tab-markets .mi-ind .ind-card { padding: 7px 10px; }
#tab-markets .mi-ind-tabs { align-self: flex-start; }
#tab-markets .mi-ind-pane { max-height: 190px; overflow: auto; }
#tab-markets .mi-ind-pane[hidden] { display: none; }
#tab-markets .mi-ind-pane .ind-sub { margin-top: 0; }

/* ── macro command: regime + reads + key levels ── */
#tab-markets .mi-regime-body { padding: 12px 14px; }
#tab-markets .mi-regime-body .mc-regime { flex-direction: column; align-items: stretch; gap: 10px; border: 0; padding: 0; background: none; flex: 1 1 auto; }
#tab-markets .mi-regime-body .mc-reg-chip { text-align: center; }
#tab-markets .mi-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--hairline); border: 1px solid var(--hairline); flex: 1 1 auto; }
#tab-markets .mi-key { background: var(--ink-2); border: 0; padding: 7px 9px; display: flex; flex-direction: column; justify-content: center; gap: 2px; text-align: left; color: var(--fg); font: inherit; cursor: pointer; min-width: 0; }
#tab-markets .mi-key:hover { background: color-mix(in srgb, var(--amber) 5%, var(--ink-2)); }
#tab-markets .mi-key small { font-family: var(--mono); font-size: 8px; letter-spacing: .12em; color: var(--muted-ink); }
#tab-markets .mi-key b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tab-markets .mi-key span { font-size: 10px; }

/* ── FII / DII ── */
#tab-markets #mcFii { padding: 12px 14px 0; }
#tab-markets .mi-fii-chip { display: block; text-align: left; margin-bottom: 10px; }
#tab-markets #mcFii .mc-fii-cvwrap { flex: 1 1 auto; min-height: 220px; }
#tab-markets #mcFii .mc-fii-cvwrap canvas { width: 100%; height: 100%; display: block; }
#tab-markets #mcFii details.mi-more { margin: 8px -14px 0; }

/* ── currencies strength: bars share the panel height ── */
#tab-markets #mcFxStr .mi-str { flex: 1 1 auto; justify-content: space-between; padding: 10px 14px; margin: 0; }
#tab-markets #mcFxStr .mc-str-row { grid-template-columns: 38px 1fr 50px; }

/* ── inflation & India macro card grids ── */
#tab-markets .mi-infl { grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: 1fr; flex: 1 1 auto; border: 0; }
#tab-markets .mi-strip { grid-template-columns: repeat(7, minmax(0, 1fr)); border: 0; }
#tab-markets .mi-infl .mc-infl-card, #tab-markets .mi-strip .mc-infl-card { padding: 10px 12px; display: flex; flex-direction: column; justify-content: space-between; min-width: 0; }
#tab-markets .mi-infl .mc-infl-card .n { font-size: 17px; }
#tab-markets .mc-infl-card .l, #tab-markets .mc-infl-card .s { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tab-markets .mi-infl .mc-infl-card .s { white-space: normal; line-height: 1.35; }

/* ── movers ── */
#tab-markets .mi-movers .mi-mv { cursor: pointer; }
#tab-markets .mi-movers .mi-mv:hover td { background: color-mix(in srgb, var(--amber) 5%, transparent); }
#tab-markets .mi-movers .mi-rank { color: var(--muted-ink); width: 26px; }
#tab-markets .mi-movers th:first-child, #tab-markets .mi-movers td:first-child { padding-left: 14px; }
#tab-markets .mi-t td.mi-sel { background: color-mix(in srgb, var(--amber) 7%, transparent); font-weight: 600; }

/* ── global indicators legend + briefing ── */
#tab-markets #mcEcon .mc-econ-legend { flex: 0 0 auto; margin: 0; padding: 8px 14px; border-top: 1px solid color-mix(in srgb, var(--hairline) 60%, transparent); }
#tab-markets #mcBrief { padding: 14px 16px; }

/* ── responsive: keep every row filled at each breakpoint ── */
@media (max-width: 1440px) {
  #tab-markets .mi-tapep { grid-column: span 8; } #tab-markets .mi-breadthp { grid-column: span 4; }
  #tab-markets .mi-lead { grid-column: span 12; } #tab-markets .mi-pair { grid-column: span 6; }
  #tab-markets .mi-cx-body { grid-template-columns: minmax(0, 1fr) 290px; }
}
@media (max-width: 1180px) {
  #tab-markets .s4 { grid-column: span 12; }
  #tab-markets .s6 { grid-column: span 12; }
  #tab-markets .mi-strip, #tab-markets .mi-infl { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  #tab-markets #watchList { max-height: 300px; }
  #tab-markets .mi-ind-pane { max-height: none; }
}
@media (max-width: 900px) {
  #tab-markets .mi-tapep, #tab-markets .mi-breadthp, #tab-markets .mi-pair { grid-column: span 12; }
  #tab-markets .mi-cx-body { grid-template-columns: 1fr; }
  #tab-markets .mi-cx-stats { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 600px) {
  #tab-markets .mi-grid { gap: 10px; }
  #tab-markets .mi-cx-stats { grid-template-columns: repeat(3, 1fr); }
  #tab-markets #heatmap { grid-template-columns: repeat(3, 1fr); }
  #tab-markets .mi-keys { grid-template-columns: repeat(2, 1fr); }
  #tab-markets .mi-p > .panel-h > .panel-sub { display: none; }
  #tab-markets .panel-tools input#indSym { width: 130px; max-width: 40vw; }
}

/* ── MI refinements: exact tape columns, matrix fill, industry form ── */
#tab-markets #tape { grid-template-columns: repeat(var(--cols, 8), minmax(0, 1fr)); }
#tab-markets #matrix > table { flex: 1 1 auto; }
#tab-markets .mi-ind-form { flex: 0 0 auto; display: flex; gap: 8px; padding: 10px 14px 0; }
#tab-markets .mi-ind-form input { flex: 1; min-width: 0; height: var(--ctl-h-sm); font-size: var(--ctl-fs-sm); }
#tab-markets .mi-ind-form .mini-btn { flex: 0 0 auto; color: var(--amber-bright); border-color: color-mix(in srgb, var(--amber) 55%, var(--hairline)); }

/* FII chart: the canvas must never size its own box — its pixel buffer is
   clientSize × DPR, so an in-flow canvas feeds back into the row height and
   can grow on every redraw. Pinned absolutely, the wrapper alone sets size. */
#tab-markets #mcFii .mc-fii-cvwrap { position: relative; flex: 1 1 auto; min-height: 230px; }
#tab-markets #mcFii .mc-fii-cvwrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
/* industry: compact scorecards so a loaded analysis keeps the row height */
#tab-markets .mi-ind .ind-card { padding: 6px 9px; }
#tab-markets .mi-ind .ind-card .ind-l { font-size: 8px; }
#tab-markets .mi-ind .ind-card .ind-v { font-size: 12.5px; line-height: 1.25; }
#tab-markets .mi-ind .ind-card .ind-s { font-size: 9.5px; }
#tab-markets .mi-ind-pane { max-height: 150px; }

/* global indicators: fixed-width period tags keep the value column aligned */
#tab-markets #mcEcon .mc-src { display: inline-block; min-width: 58px; text-align: center; }

/* ════════════════════════════════════════════════════════════════════════════
   CHART ANALYSIS — toolbar · dropdowns · events · stats with micro-visuals
   ════════════════════════════════════════════════════════════════════════════ */
#miPriceChart .cx { display: flex; flex-direction: column; gap: 10px; }
.cx-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cx-main-search { flex: 1 1 240px; max-width: 420px; min-width: 170px; }
.cx-tools { flex-wrap: nowrap; }
.cx-main-search input { width: 100%; height: 34px; font-size: 13px; font-weight: 600; font-family: var(--sans, inherit); letter-spacing: .01em; }
.cx-tf { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--hairline); border-radius: 6px; background: var(--ink); }
.cx-tfb { height: 28px; min-width: 40px; padding: 0 10px; border: 1px solid transparent; border-radius: 4px; background: none; color: var(--muted); font-family: var(--mono); font-size: 11.5px; cursor: pointer; }
.cx-tfb:hover { color: var(--fg); }
.cx-tfb.on { color: var(--amber-bright); border-color: color-mix(in srgb, var(--amber) 75%, transparent); background: color-mix(in srgb, var(--amber) 12%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--amber) 25%, transparent) inset; }
.cx-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.cx-btn { height: 34px; display: inline-flex; align-items: center; gap: 8px; padding: 0 13px; border: 1px solid var(--hairline); border-radius: 6px; background: var(--ink); color: var(--fg); font-size: 12.5px; font-family: inherit; cursor: pointer; white-space: nowrap; }
.cx-btn:hover { border-color: color-mix(in srgb, var(--amber) 55%, var(--hairline)); }
.cx-btn.on { border-color: color-mix(in srgb, var(--amber) 70%, transparent); color: var(--amber-bright); background: color-mix(in srgb, var(--amber) 9%, var(--ink)); }
.cx-ic svg, .cx-caret svg { width: 15px; height: 15px; display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cx-caret { opacity: .7; margin-right: -4px; }
.cx-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: color-mix(in srgb, var(--amber) 22%, transparent); color: var(--amber-bright); font-family: var(--mono); font-size: 10px; display: inline-flex; align-items: center; justify-content: center; }
.cx-badge[hidden] { display: none; }
.cx-dd { position: relative; }
.cx-split { display: flex; }
.cx-split .cx-ev-toggle { border-radius: 6px 0 0 6px; }
.cx-split .cx-ev-caret { border-radius: 0 6px 6px 0; border-left: 0; padding: 0 9px; }
.cx-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 40; min-width: 190px; padding: 6px; background: var(--ink-3, #1a1e24); border: 1px solid var(--hairline); border-radius: 8px; box-shadow: 0 16px 40px rgba(0,0,0,.55); }
.cx-menu[hidden] { display: none; }
.cx-menu-wide { min-width: 270px; }
.cx-mh { font-size: 9px; letter-spacing: .14em; color: var(--muted-ink); padding: 8px 8px 4px; }
.cx-mi { width: 100%; display: flex; align-items: center; gap: 9px; padding: 7px 8px; border: 0; border-radius: 5px; background: none; color: var(--fg); font: inherit; font-size: 12.5px; text-align: left; cursor: pointer; }
.cx-mi:hover { background: color-mix(in srgb, var(--amber) 8%, transparent); }
.cx-chk { width: 14px; height: 14px; border: 1px solid var(--hairline); border-radius: 3px; flex: 0 0 auto; position: relative; }
.cx-mi.on .cx-chk { background: var(--amber); border-color: var(--amber); }
.cx-mi.on .cx-chk::after { content: ""; position: absolute; left: 4px; top: 1px; width: 4px; height: 8px; border: solid #101114; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.cx-sw { width: 14px; height: 3px; border-radius: 2px; flex: 0 0 auto; }
.cx-menu .cx-cmp { padding: 4px 6px 6px; }
.cx-menu .cx-cmp input { width: 100%; height: 30px; }
/* events dropdown */
.cx-evmenu { width: 420px; max-width: 86vw; padding: 0; }
.cx-ev-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--hairline); font-size: 10px; letter-spacing: .12em; color: var(--muted-ink); }
.cx-switch { display: inline-flex; align-items: center; gap: 7px; font-family: inherit; font-size: 11.5px; letter-spacing: 0; color: var(--fg); cursor: pointer; }
.cx-switch input { display: none; }
.cx-switch span { width: 30px; height: 16px; border-radius: 8px; background: var(--hairline); position: relative; transition: background .15s; }
.cx-switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #e9e4da; transition: left .15s; }
.cx-switch input:checked + span { background: var(--amber); }
.cx-switch input:checked + span::after { left: 16px; }
.cx-ev-filters { display: flex; flex-wrap: wrap; gap: 5px; padding: 10px 12px; border-bottom: 1px solid var(--hairline); }
.cx-evf { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border: 1px solid var(--hairline); border-radius: 12px; background: none; color: var(--muted); font-size: 11px; font-family: inherit; cursor: pointer; opacity: .55; }
.cx-evf.on { opacity: 1; color: var(--fg); border-color: color-mix(in srgb, var(--amber) 40%, var(--hairline)); }
.cx-evf i { width: 7px; height: 7px; border-radius: 50%; }
.cx-evf b { font-family: var(--mono); font-weight: 600; color: var(--amber-bright); }
.cx-ev-list { max-height: 360px; overflow: auto; padding: 4px 0; }
.cx-evi { width: 100%; display: grid; grid-template-columns: 74px 1fr; gap: 10px; padding: 9px 12px; border: 0; border-bottom: 1px solid color-mix(in srgb, var(--hairline) 50%, transparent); background: none; color: var(--fg); text-align: left; font: inherit; cursor: pointer; }
.cx-evi:hover { background: color-mix(in srgb, var(--amber) 6%, transparent); }
.cx-evi-d { font-size: 10.5px; color: var(--muted); padding-top: 1px; }
.cx-evi-b { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cx-evi-b b { font-size: 12.5px; font-weight: 600; }
.cx-evi-b b.up { color: #2ebd85; } .cx-evi-b b.down { color: #f0524f; }
.cx-evi-b small { font-size: 9.5px; letter-spacing: .08em; color: var(--muted-ink); text-transform: uppercase; }
.cx-evi-b span { font-size: 11.5px; line-height: 1.45; color: var(--muted); }
.cx-ev-list .empty-mini { padding: 18px; text-align: center; }
/* canvas + stats */
#tab-markets .mi-cx-body { grid-template-columns: minmax(0, 1fr) 400px; gap: 12px; }
.cx-cvwrap { position: relative; height: 380px; border-radius: 6px; background: radial-gradient(120% 90% at 50% 0%, rgba(255,255,255,.025), transparent 60%), #0c0e12; border: 1px solid color-mix(in srgb, var(--hairline) 60%, transparent); overflow: hidden; }
.cx-cvwrap .cx-cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
#tab-markets .mi-cx-stats { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; background: var(--hairline); border-radius: 6px; }
.cx-st { background: linear-gradient(180deg, color-mix(in srgb, var(--ink-2) 92%, #fff 1.5%), var(--ink-2)); padding: 10px 12px; display: flex; flex-direction: column; justify-content: center; gap: 3px; min-width: 0; position: relative; }
.cx-st small { font-family: var(--mono); font-size: 9px; letter-spacing: .12em; color: var(--muted-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-st b { font-family: var(--mono); font-size: 16px; font-weight: 600; color: var(--fg); white-space: nowrap; line-height: 1.2; }
.cx-st b.up { color: #2ebd85; } .cx-st b.down { color: #f0524f; }
.cx-st em { font-style: normal; font-size: 9.5px; color: var(--muted-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-spark { width: 100%; height: 24px; display: block; margin-top: 3px; }
.cx-pill { align-self: flex-start; margin-top: 3px; font-family: var(--mono); font-size: 9.5px; padding: 2px 6px; border-radius: 3px; }
.cx-pill.up { color: #2ebd85; background: rgba(46,189,133,.12); } .cx-pill.down { color: #f0524f; background: rgba(240,82,79,.12); }
.cx-zbar { position: relative; height: 5px; margin-top: 5px; border-radius: 3px; background: rgba(255,255,255,.05); }
.cx-zbar::before { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: rgba(255,255,255,.22); }
.cx-zbar i { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.cx-zbar i.up { background: linear-gradient(90deg, rgba(46,189,133,.35), #2ebd85); } .cx-zbar i.down { background: linear-gradient(270deg, rgba(240,82,79,.35), #f0524f); }
.cx-range { position: relative; height: 5px; margin-top: 5px; border-radius: 3px; background: linear-gradient(90deg, rgba(240,82,79,.55), rgba(232,163,61,.45), rgba(46,189,133,.55)); }
.cx-range i, .cx-rsi i { position: absolute; top: -3px; width: 3px; height: 11px; margin-left: -1.5px; border-radius: 2px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.6); }
.cx-rsi { position: relative; height: 5px; margin-top: 5px; border-radius: 3px; background: linear-gradient(90deg, rgba(46,189,133,.5) 0 30%, rgba(255,255,255,.08) 30% 70%, rgba(240,82,79,.5) 70% 100%); }
.cx-meter { height: 5px; margin-top: 5px; border-radius: 3px; background: rgba(255,255,255,.06); overflow: hidden; }
.cx-meter i { display: block; height: 100%; background: linear-gradient(90deg, #2ebd85, #e8a33d 55%, #f0524f); }
.cx-foot { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.cx-foot .mc-note { padding: 0; flex: 1; }
.cx-foot .mc-hint { flex: 0 0 auto; margin: 0; }
.cx-pop-k { font-size: 9px; letter-spacing: .12em; color: var(--muted-ink); margin: -2px 0 6px; }
.mc-pop-t .up { color: #2ebd85; } .mc-pop-t .down { color: #f0524f; }
#cxChips:empty { display: none; }
/* fullscreen: panel fills the screen, chart takes the remaining height */
#miChartPanel:fullscreen { display: flex; flex-direction: column; background: var(--ink); padding: 14px 18px; overflow: auto; }
#miChartPanel:fullscreen #miPriceChart { flex: 1 1 auto; display: flex; }
#miChartPanel:fullscreen .cx { flex: 1 1 auto; }
#miChartPanel:fullscreen .mi-cx-body { flex: 1 1 auto; }
#miChartPanel:fullscreen .cx-cvwrap { height: auto; min-height: calc(100vh - 190px); }
/* responsive */
@media (max-width: 1440px) { #tab-markets .mi-cx-body { grid-template-columns: minmax(0, 1fr) 340px; } }
@media (max-width: 1180px) { .cx-tools { margin-left: 0; } }
@media (max-width: 900px) {
  #tab-markets .mi-cx-body { grid-template-columns: 1fr; }
  #tab-markets .mi-cx-stats { grid-template-columns: repeat(3, 1fr); }
  .cx-cvwrap { height: 320px; }
  .cx-foot { flex-direction: column; gap: 4px; }
}
@media (max-width: 600px) {
  .cx-main-search { flex: 1 1 100%; }
  .cx-tools { flex-wrap: wrap; width: 100%; }
  .cx-btn { padding: 0 10px; font-size: 12px; }
  .cx-cvwrap { height: 270px; }
  #tab-markets .mi-cx-stats { grid-template-columns: repeat(2, 1fr); }
  .cx-evmenu { position: fixed; left: 8px; right: 8px; top: 120px; width: auto; }
}

/* maximised fallback when the Fullscreen API is unavailable — mirrors :fullscreen */
#miChartPanel.cx-max { position: fixed; inset: 0; z-index: 1000; border-radius: 0; display: flex; flex-direction: column; background: var(--ink); padding: 14px 18px; overflow: auto; }
#miChartPanel.cx-max #miPriceChart { flex: 1 1 auto; display: flex; }
#miChartPanel.cx-max .cx, #miChartPanel.cx-max .mi-cx-body { flex: 1 1 auto; }
#miChartPanel.cx-max .cx-cvwrap { height: auto; min-height: calc(100vh - 190px); }
body.cx-noscroll { overflow: hidden; }

/* ════════════════════════════════════════════════════════════════════════════
   RESEARCH REPORT · researched content inside the existing sections
   Report-native styling only: source superscripts, section sub-heads, thesis
   pillars, compact exhibit tables and the sources appendix.
   ════════════════════════════════════════════════════════════════════════════ */
.ir-ref { font-family: var(--mono); font-size: 8px; line-height: 0; margin-left: 1px; }
.ir-ref a { color: #8a5a12; text-decoration: none; }
.ir-ref a:hover { text-decoration: underline; }
.ir-exec { margin: 4px 0 22px; }
.ir-exec p { font-size: 12.2px; line-height: 1.72; color: #22252a; }
.ir-exec-kpis { margin-top: 12px; }
.ir-sub { font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: #33363b; margin: 16px 0 6px; }
.ir-pillar { margin: 12px 0 16px; }
.ir-pillar h4 { font-size: 13px; font-weight: 700; color: #1a1c20; margin: 0 0 6px; }
.ir-pillar-t td { vertical-align: top; font-family: "Inter", -apple-system, sans-serif; font-size: 11px; line-height: 1.55; }
.ir-pillar-t td:first-child { width: 150px; white-space: nowrap; font-family: var(--mono); font-size: 9.5px; letter-spacing: .06em; color: #555; text-transform: uppercase; }
.ir-tl td { vertical-align: top; font-family: "Inter", -apple-system, sans-serif; font-size: 10.8px; line-height: 1.5; }
.ir-tl td:first-child { white-space: nowrap; }
.ir-sources { margin: 6px 0 0 20px; font-size: 10.2px; color: #444; line-height: 1.5; }
.ir-sources li { margin-bottom: 7px; break-inside: avoid; }
.ir-sources a { color: #2f4a6b; word-break: break-all; }
.ir-src-claim { color: #666; }
@media print { .ir-pillar, .ir-exec p { break-inside: avoid; } }

/* ════════════════════════════════════════════════════════════════════════════
   REPORT GENERATION · progress overlay (UI chrome — never printed)
   Blurred backdrop, animated document, progress bar, timing and step list.
   ════════════════════════════════════════════════════════════════════════════ */
body.rg-lock { overflow: hidden; }
.rg-overlay {
  position: fixed; inset: 0; z-index: 9000; display: grid; place-items: center; padding: 16px;
  background: color-mix(in srgb, var(--ink) 58%, transparent);
  backdrop-filter: blur(10px) saturate(.85); -webkit-backdrop-filter: blur(10px) saturate(.85);
  opacity: 0; transition: opacity .25s ease;
}
.rg-overlay.on { opacity: 1; }
.rg-overlay[hidden] { display: none; }
.rg-card {
  width: min(620px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: linear-gradient(180deg, var(--ink-2), var(--ink));
  border: 1px solid var(--hairline); border-radius: 12px; padding: 24px 28px 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55), 0 0 0 1px rgba(232, 163, 61, .06) inset;
  transform: translateY(8px) scale(.985); transition: transform .3s cubic-bezier(.2, .8, .2, 1);
}
.rg-overlay.on .rg-card { transform: none; }

/* animated document */
.rg-visual { position: relative; height: 150px; display: grid; place-items: center; margin-bottom: 10px; }
.rg-ring { position: absolute; width: 158px; height: 158px; border-radius: 50%; border: 1px dashed color-mix(in srgb, var(--amber) 28%, transparent); animation: rg-spin 14s linear infinite; }
.rg-ring i { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--amber-bright); box-shadow: 0 0 10px var(--amber-bright); top: -4px; left: calc(50% - 3.5px); }
.rg-ring i:nth-child(2) { top: auto; bottom: 16px; left: 8px; background: var(--up); box-shadow: 0 0 10px var(--up); }
.rg-ring i:nth-child(3) { top: 30px; left: auto; right: -2px; width: 5px; height: 5px; background: var(--fg); box-shadow: 0 0 8px var(--fg); }
.rg-doc {
  position: relative; width: 96px; height: 122px; border-radius: 4px; padding: 10px 9px; overflow: hidden; box-sizing: border-box;
  background: linear-gradient(180deg, #f6f3ec, #ebe6da); box-shadow: 0 14px 30px rgba(0, 0, 0, .45);
  animation: rg-float 3.2s ease-in-out infinite;
}
.rg-doc-bar { height: 7px; width: 55%; border-radius: 2px; background: var(--amber); margin-bottom: 8px; }
.rg-ln {
  height: 4px; border-radius: 2px; margin: 0 0 5px;
  background: linear-gradient(90deg, #cfc8b8 0%, #b9b1a0 40%, #e3ddd0 50%, #b9b1a0 60%, #cfc8b8 100%);
  background-size: 220% 100%; animation: rg-shimmer 1.8s linear infinite;
}
.rg-chart { display: flex; align-items: flex-end; gap: 4px; height: 30px; margin: 7px 0 8px; }
.rg-chart i { flex: 1; background: #2f4a6b; border-radius: 1px 1px 0 0; transform-origin: bottom; animation: rg-grow 1.6s ease-in-out infinite alternate; }
.rg-chart i:nth-child(1) { height: 40%; }
.rg-chart i:nth-child(2) { height: 58%; animation-delay: .15s; }
.rg-chart i:nth-child(3) { height: 50%; animation-delay: .3s; }
.rg-chart i:nth-child(4) { height: 72%; animation-delay: .45s; background: var(--amber); }
.rg-chart i:nth-child(5) { height: 66%; animation-delay: .6s; }
.rg-chart i:nth-child(6) { height: 90%; animation-delay: .75s; background: var(--up); }
.rg-scan {
  position: absolute; left: 0; right: 0; top: -20%; height: 18px;
  background: linear-gradient(180deg, transparent, rgba(232, 163, 61, .35), transparent);
  animation: rg-scan 2.4s ease-in-out infinite;
}

/* text, bar, timing */
.rg-kicker { font-family: var(--code); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--amber-bright); text-align: center; }
.rg-title { font-family: var(--serif); font-size: 22px; font-weight: 600; color: var(--fg); text-align: center; margin: 4px 0 12px; letter-spacing: .01em; }
.rg-now { display: flex; align-items: center; justify-content: center; gap: 9px; min-height: 20px; font-size: 13px; color: var(--fg); margin-bottom: 12px; text-align: center; }
.rg-spin { flex: none; width: 13px; height: 13px; box-sizing: border-box; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--amber) 25%, transparent); border-top-color: var(--amber-bright); animation: rg-spin .8s linear infinite; }
.rg-bar { position: relative; height: 8px; border-radius: 99px; background: var(--ink-3); border: 1px solid var(--hairline); overflow: hidden; }
.rg-fill {
  height: 100%; width: 0; border-radius: 99px; transition: width .7s cubic-bezier(.2, .8, .2, 1);
  background-color: var(--amber);
  background-image: repeating-linear-gradient(-45deg, rgba(255, 255, 255, .16) 0 8px, transparent 8px 16px), linear-gradient(90deg, var(--amber), var(--amber-bright));
  background-size: 32px 100%, 100% 100%; animation: rg-stripes .9s linear infinite;
}
.rg-meta { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 8px 0 16px; font-family: var(--code); font-size: 11px; color: var(--muted); }
.rg-meta b { color: var(--fg); font-weight: 600; }
.rg-pct { color: var(--amber-bright); font-weight: 600; }

/* steps */
.rg-steps { list-style: none; margin: 0; padding: 12px 0 2px; border-top: 1px solid var(--hairline); display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(6, auto); grid-auto-flow: column; gap: 6px 18px; }
.rg-step { position: relative; padding-left: 20px; font-size: 11.5px; line-height: 1.45; color: var(--muted-ink); transition: color .3s; }
.rg-step::before { content: ""; position: absolute; left: 1px; top: 3px; width: 11px; height: 11px; box-sizing: border-box; border-radius: 50%; border: 1.5px solid var(--hairline); }
.rg-step.active { color: var(--fg); }
.rg-step.active::before { border-color: color-mix(in srgb, var(--amber) 30%, transparent); border-top-color: var(--amber-bright); animation: rg-spin .8s linear infinite; }
.rg-step.done { color: var(--muted); }
.rg-step.done::before { border: 0; background: var(--up); }
.rg-step.done::after { content: ""; position: absolute; left: 5px; top: 5px; width: 3px; height: 5px; border: solid var(--ink); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.rg-step.skipped { color: var(--muted-ink); text-decoration: line-through; text-decoration-color: var(--hairline); }
.rg-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--hairline); font-size: 10.5px; color: var(--muted-ink); }

/* finished state */
.rg-overlay.done .rg-spin { animation: none; border-color: var(--up); background: var(--up); }
.rg-overlay.done .rg-scan, .rg-overlay.done .rg-ring { animation-play-state: paused; }
.rg-overlay.done .rg-fill { background-image: linear-gradient(90deg, var(--up), #3cc487); animation: none; }

@keyframes rg-spin { to { transform: rotate(360deg); } }
@keyframes rg-float { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-6px) rotate(1deg); } }
@keyframes rg-shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
@keyframes rg-grow { from { transform: scaleY(.35); } to { transform: scaleY(1); } }
@keyframes rg-scan { 0% { top: -20%; } 100% { top: 110%; } }
@keyframes rg-stripes { from { background-position: 0 0, 0 0; } to { background-position: 32px 0, 0 0; } }

@media (max-width: 560px) {
  .rg-card { padding: 18px 16px 14px; }
  .rg-visual { height: 120px; }
  .rg-ring { width: 128px; height: 128px; }
  .rg-doc { transform: scale(.85); animation: none; }
  .rg-title { font-size: 18px; }
  .rg-steps { grid-template-columns: 1fr; grid-template-rows: none; grid-auto-flow: row; }
}
@media (prefers-reduced-motion: reduce) {
  .rg-ring, .rg-doc, .rg-ln, .rg-chart i, .rg-scan, .rg-spin, .rg-fill, .rg-step.active::before { animation: none !important; }
  .rg-overlay, .rg-card, .rg-fill { transition: none; }
}
@media print { .rg-overlay { display: none !important; } }

/* report · consistency-check results */
.ir-qa td { font-size: 10.8px; vertical-align: top; }
.ir-qa-pass { color: #1f7a4d; font-weight: 600; }
.ir-qa-fail { color: #b3261e; font-weight: 700; }
.ir-qa-note { color: #8a5a12; font-weight: 600; }

/* report · grouped tables (key ratios, filing disclosures) and the 8-quarter P&L */
.ir-fin .ir-grp td { background: #f7f4ec; color: #8a6a1f; font-family: var(--mono); font-size: 9.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; text-align: left; padding: 6px 8px; border-bottom: 1px solid #e6e1d4; }
.ir-fin td.ir-spk, .ir-fin .ir-hd td.ir-spk { width: 72px; text-align: left; padding: 3px 6px; }
.ir-fin td.ir-spk .ws-spark { display: block; }
.ir-qtr { font-size: 9.8px; }
.ir-qtr td, .ir-qtr th { padding-left: 6px; padding-right: 6px; }
.ir-docs td { vertical-align: top; line-height: 1.45; }
.ir-docs td:first-child { white-space: nowrap; font-family: var(--mono); font-size: 10px; }
.ir-docs a { color: #8a6a1f; text-decoration: none; border-bottom: 1px dotted #c9b27a; }

/* ── earnings-call analysis dashboard (framework modules) — readable sizes ── */
.eca { display: flex; flex-direction: column; gap: 14px; font-size: 13px; line-height: 1.55; color: var(--fg); }
.eca-head { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 18px; border: 1px solid var(--hairline); background: var(--ink-2); border-radius: var(--r); padding: 16px 18px; }
.eca-kicker { font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; color: var(--amber-bright); }
.eca-head h3 { font-size: 22px; font-weight: 700; margin: 4px 0 6px; color: var(--fg); }
.eca-meta { font-size: 12.5px; color: var(--muted); }
.eca-people { display: grid; gap: 8px; font-size: 12.5px; }
.eca-people span { display: block; font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-ink); margin-bottom: 2px; }
.eca-people b { display: inline; font-weight: 600; margin-right: 4px; }
.eca-people i { font-style: normal; color: var(--muted); margin-right: 10px; }
.eca-notes { font-size: 12px; color: var(--muted); border-left: 3px solid var(--amber); padding: 6px 10px; background: color-mix(in srgb, var(--amber) 6%, transparent); border-radius: 3px; }
.eca-sec { border: 1px solid var(--hairline); background: var(--ink-2); border-radius: var(--r); overflow: hidden; }
.eca-h { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--hairline); background: color-mix(in srgb, var(--amber) 5%, transparent); }
.eca-n { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; background: var(--amber); color: var(--ink); font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.eca-h h4 { font-size: 14px; font-weight: 700; letter-spacing: .02em; color: var(--fg); margin: 0; }
.eca-sub { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--muted-ink); }
.eca-b { padding: 14px 16px; }
.eca-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.eca-lbl { font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-ink); margin: 4px 0 8px; }
.eca-lbl.up-l { color: var(--up); } .eca-lbl.down-l { color: var(--down); }
.eca-dim { color: var(--muted-ink); } .eca-small { font-size: 11px; margin-top: 4px; } .eca-amb { color: var(--amber-bright); }
.eca-pg { font-family: var(--mono); font-size: 10.5px; color: var(--muted-ink); border: 1px solid var(--hairline); border-radius: 3px; padding: 0 4px; white-space: nowrap; margin-left: 2px; }
.eca-tag { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; border: 1px solid var(--hairline); border-radius: 3px; padding: 1px 5px; color: var(--muted); }
.eca-tag.ok { color: var(--up); border-color: color-mix(in srgb, var(--up) 40%, transparent); }
.eca-empty { color: var(--muted); font-size: 12.5px; padding: 4px 0; }
.eca-wait { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; padding: 6px 0; }
.eca-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.eca-tile { border: 1px solid var(--hairline); border-radius: var(--r-sm); padding: 10px 12px; background: var(--ink); }
.eca-tile .k { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-ink); }
.eca-tile .v { font-family: var(--mono); font-size: 24px; font-weight: 700; color: var(--fg); margin: 2px 0; }
.eca-tile .v small { font-size: 12px; color: var(--muted); margin-left: 2px; }
.eca-tile .w { font-size: 11.5px; color: var(--muted); }
.eca-sev { font-family: var(--mono); font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 3px; }
.eca-sev.high { color: #fff; background: var(--down); } .eca-sev.medium { color: var(--ink); background: var(--amber); } .eca-sev.low { color: var(--muted); border: 1px solid var(--hairline); }
.eca-tile.sev .v { font-size: 16px; padding-top: 6px; }
.eca-headline { font-size: 15px; line-height: 1.55; margin: 6px 0 10px; color: var(--fg); }
.eca-impact { font-size: 13px; padding: 8px 12px; border-radius: 4px; margin-bottom: 12px; border: 1px solid var(--hairline); }
.eca-impact.positive { border-color: color-mix(in srgb, var(--up) 45%, transparent); background: color-mix(in srgb, var(--up) 7%, transparent); }
.eca-impact.negative { border-color: color-mix(in srgb, var(--down) 45%, transparent); background: color-mix(in srgb, var(--down) 7%, transparent); }
.eca-impact.neutral { border-color: color-mix(in srgb, var(--amber) 45%, transparent); }
.eca-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 7px; font-size: 13px; }
.eca-list.pos li::marker { color: var(--up); font-weight: 700; } .eca-list.neg li::marker { color: var(--down); font-weight: 700; }
.eca-t { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.eca-t th { font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-ink); text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--hairline); font-weight: 600; white-space: nowrap; }
.eca-t td { padding: 8px; border-bottom: 1px solid color-mix(in srgb, var(--hairline) 60%, transparent); vertical-align: top; line-height: 1.5; }
.eca-t tr:last-child td { border-bottom: 0; }
.eca-t.eca-qa td:nth-child(2), .eca-t.eca-qa td:nth-child(3) { min-width: 240px; }
.eca-heat td, .eca-heat th { text-align: center; padding: 6px 6px; } .eca-heat td:first-child { text-align: left; white-space: nowrap; }
.eca-heat td { color: var(--amber-bright); letter-spacing: 2px; }
.eca-env { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.eca-envc { border: 1px solid var(--hairline); border-radius: var(--r-sm); padding: 10px 12px; background: var(--ink); }
.eca-envc .f { font-weight: 700; font-size: 13px; margin-bottom: 3px; } .eca-envc .r { font-size: 12.5px; color: var(--muted); }
.eca-recon { margin-top: 10px; font-size: 12.5px; padding: 8px 12px; border-radius: 4px; border: 1px solid var(--hairline); }
.eca-recon.ok { border-color: color-mix(in srgb, var(--up) 40%, transparent); } .eca-recon.bad { border-color: color-mix(in srgb, var(--down) 40%, transparent); }
.eca-det { margin-top: 10px; } .eca-det summary { cursor: pointer; font-size: 12.5px; color: var(--amber-bright); }
.eca-quotes { margin: 6px 0 4px; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--fg); }
.eca-road { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.eca-road li { display: grid; grid-template-columns: 120px 1fr; gap: 10px; font-size: 13px; }
.eca-road .h { font-family: var(--mono); font-size: 11px; color: var(--amber-bright); text-transform: uppercase; padding-top: 2px; }
.eca-bars { display: flex; flex-direction: column; gap: 7px; }
.eca-bar { display: grid; grid-template-columns: 170px 1fr 26px 44px; align-items: center; gap: 8px; font-size: 12.5px; }
.eca-bar .t { height: 9px; background: var(--hairline); border-radius: 3px; overflow: hidden; } .eca-bar .t i { display: block; height: 100%; background: var(--amber); border-radius: 3px; }
.eca-bar b { font-family: var(--mono); text-align: right; } .eca-bar em { font-style: normal; font-family: var(--mono); font-size: 11.5px; color: var(--muted); text-align: right; }
.eca-gauges { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.eca-gauge { border: 1px solid var(--hairline); border-radius: var(--r-sm); padding: 10px 12px; background: var(--ink); }
.eca-gauge .k { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-ink); }
.eca-gauge .v { font-family: var(--mono); font-size: 24px; font-weight: 700; } .eca-gauge .v small { font-size: 12px; color: var(--muted); }
.eca-gauge .bar { height: 7px; background: var(--hairline); border-radius: 3px; overflow: hidden; margin: 6px 0 4px; } .eca-gauge .bar i { display: block; height: 100%; background: var(--up); }
.eca-gauge .w { font-size: 11.5px; color: var(--muted); }
.eca-hedge { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.eca-hedge .t { height: 9px; background: color-mix(in srgb, var(--down) 35%, transparent); border-radius: 3px; overflow: hidden; } .eca-hedge .t i { display: block; height: 100%; background: var(--amber); }
.eca-hedge b { font-family: var(--mono); color: var(--fg); }
.eca-read { margin: 4px 0 10px; padding-left: 18px; font-size: 12.5px; display: flex; flex-direction: column; gap: 4px; }
.eca-phr { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.eca-phr q { display: block; font-style: italic; font-size: 13px; border-left: 2px solid var(--amber); padding-left: 10px; }
.eca-phr span { display: block; font-size: 11.5px; color: var(--muted); padding-left: 12px; margin-top: 2px; }
.eca-clean { color: var(--up); font-weight: 700; }
.eca-cleanlist { margin-top: 10px; font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.eca-matrix { display: flex; flex-direction: column; gap: 4px; }
.eca-matrix .row { display: grid; grid-template-columns: 110px repeat(3, minmax(0, 1fr)); gap: 4px; }
.eca-matrix .ax { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; color: var(--muted-ink); align-self: center; }
.eca-matrix .lk { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; color: var(--muted-ink); text-align: center; }
.eca-matrix .cell { min-height: 44px; border: 1px solid var(--hairline); border-radius: 3px; padding: 5px; display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; background: var(--ink); }
.eca-matrix .cell.hot { border-color: color-mix(in srgb, var(--down) 45%, transparent); }
.eca-matrix .cell span.up { color: var(--up); } .eca-matrix .cell span.down { color: var(--down); }
@media (max-width: 900px) { .eca-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .eca-head, .eca-2, .eca-gauges { grid-template-columns: 1fr; } .eca-bar { grid-template-columns: 120px 1fr 24px 40px; } .eca-road li { grid-template-columns: 1fr; } }

/* ── Modeling Lab: "Use this DCF in research" switch ── */
.idcf-basis { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 16px; margin: 0; border-bottom: 1px solid var(--hairline); background: color-mix(in srgb, var(--ink) 60%, transparent); font-size: 12px; line-height: 1.5; }
.idcf-basis[hidden] { display: none; }
.idcf-basis.on { background: color-mix(in srgb, var(--amber) 7%, transparent); }
.idcf-switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; white-space: nowrap; }
.idcf-switch b { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--fg); font-weight: 600; }
.idcf-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.idcf-switch-track { position: relative; width: 34px; height: 18px; border-radius: 10px; background: var(--hairline); transition: background .15s; flex: 0 0 auto; }
.idcf-switch-track i { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.idcf-switch input:checked + .idcf-switch-track { background: color-mix(in srgb, var(--amber) 55%, transparent); }
.idcf-switch input:checked + .idcf-switch-track i { transform: translateX(16px); background: var(--amber-bright); }
.idcf-switch input:focus-visible + .idcf-switch-track { outline: 2px solid var(--amber); outline-offset: 2px; }
.idcf-basis-note { color: var(--muted); flex: 1 1 320px; }
.idcf-basis.on .idcf-basis-note { color: var(--fg); }
.vm-w { font-style: normal; font-family: var(--mono); font-size: 10px; color: var(--muted-ink); margin-left: 6px; }

/* ── Modeling Lab · assumption table (engine plan) ──
   Same table language as the year-wise input table (.ape-table) and the evidence
   table (.aie-table): mono 11px figures, 9px uppercase headers over an amber rule,
   numbered amber section bands, sans 11px for prose. */
.apl { margin: 18px 0 10px; }
.apl-hdr { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.apl-toggle { all: unset; cursor: pointer; display: inline-flex; align-items: baseline; gap: 6px; }
.apl-toggle:focus-visible { outline: 1px solid var(--amber); outline-offset: 3px; }
.apl-caret { font-family: var(--mono); font-size: 11px; color: var(--amber); width: 10px; }
.apl-toggle:hover .ai-sec-ttl { color: var(--amber-bright); }
.apl-body[hidden] { display: none; }
.apl-warn { margin: 6px 0; padding: 7px 10px; border-left: 2px solid var(--down); background: color-mix(in srgb, var(--down) 7%, transparent); font-size: 11px; line-height: 1.5; color: var(--fg); }
.apl-quality { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0 10px; font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: .02em; }
.apl-quality b { color: var(--fg); font-weight: 600; margin-left: 4px; }
.apl-overview { margin: 0 0 10px; padding: 7px 10px; border-left: 2px solid var(--amber); background: color-mix(in srgb, var(--amber) 5%, transparent); font-size: 11px; line-height: 1.55; color: var(--fg); }
.apl-sub { font-family: var(--mono); font-size: 9.5px; font-weight: 700; letter-spacing: .16em; color: var(--muted); margin: 16px 0 6px; }

.apl-t { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 11px; }
.apl-t thead th { padding: 5px 8px; text-align: left; font-size: 9px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); white-space: nowrap; border-bottom: 2px solid var(--amber); background: var(--ink-2); }
.apl-t thead th.apl-num { text-align: right; }
.apl-t .apl-band td { padding: 7px 8px 4px; font-size: 9.5px; font-weight: 700; letter-spacing: .16em; color: var(--amber); text-transform: uppercase; border-bottom: 1px solid var(--hairline); background: var(--ink-3); }
.apl-t .apl-row td { padding: 7px 8px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
.apl-t .apl-row:hover td { background: var(--ink-3); }
.apl-t td.apl-num { text-align: right; white-space: nowrap; color: var(--fg); }
.apl-t td.apl-latest { color: var(--muted); }
.apl-t td.apl-term { color: var(--amber-bright); }
.apl-sub2 { font-size: 9px; color: var(--muted); margin-top: 2px; }
.apl-t .apl-total td { background: color-mix(in srgb, var(--amber) 5%, transparent); }
.apl-t .apl-total td.apl-name, .apl-t .apl-total td.apl-num { color: var(--amber-bright); font-weight: 700; }
.apl-name { white-space: nowrap; }
.apl-name-l { font-weight: 600; color: var(--fg); }
.apl-name .ap-conf { margin-left: 4px; }
.apl-hist { font-size: 9.5px; color: var(--muted-ink); margin-top: 3px; }
.apl-txt { font-family: var(--sans); font-size: 11px; line-height: 1.5; color: var(--fg); min-width: 160px; }
.apl-basis { color: var(--muted); }
.apl-why { min-width: 220px; }
.apl-li { margin-bottom: 5px; }
.apl-li:last-child { margin-bottom: 0; }
.apl-li-l { color: var(--fg); }
.apl-li b { font-family: var(--mono); font-weight: 600; margin-left: 5px; }
.apl-li-s { font-size: 10px; color: var(--muted-ink); line-height: 1.45; }
.apl-w, .apl-eff { font-family: var(--mono); font-style: normal; font-size: 10px; color: var(--amber-bright); margin-left: 5px; white-space: nowrap; }
.apl-eff-c { color: var(--amber-bright) !important; font-size: 10.5px; }
.apl-flag { font-family: var(--mono); font-size: 9px; color: var(--amber-bright); border: 1px solid color-mix(in srgb, var(--amber) 45%, transparent); border-radius: 3px; padding: 0 4px; }
.apl-ai, .apl-eng { font-family: var(--sans); font-size: 11px; line-height: 1.5; }
.apl-eng { color: var(--fg); }
.apl-ai { color: var(--muted); margin-top: 4px; }
.apl-ai + .apl-ai { margin-top: 6px; }
/* AI corroboration of an assumption — a verdict, never applied to the model */
.apl-chk { font-family: var(--sans); font-size: 11px; line-height: 1.5; color: var(--muted); margin-top: 4px; }
.apl-chk b { text-transform: capitalize; font-weight: 600; }
.apl-chk-consistent b { color: var(--green, #2e9e6b); }
.apl-chk-aggressive b { color: var(--red, #c84b3c); }
.apl-chk-conservative b { color: var(--amber-bright); }
/* terminal-value cross-check */
.tvx-t td.sel, .tvx-t tr.sel td { color: var(--amber-bright); font-weight: 600; }
.tvx-t .tvx-basis { color: var(--muted); font-size: 10.5px; text-align: left; white-space: normal; }
.apl-tag { display: inline-block; font-family: var(--mono); font-size: 8.5px; font-weight: 700; letter-spacing: .08em; color: var(--amber-bright); border: 1px solid color-mix(in srgb, var(--amber) 45%, transparent); border-radius: 2px; padding: 0 4px; margin-right: 6px; vertical-align: 1px; }
.apl-tag-eng { color: var(--muted); border-color: var(--hairline); }
.apl-note { margin-top: 8px; padding: 7px 10px; border-left: 2px solid var(--hairline); }
.apl-two { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; }
@media (max-width: 1100px) { .apl-two { grid-template-columns: 1fr; } }
.apl-watch { margin: 0; padding-left: 16px; font-size: 11px; line-height: 1.55; color: var(--fg); display: flex; flex-direction: column; gap: 4px; }
.apl-src-note { font-size: 10px; color: var(--muted-ink); margin-top: 6px; }
.apl-empty { font-size: 11px; padding: 6px 0; }
.apl-pending { color: var(--amber-bright); }
.apl-ok { color: var(--up); }
.ap-engine-note { font-size: 11px; line-height: 1.5; color: var(--muted); padding: 8px 10px; border: 1px solid var(--hairline); border-radius: 4px; background: var(--ink); }
.ap-engine-note b { color: var(--amber-bright); font-weight: 600; }

/* year-wise input table: editable cells at the same size as the locked cells around them
   (a global input rule otherwise forces 12px / 600 / 34px) */
.ape-table .ape-cell-input { font-size: 11px; font-weight: 500; height: 18px; line-height: 18px; width: 42px; padding: 0; }
.ape-table .ape-edit { padding: 1px 4px; }
/* driver detail row — build · adjustments · rationale side by side under the figures */
.apl-t .apl-detail td { padding: 2px 8px 10px 22px; border-bottom: 1px solid var(--hairline); background: color-mix(in srgb, var(--ink) 55%, transparent); }
.apl-detail-g { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.35fr); gap: 16px; font-family: var(--sans); font-size: 11px; line-height: 1.5; }
@media (max-width: 1000px) { .apl-detail-g { grid-template-columns: 1fr; gap: 8px; } }
.apl-dh { font-family: var(--mono); font-size: 8.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-ink); margin: 6px 0 4px; }
.apl-t .apl-row:has(+ .apl-detail) td { border-bottom: 0; }
.apl-two { grid-template-columns: 1fr; gap: 4px; }
.apl-kv td.apl-name { white-space: normal; min-width: 150px; }
.apl-kv .apl-eff-c { white-space: normal; min-width: 110px; }
