/* Tokens: light is default; dark follows the OS unless the viewer picks a theme. */
:root {
  color-scheme: light;
  --page: #f4f4f1; --surface: #fcfcfb; --ink: #0b0b0b; --ink2: #52514e; --muted: #898781;
  --grid: #e1e0d9; --axis: #c3c2b7; --border: rgba(11,11,11,.10); --shadow: 0 1px 2px rgba(11,11,11,.04), 0 8px 24px -12px rgba(11,11,11,.12);
  --c1: #2a78d6; --c2: #eb6834; --c3: #1baf7a; --c4: #eda100;
  --blue-soft: rgba(42,120,214,.10); --good: #006300; --bad: #c42f2f; --good-bg: rgba(0,99,0,.09); --bad-bg: rgba(196,47,47,.09);
  --glow: rgba(42,120,214,.16);
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --ink: #ffffff; --ink2: #c3c2b7; --muted: #898781;
    --grid: #2c2c2a; --axis: #383835; --border: rgba(255,255,255,.10); --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 30px -14px rgba(0,0,0,.7);
    --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500;
    --blue-soft: rgba(57,135,229,.14); --good: #0ca30c; --bad: #e66767; --good-bg: rgba(12,163,12,.14); --bad-bg: rgba(230,103,103,.14);
    --glow: rgba(57,135,229,.22);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --ink: #ffffff; --ink2: #c3c2b7; --muted: #898781;
  --grid: #2c2c2a; --axis: #383835; --border: rgba(255,255,255,.10); --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 30px -14px rgba(0,0,0,.7);
  --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500;
  --blue-soft: rgba(57,135,229,.14); --good: #0ca30c; --bad: #e66767; --good-bg: rgba(12,163,12,.14); --bad-bg: rgba(230,103,103,.14);
  --glow: rgba(57,135,229,.22);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); background: var(--page);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background-image: radial-gradient(900px 380px at 15% -80px, var(--glow), transparent 70%);
  background-repeat: no-repeat;
}
h1, h2, h3, p { margin: 0; }
a { color: var(--c1); }

/* ---------- top bar ---------- */
.top { position: sticky; top: 0; z-index: 20; backdrop-filter: blur(14px) saturate(1.4);
  background: color-mix(in srgb, var(--page) 78%, transparent); border-bottom: 1px solid var(--border); }
.top-in { max-width: 1240px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: #fff;
  background: linear-gradient(140deg, var(--c1), color-mix(in srgb, var(--c1) 55%, #6a4ad8)); flex: none; }
.brand h1 { font-size: 17px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.brand p { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actions { display: flex; align-items: center; gap: 10px; flex: none; }
.range { display: flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 3px 6px; font-size: 13px; color: var(--muted); }
.range label { display: flex; align-items: center; gap: 4px; }
.dash { color: var(--axis); }
select { appearance: none; background: transparent; color: var(--ink); border: 0; font: inherit; font-weight: 600;
  padding: 5px 4px; cursor: pointer; border-radius: 6px; }
select:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--c1); outline-offset: 2px; }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--ink2); }
.icon-btn:hover { color: var(--ink); }
.i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: block; } :root[data-theme="dark"] .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .i-sun { display: block; }
  :root:where(:not([data-theme="light"])) .i-moon { display: none; }
}

/* ---------- layout ---------- */
.wrap { max-width: 1240px; margin: 0 auto; padding: 24px 20px 8px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel { display: none; flex-direction: column; gap: 16px; } .panel.active { display: flex; }
.panel > .grid2, .panel > .card { margin: 0; }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: 1.55fr 1fr; gap: 16px; margin-bottom: 16px; }
.hero-main { padding: 28px 28px 22px; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 18px; }
.hero-label { font-size: 13px; font-weight: 600; color: var(--ink2); letter-spacing: .02em; text-transform: uppercase; }
.hero-value { font-size: clamp(44px, 7vw, 68px); font-weight: 750; letter-spacing: -.035em; line-height: 1.02; margin: 6px 0 10px; }
.hero-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: var(--ink2); font-size: 13.5px; }
.hero-spark { margin: 0 -28px -22px; height: 96px; }
.hero-spark svg { display: block; width: 100%; height: 100%; }
.insights { padding: 22px 22px 14px; }
.insights h2 { font-size: 13px; font-weight: 600; color: var(--ink2); letter-spacing: .02em; text-transform: uppercase; margin-bottom: 10px; }
.insights ul { list-style: none; margin: 0; padding: 0; display: grid; }
.insights li { display: grid; grid-template-columns: 32px 1fr; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.insights li:first-child { border-top: 0; }
.ins-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--blue-soft); color: var(--c1); }
.insights b { display: block; font-size: 14px; }
.insights span.t { font-size: 13px; color: var(--ink2); }

