/* ===== Swiss Tax Atlas design system =====
   Tokens, base, layout, components (.card .btn .seg .chip .table .tip .check .field), section header (.sec-head). */
:root {
  /* colour */
  --bg: #f6f6f4;
  --bg-alt: #efeeea;
  --surface: #ffffff;
  --surface-2: #f0efec;
  --fg: #1c1c1e;
  --muted: #62626a;
  --border: #dedcd6;
  --border-strong: #c4c2ba;
  --accent: #d52b1e;
  --accent-fg: #ffffff;
  --accent-text: #c02317;
  --good: #1a7f4b;
  --bad: #c0261b;
  --focus: color-mix(in srgb, var(--accent) 55%, transparent);
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
  /* map sequential scale + no-data */
  --seq-lo: #f4ede4;
  --seq-hi: #b0140e;
  /* chart series: federal, canton, commune, church, personal */
  --chart-1: #d52b1e;
  --chart-2: #2f6fb0;
  --chart-3: #2a9d8f;
  --chart-4: #8e6bbf;
  --chart-5: #d19a2a;
  --grid: color-mix(in srgb, var(--border) 70%, transparent);
  /* shape + elevation */
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20,20,25,.05), 0 6px 18px rgba(20,20,25,.05);
  --shadow-lg: 0 4px 10px rgba(20,20,25,.10), 0 16px 40px rgba(20,20,25,.16);
  /* type */
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --fs-xs: .75rem;
  --fs-sm: .875rem;
  --fs-base: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.375rem;
  --fs-2xl: clamp(1.6rem, 2.2vw + 1rem, 2.25rem);
  --fs-hero: clamp(2.2rem, 4vw + 1rem, 3.75rem);
  /* spacing */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-7: 48px; --space-8: 64px;
  --gutter: var(--space-4);
  --maxw: 1200px;
  --nav-h: 52px;
  color-scheme: light dark;
}
@media (min-width: 720px) { :root { --gutter: var(--space-5); } }
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111113;
    --bg-alt: #151518;
    --surface: #1b1b1f;
    --surface-2: #26262b;
    --fg: #ededf0;
    --muted: #a3a3ac;
    --border: #35353c;
    --border-strong: #50505a;
    --accent: #d9382a;
    --accent-fg: #ffffff;
    --accent-text: #ff7466;
    --good: #46c585;
    --bad: #ff7d70;
    --seq-lo: #f6e7a6;   /* L*~92: light end stands out on the dark surface */
    --seq-hi: #ee3a2c;   /* saturated red, L*~54 */
    --chart-1: #ee5a4b;
    --chart-2: #5b9be0;
    --chart-3: #47bfae;
    --chart-4: #a98be0;
    --chart-5: #e6b44d;
    --shadow: 0 1px 2px rgba(0,0,0,.45), 0 6px 18px rgba(0,0,0,.30);
    --shadow-lg: 0 4px 10px rgba(0,0,0,.5), 0 16px 40px rgba(0,0,0,.55);
  }
}

