/* ============================================================
   Carilo design system v5 — precise, industrial, clear.
   Tokens → base → components → pages. Spacing on a 4px grid.
   Light and dark are both designed.
   ============================================================ */
:root {
  color-scheme: light;
  --bg: #F4F6FA; --surface-1: #FFFFFF; --surface-2: #EEF2F8; --ink: #111827; --ink-2: #2B3648; --muted: #526174;
  --line: #DCE3EE; --line-2: #C2CCDB;
  --brand: #3454D1; --brand-hover: #2842AD; --brand-ink: #FFFFFF; --brand-soft: #EAEEFB; --logo: #1E2A5A;
  --accent: #D97706; --accent-soft: #FDF3E2;
  --up: #2842AD; --down: #B45309; --ok: #15703B; --warn: #A15C07; --bad: #B42318;
  --series-1: #3454D1; --series-2: #0a8f9d; --series-3: #7952B3; --series-4: #D97706; --series-5: #d55181; --seq: #3454D1;
  --r-s: 6px; --r: 8px; --r-l: 12px; --max: 1360px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --font: Vazirmatn, "Noto Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #0B1220; --surface-1: #111827; --surface-2: #1A2334; --ink: #F1F5FB; --ink-2: #D3DBE8; --muted: #9AA8BD;
    --line: #243046; --line-2: #33425C;
    --brand: #7F98F5; --brand-hover: #9DB0F8; --brand-ink: #0B1220; --brand-soft: #1B2747; --logo: #E6ECFA;
    --accent: #F0A13A; --accent-soft: #33260F;
    --up: #9DB0F8; --down: #F0A13A; --ok: #6FD39A; --warn: #F0B45A; --bad: #F58B80;
    --series-1: #5f7cf0; --series-2: #1a97a5; --series-3: #9a74dc; --series-4: #c98500; --series-5: #d55181; --seq: #5f7cf0;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0B1220; --surface-1: #111827; --surface-2: #1A2334; --ink: #F1F5FB; --ink-2: #D3DBE8; --muted: #9AA8BD;
  --line: #243046; --line-2: #33425C;
  --brand: #7F98F5; --brand-hover: #9DB0F8; --brand-ink: #0B1220; --brand-soft: #1B2747; --logo: #E6ECFA;
  --accent: #F0A13A; --accent-soft: #33260F;
  --up: #9DB0F8; --down: #F0A13A; --ok: #6FD39A; --warn: #F0B45A; --bad: #F58B80;
  --series-1: #5f7cf0; --series-2: #1a97a5; --series-3: #9a74dc; --series-4: #c98500; --series-5: #d55181; --seq: #5f7cf0;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.75; font-family: var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; } a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.4; margin: 0 0 var(--s2); }
h1 { font-size: clamp(1.5rem, 2.2vw, 2rem); font-weight: 800; }
h2 { font-size: 1.125rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 var(--s3); max-width: 70ch; }
code { font-family: var(--mono); font-size: .9em; direction: ltr; unicode-bidi: isolate; display: inline-block; background: var(--surface-2); padding: 0 .35em; border-radius: 4px; }
bdi { unicode-bidi: isolate; }
.num { text-align: left; direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
.num-inline { unicode-bidi: plaintext; font-variant-numeric: tabular-nums; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--s4); }
.muted { color: var(--muted); } .small { font-size: .875rem; }
.lead { font-size: 1.0625rem; color: var(--ink-2); max-width: 56ch; }
.eyebrow { font-size: .8125rem; font-weight: 700; color: var(--brand); margin: 0 0 var(--s1); }
.skip { position: absolute; top: -40px; left: 0; background: var(--brand); color: var(--brand-ink); padding: 6px 10px; } .skip:focus { top: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ico { width: 18px; height: 18px; vertical-align: -3px; flex: none; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- header / footer ---------- */
.site-header { background: var(--surface-1); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.header-row { display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s4); flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: var(--s2); color: var(--logo); font-weight: 800; font-size: 1.25rem; line-height: 1; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 32px; height: 32px; flex: none; } .brand .brand-mark circle { fill: var(--brand); }
.brand-word { padding-top: 2px; }
.brand.light { color: #F1F5FB; } .brand.light .brand-mark circle { fill: #9DB0F8; }
.header-nav { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.header-nav > a, .nav-group > summary { color: var(--ink-2); padding: 6px 10px; border-radius: var(--r-s); font-weight: 600; font-size: .9375rem; cursor: pointer; list-style: none; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::after { content: " ▾"; font-size: .7em; color: var(--muted); }
.header-nav > a:hover, .nav-group > summary:hover { background: var(--surface-2); text-decoration: none; }
.header-nav > a[aria-current] { color: var(--brand); box-shadow: inset 0 -2px 0 var(--brand); }
.nav-group { position: relative; }
.nav-menu { position: absolute; top: calc(100% + 4px); inset-inline-start: 0; background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s1); display: grid; min-width: 210px; z-index: 30; box-shadow: 0 8px 20px -12px rgba(17,24,39,.35); }
.nav-menu a { padding: 7px 10px; border-radius: var(--r-s); color: var(--ink); } .nav-menu a:hover { background: var(--surface-2); text-decoration: none; }
.header-search { display: flex; align-items: center; gap: 6px; flex: 1 1 200px; max-width: 340px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 0 10px; color: var(--muted); margin-inline-start: auto; }
.header-search input { flex: 1; background: transparent; border: 0; color: var(--ink); padding: 7px 4px; font: inherit; font-size: .9375rem; outline: none; min-width: 100px; width: auto; }
.header-search:focus-within { border-color: var(--brand); }
.theme-toggle { border: 1px solid var(--line); background: transparent; color: var(--ink-2); width: 36px; height: 36px; border-radius: var(--r); cursor: pointer; display: grid; place-items: center; }
.theme-toggle svg { width: 18px; height: 18px; }
main { min-height: 60vh; padding-bottom: var(--s7); }
.messages { list-style: none; padding: 0; margin: var(--s3) 0; }
.msg { padding: var(--s2) var(--s3); border-radius: var(--r); background: var(--brand-soft); margin-bottom: 6px; border: 1px solid var(--line); }
.msg.error { background: var(--accent-soft); }
.site-footer { background: #111827; color: #D3DBE8; padding: var(--s6) 0; font-size: .9375rem; margin-top: var(--s5); }
.site-footer a { color: #C7D2F5; } .site-footer .muted { color: #9AA8BD; } .site-footer p { max-width: 52ch; }
.footer-grid { display: grid; gap: var(--s5); grid-template-columns: 1fr; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; border-radius: var(--r); border: 1px solid var(--line-2); color: var(--ink); background: var(--surface-1); font: inherit; font-weight: 600; font-size: .9375rem; cursor: pointer; text-decoration: none; line-height: 1.5; white-space: nowrap; }
.btn:hover { text-decoration: none; border-color: var(--brand); color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); } .btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: var(--brand-ink); }
.btn.ghost { background: transparent; }
.btn.small { padding: 3px 10px; font-size: .8125rem; } .btn:disabled { opacity: .5; cursor: default; }
.btn.done { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.linkbtn { background: none; border: 0; color: var(--brand); font: inherit; font-size: .875rem; cursor: pointer; padding: 0; }
.linkbtn:hover { text-decoration: underline; }
.badge { background: var(--accent); color: #fff; border-radius: 10px; padding: 0 7px; font-size: .75rem; font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: var(--s2) 0; }
.chip { border: 1px solid var(--line-2); border-radius: 999px; padding: 2px 12px; background: var(--surface-1); color: var(--ink-2); font-size: .875rem; }
.chip.on { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); font-weight: 600; }
.tag { display: inline-block; font-size: .75rem; padding: 0 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-weight: 600; line-height: 1.7; }
.tag.warn { background: var(--accent-soft); color: var(--warn); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); margin-inline-end: 6px; } .dot.on { background: var(--ok); }
/* direction is carried by sign + arrow; colour is secondary and not good/bad */
.delta { font-family: var(--font); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink-2); }
.delta.up { color: var(--up); } .delta.down { color: var(--down); } .delta.weak { opacity: .6; font-weight: 600; }
.delta.up::before { content: "▲"; font-size: .62em; margin-inline-end: 3px; vertical-align: 1px; } .delta.down::before { content: "▼"; font-size: .62em; margin-inline-end: 3px; vertical-align: 1px; }
.fresh { font-size: .75rem; font-weight: 600; white-space: nowrap; color: var(--muted); }
.fresh.fresh { color: var(--ok); } .fresh.aging { color: var(--warn); }
.fresh::before { content: "○ "; } .fresh.fresh::before { content: "● "; } .fresh.aging::before { content: "◐ "; }
select, input[type=text], input[type=search], input[type=number], input[type=email], input[type=tel], input:not([type]), textarea { width: 100%; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: var(--r); font: inherit; font-size: .9375rem; background: var(--surface-1); color: var(--ink); min-height: 40px; }
select:focus, input:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
textarea { min-height: 84px; }
.form { display: grid; gap: var(--s3); background: var(--surface-1); padding: var(--s4); border: 1px solid var(--line); border-radius: var(--r-l); }
.form label { display: grid; gap: 4px; font-size: .9375rem; }
.errorlist { color: var(--bad); list-style: none; padding: 0; margin: 0; font-size: .875rem; }
.inline-form { display: flex; gap: var(--s2); align-items: end; flex-wrap: wrap; }
.inline-form label.qty { display: grid; gap: 2px; font-size: .8125rem; width: 88px; color: var(--muted); }
.qty-input { width: 80px; } .cost-input { width: 120px; }
label.check { display: flex; gap: 6px; align-items: center; }
.mini-form { margin-top: var(--s3); } .mini-form summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: .9375rem; }
.mini-form form { display: grid; gap: var(--s2); margin-top: var(--s2); max-width: 420px; } .mini-form label { display: grid; gap: 3px; font-size: .875rem; }
.search-form { display: grid; grid-template-columns: 1fr; gap: var(--s2); margin: var(--s3) 0; }

/* ---------- surfaces & states ---------- */
.section { margin-top: var(--s6); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s3); flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.link-more { font-weight: 600; font-size: .9375rem; white-space: nowrap; }
.page-head { display: grid; gap: var(--s3); margin: var(--s5) 0 var(--s4); }
.crumbs { font-size: .875rem; color: var(--muted); margin: var(--s4) 0 0; }
.cta-row { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; margin: var(--s3) 0 0; }
.cols-2, .split, .two-col, .charts-2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s5); align-items: start; }
.chart-note, .foot-note { font-size: .875rem; color: var(--muted); margin: var(--s2) 0 0; max-width: none; }
.empty, .empty-inline { background: var(--surface-1); border: 1px dashed var(--line-2); border-radius: var(--r); padding: var(--s3) var(--s4); margin: var(--s3) 0; font-size: .9375rem; }
.empty p:last-child { margin-bottom: 0; }
.hint { background: var(--brand-soft); border-radius: var(--r); padding: var(--s2) var(--s3); font-size: .9375rem; margin: var(--s2) 0; }
.notice { background: var(--accent-soft); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s2) var(--s3); }
.error-state { border-inline-start: 3px solid var(--bad); }
.loading { color: var(--muted); font-size: .875rem; }
.plain { list-style: none; padding: 0; margin: 0; } .plain li { margin: 4px 0; }
.guide-list li, .news-list li { display: grid; gap: 2px; padding: var(--s2) 0; border-bottom: 1px solid var(--line); margin: 0; }
.news-list { list-style: none; padding: 0; margin: 0; } .news-list a { color: var(--ink); font-weight: 500; line-height: 1.6; } .news-list a:hover { color: var(--brand); }
.method { font-size: .875rem; margin-top: var(--s3); } .method summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.method div { color: var(--muted); margin-top: var(--s2); } .method p { margin-bottom: var(--s2); }
.about-data { margin-top: var(--s6); border-top: 1px solid var(--line); padding-top: var(--s3); }
.chart-meta { margin-top: var(--s2); }
.meta-grid { display: flex; flex-wrap: wrap; gap: 2px var(--s4); margin: 0; font-size: .8125rem; color: var(--muted); }
.meta-grid div { display: flex; gap: 4px; } .meta-grid dt::after { content: ":"; } .meta-grid dd { margin: 0; color: var(--ink-2); }
.facts { display: flex; gap: var(--s5); flex-wrap: wrap; margin: var(--s3) 0 0; }
.facts div { display: grid; line-height: 1.3; } .facts dt { font-size: .8125rem; color: var(--muted); } .facts dd { margin: 0; font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px var(--s3); font-size: .9375rem; margin: 6px 0 0; } .kv dt { color: var(--muted); } .kv dd { margin: 0; }
.prose p, .prose li { max-width: 72ch; }
.faq { border-bottom: 1px solid var(--line); padding: 6px 0; } .faq summary { cursor: pointer; font-weight: 600; }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r); font-size: .9375rem; overflow: hidden; }
.table th, .table td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table th { background: var(--surface-2); font-weight: 600; font-size: .8125rem; color: var(--muted); white-space: nowrap; }
.table td.num, .table th.num { text-align: left; }
.table.specs th { width: 35%; } .table.compact { font-size: .875rem; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-1); }
.table-scroll .table { border: 0; border-radius: 0; }
.table.board td { line-height: 1.5; } .table.board tbody tr:hover td { background: var(--surface-2); }
.table.board .spark { width: 112px; height: 30px; }
.table.board td.cmp, .table.board th.cmp { width: 36px; padding-inline-end: 0; } .table.board td.cmp input { width: 16px; height: 16px; min-height: 0; }
.active-row td { background: var(--brand-soft) !important; box-shadow: inset 3px 0 0 var(--brand); }
[dir=rtl] .active-row td:first-child { box-shadow: inset -3px 0 0 var(--brand); } [dir=rtl] .active-row td { box-shadow: none; }
.row-actions { white-space: nowrap; text-align: end; }
.table-view { margin-top: var(--s2); max-height: 300px; overflow: auto; } .data-table { font-size: .8125rem; }
.compare-table th:first-child { width: 190px; } .compare-table td { min-width: 190px; }
.pager { display: inline-flex; gap: var(--s2); margin-inline-start: auto; }

