:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --ink: #16202e;
  --muted: #566274;
  --line: #e2e6ec;
  --brand: #1d3a63;
  --brand-ink: #ffffff;
  --accent: #c2410c;
  --accent-soft: #fff1e8;
  --ok: #0f7a4a;
  --ok-soft: #e7f6ee;
  --focus: #2563eb;
  --c-net: #0f7a4a;
  --c-fed: #1d3a63;
  --c-fica: #c2410c;
  --c-ded: #8a94a6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e131b;
    --card: #161d28;
    --ink: #e8edf4;
    --muted: #9aa6b8;
    --line: #273142;
    --brand: #2b4f82;
    --accent: #f08a4b;
    --accent-soft: #2c1d14;
    --ok: #3ccb85;
    --ok-soft: #13291f;
    --c-net: #3ccb85;
    --c-fed: #6f9be0;
    --c-fica: #f08a4b;
    --c-ded: #6b7587;
    --shadow: none;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
img, svg { max-width: 100%; }
a { color: var(--focus); text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--card); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header { background: var(--brand); color: var(--brand-ink); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.logo { color: inherit; text-decoration: none; font-weight: 750; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; }
.logo svg { width: 28px; height: 28px; flex: none; }
.nav { display: flex; gap: 4px 18px; flex-wrap: wrap; font-size: 15px; }
.nav a { color: inherit; text-decoration: none; opacity: .88; padding: 6px 0; }
.nav a:hover, .nav a[aria-current="page"] { opacity: 1; text-decoration: underline; }

/* Hero */
.hero { padding: 28px 0 8px; }
.hero h1 { font-size: clamp(1.7rem, 3.6vw, 2.4rem); line-height: 1.15; margin: 0 0 8px; letter-spacing: -.02em; }
.hero p { margin: 0; color: var(--muted); max-width: 760px; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; padding: 0; list-style: none; }
.badges li { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 13.5px; color: var(--muted); }
.badges li b { color: var(--ok); }
@media (max-width: 600px) {
  .hero { padding-top: 18px; }
  .hero p { font-size: 15px; }
  .badges li:nth-child(n+3) { display: none; }
  .site-header .wrap { min-height: 52px; padding-top: 6px; padding-bottom: 6px; }
  .nav a:last-child { display: none; }
}
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: inherit; }