/* ===== base ===== */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + var(--space-2)); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 400 var(--fs-base)/1.55 var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
h1, h2, h3, h4 { line-height: 1.15; margin: 0 0 var(--space-3); font-weight: 650; }
h1 { font-size: var(--fs-hero); letter-spacing: -.035em; font-weight: 750; }
h2 { font-size: var(--fs-2xl); letter-spacing: -.025em; font-weight: 700; }
h3 { font-size: var(--fs-xl); letter-spacing: -.012em; }
p { margin: 0 0 var(--space-3); }
a { color: var(--accent-text); text-underline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.num, .kpi .v, table td, table th, .chart text { font-variant-numeric: tabular-nums; }
.num { text-align: right; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ===== nav ===== */
.topnav { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--border); }
.topnav-in { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.brand { display: flex; align-items: center; gap: var(--space-2); font-weight: 700; letter-spacing: -.01em; color: var(--fg);
  text-decoration: none; white-space: nowrap; flex: none; border-radius: var(--radius-sm); }
.brand-flag { width: 22px; height: 22px; border-radius: 5px; background: var(--accent); position: relative; display: inline-block; flex: none; }
.brand-flag::before, .brand-flag::after { content: ""; position: absolute; background: #fff; }
.brand-flag::before { left: 9px; top: 4px; width: 4px; height: 14px; }
.brand-flag::after { left: 4px; top: 9px; width: 14px; height: 4px; }
.topnav nav { display: flex; gap: var(--space-1); overflow-x: auto; scrollbar-width: none; min-width: 0; margin-right: calc(var(--space-2) * -1); }
.topnav nav::-webkit-scrollbar { display: none; }
.topnav nav a { color: var(--muted); text-decoration: none; padding: var(--space-2) var(--space-3); min-height: 40px; display: inline-flex; align-items: center;
  border-radius: 999px; font-weight: 550; font-size: var(--fs-sm); white-space: nowrap; transition: background .15s, color .15s; }
.topnav nav a:hover { background: var(--surface-2); color: var(--fg); }
.topnav nav a.active { color: var(--accent-text); background: color-mix(in srgb, var(--accent) 12%, transparent); font-weight: 650; }
@media (max-width: 560px) { .brand-name { display: none; } }

/* ===== layout ===== */
main { display: block; }
.page-section { padding: var(--space-8) max(var(--gutter), calc((100% - var(--maxw)) / 2 + var(--gutter))); border-top: 1px solid var(--border); }
#map, #info { background: var(--bg-alt); }
@media (max-width: 720px) { .page-section { padding-block: var(--space-7); } }
.sec-head { margin-bottom: var(--space-6); max-width: 70ch; }
.sec-eyebrow { margin: 0 0 var(--space-2); font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--accent-text); }
.sec-head h2 { margin-bottom: var(--space-3); }
.sec-lede { margin: 0; color: var(--muted); font-size: var(--fs-lg); line-height: 1.5; }
.foot { text-align: center; color: var(--muted); font-size: var(--fs-sm); padding: var(--space-6) var(--gutter) var(--space-7); border-top: 1px solid var(--border); background: var(--bg); }
.foot a { color: inherit; }
.mod-error { background: color-mix(in srgb, var(--bad) 10%, var(--surface)); border: 1px solid var(--bad); color: var(--bad); padding: var(--space-3) var(--space-4); border-radius: var(--radius); font-size: var(--fs-sm); }

/* ===== hero ===== */
#hero { position: relative; overflow: hidden; border-top: 0; padding-top: var(--space-8); padding-bottom: var(--space-8);
  background: radial-gradient(900px 420px at 85% -10%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%),
              linear-gradient(180deg, var(--surface), var(--bg)); }
#hero::before { content: ""; position: absolute; right: 2%; top: 50%; width: 360px; height: 360px; transform: translateY(-50%); pointer-events: none; z-index: 0;
  --t: color-mix(in srgb, var(--accent) 9%, transparent);
  background: linear-gradient(var(--t), var(--t)) center / 128px 100% no-repeat, linear-gradient(var(--t), var(--t)) center / 100% 128px no-repeat; }