/* ---------- cards ---------- */
.insight-card { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s3) var(--s4); display: grid; gap: 4px; align-content: start; }
.ic-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); }
.ic-value { font-size: 1.125rem; font-variant-numeric: tabular-nums; color: var(--ink); }
.insight-card h3 { margin: 2px 0 0; font-size: 1rem; } .insight-card p { margin: 0; }
.card-actions { display: flex; gap: var(--s3); flex-wrap: wrap; font-size: .875rem; font-weight: 600; margin-top: 4px; }
.observations { display: grid; gap: var(--s3); align-content: start; }
.observations.grid3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.insight { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s3) var(--s4); margin: var(--s2) 0; display: grid; gap: 4px; } .insight p { margin: 0; }
.pulse-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s3); }
.pulse-card { display: grid; gap: 6px; background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s3) var(--s4); color: var(--ink); }
.pulse-card:hover { text-decoration: none; border-color: var(--brand); }
.pulse-head { display: grid; line-height: 1.3; } .pulse-group { font-weight: 700; } .pulse-term { font-size: .8125rem; color: var(--muted); }
.spark { width: 100%; height: 40px; display: block; } .pulse-foot { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--s2); }
.cat-card, .cat-row { display: flex; gap: var(--s3); align-items: center; background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s2) var(--s3); color: var(--ink); }
.cat-card:hover, .cat-row:hover { text-decoration: none; border-color: var(--brand); }
.cat-text { display: grid; line-height: 1.45; min-width: 0; } .cat-text .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-icon { width: 36px; height: 36px; border-radius: var(--r); background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: none; }
.cat-icon svg { width: 22px; height: 22px; }
.cat-list { display: grid; gap: 6px; }
.grid { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.grid.products { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.grid.stats { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.card { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r); }
.card.cat { padding: var(--s3); display: grid; gap: 4px; color: var(--ink); } .card.cat:hover { border-color: var(--brand); text-decoration: none; }
.card.cat-block { padding: var(--s3); } .card.cat-block ul { margin: 6px 0 0; font-size: .9375rem; }
.product-card .card-body { display: block; padding: var(--s3); color: var(--ink); }
.product-card img, .img-empty { width: 100%; aspect-ratio: 4/3; object-fit: contain; background: var(--surface-2); border-radius: var(--r-s); display: grid; place-items: center; color: var(--muted); font-size: .8125rem; }
.img-empty.big { aspect-ratio: 4/3; }
.product-card h3 { margin: var(--s2) 0 2px; } .meta { margin: 2px 0; font-size: .9375rem; }
.price { font-weight: 700; margin: 6px 0 0; font-variant-numeric: tabular-nums; } .price.big { font-size: 1.5rem; line-height: 1.3; } .price .unit { font-weight: 500; font-size: .875rem; color: var(--muted); }
.price.stale, .stale { font-weight: 500; color: var(--warn); font-size: .9375rem; }
.avail { font-size: .75rem; padding: 0 8px; border-radius: 999px; background: var(--surface-2); margin-inline-start: 6px; font-weight: 600; }
.avail.in_stock { color: var(--ok); } .avail.low { color: var(--warn); } .avail.out { color: var(--bad); }
.stat { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s3); display: grid; } .stat b { font-size: 1.375rem; } .stat.warn b { color: var(--warn); }
.pro-band { display: grid; gap: var(--s4); grid-template-columns: 1fr; background: var(--surface-1); border: 1px solid var(--line); border-inline-start: 4px solid var(--brand); border-radius: var(--r); padding: var(--s4) var(--s5); align-items: center; }
.pro-band h2 { margin-bottom: 4px; } .pro-band p { margin: 0; color: var(--ink-2); } .pro-band .cta-row { margin: 0; }
.status-labels { list-style: none; padding: 0; margin: var(--s2) 0 0; display: flex; gap: var(--s2); flex-wrap: wrap; }
.status-labels li { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-s); overflow: hidden; font-size: .8125rem; }
.sl-key { background: var(--surface-2); color: var(--muted); padding: 1px 8px; } .sl-val { padding: 1px 8px; font-weight: 600; } .sl-val.na { color: var(--muted); font-weight: 400; }

