@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:ital,wght@0,400;0,500;0,600;1,400&display=swap');

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --bg: #f6f6f4;
  --surface: #ffffff;
  --surface-2: #f9f9f7;
  --surface-3: #f1f1ee;
  --border: #e5e5e1;
  --border-strong: #d3d3ce;
  --text: #15171b;
  --text-2: #4c5058;
  --text-3: #6b6f77;
  --accent: #2a4bd1;
  --accent-hover: #203db3;
  --accent-soft: #edf0fc;
  --accent-text: #2440b8;
  --pos: #11805b;
  --pos-soft: #e6f4ee;
  --neg: #c2382d;
  --neg-soft: #fcebe9;
  --warn: #9a5b00;
  --warn-soft: #fbf1df;
  --chart-1: #2a4bd1;
  --chart-2: #a3a9b5;
  --chart-3: #c58a1c;
  --chart-grid: #ebebe7;
  --shadow: 0 1px 2px rgb(20 22 26 / .04);
  --shadow-pop: 0 12px 32px rgb(20 22 26 / .12), 0 2px 6px rgb(20 22 26 / .06);
  --sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --radius: 8px;
  --radius-sm: 6px;
  --topbar: 56px;
  --sidebar: 232px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1013; --surface: #15181d; --surface-2: #191c22; --surface-3: #20242b;
    --border: #262a31; --border-strong: #353a43;
    --text: #e9ebee; --text-2: #b0b5bd; --text-3: #8b9099;
    --accent: #7b98ff; --accent-hover: #93abff; --accent-soft: rgb(123 152 255 / .13); --accent-text: #9ab0ff;
    --pos: #3fcf92; --pos-soft: rgb(63 207 146 / .12);
    --neg: #ff7b70; --neg-soft: rgb(255 123 112 / .12);
    --warn: #f1b456; --warn-soft: rgb(241 180 86 / .12);
    --chart-1: #7b98ff; --chart-2: #5d6370; --chart-3: #e3a948; --chart-grid: #23272e;
    --shadow: none; --shadow-pop: 0 16px 40px rgb(0 0 0 / .5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1013; --surface: #15181d; --surface-2: #191c22; --surface-3: #20242b;
  --border: #262a31; --border-strong: #353a43;
  --text: #e9ebee; --text-2: #b0b5bd; --text-3: #8b9099;
  --accent: #7b98ff; --accent-hover: #93abff; --accent-soft: rgb(123 152 255 / .13); --accent-text: #9ab0ff;
  --pos: #3fcf92; --pos-soft: rgb(63 207 146 / .12);
  --neg: #ff7b70; --neg-soft: rgb(255 123 112 / .12);
  --warn: #f1b456; --warn-soft: rgb(241 180 86 / .12);
  --chart-1: #7b98ff; --chart-2: #5d6370; --chart-3: #e3a948; --chart-grid: #23272e;
  --shadow: none; --shadow-pop: 0 16px 40px rgb(0 0 0 / .5);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -.01em; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
button:disabled { opacity: .55; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
code { font: 12.5px var(--mono); background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }
ul { padding-left: 18px; margin: 0; }
li + li { margin-top: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; clip: rect(0 0 0 0); overflow: hidden; white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -40px; z-index: 50; background: var(--surface); padding: 8px 12px; border-radius: 6px; box-shadow: var(--shadow-pop); }
.skip-link:focus { top: 8px; }
.numeric, .num { font-variant-numeric: tabular-nums; }
.positive { color: var(--pos) !important; }
.negative { color: var(--neg) !important; }
svg { flex-shrink: 0; }

/* ---------- Buttons ---------- */
.button { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); font-size: 13.5px; font-weight: 500; white-space: nowrap; box-shadow: var(--shadow); transition: background .12s, border-color .12s; }
.button:hover:not(:disabled) { background: var(--surface-2); border-color: var(--text-3); }
.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.button.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
:root[data-theme="dark"] .button.primary { color: #0e1013; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .button.primary { color: #0e1013; } }
.button.ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--text-2); }
.button.ghost:hover:not(:disabled) { background: var(--surface-3); border-color: transparent; color: var(--text); }
.button.small { height: 28px; padding: 0 10px; font-size: 13px; }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11.5px; font-weight: 600; display: inline-grid; place-content: center; font-variant-numeric: tabular-nums; }
.icon-button { width: 34px; height: 34px; display: grid; place-content: center; border-radius: var(--radius-sm); color: var(--text-2); }
.icon-button:hover { background: var(--surface-3); color: var(--text); }
.icon-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.link-button { color: var(--accent-text); font-weight: 500; font-size: 13.5px; }
.link-button:hover { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; height: var(--topbar); display: flex; align-items: center; gap: 24px; padding: 0 20px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; width: calc(var(--sidebar) - 20px); font-weight: 600; font-size: 15.5px; color: var(--text); letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 24px; height: 24px; }
.brand-mark rect { fill: var(--text); }
.brand-mark path { fill: var(--bg); }
.search { position: relative; flex: 1; max-width: 560px; display: flex; align-items: center; height: 36px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); padding: 0 4px 0 10px; gap: 8px; transition: border-color .12s, box-shadow .12s; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-icon { width: 17px; height: 17px; fill: none; stroke: var(--text-3); stroke-width: 1.7; stroke-linecap: round; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; height: 100%; font-size: 14px; outline: none; }
.search input::placeholder { color: var(--text-3); }
.search-kbd { font: 12px var(--mono); color: var(--text-3); border: 1px solid var(--border-strong); border-radius: 4px; padding: 0 6px; line-height: 18px; }
.search:focus-within .search-kbd { display: none; }
.search-submit { height: 28px; padding: 0 12px; border-radius: 4px; background: var(--surface-3); color: var(--text-2); font-size: 13px; font-weight: 500; }
.search-submit:hover:not(:disabled) { background: var(--accent); color: #fff; }
.search-results { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0; max-height: 420px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-pop); padding: 6px; }
.search-results .results-label { font-size: 12px; font-weight: 500; color: var(--text-3); padding: 8px 10px 4px; }
.search-results button { display: flex; align-items: center; width: 100%; text-align: left; padding: 8px 10px; border-radius: var(--radius-sm); gap: 12px; font-size: 14px; }
.search-results button:hover, .search-results button:focus-visible { background: var(--surface-3); outline: none; }
.search-results button strong { font: 500 13px var(--mono); width: 56px; flex-shrink: 0; }
.search-results button span { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-results .empty { padding: 12px; color: var(--text-3); font-size: 13.5px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar-link { font-size: 13.5px; color: var(--text-2); padding: 6px 8px; }
.topbar-link:hover { color: var(--text); text-decoration: none; }
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .icon-sun { display: none; } :root:not([data-theme="light"]) .icon-moon { display: block; } }

/* ---------- Shell & sidebar ---------- */
.shell { display: flex; align-items: flex-start; }
.sidebar { position: sticky; top: var(--topbar); width: var(--sidebar); flex-shrink: 0; height: calc(100vh - var(--topbar)); overflow-y: auto; padding: 20px 12px; border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 22px; }
.nav { display: flex; flex-direction: column; gap: 20px; }
.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-label { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 500; color: var(--text-3); padding: 0 10px 6px; }
.nav-label .count { font-variant-numeric: tabular-nums; }
.nav-item { text-align: left; padding: 6px 10px; border-radius: var(--radius-sm); font-size: 14px; color: var(--text-2); }
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--surface); color: var(--text); font-weight: 500; box-shadow: inset 0 0 0 1px var(--border), var(--shadow); }
.saved-list p { font-size: 13px; color: var(--text-3); padding: 0 10px; line-height: 1.5; }
.saved-item { display: flex; align-items: center; border-radius: var(--radius-sm); }
.saved-item:hover { background: var(--surface-3); }
.saved-item button:first-child { flex: 1; text-align: left; padding: 6px 10px; font: 500 13px var(--mono); }
.saved-item.current button:first-child { color: var(--accent-text); }
.saved-item button:last-child { width: 28px; height: 28px; color: var(--text-3); font-size: 16px; opacity: 0; }
.saved-item:hover button:last-child, .saved-item button:last-child:focus-visible { opacity: 1; }
.sidebar-foot { margin-top: auto; font-size: 12px; color: var(--text-3); padding: 0 10px; line-height: 1.5; }

