/* ============================================================
   Casvia — UK financial tools
   Minimal deep blue-green financial style.
   Architecture mirror of Caspenda: static, no-tracking, pure CSS.
   ============================================================ */

:root {
  --bg: #f1f6f4;
  --surface: #ffffff;
  --surface-2: #f6faf8;
  --ink: #0e2e2b;
  --ink-soft: #57716c;
  --ink-strong: #3d5753;
  --line: #dfe9e5;
  --brand: #0f766e;          /* deep teal — primary */
  --brand-deep: #0b3b38;     /* header gradient deep green */
  --brand-2: #0c4a5c;        /* header gradient blue-green */
  --growth: #2f9e8f;
  --contrib: #0f766e;
  --warn: #a16207;
  --warn-bg: #fdf6e9;
  --ok: #15803d;
  --note-ok-bg: #ecf7ef;
  --note-info-bg: #eef4f6;
  --info-ink: #0c4a5c;
  --grid-line: #e6eeea;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(14,46,43,.05), 0 8px 24px rgba(14,46,43,.07);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;
}

/* ---------- Dark theme (system-following + manual override) ----------
   The <html data-theme> attribute is set by an inline script in <head>
   so there is no flash of the wrong theme. 'auto' = follow the OS;
   light/dark force it. Header/footer/hero keep their deep-teal identity
   in both themes — only the content surface is re-themed. */