/* ---------- filter bar ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s3); align-items: end; background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s3); margin: var(--s3) 0; }
.filter-bar label { display: grid; gap: 2px; font-size: .8125rem; color: var(--muted); flex: 1 1 140px; min-width: 130px; max-width: 220px; }
.filter-bar label.grow { flex: 2 1 240px; max-width: none; } .filter-bar label.narrow { flex: 0 1 110px; min-width: 100px; }
.filter-bar select, .filter-bar input { min-height: 36px; padding: 5px 10px; }
.active-filter { font-size: .875rem; color: var(--brand); font-weight: 600; }
.filter-drawer > summary { cursor: pointer; font-weight: 600; margin-top: var(--s3); list-style: none; } .filter-drawer > summary::-webkit-details-marker { display: none; }
.filter-drawer > summary::before { content: "⚙ "; color: var(--muted); }

/* ---------- home ---------- */
.hero-data { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s5); padding: var(--s5) 0 0; align-items: center; }
.hero-data h1 { font-size: clamp(1.75rem, 3vw, 2.5rem); max-width: 16ch; }
.hero-search { display: flex; gap: var(--s2); margin-top: var(--s3); max-width: 520px; } .hero-search input { flex: 1; min-height: 44px; }
.hero-chart { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r-l); padding: var(--s4); min-width: 0; }
.hero-chart .chart-wrap { border: 0; padding: 0; }
.chart-head { display: flex; align-items: baseline; gap: var(--s2) var(--s3); flex-wrap: wrap; margin-bottom: var(--s2); } .chart-head h2 { margin: 0; }
.picker-bar { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s3); margin-bottom: var(--s3); }
.vehicle-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--s3); align-items: end; }
.vehicle-picker label { display: grid; gap: 2px; font-size: .8125rem; color: var(--muted); }

