:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f0f3f7;
  --fg: #111827;
  --muted: #5b6474;
  --border: #e2e7ee;
  --accent: #2563eb;
  --accent-fg: #ffffff;
  --accent-soft: #e8efff;
  --positive: #047857;
  --negative: #c62828;
  /* chart series: validated all-pairs per mark group (bars: 1-3, lines: 4-6) */
  --series-revenue: #2a78d6;
  --series-net_income: #eb6834;
  --series-free_cash_flow: #1baf7a;
  --series-profit_margin: #6250d6;
  --series-pe_ratio: #e87ba4;
  --series-eps_diluted: #008300;
  --warning-bg: #fff8eb;
  --warning-border: #f3d9a4;
  --warning-fg: #7a4a00;
  --error-bg: #fdecec;
  --error-border: #f3b8b8;
  --error-fg: #8f1d1d;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  /* valuation ratings: very expensive -> very cheap (solid for gauges, tint for cells) */
  --rating-1: #d03b3b; --rating-2: #ec7f4f; --rating-3: #e2ad12; --rating-4: #6dbf67; --rating-5: #1f8a45;
  --rating-1-tint: #fbe4e4; --rating-2-tint: #fdeadf; --rating-3-tint: #fbf1cf; --rating-4-tint: #e3f4df; --rating-5-tint: #cde9d5;
  --radius: 12px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0c111b;
  --surface: #141b27;
  --surface-2: #1b2433;
  --fg: #e6eaf0;
  --muted: #9aa5b5;
  --border: #263145;
  --accent: #5b8def;
  --accent-fg: #0c111b;
  --accent-soft: #1c2a45;
  --positive: #34c38f;
  --negative: #f07070;
  --series-revenue: #3987e5;
  --series-net_income: #d95926;
  --series-free_cash_flow: #199e70;
  --series-profit_margin: #9085e9;
  --series-pe_ratio: #d55181;
  --series-eps_diluted: #008300;
  --warning-bg: #2a2111;
  --warning-border: #5a4419;
  --warning-fg: #f3cf8a;
  --error-bg: #2c1515;
  --error-border: #5c2626;
  --error-fg: #f6b4b4;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --rating-1: #e05757; --rating-2: #ee8a5c; --rating-3: #e3b323; --rating-4: #78c872; --rating-5: #2fa05a;
  --rating-1-tint: #3d1f22; --rating-2-tint: #3d2a1e; --rating-3-tint: #3a3318; --rating-4-tint: #203b25; --rating-5-tint: #163625;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 { line-height: 1.25; margin: 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: .75rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark { width: 26px; height: 26px; color: var(--accent); }

.search { display: flex; gap: .5rem; flex: 1; justify-content: flex-end; min-width: 0; }

.search input {
  flex: 0 1 240px;
  min-width: 0;
  padding: .55rem .8rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--fg);
  text-transform: uppercase;
}

.search input::placeholder { text-transform: none; color: var(--muted); }
.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .55rem 1rem;
  font-size: .95rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}

.btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--accent); color: var(--accent-fg); }
.btn-secondary { background: var(--surface-2); color: var(--fg); border-color: var(--border); }
.btn:focus-visible, .icon-button:focus-visible, .chip:focus-visible, .sort-button:focus-visible, .info:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--fg);
  cursor: pointer;
}

.icon-button svg { width: 18px; height: 18px; }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }

/* ---------- access gate ---------- */
.access-gate { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: grid; place-items: center; padding: 1rem; }
.access-gate-box { width: min(420px, 100%); padding: 1.6rem 1.5rem; display: flex; flex-direction: column; gap: .75rem; }
.access-gate-box h1 { font-size: 1.25rem; }
.access-gate-box p { margin: 0; }
.access-gate-box input {
  padding: .65rem .8rem; font-size: 1rem; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2); color: var(--fg); font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.access-gate-box input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.access-gate-error { color: var(--negative); font-size: .88rem; }
.btn-small { padding: .45rem .75rem; font-size: .85rem; }

