:root {
  --bg: #ffffff;
  --ink: #102033;
  --muted: #5c6b7a;
  --line: #d9e0e8;
  --soft: #f5f7fa;
  --soft-2: #eef3f1;
  --green: #14784f;
  --green-2: #dff2e8;
  --navy: #19375a;
  --amber: #b26a00;
  --amber-2: #fff4dc;
  --blue: #2b6cb0;
  --radius: 8px;
  --shadow: 0 18px 50px rgba(16, 32, 51, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}

a {
  color: var(--navy);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  min-height: 68px;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 750;
  color: var(--ink);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

nav {
  display: flex;
  justify-content: center;
  gap: 22px;
  font-size: 14px;
  font-weight: 650;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid #0f6643;
  border-radius: var(--radius);
  background: var(--green);
  color: #fff;
  font-size: 14px;
  font-weight: 750;
}

.button:hover {
  text-decoration: none;
  background: #0f6643;
}

.button-small {
  min-height: 36px;
  padding-inline: 14px;
}

.calculator-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 42px 24px 28px;
}

.intro-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  margin-bottom: 24px;
}

.intro-panel h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(36px, 5vw, 64px);
  line-height: 0.98;
  letter-spacing: 0;
}

.intro-panel p {
  max-width: 700px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.freshness {
  display: grid;
  gap: 8px;
  min-width: 190px;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.app-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
  gap: 18px;
  align-items: start;
  min-width: 0;
}

.calculator-error {
  margin-bottom: 18px;
  border: 1px solid #efc46f;
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--amber-2);
  color: #6f4100;
  font-size: 14px;
  font-weight: 750;
}

.rate-warning {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
  border: 1px solid #efc46f;
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--amber-2);
  color: #6f4100;
  font-size: 14px;
  line-height: 1.45;
}

.rate-warning strong {
  color: #5a3500;
}

.rate-warning p {
  margin: 0;
}

.calculator-form,
.result-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.calculator-form {
  padding: 22px;
}

.form-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: start;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.form-head h2,
.section-heading h2,
.article-page h1,
.link-columns h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: 0;
}

.form-head p,
.section-heading p,
.article-page p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.form-head p {
  max-width: 430px;
  font-size: 14px;
}

.form-actions,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.form-actions button,
.result-actions button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  background: var(--soft);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 760;
  cursor: pointer;
}