/* ---------- market ---------- */
.market-top { display: grid; grid-template-columns: 1fr; gap: var(--s3); align-items: center; margin: var(--s5) 0 0; }
.market-top h1 { margin: 0; }
.market-search { display: flex; gap: var(--s2); } .market-search input { flex: 1; min-height: 42px; }
.market-actions { display: flex; gap: var(--s2); }
.market-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s5); align-items: start; margin-top: var(--s2); }
.market-main { min-width: 0; display: grid; gap: var(--s5); }
.board-head { display: flex; align-items: baseline; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s2); } .board-head h2 { margin: 0; }
.count { font-size: .8125rem; font-weight: 600; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 0 8px; }
.board-foot { display: flex; align-items: center; gap: var(--s3); margin-top: var(--s2); flex-wrap: wrap; }
.market-panel { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r-l); padding: var(--s4); min-width: 0; }
.market-panel h2 { font-size: 1.25rem; margin-bottom: 2px; } .market-panel .chart-wrap { border: 0; padding: 0; margin-top: var(--s2); }
.panel-h { margin: var(--s5) 0 var(--s2); padding-top: var(--s3); border-top: 1px solid var(--line); }
.panel-figure { margin: 2px 0 0; font-size: 1.125rem; } .panel-note { font-size: .9375rem; color: var(--ink-2); margin-top: var(--s2); }
.market-panel .insight-card { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: var(--s2) 0; }
.row-cards { list-style: none; padding: 0; margin: 0; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-1); }
.row-cards li { border-bottom: 1px solid var(--line); } .row-cards li:last-child { border-bottom: 0; }
.row-cards summary { display: flex; justify-content: space-between; gap: var(--s3); padding: var(--s2) var(--s3); cursor: pointer; list-style: none; align-items: center; }
.row-cards summary::-webkit-details-marker { display: none; }
.rc-name { display: grid; line-height: 1.45; min-width: 0; } .rc-price { display: grid; justify-items: end; line-height: 1.45; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rc-body { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); margin: 0; padding: 0 var(--s3) var(--s2); font-size: .875rem; }
.rc-body dt { color: var(--muted); font-size: .75rem; } .rc-body dd { margin: 0; }
.row-cards details .cta-row { padding: 0 var(--s3) var(--s3); margin: 0; } .row-cards .spark { padding: 0 var(--s3); height: 36px; }
.desktop-only { display: none; }

/* ---------- part page ---------- */
.part-head { display: grid; gap: var(--s4); margin: var(--s3) 0 0; padding-bottom: var(--s4); border-bottom: 1px solid var(--line); }
.cta-col { display: grid; gap: var(--s2); align-content: start; justify-items: start; }
.blocks { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); margin-top: var(--s4); align-items: start; }
.block { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r-l); padding: var(--s4); min-width: 0; }
.block h2 { font-size: 1rem; margin: 0 0 var(--s2); color: var(--muted); font-weight: 600; } .block h3 { margin-top: var(--s4); font-size: .9375rem; }
.block-sub { font-size: .875rem; color: var(--ink-2); margin: 0 0 6px; } .block .chart-wrap { border: 0; padding: 0; }
.block.takeaway { border-inline-start: 3px solid var(--brand); }
.qa { margin: 0; } .qa dt { font-weight: 600; font-size: .8125rem; color: var(--muted); margin-top: var(--s2); } .qa dt:first-child { margin-top: 0; } .qa dd { margin: 0; }
.product-page { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s5); margin-top: var(--s5); align-items: start; }
.product-media img { border-radius: var(--r-l); background: var(--surface-1); border: 1px solid var(--line); }
.fitment-box, .offer-box { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r-l); padding: var(--s4); margin: 0 0 var(--s4); }
.fitment-box h2, .offer-box h2 { margin-top: 0; }
.ok { color: var(--ok); } .warn { color: var(--warn); }
.fit-list { padding-inline-start: 18px; margin: 4px 0; } .fit-list.unverified { color: var(--warn); }
.stack-gap { margin-top: var(--s5); }