@media (max-width: 1280px) { #hero::before { display: none; } }
@media (max-width: 720px) { #hero::before { display: none; } #hero { padding-block: var(--space-7); } }
.hero-in { position: relative; z-index: 1; max-width: 880px; }
.hero-in h1 { margin: 0 0 var(--space-4); }
.hero-lede { font-size: var(--fs-lg); color: var(--muted); max-width: 56ch; margin: 0 0 var(--space-5); line-height: 1.5; }
.hero-cta { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-bottom: var(--space-7); }
.hero-facts-label { margin: 0 0 var(--space-3); font-size: var(--fs-xs); font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.hero-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
@media (max-width: 720px) { .hero-facts { grid-template-columns: 1fr; } }
.stat { display: block; text-align: left; font: inherit; color: inherit; width: 100%; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--space-5); box-shadow: var(--shadow); position: relative; }
button.stat { cursor: pointer; transition: border-color .15s, transform .15s, box-shadow .15s; }
button.stat:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.stat-k { display: block; font-size: var(--fs-xs); font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: var(--space-2); }
.stat-v { display: block; font-size: clamp(1.9rem, 2.4vw + 1rem, 2.6rem); font-weight: 750; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-v small { font-size: var(--fs-base); font-weight: 600; letter-spacing: 0; color: var(--muted); margin-left: var(--space-1); }
.stat-place { display: block; margin-top: var(--space-3); font-weight: 600; }
.stat-sub { display: block; color: var(--muted); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.stat.good .stat-v { color: var(--good); }
.stat.hot .stat-v { color: var(--accent-text); }

/* ===== card & grids ===== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-5); box-shadow: var(--shadow); min-width: 0; }
.card > h3:first-child { margin-bottom: var(--space-4); }
.grid-sim { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: var(--space-5); align-items: start; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-5); align-items: start; }
.stack { display: grid; gap: var(--space-5); min-width: 0; }
@media (min-width: 961px) { .sim-form { position: sticky; top: calc(var(--nav-h) + var(--space-4)); } }
@media (max-width: 960px) { .grid-sim, .grid-2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) { .card { padding: var(--space-4); } }

/* ===== forms ===== */
.field { display: grid; gap: var(--space-1); margin-bottom: var(--space-4); min-width: 0; }
.field label:not(.check), .field-label { font-size: var(--fs-xs); font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.row { display: flex; gap: var(--space-3); }
.row > * { flex: 1; min-width: 0; }
input[type=text], input[type=number], input[type=search], input[type=email], select, textarea {
  width: 100%; font: inherit; font-size: var(--fs-base); color: var(--fg); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); height: 40px; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 40px; }
input[type=number] { font-variant-numeric: tabular-nums; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input[type=text]:focus, input[type=number]:focus, input[type=search]:focus, input[type=email]:focus, select:focus, textarea:focus,
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--accent); box-shadow: var(--ring); outline: none; }
select { appearance: none; -webkit-appearance: none; padding-right: var(--space-6); cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 17px, calc(100% - 13px) 17px; background-size: 5px 5px; background-repeat: no-repeat; }
input[type=range] { width: 100%; accent-color: var(--accent); margin: 0; height: 40px; cursor: pointer; background: transparent; }
.slider-row { display: grid; grid-template-columns: minmax(0, 1fr) 128px; gap: var(--space-3); align-items: center; }
.slider-row input[type=number] { text-align: right; }
.check { display: flex; align-items: center; gap: var(--space-2); font-size: var(--fs-sm); margin: 0 0 var(--space-4); cursor: pointer; min-height: 40px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; flex: none; cursor: pointer; }
.row.wrap { flex-wrap: wrap; gap: var(--space-2); }
.row.wrap > .age-in { flex: 0 0 72px; width: 72px; }

/* segmented control: one rule for every .seg (track = surface-2, selected = raised surface) */
.seg { display: inline-flex; gap: var(--space-1); padding: var(--space-1); background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; max-width: 100%; }
.field > .seg { display: flex; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: var(--fs-sm); font-weight: 550;
  padding: 0 var(--space-4); min-height: 40px; border-radius: 999px; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s, box-shadow .15s; }
.seg button:hover { color: var(--fg); }
.seg button[aria-pressed=true], .seg button[aria-selected=true] { background: var(--surface); color: var(--fg); font-weight: 650; box-shadow: 0 1px 2px rgba(0,0,0,.18), 0 0 0 1px var(--border); }
.seg button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
@media (max-width: 560px) { .seg button { padding: 0 var(--space-3); } }

/* ===== buttons ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); font: inherit; font-weight: 600; font-size: var(--fs-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--fg); padding: 0 var(--space-4); min-height: 40px; border-radius: var(--radius-sm);
  cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, filter .15s, box-shadow .15s; }
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.btn.primary:hover { background: var(--accent); filter: brightness(1.1); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--fg); }
.btn.lg { min-height: 48px; padding: 0 var(--space-5); font-size: var(--fs-base); border-radius: 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ===== autocomplete ===== */
.ac { position: relative; }
.ac-list { position: absolute; left: 0; right: 0; top: calc(100% + var(--space-1)); z-index: 30; margin: 0; padding: var(--space-1); list-style: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); max-height: 280px; overflow: auto; }
.ac-list li { padding: var(--space-2) var(--space-3); min-height: 40px; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.ac-list li.on, .ac-list li:hover { background: var(--surface-2); }
.ac-list .canton { color: var(--muted); font-size: var(--fs-xs); font-weight: 650; }

/* ===== chips ===== */
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-3) 0; }
.chip { display: inline-flex; align-items: center; gap: var(--space-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
  padding: var(--space-1) var(--space-1) var(--space-1) var(--space-3); font-size: var(--fs-sm); font-weight: 550; min-height: 32px; }
.chip button { border: 0; background: var(--border); color: var(--fg); border-radius: 50%; width: 24px; height: 24px; cursor: pointer; line-height: 1; padding: 0; font-size: var(--fs-base); }
.chip button:hover { background: var(--accent); color: var(--accent-fg); }
.chip button:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
button.chip { cursor: pointer; font: inherit; font-size: var(--fs-sm); font-weight: 550; padding: 0 var(--space-3); color: var(--fg); }
button.chip:hover { border-color: var(--accent); color: var(--accent-text); }

/* ===== KPI / results ===== */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-5); }
.kpi { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-3) var(--space-4); min-width: 0; }
.kpi .k { font-size: var(--fs-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 650; }
.kpi .v { font-size: var(--fs-xl); font-weight: 750; letter-spacing: -.02em; line-height: 1.25; white-space: nowrap; }
.kpi .s { font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
.kpi.main { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.kpi.main .k, .kpi.main .s { color: rgba(255,255,255,.85); }
.stackbar { display: flex; height: 24px; border-radius: 6px; overflow: hidden; background: var(--surface-2); margin: var(--space-2) 0 var(--space-3); gap: 2px; }
.stackbar span { display: block; min-width: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); font-size: var(--fs-xs); color: var(--muted); margin-bottom: var(--space-4); }
.legend i, .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: var(--space-2); vertical-align: -1px; }
.loading { opacity: .5; transition: opacity .15s; }
.err { color: var(--bad); font-size: var(--fs-sm); }
.result-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2); }
.result-title .muted { font-size: var(--fs-base); font-weight: 500; letter-spacing: 0; }