/* ---------- chips & tiles ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 13px; font-weight: 650; white-space: nowrap; }
.chip.up { color: var(--good); background: var(--good-bg); } .chip.down { color: var(--bad); background: var(--bad-bg); }
.chip.flat { color: var(--ink2); background: var(--grid); }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.panel .tiles { margin-bottom: 0; }
.tiles-3 { grid-template-columns: repeat(3, 1fr); } .tiles-4 { grid-template-columns: repeat(4, 1fr); }
.tile { padding: 16px 18px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; }
.tile .l { font-size: 13px; color: var(--ink2); }
.tile .v { font-size: 28px; font-weight: 720; letter-spacing: -.02em; line-height: 1.15; }
.tile .sub { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.tile .spark { height: 34px; margin-top: 4px; } .tile .spark svg { display: block; width: 100%; height: 100%; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; padding: 4px; margin: 0; overflow-x: auto; width: fit-content; max-width: 100%;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { background: none; border: 0; color: var(--ink2); font: inherit; font-weight: 600; font-size: 14px; padding: 8px 16px;
  border-radius: 9px; cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button.active { background: var(--ink); color: var(--surface); }

/* ---------- chart cards ---------- */
article.card { padding: 20px 20px 12px; }
article.card header { margin-bottom: 8px; }
article.card h3 { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
article.card header p { font-size: 13px; color: var(--muted); margin-top: 2px; }
.plot { height: 340px; width: 100%; } .plot.h-md { height: 380px; } .plot.h-lg { height: 420px; } .plot.h-xl { height: 500px; } .plot.sm { height: 260px; }
.row-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
input[type=search] { background: var(--page); border: 1px solid var(--border); color: var(--ink); border-radius: 10px; padding: 8px 12px; font: inherit; font-size: 14px; width: 240px; max-width: 100%; }

/* ---------- forecast controls ---------- */
.controls-card { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; justify-content: space-between; padding: 14px 18px; }
.seg { display: inline-flex; background: var(--page); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; color: var(--ink2); font: inherit; font-weight: 600; font-size: 14px; padding: 6px 14px; border-radius: 8px; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--border), 0 1px 3px rgba(0,0,0,.12); }
.slider { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--ink2); }
.slider b { color: var(--ink); min-width: 78px; }
input[type=range] { accent-color: var(--c1); width: 220px; }
.note { color: var(--muted); font-size: 13px; max-width: 880px; }