/* ---------- layout ---------- */
.container { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 1rem 1rem 2rem; }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1rem;
  text-align: center;
  font-size: .82rem;
  color: var(--muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.banner {
  padding: .7rem 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  font-size: .9rem;
}

.banner-sample {
  background: var(--warning-bg);
  border: 1px dashed var(--warning-border);
  color: var(--warning-fg);
}

/* ---------- states ---------- */
.empty-state { text-align: center; padding: 4rem 1rem; }
.empty-state h1 { font-size: 1.9rem; margin-bottom: .6rem; }
.empty-state p { color: var(--muted); max-width: 560px; margin: 0 auto 1.5rem; }

.chips { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }

.chip {
  padding: .35rem .9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  font-weight: 600;
  cursor: pointer;
}

.chip:hover { border-color: var(--accent); color: var(--accent); }

.loading-state { display: flex; flex-direction: column; align-items: center; padding: 4rem 1rem; color: var(--muted); }

.spinner {
  width: 38px;
  height: 38px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

.alert { padding: 1rem 1.2rem; border-radius: var(--radius); margin-bottom: 1rem; }
.alert p { margin: .25rem 0 0; }
.alert-error { background: var(--error-bg); border: 1px solid var(--error-border); color: var(--error-fg); }

/* ---------- overview ---------- */
.overview { padding: .85rem 1.1rem; margin-bottom: 1rem; }

.overview-head { display: flex; align-items: center; gap: .85rem; flex-wrap: wrap; }
.company-logo { width: 40px; height: 40px; border-radius: 9px; object-fit: contain; background: #fff; border: 1px solid var(--border); padding: 3px; }
.overview-title { flex: 1; min-width: 200px; }
.overview-title h1 { font-size: 1.3rem; }
.overview-sub { margin: .15rem 0 0; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; font-size: .88rem; }

.ticker-badge {
  display: inline-block;
  padding: 0 .45rem;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: .82rem;
}

.price-block { text-align: right; }
.price-line { display: flex; align-items: baseline; justify-content: flex-end; gap: .6rem; flex-wrap: wrap; }
.price { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.change { font-weight: 600; font-variant-numeric: tabular-nums; }
.change.up { color: var(--positive); }
.change.down { color: var(--negative); }

.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .5rem 1.5rem;
  margin: .75rem 0 0;
  padding-top: .7rem;
  border-top: 1px solid var(--border);
}

.overview-grid dd.sub { margin-top: .1rem; font-weight: 400; font-size: .78rem; color: var(--muted); white-space: normal; }
.overview-grid dd.dd-wrap { white-space: normal; overflow: visible; display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .45rem; }
.overview-grid dd.dd-wrap .pill { margin-left: 0; }
.overview-grid .est { font-weight: 400; font-size: .85rem; }
.pill {
  display: inline-block; margin-left: .45rem; padding: .05rem .5rem; border-radius: 999px; vertical-align: 1px;
  font-size: .72rem; font-weight: 700; background: var(--accent-soft); color: var(--accent); border: 1px solid transparent;
}
.pill-soon { background: var(--warning-bg); color: var(--warning-fg); border-color: var(--warning-border); }
.overview-grid dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); display: flex; align-items: center; gap: .3rem; position: relative; }
.overview-grid dd { margin: .05rem 0 0; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.overview-grid .info { width: 16px; height: 16px; font-size: 10px; }

/* ---------- metrics ---------- */
/* ---------- tabs ---------- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; overflow-x: auto; }

.tab {
  padding: .6rem 1rem;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.tab:hover { color: var(--fg); }
.tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 6px 6px 0 0; }
.tab-panel:focus-visible { outline: none; }

.metric-section + .metric-section { margin-top: 1.6rem; }
.metric-section h2 { font-size: 1.05rem; margin-bottom: .6rem; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .75rem; }

.fcard {
  position: relative;
  padding: .9rem 1rem .85rem;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}

.fcard-head { display: flex; align-items: center; gap: .45rem; }
.fcard-head .info { margin-left: auto; }
.metric-label { font-size: .88rem; color: var(--fg); font-weight: 650; }
.period-tag {
  font-size: .68rem; font-weight: 700; letter-spacing: .04em; color: var(--muted);
  border: 1px solid var(--border); border-radius: 5px; padding: 0 .3rem; line-height: 1.5;
}

.fcard-main { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 2.1rem; }
.metric-value { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; line-height: 1.2; }
.fcard[data-status="not_available"] .metric-value,
.fcard[data-status="not_meaningful"] .metric-value { color: var(--muted); }
.metric-meta { font-size: .76rem; color: var(--muted); min-height: 1.1em; }

.spark-wrap { flex: none; display: inline-flex; }
.spark path { fill: none; stroke: var(--spark); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark circle { fill: var(--spark); stroke: var(--surface); stroke-width: 1.5; }

.fcard-rows { margin: .55rem 0 0; padding-top: .5rem; border-top: 1px solid var(--border); display: grid; gap: .25rem; }
.fcard-rows div { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; font-size: .86rem; }
.fcard-rows dt { color: var(--muted); }
.fcard-rows dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fcard-rows dd.na { color: var(--muted); font-weight: 500; }

.info {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font: 700 12px/1 Georgia, serif;
  cursor: help;
  padding: 0;
}

.tooltip {
  display: none;
  position: absolute;
  z-index: 30;
  top: 2.4rem;
  left: .75rem;
  right: .75rem;
  padding: .7rem .8rem;
  border-radius: 10px;
  background: var(--fg);
  color: var(--bg);
  font-size: .8rem;
  line-height: 1.45;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}

.tooltip p { margin: 0; }
.tooltip p + p { margin-top: .4rem; }
.tooltip .tip-label { font-weight: 700; }
.tooltip .tip-source { opacity: .75; }
.tooltip .tip-note { font-style: italic; }
.info:hover + .tooltip, .info:focus + .tooltip { display: block; }
.overview-grid .tooltip { top: 1.6rem; left: 0; right: auto; width: min(320px, 80vw); }

/* ---------- charts ---------- */
.chart-panel { padding: .9rem 1rem .6rem; }

.chart-toolbar { display: flex; align-items: center; justify-content: space-between; gap: .75rem 1.25rem; flex-wrap: wrap; margin-bottom: .5rem; }

.series-picker { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; padding: 0; border: 0; }

.series-option {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .3rem .7rem .3rem .5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .86rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  color: var(--muted);
}

.series-option input { margin: 0; accent-color: var(--accent); }
.series-option:has(input:checked) { color: var(--fg); border-color: var(--muted); background: var(--surface-2); }
.series-option:has(input:disabled) { opacity: .45; cursor: not-allowed; }
.series-option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.swatch { display: inline-block; flex: none; }
.swatch-bar { width: 12px; height: 12px; border-radius: 3px; background: var(--swatch); }
.swatch-line, .swatch-dash, .swatch-dot { width: 18px; height: 0; border-top: 3px solid var(--swatch); }
.swatch-dash { border-top-style: dashed; }
.swatch-dot { border-top-style: dotted; }
.series-option[data-series="revenue"] { --swatch: var(--series-revenue); }
.series-option[data-series="net_income"] { --swatch: var(--series-net_income); }
.series-option[data-series="free_cash_flow"] { --swatch: var(--series-free_cash_flow); }
.series-option[data-series="profit_margin"] { --swatch: var(--series-profit_margin); }
.series-option[data-series="pe_ratio"] { --swatch: var(--series-pe_ratio); }
.series-option[data-series="eps_diluted"] { --swatch: var(--series-eps_diluted); }

.view-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.view-switch label { cursor: pointer; }
.view-switch input { position: absolute; opacity: 0; pointer-events: none; }
.view-switch span { display: block; padding: .3rem .85rem; font-size: .86rem; font-weight: 600; color: var(--muted); }
.view-switch input:checked + span { background: var(--accent); color: var(--accent-fg); }
.view-switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }

.combo-chart { width: 100%; height: 460px; }
.chart-empty { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: .9rem; text-align: center; }
.chart-note { margin: .4rem 0 0; min-height: 1.2em; }

/* ---------- table ---------- */
.table-card { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: .65rem 1rem; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); }
td.num, th.num { text-align: right; }
td.neg { color: var(--negative); }
td.na { color: var(--muted); }
tbody tr:last-child td { border-bottom: 0; }
.sort-button { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; }
.table-note { margin: 0; padding: .6rem 1rem; border-top: 1px solid var(--border); }