/* ---------- Main ---------- */
main { flex: 1; min-width: 0; max-width: 1280px; padding: 24px 32px 28px; }
.data-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--text-3); margin-bottom: 14px; }
.data-banner .tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--text-2); background: var(--surface-3); border-radius: 4px; padding: 1px 7px; }
.data-banner .tag.warn { color: var(--warn); background: var(--warn-soft); }
.data-banner .sep { color: var(--border-strong); }
.data-banner button { margin-left: auto; color: var(--accent-text); font-weight: 500; font-size: 13px; }
.data-banner button:hover { text-decoration: underline; text-underline-offset: 2px; }
.company-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding-bottom: 20px; margin-bottom: 24px; border-bottom: 1px solid var(--border); }
.company-identity { display: flex; align-items: center; gap: 14px; min-width: 0; }
.company-monogram { width: 44px; height: 44px; border-radius: 10px; display: grid; place-content: center; background: var(--surface); border: 1px solid var(--border); font-size: 18px; font-weight: 600; color: var(--text-2); flex-shrink: 0; box-shadow: var(--shadow); }
.company-name-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.company-name-line h1 { font-size: 24px; line-height: 1.2; letter-spacing: -.02em; }
.ticker { font: 500 12.5px var(--mono); color: var(--text-2); background: var(--surface-3); border-radius: 4px; padding: 2px 7px; }
.company-identity p { font-size: 13.5px; color: var(--text-3); margin-top: 3px; }
.company-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
#save-company.saved { color: var(--accent-text); }

