/* RupeeSheet design system
   One accent, one radius family, one theme at a time.
   Type: Geist (display and UI) + Geist Mono (figures in tables and inputs). */

@font-face {
  font-family: 'Geist';
  src: url('../fonts/geist.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('../fonts/geist-mono.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --ink: #0b1118;
  --ink-2: #2a3441;
  --muted: #56616f;
  --faint: #66717f;
  --line: #e2e7ed;
  --line-strong: #ccd4de;
  --accent: #1b46c2;
  --accent-hover: #163aa3;
  --accent-ink: #ffffff;
  --accent-soft: #e9eefb;
  --accent-line: #c2d0f6;
  --stack-pf: #b7c1cd;
  --positive: #0a7a54;
  --negative: #a93226;
  --warn-soft: #fdf5e3;
  --warn-line: #efd9a8;
  --warn-ink: #6b4a08;
  --shadow-sm: 0 1px 2px rgba(11, 17, 24, .06);
  --shadow: 0 1px 2px rgba(11, 17, 24, .04), 0 18px 40px -24px rgba(11, 17, 24, .35);
  --r-card: 14px;
  --r-input: 10px;
  --r-btn: 10px;
  --sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --wrap: 1200px;
  color-scheme: light;
}

html[data-theme='dark'] {
  --bg: #0a0f15;
  --surface: #101821;
  --surface-2: #17212c;
  --ink: #e9eff6;
  --ink-2: #c5d0dc;
  --muted: #96a4b4;
  --faint: #8494a6;
  --line: #1e2a36;
  --line-strong: #2d3b49;
  --accent: #86a1ff;
  --accent-hover: #a2b6ff;
  --accent-ink: #08101f;
  --accent-soft: #16213a;
  --accent-line: #2b3f66;
  --stack-pf: #48596b;
  --positive: #45d3a1;
  --negative: #ff9186;
  --warn-soft: #251d0c;
  --warn-line: #4a3b16;
  --warn-ink: #f2d79a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 18px 40px -24px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'kern' 1, 'liga' 1;
  overflow-x: clip;
}

/* one soft wash at the top of the page, so the hero does not sit on flat grey */
body::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 540px;
  background: radial-gradient(760px 300px at 78% -6%, var(--accent-soft) 0%, transparent 72%);
  opacity: .9;
  pointer-events: none;
  z-index: 0;
}

header, main, footer { position: relative; z-index: 1; }

img, svg { max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--accent-soft); color: var(--ink); }
hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }

h1, h2, h3, h4 {
  font-weight: 600;
  letter-spacing: -.025em;
  line-height: 1.18;
  margin: 0 0 .5em;
  color: var(--ink);
  text-wrap: balance;
}
h1 { font-size: clamp(2.1rem, 1.5rem + 2vw, 3.35rem); letter-spacing: -.04em; line-height: 1.04; }
h2 { font-size: clamp(1.45rem, 1.25rem + .7vw, 1.85rem); letter-spacing: -.03em; }
h3 { font-size: 1.06rem; letter-spacing: -.02em; }
h4 { font-size: .95rem; }
p { margin: 0 0 1em; text-wrap: pretty; }
small { font-size: .82rem; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 780px; }

.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.pos { color: var(--positive); }
.neg { color: var(--negative); }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  font-size: 1.06rem;
  letter-spacing: -.035em;
  color: var(--ink);
  flex: none;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 27px; height: 27px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  flex: none;
}
.brand-mark svg { width: 17px; height: 17px; display: block; }
.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  font-size: .9rem;
  height: 64px;
}
.nav a {
  color: var(--muted);
  padding: 0 12px;
  height: 64px;
  display: inline-flex;
  align-items: center;
  position: relative;
  transition: color .15s;
}
.nav a:hover { color: var(--ink); text-decoration: none; }
.nav a[aria-current='page'] { color: var(--ink); }
.nav a[aria-current='page']::after {
  content: '';
  position: absolute;
  left: 12px; right: 12px; bottom: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
}
.icon-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  width: 34px; height: 34px;
  margin-left: 8px;
  border-radius: var(--r-btn);
  display: grid; place-items: center;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.icon-btn:hover { border-color: var(--line-strong); background: var(--surface-2); color: var(--ink); }