/* Calculator layout */
.calc-grid { display: grid; gap: 20px; grid-template-columns: 1fr; margin: 20px 0 8px; align-items: start; }
@media (min-width: 900px) { .calc-grid { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); } .results { position: sticky; top: 16px; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card h2 { font-size: 1.15rem; margin: 0 0 14px; }

fieldset { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
legend { font-weight: 650; padding: 0; margin-bottom: 8px; font-size: 15px; }
.row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.row.three { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 520px) { .row, .row.three { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; min-width: 0; }
.field label, .lbl { font-size: 14px; font-weight: 600; }
.hint { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
input[type="number"], input[type="text"], select {
  width: 100%; font: inherit; color: inherit; background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px;
}
input:focus, select:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.money { position: relative; }
.money::before { content: "$"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.money input { padding-left: 26px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; margin: 6px 0 10px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; flex: none; accent-color: var(--brand); }

.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { text-align: center; padding: 9px 8px; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: 15px; color: var(--muted); }
.seg input:checked + label { background: var(--card); color: var(--ink); box-shadow: var(--shadow); outline: 1px solid var(--line); }
.seg input:focus-visible + label { outline: 3px solid var(--focus); }

#calc.is-salary .only-hourly, #calc.is-hourly .only-salary { display: none; }

details.more { border-top: 1px solid var(--line); padding: 12px 0 0; margin-top: 4px; }
details.more summary { cursor: pointer; font-weight: 650; font-size: 15px; list-style: none; display: flex; justify-content: space-between; align-items: center; padding: 4px 0 10px; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::after { content: "+"; font-size: 20px; color: var(--muted); }
details.more[open] summary::after { content: "–"; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.btn { font: inherit; font-weight: 650; border-radius: 10px; padding: 11px 18px; min-height: 44px; cursor: pointer; border: 1px solid var(--brand); background: var(--brand); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }

/* Results */
.net { text-align: center; padding: 6px 0 14px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.net .k { font-size: 14px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.net .v { font-size: clamp(2.2rem, 6vw, 2.9rem); font-weight: 800; letter-spacing: -.02em; color: var(--ok); line-height: 1.15; font-variant-numeric: tabular-nums; }
.net .s { color: var(--muted); font-size: 14.5px; }
.chart { display: grid; grid-template-columns: 132px 1fr; gap: 16px; align-items: center; margin-bottom: 14px; }
#donut svg { width: 132px; height: 132px; display: block; }
#legend { list-style: none; padding: 0; margin: 0; font-size: 13.5px; }
#legend li { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
#legend b { margin-left: auto; font-variant-numeric: tabular-nums; }
.sw { width: 11px; height: 11px; border-radius: 3px; flex: none; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: right; }
th:first-child, td:first-child { text-align: left; }
thead th { font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
tbody th { font-weight: 500; }
tr.strong th, tr.strong td { font-weight: 700; }
tr.sub th, tr.sub td { color: var(--muted); font-size: 13.5px; }
tr.tn th, tr.tn td { color: var(--ok); }
tr.total th, tr.total td { font-weight: 800; border-bottom: 0; border-top: 2px solid var(--ink); font-size: 15.5px; }
.rates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 4px; text-align: center; }
.rates div { background: var(--bg); border-radius: 10px; padding: 8px 4px; }
.rates b { display: block; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.rates span { font-size: 12px; color: var(--muted); }
.note { background: var(--accent-soft); border-left: 3px solid var(--accent); border-radius: 8px; padding: 10px 12px; font-size: 13.5px; margin-top: 12px; }
.tn-callout { background: var(--ok-soft); border-left: 3px solid var(--ok); border-radius: 8px; padding: 10px 12px; font-size: 13.5px; margin-top: 12px; }
.disclaimer { font-size: 12.5px; color: var(--muted); margin-top: 12px; }

/* Content */
.content { padding: 12px 0 40px; }
.content article { max-width: 780px; }
.content h2 { font-size: 1.5rem; margin: 36px 0 10px; letter-spacing: -.01em; line-height: 1.25; }
.content h3 { font-size: 1.15rem; margin: 24px 0 8px; }
.content p, .content li { color: var(--ink); }
.content .table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin: 12px 0 18px; }
.content .table-wrap table { min-width: 460px; }
.content .table-wrap th, .content .table-wrap td { padding: 9px 12px; }
.content .table-wrap caption { text-align: left; padding: 10px 12px 0; font-size: 13px; color: var(--muted); caption-side: bottom; padding-bottom: 10px; }
.toc { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin: 8px 0 12px; }
.toc ol { margin: 6px 0 0; padding-left: 20px; columns: 2 240px; }
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0 16px; margin: 10px 0; }
.faq summary { cursor: pointer; font-weight: 650; padding: 14px 0; }
.faq details > div { padding: 0 0 14px; }
.faq details p { margin: 0 0 8px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 14px 0; padding: 0; list-style: none; }
.cards a { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; text-decoration: none; color: var(--ink); height: 100%; }
.cards a:hover { border-color: var(--brand); }
.cards b { display: block; color: var(--focus); margin-bottom: 2px; }
.cards span { font-size: 14px; color: var(--muted); }
.formula { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 14px; overflow-x: auto; }
.updated { font-size: 14px; color: var(--muted); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 24px 0 36px; font-size: 14px; color: var(--muted); background: var(--card); }
.site-footer .cols { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-bottom: 10px; }
.site-footer a { color: inherit; }

@media print {
  .site-header, .site-footer, .content, .actions, #calc { display: none; }
  .calc-grid { display: block; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