.disclaimer { margin-top: 2rem; font-size: .82rem; color: var(--muted); }

/* ---------- stock valuation ---------- */
#panel-valuation .metric-section { margin-top: 1.6rem; }
.val-heading { margin: 0 0 .8rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.val-price { font-weight: 700; font-variant-numeric: tabular-nums; }
.val-panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.val-panel { padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .6rem; }
.val-panel h2 { font-size: 1rem; }
.val-panel .btn { align-self: flex-start; }
.val-reason { margin: 0; font-size: .88rem; color: var(--muted); }
.val-figures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem 1rem; margin: 0; }
.val-figures dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.val-figures dd { margin: .1rem 0 0; font-weight: 700; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.val-more summary { cursor: pointer; font-size: .82rem; color: var(--muted); }
.val-more ul { margin: .4rem 0 0; padding-left: 1.1rem; font-size: .82rem; color: var(--muted); }

.gauge { position: relative; padding-top: 1.6rem; }
.gauge-track { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; height: 12px; border-radius: 6px; overflow: hidden; }
.gauge-seg.r1 { background: var(--rating-1); } .gauge-seg.r2 { background: var(--rating-2); }
.gauge-seg.r3 { background: var(--rating-3); } .gauge-seg.r4 { background: var(--rating-4); }
.gauge-seg.r5 { background: var(--rating-5); }
.gauge-track.gauge-empty { opacity: .3; }
.gauge-scale { display: flex; justify-content: space-between; font-size: .66rem; color: var(--muted); margin-top: .15rem; font-variant-numeric: tabular-nums; }
.gauge-labels { display: grid; grid-template-columns: repeat(5, 1fr); font-size: .68rem; color: var(--muted); text-align: center; line-height: 1.2; margin-top: .1rem; }
.gauge-marker { position: absolute; top: 0; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; }
.gauge-marker::after { content: ""; width: 0; height: 0; border-left: 7px solid transparent; border-right: 7px solid transparent; border-top: 9px solid var(--fg); margin-top: 1px; }
.gauge-value { font-size: .78rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }

.rating-badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 700; white-space: nowrap; color: var(--fg); border: 1px solid transparent; }
.rating-badge.r1 { background: var(--rating-1-tint); border-color: var(--rating-1); }
.rating-badge.r2 { background: var(--rating-2-tint); border-color: var(--rating-2); }
.rating-badge.r3 { background: var(--rating-3-tint); border-color: var(--rating-3); }
.rating-badge.r4 { background: var(--rating-4-tint); border-color: var(--rating-4); }
.rating-badge.r5 { background: var(--rating-5-tint); border-color: var(--rating-5); }