/* ===== tables ===== */
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
th, td { padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border); text-align: left; }
th { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; white-space: nowrap; }
td.num, th.num { text-align: right; }
tr.total td { font-weight: 700; border-bottom: 0; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--surface-2); }
.pos { color: var(--bad); } .neg { color: var(--good); }
.table-wrap { overflow-x: auto; max-width: 100%; }
.table-wrap table.cmp-table { min-width: 600px; }
td.num, td.nw { white-space: nowrap; }
.cmp-chart { max-width: 760px; }

/* ===== charts ===== */
.chart { width: 100%; height: auto; display: block; }
.chart text { font: 400 var(--fs-xs) var(--font); fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .tip { font-weight: 650; fill: var(--fg); }
.chart-legend { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); font-size: var(--fs-xs); color: var(--muted); margin-top: var(--space-2); }

/* ===== tooltip ===== */
.tip { background: var(--surface); color: var(--fg); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  padding: var(--space-2) var(--space-3); font-size: var(--fs-sm); line-height: 1.4; font-variant-numeric: tabular-nums; }

.presets { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-3) 0 var(--space-4); }
.profile-note { background: var(--surface-2); border-radius: var(--radius-sm); padding: var(--space-3) var(--space-4); font-size: var(--fs-sm); color: var(--muted); margin-bottom: var(--space-4); }
.profile-note b { color: var(--fg); font-weight: 650; font-variant-numeric: tabular-nums; }

@media (max-width: 560px) {
  .kpis { grid-template-columns: 1fr 1fr; gap: var(--space-2); }
  .kpi.main { grid-column: 1 / -1; }
  .kpi.main ~ .kpi:last-child:nth-child(even) { grid-column: 1 / -1; }
  .kpi { padding: var(--space-3); }
  .kpi .v { font-size: var(--fs-lg); }
  .kpi.main .v { font-size: var(--fs-xl); }
  .slider-row { grid-template-columns: minmax(0, 1fr) 112px; }
  .row { gap: var(--space-2); }
  .hero-cta .btn { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }

/* ===== UX round 2 ===== */
.skip-link { position: absolute; left: var(--space-3); top: -60px; z-index: 100; background: var(--accent); color: var(--accent-fg); padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm); font-weight: 650; text-decoration: none; transition: top .15s; }
.skip-link:focus { top: var(--space-2); }
.to-top { position: fixed; right: var(--space-4); bottom: var(--space-4); z-index: 45; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--fg); box-shadow: var(--shadow-lg); cursor: pointer; font-size: 1.2rem; line-height: 1; opacity: 0; pointer-events: none; transform: translateY(8px);
  transition: opacity .2s, transform .2s; }
