:root {
  --ink: #10263d;
  --ink-subtle: #516476;
  --paper: #f4f7f8;
  --surface: #ffffff;
  --surface-muted: #eef3f5;
  --line: #cfd9df;
  --line-strong: #9db0ba;
  --accent: #0f766e;
  --accent-dark: #0b5752;
  --accent-soft: #dff3f1;
  --warning: #8a5a17;
  --warning-surface: #fff8ed;
  --danger: #9f342b;
  --danger-surface: #fff1ef;
  --focus: #f4b942;
  --page-max: 1180px;
  --calculator-max: 1120px;
  --control-height: 48px;
  --control-radius: 3px;
  --surface-radius: 4px;
  --field-gap: 1rem;
  --space-1: .35rem;
  --space-2: .65rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2.25rem;
  --space-6: 3.25rem;
  --shadow: 0 18px 50px rgba(20, 46, 67, .1);
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font-sans);
  font-size: 16px;
}

/* Reset and base */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
}
a {
  color: var(--accent-dark);
  text-decoration-thickness: .08em;
  text-underline-offset: .18em;
}
a:hover { color: var(--ink); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.skip-link {
  position: fixed;
  top: .75rem;
  left: .75rem;
  z-index: 100;
  transform: translateY(-160%);
  padding: .65rem .9rem;
  color: white;
  background: var(--ink);
}
.skip-link:focus { transform: translateY(0); }

/* Typography */
h1, h2, h3 {
  margin: 0 0 var(--space-2);
  color: var(--ink);
  line-height: 1.12;
}
h1, h2 {
  font-family: var(--font-serif);
  font-weight: 500;
  letter-spacing: -.035em;
}
h1 { font-size: clamp(2rem, 3.8vw, 3.4rem); }
h2 { font-size: clamp(1.55rem, 2.4vw, 2.25rem); }
h3 { font-size: 1.05rem; letter-spacing: -.01em; }
p { margin: 0 0 var(--space-3); }
.eyebrow {
  color: var(--accent-dark);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.lede {
  max-width: 700px;
  color: var(--ink-subtle);
  font-size: 1.02rem;
}
.help, .field-help, .details-note {
  color: var(--ink-subtle);
  font-size: .79rem;
  line-height: 1.35;
}

/* Layout */
.container {
  width: min(var(--page-max), calc(100% - 2.5rem));
  margin-inline: auto;
}
.page { padding: var(--space-4) 0 var(--space-6); }
.page-head {
  padding: var(--space-4) 0;
  border-top: 1px solid var(--line);
}
.page-head h1 { margin-top: .2rem; }
.intro { border-top: 1px solid var(--line); }
.home-intro { padding: 1.35rem 0 1rem; }
.home-intro h1 {
  max-width: none;
  margin: .15rem 0 .4rem;
  font-size: clamp(1.9rem, 3vw, 2.65rem);
  line-height: 1.05;
}
.home-intro .lede { max-width: 640px; margin-bottom: 0; }
.content { max-width: 820px; }
.content h2 { margin-top: var(--space-5); }
.content h3 { margin-top: var(--space-4); }
.content ul { padding-left: 1.2rem; }
.section { padding: var(--space-5) 0; }
.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.category { margin-top: var(--space-5); }
.category h2 { font-size: 1.65rem; }
.breadcrumbs {
  margin-bottom: var(--space-3);
  color: var(--ink-subtle);
  font-size: .85rem;
}
.breadcrumbs a { color: var(--ink-subtle); }

/* Header and navigation */
.site-header {
  position: relative;
  z-index: 10;
  padding: 1.15rem 0;
  background: var(--paper);
}
.nav-wrap {
  width: min(var(--page-max), calc(100% - 2.5rem));
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -.01em;
  text-decoration: none;
}
.brand-mark {
  display: grid;
  grid-template-columns: repeat(3, 5px);
  gap: 3px;
  padding: 8px;
  border-radius: var(--control-radius);
  background: var(--ink);
}
.brand-mark span {
  width: 5px;
  height: 14px;
  background: white;
}
.brand-mark span:nth-child(2) { height: 9px; align-self: end; }
.brand-mark span:nth-child(3) { height: 5px; align-self: end; }
.nav-links {
  display: flex;
  align-items: center;
  gap: 1.15rem;
}
.nav-links a {
  color: var(--ink-subtle);
  font-size: .88rem;
  text-decoration: none;
}
.nav-links a:hover { color: var(--ink); }
.menu-toggle {
  display: none;
  min-height: 42px;
  padding: .45rem .7rem;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--control-radius);
}

/* Forms */
.calculator-form { width: 100%; }
.form-heading {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.form-heading h2 { margin-bottom: .3rem; }
.form-heading p { margin: 0; color: var(--ink-subtle); font-size: .9rem; }
.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: var(--field-gap) 1.1rem;
}
.field {
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(1.35rem, auto) var(--control-height) minmax(1.08rem, auto);
  gap: .28rem;
}
.field.full, .field-group.full, .button-row.full, .error.full { grid-column: 1 / -1; }
.field-label-row {
  min-width: 0;
  display: flex;
  align-items: end;
}
.field-label-row label {
  color: var(--ink);
  font-size: .86rem;
  font-weight: 750;
  line-height: 1.25;
}
.field-help { min-width: 0; }
.field-help:empty::after { content: "\00a0"; }
.text-button {
  display: inline;
  padding: 0;
  color: var(--accent-dark);
  background: transparent;
  border: 0;
  border-bottom: 1px solid currentColor;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}
.text-button:hover { color: var(--accent); }
.field-control {
  min-width: 0;
  min-height: var(--control-height);
}
.field-control--input {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: stretch;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--control-radius);
}
.field-control--input:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, .12);
}
.field-control input {
  min-width: 0;
  width: 100%;
  height: calc(var(--control-height) - 2px);
  padding: .65rem .25rem;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font-variant-numeric: tabular-nums;
}
.field-control input[type="date"] { padding-right: .65rem; }
.field-control select {
  min-width: 0;
  width: 100%;
  height: var(--control-height);
  padding: .6rem .75rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--control-radius);
}
.control-adornment {
  display: flex;
  align-items: center;
  color: var(--ink-subtle);
  font-size: .85rem;
  line-height: 1;
  white-space: nowrap;
}
.control-adornment:empty { display: none; }
.control-prefix { padding-left: .75rem; padding-right: .2rem; }
.control-suffix { padding-right: .75rem; padding-left: .35rem; }
.field-group {
  min-width: 0;
  margin: .1rem 0 0;
  padding: .9rem 0 .05rem;
  border: 0;
  border-top: 1px solid var(--line);
}
.field-group legend {
  padding: 0 .5rem 0 0;
  color: var(--ink);
  font-size: .88rem;
  font-weight: 800;
}
.advanced {
  margin-top: var(--space-3);
  border-top: 1px solid var(--line);
}
.advanced + .advanced { margin-top: 0; }
.advanced:last-of-type { border-bottom: 1px solid var(--line); }
.advanced summary {
  padding: .8rem 0;
  color: var(--accent-dark);
  font-weight: 750;
  cursor: pointer;
}
.advanced-body { padding: .15rem 0 var(--space-3); }
.details-note { margin-bottom: var(--space-3); }
.home-extra-note { margin-top: var(--space-3); }
.more-options { grid-column: 1 / -1; }
.additional-one-times { margin-top: var(--space-3); border-top: 1px solid var(--line); }
.additional-one-times summary { padding: .7rem 0; color: var(--accent-dark); font-weight: 750; cursor: pointer; }
.one-time-payment-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--field-gap) 1.1rem; margin-bottom: var(--space-2); }
.checkbox-field { min-height: var(--control-height); display: flex; align-items: center; gap: .65rem; padding: .65rem .75rem; border: 1px solid var(--line-strong); border-radius: var(--control-radius); background: var(--surface); color: var(--ink); font-size: .86rem; }
.checkbox-field input { width: 1rem; height: 1rem; margin: 0; accent-color: var(--accent); }
.checkbox-field span { display: grid; gap: .1rem; }
.checkbox-field small { color: var(--ink-subtle); line-height: 1.25; }
.biweekly-summary { margin: var(--space-3) 0; padding-top: var(--space-3); border-top: 1px solid var(--line); }
.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem;
  margin-top: var(--space-3);
}
.button {
  min-height: var(--control-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .65rem .95rem;
  color: white;
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: var(--control-radius);
  font-weight: 750;
  text-decoration: none;
}
.button:hover { color: white; background: #193b5d; }
.button.secondary {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line-strong);
}
.button.secondary:hover { color: var(--ink); background: var(--surface-muted); }
.button.ghost {
  color: var(--ink-subtle);
  background: transparent;
  border-color: transparent;
  font-weight: 650;
}
.button.ghost:hover { color: var(--ink); background: var(--surface-muted); }
.text-button {
  padding: .25rem 0;
  color: var(--accent-dark);
  background: transparent;
  border: 0;
  text-decoration: underline;
}
.error {
  margin-top: .25rem;
  padding: .7rem .8rem;
  color: var(--danger);
  background: var(--danger-surface);
  border: 1px solid #f1c1bb;
  border-radius: var(--control-radius);
}

/* Calculator workspace */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--surface-radius);
}
.workspace, .calculator-layout {
  width: min(100%, var(--calculator-max));
  margin: .6rem auto 0;
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(360px, .96fr);
  align-items: start;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--surface-radius);
  box-shadow: var(--shadow);
}
.calculator-layout { width: 100%; margin-top: 0; box-shadow: none; }
.calculator-panel, .panel { min-width: 0; padding: clamp(1.35rem, 2.5vw, 2.25rem); }
.calculator-panel, .input-panel { border-right: 1px solid var(--line); }
.calculator-layout > .panel { border: 0; border-radius: 0; }
.panel-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.panel-header h2 { font-size: 1.55rem; }
.panel-header p { margin: 0; }
.result-panel {
  min-width: 0;
  padding: clamp(1.35rem, 2.5vw, 2.25rem);
  color: white;
  background: var(--ink);
}
.result-kicker {
  margin: 0 0 var(--space-3);
  color: #b9cad8;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.calculator-education { margin-top: var(--space-6); }

/* Results */
.result-hero {
  margin-bottom: var(--space-4);
  padding: 1.1rem;
  color: var(--ink);
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
}
.result-panel .result-hero {
  padding: 0 0 var(--space-4);
  color: white;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #426078;
  border-radius: 0;
}
.result-hero .label {
  display: block;
  color: var(--ink-subtle);
  font-size: .82rem;
  font-weight: 700;
}
.result-panel .result-hero .label { color: #b9cad8; }
.result-hero .big-number {
  margin: .3rem 0 .45rem;
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.05em;
  line-height: 1;
}
.result-panel .result-hero .big-number { color: white; }
.result-hero p {
  margin: 0;
  color: var(--ink-subtle);
  font-size: .9rem;
}
.result-panel .result-hero p { color: #cbd9e2; }
.breakdown { width: 100%; margin-top: var(--space-4); }
.breakdown h3 { margin-bottom: .4rem; }
.result-panel .breakdown h3 { color: white; }
.result-rows, .summary-list { width: 100%; }
.result-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: baseline;
  gap: var(--space-3);
  padding: .55rem 0;
  border-bottom: 1px solid var(--line);
  font-size: .91rem;
}
.result-label { min-width: 0; }
.result-value {
  min-width: max-content;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.result-row--subdued { color: var(--ink-subtle); }
.result-row--total {
  margin-top: .25rem;
  padding-top: .8rem;
  border-top: 1px solid var(--line-strong);
  border-bottom: 0;
  font-weight: 800;
}
.result-panel .result-row { color: #d8e3eb; border-bottom-color: #324e66; }
.result-panel .result-value { color: white; }
.result-panel .result-row--total { border-top-color: #7890a3; }
.bar {
  width: 100%;
  height: .42rem;
  display: flex;
  overflow: hidden;
  margin-top: .8rem;
  background: #e1e9ed;
  border-radius: 99px;
}
.bar-segment { width: var(--segment-width); height: 100%; }
.bar-principal { background: var(--accent); }
.bar-tax { background: #64a6b5; }
.bar-insurance { background: #cf933a; }
.bar-pmi { background: #9a68b8; }
.bar-hoa { background: #78909c; }
.bar-extra { background: #3b8f67; }
.summary-list {
  margin-top: var(--space-4);
  border-top: 1px solid var(--line);
}
.result-panel .summary-list { border-top-color: #426078; }
.loan-summary { margin-top: var(--space-4); }
.compact-note {
  display: grid;
  gap: .15rem;
  margin-top: var(--space-4);
  padding: .85rem 0;
  color: #d4e0e8;
  border-top: 1px solid #426078;
  font-size: .86rem;
}
.compact-note span { color: #b8cad6; }
.compact-actions { margin-top: var(--space-4); }
.result-panel .compact-actions .button.secondary {
  color: white;
  background: transparent;
  border-color: #7890a3;
}
.result-panel .compact-actions .button.secondary:hover { background: #193b5d; }
.assumptions {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  color: var(--ink-subtle);
  border-top: 1px solid var(--line);
  font-size: .84rem;
}
.calculation-details {
  margin-top: var(--space-4);
  padding-top: .7rem;
  border-top: 1px solid var(--line);
}
.calculation-details summary {
  color: var(--accent-dark);
  font-weight: 750;
  cursor: pointer;
}
.loan-totals { margin-bottom: var(--space-4); }
.notice {
  margin-top: var(--space-3);
  padding: .8rem .95rem;
  color: var(--warning);
  background: var(--warning-surface);
  border-left: 4px solid #cf933a;
  border-radius: var(--control-radius);
  font-size: .86rem;
}
.benchmark-status {
  margin: var(--space-4) 0;
  padding: var(--space-4);
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
}
.benchmark-status .table-wrap { margin-top: var(--space-2); }
.benchmark-status table { min-width: 0; }
.benchmark-status .help { margin: var(--space-2) 0 0; }
.benchmark-label {
  margin: 0;
  color: var(--accent-dark);
  font-size: .84rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

/* Tables */
.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  margin-top: var(--space-3);
  border-block: 1px solid var(--line);
}
table {
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
  font-size: .83rem;
  font-variant-numeric: tabular-nums;
}
th, td {
  padding: .65rem .7rem;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
th:first-child, td:first-child { text-align: left; }
th {
  color: var(--ink-subtle);
  background: var(--surface-muted);
  font-size: .72rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
tr:last-child td { border-bottom: 0; }
.table-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem;
  margin-top: var(--space-3);
}
.table-controls label { font-size: .82rem; font-weight: 750; }
.table-controls select {
  width: auto;
  height: var(--control-height);
  padding: .6rem .75rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--control-radius);
}

/* Cards and content */
.link-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .8rem;
}
.tool-card {
  min-width: 0;
  padding: var(--space-3);
  color: var(--ink);
  text-decoration: none;
}
.tool-card:hover { border-color: var(--accent); }
.tool-card h3 { margin-bottom: .35rem; }
.tool-card p {
  margin-bottom: .65rem;
  color: var(--ink-subtle);
  font-size: .86rem;
}
.tool-card span {
  color: var(--accent-dark);
  font-size: .86rem;
  font-weight: 750;
}
.small-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
}
.faq {
  padding: .8rem 0;
  border-top: 1px solid var(--line);
}
.faq summary { font-weight: 750; cursor: pointer; }

/* Footer */
.footer {
  width: min(var(--page-max), calc(100% - 2.5rem));
  margin: var(--space-5) auto 0;
  padding: var(--space-4) 0 var(--space-6);
  color: var(--ink-subtle);
  border-top: 1px solid var(--line);
}
.footer-grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: var(--space-5);
}
.footer h3 { font-size: .95rem; }
.footer p, .footer a { font-size: .85rem; }
.footer a {
  display: block;
  margin: .35rem 0;
  color: var(--ink-subtle);
}
.footer-note {
  width: 100%;
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  color: var(--ink-subtle);
  border-top: 1px solid var(--line);
  font-size: .78rem;
}
.print-only { display: none; }

/* Responsive */
@media (min-width: 901px) {
  .home-intro h1 { white-space: nowrap; }
}

@media (max-width: 900px) {
  .workspace, .calculator-layout { grid-template-columns: minmax(0, 1fr); }
  .calculator-panel, .input-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .link-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .container, .nav-wrap, .footer { width: min(100% - 1rem, var(--page-max)); }
  .site-header { padding: .75rem 0; }
  .menu-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 4rem;
    right: .5rem;
    left: .5rem;
    flex-direction: column;
    align-items: stretch;
    gap: .15rem;
    padding: .75rem;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: .55rem; }
  .page { padding-top: .8rem; }
  .home-intro { padding-top: 1rem; }
  .home-intro h1 { font-size: clamp(1.8rem, 8vw, 2.25rem); }
  .page-head { padding: 1rem 0 1.25rem; }
  .field-grid, .link-grid, .small-grid, .footer-grid { grid-template-columns: minmax(0, 1fr); }
  .one-time-payment-row { grid-template-columns: minmax(0, 1fr); }
  .field.full, .field-group.full, .button-row.full, .error.full { grid-column: auto; }
  .field { grid-template-rows: auto var(--control-height) auto; }
  .field-help:empty::after { content: none; }
  .field-help:empty { min-height: 0; }
  .calculator-panel, .panel, .result-panel { padding: 1.1rem; }
  .section { padding: 1.8rem 0; }
  .section-head { align-items: start; flex-direction: column; }
  .result-hero .big-number { font-size: clamp(2.15rem, 12vw, 3rem); }
  .result-row { gap: .7rem; font-size: .87rem; }
  .result-label { overflow-wrap: anywhere; }
  .result-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .result-value { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
  .button-row { align-items: stretch; }
  .button-row .button { flex: 1 1 12rem; }
  .table-controls { align-items: stretch; }
  .table-controls select, .table-controls .button { flex: 1 1 100%; width: 100%; }
}

/* Print */
@media print {
  .site-header, .footer, .button-row, .menu-toggle, .no-print, .breadcrumbs, .skip-link, .calculator-education { display: none !important; }
  html, body, .page, .calculator-layout, .results-panel, .table-wrap { background: white !important; }
  body { min-width: 0; }
  .container { width: 100%; }
  .page { padding: 0; }
  .calculator-layout, .workspace {
    display: block;
    width: 100%;
    border: 0;
    box-shadow: none;
  }
  .input-panel { display: none; }
  .panel, .result-panel { padding: 0; border: 0; }
  .result-hero { color: black; background: white; border: 1px solid #bbb; }
  .result-hero .big-number, .result-hero .label, .result-hero p { color: black; }
  .table-wrap { overflow: visible; }
  table { min-width: 0; font-size: 9pt; }
  .print-only { display: block; }
}