:root[data-theme="dark"] {
  --bg: #0c1417;
  --surface: #15212a;
  --surface-2: #1b2a33;
  --ink: #dfece6;
  --ink-soft: #8fa49e;
  --ink-strong: #c2d6cf;
  --line: #2b3a42;
  --brand: #22b3a4;
  --brand-deep: #081f1d;
  --brand-2: #0a3644;
  --growth: #3fc3b2;
  --contrib: #22b3a4;
  --warn: #d9a441;
  --warn-bg: #2a2311;
  --ok: #4ade80;
  --note-ok-bg: #12301d;
  --note-info-bg: #12282e;
  --info-ink: #7fc3d8;
  --grid-line: #2b3a42;
  --shadow: 0 1px 2px rgba(0,0,0,.45), 0 10px 28px rgba(0,0,0,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
}
.container { max-width: 1040px; margin: 0 auto; padding: 0 20px; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
/* Text-block links must be distinguishable beyond colour alone (WCAG 1.4.1). */
p a, li a, td a, .breadcrumb a, .src-foot a, .note a, .faq-answer a, .card-body p a {
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}
a.btn, p a.btn, li a.btn { text-decoration: none; }
h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -.01em; }
p { margin: 0 0 12px; }

/* ---------- Header ---------- */
.site-header {
  background: var(--brand-deep);
  color: #eaf7f4;
  padding: 14px 0;
  position: sticky; top: 0; z-index: 20;
  box-shadow: 0 1px 0 rgba(255,255,255,.06), 0 6px 20px rgba(11,59,56,.25);
}
.site-header .container { display: flex; align-items: center; gap: 18px; }
.logo {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 1.15rem; color: #eaf7f4; letter-spacing: -.01em;
}
.logo:hover { text-decoration: none; opacity: .92; }
.logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  line-height: 0;
}
.logo-mark svg { display: block; }
.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav a {
  color: #cfe6e0; padding: 7px 12px; border-radius: 8px; font-size: .94rem;
}
.nav a:hover { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.nav a.active, .nav a[aria-current="page"] { background: rgba(255,255,255,.18); color: #fff; font-weight: 600; }
.nav a.active:hover { background: rgba(255,255,255,.24); color: #fff; }
.nav-toggle { display: none; background: none; border: 0; color: #eaf7f4; font-size: 1.3rem; cursor: pointer; }

/* ---------- Hero ---------- */
.hero { background: var(--brand-deep); color: #eaf7f4; padding: 44px 0 34px; }
.hero .badge {
  display: inline-block; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.16);
  padding: 4px 12px; border-radius: 999px; font-size: .82rem; letter-spacing: .02em; margin-bottom: 14px;
}
.hero h1 { font-size: 2.3rem; margin: 0 0 10px; color: #fff; }
.hero-tagline {
  color: #7fd4c8; font-size: .92rem; font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase; margin: 0 0 8px;
}
.hero .sub { color: #cfe6e0; font-size: 1.08rem; max-width: 620px; margin: 0; }

/* ---------- Generic sections ---------- */
.section { padding: 40px 0; }
.section-head { margin-bottom: 24px; }
.section-head h2 { margin: 0 0 6px; font-size: 1.6rem; }
.section-head p { color: var(--ink-soft); margin: 0; max-width: 640px; }

/* ---------- Calculator shell ---------- */
.calc-shell {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin: 34px 0; overflow: hidden;
}
.calc-grid { display: grid; grid-template-columns: 420px 1fr; }
.calc-panel { padding: 26px 28px; }
.calc-panel.inputs { border-right: 1px solid var(--line); background: var(--surface-2); }
.calc-panel h2 { margin: 0 0 18px; font-size: 1.05rem; }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: .86rem; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.field .hint { font-size: .8rem; color: var(--ink-soft); margin-top: 4px; }

.input-affix { position: relative; }
.input-affix .prefix {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--ink-soft); font-weight: 600; font-size: .95rem; pointer-events: none;
}
.input-affix input {
  width: 100%; padding: 10px 12px 10px 30px;
  border: 1px solid var(--line); border-radius: 10px; font-size: 1rem; color: var(--ink);
  background: var(--surface); font-family: var(--font);
}
.input-affix input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15,118,110,.12); }
select.input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 1rem; color: var(--ink); background: var(--surface); font-family: var(--font);
}
select.input:focus { outline: none; border-color: var(--brand); }

.presets { display: flex; gap: 8px; margin-top: 10px; }
.preset {
  flex: 1; padding: 8px 6px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink); cursor: pointer; font-size: .86rem; font-weight: 600;
  text-align: center; line-height: 1.3;
}
.preset small { display: block; font-weight: 400; color: var(--ink-strong); font-size: .74rem; }
.preset:hover { border-color: var(--brand); }
.preset.active { border-color: var(--brand); background: rgba(15,118,110,.08); color: var(--brand); }
.preset-note { font-size: .74rem; color: var(--ink-soft); margin: 8px 0 0; line-height: 1.4; }

.range-wrap { display: flex; align-items: center; gap: 10px; }
.range-wrap input[type=range] { flex: 1; accent-color: var(--brand); }
.range-val { width: 70px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; font-size: .95rem; }
.range-wrap #yearsVal, .range-wrap .yearsVal { color: var(--ink-soft); font-size: .86rem; white-space: nowrap; }

.toggle-label { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .9rem; cursor: pointer; }
.toggle-label input[type=checkbox] { accent-color: var(--brand); width: 16px; height: 16px; }
.infl-row { margin-top: 10px; }

/* ---------- Results panel ---------- */
.result-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.result-head .label { color: var(--ink-soft); font-size: .9rem; }
.growth-share { color: var(--brand); font-size: .84rem; font-weight: 600; }
.fv { font-size: 2.5rem; font-weight: 700; letter-spacing: -.02em; color: var(--ink); margin-bottom: 14px; }
.fv small { font-size: 1rem; font-weight: 400; color: var(--ink-soft); }

.split { border-top: 1px solid var(--line); padding-top: 12px; }
.split-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: .94rem; color: var(--ink-soft); }
.split-row b { margin-left: auto; color: var(--ink); font-variant-numeric: tabular-nums; }
.dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.dot.contrib { background: var(--contrib); }
.dot.growth { background: var(--growth); }
.dot.warning { background: var(--warn); }
.dot.bonus { background: #0c4a5c; }

.real-split { border-top: 1px dashed var(--line); margin-top: 12px; padding-top: 12px; }
.real-note { font-size: .82rem; color: var(--ink-soft); margin-bottom: 6px; }

.chart-box { margin: 18px 0 6px; }
.chart-box canvas { width: 100%; height: 220px; display: block; }
.chart-legend { display: flex; gap: 16px; font-size: .82rem; color: var(--ink-soft); margin-top: 8px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }

.actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; align-items: center; }
.share-flash { color: var(--ok); font-size: .84rem; font-weight: 600; }
.btn {
  padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); font-size: .9rem; font-weight: 600; cursor: pointer; font-family: var(--font);
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-deep); }