/* ---------- table ---------- */
.tablewrap { overflow-x: auto; margin: 0 -20px -12px; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
th, td { text-align: left; padding: 10px 16px; border-top: 1px solid var(--border); white-space: nowrap; }
tbody tr:hover td { background: var(--page); }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
td.t { max-width: 420px; overflow: hidden; text-overflow: ellipsis; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-weight: 650; font-size: 12.5px; background: var(--blue-soft); color: var(--c1); }

footer { max-width: 1240px; margin: 0 auto; padding: 24px 20px 40px; color: var(--muted); font-size: 12.5px; line-height: 1.6; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .tiles, .tiles-4 { grid-template-columns: repeat(2, 1fr); } .tiles-3 { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .top-in { padding: 10px 14px; } .wrap { padding: 16px 14px 8px; }
  .brand p, .lbl { display: none; } .brand h1 { font-size: 15px; } .range { font-size: 12px; } .actions { gap: 8px; }
  .hero-main { padding: 20px 20px 16px; } .hero-spark { margin: 0 -20px -16px; }
  .tiles, .tiles-4 { grid-template-columns: 1fr 1fr; gap: 10px; } .tile .v { font-size: 22px; }
  .plot, .plot.h-md, .plot.h-lg, .plot.sm { height: 300px; } .plot.h-xl { height: 380px; }
  input[type=range] { width: 150px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- toolbar, chips, toggles ---------- */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.presets, .togglebar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chipbtn { border: 1px solid var(--border); background: var(--surface); color: var(--ink2); border-radius: 999px; padding: 6px 12px;
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: background .15s, color .15s, border-color .15s; white-space: nowrap; }
.chipbtn:hover { color: var(--ink); border-color: var(--axis); }
.chipbtn.on, .chipbtn[aria-pressed="true"] { background: var(--blue-soft); color: var(--c1); border-color: color-mix(in srgb, var(--c1) 45%, transparent); }
.chipbtn.ghost { border-style: dashed; }
.togglebar .seg { overflow-x: auto; max-width: 100%; }
.seg button { white-space: nowrap; }

/* ---------- selectable hero / tiles ---------- */
button.tile { text-align: left; font: inherit; color: inherit; width: 100%; cursor: pointer; transition: transform .15s, box-shadow .15s; }
button.tile:hover, .selectable:hover { transform: translateY(-2px); }
.selectable { cursor: pointer; transition: transform .15s, box-shadow .15s; }
.tile.sel, .selectable.sel { box-shadow: 0 0 0 2px var(--c1), var(--shadow); }
.tile.inline { box-shadow: none; }
.tiles.inline { margin-bottom: 8px; }
.insights h2 { display: flex; justify-content: space-between; align-items: baseline; }
.insights h2 small { font-size: 11.5px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); }
.insights li.go { cursor: pointer; margin: 0 -10px; padding: 12px 10px; border-radius: 10px; position: relative; transition: background .15s; }
.insights li.go:hover { background: var(--page); }
.insights li.go::after { content: "›"; position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 20px; }
.insights li.go div { padding-right: 18px; }

/* ---------- motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.panel.active > * { animation: rise .25s ease both; }
.hero, .tiles { animation: rise .5s ease both; } .tiles { animation-delay: .08s; }
[hidden] { display: none !important; }

/* ---------- table sorting ---------- */
th.sortable { cursor: pointer; user-select: none; } th.sortable:hover { color: var(--ink); }
th.sorted { color: var(--ink); }

/* ---------- forecast scenario ---------- */
#whatifWrap input { width: 160px; }
.chipbtn.small { padding: 3px 9px; font-size: 12px; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow); transition: opacity .2s, transform .2s; z-index: 50; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.clickable .nsewdrag { cursor: pointer !important; }

/* ---------- small-screen containment ---------- */
.panel > *, .grid2 > *, .card, .row-head > div { min-width: 0; max-width: 100%; }
.slider { flex-wrap: wrap; }
.togglebar .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
@media (max-width: 700px) {
  .togglebar { width: 100%; }
  .controls-card { gap: 14px; } .slider { width: 100%; } .slider input[type=range] { flex: 1; min-width: 120px; width: auto; }
  #whatifWrap input { width: auto; }
  .tablewrap { margin: 0 -20px -12px; }
}

/* ---------- executive brief & forecast lab ---------- */
body:not([data-tab="overview"]) #perfTop { display: none; }
body:not([data-tab="performance"]) :is(.range, #presets) { display: none; }
.sect { font-size: 13px; font-weight: 600; color: var(--ink2); letter-spacing: .02em; text-transform: uppercase; margin: 4px 0 10px; }
.verdict { padding: 26px 28px; display: grid; grid-template-columns: 1.5fr 1fr; gap: 28px; align-items: center; }
.verdict h2 { font-size: clamp(24px, 3.4vw, 36px); font-weight: 750; letter-spacing: -.025em; line-height: 1.15; margin-bottom: 10px; }
.verdict .lead { color: var(--ink2); font-size: 15px; margin-bottom: 14px; }
.verdict .lead b { color: var(--ink); }
.verdict .badges { display: flex; flex-wrap: wrap; gap: 8px; }
.vt { border-left: 1px solid var(--border); padding-left: 28px; display: grid; gap: 10px; }
.vt .l { font-size: 13px; font-weight: 600; color: var(--ink2); text-transform: uppercase; letter-spacing: .02em; }
.vt-input { display: flex; align-items: center; gap: 8px; }
.vt-input input, .field input[type=text] { background: var(--page); border: 1px solid var(--border); color: var(--ink); border-radius: 10px; padding: 8px 12px; font: inherit; font-weight: 650; width: 100%; max-width: 190px; }
.gauge { display: flex; align-items: center; gap: 16px; }
.gauge svg { width: 132px; height: 78px; flex: none; }
.gauge .gv { font-size: 30px; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; }
.gauge .gt { font-size: 13px; color: var(--ink2); }
.quick { display: flex; gap: 6px; flex-wrap: wrap; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: 13px; font-weight: 650; background: var(--grid); color: var(--ink2); white-space: nowrap; }
.badge.good { background: var(--good-bg); color: var(--good); } .badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.warn { background: rgba(237,161,0,.16); color: #8a5a00; } .badge.info { background: var(--blue-soft); color: var(--c1); }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .badge.warn { color: #f0b84a; } }
:root[data-theme="dark"] .badge.warn { color: #f0b84a; }

.decisions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.dcard { padding: 18px; text-align: left; font: inherit; color: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); transition: transform .15s; }
.dcard:hover { transform: translateY(-2px); } .dcard.empty { cursor: default; opacity: .7; } .dcard.empty:hover { transform: none; }
.dcard h4 { margin: 0; font-size: 17px; letter-spacing: -.01em; line-height: 1.25; }
.dcard p { margin: 0; font-size: 13.5px; color: var(--ink2); }
.dcard .go { margin-top: auto; font-size: 13px; font-weight: 650; color: var(--c1); }

.pulse-stat { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; margin: 2px 0 6px; }
.pulse-stat .big { font-size: 30px; font-weight: 750; letter-spacing: -.02em; }
.pulse-stat .small { color: var(--ink2); font-size: 13.5px; }
.alist { display: grid; }
.alist .arow { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); cursor: pointer; }
.alist .arow:first-child { border-top: 0; } .alist .arow:hover b { color: var(--c1); }
.alist small { display: block; color: var(--muted); font-size: 12.5px; }
.empty-note { color: var(--ink2); font-size: 14px; padding: 8px 0; }

details.rules, details.scenario { margin: 4px 0 12px; }
details summary { cursor: pointer; font-weight: 650; font-size: 14px; padding: 6px 0; }
details summary span { font-weight: 400; color: var(--muted); font-size: 13px; }
.rules-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 24px; margin: 8px 0; }
.rules-grid .slider { flex-direction: column; align-items: stretch; gap: 4px; }
.rules-grid input[type=range] { width: 100%; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--page); }
.trend-cell { width: 90px; } .trend-cell svg { width: 86px; height: 24px; display: block; }
td .sub2 { display: block; color: var(--muted); font-size: 12px; }

.lab-controls { display: grid; gap: 14px; }
.lab-row { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink2); min-width: 0; }
.field .fl { font-size: 13px; }
.field select { background: var(--page); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; font-weight: 600; min-width: 230px; max-width: 100%; }
.field.slider { flex-direction: column; align-items: stretch; } .field.slider input { width: 200px; }
.scenario summary span { color: var(--c1); font-weight: 650; }
.trust-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 8px; }
.tg { background: var(--page); border-radius: 12px; padding: 12px 14px; }
.tg .l { font-size: 12.5px; color: var(--muted); } .tg .v { font-size: 18px; font-weight: 700; margin: 2px 0; } .tg .s { font-size: 12.5px; color: var(--ink2); }
.method ul { margin: 0; padding-left: 18px; display: grid; gap: 8px; color: var(--ink2); font-size: 14px; } .method b { color: var(--ink); }