/* ---------- charts ---------- */
.chart-wrap { position: relative; background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s3); margin: 0; min-width: 0; }
.chart-wrap.flat { border: 0; padding: 0; background: transparent; }
.chart-wrap > svg { aspect-ratio: var(--ar, 760 / 300); }
.chart { width: 100%; height: auto; display: block; direction: ltr; font-family: var(--font); overflow: visible; }
.chart .grid { stroke: var(--line); } .chart .axis { stroke: var(--line-2); }
.chart .tick { font-size: 12px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart .endlabel, .chart .panel-title, .chart .rowlabel, .chart .value { font-size: 13px; font-weight: 600; }
.chart .rowlabel { fill: var(--ink-2); } 
.chart .value { fill: var(--ink-2); font-variant-numeric: tabular-nums; }
.chart .collabel { font-size: 12px; fill: var(--muted); }
.chart .crosshair { stroke: var(--muted); stroke-dasharray: 3 3; }
.chart .cell.empty { stroke: var(--line); }
.chart .s { transition: opacity .15s ease; } .chart .s.dim, .chart .endlabel.dim { opacity: .2; } .chart .s.hl { stroke-width: 3; }
.chart:focus-visible { outline: 2px solid var(--brand); outline-offset: 4px; border-radius: 4px; }
.chart a text { fill: var(--brand); cursor: pointer; }
.chart-foot { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-top: var(--s2); }
.legend { display: flex; gap: var(--s3); flex-wrap: wrap; font-size: .8125rem; color: var(--ink-2); margin-top: 4px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; font: inherit; color: inherit; padding: 0; }
button.legend-item { cursor: pointer; } button.legend-item.dim { opacity: .4; }
.legend-item i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.swatch-seq { background: linear-gradient(90deg, color-mix(in srgb, var(--seq) 14%, transparent), var(--seq)); width: 32px !important; }
.swatch-hatch { background: repeating-linear-gradient(45deg, var(--line-2) 0 2px, transparent 2px 5px); border: 1px solid var(--line); }
.tooltip { position: absolute; z-index: 5; background: #111827; color: #F1F5FB; border-radius: var(--r-s); padding: 6px 10px; font-size: .8125rem; pointer-events: none; min-width: 130px; line-height: 1.6; }
.tooltip .tt-head { font-family: var(--mono); opacity: .75; direction: ltr; text-align: left; }
.tooltip .tt-row { display: flex; align-items: center; gap: 6px; } .tooltip .tt-row b { margin-inline-start: auto; font-variant-numeric: tabular-nums; }
.tooltip .tt-row i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.multiples { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s3); }
.multiples .panel { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s3); min-width: 0; }
.multiples .panel svg { aspect-ratio: 260 / 110; overflow: hidden; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s2); margin-bottom: var(--s2); min-height: 2.9em; }
.panel-name { font-size: .875rem; font-weight: 600; line-height: 1.45; color: var(--ink); overflow-wrap: anywhere; }
.panel-num { display: flex; flex-direction: column; align-items: flex-end; flex: none; line-height: 1.2; }
.panel-num b { font-size: 1.125rem; font-variant-numeric: tabular-nums; } .panel-num small { font-size: .75rem; color: var(--muted); white-space: nowrap; }

/* ---------- tools ---------- */
.privacy-note { margin: 0; }
.tool-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: var(--s3) 0; border-bottom: 1px solid var(--line); padding-bottom: var(--s2); }
.tool-tab { border: 1px solid var(--line-2); background: var(--surface-1); color: var(--ink-2); border-radius: 999px; padding: 4px 14px; font: inherit; font-size: .9375rem; font-weight: 600; cursor: pointer; }
.tool-tab.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.tool { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); align-items: start; }
.tool[hidden] { display: none; }
.tool-form, .tool-result { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r-l); padding: var(--s4); min-width: 0; }
.tool-result { border-inline-start: 3px solid var(--brand); }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--s3); margin-top: var(--s2); }
.fields label { display: grid; gap: 2px; font-size: .8125rem; color: var(--muted); } .fields label.check { font-size: .9375rem; color: var(--ink); align-self: end; min-height: 40px; }
.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--s3); margin: 0; }
.result-grid div { display: grid; line-height: 1.4; } .result-grid dt { font-size: .8125rem; color: var(--muted); } .result-grid dd { margin: 0; font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.lookup { position: relative; margin-bottom: var(--s3); } .lookup label { display: grid; gap: 2px; font-size: .8125rem; color: var(--muted); }
.lookup-results { list-style: none; margin: 4px 0 0; padding: 4px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface-1); position: absolute; inset-inline: 0; z-index: 6; max-height: 260px; overflow: auto; }
.lookup-results button { width: 100%; text-align: start; background: none; border: 0; padding: 6px 8px; font: inherit; font-size: .875rem; color: var(--ink); border-radius: var(--r-s); cursor: pointer; } .lookup-results button:hover { background: var(--surface-2); }
.input-table input { min-height: 34px; padding: 4px 8px; min-width: 90px; }
.month-bars { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px; align-items: end; margin-bottom: var(--s4); direction: rtl; }
.mb-col { display: grid; gap: 2px; justify-items: center; font-size: .75rem; color: var(--muted); }
.mb-box { height: 120px; width: 100%; display: flex; align-items: flex-end; }
.mb-bar { width: 100%; background: var(--series-1); opacity: .45; border-radius: 3px 3px 0 0; }
.mb-bar.missing { background: repeating-linear-gradient(45deg, var(--line-2) 0 2px, transparent 2px 5px); opacity: 1; }
.mb-col.peak .mb-bar { opacity: 1; } .mb-col.start .mb-lab { color: var(--accent); font-weight: 700; }
.mb-lab { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; height: 58px; } .mb-val { font-variant-numeric: tabular-nums; }