.icon-btn:active { transform: scale(.95); }
.icon-btn svg { width: 16px; height: 16px; }
html[data-theme='light'] .icon-moon, html[data-theme='dark'] .icon-sun { display: none; }

/* ---------- buttons ---------- */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: .94rem;
  font-weight: 500;
  line-height: 1;
  height: 44px;
  padding: 0 18px;
  border-radius: var(--r-btn);
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s, color .15s;
}
.btn:hover { text-decoration: none; background: var(--accent-hover); }
.btn:active { transform: translateY(1px); }
.btn.secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn.secondary:hover { background: var(--surface-2); border-color: var(--faint); }
.btn.ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
  height: 32px;
  padding: 0 8px;
  font-size: .82rem;
}
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.small { height: 34px; padding: 0 12px; font-size: .84rem; }
.btn svg { width: 15px; height: 15px; }

/* ---------- hero ---------- */
.hero {
  padding: 60px 0 44px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: 56px;
  align-items: start;
}
.hero-copy { display: flex; flex-direction: column; align-items: flex-start; }
.hero h1 { max-width: 14ch; margin-bottom: 18px; }
.hero .lede {
  font-size: 1.04rem;
  line-height: 1.55;
  color: var(--muted);
  max-width: 44ch;
  margin-bottom: 26px;
}
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-meta {
  margin-top: 30px;
  font-size: .82rem;
  color: var(--faint);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: center;
}
.hero-meta b { color: var(--ink-2); font-weight: 500; }
.hero-meta .sep { color: var(--line-strong); }

.hero-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.hero-card .panel-head { padding: 16px 18px; }
.hero-card .panel-body { padding: 18px; }

/* ---------- cards & panels ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
}
.panel-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.panel-head h2, .panel-head h3 { margin: 0; font-size: .98rem; letter-spacing: -.015em; }
.panel-body { padding: 18px; }
.panel-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  font-size: .8rem;
  color: var(--faint);
}
.section { padding: 68px 0; }
.section.tight { padding: 40px 0; }
.section-head { margin-bottom: 26px; }
.section-head h2 { margin-bottom: 8px; }
.section-head p { color: var(--muted); max-width: 58ch; margin: 0; font-size: .97rem; }

/* ---------- tool grid ---------- */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.tool-card {
  display: flex;
  flex-direction: column;
  padding: 18px 18px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  color: var(--ink);
  transition: border-color .15s, transform .15s;
}
.tool-card:hover { text-decoration: none; border-color: var(--accent-line); transform: translateY(-2px); }
.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.tool-card .kicker {
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--accent);
}
.card-top .go {
  color: var(--accent);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity .15s, transform .15s;
  display: inline-flex;
}
.tool-card:hover .card-top .go { opacity: 1; transform: none; }
.tool-card h3 { margin: 0 0 6px; font-size: 1.04rem; letter-spacing: -.02em; }
.tool-card p { margin: 0; font-size: .875rem; color: var(--muted); line-height: 1.5; max-width: 46ch; }
.tool-card .metric {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: .78rem;
  color: var(--muted);
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}
.tool-card .metric b {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: .88rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -.02em;
}