.collapse { margin-top: 16px; }
.collapse summary { cursor: pointer; font-size: .9rem; font-weight: 600; color: var(--brand); }
.table-wrap { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-top: 10px; }
.table-scroll { overflow-x: auto; max-height: 300px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th, td { padding: 8px 12px; text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { background: var(--surface-2); color: var(--ink-soft); font-weight: 600; position: sticky; top: 0; border-bottom: 1px solid var(--line); }
td { border-bottom: 1px solid var(--line); color: var(--ink); font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; font-weight: 700; }

/* ---------- Status / notes ---------- */
.status-note {
  display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; padding: 12px 14px;
  border-radius: 10px; font-size: .86rem; line-height: 1.5;
}
.status-note.ok { background: var(--note-ok-bg); color: var(--ok); }
.status-note.warn { background: var(--warn-bg); color: var(--warn); }
.status-note.info { background: var(--note-info-bg); color: var(--info-ink); }

/* 结果区自动结论句：把结果数字变成一句话决策 */
.result-insight {
  margin: 0; font-size: .86rem; line-height: 1.55;
  color: var(--ink-strong); background: transparent;
  border-left: none;
  padding: 0; border-radius: 0;
}

/* Deposit% / LTV metric row below primary result */
.result-metrics {
  display: flex; gap: 18px; margin: 0 0 14px; flex-wrap: wrap;
}
.result-metric {
  display: flex; flex-direction: column;
}
.result-metric b {
  font-size: 1.15rem; font-weight: 700; color: var(--brand);
  line-height: 1.2;
}
.result-metric em {
  font-size: .72rem; font-style: normal; color: var(--ink-soft);
  text-transform: uppercase; letter-spacing: .05em; margin-top: 1px;
}

/* "What your result means" insight card */
.insight-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: 0 10px 10px 0;
  padding: 12px 15px;
  margin: 0 0 14px;
}
.insight-card-title {
  font-size: .72rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--brand); margin-bottom: 5px;
}

/* Collapse summary hint */
.collapse-hint {
  color: var(--ink-soft); font-size: .82rem; font-weight: 400;
}

/* Yearly breakdown table: emphasised header */
#mgTableBox thead th {
  background: var(--brand-deep);
  color: var(--ink);
  border-bottom: 2px solid var(--brand);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.isa-type-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.isa-type {
  padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  cursor: pointer; text-align: left; font-family: var(--font);
}
.isa-type b { display: block; font-size: .9rem; color: var(--ink); }
.isa-type span { font-size: .76rem; color: var(--ink-strong); display: block; margin-top: 2px; }
.isa-type:hover { border-color: var(--brand); }
.isa-type.active { border-color: var(--brand); background: rgba(15,118,110,.08); box-shadow: 0 0 0 3px rgba(15,118,110,.1); }

/* Mortgage type buttons (repayment / interest-only) — same visual language as .isa-type */
.mort-type-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.mort-type {
  padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  cursor: pointer; text-align: left; font-family: var(--font);
}
.mort-type b { display: block; font-size: .9rem; color: var(--ink); }
.mort-type span { font-size: .76rem; color: var(--ink-strong); display: block; margin-top: 2px; }
.mort-type:hover { border-color: var(--brand); }
.mort-type.active { border-color: var(--brand); background: rgba(15,118,110,.08); box-shadow: 0 0 0 3px rgba(15,118,110,.1); }

/* Stamp Duty region buttons (England&NI / Scotland / Wales) — same visual language */
.sd-region-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sd-region {
  padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  cursor: pointer; text-align: left; font-family: var(--font);
}
.sd-region b { display: block; font-size: .9rem; color: var(--ink); }
.sd-region span { font-size: .76rem; color: var(--ink-strong); display: block; margin-top: 2px; }
.sd-region:hover { border-color: var(--brand); }
.sd-region.active { border-color: var(--brand); background: rgba(15,118,110,.08); box-shadow: 0 0 0 3px rgba(15,118,110,.1); }