/* ---------- breakpoints ---------- */
.mobile-only { display: block; }
@media (min-width: 760px) {
  .desktop-only { display: block; } .mobile-only { display: none; }
  .cols-2, .split, .two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: 2fr 1fr 1fr; }
  .page-head { grid-template-columns: 1fr auto; align-items: end; }
  .part-head { grid-template-columns: 1fr auto; }
  .pro-band { grid-template-columns: 1fr auto; }
  .product-page { grid-template-columns: 300px minmax(0, 1fr); }
  .search-form { grid-template-columns: 1fr 200px auto; }
  .market-top { grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s4); }
  .filter-drawer > summary { display: none; }
  .mb-lab { writing-mode: horizontal-tb; transform: none; height: auto; }
}
@media (min-width: 1024px) {
  .hero-data { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
  .charts-2 { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
  .blocks { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
  .tool { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
  .tool-result { position: sticky; top: 72px; }
}
@media (min-width: 1200px) {
  .market-grid { grid-template-columns: minmax(0, 1fr) 400px; }
  .market-panel { position: sticky; top: 72px; max-height: calc(100vh - 88px); overflow: auto; }
}
@media (max-width: 759px) {
  .header-row { gap: var(--s2); }
  .header-nav { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .header-nav > a, .nav-group > summary { padding: 4px 8px; font-size: .875rem; white-space: nowrap; }
  .nav-group { position: static; } .nav-menu { inset-inline: var(--s4); top: auto; }
  .header-search { order: 2; max-width: none; flex-basis: 100%; }
  .chart .tick, .chart .collabel { font-size: 15px; } .chart .rowlabel, .chart .value, .chart .endlabel { font-size: 15px; }
  .filter-bar label { max-width: none; flex-basis: 45%; }
  .section { margin-top: var(--s5); }
}

/* ---------- v5.1: fixes found in browser review ---------- */
.num-inline, .delta, .ic-value, .price bdi { white-space: nowrap; }
.header-nav { scrollbar-width: none; } .header-nav::-webkit-scrollbar { display: none; }
@media (max-width: 759px) {
  .header-nav { overflow: visible; flex-wrap: wrap; gap: 0; }
  .chart .tick, .chart .collabel, .chart .rowlabel, .chart .value, .chart .endlabel { font-size: 13px; }
  .chart-wrap:has(> svg.heat), .chart-wrap:has(> svg.seasonal) { overflow-x: auto; }
  .chart-wrap > svg.heat, .chart-wrap > svg.seasonal { min-width: 720px; }
  .chart.heat .collabel { font-size: 11px !important; }
  .hero-search { flex-wrap: wrap; } .hero-search input { flex: 1 1 100%; }
}
@media (max-width: 759px) {
  .chart .tick, .chart .collabel, .chart .rowlabel, .chart .value, .chart .endlabel { font-size: 14px; }
  .chart-wrap > svg.heat .collabel, .chart-wrap > svg.seasonal .collabel { font-size: 13px; }
}

/* index ticker */
.ticker { background: var(--surface-1); border-bottom: 1px solid var(--line); display: flex; align-items: stretch; font-size: .8125rem; overflow: hidden; }
.ticker-label { flex: none; display: flex; align-items: center; gap: 6px; padding: 0 var(--s3); background: var(--brand); color: #fff; font-weight: 600; white-space: nowrap; z-index: 1; }
.ticker-label small { font-weight: 400; opacity: .85; }
.ticker-view { overflow: hidden; flex: 1; min-width: 0; direction: ltr; }
.ticker-track { display: flex; width: max-content; animation: ticker var(--ticker-time, 60s) linear infinite; }
.ticker:hover .ticker-track, .ticker:focus-within .ticker-track { animation-play-state: paused; }
.ticker-list { display: flex; flex: none; margin: 0; padding: 0; list-style: none; direction: rtl; }
.ticker-list li { flex: none; }
.ticker-list a { display: flex; align-items: baseline; gap: 6px; padding: 7px var(--s4); color: var(--ink); text-decoration: none; white-space: nowrap; border-inline-start: 1px solid var(--line); }
.ticker-list a:hover { background: var(--surface-2); }
.ticker-list .tk-val { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.ticker-list .tk-ch { font-variant-numeric: tabular-nums; font-weight: 600; direction: ltr; unicode-bidi: isolate; }
.tk-up { color: var(--series-1); } .tk-down { color: var(--accent); } .tk-flat { color: var(--muted); }
@keyframes ticker { from { transform: translateX(-50%); } to { transform: translateX(0); } }
@media (prefers-reduced-motion: reduce) { .ticker-view { overflow-x: auto; } .ticker-list[aria-hidden] { display: none; } }
@media (max-width: 600px) { .ticker-label small { display: none; } }
.chart.cols .collabel { font-size: 11px; } .chart.cols .value { font-size: 12px; }

/* buying outlook */
.outlook-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); }
@media (min-width: 800px) { .outlook-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.outlook-card { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s4); border-top: 3px solid var(--series-1); }
.outlook-card.careful { border-top-color: var(--accent); }
.outlook-card h3 { margin: 0 0 2px; font-size: 1.0625rem; } .outlook-card > p { margin: 0 0 var(--s3); font-size: .875rem; color: var(--ink-2); }
.outlook-list { list-style: none; margin: 0; padding: 0; }
.outlook-list li { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); padding: 9px 0; border-top: 1px solid var(--line); }
.outlook-list a { font-weight: 600; color: var(--ink); text-decoration: none; } .outlook-list a:hover { color: var(--brand); }
.outlook-list small { display: block; color: var(--muted); font-size: .8125rem; font-weight: 400; }
.outlook-list b { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; white-space: nowrap; }
.tag { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink-2); white-space: nowrap; }
.tag.buy { background: color-mix(in srgb, var(--series-1) 12%, transparent); border-color: transparent; color: var(--series-1); }
.tag.careful { background: color-mix(in srgb, var(--accent) 14%, transparent); border-color: transparent; color: var(--accent); }
.outlook-table td small { color: var(--muted); display: block; font-size: .75rem; }
.outlook-table { min-width: 560px; }

/* fleet and market size */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--s3); margin: var(--s4) 0 var(--s5); }
.kpi { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s4); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi span { font-size: .875rem; color: var(--ink-2); } .kpi small { font-size: .8125rem; color: var(--muted); }
.kpi b { font-size: 1.625rem; line-height: 1.3; font-variant-numeric: tabular-nums; } .kpi b i { font-style: normal; font-size: .875rem; font-weight: 500; color: var(--ink-2); }
.market-size { min-width: 860px; } .market-size td small { display: block; color: var(--muted); font-size: .75rem; font-weight: 400; }
.market-size td.nowrap small { display: inline; }
.nowrap { white-space: nowrap; } .mt { margin-top: var(--s5); }
.inline-input { display: inline-flex; align-items: center; gap: 6px; font-size: .8125rem; color: var(--muted); }
.inline-input input { width: 7.5em; padding: 6px 8px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface-1); color: var(--ink); font: inherit; font-size: .9375rem; direction: ltr; text-align: left; font-variant-numeric: tabular-nums; }
.inline-input input:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.market-total { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s3) var(--s4); margin: var(--s3) 0 0; max-width: none; }

/* reference prices */
.ref-groups { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--s2); }
.ref-groups a { display: block; padding: 10px 12px; background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r); text-decoration: none; color: var(--ink); height: 100%; }
.ref-groups a:hover { border-color: var(--brand); } .ref-groups b { display: block; font-size: .9375rem; } .ref-groups small { color: var(--muted); font-size: .8125rem; }
.ref-table { min-width: 640px; } .ref-table td small { font-size: .75rem; } .block { display: block; }
.pager { display: flex; align-items: center; justify-content: center; gap: var(--s3); margin-top: var(--s4); }
.market-search { display: flex; gap: var(--s2); margin: 0 0 var(--s4); } .market-search input { flex: 1; min-width: 0; }

.panel-axis { display: flex; justify-content: space-between; direction: ltr; font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 4px; }
.panel-cap { display: block; font-size: .8125rem; font-weight: 600; margin-top: 2px; direction: rtl; }
.multiples { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }

.cat-meta { display: block; font-size: .8125rem; color: var(--muted); margin: 2px 0 6px; } .mt-s { margin-top: var(--s3); }