@media (max-width: 900px) {
  .verdict { grid-template-columns: 1fr; } .vt { border-left: 0; padding-left: 0; border-top: 1px solid var(--border); padding-top: 16px; }
  .decisions { grid-template-columns: 1fr 1fr; } .rules-grid { grid-template-columns: 1fr; } .trust-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) { .decisions, .trust-grid { grid-template-columns: 1fr; } .verdict { padding: 20px; } .field select { min-width: 0; width: 100%; } .field { width: 100%; } .field.slider input { width: 100%; } }

/* scorecard: keep all columns visible on laptop widths */
#scorecard th, #scorecard td { padding: 10px 12px; }
#scorecard td:first-child { max-width: 250px; white-space: normal; }
#scorecard td:first-child b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#scorecard .badge { padding: 3px 9px; font-size: 12.5px; }
#plan th, #plan td { padding: 9px 14px; }

/* ---------- freshness notice, company strip, market tab ---------- */
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: 12px; font-size: 14px; color: var(--ink2);
  background: rgba(237,161,0,.12); border: 1px solid rgba(237,161,0,.35); }
.notice b { color: var(--ink); } .notice .n-ic { font-size: 18px; line-height: 1.3; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; font-weight: 650; color: var(--c1); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.strip { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 28px; padding: 14px 20px; font-size: 14px; }
.strip > div { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } .strip b { font-size: 16px; }
.cs-tag { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--c1); background: var(--blue-soft); padding: 3px 9px; border-radius: 999px; }
.cs-k { color: var(--muted); } .cs-sub { color: var(--ink2); font-size: 13px; } .strip .linkbtn { margin-left: auto; }
.fresh table th, .fresh table td { padding: 12px 18px; } .fresh { margin: 0 -20px -12px; }
@media (max-width: 700px) { .strip .linkbtn { margin-left: 0; } .strip { gap: 8px 18px; } }