.to-top.show { opacity: 1; pointer-events: auto; transform: none; }
.to-top:hover { border-color: var(--accent); color: var(--accent-text); }

/* label row with help bubble */
.lbl { display: flex; align-items: center; gap: var(--space-2); }
.field { position: relative; }
.h3-row { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-3); position: relative; }
.h3-row h3 { margin: 0; }
.help { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; flex: none; cursor: help;
  background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--muted); font-size: 12px; font-weight: 700; line-height: 1; text-transform: none; letter-spacing: 0; }
.help:hover, .help:focus-visible { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); outline: none; }
.help-pop { display: none; position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 40; background: var(--fg); color: var(--bg); font-size: var(--fs-sm); font-weight: 400;
  line-height: 1.45; padding: var(--space-3); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); text-align: left; text-transform: none; letter-spacing: 0; }
.help:hover .help-pop, .help:focus .help-pop, .help:focus-visible .help-pop { display: block; }
.kpi, .check-f { position: relative; }
.kpi .help { width: 16px; height: 16px; font-size: 10px; vertical-align: 1px; margin-left: 4px; }
.kpi .help-pop { left: 0; right: auto; width: 220px; top: 100%; }
.check-f { display: flex; align-items: center; gap: var(--space-2); }
.check-f .check { margin: 0; flex: 1; }

/* money input: CHF prefix, right aligned, thousands separators */
.money { position: relative; }
.money-pre { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: var(--fs-xs); font-weight: 650; color: var(--muted); pointer-events: none; letter-spacing: .04em; }
.money input { text-align: right; padding-left: 46px; font-variant-numeric: tabular-nums; font-weight: 550; }
.slider-row { grid-template-columns: minmax(0, 1fr) 150px; }

/* quick start presets */
.quick { margin-bottom: var(--space-4); display: grid; gap: var(--space-2); }
.quick-btns { display: flex; flex-wrap: wrap; gap: var(--space-2); }
button.chip.pill { min-height: 36px; padding: 0 var(--space-3); background: var(--surface); border-color: var(--border-strong); }
button.chip.pill:hover { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }

/* result card header + actions */
.result-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.result-head .result-title { margin: 0; }
.result-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.btn.sm { min-height: 36px; padding: 0 var(--space-3); }
.sim-result .kpis { grid-template-columns: 1fr 1fr; }
@media (min-width: 1100px) { .sim-result .kpis { grid-template-columns: repeat(4, 1fr); } .sim-result .kpi:nth-child(n+4) { grid-column: span 2; } }
.kpi.main { grid-column: span 2; }
@media (max-width: 560px) { .kpi.main { grid-column: 1 / -1; } }

/* what-if */
.whatif { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--space-3) var(--space-4); margin-bottom: var(--space-4); background: var(--surface); }
.whatif h4 { margin: 0 0 var(--space-2); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.whatif-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-2) 0; border-top: 1px solid var(--border); }
.whatif-row:first-of-type { border-top: 0; }
.wi-l { font-weight: 600; }
.wi-d { font-weight: 750; font-size: var(--fs-lg); white-space: nowrap; font-variant-numeric: tabular-nums; text-align: right; }
.wi-d small { font-weight: 500; font-size: var(--fs-xs); color: var(--muted); }
.breakdown > summary { cursor: pointer; font-weight: 650; padding: var(--space-2) 0; min-height: 40px; display: flex; align-items: center; }
.breakdown[open] > summary { margin-bottom: var(--space-2); }

/* loading: skeletons + slim progress bar instead of a content jump */
.skel { background: linear-gradient(90deg, var(--surface-2) 25%, color-mix(in srgb, var(--surface-2) 55%, var(--surface)) 50%, var(--surface-2) 75%); background-size: 200% 100%;
  animation: skel 1.2s linear infinite; border-radius: var(--radius-sm); }
@keyframes skel { to { background-position: -200% 0; } }
.skel-title { height: 28px; width: 40%; margin-bottom: var(--space-4); }
.skel-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-5); }
.skel-kpi { height: 84px; }
.skel-bar { height: 24px; margin-bottom: var(--space-4); }
.skel-block { height: 160px; } .skel-block.short { height: 90px; }
.skel-chart { height: 240px; }
.skel-inline { display: inline-block; width: 70px; height: 22px; vertical-align: middle; }
.loading { opacity: 1; position: relative; }
.loading > * { opacity: .55; transition: opacity .15s; }
.loading::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; border-radius: var(--radius) var(--radius) 0 0; z-index: 2;
  background: linear-gradient(90deg, transparent, var(--accent), transparent); background-size: 40% 100%; background-repeat: no-repeat; animation: bar 1s ease-in-out infinite; }
