:root {
  color-scheme: light;
  --bg: #f7f8f4;
  --panel: #ffffff;
  --ink: #17211f;
  --muted: #5f6b66;
  --line: #d9dfd9;
  --green: #0c5a46;
  --green-2: #13725c;
  --blue: #235f9c;
  --amber: #a05f0f;
  --soft-green: #e7f1ec;
  --soft-blue: #e7eef7;
  --soft-amber: #f7eddf;
  --shadow: 0 16px 48px rgba(23, 33, 31, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  align-items: center;
  background: rgba(247, 248, 244, 0.94);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: space-between;
  left: 0;
  padding: 16px clamp(18px, 5vw, 64px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  align-items: center;
  display: inline-flex;
  flex: 0 0 auto;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  align-items: center;
  background: var(--green);
  border-radius: 8px;
  color: #fff;
  display: inline-flex;
  font-weight: 800;
  height: 38px;
  justify-content: center;
  width: 38px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 17px;
  line-height: 1.1;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.nav {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.nav a {
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  padding: 10px 12px;
  text-decoration: none;
}

.nav a:hover {
  background: var(--soft-green);
  color: var(--green);
}

main {
  margin: 0 auto;
  max-width: 1240px;
  padding: 34px clamp(18px, 5vw, 64px) 64px;
}

.calculator-hero {
  align-items: stretch;
  display: grid;
  gap: 28px;
  grid-template-columns: minmax(280px, 0.82fr) minmax(560px, 1.18fr);
  min-height: calc(100vh - 108px);
}

.hero-copy {
  align-content: center;
  display: grid;
  padding: 24px 0;
}

.eyebrow {
  color: var(--green-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 12px;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(36px, 5vw, 68px);
  letter-spacing: 0;
  line-height: 1.02;
  margin-bottom: 18px;
}

.hero-lede {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.65;
  max-width: 620px;
}

.metric-strip {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 26px;
}

.metric-strip span {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  display: grid;
  gap: 4px;
  min-height: 84px;
  padding: 16px;
}

.metric-strip strong {
  color: var(--ink);
  font-size: 20px;
}

.workbench {
  align-self: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.tabs {
  background: #eef2ec;
  border-radius: 8px;
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 4px;
}

.tabs button {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
  min-height: 42px;
  padding: 8px;
}

.tabs button.active {
  background: var(--green);
  color: #fff;
}

.calculator-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.05fr) minmax(260px, 0.95fr);
  margin-top: 18px;
}

.calculator-panel {
  display: none;
}

.calculator-panel.active {
  display: block;
}

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

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

.form-details summary {
  color: var(--green);
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
  margin-bottom: 16px;
}

.field-grid label small,
.checkbox-field small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  text-transform: none;
}

.checkbox-field {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: auto 1fr;
  min-height: 70px;
  padding: 12px;
}

.state-only[hidden] {
  display: none;
}

.checkbox-field input {
  min-height: 20px;
  width: 20px;
}

.checkbox-field span {
  display: grid;
  gap: 4px;
}

label,
.compact-select {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 800;
  gap: 7px;
  text-transform: uppercase;
}

input,
select {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 46px;
  outline: none;
  padding: 10px 12px;
  width: 100%;
}

input:focus,
select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(12, 90, 70, 0.14);
}

.result-card {
  background: #17211f;
  border-radius: 8px;
  color: #fff;
  display: grid;
  min-height: 326px;
  padding: 22px;
}

.result-label {
  color: #a8bbb3;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.result-primary {
  font-size: clamp(34px, 4vw, 54px);
  line-height: 1;
}

.result-note {
  color: #d8e2dd;
  line-height: 1.5;
  margin-top: 10px;
}

.result-list {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  display: grid;
  gap: 10px;
  margin: 20px 0 0;
  padding-top: 18px;
}

.result-list div {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.result-list dt {
  color: #a8bbb3;
}

.result-list dd {
  font-weight: 800;
  margin: 0;
  text-align: right;
}

.share-row {
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-top: 18px;
  padding-top: 18px;
}

.share-button {
  background: #fff;
  border: 0;
  border-radius: 8px;
  color: var(--green);
  cursor: pointer;
  font-size: 14px;
  font-weight: 900;
  min-height: 40px;
  padding: 10px 14px;
}

.share-button:hover {
  background: var(--soft-green);
}

.share-status {
  color: #a8bbb3;
  font-size: 13px;
  font-weight: 800;
  text-align: right;
}

.page-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.page-share-button {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--green);
  cursor: pointer;
  font-size: 14px;
  font-weight: 900;
  min-height: 40px;
  padding: 10px 14px;
}

.page-share-button:hover {
  background: var(--soft-green);
}

.page-share-status {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.section-head {
  align-items: end;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.section-head h2 {
  font-size: 32px;
  line-height: 1.15;
  margin: 0;
}

.compact-select {
  max-width: 240px;
  min-width: 220px;
}

.state-section,
.guides-section,
.strategy-section,
.sources-section {
  margin-top: 70px;
}

.state-layout {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(280px, 0.75fr) minmax(0, 1.25fr);
}

.state-detail,
.state-table-wrap,
.guides-section article,
.milestone-grid article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.state-detail {
  padding: 24px;
}

.state-code {
  align-items: center;
  background: var(--soft-blue);
  border-radius: 8px;
  color: var(--blue);
  display: inline-flex;
  font-weight: 900;
  height: 44px;
  justify-content: center;
  margin-bottom: 16px;
  width: 54px;
}

.state-detail h3 {
  font-size: 30px;
  margin-bottom: 20px;
}

.state-detail dl {
  display: grid;
  gap: 16px;
  margin: 0;
}

.state-detail dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.state-detail dd {
  line-height: 1.55;
  margin: 4px 0 0;
}

.state-table-wrap {
  overflow: auto;
}

table {
  border-collapse: collapse;
  min-width: 680px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 15px 16px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

td strong {
  display: block;
}

td span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  margin-top: 3px;
}

.state-link {
  color: var(--green);
  font-weight: 900;
  text-decoration: none;
}

.state-link:hover {
  text-decoration: underline;
}

tr[data-active] {
  background: var(--soft-green);
}

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

.guides-section article {
  padding: 22px;
}

.guides-section article span {
  color: var(--amber);
  font-weight: 900;
}

.guides-section h3 {
  font-size: 20px;
  margin: 10px 0 8px;
}

.guides-section h3 a {
  text-decoration: none;
}

.guides-section h3 a:hover {
  color: var(--green);
}

.guides-section p {
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}

.strategy-section {
  background: var(--green);
  border-radius: 8px;
  color: #fff;
  display: grid;
  gap: 24px;
  grid-template-columns: 0.9fr 1.1fr;
  padding: 32px;
}

.strategy-section .eyebrow {
  color: #cfe2d9;
}

.strategy-section h2 {
  font-size: 32px;
  line-height: 1.18;
  margin: 0;
}

.milestone-grid {
  display: grid;
  gap: 12px;
}

.milestone-grid article {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
  display: grid;
  gap: 6px;
  padding: 16px;
}

.milestone-grid span {
  color: #e0ebe6;
  line-height: 1.5;
}

.source-list {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.source-list a,
.state-page-grid a {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--green);
  font-weight: 800;
  line-height: 1.4;
  min-height: 110px;
  padding: 16px;
  text-decoration: none;
}

.source-list a:hover,
.state-page-grid a:hover {
  border-color: var(--green);
}

.state-page-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.link-group-title {
  font-size: 18px;
  margin: 26px 0 12px;
}

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

.calculator-route {
  display: grid;
  gap: 28px;
  grid-template-columns: minmax(260px, 0.62fr) minmax(560px, 1.38fr);
  margin-top: 34px;
}

.route-copy {
  align-self: start;
  position: sticky;
  top: 104px;
}

.route-copy h1,
.trust-page h1 {
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.08;
  margin-bottom: 16px;
}

.route-copy p,
.trust-page p {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.disclaimer-note {
  background: var(--soft-amber);
  border: 1px solid #ebd2ae;
  border-radius: 8px;
  color: #6f4718;
  padding: 14px;
}

.trust-page {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 34px;
  max-width: 920px;
  padding: clamp(24px, 5vw, 48px);
}

.final-pay-page {
  max-width: 1100px;
}

.hub-page {
  background: transparent;
  border: 0;
  max-width: 1160px;
  padding-left: 0;
  padding-right: 0;
}

.hub-page > h2 {
  margin: 34px 0 14px;
}

.hub-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 24px;
}

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

.hub-grid h3 {
  margin-bottom: 10px;
}

.hub-grid h3 a {
  color: var(--green);
  text-decoration: none;
}

.hub-grid h3 a:hover {
  text-decoration: underline;
}

.mini-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.mini-link-row a {
  background: var(--soft-green);
  border-radius: 8px;
  color: var(--green);
  font-size: 13px;
  font-weight: 900;
  padding: 8px 10px;
  text-decoration: none;
}

.federal-guide {
  max-width: 1120px;
}

.deadline-table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 24px 0;
  overflow: auto;
}

.deadline-table {
  background: #fff;
  min-width: 720px;
}

.deadline-table th {
  background: #eef2ec;
  color: var(--green);
}

.deadline-table td:nth-child(2) {
  color: var(--ink);
  font-weight: 900;
  white-space: nowrap;
}

.trust-source-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 24px;
}

.state-guide {
  margin-top: 44px;
}

.section-intro {
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: 20px;
  max-width: 880px;
}

.fact-grid,
.copy-columns {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.fact-grid article,
.copy-columns article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}

.fact-grid span {
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.fact-grid strong {
  display: block;
  font-size: 24px;
  margin: 8px 0 10px;
}

.fact-grid p,
.copy-columns p,
.source-note {
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 0;
}

.source-note {
  margin-top: 18px;
}

.source-note a {
  color: var(--green);
  font-weight: 800;
}

.footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 28px clamp(18px, 5vw, 64px);
}

.footer p {
  line-height: 1.55;
  margin: 0;
  max-width: 640px;
}

@media (max-width: 980px) {
  .calculator-hero,
  .calculator-grid,
  .state-layout,
  .strategy-section,
  .calculator-route {
    grid-template-columns: 1fr;
  }

  .route-copy {
    position: static;
  }

  .calculator-hero {
    min-height: auto;
  }

  .source-list,
  .guide-grid,
  .state-page-grid,
  .hub-grid,
  .fact-grid,
  .copy-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .topbar {
    align-items: flex-start;
    gap: 10px;
  }

  .nav {
    flex: 1 1 100%;
    justify-content: flex-start;
    overflow-x: visible;
    width: 100%;
  }

  .nav a {
    font-size: 13px;
    padding: 8px 10px;
    white-space: normal;
  }

  main {
    padding-top: 22px;
  }

  h1 {
    font-size: 38px;
  }

  .metric-strip,
  .field-grid,
  .guide-grid,
  .source-list,
  .state-page-grid,
  .hub-grid,
  .fact-grid,
  .copy-columns {
    grid-template-columns: 1fr;
  }

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

  .section-head {
    align-items: stretch;
    display: grid;
  }

  .compact-select {
    max-width: none;
    min-width: 0;
  }

  .result-card {
    min-height: 280px;
  }

  .share-row {
    align-items: stretch;
    display: grid;
  }

  .share-status {
    text-align: left;
  }

  .strategy-section {
    padding: 24px;
  }

  .trust-source-list {
    grid-template-columns: 1fr;
  }

  .footer {
    display: grid;
  }
}
