/* ═══════════════════════════════════════════════════════════════
   Triangle Mortgage — Rate Calculator
   Brand palette pulled from trianglemortgage.com:
     slate blue #3F6C8C · navy #34394D · body gray #5C5E66
     font: Josefin Sans
   ═══════════════════════════════════════════════════════════════ */

:root {
  --brand:        #3f6c8c;
  --brand-hover:  #335a76;
  --brand-dark:   #34394d;
  --ink:          #5c5e66;
  --line:         #d5dbe1;
  --page-bg:      #eef1f4;
  --card-bg:      #ffffff;
  --credit:       #1a7f4b;
  --cost:         #b4521f;
  --danger:       #c0392b;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Josefin Sans", -apple-system, "Segoe UI", sans-serif;
  background: var(--page-bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--brand); }

/* ── Site header ─────────────────────────────────────────── */
.site-header { background: #fff; box-shadow: 0 1px 8px rgba(0,0,0,.06); }

.header-top {
  max-width: 1180px;
  margin: 0 auto;
  padding: .9rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand img { height: 62px; width: auto; display: block; }

.header-phone {
  color: var(--brand);
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  white-space: nowrap;
}
.header-phone:hover { color: var(--brand-hover); }

/* ── Navigation bar ──────────────────────────────────────── */
.site-nav {
  background: var(--brand);
  padding: 0 1.25rem;
}

/* Same centered column as .header-top, so the links line up with the logo
   above instead of spanning the full-width colored bar. */
.nav-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.nav-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.nav-links > li { position: relative; }

.nav-links > li > a {
  display: block;
  padding: .95rem 1rem;
  color: #fff;
  text-decoration: none;
  font-size: .98rem;
  font-weight: 500;
  transition: background .15s;
  white-space: nowrap;
}
.nav-links > li > a:hover { background: rgba(255,255,255,.14); }

/* Resources dropdown */
.submenu {
  list-style: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(0,0,0,.16);
  border-radius: 0 0 6px 6px;
  padding: .3rem 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity .15s, transform .15s;
  z-index: 40;
}
.has-sub:hover .submenu { opacity: 1; visibility: visible; transform: translateY(0); }
.submenu a {
  display: block;
  padding: .55rem 1.1rem;
  color: var(--brand-dark);
  text-decoration: none;
  font-size: .92rem;
}
.submenu a:hover { background: #f0f4f8; color: var(--brand); }

.nav-cta {
  align-self: center;
  margin: .35rem 0;
  padding: .5rem 1.4rem;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: .9rem;
  letter-spacing: .03em;
  transition: background .15s, color .15s;
}
.nav-cta:hover { background: #fff; color: var(--brand); }

/* ── Page body ───────────────────────────────────────────── */
.page-main {
  flex: 1;
  width: 100%;
  padding: 2rem 1rem 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.card {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 2px 16px rgba(0,0,0,.09);
  padding: 2rem;
  width: 100%;
  /* Two-column form needs more room than the old single stack. */
  max-width: 780px;
  border-top: 4px solid var(--brand);
}

/* Two-up form layout; collapses to a single column on narrow screens. */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 1.1rem;
}
.form-grid > .span-2 { grid-column: 1 / -1; }
@media (max-width: 620px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* Escrow waiver checkbox on the form */
.escrow-waiver {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .45rem .75rem;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-size: .84rem;
  font-weight: 600;
  color: var(--brand-dark);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .15s, background .15s;
}
.escrow-waiver:hover { border-color: var(--brand); }
.escrow-waiver input { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }
.escrow-waiver:has(input:checked) { border-color: var(--brand); background: #eef4f9; }
.escrow-waiver.disabled { opacity: .5; cursor: not-allowed; background: #f2f5f8; }
.escrow-waiver.disabled:hover { border-color: var(--line); }
.escrow-waiver.disabled input { cursor: not-allowed; }

h1 {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--brand-dark);
  margin-bottom: 1.5rem;
}

/* Hero headline + subhead at the top of the form card */
.hero-headline {
  font-size: 1.75rem;
  line-height: 1.2;
  margin-bottom: .4rem;
  text-align: center;
}
.hero-subhead {
  font-size: .95rem;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 1.6rem;
  text-align: center;
}
@media (max-width: 560px) {
  .hero-headline { font-size: 1.5rem; }
}

/* Purpose toggle */
.purpose-toggle { border: none; margin-bottom: 1.25rem; }
.purpose-toggle legend {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #8a92a0;
  margin-bottom: .5rem;
}
.purpose-toggle .toggle-btn { display: inline-block; cursor: pointer; }
.purpose-toggle input[type="radio"] { display: none; }

/* Scope the boxed-button style to toggle labels only, so it never boxes the
   required-mark asterisk in the legend. */
.purpose-toggle .toggle-btn span {
  display: inline-block;
  padding: .5rem 1.35rem;
  border: 2px solid var(--line);
  font-size: .95rem;
  font-weight: 600;
  color: var(--ink);
  transition: all .15s;
}
.purpose-toggle .toggle-btn:first-of-type span { border-radius: 6px 0 0 6px; }
.purpose-toggle .toggle-btn:last-of-type  span { border-radius: 0 6px 6px 0; border-left: none; }
.purpose-toggle input[type="radio"]:checked + span {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

/* Field groups */
.field-group { margin-bottom: 1.1rem; }
.field-group label {
  display: block;
  font-size: .84rem;
  font-weight: 600;
  color: var(--brand-dark);
  margin-bottom: .35rem;
}
.required-mark { color: var(--danger); margin-left: .15rem; }

.field-group select,
.field-group input[type="text"],
.field-group input[type="tel"],
.field-group input[type="email"],
.field-group input[type="date"],
.field-group input[type="number"] {
  width: 100%;
  padding: .58rem .75rem;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  font-size: .95rem;
  font-family: inherit;
  color: #1c2430;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
/* The native date control carries extra intrinsic height from its picker UI;
   trim the padding so it lines up with the other boxes on the row. */
.field-group input[type="date"] {
  padding-top: calc(.58rem - 2px);
  padding-bottom: calc(.58rem - 2px);
}

/* Selects sit a couple of pixels taller than inputs by default. Pin every
   control to one height so the two-column grid lines up across a row.
   Direct children only — an input inside .input-prefix must stay unconstrained
   or its height stacks with the wrapper's border. */
.field-group > select,
.field-group > input[type="text"],
.field-group > input[type="tel"],
.field-group > input[type="email"],
.field-group > input[type="date"],
.field-group > input[type="number"],
.field-group > .input-prefix,
.field-group .dp-pair .input-prefix { min-height: 38px; }

.field-group select:focus,
.field-group input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(63,108,140,.15);
}

/* Down payment: dollars on the left, percent on the right, each driving the
   other. The percent box is narrow — it only ever holds a few characters. */
.dp-pair { display: flex; gap: .5rem; }
.dp-pair .dp-amt { flex: 1 1 auto; min-width: 0; }
.dp-pair .dp-pct { flex: 0 0 5.5rem; }
/* Suffix rather than prefix: the symbol trails the number on this one. */
.dp-pct span { border-right: none; border-left: 1.5px solid var(--line); }
.dp-pct input { text-align: right; }

/* Modal ------------------------------------------------------------------ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(52,57,77,.55);
}
.modal-card {
  background: #fff;
  border-radius: 12px;
  border-top: 4px solid var(--brand);
  box-shadow: 0 12px 40px rgba(0,0,0,.28);
  padding: 1.75rem;
  max-width: 460px;
  width: 100%;
  text-align: center;
  animation: rise .25s ease;
}
.modal-card h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--brand-dark);
  margin-bottom: .6rem;
}
.modal-card p { font-size: .92rem; line-height: 1.5; margin-bottom: .8rem; }
.modal-actions {
  display: flex;
  justify-content: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin-top: 1.1rem;
}
@media (max-width: 480px) {
  .modal-actions { flex-direction: column; }
  .modal-actions .apply-btn, .modal-actions .contact-btn { width: 100%; }
}

/* $ / % prefix */
.input-prefix {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.input-prefix:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(63,108,140,.15); }
.input-prefix span {
  padding: .58rem .7rem;
  background: #f2f5f8;
  color: #5b6472;
  font-size: .95rem;
  border-right: 1.5px solid var(--line);
  white-space: nowrap;
}
.input-prefix input {
  flex: 1;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  /* The wrapper draws the border, so the inner padding is 1px lighter to keep
     these the same height as the unwrapped fields. */
  padding: calc(.58rem - 1px) .75rem;
  min-height: 0;
}
.input-prefix input:focus { outline: none; }

/* Inline checkbox */
.inline-check {
  display: flex !important;
  align-items: center;
  gap: .5rem;
  font-size: .9rem !important;
  font-weight: 500 !important;
  color: var(--brand-dark);
  cursor: pointer;
  margin-bottom: .35rem;
}
.inline-check input[type="checkbox"],
.inline-check input[type="radio"] {
  width: 16px; height: 16px;
  accent-color: var(--brand);
  cursor: pointer;
  flex-shrink: 0;
}

/* Sub-fields */
.sub-field {
  margin-top: .75rem;
  padding: .9rem;
  background: #f5f8fa;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.sub-field label { font-size: .84rem; font-weight: 600; color: var(--brand-dark); margin-bottom: 0; }

/* Submit button */
button[type="submit"] {
  width: 100%;
  margin-top: .75rem;
  padding: .8rem;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: .02em;
  cursor: pointer;
  transition: background .15s;
}
button[type="submit"]:hover:not(:disabled) { background: var(--brand-hover); }
button[type="submit"]:disabled { opacity: .6; cursor: not-allowed; }

/* Consent / privacy note under the submit button */
.consent-note {
  margin-top: .8rem;
  font-size: .78rem;
  line-height: 1.45;
  color: #8a92a0;
  text-align: center;
}
.consent-note a { color: var(--brand); text-decoration: underline; }

/* Status + error */
#resultsArea { margin-top: 1.5rem; border-top: 1.5px solid #eef0f4; padding-top: 1.25rem; }
.success-banner {
  padding: .9rem 1rem;
  background: #f0faf4;
  border: 1.5px solid #6fcf97;
  border-radius: 8px;
  color: #1a6b3c;
  font-size: .95rem;
  font-weight: 500;
}
.error {
  margin-top: 1rem;
  padding: .75rem 1rem;
  background: #fff0f0;
  border: 1.5px solid #ffb3b3;
  border-radius: 6px;
  color: var(--danger);
  font-size: .9rem;
}
/* Informational variant — used when inputs simply don't match a product
   (not a real error), so it shouldn't look alarming. */
.error.info {
  background: #eef4f9;
  border-color: #bcd6ea;
  color: #2c5f80;
  line-height: 1.5;
}
.error.info a { color: var(--brand); font-weight: 600; }

.hidden { display: none !important; }

/* ── Rate options card ───────────────────────────────────── */
.rates-card {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 2px 16px rgba(0,0,0,.09);
  padding: 1.75rem;
  width: 100%;
  /* Wide enough that the compare and costs columns don't force the table into
     horizontal scrolling on desktop. */
  max-width: 1180px;
  border-top: 4px solid var(--brand);
  animation: rise .35s ease;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.rates-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}
.rates-header h2 { font-size: 1.25rem; font-weight: 700; color: var(--brand-dark); }
.rates-subtitle { font-size: .88rem; color: #5b6472; margin-top: .15rem; }
.rates-generated { font-size: .74rem; color: #98a0ad; white-space: nowrap; padding-top: .3rem; }

.compliance-notice {
  margin-bottom: 1.1rem;
  padding: .7rem 1rem;
  background: #fff8e6;
  border: 1.5px solid #f0d792;
  border-left: 4px solid #c99a1f;
  border-radius: 6px;
  color: #7a5c0a;
  font-size: .82rem;
  font-weight: 600;
  line-height: 1.4;
}

/* The table scrolls sideways when it can't fit. Nothing signalled that, so
   there's a persistent scrollbar plus a fading arrow at the right edge that
   clears once you've reached the end. */
.scroll-shell { position: relative; }
/* No fade over the right edge: a column cut in half is the clearest signal
   that the table slides, and people act on it without being told. */
.rates-table-wrap,
.compare-grid-wrap {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--brand) #e4e9ee;
}
/* Force the bar to show rather than overlay-fade, on the engines that allow it */
.rates-table-wrap::-webkit-scrollbar,
.compare-grid-wrap::-webkit-scrollbar { height: 9px; }
.rates-table-wrap::-webkit-scrollbar-track,
.compare-grid-wrap::-webkit-scrollbar-track { background: #e4e9ee; border-radius: 999px; }
.rates-table-wrap::-webkit-scrollbar-thumb,
.compare-grid-wrap::-webkit-scrollbar-thumb {
  background: var(--brand);
  border-radius: 999px;
}
.rates-table-wrap::-webkit-scrollbar-thumb:hover,
.compare-grid-wrap::-webkit-scrollbar-thumb:hover { background: var(--brand-hover); }

.scroll-cue {
  position: absolute;
  top: 0;
  bottom: 12px;                 /* clear of the scrollbar */
  width: 62px;
  display: none;                /* only when there's more that way */
  align-items: center;
  pointer-events: none;
}
.scroll-cue-right {
  right: 0;
  justify-content: flex-end;
  padding-right: .35rem;
  background: linear-gradient(to right, rgba(255,255,255,0), rgba(255,255,255,.96) 62%);
  border-radius: 0 8px 8px 0;
}
.scroll-cue-left {
  left: 0;
  justify-content: flex-start;
  padding-left: .35rem;
  background: linear-gradient(to left, rgba(255,255,255,0), rgba(255,255,255,.96) 62%);
  border-radius: 8px 0 0 8px;
}
/* Each side shows only while there's actually content that way. */
.scroll-shell.can-scroll:not(.at-end)   .scroll-cue-right { display: flex; }
.scroll-shell.can-scroll:not(.at-start) .scroll-cue-left  { display: flex; }

.scroll-cue-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  padding-bottom: .15rem;
  box-shadow: 0 1px 6px rgba(52,57,77,.3);
  animation: nudge-right 1.4s ease-in-out infinite;
  /* The gradient stays click-through so it can't block the row beneath; only
     the circle itself takes taps, and it scrolls the table. */
  pointer-events: auto;
  cursor: pointer;
  border: none;
  padding: 0 0 .15rem 0;
}
.scroll-cue-arrow:hover { background: var(--brand-hover); }
.scroll-cue-left .scroll-cue-arrow { animation-name: nudge-left; }
@keyframes nudge-right {
  0%, 100% { transform: translateX(0); }
  50%      { transform: translateX(4px); }
}
@keyframes nudge-left {
  0%, 100% { transform: translateX(0); }
  50%      { transform: translateX(-4px); }
}
@media (prefers-reduced-motion: reduce) {
  .scroll-cue-arrow { animation: none; }
}

.scroll-note {
  margin-top: .5rem;
  font-size: .78rem;
  color: #8a92a0;
  text-align: center;
}
.rates-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.rates-table thead th {
  text-align: center;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  line-height: 1.4;
  color: #8a92a0;
  padding: .55rem .25rem;
  border-bottom: 2px solid #eef0f4;
}
.rates-table tbody td {
  padding: .75rem .25rem;
  border-bottom: 1px solid #f1f3f6;
  color: #2a2f3a;
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.rates-table tbody tr:hover { background: #fafbfc; }

/* Rate and APR are the two numbers customers compare, so they carry the same
   weight and colour; only the rate cell needs positioning for the par badge. */
.rate-cell, .apr-cell { font-weight: 700; color: var(--brand-dark); }
.rate-cell { position: relative; }
.rates-table td.credit { color: var(--credit); font-weight: 600; }

.rates-foot {
  font-size: .74rem;
  color: #98a0ad;
  margin-top: .9rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #eef0f4;
  line-height: 1.5;
}

/* Contact box under the results: apply, request contact, or reach us direct */
.contact-box {
  margin-top: 1.75rem;
  padding: 1.5rem;
  background: #f2f6fa;
  border: 1.5px solid #d9e4ec;
  border-radius: 10px;
  text-align: center;
}
.contact-box .save-status { display: block; margin-top: .75rem; }

.contact-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .9rem;
  max-width: 520px;
  margin: 0 auto 1.25rem;
  text-align: left;
}
@media (max-width: 560px) { .contact-fields { grid-template-columns: 1fr; } }
.contact-field-row label {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  color: var(--brand-dark);
  margin-bottom: .25rem;
}
.contact-field-row input {
  width: 100%;
  min-height: 38px;
  padding: .5rem .65rem;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  font-size: .88rem;
  font-family: inherit;
  background: #fff;
}
.contact-field-row input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(63,108,140,.15);
}

.contact-actions {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: .9rem;
  flex-wrap: wrap;
}
/* Both calls to action share one look: white, filling brand on hover. */
.apply-btn,
.contact-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .95rem 2rem;
  background: #fff;
  color: var(--brand);
  border: 2px solid var(--brand);
  border-radius: 999px;
  font-family: inherit;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: .01em;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.apply-btn:hover,
.contact-btn:hover:not(:disabled) { background: var(--brand); color: #fff; }
.contact-btn:disabled { opacity: .6; cursor: not-allowed; }
@media (max-width: 560px) {
  .contact-actions { flex-direction: column; }
  /* Tighter sides and type so "Have a Loan Officer Contact Me" stays on one
     line — otherwise it wraps and the two buttons end up different heights. */
  .apply-btn, .contact-btn {
    width: 100%;
    padding-left: .85rem;
    padding-right: .85rem;
    font-size: .875rem;
  }
}

.contact-direct {
  margin-top: 1.4rem;
  padding-top: 1.1rem;
  border-top: 1px solid #d9e4ec;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .5rem 1.5rem;
  flex-wrap: wrap;
}
.contact-direct > span {
  font-size: .8rem;
  color: #8a92a0;
  width: 100%;
  margin-bottom: -.2rem;
}
.contact-direct a {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--brand-dark);
  text-decoration: none;
  white-space: nowrap;
}
.contact-direct a:hover { color: var(--brand); text-decoration: underline; }

.secondary-btn {
  padding: .6rem 1.3rem;
  background: #fff;
  color: var(--brand);
  border: 2px solid var(--brand);
  border-radius: 999px;
  font-family: inherit;
  font-size: .92rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.secondary-btn:hover:not(:disabled) { background: var(--brand); color: #fff; }
.secondary-btn:disabled { opacity: .6; cursor: not-allowed; }
.save-status { font-size: .84rem; font-weight: 500; }
.save-status.ok  { color: var(--credit); }
.save-status.err { color: var(--danger); }

/* ── Site footer ─────────────────────────────────────────── */
.site-footer { background: var(--brand-dark); color: #c7ccd6; margin-top: auto; }
.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 2rem 1.5rem 1.5rem;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 1.75rem;
}
.footer-col h4 {
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .7rem;
}
.footer-col p { font-size: .9rem; line-height: 1.6; margin-bottom: .5rem; }
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: .4rem; }
.footer-col a { color: #c7ccd6; text-decoration: none; font-size: .9rem; }
.footer-col a:hover { color: #fff; text-decoration: underline; }
.footer-logo { height: 54px; width: auto; background: #fff; padding: .4rem .6rem; border-radius: 6px; margin-bottom: .8rem; }

/* Equal Housing Opportunity (Fair Housing) mark */
.eho { display: flex; align-items: center; gap: .55rem; margin-top: 1rem; color: #c7ccd6; }
.eho-icon { width: 34px; height: 34px; flex-shrink: 0; }
.eho-text {
  font-size: .68rem;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 600;
}

.footer-bar {
  border-top: 1px solid rgba(255,255,255,.12);
  padding: .9rem 1.5rem;
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  font-size: .78rem;
  color: #98a0ad;
}
.footer-bar a { color: #c7ccd6; }

/* Demo mode — only rendered when MOCK_PRICING_RESULTS is set */
.demo-banner {
  width: 100%;
  max-width: 1180px;
  margin-bottom: 1.25rem;
  padding: .8rem 1.1rem;
  background: #fdecea;
  border: 1.5px solid #e8a9a1;
  border-left: 5px solid var(--danger);
  border-radius: 8px;
  color: #8c2c20;
  font-size: .85rem;
  font-weight: 600;
  line-height: 1.45;
}
.demo-banner strong { color: var(--danger); }

/* ═══ Cookie notice ═══════════════════════════════════════ */

.cookie-notice {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 60;                      /* above the compare tray */
  background: var(--brand-dark);
  color: #e8ecf1;
  box-shadow: 0 -3px 18px rgba(0,0,0,.22);
  animation: rise .3s ease;
}
.cookie-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: .9rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.cookie-inner p { font-size: .82rem; line-height: 1.5; margin: 0; }
.cookie-inner a { color: #9dc2dc; text-decoration: underline; }
.cookie-inner a:hover { color: #fff; }
.cookie-btn {
  padding: .55rem 1.5rem;
  background: #fff;
  color: var(--brand-dark);
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}
.cookie-btn:hover { background: #dfe7ee; }

@media (max-width: 560px) {
  .cookie-inner { padding: .8rem .9rem; gap: .7rem; }
  .cookie-btn { width: 100%; }
}

/* ═══ Closing-cost worksheet ══════════════════════════════ */

.field-hint {
  margin-top: .3rem;
  font-size: .76rem;
  color: #8a92a0;
  line-height: 1.4;
}

/* Rows select which fee sheet is showing, so they read as controls. */
.rates-table tbody tr.rate-row { cursor: pointer; }
.rates-table tbody tr.rate-row:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}
.rates-table tbody tr.rate-row-active,
.rates-table tbody tr.rate-row-active.compare-row {
  background: #e2edf5;
  box-shadow: inset 4px 0 0 var(--brand);
}
.rates-table tbody tr.rate-row-active:hover { background: #dae8f2; }

.worksheet-panel {
  margin-top: 1rem;
  background: #f7f9fb;
  border: 1.5px solid #e3e9ee;
  border-radius: 10px;
  animation: rise .25s ease;
  scroll-margin-top: 1rem;
}
.ws-head {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  padding: .9rem 1.25rem 0;
  text-align: center;
}
/* Out of the flow on wide screens so it can't pull the title off centre. */
@media (min-width: 561px) {
  .ws-head .ws-pdf { position: absolute; top: .9rem; right: 1.25rem; }
}
.ws-head h3 { font-size: 1.05rem; font-weight: 700; color: var(--brand-dark); }
.ws-title { display: flex; flex-direction: column; align-items: center; gap: .15rem; }
/* Rate and APR carry the same size and family — only the word "APR" is
   smaller. Stating one prominently and the other quietly isn't allowed. */
.ws-rates {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: .35rem;
  font-variant-numeric: tabular-nums;
}
.ws-rate-num {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--brand);
}
.ws-rate-sep { font-size: 1.15rem; font-weight: 400; color: #9aa3b0; }
.ws-rate-label {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .05em;
  color: #8a92a0;
}

.ws-tabs-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.25rem .25rem;
}

/* The view arrows sit against the worksheet rather than the tab pills — the
   same shape and weight as the rate table's, so they read as the same idea. */
.ws-views { position: relative; }
.view-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-family: inherit;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  padding-bottom: .18rem;
  cursor: pointer;
  box-shadow: 0 1px 6px rgba(52,57,77,.3);
  transition: background .15s;
}
.view-nav:hover { background: var(--brand-hover); }
.view-nav-prev { left: .5rem; }
.view-nav-next { right: .5rem; }
.view-nav-bar { display: contents; }
/* Reserve a lane each side so an arrow never lands on a figure. Desktop gets
   it free from the sheet's own max-width; narrow screens have to be given it. */
@media (max-width: 560px) {
  .ws-views { padding-inline: 40px; }
  .view-nav { width: 34px; height: 34px; font-size: 1.3rem; }
  .view-nav-prev { left: 2px; }
  .view-nav-next { right: 2px; }
  .ws { padding-left: .55rem; padding-right: .55rem; }
}
/* Segmented control rather than an underline: the previous version read as
   decoration and customers didn't realise the other views existed. */
.ws-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .25rem;
  padding: .3rem;
  background: #e8edf2;
  border-radius: 999px;
}
.ws-tab {
  border: none;
  background: none;
  padding: .5rem 1.15rem;
  border-radius: 999px;
  font-family: inherit;
  font-size: .86rem;
  font-weight: 700;
  color: #5b6472;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s, box-shadow .15s;
}
.ws-tab:hover { color: var(--brand-dark); }
.ws-tab.active {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 1px 4px rgba(52,57,77,.25);
}

.ws {
  padding: .9rem 1.25rem 1.25rem;
  text-align: left;
  max-width: 640px;
  margin-inline: auto;          /* centred in the panel rather than hugging left */
}
.ws-total-cash { border-top-width: 3px; font-size: 1rem; }
.ws-group-head > span, .ws-item > span, .ws-total > span { min-width: 0; overflow-wrap: anywhere; }
.ws-group-head > span:last-child, .ws-item > span:last-child, .ws-total > span:last-child {
  white-space: nowrap;
}
.ws-group { margin-bottom: .9rem; }
.ws-group-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: .3rem;
  margin-bottom: .3rem;
  border-bottom: 1.5px solid #dde4ea;
  font-size: .82rem;
  font-weight: 700;
  color: var(--brand-dark);
  font-variant-numeric: tabular-nums;
}
.ws-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .18rem 0 .18rem .8rem;
  font-size: .8rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.ws-item .credit { color: var(--credit); font-weight: 600; }
.ws-total {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: .9rem;
  padding-top: .6rem;
  border-top: 2px solid var(--brand-dark);
  font-size: .92rem;
  font-weight: 700;
  color: var(--brand-dark);
  font-variant-numeric: tabular-nums;
}
.ws-note {
  margin-top: .7rem;
  font-size: .72rem;
  line-height: 1.5;
  color: #8a92a0;
}

/* ═══ Rate comparison ═════════════════════════════════════ */

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.rates-hint {
  margin-top: .8rem;
  font-size: .82rem;
  color: #6b7383;
}
.rates-hint strong { color: var(--brand-dark); }

/* Compare column sits first so it stays put when the table scrolls on mobile */
.rates-table th.compare-col { width: 1%; white-space: nowrap; }
.rates-table td.compare-cell { padding-left: .2rem; padding-right: .2rem; }
.compare-check { display: inline-flex; cursor: pointer; padding: .25rem; }
.compare-check input { width: 17px; height: 17px; accent-color: var(--brand); cursor: pointer; }
.compare-check input:disabled { cursor: not-allowed; opacity: .4; }
/* Selection owns the background; a compare pick just gets a marker, and the
   ticked box and tray chip already say so. */
.rates-table tbody tr.compare-row { box-shadow: inset 3px 0 0 #9db8cb; }

/* ── Sticky selection tray ─────────────────────────────── */
.compare-tray {
  position: fixed;
  left: 0; right: 0;
  /* The cookie notice is also bottom-pinned; sit above it while it shows. */
  bottom: var(--cookie-h, 0px);
  z-index: 40;
  background: #fff;
  border-top: 1.5px solid var(--line);
  box-shadow: 0 -3px 18px rgba(0,0,0,.12);
  animation: rise .25s ease;
}
.compare-tray-inner {
  max-width: 1180px;   /* keep the tray aligned with .rates-card */
  margin: 0 auto;
  padding: .75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.compare-chips { display: flex; gap: .5rem; flex-wrap: wrap; }
.compare-chip {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .35rem .4rem .35rem .6rem;
  background: #f2f6fa;
  border: 1.5px solid #d9e4ec;
  border-radius: 8px;
  font-size: .82rem;
}
.chip-opt { font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #8a92a0; }
.chip-rate { font-weight: 700; color: var(--brand-dark); font-variant-numeric: tabular-nums; }
.chip-x {
  border: none; background: none; cursor: pointer;
  color: #98a0ad; font-size: 1.05rem; line-height: 1;
  padding: 0 .2rem; border-radius: 4px;
}
.chip-x:hover { color: var(--danger); background: #fdecea; }

.compare-tray-actions { display: flex; align-items: center; gap: 1rem; margin-left: auto; }
.link-btn {
  border: none; background: none; cursor: pointer;
  font-family: inherit; font-size: .84rem; font-weight: 600;
  color: var(--ink); text-decoration: underline;
}
.link-btn:hover { color: var(--brand); }
.compare-go {
  padding: .6rem 1.4rem;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: .92rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.compare-go:hover:not(:disabled) { background: var(--brand-hover); }
.compare-go:disabled { opacity: .45; cursor: not-allowed; }

/* ── Side-by-side panel ────────────────────────────────── */
.compare-panel {
  margin-top: 1.5rem;
  padding: 1.4rem;
  background: #fbfcfd;
  border: 1.5px solid #e3e9ee;
  border-radius: 10px;
  animation: rise .3s ease;
  scroll-margin-top: 1rem;
}
.compare-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.compare-panel-head h3 { font-size: 1.1rem; font-weight: 700; color: var(--brand-dark); }

.compare-grid { width: 100%; border-collapse: collapse; font-size: .88rem; }
.compare-grid th.compare-rowhead {
  text-align: left;
  font-size: .78rem;
  font-weight: 600;
  color: #6b7383;
  padding: .6rem .8rem .6rem 0;
  white-space: nowrap;
  border-bottom: 1px solid #eef0f4;
}
.compare-grid thead th.compare-opt {
  padding: .5rem .8rem .7rem;
  border-bottom: 2px solid #e3e9ee;
  text-align: left;
  min-width: 8.5rem;
}
.opt-tag {
  display: inline-block;
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: .12rem .4rem;
  border-radius: 999px;
  color: #fff;
}
.opt-a { background: var(--brand); }
.opt-b { background: #7a5ea8; }
.opt-c { background: #2f8f7d; }
/* Rate and APR share this line and this weight — APR is half the comparison,
   so it shouldn't be buried in the rows below. */
.opt-rate {
  display: block;
  margin-top: .3rem;
  font-size: 1.22rem;
  font-weight: 700;
  color: var(--brand-dark);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.opt-rate-label {
  display: block;
  margin-top: .1rem;
  font-size: .64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #8a92a0;
}
.compare-grid tbody td {
  padding: .6rem .8rem;
  border-bottom: 1px solid #eef0f4;
  color: #2a2f3a;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.compare-grid tbody tr:hover { background: #f4f7f9; }
.compare-grid .unit { font-size: .74rem; color: #98a0ad; }
.delta {
  display: inline-block;
  margin-left: .45rem;
  font-size: .74rem;
  font-weight: 700;
}
.delta.good { color: var(--credit); }
.delta.bad  { color: var(--cost); }

.compare-disclaimer {
  margin-top: 1rem;
  font-size: .74rem;
  line-height: 1.5;
  color: #98a0ad;
}

/* ── Bar comparisons ───────────────────────────────────── */
.compare-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 1.4rem;
  padding-top: 1.4rem;
  border-top: 1px solid #eef0f4;
}
.chart h4 {
  font-size: .8rem;
  font-weight: 700;
  color: var(--brand-dark);
  margin-bottom: .9rem;
}
.bar-row { margin-bottom: .85rem; }
.bar-label { display: flex; align-items: center; gap: .45rem; margin-bottom: .3rem; }
.bar-sub { font-size: .78rem; font-weight: 600; color: #6b7383; font-variant-numeric: tabular-nums; }
.bar-track {
  height: 16px;
  background: #eaeef2;
  border-radius: 4px;
  overflow: hidden;
}
.bar-fill { height: 100%; border-radius: 4px; transition: width .4s ease; }
.opt-fill-a { background: var(--brand); }
.opt-fill-b { background: #7a5ea8; }
.opt-fill-c { background: #2f8f7d; }
.bar-value {
  margin-top: .25rem;
  font-size: .82rem;
  font-weight: 700;
  color: var(--brand-dark);
  font-variant-numeric: tabular-nums;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 760px) {
  .footer-inner { grid-template-columns: 1fr; gap: 1.25rem; }
  .header-top { flex-direction: column; align-items: center; gap: .5rem; text-align: center; }
  .nav-links > li > a { padding: .7rem .8rem; font-size: .9rem; }
}
@media (max-width: 560px) {
  .card { padding: 1.5rem 1.15rem; }
  .rates-card { padding: 1.25rem 1rem; }
  .rates-table { font-size: .84rem; }
  .rates-table thead th, .rates-table tbody td { padding: .5rem .45rem; }

  .compare-tray-inner { padding: .65rem .9rem; gap: .6rem; }
  .compare-tray-actions { width: 100%; justify-content: space-between; margin-left: 0; }
  .compare-go { flex: 1; margin-left: .5rem; }
  .compare-panel { padding: 1.1rem .9rem; }
  .compare-charts { grid-template-columns: 1fr; gap: 1.25rem; }

  /* Three tabs are a tight fit at 375px — drop the gap (the pill padding
     already separates them) and trim the sides so they stay on one row. */
  .ws-tabs-wrap { padding-left: .5rem; padding-right: .5rem; }
  .ws-tabs { gap: 0; padding: .25rem; }
  .ws-tab { padding: .45rem .6rem; font-size: .78rem; }
  .ws, .ws-head { padding-left: .9rem; padding-right: .9rem; }
}

/* The fixed tray and cookie notice would otherwise sit on the footer's last
   rows. --cookie-h is set from the notice's measured height, 0 once dismissed. */
body { padding-bottom: var(--cookie-h, 0px); }
body.compare-open { padding-bottom: calc(92px + var(--cookie-h, 0px)); }
@media (max-width: 560px) {
  body.compare-open { padding-bottom: calc(132px + var(--cookie-h, 0px)); }
}

/* Worksheet header actions (PDF download + close) */
.ws-head-actions { display: flex; align-items: center; gap: .9rem; }
.ws-pdf {
  font-size: .8rem;
  font-weight: 700;
  color: var(--brand);
  text-decoration: none;
  padding: .35rem .8rem;
  border: 1.5px solid var(--brand);
  border-radius: 999px;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.ws-pdf:hover { background: var(--brand); color: #fff; }

/* ═══ Saved worksheets ════════════════════════════════════ */

.history-card {
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 2px 16px rgba(0,0,0,.09);
  padding: 1.5rem 1.75rem;
  width: 100%;
  max-width: 1180px;
  border-top: 4px solid #8a92a0;
  animation: rise .35s ease;
}
.history-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .9rem;
}
.history-head h2 { font-size: 1.05rem; font-weight: 700; color: var(--brand-dark); }
.history-sub { font-size: .8rem; color: #8a92a0; margin-top: .15rem; }

.history-list { display: flex; flex-direction: column; gap: .5rem; }
.history-item {
  display: grid;
  grid-template-columns: 8.5rem 5rem 1fr auto 6rem;
  align-items: center;
  gap: .75rem;
  padding: .7rem .9rem;
  background: #f7f9fb;
  border: 1.5px solid #e3e9ee;
  border-radius: 8px;
}
.hist-when { font-size: .78rem; color: #8a92a0; white-space: nowrap; }
.hist-rate {
  font-size: 1rem; font-weight: 700; color: var(--brand-dark);
  font-variant-numeric: tabular-nums;
}
.hist-meta { font-size: .8rem; color: var(--ink); }
.hist-amt {
  font-size: .84rem; font-weight: 600; color: var(--ink);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.hist-pdf {
  font-size: .78rem;
  font-weight: 700;
  color: var(--brand);
  text-decoration: none;
  text-align: center;
  padding: .35rem .6rem;
  border: 1.5px solid var(--brand);
  border-radius: 999px;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.hist-pdf:hover { background: var(--brand); color: #fff; }

@media (max-width: 640px) {
  .history-item { grid-template-columns: 1fr auto; gap: .3rem .75rem; }
  .hist-when { order: 1; }
  .hist-pdf  { order: 2; }
  .hist-rate { order: 3; }
  .hist-amt  { order: 4; }
  .hist-meta { order: 5; grid-column: 1 / -1; }
}

/* ── Touch targets ───────────────────────────────────────
   Phone-sized screens get larger hit areas: several of these controls are
   only 13–26px tall by default, well under the ~44px a thumb needs. Heights
   only — nothing here changes the layout's width. */
@media (max-width: 560px) {
  .ws-tab { min-height: 44px; }
  .ws-pdf, .hist-pdf {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 40px;
  }
  .link-btn { display: inline-flex; align-items: center; min-height: 40px; }
  /* The label is the real target; pad it out around the small native box. */
  .compare-check { padding: .65rem .5rem; }
  .inline-check { display: inline-flex; align-items: center; gap: .45rem; min-height: 40px; }
  .escrow-waiver { min-height: 44px; }
  .contact-field-row input { min-height: 44px; }
  /* These dial and compose — worth a generous target on a phone. */
  .contact-direct a {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 44px; padding: 0 .5rem;
  }
}