@keyframes bar { from { background-position: -40% 0; } to { background-position: 140% 0; } }
@media (prefers-reduced-motion: reduce) { .skel, .loading::after { animation: none; } }

/* error + empty states */
.err-box { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-4);
  border: 1px solid color-mix(in srgb, var(--bad) 50%, var(--border)); background: color-mix(in srgb, var(--bad) 7%, var(--surface)); border-radius: var(--radius-sm); font-size: var(--fs-sm); }
.empty { text-align: center; padding: var(--space-6) var(--space-4); color: var(--muted); border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); }
.empty strong { display: block; color: var(--fg); font-size: var(--fs-base); margin-bottom: var(--space-1); }

/* mobile sticky result bar */
.sim-bar { display: none; }
@media (max-width: 960px) {
  .sim-bar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 48; align-items: center; justify-content: space-between; gap: var(--space-3);
    padding: var(--space-2) var(--gutter) calc(var(--space-2) + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border-strong); box-shadow: 0 -6px 20px rgba(0,0,0,.12); }
  .sim-bar[hidden] { display: none !important; }
  .sim-bar-txt { display: grid; min-width: 0; }
  .sb-total { font-size: var(--fs-lg); font-variant-numeric: tabular-nums; }
  .sb-sub { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .to-top { bottom: calc(var(--space-7) + 24px); }
}
@media (max-width: 560px) {
  input[type=text], input[type=number], input[type=search], select { height: 46px; font-size: 16px; }
  .seg button, .btn, .ac-list li, button.chip.pill { min-height: 44px; }
  .check { min-height: 44px; }
  .result-actions { width: 100%; }
  .result-actions .btn { flex: 1 1 auto; white-space: nowrap; padding: 0 var(--space-3); }
  .slider-row { grid-template-columns: minmax(0, 1fr) 132px; }
  .whatif-row { flex-wrap: wrap; }
  .kpi .help-pop { width: 180px; }
}

/* compare: verdict + savings */
.cmp-verdict { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-4) var(--space-5);
  border-radius: var(--radius); border: 1px solid color-mix(in srgb, var(--good) 45%, var(--border)); background: color-mix(in srgb, var(--good) 9%, var(--surface)); margin-bottom: var(--space-4); }
.cmp-verdict.neutral { border-color: var(--border); background: var(--surface-2); }
.cmp-verdict .big { font-size: var(--fs-xl); font-weight: 750; letter-spacing: -.02em; line-height: 1.25; }
.cmp-verdict .big .g { color: var(--good); }
.cmp-verdict .sub { color: var(--muted); font-size: var(--fs-sm); }
.badge { display: inline-block; font-size: var(--fs-xs); font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--muted); vertical-align: 1px; margin-left: var(--space-1); }
.badge.good { background: color-mix(in srgb, var(--good) 14%, var(--surface)); border-color: var(--good); color: var(--good); }
.badge.you { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border-color: var(--accent); color: var(--accent-text); }
.cmp-table tr.best td { background: color-mix(in srgb, var(--good) 8%, transparent); }
.cmp-table tr.you td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.cmp-table .sv { font-weight: 700; white-space: nowrap; }
.cmp-table .sv small { display: block; font-weight: 500; color: var(--muted); font-size: var(--fs-xs); }
.chip.base { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border-color: var(--accent); padding-right: var(--space-3); }
.preset-label { font-size: var(--fs-xs); font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); align-self: center; margin-right: var(--space-1); }
.hide-sm {}
.show-sm { display: none; }
@media (max-width: 640px) { .hide-sm { display: none; } .show-sm { display: inline; font-size: 1.4rem; } .table-wrap table.cmp-table { min-width: 0; } .cmp-table th, .cmp-table td { padding: var(--space-2); } }
@media (max-width: 640px) { .cmp-table th { white-space: normal; font-size: 10px; } .cmp-table td, .cmp-table th { padding: var(--space-2) 6px; } .cmp-table .sv { font-size: var(--fs-xs); } }