/* ---------- forms ---------- */
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: block;
  font-size: .82rem;
  font-weight: 500;
  color: var(--ink-2);
  margin-bottom: 6px;
  letter-spacing: -.005em;
}
.field .hint { font-size: .76rem; color: var(--faint); margin-top: 6px; line-height: 1.45; }
.field .hint a { color: var(--faint); text-decoration: underline; text-underline-offset: 2px; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .prefix {
  position: absolute;
  left: 12px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: .9rem;
  pointer-events: none;
}
input[type='number'], input[type='text'], select {
  width: 100%;
  appearance: none;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: .95rem;
  letter-spacing: -.01em;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-input);
  height: 42px;
  padding: 0 12px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input.with-prefix { padding-left: 27px; }
select { font-family: var(--sans); padding-right: 34px; cursor: pointer; }
input:hover, select:hover { border-color: var(--faint); }
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type='number'] { -moz-appearance: textfield; }
.select-wrap { position: relative; }
.select-wrap::after {
  content: '';
  position: absolute;
  right: 13px; top: 50%;
  width: 7px; height: 7px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.field-row .field { margin-bottom: 0; }
input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--line-strong);
  outline: none;
  cursor: pointer;
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line-strong);
  cursor: grab;
}
input[type='range']::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--surface); cursor: grab;
}
.segmented {
  display: inline-flex;
  padding: 3px;
  background: var(--surface-2);
  border-radius: var(--r-btn);
  gap: 2px;
  width: 100%;
}
.segmented button {
  appearance: none;
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: .84rem;
  font-weight: 500;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
  white-space: nowrap;
}
.segmented button:hover { color: var(--ink-2); }
.segmented button[aria-pressed='true'] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  font-size: .86rem;
  color: var(--ink-2);
}
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span {
  position: absolute; inset: 0;
  background: var(--line-strong);
  border-radius: 999px;
  transition: background .15s;
  pointer-events: none;
}
.switch span::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  background: var(--surface);
  border-radius: 50%;
  transition: transform .15s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* quick salary presets */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chips button {
  appearance: none;
  font-family: var(--mono);
  font-size: .74rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  height: 26px;
  padding: 0 10px;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.chips button:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.chips button[aria-pressed='true'] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

details.advanced {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
details.advanced summary {
  cursor: pointer;
  font-size: .82rem;
  color: var(--muted);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 7px;
}
details.advanced summary:hover { color: var(--ink-2); }
details.advanced summary::-webkit-details-marker { display: none; }
details.advanced summary::before {
  content: '+';
  font-family: var(--mono);
  color: var(--accent);
  font-size: .95rem;
  line-height: 1;
  width: 12px;
}
details.advanced[open] summary::before { content: '\2212'; }
details.advanced .advanced-body { padding-top: 14px; }

/* ---------- results ---------- */
.result-panel { position: sticky; top: 84px; }
.result-hero { padding: 20px 18px 18px; border-bottom: 1px solid var(--line); }
.result-hero .label {
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 500;
}
.result-hero .value {
  font-size: clamp(2.1rem, 1.7rem + 1.2vw, 2.55rem);
  font-weight: 600;
  letter-spacing: -.045em;
  line-height: 1.02;
  margin: 8px 0 6px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.result-hero .sub { font-size: .84rem; color: var(--muted); }
.result-hero .sub strong { color: var(--ink-2); font-weight: 500; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .74rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 3px 9px;
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}

.kv { display: grid; gap: 0; }
.kv-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  font-size: .87rem;
  border-bottom: 1px solid var(--line);
}
.kv-row:last-child { border-bottom: 0; }
.kv-row .k { color: var(--muted); }
.kv-row .v {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
  color: var(--ink);
  white-space: nowrap;
}
.kv-row.total { border-top: 1px solid var(--line-strong); border-bottom: 0; padding-top: 11px; margin-top: 2px; font-weight: 500; }
.kv-row.total .k { color: var(--ink); }

/* the regime that wins gets a quiet outline */
.regime-card { transition: border-color .15s, box-shadow .15s; }
.regime-card.chosen { border-color: var(--accent) !important; box-shadow: 0 0 0 3px var(--accent-soft); }

/* split of take-home vs deductions */
.stack {
  display: flex;
  height: 7px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface-2);
  margin-top: 14px;
  gap: 2px;
}
.stack i { display: block; height: 100%; }
.stack .s-take { background: var(--positive); }
.stack .s-pf { background: var(--stack-pf); }
.stack .s-tax { background: var(--negative); }
.stack-legend .s-take { background: var(--positive); }
.stack-legend .s-pf { background: var(--stack-pf); }
.stack-legend .s-tax { background: var(--negative); }
.stack-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 8px;
  font-size: .73rem;
  color: var(--muted);
}
.stack-legend span { display: inline-flex; align-items: center; gap: 5px; }
.stack-legend i { width: 7px; height: 7px; border-radius: 2px; display: inline-block; }
.stack-legend b { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }

.alloc { display: grid; gap: 7px; margin-top: 4px; }
.alloc-row { display: grid; grid-template-columns: 88px 1fr 72px; align-items: center; gap: 10px; font-size: .78rem; }
.alloc-row .name { color: var(--muted); }
.alloc-row .bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.alloc-row .bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.alloc-row .amt { text-align: right; font-family: var(--mono); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.alloc-row.ded .bar i { background: var(--negative); }
.alloc-row.muted .bar i { background: var(--stack-pf); }
.alloc-row.keep .bar i { background: var(--positive); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
table.data th, table.data td {
  padding: 10px 14px;
  text-align: right;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data th:first-child, table.data td:first-child { text-align: left; white-space: normal; }
table.data thead th {
  font-size: .7rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 500;
  border-bottom: 1px solid var(--line-strong);
  padding-top: 8px;
  padding-bottom: 8px;
}
table.data a { color: var(--ink-2); }
table.data a:hover { color: var(--accent); }
table.data td.n { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr.highlight { background: var(--accent-soft); }
table.data tbody tr.highlight td { font-weight: 500; }
table.data tbody tr.highlight:hover { background: var(--accent-soft); }
table.data caption { caption-side: bottom; padding: 12px 14px 0; font-size: .76rem; color: var(--faint); text-align: left; white-space: normal; }

/* ---------- charts ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid line { stroke: var(--line); stroke-width: 1; }
.chart .axis text { fill: var(--faint); font-family: var(--mono); font-size: 10px; }
.chart .area { fill: var(--accent-soft); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line-2 { fill: none; stroke: var(--muted); stroke-width: 1.6; stroke-dasharray: 4 4; }
.chart .dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart .label { fill: var(--ink-2); font-family: var(--mono); font-size: 10px; }
.chart-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: .76rem;
  color: var(--muted);
  margin-top: 12px;
}
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 9px; height: 9px; border-radius: 2px; background: var(--accent); display: inline-block; }
.chart-legend .alt i { background: var(--muted); }

/* ---------- tool page ---------- */
.page-head { padding: 26px 0 6px; max-width: 74ch; }
.crumbs { font-size: .78rem; color: var(--faint); margin-bottom: 12px; display: flex; gap: 7px; flex-wrap: wrap; }
.crumbs a { color: var(--faint); }
.crumbs a:hover { color: var(--accent); }
.crumbs span.sep { color: var(--line-strong); }
.page-head h1 { font-size: clamp(1.8rem, 1.4rem + 1vw, 2.25rem); letter-spacing: -.035em; line-height: 1.12; margin-bottom: 10px; max-width: 26ch; }
.page-head .lede { font-size: 1.01rem; color: var(--muted); max-width: 66ch; margin-bottom: 12px; }
.byline {
  font-size: .76rem;
  color: var(--faint);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.byline .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--line-strong); }

.tool-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 356px;
  gap: 26px;
  align-items: start;
  padding: 20px 0 8px;
}
.guide-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 26px;
  align-items: start;
  padding: 20px 0 8px;
}
.tool-main { min-width: 0; }
.tool-side { position: sticky; top: 84px; }

/* ---------- article prose ---------- */
.prose { max-width: 70ch; font-size: 1rem; color: var(--ink-2); }
.prose > :first-child { margin-top: 0; }
.prose h2 { margin-top: 2.1em; color: var(--ink); font-size: 1.4rem; }
.prose h3 { margin-top: 1.7em; color: var(--ink); font-size: 1.06rem; }
.prose > h2:first-child, .prose > h3:first-child { margin-top: 0; }
.prose p, .prose li { color: var(--ink-2); line-height: 1.65; }
.prose ul, .prose ol { padding-left: 1.2em; margin: 0 0 1.1em; }
.prose li { margin-bottom: .45em; }
.prose li::marker { color: var(--faint); }
.prose strong { color: var(--ink); font-weight: 600; }
.prose code {
  font-family: var(--mono);
  font-size: .85em;
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 5px;
  color: var(--ink);
}
.prose blockquote {
  margin: 1.4em 0;
  padding: 2px 0 2px 18px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}
.prose table { margin: 1.2em 0; }
.callout {
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  border-radius: 12px;
  padding: 15px 17px;
  margin: 1.5em 0;
  font-size: .91rem;
  color: var(--ink-2);
}
.callout.warn { border-color: var(--warn-line); background: var(--warn-soft); color: var(--warn-ink); }
.callout p:last-child { margin-bottom: 0; }
.callout .title { font-weight: 600; color: var(--ink); display: block; margin-bottom: 4px; font-size: .86rem; }
.callout.warn .title { color: var(--warn-ink); }

/* ---------- accordion ---------- */
.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  cursor: pointer;
  padding: 16px 34px 16px 0;
  font-weight: 500;
  font-size: .95rem;
  color: var(--ink);
  list-style: none;
  position: relative;
  text-wrap: pretty;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary:hover { color: var(--accent); }
.faq summary::after {
  content: '';
  position: absolute;
  right: 8px; top: 24px;
  width: 7px; height: 7px;
  border-right: 1.6px solid var(--muted);
  border-bottom: 1.6px solid var(--muted);
  transform: rotate(45deg);
  transition: transform .2s;
}
.faq details[open] summary::after { transform: rotate(-135deg); top: 26px; }
.faq .answer { padding: 0 0 18px; color: var(--muted); font-size: .92rem; max-width: 68ch; line-height: 1.6; }
.faq .answer p:last-child { margin-bottom: 0; }

/* ---------- misc blocks ---------- */
.ad-slot { margin: 26px 0; }
.ad-slot .ad-label {
  font-size: .66rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 6px;
}
.ad-slot ins { display: block; min-height: 90px; }

.affiliate {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  margin: 24px 0;
}
.affiliate .tag {
  font-size: .64rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}
.affiliate .body { flex: 1; font-size: .86rem; color: var(--muted); }
.affiliate .body strong { color: var(--ink); }
.affiliate .body p { margin: 2px 0 0; }
.affiliate .body a { font-size: .84rem; }

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  overflow: hidden;
}
.stat { background: var(--surface); padding: 15px 18px; }
.stat .k { font-size: .74rem; color: var(--muted); margin-bottom: 5px; }
.stat .v {
  font-size: 1.32rem;
  font-weight: 600;
  letter-spacing: -.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.link-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 26px; }