/* ---------- View header ---------- */
.view-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; }
.view-header h2 { font-size: 20px; line-height: 1.3; letter-spacing: -.015em; }
.view-header p { font-size: 14px; color: var(--text-2); margin-top: 4px; max-width: 760px; }

/* ---------- Verdict ---------- */
.verdict { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; }
.verdict-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; padding: 22px 24px 18px; align-items: start; }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; padding: 3px 9px 3px 8px; border-radius: 999px; }
.status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.pos { color: var(--pos); background: var(--pos-soft); }
.status.neg { color: var(--neg); background: var(--neg-soft); }
.status.warn { color: var(--warn); background: var(--warn-soft); }
.status.neutral { color: var(--text-2); background: var(--surface-3); }
.verdict h2 { font-size: 22px; line-height: 1.3; letter-spacing: -.02em; margin: 12px 0 6px; }
.verdict-copy { font-size: 14px; color: var(--text-2); max-width: 640px; }
.verdict-stats { display: grid; grid-template-columns: repeat(4, auto); gap: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.verdict-stat { padding: 10px 18px; border-left: 1px solid var(--border); }
.verdict-stat:first-child { border-left: 0; }
.verdict-stat dt { font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.verdict-stat dd { margin: 2px 0 0; font-size: 20px; font-weight: 500; letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.verdict-stats dl { display: contents; }
.verdict-bar { padding: 4px 24px 22px; }
.fv { position: relative; padding-top: 2px; }
.fv-row { position: relative; height: 24px; }
.fv-row:first-child .fv-label { top: 0; }
.fv-row:nth-child(3) .fv-label { top: 6px; }
.fv-label { position: absolute; top: 2px; transform: translateX(-50%); font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.fv-label b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; margin-left: 3px; }
.fv-label.accent, .fv-label.accent b { color: var(--accent-text); }
.fv-label.start, .fv-axis span.start { transform: none; }
.fv-label.end, .fv-axis span.end { transform: translateX(-100%); }
.fv-track { position: relative; height: 26px; margin: 2px 0; }
.fv-zone { position: absolute; top: 0; bottom: 0; }
.fv-zone.pos { background: color-mix(in srgb, var(--pos) 20%, transparent); border-radius: 4px 0 0 4px; }
.fv-zone.mid { background: color-mix(in srgb, var(--chart-2) 24%, transparent); }
.fv-zone.neg { background: color-mix(in srgb, var(--neg) 16%, transparent); border-radius: 0 4px 4px 0; }
.fv-range { position: absolute; top: 10px; height: 6px; border-radius: 3px; background: var(--text); opacity: .7; }
.fv-value, .fv-price { position: absolute; width: 0; }
.fv-value { top: -3px; bottom: -3px; border-left: 2px solid var(--text); margin-left: -1px; }
.fv-price { top: -5px; bottom: -5px; border-left: 2px solid var(--accent); margin-left: -1px; }
.fv-axis { position: relative; height: 18px; margin-top: 6px; border-top: 1px solid var(--border); }
.fv-axis span { position: absolute; top: 4px; transform: translateX(-50%); font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.fv-legend { display: flex; gap: 6px 18px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-3); margin-top: 10px; }
.fv-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.fv-legend .pos { background: var(--pos); opacity: .35; }
.fv-legend .mid { background: var(--chart-2); opacity: .4; }
.fv-legend .neg { background: var(--neg); opacity: .32; }
.fv-legend .range { background: var(--text); opacity: .7; height: 5px; width: 14px; vertical-align: 2px; border-radius: 3px; }

/* ---------- Metrics ---------- */
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.metric { padding: 14px 16px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.metric-label { font-size: 13px; color: var(--text-3); margin-bottom: 6px; }
.metric-value { font-size: 24px; font-weight: 500; letter-spacing: -.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.metric-value .unit { font-size: 15px; color: var(--text-2); margin-left: 2px; letter-spacing: 0; }
.metric-sub { font-size: 12.5px; color: var(--text-3); margin-top: 6px; line-height: 1.5; }
.metric.primary { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); box-shadow: inset 3px 0 0 var(--accent), var(--shadow); }
.metric-primary-badge { font-size: 11.5px; font-weight: 500; color: var(--accent-text); background: var(--accent-soft); border-radius: 4px; padding: 1px 6px; margin-right: 4px; }

/* ---------- Panels ---------- */
.panel { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; min-width: 0; }
.panel-header { padding: 16px 20px 12px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.panel-header h3 { font-size: 15px; line-height: 1.35; }
.panel-header p { font-size: 13.5px; color: var(--text-3); margin-top: 3px; line-height: 1.5; }
.panel-body { padding: 4px 20px 18px; }
.panel-body > :is(p, ul, div) + :is(p, ul, a, .muted) { margin-top: 10px; }
.chip { display: inline-block; border: 1px solid var(--border); border-radius: 4px; color: var(--text-3); padding: 1px 7px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.two-columns { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 16px; }
.two-columns.equal { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.panel-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-top: 1px solid var(--border); padding: 10px 20px; font-size: 13px; color: var(--text-3); }

/* ---------- Charts ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--text-3); font-family: var(--sans); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.chart .grid { stroke: var(--chart-grid); }
.chart .zero { stroke: var(--border-strong); }
.chart .bar { fill: var(--chart-1); opacity: .88; }
.chart .bar:hover { opacity: 1; }
.chart .line-2 { fill: none; stroke: var(--chart-3); stroke-width: 2; }
.chart .dot-2 { fill: var(--surface); stroke: var(--chart-3); stroke-width: 1.5; }
.chart .line-1 { fill: none; stroke: var(--chart-1); stroke-width: 2; }
.chart .dot-1 { fill: var(--chart-1); }
.chart .marker { stroke: var(--chart-3); stroke-dasharray: 3 3; }
.chart .marker-dot { fill: var(--chart-3); stroke: var(--surface); stroke-width: 2; }
.legend { display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-3); align-items: center; margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; background: var(--chart-1); border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.legend i.sage { background: var(--chart-1); height: 2px; width: 14px; vertical-align: 3px; }
.legend i.line { height: 2px; width: 14px; border-radius: 0; background: var(--chart-3); vertical-align: 3px; }
.legend i.dot { width: 8px; height: 8px; border-radius: 50%; }

/* ---------- Lists & tables ---------- */
.value-bridge { list-style: none; padding: 0; margin: 0; }
.value-bridge li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; margin: 0; }
.value-bridge li > span { color: var(--text-2); }
.value-bridge li strong { font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.value-bridge li.total { font-weight: 600; border-bottom-color: var(--border-strong); }
.value-bridge li.total > span { color: var(--text); }
.value-bridge li.total strong { font-weight: 600; }
.bridge-bar { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-top: 14px; }
.bridge-bar > span { font-size: 13.5px; color: var(--text-3); }
.bridge-bar strong { font-size: 24px; font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
th, td { padding: 9px 14px; text-align: right; border-bottom: 1px solid var(--border); }
thead th { font-size: 12.5px; font-weight: 500; color: var(--text-3); background: var(--surface-2); border-top: 1px solid var(--border); }
th:first-child, td:first-child { text-align: left; padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
tbody th { font-weight: 400; color: var(--text-2); }
td { color: var(--text); }
tbody tr:hover { background: var(--surface-2); }
tr:last-child td, tr:last-child th { border-bottom: 0; }
th.left, td.left { text-align: left; }
td .subline, th .subline { font-size: 12.5px; color: var(--text-3); margin-top: 1px; font-weight: 400; }
.highlight-row, .highlight-row:hover { background: var(--accent-soft); }
.highlight-row td, .highlight-row th { font-weight: 600; color: var(--text); }
.table-note { padding: 10px 20px 14px; font-size: 13px; color: var(--text-3); line-height: 1.55; border-top: 1px solid var(--border); white-space: normal; }
.sensitivity td { position: relative; }
.sensitivity td.cell { background: color-mix(in srgb, var(--accent) calc(3% + var(--t, 0) * 22%), transparent); }
.sensitivity td.above { color: var(--pos); font-weight: 600; }
.sensitivity td.cell-na { color: var(--text-3); font-size: 12.5px; }
.sensitivity td.active-cell { box-shadow: inset 0 0 0 2px var(--text); font-weight: 600; }
.sensitivity tbody tr:hover { background: none; }

/* ---------- Text helpers ---------- */
.muted { font-size: 14px; color: var(--text-2); line-height: 1.6; }
.muted + .muted { margin-top: 10px; }
.stamp { font-size: 13px; color: var(--text-3); margin-top: 10px; }
.note-box { padding: 12px 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13.5px; color: var(--text-2); line-height: 1.6; margin: 14px 0; }
.formula, .formula-note { background: var(--surface-2); border: 1px solid var(--border); padding: 9px 12px; border-radius: var(--radius-sm); margin-top: 14px; font: 12.5px/1.6 var(--mono); color: var(--text-2); overflow-wrap: anywhere; }
.section-kicker { font-size: 13px; font-weight: 500; color: var(--text-2); }
.pill { font-size: 12px; padding: 1px 7px; background: var(--accent-soft); color: var(--accent-text); border-radius: 4px; }
.provenance-tag { display: block; max-width: 280px; overflow: hidden; text-overflow: ellipsis; font: 12px var(--mono); color: var(--text-3); margin-top: 2px; }
.tag-mono { font: 12.5px var(--mono); color: var(--text-2); }
.status-text-pass { color: var(--pos); font-weight: 500; }
.status-text-fail { color: var(--neg); font-weight: 500; }

/* ---------- Scenarios ---------- */
.scenario-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.scenario-card { padding: 14px 16px; border: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius-sm); }
.scenario-card.base { background: var(--surface); border-color: var(--border-strong); }
.scenario-card .section-kicker { display: flex; justify-content: space-between; align-items: center; }
.scenario-card strong { display: block; font-size: 22px; font-weight: 500; letter-spacing: -.02em; margin: 6px 0 10px; font-variant-numeric: tabular-nums; }
.scenario-card dl { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; font-size: 13px; }
.scenario-card dt { color: var(--text-3); }
.scenario-card dd { margin: 0; font-variant-numeric: tabular-nums; text-align: right; color: var(--text-2); }
.vs-price { font-size: 12.5px; font-weight: 500; font-variant-numeric: tabular-nums; }

/* ---------- Callout ---------- */
.insight { padding: 14px 18px; border: 1px solid var(--border); border-left: 3px solid var(--accent); background: var(--surface); border-radius: var(--radius-sm); margin-bottom: 16px; }
.insight.warn { border-left-color: var(--warn); background: color-mix(in srgb, var(--warn-soft) 60%, var(--surface)); }
.insight h3 { font-size: 14.5px; margin-bottom: 4px; }
.insight p { font-size: 14px; line-height: 1.6; color: var(--text-2); }
.insight p strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Quality ---------- */
.quality-item { display: flex; gap: 12px; font-size: 13.5px; color: var(--text-2); line-height: 1.55; border-bottom: 1px solid var(--border); padding: 10px 0; }
.quality-item:last-child { border: 0; }
.quality-item .flag { flex-shrink: 0; font-size: 12px; font-weight: 500; border-radius: 4px; align-self: flex-start; padding: 0 7px; line-height: 20px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; min-width: 66px; text-align: center; }
.quality-item.critical .flag { background: var(--neg-soft); color: var(--neg); }
details.quality { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); margin-bottom: 16px; }
details.quality > summary { display: flex; align-items: center; gap: 10px; padding: 14px 20px; cursor: pointer; list-style: none; }
details.quality > summary::-webkit-details-marker { display: none; }
details.quality > summary::before { content: ''; width: 7px; height: 7px; border-right: 1.6px solid var(--text-3); border-bottom: 1.6px solid var(--text-3); transform: rotate(-45deg); transition: transform .15s; margin-right: 2px; }
details.quality[open] > summary::before { transform: rotate(45deg); }
details.quality > summary h3 { font-size: 15px; }
details.quality > summary p { font-size: 13.5px; color: var(--text-3); margin-left: auto; }
details.quality .panel-body { padding-top: 0; }
.critical-count { color: var(--neg); font-weight: 500; }

/* ---------- Capital / factors ---------- */
.factor { padding: 16px 20px; border-top: 1px solid var(--border); }
.factor-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.factor-head h4 { font-size: 14px; font-weight: 500; }
.factor-head h4 .idx { font: 12.5px var(--mono); color: var(--text-3); margin-right: 8px; }
select, .factor-head select { height: 32px; padding: 0 28px 0 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='m3 4.5 3 3 3-3' fill='none' stroke='%23888' stroke-width='1.4'/%3E%3C/svg%3E") right 8px center / 12px no-repeat; font-size: 13.5px; appearance: none; font-variant-numeric: tabular-nums; }
.factor p { font-size: 13.5px; line-height: 1.6; color: var(--text-2); margin-top: 6px; }
.factor blockquote { font-size: 13.5px; color: var(--text-2); line-height: 1.6; border-left: 2px solid var(--border-strong); padding-left: 12px; margin: 10px 0; }
.factor a { font-size: 13px; }
.checkbox-label { display: flex; gap: 10px; align-items: center; font-size: 14px; color: var(--text); cursor: pointer; }
input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.review-bar { padding: 14px 20px; background: var(--surface-2); border-top: 1px solid var(--border); }

/* ---------- Methodology ---------- */
.flow-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.method-card { background: var(--surface); border: 1px solid var(--border); padding: 18px 20px; border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; }
.method-number { font: 500 12.5px var(--mono); color: var(--text-3); margin-bottom: 10px; }
.method-card h3 { font-size: 15px; margin-bottom: 6px; }
.method-card p { font-size: 13.5px; color: var(--text-2); line-height: 1.6; }
.method-card .formula { margin-top: auto; }
.method-card p + .formula { margin-top: 14px; }

/* ---------- Sources / research ---------- */
.source-row { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.source-row strong { font-size: 14px; font-weight: 500; }
.source-row p { font-size: 13px; color: var(--text-3); margin-top: 2px; line-height: 1.5; }
.source-row a { font-size: 13.5px; white-space: nowrap; font-weight: 500; }
.ext::after { content: ''; display: inline-block; width: 9px; height: 9px; margin-left: 4px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M3 1h6v6M9 1 1 9' fill='none' stroke='black' stroke-width='1.5'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M3 1h6v6M9 1 1 9' fill='none' stroke='black' stroke-width='1.5'/%3E%3C/svg%3E") center / contain no-repeat; opacity: .7; }
.research-status { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.research-status p { font-size: 13.5px; color: var(--text-2); max-width: 620px; }
.peer-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.peer-controls input { flex: 1; min-width: 160px; height: 34px; border: 1px solid var(--border-strong); padding: 0 12px; border-radius: var(--radius-sm); font: 13.5px var(--mono); background: var(--surface); }
.peer-controls input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.peer-controls label { font-size: 13.5px; color: var(--text-2); }
details.disclosure { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px; background: var(--surface); overflow: hidden; }
details.disclosure > summary { cursor: pointer; font-size: 14px; font-weight: 500; padding: 14px 20px; }
details.disclosure[open] > summary { border-bottom: 1px solid var(--border); }
details.disclosure .panel-body { padding-top: 14px; }

/* ---------- Messages & loading ---------- */
#message:not(:empty) { padding: 12px 16px; background: var(--neg-soft); border: 1px solid color-mix(in srgb, var(--neg) 25%, transparent); border-radius: var(--radius-sm); font-size: 14px; line-height: 1.55; color: var(--neg); margin-bottom: 16px; }
#loading { display: flex; gap: 16px; align-items: flex-start; padding: 28px 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 16px; }
#loading h2 { font-size: 16px; margin-bottom: 2px; }
#loading p { font-size: 14px; color: var(--text-2); }
#loading .loading-note { font-size: 13px; color: var(--text-3); margin-top: 6px; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--accent); animation: spin .8s infinite linear; margin-top: 2px; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-box { padding: 12px 16px; background: var(--neg-soft); border: 1px solid color-mix(in srgb, var(--neg) 25%, transparent); color: var(--text); font-size: 14px; line-height: 1.6; border-radius: var(--radius-sm); margin: 0 0 14px; }
.error-box strong { color: var(--neg); }
.error-actions { display: flex; gap: 8px; margin-bottom: 16px; }
.empty-state { text-align: center; padding: 48px 20px; }

/* ---------- Dialog ---------- */
dialog { padding: 0; border: 1px solid var(--border); border-radius: 12px; color: var(--text); background: var(--surface); width: 600px; max-width: calc(100% - 24px); max-height: 88vh; box-shadow: var(--shadow-pop); }
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: rgb(10 12 16 / .45); backdrop-filter: blur(2px); }
.dialog-header { padding: 18px 20px 14px; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 1px solid var(--border); margin: 0; }
.dialog-header h2 { font-size: 17px; }
.dialog-header p { font-size: 13.5px; color: var(--text-3); margin-top: 2px; }
.dialog-body { padding: 4px 20px 16px; overflow: auto; flex: 1; }
.dialog-footer { border-top: 1px solid var(--border); padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface-2); }
.assumption-group { margin: 18px 0 2px; font-size: 13px; font-weight: 600; color: var(--text); position: sticky; top: 0; background: var(--surface); padding: 8px 0; z-index: 1; }
.input-field { display: grid; grid-template-columns: 1fr 120px; align-items: center; gap: 4px 16px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.input-field label { font-size: 14px; color: var(--text); }
.input-field label small { color: var(--text-3); font-size: 12.5px; }
.input-field input { width: 100%; height: 34px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); padding: 0 10px; text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; }
.input-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-field p { font-size: 12.5px; color: var(--text-3); line-height: 1.5; grid-column: 1 / -1; }

/* ---------- Footer ---------- */
.main-footer { border-top: 1px solid var(--border); margin-top: 32px; padding-top: 14px; color: var(--text-3); font-size: 12.5px; display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .verdict-top { grid-template-columns: 1fr; }
  .verdict-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .flow-steps { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1024px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-columns, .two-columns.equal { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
@media (max-width: 860px) {
  :root { --topbar: 104px; }
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 16px; gap: 10px 12px; }
  .brand { width: auto; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .search-kbd, .topbar-link { display: none; }
  .shell { display: block; }
  .sidebar { position: sticky; top: var(--topbar); z-index: 15; width: auto; height: auto; padding: 0; border-right: 0; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); }
  .nav { flex-direction: row; gap: 0; overflow-x: auto; scrollbar-width: none; padding: 6px 12px; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-group { flex-direction: row; gap: 2px; }
  .nav-group + .nav-group { border-left: 1px solid var(--border); margin-left: 6px; padding-left: 6px; }
  .nav-label { display: none; }
  .nav-item { white-space: nowrap; font-size: 13.5px; }
  .watchlist, .sidebar-foot { display: none; }
  main { padding: 18px 16px 24px; }
  .company-header { flex-direction: column; align-items: stretch; gap: 14px; }
  .company-actions { justify-content: flex-start; flex-wrap: wrap; }
  .company-actions .button.ghost:first-child { padding-left: 0; }
  .view-header { flex-direction: column; align-items: stretch; }
  .flow-steps { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .verdict-top { padding: 18px 16px 14px; }
  .verdict-bar { padding: 0 16px 18px; }
  .verdict h2 { font-size: 19px; }
  .verdict-stats { grid-template-columns: 1fr 1fr; }
  .verdict-stat:nth-child(3) { border-left: 0; }
  .verdict-stat:nth-child(n+3) { border-top: 1px solid var(--border); }
  .metrics { gap: 8px; }
  .metric { padding: 12px 14px; }
  .metric-value { font-size: 20px; }
  .scenario-grid { grid-template-columns: 1fr; }
  .panel-header { padding: 14px 16px 10px; }
  .panel-body { padding: 4px 16px 16px; }
  th:first-child, td:first-child { padding-left: 16px; }
  th:last-child, td:last-child { padding-right: 16px; }
  .table-note, .panel-footer, .source-row, .factor, .review-bar { padding-left: 16px; padding-right: 16px; }
  .source-row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .company-name-line h1 { font-size: 21px; }
  .data-banner .sep { display: none; }
  .data-banner button { margin-left: 0; }
  .main-footer { flex-direction: column; gap: 4px; }
  .input-field { grid-template-columns: 1fr 100px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