/* ---------- product explorer, data quality, extra grids ---------- */
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.tiles-5 { grid-template-columns: repeat(5, 1fr); }
.px-controls { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 12px; }
.px-controls input[type=search] { flex: 1 1 280px; width: auto; max-width: none; }
.px-controls select { background: var(--page); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; font-weight: 600; max-width: 100%; }
.px-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sub-h { margin: 18px 0 6px; font-size: 14px; font-weight: 650; color: var(--ink2); }
.notes-list { margin: 0; padding-left: 18px; display: grid; gap: 8px; color: var(--ink2); font-size: 14px; } .notes-list b { color: var(--ink); }
.theme-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.theme-head .note { margin: 0; }
.simlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin: 6px 0 14px; }
.simbtn { text-align: left; font: inherit; color: inherit; cursor: pointer; padding: 10px 12px; background: var(--page); border: 1px solid var(--border); border-radius: 12px; display: flex; flex-direction: column; gap: 4px; }
.simbtn:hover { border-color: var(--c1); } .simbtn b { font-size: 13px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; } .simbtn span { font-size: 12.5px; color: var(--ink2); }
td.pt { max-width: 440px; } td.pt b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tr.sel-row td { background: var(--blue-soft); } .up-t { color: var(--good); } .down-t { color: var(--bad); }
td.wrap { white-space: normal; min-width: 260px; } .more { text-align: center; padding: 14px 0 4px; }
@media (max-width: 900px) { .grid3 { grid-template-columns: 1fr; } .tiles-5 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .tiles-5 { grid-template-columns: 1fr 1fr; } }

.dotk { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; vertical-align: baseline; }

/* segmented controls never push the page wider than the screen */
.seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; } .seg::-webkit-scrollbar { display: none; }
.theme-head > * { min-width: 0; max-width: 100%; }
@media (max-width: 560px) { .seg button { padding: 6px 10px; font-size: 13px; } }

/* ---------- product lifecycle ---------- */
.lcv { padding: 24px 28px; }
.lcv h2 { font-size: clamp(22px, 3vw, 30px); font-weight: 750; letter-spacing: -.02em; line-height: 1.2; margin-bottom: 12px; }
.lead-list { font-size: 15px; gap: 10px; }

/* ---------- shared header: data freshness ---------- */
.fresh { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; min-width: 0; }
.fchip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font: inherit; font-size: 12.5px; color: var(--ink2); cursor: pointer; background: var(--surface); border: 1px solid var(--border); white-space: nowrap; }
.fchip:hover { color: var(--ink); border-color: var(--axis); } .fchip b { color: var(--ink); font-weight: 650; }
.fdot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.fchip.good .fdot { background: var(--good); } .fchip.warn .fdot { background: var(--c4); } .fchip.bad .fdot { background: var(--bad); }
.fchip.all { display: none; }
@media (max-width: 1100px) { .fchip:not(.all) { display: none; } .fchip.all { display: inline-flex; } }

/* ---------- "i" pop-ups: short explanations on demand ---------- */
.tip { display: inline-grid; place-items: center; width: 17px; height: 17px; margin-left: 4px; border-radius: 50%; border: 1px solid var(--axis); background: none; color: var(--muted); font: italic 700 11px/1 Georgia, serif; cursor: help; position: relative; vertical-align: 1px; padding: 0; }
.tip:hover, .tip:focus-visible { color: var(--c1); border-color: var(--c1); }
.tip::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); width: max-content; max-width: min(300px, 80vw); padding: 9px 12px; border-radius: 10px;
  background: var(--ink); color: var(--surface); font: 400 12.5px/1.45 system-ui, sans-serif; font-style: normal; text-align: left; white-space: normal; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 40; }
.tip:hover::after, .tip:focus-visible::after { opacity: 1; }