/* Investment Return mode buttons (Estimate growth / Reach a target) — same visual language */
.mode-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.mode-btn {
  padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  cursor: pointer; text-align: left; font-family: var(--font);
}
.mode-btn b { display: block; font-size: .9rem; color: var(--ink); }
.mode-btn span { font-size: .76rem; color: var(--ink-strong); display: block; margin-top: 2px; }
.mode-btn:hover { border-color: var(--brand); }
.mode-btn.active { border-color: var(--brand); background: rgba(15,118,110,.08); box-shadow: 0 0 0 3px rgba(15,118,110,.1); }

/* Checkbox label (retirement / stamp duty) */
.check-label { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .9rem; cursor: pointer; }
.check-label input[type=checkbox] { accent-color: var(--brand); width: 16px; height: 16px; }

/* ---------- Tool cards ---------- */
.tool-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.tool-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); display: block; color: var(--ink);
  transition: transform .12s ease, border-color .12s ease;
}
.tool-card:hover { transform: translateY(-2px); border-color: var(--brand); text-decoration: none; }
.tool-card .icon { font-size: 1.6rem; margin-bottom: 10px; }
.tool-card h3 { margin: 0 0 6px; font-size: 1.08rem; }
.tool-card p { color: var(--ink-soft); font-size: .9rem; margin: 0 0 14px; }
.tool-card .go { color: var(--brand); font-weight: 600; font-size: .9rem; }