.link-list a {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  font-size: .88rem;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}
.link-list a:hover { color: var(--accent); text-decoration: none; }
.link-list a span { color: var(--faint); font-family: var(--mono); font-size: .76rem; white-space: nowrap; }

.toc { font-size: .84rem; border-left: 1px solid var(--line); padding-left: 14px; }
.toc a { display: block; padding: 5px 0; color: var(--muted); line-height: 1.4; }
.toc a:hover { color: var(--accent); text-decoration: none; }

.disclaimer {
  font-size: .79rem;
  color: var(--faint);
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 32px;
  max-width: 80ch;
  line-height: 1.55;
}

.cta-band {
  margin: 44px 0 8px;
  padding: 26px 28px;
  border-radius: var(--r-card);
  background: var(--ink);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
html[data-theme='dark'] .cta-band { background: var(--surface-2); color: var(--ink); }
.cta-band h2 { color: inherit; margin: 0 0 4px; font-size: 1.22rem; }
.cta-band p { margin: 0; opacity: .72; font-size: .89rem; max-width: 48ch; }
.cta-band .btn { background: var(--bg); color: var(--ink); }
html[data-theme='dark'] .cta-band .btn { background: var(--accent); color: var(--accent-ink); }
.cta-band .btn:hover { background: var(--surface); }

/* ---------- footer ---------- */
.site-footer {
  margin-top: 56px;
  border-top: 1px solid var(--line);
  padding: 40px 0;
  font-size: .85rem;
  color: var(--muted);
  background: var(--surface);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, minmax(0, 1fr));
  gap: 32px;
}
.footer-grid h4 {
  font-size: .7rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 12px;
  font-weight: 500;
}
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.footer-grid a { color: var(--muted); }
.footer-grid a:hover { color: var(--accent); text-decoration: none; }
.footer-bottom {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: .76rem;
  color: var(--faint);
}
.footer-brand p { margin: 10px 0 0; max-width: 32ch; font-size: .82rem; line-height: 1.55; }
.footer-brand .brand { font-size: 1rem; }