.breakdown th[scope="row"] { font-weight: 600; text-transform: none; letter-spacing: normal; font-size: .9rem; color: var(--fg); background: none; white-space: normal; }
.row-toggle { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; display: inline-flex; gap: .4rem; align-items: center; text-align: left; }
.row-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chevron { color: var(--muted); width: .8rem; }
.row-reason { font-size: .76rem; font-weight: 400; color: var(--muted); margin: .15rem 0 0 1.2rem; max-width: 48ch; }
.blended-row { background: var(--accent-soft); }
.blended-row th[scope="row"], .blended-row td { font-weight: 700; }
.detail-row td { background: var(--surface-2); white-space: normal; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .6rem 1.5rem; font-size: .84rem; }
.detail-block h4 { margin: 0 0 .2rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.detail-block p { margin: 0; }
.detail-block ul { margin: 0; padding-left: 1.1rem; }
.detail-reason { grid-column: 1 / -1; margin: 0; font-weight: 600; }

.range-chart { width: 100%; min-height: 200px; }

.assumptions-panel { padding: .8rem 1.1rem; margin-top: 1.6rem; }
.assumptions-panel > summary { cursor: pointer; font-weight: 700; font-size: 1.02rem; display: flex; align-items: center; gap: .5rem; }
.assumptions-table th[scope="row"] { font-weight: 500; text-transform: none; letter-spacing: normal; font-size: .86rem; color: var(--fg); background: none; white-space: normal; }
.assumptions-table td, .assumptions-table th { padding: .35rem .6rem; }
.input-unit { display: inline-flex; align-items: center; gap: .3rem; font-size: .82rem; color: var(--muted); }
.input-unit input {
  width: 6.2rem; padding: .3rem .45rem; font: inherit; font-size: .88rem; color: var(--fg);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; font-variant-numeric: tabular-nums;
}
.input-unit input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.assumptions-actions { display: flex; gap: .5rem; margin: .7rem 0 .4rem; flex-wrap: wrap; }

.sensitivity td, .sensitivity th { text-align: right; }
.sensitivity th[scope="row"] { color: var(--fg); font-weight: 600; background: var(--surface-2); }
.sensitivity td.cell-r1 { background: var(--rating-1-tint); } .sensitivity td.cell-r2 { background: var(--rating-2-tint); }
.sensitivity td.cell-r3 { background: var(--rating-3-tint); } .sensitivity td.cell-r4 { background: var(--rating-4-tint); }
.sensitivity td.cell-r5 { background: var(--rating-5-tint); }
.sensitivity td.cell-invalid { color: var(--muted); }
.sensitivity th.base-col, .sensitivity th[scope="row"].base-col { color: var(--accent); }
.sensitivity td.base-cell { box-shadow: inset 0 0 0 2px var(--fg); font-weight: 700; }

.ai-summary { margin: 0; font-size: .92rem; }
.ai-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.ai-card { padding: 1rem 1.2rem; }
.ai-card h3 { font-size: .95rem; margin: 1.1rem 0 .35rem; }
.ai-card h3:first-of-type { margin-top: 0; }
.ai-card p { margin: 0; font-size: .9rem; }
.ai-card ul { margin: 0; padding-left: 1.15rem; font-size: .9rem; }
.ai-card li + li { margin-top: .2rem; }
.ai-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .3rem 1.5rem; }
.ai-grid h4 { margin: .6rem 0 .25rem; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.ai-factors { margin: .8rem 0 .2rem; }
.ai-factors th[scope="row"] { font-weight: 600; text-transform: none; letter-spacing: normal; font-size: .9rem; color: var(--fg); background: none; }
.ai-callout { padding: .6rem .8rem; border-radius: 8px; background: var(--warning-bg); border: 1px solid var(--warning-border); color: var(--warning-fg); margin: 0 0 .8rem !important; }
#ai-evidence .detail-block { margin-top: .6rem; }

/* ---------- responsive ---------- */

@media (max-width: 760px) {
  .header-inner { gap: .6rem; }
  .brand span { font-size: .95rem; }
  .search { order: 3; flex-basis: 100%; justify-content: stretch; }
  .search input { flex: 1 1 auto; }
  #theme-toggle { margin-left: auto; }
  .combo-chart { height: 380px; }
  .val-panels { grid-template-columns: minmax(0, 1fr); }
  .gauge-labels { font-size: .6rem; }
  .price-block { text-align: left; width: 100%; }
  .price-line { justify-content: flex-start; }
  .overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-grid dd { white-space: normal; }
  .btn span { display: none; }
  .card-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  .metric-value { font-size: 1.3rem; }
}
