:root {
  --ink: #14213d;
  --ink-2: #3d4a63;
  --muted: #6b7489;
  --line: #e2e6ee;
  --bg: #ffffff;
  --bg-2: #f5f7fb;
  --accent: #0f7b5f;
  --accent-2: #e6f4ef;
  --on-accent: #ffffff;
  --field-bg: #ffffff;
  --field-line: #c9d0dd;
  --card-bg: #ffffff;
  --error: #a3261b;
  --focus: rgba(15, 123, 95, 0.25);
  --shadow: rgba(20, 33, 61, 0.06);
  color-scheme: light;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
/* Dark theme: follows the device or browser setting, unless the visitor picks one with the toggle
   (stored as data-theme on <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e6eaf2;
    --ink-2: #c3cad8;
    --muted: #9aa4b8;
    --line: #2a3346;
    --bg: #0f1420;
    --bg-2: #161d2c;
    --accent: #3ccf9f;
    --accent-2: #12352b;
    --on-accent: #062a1f;
    --field-bg: #121a29;
    --field-line: #3a4560;
    --card-bg: #141b2a;
    --error: #ff8a7a;
    --focus: rgba(60, 207, 159, 0.35);
    --shadow: rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #e6eaf2;
  --ink-2: #c3cad8;
  --muted: #9aa4b8;
  --line: #2a3346;
  --bg: #0f1420;
  --bg-2: #161d2c;
  --accent: #3ccf9f;
  --accent-2: #12352b;
  --on-accent: #062a1f;
  --field-bg: #121a29;
  --field-line: #3a4560;
  --card-bg: #141b2a;
  --error: #ff8a7a;
  --focus: rgba(60, 207, 159, 0.35);
  --shadow: rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.55; font-size: 17px; }
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); font-size: 14px; }

/* Header and footer */
.site-header { border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.logo { font-weight: 700; font-size: 20px; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 8px; }
.logo__text span { color: var(--accent); }
.logo__mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--on-accent); font-size: 17px; }
.site-header nav { display: flex; gap: 12px; flex-wrap: wrap; }
.site-header nav a { color: var(--ink-2); text-decoration: none; font-size: 14.5px; }
.site-header nav a:hover { color: var(--accent); }
.header-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--ink-2); cursor: pointer; flex: none; }
.icon-btn:hover { color: var(--accent); border-color: var(--accent); filter: none; }
.icon-btn svg { width: 20px; height: 20px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme-current="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme-current="dark"] .theme-toggle .icon-moon { display: none; }
.site-footer { margin-top: 64px; padding: 28px 0 40px; background: var(--bg-2); border-top: 1px solid var(--line); font-size: 15px; }
.site-footer nav { display: flex; gap: 18px; flex-wrap: wrap; margin: 8px 0; }

/* Type */
h1 { font-size: clamp(28px, 4vw, 40px); line-height: 1.15; margin: 20px 0 8px; letter-spacing: -0.01em; }
h2 { font-size: 24px; line-height: 1.25; margin: 36px 0 10px; }
h3 { font-size: 19px; margin: 24px 0 6px; }
.lede { font-size: 19px; color: var(--ink-2); margin: 0 0 6px; max-width: 760px; }
.updated { color: var(--muted); font-size: 14px; margin: 0 0 20px; }
.year-badge { display: inline-block; vertical-align: middle; font-size: 14px; font-weight: 600; background: var(--accent-2); color: var(--accent); padding: 3px 10px; border-radius: 999px; letter-spacing: 0; }
.crumbs { font-size: 14px; color: var(--muted); margin-top: 18px; display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }

/* Calculator */
.calc { display: grid; grid-template-columns: minmax(280px, 400px) minmax(0, 1fr); gap: 24px; align-items: start; }
.calc > *, .content > * { min-width: 0; }
.calc__form { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 15px; margin-bottom: 5px; }
.field small { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; line-height: 1.4; }
select, input[type="text"], input[type="email"] { width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--field-line); border-radius: 8px; background: var(--field-bg); color: var(--ink); }
select:focus, input:focus { outline: 3px solid var(--focus); border-color: var(--accent); }
.affix { display: flex; align-items: center; background: var(--field-bg); border: 1px solid var(--field-line); border-radius: 8px; }
.affix:focus-within { outline: 3px solid var(--focus); border-color: var(--accent); }
.affix span { padding: 0 4px 0 12px; color: var(--muted); white-space: nowrap; }
.affix--pct span { padding: 0 12px 0 4px; }
.affix--pct input { padding-left: 12px; }
.affix input { border: 0; outline: none; padding-left: 4px; }
.affix input:focus { outline: none; }
.calc__actions { display: flex; gap: 12px; align-items: center; }
button { font: inherit; font-weight: 600; font-size: 16px; padding: 10px 18px; border-radius: 8px; border: 0; background: var(--accent); color: var(--on-accent); cursor: pointer; }
button:hover { filter: brightness(1.08); }
button.link { background: none; color: var(--accent); padding: 10px 4px; text-decoration: underline; }
.calc__result { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; min-height: 320px; }
.result--error { color: var(--error); }
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--bg-2); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.stat--big { grid-column: 1 / -1; background: var(--accent-2); }
.stat__label { font-size: 14px; color: var(--ink-2); }
.stat__value { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat--big .stat__value { font-size: 36px; color: var(--accent); }
.table-wrap { overflow-x: auto; margin: 0 0 16px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 15px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
td { text-align: right; white-space: nowrap; }
.schedule td { text-align: right; }
.schedule thead th { font-size: 13px; color: var(--muted); font-weight: 600; }
.schedule thead th:not(:first-child) { text-align: right; }
.steps summary { cursor: pointer; font-weight: 600; margin-bottom: 6px; }
.steps th { font-weight: 500; }
.steps th small { display: block; color: var(--muted); font-size: 13px; font-weight: 400; }
.steps__total th, .steps__total td { font-weight: 700; border-top: 2px solid var(--ink); }
.notes { margin: 16px 0 0; padding-left: 20px; color: var(--ink-2); font-size: 15px; }
.notes li { margin-bottom: 6px; }
.disclaimer-line { font-size: 14px; color: var(--muted); margin: 12px 0 0; }

/* Content */
.content { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 40px; margin-top: 24px; }
.prose { max-width: 720px; }
.prose.narrow { margin: 0 auto; }
.prose li { margin-bottom: 6px; }
.sidebar { display: flex; flex-direction: column; gap: 20px; padding-top: 36px; }
.sidebar h2, .deadlines h2, .signup h2 { font-size: 17px; margin: 0 0 10px; }
.deadlines, .signup, .related { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.deadlines ul { list-style: none; margin: 0; padding: 0; }
.deadlines li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.deadlines li:last-child { border-bottom: 0; }
.signup form { display: flex; flex-direction: column; gap: 8px; }
.sources { font-size: 15px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin: 18px 0; }
.related .card { margin-bottom: 10px; }
.card { display: flex; flex-direction: column; gap: 4px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); background: var(--card-bg); }
.card:hover { border-color: var(--accent); box-shadow: 0 2px 10px var(--shadow); }
.card strong { color: var(--accent); }
.card span { color: var(--ink-2); font-size: 15px; }
.hero { padding: 24px 0 8px; }
.hub-section h2 a { color: var(--ink); text-decoration: none; }
.hub-section h2 a:hover { color: var(--accent); }
.hero h1 { max-width: 820px; }
.home-deadlines, .why { margin-top: 24px; }
.ad { margin: 24px 0; min-height: 120px; }

@media (max-width: 860px) {
  .calc, .content { grid-template-columns: minmax(0, 1fr); }
  .sidebar { padding-top: 0; }
  .calc__result { min-height: 0; }
  .site-header nav { gap: 14px; }
  .site-header nav a { font-size: 14px; }
}
/* Below the width where the logo, every nav link and the theme button fit on one line,
   the nav moves to its own row under the logo. */
@media (max-width: 1150px) {
  .site-header nav { order: 3; flex-basis: 100%; padding-bottom: 10px; }
  .header-actions { order: 2; margin-left: auto; }
}

/* A–Z index that reads down each column, like a book index. */
.state-links { list-style: none; padding: 0; margin: 14px 0 18px; columns: 2; column-gap: 24px; }
.state-links li { break-inside: avoid; }
.state-links a { display: block; padding: 5px 0; }
@media (min-width: 560px) { .state-links { columns: 3; } }
@media (min-width: 820px) { .state-links { columns: 4; } }
@media (min-width: 1040px) { .state-links { columns: 5; } }
.state-jump { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 16px 0 6px; }
.state-jump label { font-weight: 600; }
.state-jump select { font: inherit; padding: 8px 10px; border: 1px solid var(--field-line); border-radius: 8px; background: var(--field-bg); color: var(--ink); min-width: 220px; max-width: 100%; }
/* Tables inside articles: labels read left, figures right. */
.prose table { width: 100%; border-collapse: collapse; margin: 16px 0 20px; font-size: 16px; }
.prose th, .prose td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th:first-child, .prose td:first-child { text-align: left; white-space: normal; }
.prose th { text-align: right; font-size: 14px; color: var(--muted); font-weight: 600; }
.situations .cards { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

/* Site search */
.site-search { position: relative; max-width: 680px; margin: 18px 0 8px; }
.site-search__box { display: flex; align-items: center; gap: 8px; border: 1px solid var(--field-line); border-radius: 12px; background: var(--field-bg); padding: 4px 4px 4px 14px; }
.site-search__box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-2); }
.site-search__box > svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
.site-search input[type="search"] { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 17px; padding: 10px 2px; color: var(--ink); outline: none; -webkit-appearance: none; appearance: none; }
.site-search__box button { padding: 9px 18px; flex: none; }
.site-search__list { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none; background: var(--card-bg); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 28px var(--shadow); }
.site-search__list a { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 10px; border-radius: 8px; text-decoration: none; color: var(--ink); }
.site-search__list a strong { font-weight: 600; }
.site-search__list a span { color: var(--muted); font-size: 13px; white-space: nowrap; }
.site-search__list li[aria-selected="true"] a, .site-search__list a:hover { background: var(--accent-2); }
.site-search__all { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }
.site-search__all a { color: var(--accent); font-weight: 600; font-size: 15px; }
.search-results { list-style: none; padding: 0; margin: 8px 0 24px; max-width: 760px; }
.search-results li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.search-results a { font-weight: 600; font-size: 18px; }
.search-results .kind { display: block; color: var(--muted); font-size: 13px; margin-bottom: 2px; }
.search-results p { margin: 4px 0 0; color: var(--ink-2); }
.search-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 20px; padding: 0; list-style: none; }
.search-chips a { display: inline-block; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--ink-2); font-size: 15px; background: var(--card-bg); }
.search-chips a:hover { border-color: var(--accent); color: var(--accent); }
@media (max-width: 520px) {
  .site-search__box button { padding: 9px 12px; }
  .site-search input[type="search"] { font-size: 16px; }
}