/* ---------- consent ---------- */
.consent {
  position: fixed;
  left: 16px; right: 16px; bottom: 16px;
  z-index: 60;
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
  font-size: .84rem;
  color: var(--muted);
  max-width: 620px;
  margin: 0 auto;
}
.consent p { margin: 0; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .hero { gap: 36px; }
  .tool-layout { grid-template-columns: minmax(0, 1fr) 330px; }
}
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; gap: 28px; padding-top: 36px; }
  .hero h1 { max-width: none; }
  .hero .lede { max-width: 60ch; }
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tool-layout { display: flex; flex-direction: column; gap: 18px; }
  .tool-layout > .tool-main { display: contents; }
  .tool-side { order: 2; position: static; }
  .tool-layout > .tool-main > :first-child { order: 1; }
  .tool-layout > .tool-main > :not(:first-child) { order: 3; }
  .result-panel { position: static; }
  .guide-layout { grid-template-columns: minmax(0, 1fr); }
  .guide-layout .tool-side { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .nav .nav-hide-sm { display: none; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 18px; }
  .nav { gap: 0; }
  .nav a { padding: 0 10px; }
  .nav a[aria-current='page']::after { left: 10px; right: 10px; }
  .panel-head { flex-wrap: wrap; gap: 10px; }
  .panel-head .segmented { max-width: none !important; width: 100%; }
  .tool-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; gap: 14px; }
  .section { padding: 44px 0; }
  .section.tight { padding: 28px 0; }
  .hero { padding: 28px 0 32px; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .cta-band { padding: 20px; }
  .alloc-row { grid-template-columns: 74px 1fr 66px; }
  table.data th, table.data td { padding: 9px 10px; font-size: .82rem; }
}
@media (max-width: 480px) {
  .brand { font-size: .95rem; gap: 7px; }
  .brand-mark { width: 24px; height: 24px; border-radius: 7px; }
  .brand-mark svg { width: 15px; height: 15px; }
  .nav { font-size: .8rem; }
  .nav a { padding: 0 8px; white-space: nowrap; }
  .icon-btn { width: 32px; height: 32px; margin-left: 4px; }
}

/* wide screens: one shell width for every page, so nothing jumps between pages */
@media (min-width: 1400px) {
  :root { --wrap: 1320px; }
  .hero { gap: 64px; }
  h1 { font-size: clamp(2.6rem, 1.9rem + 1.5vw, 3.4rem); }
  .tool-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tool-layout { grid-template-columns: minmax(0, 1fr) 372px; }
  .guide-layout { grid-template-columns: minmax(0, 1fr) 268px; }
}
@media (min-width: 1900px) {
  :root { --wrap: 1440px; }
  .tool-layout { grid-template-columns: minmax(0, 1fr) 392px; }
  .guide-layout { grid-template-columns: minmax(0, 1fr) 280px; }
}

@media print {
  .site-header, .site-footer, .ad-slot, .affiliate, .cta-band, .tool-side > .panel:not(.result-panel), .consent { display: none !important; }
  body { background: #fff; color: #000; }
  body::before { display: none; }
}