.form-actions button:hover,
.result-actions button:hover {
  border-color: var(--green);
  color: var(--green);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.field {
  display: grid;
  gap: 8px;
  font-size: 13px;
  font-weight: 720;
  color: var(--muted);
}

.spouse-fields {
  display: contents;
}

.spouse-fields[hidden] {
  display: none;
}

.field input,
.field select {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 650;
}

.field input:focus,
.field select:focus {
  outline: 3px solid rgba(20, 120, 79, 0.16);
  border-color: var(--green);
}

.detail-fields {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.detail-fields summary {
  cursor: pointer;
  color: var(--green);
  font-weight: 800;
}

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--soft);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.segmented legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.segmented label {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
}

.fine-print {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.mileage-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.result-panel {
  position: sticky;
  top: 86px;
  overflow: hidden;
}

.result-topline {
  padding: 24px;
  background: var(--green);
  color: #fff;
}

.result-topline > span:first-child {
  display: block;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.result-topline strong {
  display: block;
  margin-top: 8px;
  font-size: 52px;
  line-height: 1;
  letter-spacing: 0;
}

.result-topline small {
  display: block;
  margin-top: 12px;
  color: rgba(255, 255, 255, 0.84);
  font-size: 14px;
}

.result-topline small span {
  display: inline;
  font-size: inherit;
  font-weight: inherit;
  text-transform: none;
}

.result-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.result-metrics div {
  display: grid;
  gap: 6px;
  min-height: 92px;
  padding: 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.result-metrics div:nth-child(even) {
  border-right: 0;
}

.result-metrics span,
.split-head span,
.split-list dt,
.math-card dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.result-metrics strong {
  font-size: 22px;
}

.result-metrics p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.safe-harbor-metric {
  min-height: 116px;
}

.split-card,
.math-card {
  padding: 18px;
}

.split-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
}

.split-head h3,
.math-card h3,
.process-grid h3,
.guide-card h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.split-bar {
  display: flex;
  width: 100%;
  height: 14px;
  overflow: hidden;
  margin: 14px 0;
  border-radius: 999px;
  background: var(--soft);
}

.split-bar span {
  min-width: 4%;
}

.split-income {
  background: var(--blue);
}

.split-se {
  background: var(--green);
}

.split-state {
  background: var(--amber);
}

.split-list,
.math-card dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.split-list div,
.math-card dl div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.split-list dd,
.math-card dd {
  margin: 0;
  font-weight: 800;
}

.math-card {
  border-top: 1px solid var(--line);
  background: var(--soft);
}

.math-card dl {
  margin-top: 14px;
}

.math-card p {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.result-actions {
  align-items: center;
  padding: 16px 18px 18px;
  border-top: 1px solid var(--line);
}

.result-actions span {
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

.print-summary {
  display: none;
}

.ad-slot {
  display: grid;
  place-items: center;
  max-width: 970px;
  min-height: 110px;
  margin: 20px auto;
  border: 1px dashed #b8c3cf;
  border-radius: var(--radius);
  background: #fafbfc;
  color: #7a8795;
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.content-band {
  max-width: 1180px;
  margin: 0 auto;
  padding: 48px 24px;
}

.section-heading {
  display: grid;
  grid-template-columns: minmax(240px, 0.7fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  margin-bottom: 22px;
}

.process-grid,
.guide-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.process-grid article,
.guide-card,
.deduction-list div,
.callout {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 18px;
}

.process-grid article strong {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-bottom: 18px;
  border-radius: 7px;
  background: var(--green-2);
  color: var(--green);
}

.process-grid p,
.guide-card p,
.deduction-list span {
  color: var(--muted);
  line-height: 1.55;
}

.link-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.link-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.link-cloud a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--soft);
  font-size: 13px;
  font-weight: 750;
}

.guide-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.guide-card {
  color: var(--ink);
}

.checklist-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.checklist-grid article {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: #fff;
}

.checklist-grid h2,
.faq-list h2 {
  margin: 0 0 10px;
  font-size: 20px;
}

.checklist-grid p,
.faq-list p {
  margin: 0;
}

.faq-list {
  display: grid;
  gap: 22px;
  margin-top: 28px;
}

.article-page {
  max-width: 880px;
}

.article-page h1 {
  margin-bottom: 18px;
  font-size: 48px;
}

.article-page section {
  margin-top: 34px;
}

.article-page h2 {
  font-size: 24px;
}

.deadline-table {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.deadline-table div {
  display: grid;
  grid-template-columns: 70px 1fr auto auto;
  gap: 18px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.deadline-table span {
  color: var(--muted);
}

.deadline-passed {
  color: var(--amber);
  font-size: 14px;
  font-weight: 800;
}

.deduction-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.deduction-list div {
  display: grid;
  gap: 8px;
}

.sources ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.7;
}

.source-note {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.callout {
  margin-top: 28px;
  background: var(--amber-2);
}

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--soft);
}

.trust-strip,
.footer-links {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 24px;
}

.trust-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}

.trust-strip p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.footer-links {
  display: flex;
  gap: 18px;
  padding-top: 0;
  font-size: 13px;
  font-weight: 750;
}

code {
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--soft);
}

@media (max-width: 900px) {
  .site-header {
    grid-template-columns: 1fr auto;
    padding: 0 18px;
  }

  nav {
    display: none;
  }

  .intro-panel,
  .app-grid,
  .section-heading,
  .link-columns,
  .trust-strip {
    grid-template-columns: 1fr;
  }

  .freshness {
    text-align: left;
  }

  .result-panel {
    position: static;
  }

  .process-grid,
  .guide-grid,
  .deduction-list,
  .checklist-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .site-header {
    grid-template-columns: 1fr;
  }

  .site-header .button-small {
    display: none;
  }

  .calculator-shell,
  .content-band {
    padding-inline: 16px;
  }

  .app-grid {
    display: block;
    width: 100%;
    max-width: calc(100vw - 32px);
  }

  .calculator-form,
  .result-panel {
    width: 100%;
    max-width: calc(100vw - 32px);
  }

  .calculator-form {
    padding: 20px;
  }

  .intro-panel h1 {
    font-size: 31px;
    line-height: 1.05;
    max-width: 11.5ch;
    overflow-wrap: anywhere;
  }

  .intro-panel p {
    font-size: 16px;
    max-width: 34ch;
    overflow-wrap: anywhere;
  }

  .field-grid,
  .result-metrics,
  .process-grid,
  .guide-grid,
  .deduction-list,
  .checklist-grid {
    grid-template-columns: 1fr;
  }

  .form-head {
    display: grid;
  }

  .result-topline strong {
    font-size: 44px;
  }

  .deadline-table div {
    grid-template-columns: 1fr;
  }
}

@media print {
  .site-header,
  .site-footer,
  .calculator-form,
  .result-panel > :not(.print-summary),
  .content-band,
  .ad-slot,
  .rate-warning,
  .calculator-error {
    display: none !important;
  }

  .calculator-shell {
    max-width: none;
    padding: 0;
  }

  .app-grid,
  .result-panel {
    display: block;
    border: 0;
    box-shadow: none;
  }

  .intro-panel {
    display: block;
    margin-bottom: 18px;
  }

  .intro-panel h1 {
    font-size: 28px;
    line-height: 1.15;
  }

  .intro-panel p,
  .freshness {
    display: none;
  }

  .print-summary {
    display: block;
    margin: 0;
    white-space: pre-wrap;
    color: #000;
    font: 14px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  }
}