/* atlas, scenarios, balanced grids */
.atlas { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s5); align-items: start; }
@media (min-width: 1000px) { .atlas { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); } }
.chart.geo .prov { transition: fill-opacity .15s ease; cursor: pointer; } .chart.geo a:hover .prov, .chart.geo a:focus .prov { stroke: var(--ink); stroke-width: 2; }
.chart.geo a:focus { outline: none; }
.chart .geo-label, .chart .tile-text { font-size: 13px; font-weight: 600; fill: var(--ink); pointer-events: none; }
.chart .geo-label.on-dark, .chart .tile-text.on-dark { fill: #fff; } .chart .tile-val { font-weight: 500; font-size: 12px; }
.geo-legend { display: flex; align-items: center; gap: 8px; font-size: .8125rem; color: var(--ink-2); margin-top: var(--s2); direction: rtl; }
.geo-legend .ramp { display: inline-flex; direction: ltr; } .geo-legend .ramp i { width: 22px; height: 10px; background: var(--series-1); display: block; }
.table-scroll.tall { max-height: 640px; overflow-y: auto; } .table-scroll.tall thead th { position: sticky; top: 0; background: var(--surface-1); z-index: 1; }
.filter-bar { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: flex-end; background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s3) var(--s4); margin-bottom: var(--s4); }
.filter-bar label { display: flex; flex-direction: column; gap: 4px; font-size: .8125rem; color: var(--ink-2); min-width: 170px; flex: 1 1 170px; }
.filter-bar select { padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface-1); color: var(--ink); font: inherit; }
.filter-bar select:disabled { opacity: .5; }
details.basis { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s3) var(--s4); margin: 0 0 var(--s5); }
details.basis summary { cursor: pointer; font-weight: 600; } details.basis ul { margin: var(--s3) 0 0; padding-inline-start: 1.2em; font-size: .9375rem; color: var(--ink-2); } details.basis li { margin-bottom: 6px; }
.intervals .inline-input { display: flex; margin-bottom: 4px; } .inline-input input.narrow { width: 4em; }
.market-size { min-width: 1080px; }
.sam { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); } @media (min-width: 900px) { .sam { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); } }
.sam-form { display: grid; gap: var(--s3); background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s4); }
.sam-form label { display: flex; flex-direction: column; gap: 4px; font-size: .875rem; color: var(--ink-2); }
.sam-form input[type=text], .sam-form select { padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface-1); color: var(--ink); font: inherit; }
.sam-form fieldset { border: 1px solid var(--line); border-radius: 8px; padding: var(--s2) var(--s3); margin: 0; min-width: 0; } .sam-form legend { font-size: .875rem; color: var(--ink-2); padding: 0 6px; }
.sam-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 2px 10px; max-height: 190px; overflow-y: auto; }
.sam-checks .check { flex-direction: row; align-items: center; gap: 6px; font-size: .8125rem; color: var(--ink); }
.sam-actions { margin: 6px 0 0; font-size: .8125rem; } .sam-out { display: grid; gap: var(--s3); align-content: start; }
.link-list li { padding: 6px 0; border-bottom: 1px solid var(--line); }
/* balanced card rows: the column count follows the number of cards */
.kpi-row { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
@media (min-width: 900px) {
  .kpi-row.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpi-row:has(> :nth-child(5):last-child) { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .kpi-row:has(> :nth-child(5):last-child) > * { grid-column: span 2; } .kpi-row:has(> :nth-child(5):last-child) > :nth-child(-n+2) { grid-column: span 3; }
  .kpi-row:has(> :nth-child(3):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-row:has(> :nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-row:has(> :nth-child(1):last-child) { grid-template-columns: minmax(0, 420px); }
  .kpi-row:has(> :nth-child(6):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-row:has(> :nth-child(7):last-child) { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .kpi-row:has(> :nth-child(7):last-child) > * { grid-column: span 3; } .kpi-row:has(> :nth-child(7):last-child) > :nth-child(-n+3) { grid-column: span 4; }
}
@media (min-width: 600px) and (max-width: 899px) { .kpi-row.k4, .kpi-row:has(> :nth-child(4):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* header: one scrollable row of links on phones, menus open below it */
@media (max-width: 759px) {
  .header-nav { overflow-x: auto; overflow-y: hidden; flex-wrap: nowrap; gap: 0; -webkit-overflow-scrolling: touch; }
  .header-nav:has(details[open]) { overflow: visible; flex-wrap: wrap; }
}
/* card grids sized by the number of cards */
.card-grid { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
@media (min-width: 900px) {
  .card-grid.n1 { grid-template-columns: minmax(0, 420px); }
  .card-grid.n2, .card-grid.n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-grid.n3, .card-grid.n5, .card-grid.n6, .card-grid.n9 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .card-grid.n7, .card-grid.n8 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .card-grid.n5 { grid-template-columns: repeat(6, minmax(0, 1fr)); } .card-grid.n5 > * { grid-column: span 2; } .card-grid.n5 > :nth-child(-n+2) { grid-column: span 3; }
  .card-grid.n7 { grid-template-columns: repeat(12, minmax(0, 1fr)); } .card-grid.n7 > * { grid-column: span 3; } .card-grid.n7 > :nth-child(-n+3) { grid-column: span 4; }
  .card-grid.n4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 600px) and (max-width: 899px) { .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .card-grid.n3 > :last-child, .card-grid.n5 > :last-child, .card-grid.n7 > :last-child { grid-column: 1 / -1; } }
.tool-card { display: flex; flex-direction: column; gap: 4px; padding: var(--s4); background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r); color: var(--ink); text-decoration: none; }
.tool-card:hover { border-color: var(--brand); text-decoration: none; } .tool-card span { font-size: .875rem; color: var(--ink-2); }
.kpi-row.stack { grid-template-columns: minmax(0, 1fr); margin: 0 0 var(--s3); gap: var(--s2); } .kpi-row.stack .kpi { padding: var(--s3) var(--s4); } .kpi-row.stack .kpi b { font-size: 1.375rem; }
.rank-list { margin: 0; padding: 0; list-style: none; counter-reset: r; }
.rank-list li { counter-increment: r; display: flex; justify-content: space-between; gap: var(--s3); padding: 7px 0; border-bottom: 1px solid var(--line); }
.rank-list li::before { content: counter(r, persian); color: var(--muted); width: 1.4em; flex: none; } .rank-list a { flex: 1; font-weight: 600; color: var(--ink); }

/* phone header: brand, search icon, quote, theme on one row; links on the second */
.search-link { display: none; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: var(--r); color: var(--ink-2); place-items: center; }
.search-link svg { width: 18px; height: 18px; }
@media (max-width: 759px) {
  .header-search { display: none; } .search-link { display: grid; margin-inline-start: auto; }
  .header-row { flex-wrap: wrap; } .header-row .quote-link { padding-inline: 12px; }
}
@media (min-width: 760px) and (max-width: 1100px) { .header-search { flex: 1 1 140px; max-width: 220px; } .header-nav > a, .nav-group > summary { padding: 6px 7px; } }
/* rows of cards follow the number of cards (no 7+1 or 3+1 leftovers) */
@media (min-width: 900px) {
  .grid.cats:has(> :nth-child(4):last-child), .grid.cats:has(> :nth-child(8):last-child), .grid.cats:has(> :nth-child(7):last-child) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid.cats:has(> :nth-child(3):last-child), .grid.cats:has(> :nth-child(6):last-child), .grid.cats:has(> :nth-child(9):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.cats:has(> :nth-child(5):last-child), .grid.cats:has(> :nth-child(10):last-child) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .grid.cats:has(> :nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cats:has(> :nth-child(7):last-child) > :nth-child(n+5) { grid-column: span 1; }
  .observations.grid3:has(> :nth-child(4):last-child), .observations.grid3:has(> :nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .observations.grid3:has(> :nth-child(3):last-child), .observations.grid3:has(> :nth-child(5):last-child), .observations.grid3:has(> :nth-child(6):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 600px) and (max-width: 899px) {
  .grid.cats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .observations.grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .observations.grid3:has(> :nth-child(3):last-child) > :last-child { grid-column: 1 / -1; }
}

.market-actions { flex-wrap: wrap; }
@media (max-width: 759px) { .market-actions .btn { flex: 1 1 auto; text-align: center; } }

@media (max-width: 759px) { .chart .geo-label { display: none; } }

/* prices */
.price-table { min-width: 900px; } .price-table td small { font-size: .75rem; }
.filter-bar label.grow { flex: 2 1 260px; } .filter-bar input[type=search] { padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface-1); color: var(--ink); font: inherit; }
.spec-table th { width: 11em; text-align: start; color: var(--ink-2); font-weight: 500; }
.ref-figure { margin: 0 0 var(--s4); background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s3); max-width: 420px; }
.ref-figure img { display: block; width: 100%; height: auto; border-radius: 8px; background: #fff; } .ref-figure figcaption { font-size: .75rem; color: var(--muted); margin-top: 6px; }
.ref-groups a.has-thumb { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 10px; align-items: center; }
.ref-groups img { width: 56px; height: 56px; object-fit: contain; border-radius: 8px; background: #fff; border: 1px solid var(--line); }

.more-link { margin: var(--s2) 0 0; font-size: .875rem; font-weight: 600; }

/* members */
.account-link { font-weight: 600; font-size: .9375rem; color: var(--ink-2); padding: 6px 8px; border-radius: var(--r-s); white-space: nowrap; }
.account-link:hover { background: var(--surface-2); text-decoration: none; }
.auth-wrap { display: grid; place-items: start center; padding: var(--s6) 0; }
.auth-card { width: 100%; max-width: 440px; background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s5); }
.auth-card h1 { font-size: 1.5rem; margin-top: 0; } .auth-card form { display: grid; gap: var(--s3); margin-top: var(--s4); }
.field { display: grid; gap: 6px; } .field label { font-weight: 600; font-size: .9375rem; }
.field input, .profile-form input[type=text], .profile-form select { width: 100%; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface-1); color: var(--ink); font: inherit; }
.field input:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.pw-wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.field-error { color: #b42318; margin: 0; font-size: .875rem; } :root[data-theme="dark"] .field-error { color: #ff8a80; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .field-error { color: #ff8a80; } }
.check.consent { display: flex; gap: 8px; align-items: flex-start; font-size: .875rem; color: var(--ink-2); }
.btn.block { width: 100%; justify-content: center; } .auth-alt { margin: var(--s3) 0 0; font-size: .9375rem; }
.member-gate { border: 1px solid var(--line-2); border-inline-start: 4px solid var(--brand); background: var(--surface-1); border-radius: var(--r); padding: var(--s4); margin: var(--s4) 0; }
.gate-title { font-weight: 700; margin: 0 0 6px; } .gate-text { margin: 0 0 var(--s3); color: var(--ink-2); font-size: .9375rem; }
.gate-actions { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; margin: 0; font-size: .9375rem; }
.sample-note { font-size: .8125rem; color: var(--muted); margin: 0 0 var(--s2); }
.profile-form { display: grid; gap: var(--s3); max-width: 720px; } .profile-form .fields { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.profile-form label { display: grid; gap: 4px; font-size: .875rem; color: var(--ink-2); }
.profile-form fieldset { border: 1px solid var(--line); border-radius: 8px; padding: var(--s2) var(--s3); }
@media (max-width: 759px) { .account-link { padding: 4px 6px; font-size: .875rem; } }

.change-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.change-card { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s4); display: grid; gap: 6px; align-content: start; }
.change-card a { color: var(--ink); text-decoration: none; } .change-card a:hover { color: var(--brand); }
.cc-figure { display: flex; gap: var(--s3); align-items: baseline; font-size: 1.125rem; font-variant-numeric: tabular-nums; } .cc-figure bdi { font-weight: 700; }
.change-card small { color: var(--muted); font-size: .8125rem; line-height: 1.6; }
@media (min-width: 900px) { .change-cards:has(> :nth-child(3):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); } .change-cards:has(> :nth-child(2):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Market analysis (newsroom) */
.analysis-list { list-style: none; padding: 0; margin: var(--s3) 0; }
.analysis-list li { display: grid; grid-template-columns: 160px 1fr; gap: var(--s3); padding: var(--s3) 0; border-bottom: 1px solid var(--line); }
.analysis-list li > div:only-child { grid-column: 1 / -1; }
.analysis-list p { margin: 4px 0 0; }
.analysis-thumb img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--r); display: block; }
.analysis-hero { margin: var(--s3) 0; }
.analysis-hero img { width: 100%; height: auto; border-radius: var(--r); display: block; }
.analysis .key-points { background: var(--accent-soft); border-radius: var(--r); padding: var(--s2) var(--s3); margin: var(--s3) 0; }
.analysis .key-points h2 { margin-top: 0; font-size: 1.05rem; }
.analysis table { display: block; overflow-x: auto; max-width: 100%; }
.src-ref a { text-decoration: none; font-size: .75em; padding: 0 2px; }
.source-list li { overflow-wrap: anywhere; margin-bottom: 4px; }
@media (max-width: 560px) { .analysis-list li { grid-template-columns: 1fr; } }