/* ---------- layout bits for the merged tabs ---------- */
.brief-top { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; } .brief-top .notice { flex: 1 1 420px; }
.view-seg { align-self: flex-start; margin-bottom: 4px; } .stack { display: flex; flex-direction: column; gap: 16px; } .stack[hidden] { display: none; }
.cmp-pick { display: flex; flex-wrap: wrap; gap: 12px 20px; margin-bottom: 12px; } .cmp-pick .field { flex: 1 1 220px; } .cmp-pick select { width: 100%; min-width: 0; }
td.rowlab { color: var(--ink2); font-weight: 600; white-space: nowrap; } #cmpTable th { white-space: normal; min-width: 150px; }
.changes .lead2, #changesBody .lead2 { color: var(--ink2); margin-bottom: 8px; } #changesBody .lead2 b { color: var(--ink); }
.chg-list { list-style: none; margin: 8px 0; padding: 0; display: grid; } .chg-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid var(--border); cursor: pointer; } .chg-list li:first-child { border-top: 0; } .chg-list li:hover b { color: var(--c1); }
.chg-list .sub2 { flex-basis: 100%; margin-left: 2px; }
details.method { padding: 14px 20px; } details.method > summary { cursor: pointer; font-size: 16px; font-weight: 700; } details.method[open] > summary { margin-bottom: 10px; }
.back { margin: 0 0 4px; } .foot-links { margin-bottom: 6px; } .infoline { display: inline; }
.print-head { display: none; }

/* ---------- print: one clean page ---------- */
@media print {
  body { background: #fff !important; color: #000 !important; }
  .top, .toolbar, .toast, footer, #printBtn, .presets, .tabs, .chipbtn, .seg, .tip, .more, .quick, .linkbtn, .rules, .back { display: none !important; }
  .print-head { display: flex !important; justify-content: space-between; margin: 0 0 12px; font-size: 14px; border-bottom: 1px solid #ccc; padding-bottom: 6px; }
  .panel:not(.active) { display: none !important; }
  .panel.active > *, .hero, .tiles { animation: none !important; }
  .wrap { max-width: none; padding: 0; }
  .card, .tile, .dcard { box-shadow: none !important; border: 1px solid #ccc; break-inside: avoid; }
  .plot { height: 230px !important; }
  #scorecard tbody tr:nth-child(n+11) { display: none; }
  #tab-brief .tablewrap { overflow: visible; }
}

/* ---------- ask the dashboard, explainers ---------- */
.ask input[type=search] { width: 100%; max-width: none; margin: 4px 0 10px; padding: 11px 14px; font-size: 15px; }
.ask-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ask-answer { margin-top: 14px; padding: 16px 18px; border-radius: 12px; background: var(--page); border-left: 3px solid var(--c1); }
.ask-q { font-size: 12.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin-bottom: 4px; }
.ask-head { font-size: 17px; font-weight: 650; letter-spacing: -.01em; line-height: 1.35; margin-bottom: 8px; }
.ask-answer ul { margin: 0 0 10px; padding-left: 18px; display: grid; gap: 6px; color: var(--ink2); font-size: 14.5px; } .ask-answer ul b { color: var(--ink); }
.ask-foot { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; font-size: 13px; } .ask-cav { color: var(--muted); }
.sub2i { color: var(--muted); font-size: 12px; font-weight: 400; font-style: normal; }
.explain-wrap { margin: 2px 0 8px; } .explain-btn { background: none; border: 0; padding: 4px 0; font: inherit; font-size: 13px; font-weight: 650; color: var(--c1); cursor: pointer; }
.explain-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
.explain { margin-top: 6px; padding: 12px 14px; border-radius: 10px; background: var(--page); font-size: 14px; color: var(--ink2); } .explain p { margin: 0 0 8px; } .explain p:last-child { margin: 0; } .explain b { color: var(--ink); }
@media print { .ask, .explain-wrap { display: none !important; } }

/* Tesla vs BYD: nav separator, plain lists, and header items that only belong to the Amazon archive */
.tabs .navsep { align-self: center; padding: 0 8px 0 12px; margin-left: 6px; border-left: 1px solid var(--line, var(--axis)); font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
ul.plain { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
body[data-tab="versus"] .range, body[data-tab="ev"] .range, body[data-tab="versus"] .fresh, body[data-tab="ev"] .fresh, body[data-tab="versus"] .presets, body[data-tab="ev"] .presets { display: none !important; }

/* Tableau Public embed */
.tb-frame { position: relative; width: 100%; height: min(900px, 80vh); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff; margin-top: 12px; }
.tb-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