/* ---------- Trust strip ---------- */
.trust-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.trust-item { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.trust-item .t-ic { font-size: 1.4rem; }
.trust-item h4 { margin: 8px 0 4px; font-size: .98rem; }
.trust-item p { font-size: .86rem; color: var(--ink-soft); margin: 0; }
.trust-more { text-align: center; margin: 18px 0 0; font-size: .9rem; color: var(--ink-soft); }
.trust-more a { color: var(--brand); font-weight: 600; text-decoration: none; }
.trust-more a:hover { text-decoration: underline; }

/* ---------- Article list ---------- */
.article-list { display: flex; flex-direction: column; gap: 10px; }
.article-link {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 18px; color: var(--ink);
}
.article-link:hover { border-color: var(--brand); text-decoration: none; }
.article-link .t { font-weight: 600; font-size: .98rem; }
.article-link .s { color: var(--ink-soft); font-size: .85rem; }
.article-link .go { color: var(--brand); font-weight: 600; }

/* ---------- FAQ ---------- */
.faq { display: flex; flex-direction: column; gap: 10px; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px 18px; }
.faq summary { cursor: pointer; font-weight: 600; padding: 12px 0; font-size: .96rem; }
.faq summary::-webkit-details-marker { color: var(--brand); }
.faq-body { padding: 0 0 14px; color: var(--ink-soft); font-size: .92rem; }

/* ---------- Breadcrumb ---------- */
.breadcrumb { font-size: .82rem; color: var(--ink-soft); margin: 18px 0 0; }
.breadcrumb a { color: var(--brand); }
.breadcrumb span { color: var(--ink-soft); }
/* Breadcrumb inside the dark-green hero: light text so it stays readable. */
.hero .breadcrumb { color: rgba(255,255,255,.72); margin: 0 0 16px; }
.hero .breadcrumb a { color: #b9d5ce; }
.hero .breadcrumb span { color: rgba(255,255,255,.55); }

/* ---------- Roadmap chips (planned calculators) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 12px; border-radius: 999px; background: var(--surface);
  border: 1px dashed var(--line); color: var(--ink-soft); font-size: .84rem;
}
.chip b { color: var(--ink); font-weight: 600; }

/* ---------- Data / source footnote ---------- */
.src-foot {
  font-size: .8rem; color: var(--ink-soft); border-top: 1px dashed var(--line);
  margin-top: 18px; padding-top: 12px; line-height: 1.5;
}
.src-foot a { color: var(--brand); }

/* trust bar: low-key updated-for / last-verified line (YMYL) */
.trust-bar {
  font-size: .76rem; color: var(--ink-soft); margin: 10px 0 0;
  letter-spacing: .01em; line-height: 1.4;
}
.trust-bar .trust-dot { margin: 0 6px; opacity: .45; }

/* ---------- Content pages ---------- */
.page { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 34px 38px; margin: 34px 0; box-shadow: var(--shadow); }
.page h1 { font-size: 1.9rem; margin: 0 0 8px; }
.page .lede { color: var(--ink-soft); font-size: 1.02rem; margin-bottom: 26px; }
.page h2 { font-size: 1.25rem; margin: 28px 0 8px; }
.page h3 { font-size: 1.05rem; margin: 20px 0 6px; }
.page ul, .page ol { padding-left: 22px; }
.page li { margin-bottom: 6px; }
.page blockquote { margin: 16px 0; padding: 12px 16px; border-left: 3px solid var(--brand); background: var(--surface-2); border-radius: 0 10px 10px 0; color: var(--ink-soft); }
.page table { margin: 14px 0; }
.data-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 14px 0; }
.data-table-wrap table { margin: 0; min-width: 640px; }
.page .note { font-size: .84rem; color: var(--ink-soft); }

.data-src { display: inline-block; font-size: .76rem; color: var(--ink-soft); background: var(--surface-2); border: 1px solid var(--line); padding: 2px 8px; border-radius: 999px; margin-left: 6px; vertical-align: middle; }
.data-src a { color: var(--brand); font-weight: 600; text-decoration: none; }
.data-src a:hover { text-decoration: underline; }

/* ---------- Footer ---------- */
.site-footer { background: var(--brand-deep); color: #b9d5ce; padding: 40px 0 26px; margin-top: 50px; }
.site-footer .logo { color: #eaf7f4; }
.site-footer h4, .site-footer .f-head { color: #eaf7f4; font-size: .92rem; margin: 0 0 10px; }
.footer-tagline { margin: 12px 0 0; font-size: 1.05rem; font-weight: 700; color: #eaf7f4; letter-spacing: .01em; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 26px; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin-bottom: 6px; }
.footer-grid a { color: #b9d5ce; font-size: .9rem; }
.footer-grid a:hover { color: #fff; text-decoration: none; }
.footer-note { border-top: 1px solid rgba(255,255,255,.12); margin-top: 28px; padding-top: 18px; font-size: .8rem; color: #8fb5ad; }
.footer-note p { margin: 0 0 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .calc-grid { grid-template-columns: 1fr; }
  .calc-panel.inputs { border-right: 0; border-bottom: 1px solid var(--line); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .nav { display: flex; visibility: hidden; opacity: 0; transform: translateY(-6px); position: absolute; top: 100%; left: 0; right: 0; background: var(--brand-deep); flex-direction: column; padding: 10px 20px 16px; transition: opacity .16s ease, transform .16s ease, visibility .16s; pointer-events: none; }
  .nav.open { visibility: visible; opacity: 1; transform: translateY(0); pointer-events: auto; }
  .nav-toggle { display: block; margin-left: auto; }
  .isa-type-grid { grid-template-columns: 1fr; }
  .mort-type-grid { grid-template-columns: 1fr; }
  .sd-region-grid { grid-template-columns: 1fr; }
  .mode-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .hero h1 { font-size: 1.8rem; }
  .fv { font-size: 2rem; }
  .page { padding: 24px 20px; }
}

/* ---------- Live result display (top of calculator, always visible) ----------
   Mirrors the main result in a big always-on card pinned just below the
   sticky header while scrolling — the "top result display" pattern. The
   card re-themes with dark mode via the same brand variables. */
.live-wrap { position: sticky; top: 62px; z-index: 15; margin-top: -14px; }
/* Desktop doesn't need the pinned top result — results are always on screen.
   Mobile keeps it so results stay visible while scrolling the form. */
@media (min-width: 861px) {
  .live-wrap { display: none; }
}
.live-results {
  display: flex; align-items: center; gap: 14px;
  background: var(--brand-deep); color: #eaf7f4;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px; padding: 13px 18px;
  box-shadow: var(--shadow);
}
.live-results .lr-name {
  flex: none; text-transform: uppercase; letter-spacing: .1em;
  font-size: .7rem; font-weight: 700; color: #7fd4c8;
  writing-mode: horizontal-tb; white-space: nowrap;
}
.live-results .lr-main { flex: 1; min-width: 0; }
.live-results .lr-label { font-size: .8rem; color: #cfe6e0; }
.live-results .lr-value { font-size: 2rem; font-weight: 800; color: #fff; line-height: 1.15; font-variant-numeric: tabular-nums; word-break: break-word; }
.live-results .lr-sub { font-size: .82rem; color: #b9d5ce; }
@media (max-width: 520px) {
  .live-results { gap: 10px; padding: 9px 14px; }
  .live-results .lr-name { font-size: .68rem; letter-spacing: .08em; }
  .live-results .lr-main { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
  .live-results .lr-label { font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .live-results .lr-value { font-size: 1.45rem; white-space: nowrap; }
  .live-results .lr-sub { font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .live-wrap { top: 56px; }
}

/* ---------- Privacy pitch ---------- */
.privacy-note {
  font-size: .8rem; color: var(--ink-soft); margin-left: 10px;
  display: inline-flex; align-items: center; gap: 6px;
}
.privacy-note::before { content: '✓'; color: var(--growth); font-weight: 700; }
@media (max-width: 520px) { .privacy-note { display: block; margin: 10px 0 0; } }

/* ---------- Theme toggle ---------- */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18);
  color: #eaf7f4; cursor: pointer; flex: none; margin-left: 8px;
  line-height: 0;
}
.theme-toggle:hover { background: rgba(255,255,255,.16); }
.theme-toggle svg { width: 17px; height: 17px; display: block; }

/* ============================================================
   Site search (js/search.js)
   ============================================================ */
.search-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18);
  color: #eaf7f4; cursor: pointer; flex: none; margin-left: 8px;
  line-height: 0; transition: background .15s;
}
.search-toggle:hover { background: rgba(255,255,255,.16); }
.search-toggle svg { width: 16px; height: 16px; display: block; }

.search-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 12vh;
}
.search-overlay[hidden] { display: none; }
.search-backdrop {
  position: absolute; inset: 0;
  background: rgba(8,24,22,.55);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.search-panel {
  position: relative; z-index: 1;
  width: 100%; max-width: 620px;
  background: var(--bg, #fff);
  border: 1px solid var(--grid-line, #e6eeea);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0,0,0,.28);
  overflow: hidden;
  margin: 0 16px;
}
[data-theme="dark"] .search-panel {
  background: #0f2421;
  border-color: rgba(255,255,255,.1);
}
.search-box {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--grid-line, #e6eeea);
}
[data-theme="dark"] .search-box { border-bottom-color: rgba(255,255,255,.08); }
.search-icon { color: var(--ink-soft, #57716c); display: flex; line-height: 0; }
.search-icon svg { width: 20px; height: 20px; }
.search-input {
  flex: 1; border: none; outline: none; background: transparent;
  font-size: 1.05rem; color: var(--ink-strong, #14322d);
  font-family: inherit;
}
[data-theme="dark"] .search-input { color: #eaf7f4; }
.search-input::placeholder { color: var(--ink-soft, #8fa49e); }
.search-close {
  background: none; border: none; cursor: pointer;
  color: var(--ink-soft, #8fa49e); font-size: 1rem;
  padding: 4px 8px; border-radius: 6px; line-height: 1;
}
.search-close:hover { background: var(--grid-line, #e6eeea); color: var(--ink-strong, #14322d); }

.search-results {
  max-height: 50vh; overflow-y: auto;
  padding: 8px;
}
.search-result {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  text-decoration: none; color: var(--ink-strong, #14322d);
  cursor: pointer;
}
[data-theme="dark"] .search-result { color: #eaf7f4; }
.search-result:hover, .search-result.active {
  background: var(--brand-tint, #e8f5f2);
}
[data-theme="dark"] .search-result:hover,
[data-theme="dark"] .search-result.active {
  background: rgba(34,179,164,.14);
}
.sr-type {
  flex: none; font-size: .65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--brand, #0b3b38);
  background: var(--brand-tint, #e8f5f2);
  padding: 3px 8px; border-radius: 20px;
}
[data-theme="dark"] .sr-type {
  color: #7fd4c8; background: rgba(34,179,164,.18);
}
.sr-title { font-size: .92rem; line-height: 1.35; }
.search-empty {
  padding: 24px 16px; text-align: center;
  color: var(--ink-soft, #8fa49e); font-size: .9rem;
}
.search-popular {
  padding: 16px;
}
.search-popular-label {
  font-size: .72rem; font-weight: 600;
  color: var(--ink-soft, #8fa49e);
  text-transform: uppercase; letter-spacing: .05em;
  margin-bottom: 10px;
}
.search-chips {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.search-chip {
  padding: 6px 14px;
  border: 1px solid var(--grid-line, #d8e4df);
  border-radius: 999px;
  background: var(--surface, #fff);
  color: var(--ink-strong, #14322d);
  font-size: .85rem;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.search-chip:hover {
  background: var(--brand-tint, #edf7f4);
  border-color: var(--brand, #2f9e8f);
  color: var(--brand-dark, #0b5c4f);
}
[data-theme="dark"] .search-chip {
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.1);
  color: #eaf7f4;
}
[data-theme="dark"] .search-chip:hover {
  background: rgba(47,158,143,.15);
  border-color: #2f9e8f;
  color: #5fd4c4;
}
.search-hint {
  padding: 8px 16px; border-top: 1px solid var(--grid-line, #e6eeea);
  font-size: .72rem; color: var(--ink-soft, #8fa49e);
  text-align: center;
}
[data-theme="dark"] .search-hint { border-top-color: rgba(255,255,255,.08); }
@media (max-width: 520px) {
  .search-overlay { padding-top: 8vh; }
  .search-panel { margin: 0 10px; border-radius: 14px; }
  .search-input { font-size: 1rem; }
}

/* ============================================================
   Article CTA box (inserted before privacy-note)
   ============================================================ */
.cta-box {
  margin-top: 32px;
  background: var(--brand-tint, #e8f5f2);
  border: 1px solid var(--brand, #0b3b38);
  border-radius: 14px;
  padding: 24px 28px;
  display: flex; align-items: center; gap: 20px;
  flex-wrap: wrap;
}
[data-theme="dark"] .cta-box {
  background: rgba(34,179,164,.1);
  border-color: rgba(127,212,200,.3);
}
.cta-box .cta-text { flex: 1; min-width: 200px; }
.cta-box .cta-text h3 {
  margin: 0 0 4px; font-size: 1.1rem;
  color: var(--brand-deep, #0b3b38);
}
[data-theme="dark"] .cta-box .cta-text h3 { color: #7fd4c8; }
.cta-box .cta-text p {
  margin: 0; font-size: .9rem; color: var(--ink-soft, #57716c);
}
.cta-box .cta-btn {
  display: inline-block; flex: none;
  background: var(--brand, #0b3b38); color: #fff;
  padding: 11px 22px; border-radius: 10px;
  text-decoration: none; font-weight: 600; font-size: .92rem;
  transition: opacity .15s;
}
.cta-box .cta-btn:hover { opacity: .88; }
[data-theme="dark"] .cta-box .cta-btn {
  background: #22b3a4; color: #06201d;
}
@media (max-width: 520px) {
  .cta-box { padding: 18px 20px; gap: 14px; }
  .cta-box .cta-btn { width: 100%; text-align: center; }
}

/* ============================================================
   Homepage data-verified badge
   ============================================================ */
.data-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .78rem; font-weight: 600;
  color: var(--brand-deep, #0b3b38);
  background: var(--brand-tint, #e8f5f2);
  border: 1px solid rgba(11,59,56,.15);
  padding: 5px 12px; border-radius: 20px;
  margin-bottom: 14px;
}
[data-theme="dark"] .data-badge {
  color: #7fd4c8;
  background: rgba(34,179,164,.12);
  border-color: rgba(127,212,200,.25);
}
.data-badge::before { content: '✓'; font-weight: 800; }
