
/* ====== Altaloans calculators ====== */

.alta-calc {
  /* Brand */
  --color-brand: var(--wp--preset--color--brand, #006199);
  --color-brand-hover: var(--wp--custom--blue--700, #024c77);
  --color-brand-soft: #9ec6dd;
  --color-brand-deep: #00456f;
  --color-brand-wash: rgba(0, 97, 153, 0.08);
  --color-accent: var(--wp--preset--color--accent, #f16f00);

  /* Surfaces. The ground is white (.alta-calc-page in style.css) and the panels
   * are tinted, which is the way round the design was drawn — the site's own
   * pages do the opposite, white cards on warm off-white.
   *
   * These greys are the one place this file does not read a theme token, and
   * the reason is worth stating. The theme has no neutral ramp: every surface
   * it owns is warm, because warm is what sits under its orange accent. The
   * calculator sets two things into its cards — a summary strip and a control
   * groove — and both are warm, because every line on this site is warm and a
   * cool fill inside a warm hairline disagrees with its own border.
   *
   * These were cool greys for three passes, which worked while the ground was
   * warm off-white and the fills had to stand apart from it. The ground is
   * white now, so warm fills have somewhere to sit and nothing to blend into,
   * and the whole page finally runs at one temperature.
   *
   * Saturated brand is spent only where it means something: the figure you came
   * for, an active control, a focus ring, the primary CTA, the answer. */
  --color-bg: transparent;
  --color-surface: var(--wp--preset--color--surface, #ffffff);
  --color-cream: #f1f3f7;
  --color-input-bg: var(--wp--preset--color--surface, #ffffff);
  /* A groove has to hold a white pill and still read as the groove behind it. */
  --color-input-bg-solid: #e6eaf0;
  /* Brand-tinted, for the few things that want to look interactive rather than
   * structural: a ghost button under the cursor, the unfilled half of a split
   * bar, the row you are standing on. */
  --color-surface-alt: var(--wp--custom--tint--blue-100, #eef4f8);

  /* Text */
  --color-text-heading: var(--wp--preset--color--text, #4a4340);
  --color-text-body: var(--wp--custom--neutral--400, #6b625c);
  --color-text-muted: var(--wp--preset--color--text-secondary, #776d66);
  --color-text-on-brand: var(--wp--preset--color--surface, #ffffff);

  /* Borders */
  --color-field-edge: var(--wp--custom--neutral--500, #776d66);
  --color-field-edge-hover: rgba(0, 97, 153, 0.4);
  /* The rule under a total row: one step down from the hairline again. */
  --color-border-subtle: #c9d1dc;
  --color-answer-edge: var(--wp--preset--color--brand, #006199);
  --color-answer-wash: rgba(0, 97, 153, 0.05);
  /* The theme's --line is warm, and a warm edge around a cool fill is a card
   * disagreeing with its own border. The fills are what everything else on the
   * page is measured against, so the edge moves to them rather than the other
   * way round — and darker than --line, which is drawn to be barely there on a
   * page with no other structure. Here it has cards to actually delimit. */
  --color-border-hairline: #dee3ea;

  /* Status. Darker inks than the design shipped: its green (#2F7D58 on
   * #F1F9F4, 3.1:1) and red (#C04747 on #FCF1F1, 4.1:1) both failed 4.5:1 at
   * the 12px these badges are set in. */
  --tone-good-ink: #157a42;
  --tone-good-line: #bfe0cd;
  --tone-good-wash: #f1f9f4;
  --tone-warn-ink: var(--wp--custom--orange--500, #b35300);
  --tone-warn-line: #f0d3ac;
  --tone-warn-wash: #fdf4e9;
  --tone-bad-ink: #b3352b;
  --tone-bad-line: #eec7c7;
  --tone-bad-wash: #fcf1f1;

  /* Radius */
  --radius-sm: var(--wp--custom--radius--xs, 11px);
  --radius-md: var(--wp--custom--radius--md, 16px);
  --radius-lg: var(--wp--custom--radius--lg, 20px);

  /* Shadow */
  --shadow-card: var(--wp--custom--shadow--card, 0 1px 2px rgba(15, 37, 47, 0.04), 0 8px 24px rgba(15, 37, 47, 0.06));
  --shadow-card-lifted: 0 2px 6px rgba(15, 37, 47, 0.08), 0 18px 44px rgba(15, 37, 47, 0.16);
  --shadow-btn: var(--wp--custom--shadow--blue, 0 8px 20px rgba(0, 97, 153, 0.22));
  --shadow-btn-hover: 0 12px 26px rgba(0, 97, 153, 0.3);
  /* The lift under a column-level panel, and the one under the answer. Both are
   * the site's shape — tinted blue rather than grey, which is what lets a white
   * card read on a white ground without a fill behind it — at about two thirds
   * its opacity. The home page spends 16% on a card five hundred pixels tall;
   * the inputs panel is three times that, and the same haze down that length
   * stops reading as lift and starts reading as dirt. */
  --shadow-card-lift: 0 2px 4px rgba(15, 37, 47, 0.04), 0 18px 44px rgba(0, 97, 153, 0.10);
  --shadow-answer: 0 2px 4px rgba(15, 37, 47, 0.04), 0 10px 26px rgba(0, 97, 153, 0.09);

  /* Type */
  --font-family: Roboto, system-ui, sans-serif;

  /* Control heights */
  --control-height: 55px;
  --control-height-sm: 44px;

  /* Density scalar (tweakable) */
  --density: 1;
}

.alta-calc, .alta-calc *, .alta-calc *::before, .alta-calc *::after { box-sizing: border-box; }

.alta-calc {
  font-family: var(--font-family);
  background: var(--color-bg);
  color: var(--color-text-heading);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
}

.alta-calc button {
  font-family: inherit;
  cursor: pointer;
}

.alta-calc input, .alta-calc select {
  font-family: inherit;
}

/* ===== Layout ===== */
.alta-calc__shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 48px 32px 96px;
}

/* Header, nav, and page-intro hero removed: calculators ship as iframe widgets;
 * the host page (altaloans.com/calculators) owns all page chrome and headline copy. */

/* ===== Main grid ===== */
.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 28px;
  align-items: start;
}
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; gap: 24px; }
  .results-col { position: static !important; }
}

.results-panel {
  position: sticky;
  top: 24px;
}
@media (max-width: 980px) {
  .results-panel { position: static; }
}

/* ===== Inputs panel ===== */
.inputs-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border-hairline);
  box-shadow: var(--shadow-card-lift);
  border-radius: var(--radius-lg);
  padding: calc(32px * var(--density));
}

.input-section {
  padding-bottom: calc(28px * var(--density));
  margin-bottom: calc(28px * var(--density));
  border-bottom: 1px solid var(--color-border-hairline);
}
.input-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: calc(20px * var(--density));
}
.section-head h2 {
  font-size: 20px;
  font-weight: 500;
  color: var(--color-text-heading);
  margin: 0;
  letter-spacing: -0.01em;
}
.section-head .section-hint {
  font-size: 13px;
  color: var(--color-text-muted);
  font-weight: 500;
}

details.input-section > summary {
  list-style: none;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  margin-bottom: 0;
}
details.input-section > summary::-webkit-details-marker { display: none; }
details.input-section > summary .section-hint {
  display: flex;
  align-items: center;
  gap: 5px;
}
details.input-section > summary .section-hint::after {
  content: '';
  display: inline-block;
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--color-text-muted);
  transition: transform 0.18s ease;
  margin-top: 1px;
}
details[open].input-section > summary .section-hint::after {
  transform: rotate(180deg);
}
details.input-section > summary:hover h2 { color: var(--color-text-body); }
details.input-section > .section-fields {
  margin-top: calc(20px * var(--density));
}
details.input-section:not([open]) {
  padding-bottom: calc(20px * var(--density));
  margin-bottom: calc(20px * var(--density));
}

.advanced {
  margin-top: 16px;
  border-top: 1px dashed var(--color-border-hairline);
  padding-top: 14px;
}
.advanced > summary {
  font-size: 13px;
  color: var(--color-text-muted);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.advanced > summary::-webkit-details-marker { display: none; }
.advanced > summary::before {
  content: '+';
  display: inline-flex;
  width: 16px; height: 16px;
  align-items: center; justify-content: center;
  border-radius: 3px;
  background: var(--color-input-bg-solid);
  color: var(--color-text-body);
  font-size: 14px;
  line-height: 1;
}
.advanced[open] > summary::before { content: '−'; }
.advanced-body { margin-top: 12px; display: flex; flex-direction: column; gap: 12px; }

/* ===== Field ===== */
.field {
  margin-bottom: calc(22px * var(--density));
}
.field:last-child { margin-bottom: 0; }

.field-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 12px;
}
.field-label {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.tooltip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-input-bg-solid);
  border: none;
  color: var(--color-brand-deep);
  font-size: 11px;
  font-weight: 600;
  cursor: help;
  position: relative;
}
.tooltip-btn:hover { background: var(--color-brand); color: white; }
.tooltip-content {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-text-heading);
  color: white;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
  width: max-content;
  max-width: 280px;
  min-width: 200px;
  z-index: 10;
  pointer-events: none;
  text-align: left;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: auto;
  box-shadow: var(--shadow-card-lifted);
}
@media (max-width: 480px) {
  .tooltip-content {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 16px;
    top: auto;
    transform: none;
    width: auto;
    max-width: none;
    font-size: 13px;
    padding: 14px 16px;
  }
  .tooltip-content::after { display: none; }
}
.tooltip-content::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--color-text-heading);
}

/* Input wrapper */
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-wrap .prefix,
.input-wrap .suffix {
  position: absolute;
  color: var(--color-text-muted);
  font-size: 18px;
  font-weight: 500;
  pointer-events: none;
}
.input-wrap .prefix { left: 16px; }
.input-wrap .suffix { right: 16px; }

.input-base {
  width: 100%;
  height: var(--control-height);
  background: var(--color-input-bg);
  color: var(--color-text-heading);
  border: 1px solid var(--color-field-edge);
  border-radius: var(--radius-sm);
  padding: 0 16px;
  font-size: 18px;
  font-weight: 500;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
  font-variant-numeric: tabular-nums;
}
.input-base.has-prefix { padding-left: 32px; }
.input-base.has-suffix { padding-right: 32px; }
.input-base:focus {
  border-color: var(--color-brand);
  background: white;
}
.input-base:hover:not(:focus) {
  border-color: var(--color-field-edge-hover);
}
.input-base.is-invalid,
.input-base[aria-invalid="true"] {
  border-color: var(--tone-bad-ink);
  background: var(--tone-bad-wash);
}
.input-base.is-invalid:focus,
.input-base[aria-invalid="true"]:focus {
  border-color: var(--tone-bad-ink);
  box-shadow: 0 0 0 3px rgba(179, 53, 43, 0.15);
}
.input-base.is-clamped {
  animation: lk-clamp-pulse 1.5s ease-out;
}
@keyframes lk-clamp-pulse {
  0%   { background: rgba(0, 97, 153, 0.14); }
  100% { background: transparent; }
}
.input-error-hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--tone-bad-ink);
  font-weight: 500;
}

/* Field below: slider */
.slider-wrap {
  margin-top: 14px;
  padding: 0 2px;
}
.slider-wrap .slider-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 11px;
  color: var(--color-text-muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* ===== Custom slider ===== */
.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 24px;
  background: transparent;
  outline: none;
  cursor: pointer;
  margin: 0;
}
.slider::-webkit-slider-runnable-track {
  height: var(--track-h, 6px);
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--color-brand) 0%,
    var(--color-brand) var(--fill, 50%),
    var(--color-input-bg-solid) var(--fill, 50%),
    var(--color-input-bg-solid) 100%
  );
}
.slider::-moz-range-track {
  height: var(--track-h, 6px);
  border-radius: 999px;
  background: var(--color-input-bg-solid);
}
.slider::-moz-range-progress {
  height: var(--track-h, 6px);
  border-radius: 999px;
  background: var(--color-brand);
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: var(--thumb-size, 22px);
  height: var(--thumb-size, 22px);
  border-radius: 50%;
  background: white;
  border: 2px solid var(--color-brand);
  box-shadow: 0 1px 4px rgba(74, 67, 64, 0.2);
  margin-top: calc((var(--track-h, 6px) - var(--thumb-size, 22px)) / 2);
  transition: transform 0.12s;
}
.slider::-moz-range-thumb {
  width: var(--thumb-size, 22px);
  height: var(--thumb-size, 22px);
  border-radius: 50%;
  background: white;
  border: 2px solid var(--color-brand);
  box-shadow: 0 1px 4px rgba(74, 67, 64, 0.2);
}
.slider:hover::-webkit-slider-thumb { transform: scale(1.1); }
.slider:active::-webkit-slider-thumb { transform: scale(1.15); }
.slider:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px var(--color-brand-wash);
}

/* ===== $/% toggle (segmented control) ===== */
.segmented {
  display: inline-flex;
  background: var(--color-input-bg-solid);
  border-radius: var(--radius-sm);
  padding: 3px;
  height: 32px;
}
.segmented button {
  background: transparent;
  border: none;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
  border-radius: 6px;
  transition: all 0.15s;
  min-width: 36px;
  white-space: nowrap;
}
.segmented button.active {
  background: var(--color-surface);
  color: var(--color-brand-deep);
  box-shadow: 0 0 0 1px rgba(0, 97, 153, 0.22), 0 1px 3px rgba(15, 37, 47, 0.12);
}

/* Term chips */
.term-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.term-chip {
  flex: 1;
  min-width: 60px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--color-input-bg);
  border: 1px solid var(--color-field-edge);
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text-muted);
  transition: all 0.15s;
  font-variant-numeric: tabular-nums;
}
.term-chip:hover { border-color: var(--color-field-edge-hover); }
.term-chip.active {
  background: var(--color-brand-wash);
  color: var(--color-text-heading);
  border-color: var(--color-brand);
}
.term-chip .yrs {
  font-size: 11px;
  color: var(--color-text-muted);
  display: block;
  font-weight: 500;
  margin-top: -2px;
}
.term-chip.active .yrs { color: var(--color-brand); }

/* ===== Results column ===== */
.results-col {
  position: sticky;
  top: 24px;
}

/* Hero result */
.result-hero {
  background: var(--color-answer-wash);
  border: 1px solid var(--color-answer-edge);
  border-radius: var(--radius-md);
  padding: 32px;
  box-shadow: var(--shadow-answer);
  position: relative;
  overflow: hidden;
}
.result-hero::before {
  content: '';
  position: absolute;
  top: -41px;
  right: -41px;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(0, 97, 153, 0.18) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.result-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.result-label::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--color-accent);
  flex-shrink: 0;
}
.result-amount {
  font-size: 64px;
  line-height: 1;
  font-weight: 500;
  color: var(--color-text-heading);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 4px;
}
.result-amount .cents {
  font-size: 28px;
  color: var(--color-text-muted);
  letter-spacing: -0.01em;
}
.result-amount .curr {
  font-size: 32px;
  color: var(--color-text-muted);
  font-weight: 500;
  align-self: flex-start;
  margin-top: 10px;
}
.result-sub {
  font-size: 14px;
  color: var(--color-text-body);
  margin-bottom: 24px;
}

/* Breakdown donut + legend */
.breakdown {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 20px;
  align-items: center;
  margin-top: 20px;
}
.donut-wrap {
  position: relative;
  width: 140px;
  height: 140px;
}
.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}
.donut-center .lbl {
  font-size: 10px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-bottom: 2px;
}
.donut-center .val {
  font-size: 18px;
  font-weight: 500;
  color: var(--color-text-heading);
  font-variant-numeric: tabular-nums;
}

.legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.legend-row {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}
.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}
.legend-name {
  color: var(--color-text-body);
  font-weight: 500;
}
.legend-value {
  color: var(--color-text-heading);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* CTAs */
.cta-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 28px;
}
.btn {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  justify-content: center;
  gap: 8px;
  height: 52px;
  padding: 0 24px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 500;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
}
.btn-primary {
  background: var(--color-brand);
  color: var(--color-text-on-brand);
  box-shadow: var(--shadow-btn);
}
.btn-primary:hover { background: var(--color-brand-hover); box-shadow: var(--shadow-btn-hover); }
.btn-primary:active { transform: scale(0.97); }

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text-heading);
  border: 1.5px solid var(--color-border-hairline);
}
.btn-secondary:hover { border-color: var(--color-brand); color: var(--color-brand); }

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  padding: 0 12px;
  height: 40px;
  font-size: 14px;
}
.btn-ghost:hover { color: var(--color-brand); background: var(--color-surface-alt); }

/* ===== Summary strip ===== */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 20px;
}
.summary-card {
  background: white;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.summary-card .lbl {
  font-size: 12px;
  color: var(--color-text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.summary-card .val {
  font-size: 18px;
  font-weight: 500;
  color: var(--color-text-heading);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.summary-card .sub {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* ===== Tabs ===== */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--color-border-hairline);
}
.tab {
  background: transparent;
  border: none;
  padding: 14px 4px;
  margin-right: 24px;
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text-muted);
  position: relative;
  transition: color 0.15s;
}
.tab:hover { color: var(--color-text-heading); }
.tab.active { color: var(--color-text-heading); }
.tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-brand);
  border-radius: 2px 2px 0 0;
}

/* ===== Breakdown/Schedule section ===== */
.detail-section {
  margin-top: 48px;
  background: white;
  border-radius: var(--radius-md);
  padding: 32px;
  box-shadow: var(--shadow-card);
}
.detail-section h2 {
  font-size: 24px;
  font-weight: 500;
  color: var(--color-text-heading);
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.detail-section .detail-sub {
  font-size: 14px;
  color: var(--color-text-body);
  margin: 0 0 24px;
}

/* Tab-specific action bar */
.tab-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

/* ===== Amortization table ===== */
.amort-wrap {
  max-height: 480px;
  overflow: auto;
  border-radius: var(--radius-sm);
  background: var(--color-surface);
}
table.amort {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
}
.amort thead {
  position: sticky;
  top: 0;
  background: var(--color-surface);
  z-index: 1;
}
.amort th {
  text-align: right;
  padding: 12px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--color-border-hairline);
}
.amort th:first-child, .amort td:first-child { text-align: left; }
.amort td {
  padding: 12px 14px;
  text-align: right;
  color: var(--color-text-heading);
  border-bottom: 1px solid var(--color-border-hairline);
  font-weight: 500;
}
.amort tbody tr:hover { background: rgba(255, 255, 255, 0.5); }
.amort .dim { color: var(--color-text-muted); font-weight: 400; }

/* ===== Pill badge ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: var(--color-brand-wash);
  color: var(--color-brand);
}
.badge.neutral {
  background: var(--color-input-bg-solid);
  color: var(--color-text-muted);
}

/* ===== Chart grid label style ===== */
.chart-svg text { font-family: var(--font-family); font-weight: 500; }

/* ===== Interactive chart ===== */
.chart-container {
  position: relative;
  width: 100%;
}
.chart-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 16px;
  flex-wrap: wrap;
}
.chart-tabs {
  display: inline-flex;
  background: var(--color-input-bg-solid);
  border-radius: var(--radius-sm);
  padding: 4px;
  gap: 2px;
}
.chart-tabs button {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  gap: 8px;
  background: transparent;
  border: none;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
  border-radius: 6px;
  transition: all 0.18s;
  cursor: pointer;
}
.chart-tabs button:hover {
  color: var(--color-text-heading);
}
.chart-tabs button.active {
  background: var(--color-surface);
  color: var(--color-brand-deep);
  box-shadow: 0 0 0 1px rgba(0, 97, 153, 0.22), 0 1px 3px rgba(15, 37, 47, 0.12);
}
.chart-tabs button.active svg { color: var(--color-brand); }
.chart-tabs button svg { color: var(--color-text-muted); transition: color 0.18s; flex-shrink: 0; }

.chart-insight {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--color-text-body);
  font-weight: 500;
  padding: 8px 14px;
  background: var(--color-cream);
  border-radius: 999px;
}
.chart-insight strong { color: var(--color-text-heading); font-weight: 600; }
.insight-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-brand);
  animation: pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.6; }
}

/* Tooltip */
.chart-tooltip {
  position: absolute;
  top: 60px;
  background: white;
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 8px 24px -4px rgba(74, 67, 64, 0.18), 0 2px 6px rgba(74, 67, 64, 0.08);
  min-width: 200px;
  pointer-events: none;
  z-index: 10;
  animation: tip-in 0.12s ease-out;
  border: 1px solid var(--color-border-hairline);
}
@keyframes tip-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.chart-tooltip .tip-head {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.chart-tooltip .tip-row {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  padding: 3px 0;
}
.chart-tooltip .tip-row:not(:has(.swatch)) { grid-template-columns: 1fr auto; }
.chart-tooltip .tip-row .swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}
.chart-tooltip .tip-row .lbl {
  color: var(--color-text-body);
}
.chart-tooltip .tip-row .val {
  color: var(--color-text-heading);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.chart-tooltip .tip-divider {
  height: 1px;
  background: var(--color-border-hairline);
  margin: 6px 0;
}

/* ===== Tweaks panel ===== */
.tweaks-panel {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 300px;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card-lifted);
  padding: 20px;
  z-index: 1000;
  font-size: 14px;
}
.tweaks-panel h3 {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-heading);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tweak-row {
  margin-bottom: 14px;
}
.tweak-row:last-child { margin-bottom: 0; }
.tweak-row label {
  font-size: 12px;
  color: var(--color-text-muted);
  font-weight: 500;
  margin-bottom: 6px;
  display: block;
}
.tweak-opts {
  display: flex;
  gap: 6px;
}
.tweak-opts button {
  flex: 1;
  padding: 7px 8px;
  border-radius: 6px;
  background: var(--color-input-bg-solid);
  border: 1.5px solid transparent;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-muted);
  transition: all 0.15s;
}
.tweak-opts button.active {
  background: white;
  color: var(--color-text-heading);
  border-color: var(--color-brand);
}

/* ===== Page intro + reset ===== */
.page-intro .intro-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
}
.reset-btn, .icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid var(--color-border-hairline);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  margin-top: 4px;
  white-space: nowrap;
}
.reset-btn:hover, .icon-btn:hover {
  background: var(--color-surface);
  color: var(--color-brand);
  border-color: var(--color-brand);
}
.reset-btn svg, .icon-btn svg { color: var(--color-text-muted); }
.reset-btn:hover svg, .icon-btn:hover svg { color: var(--color-brand); }
.reset-btn:focus-visible, .icon-btn:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

/* Auto-fill chip shown next to tax/ins labels */
.auto-chip {
  font-size: 10px;
  font-weight: 600;
  color: var(--color-text-muted);
  background: var(--color-input-bg-solid);
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-left: 6px;
}

/* Inline error banner in result hero */
.result-error {
  padding: 14px 16px;
  margin-top: 16px;
  background: var(--color-brand-wash);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--color-text-heading);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.result-error .err-icon { color: var(--color-brand); flex-shrink: 0; margin-top: 1px; }

/* ===== A11y focus-visible ===== */
.alta-calc *:focus { outline: none; }
.alta-calc button:focus-visible,
.alta-calc [role="button"]:focus-visible,
.alta-calc [role="tab"]:focus-visible,
.alta-calc a:focus-visible,
.alta-calc select:focus-visible,
.segmented button:focus-visible,
.chart-tabs button:focus-visible,
.amort-wrap:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
.input-base:focus-visible {
  outline: none;
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px var(--color-brand-wash);
}
.slider:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 6px var(--color-brand-wash), 0 0 0 2px var(--color-brand);
}
.slider:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 6px var(--color-brand-wash), 0 0 0 2px var(--color-brand);
}
/* Screen-reader only */
.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;
}

/* Mobile touch targets */
@media (max-width: 640px) {
  .slider { height: 40px; }
  .slider::-webkit-slider-thumb { width: 28px; height: 28px; }
  .slider::-moz-range-thumb { width: 28px; height: 28px; }
  .segmented button { min-height: 44px; padding: 0 16px; }
  .chart-tabs button { min-height: 44px; }
  .alta-calc button, .alta-calc .btn { min-height: 44px; }
}

@media (max-width: 768px) {
  .dti-layout, .aff-layout, .refi-layout, .rentbuy-layout, .co-layout, .dc-layout, .heloc-layout, .main-layout {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }
  .results-panel { position: static !important; }
  .headline-value { font-size: 56px !important; }
  .field-row { flex-wrap: wrap; gap: 8px; }
  .shell { padding: 0 20px 40px !important; }
  .results-panel > *, .inputs-panel > * { width: 100%; }
}

/* Keyboard hint for schedule scrollable */
.amort-wrap:focus { outline: 2px solid var(--color-brand); outline-offset: 2px; }

/* Skeleton loading state (only if needed at init) */
@keyframes skel-pulse { 0%,100% { opacity:.5 } 50% { opacity: 1 } }

/* ===== Headline number (reused across calcs) ===== */
.headline {
  padding: 32px 36px;
  border-radius: var(--radius-lg);
  position: relative;
}
.headline-brand {
  background: linear-gradient(135deg, var(--color-cream) 0%, #fff 100%);
  border: 1px solid var(--color-brand-soft);
}
.headline-label {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--color-text-muted); font-weight: 600;
  margin-bottom: 12px;
}
.headline-value {
  display: flex; align-items: baseline;
  font-size: 64px; font-weight: 600;
  color: var(--color-text-heading);
  line-height: 1; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.headline-value .curr { font-size: 44px; color: var(--color-brand); margin-right: 2px; }
.headline-value .curr-after { font-size: 28px; color: var(--color-text-muted); margin-left: 6px; font-weight: 500; }
.headline-value .whole { animation: num-flash .35s ease-out; }
.headline-sub {
  font-size: 14px; color: var(--color-text-muted);
  margin-top: 12px;
}
@keyframes num-flash {
  0% { color: var(--color-brand); }
  100% { color: var(--color-text-heading); }
}

/* ===== Delta pill ===== */
.delta {
  display: inline-flex; align-items: baseline; gap: 2px;
  font-weight: 600; font-variant-numeric: tabular-nums;
}
.delta-arrow { font-size: 0.85em; }
.delta-good { color: var(--tone-good-ink); }
.delta-bad { color: var(--tone-bad-ink); }
.delta-flat { color: var(--color-text-muted); font-weight: 500; font-size: 0.95em; }

/* ===== Flash on auto-update ===== */
@keyframes field-flash {
  0% { background-color: var(--color-brand-wash); }
  100% { background-color: transparent; }
}
.input-base.is-flashing {
  animation: field-flash 0.9s ease-out;
}

/* ===== Comparison columns (Current vs New) ===== */
.compare-cols {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.compare-col {
  padding: 20px; border-radius: var(--radius-md);
  background: var(--color-surface);
}
.compare-col.primary {
  background: linear-gradient(135deg, var(--color-cream) 0%, #fff 100%);
  border: 1px solid var(--color-brand-soft);
}
.compare-col-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--color-text-muted); font-weight: 600; margin-bottom: 6px;
}
.compare-col-value {
  font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--color-text-heading); letter-spacing: -0.01em;
}
.compare-col .compare-meta {
  font-size: 12.5px; color: var(--color-text-muted); margin-top: 8px;
}

/* ===== Warning / info callout ===== */
.callout {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  font-size: 13.5px; line-height: 1.5;
}
.callout-warn { background: var(--tone-warn-wash); border: 1px solid var(--tone-warn-line); color: var(--tone-warn-ink); }
.callout-info { background: var(--color-surface-alt); border: 1px solid rgba(0, 97, 153, 0.14); color: var(--color-text-heading); }
.callout-good { background: var(--tone-good-wash); border: 1px solid var(--tone-good-line); color: var(--tone-good-ink); }
.callout-icon { flex-shrink: 0; margin-top: 1px; }

/* Responsive for compare-cols */
@media (max-width: 640px) {
  .compare-cols { grid-template-columns: 1fr; }
  .headline-value { font-size: 48px; }
  .headline-value .curr { font-size: 32px; }
  .calc-menu { left: 0; right: auto; min-width: 260px; }
}

/* Extra advanced toggle link */
.advanced-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-brand);
  background: transparent;
  border: none;
  padding: 0;
  margin-top: 8px;
}
.advanced-toggle:hover { text-decoration: underline; }
.advanced-toggle .chev { transition: transform 0.2s; }
.advanced-toggle.open .chev { transform: rotate(180deg); }

/* Fade in for dynamic values */
@keyframes value-pop {
  0% { transform: scale(1.03); opacity: 0.7; }
  100% { transform: scale(1); opacity: 1; }
}
.result-amount .whole { animation: value-pop 0.18s ease-out; }

/* ===== Calculator toolbar (Reset · Print · CTA) ===== */
.calc-toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-bottom: calc(24px * var(--density));
  flex-wrap: wrap;
}
.tb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
  outline: none;
}
.tb-btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(0, 97, 153, 0.28);
}
.tb-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.tb-ghost {
  background: transparent;
  border: 1px solid var(--color-border-hairline);
  color: var(--color-text-heading);
}
.tb-ghost:hover {
  border-color: var(--color-text-heading);
  background: var(--color-surface);
}
.tb-ghost:active { background: var(--color-surface-alt); }
.tb-cta {
  background: var(--color-brand);
  color: #fff;
  border: 1px solid var(--color-brand);
  padding: 0 22px;
  height: 48px;
  font-weight: 600;
}
.tb-cta:hover {
  background: var(--color-brand-hover);
  border-color: var(--color-brand-hover);
  color: #fff;
}
.tb-cta svg { opacity: 0.9; }
.tb-outline {
  background: var(--color-surface);
  color: var(--color-text-heading);
  border: 1.5px solid var(--color-border-hairline);
  height: 48px;
  font-weight: 600;
  padding: 0 22px;
}
.tb-outline:hover {
  border-color: var(--color-brand);
  color: var(--color-brand);
}
.reset-btn { align-self: flex-end; }

/* ===== CTAPair — dual conversion block after results ===== */
.cta-pair {
  margin: 32px 0 0;
  padding: 28px 28px 22px;
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-border-hairline);
  box-shadow: var(--shadow-card);
}
.cta-pair-headline {
  font-size: 20px;
  font-weight: 600;
  color: var(--color-text-heading);
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin-bottom: 18px;
}
.cta-pair-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.cta-pair .tb-btn { text-decoration: none; }

/* ===== TrustStrip — social proof microcopy ===== */
.trust-strip {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border-hairline);
  font-size: 13px;
  color: var(--color-text-muted);
  font-weight: 500;
}
.trust-strip .trust-dot {
  color: var(--color-text-muted);
  opacity: 0.5;
}

/* Responsive */
@media (max-width: 640px) {
  .alta-calc__shell { padding: 24px 16px 60px; }
  .cta-pair { padding: 22px 18px 18px; margin-top: 24px; border-radius: var(--radius-md); }
  .cta-pair-headline { font-size: 17px; margin-bottom: 14px; }
  .cta-pair-buttons { flex-direction: column; align-items: stretch; gap: 10px; }
  .cta-pair-buttons .tb-btn { width: 100%; justify-content: center; }
  .trust-strip { font-size: 12px; gap: 8px; }
  .page-intro .intro-top { flex-direction: column-reverse; align-items: stretch; gap: 12px; }
  .calc-toolbar { gap: 8px; }
  .tb-btn { flex: 1 1 auto; padding: 0 14px; }
  .tb-cta { order: -1; flex-basis: 100%; }
  .inputs-panel { padding: 20px; }
  .result-hero { padding: 24px; }
  .result-amount { font-size: 48px; }
  .breakdown { grid-template-columns: 1fr; }
  .donut-wrap { margin: 0 auto; }
  .summary-grid { grid-template-columns: 1fr; }
  .chart-tabs button { padding: 7px 10px; font-size: 12px; }
  .chart-insight { font-size: 12px; padding: 6px 10px; }
  .detail-section { padding: 20px; margin-top: 28px; }
}

/* ===== PrintView — screen-hidden, print-only purpose-built document =====
 * Rationale: coercing the live UI into a printable form yielded ugly output.
 * Each calc renders a second, pristine DOM (<PrintView />) that is invisible
 * on screen and becomes the only visible content at print time. Live UI is
 * fully hidden during print.
 */
.print-only { display: none; }

@media print {
  @page { margin: 16mm; size: auto; }
  html, body {
    background: #fff !important;
    color: #111 !important;
    font-size: 10.5pt;
    line-height: 1.4;
  }
  /* Hide live UI, show print document */
  .alta-calc__shell { display: none !important; }
  .print-only { display: block !important; }

  .pv-head {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22pt;
  }
  .lk-logo {
    display: block !important;
    height: 25pt !important;
    width: auto;
  }
  .pv-meta { font-size: 9.5pt; color: #555; }

  .pv-title {
    font-size: 15pt;
    font-weight: 600;
    margin: 0 0 16pt;
    color: #111;
  }

  /* Hero: big amount left, breakdown table right — flush with page */
  .pv-hero {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 28pt;
    align-items: start;
    margin: 0 0 22pt;
    padding: 0 0 16pt;
    border-bottom: 0.5pt solid #DDD;
    break-inside: avoid;
  }
  .pv-hero-main { min-width: 0; }
  .pv-hero-label {
    font-size: 9pt;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #4a4340;
    font-weight: 700;
    margin-bottom: 6pt;
  }
  .pv-hero-amount {
    font-size: 30pt;
    font-weight: 600;
    color: #006199;
    letter-spacing: -0.02em;
    line-height: 1;
  }
  .pv-hero-sub { font-size: 10pt; color: #4a4340; margin-top: 8pt; line-height: 1.4; }
  .pv-hero-side { min-width: 0; }
  .pv-hero-side-title {
    font-size: 9pt;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #4a4340;
    font-weight: 700;
    margin-bottom: 8pt;
  }

  /* Full-width inputs section */
  .pv-section { margin: 0 0 22pt; break-inside: avoid; }
  .pv-section h2 {
    font-size: 9.5pt;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #4a4340;
    font-weight: 700;
    margin: 0 0 10pt;
  }
  .pv-inputs-split {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 24pt;
  }

  .pv-kv { width: 100%; border-collapse: collapse; font-size: 10.5pt; }
  .pv-kv th, .pv-kv td {
    padding: 5pt 0;
    text-align: left;
    font-weight: 400;
    vertical-align: baseline;
  }
  .pv-kv th { color: #776d66; }
  .pv-kv td {
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: #111;
    font-weight: 500;
  }
  .pv-kv-compact { font-size: 10pt; }
  .pv-kv-compact th, .pv-kv-compact td { padding: 3.5pt 0; }

  /* Metrics: 3-col fits 6/9; rare 4th-col overflows gracefully */
  .pv-metrics {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14pt 22pt;
    margin: 0 0 22pt;
    padding: 16pt 0 0;
    border-top: 0.5pt solid #DDD;
    break-inside: avoid;
  }
  .pv-metric { break-inside: avoid; }
  .pv-metric-label {
    font-size: 8.5pt;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #4a4340;
    font-weight: 700;
    margin-bottom: 4pt;
  }
  .pv-metric-value {
    font-size: 12pt;
    font-weight: 600;
    color: #111;
    font-variant-numeric: tabular-nums;
  }

  .pv-foot {
    margin-top: 22pt;
    padding-top: 16pt;
    border-top: 0.5pt solid #DDD;
    break-inside: avoid;
  }
  .pv-cta { margin-bottom: 14pt; }
  .pv-cta strong {
    display: block !important;
    font-size: 11pt;
    color: #111;
    margin-bottom: 4pt;
  }
  .pv-contact {
    display: flex !important;
    gap: 10pt;
    font-size: 10pt;
    color: #4a4340;
    font-variant-numeric: tabular-nums;
  }
  .pv-contact .pv-sep { color: #B8B0AC; }
  .pv-contact-addr { margin-top: 4pt; color: #776d66; font-size: 9.5pt; }
}

/* ===== Auto-estimate chip (apply default) ===== */
.auto-estimate-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  padding: 4px 9px;
  background: transparent;
  border: 1px solid var(--color-border-hairline);
  border-radius: 999px;
  color: var(--color-brand);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.auto-estimate-btn:hover {
  background: var(--color-brand-wash);
  border-color: var(--color-brand-soft);
  color: var(--color-brand);
}
.auto-estimate-btn:focus { outline: none; }
.auto-estimate-btn:focus-visible {
  outline: none;
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px rgba(0, 97, 153, 0.2);
}
.auto-estimate-btn:active { transform: translateY(0.5px); }
.auto-estimate-btn svg { flex-shrink: 0; opacity: 0.85; }

/* ===== Related calculators (secondary, after CTAPair) ===== */
.cta-related {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px dashed var(--color-border-hairline);
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.4;
}
.cta-related-label {
  color: var(--color-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.06em;
}
.cta-related-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--color-brand);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 120ms ease;
}
.cta-related-link:hover { border-bottom-color: var(--color-brand); }
.cta-related-link:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; border-radius: 2px; }
.cta-related-link svg { opacity: 0.7; }
.cta-related-sep { color: var(--color-text-muted); opacity: 0.5; }

/* Must close the @media print block above cleanly — reopen for any later print rules if needed */
@media print {
  .auto-estimate-btn { display: none !important; }
  .pv-note { font-size: 9pt; color: #776d66; margin-bottom: 8pt; line-height: 1.45; }
  .pv-compliance { font-size: 8.5pt; color: #776d66; line-height: 1.55; }
  .pv-compliance-entity {
    color: #4a4340;
    font-weight: 600;
    margin-bottom: 3pt;
  }
  .pv-compliance-legal { color: #776d66; }
}


/* ===== Year slider field ===== */
.year-field-display {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 16px;
  background: var(--color-input-bg);
  border: 1px solid var(--color-field-edge);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}
.year-field-value {
  font-size: 22px;
  font-weight: 600;
  color: var(--color-text-heading);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.015em;
}
.year-field-unit {
  font-size: 13px;
  color: var(--color-text-muted);
}



/* ===== State property tax dropdown ===== */
.state-tax-field {}
.state-select {
  width: 100%;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 14px;
  color: var(--color-text-heading);
  background: var(--color-input-bg);
  border: 1px solid var(--color-field-edge);
  border-radius: var(--radius-sm);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%23776d66' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
  transition: border-color 0.15s;
}
.state-select:hover, .state-select:focus {
  border-color: var(--color-brand);
  outline: none;
}

/* ===== Credit score color classes ===== */
.field-value-display {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-heading);
}


/* ===== PMI drop row in amortization ===== */
.amort-pmi-drop-row td {
  padding: 0;
  background: none;
  border: none;
}
.pmi-drop-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--tone-good-ink);
  background: var(--tone-good-wash);
  border: 1px solid var(--tone-good-line);
  border-radius: 20px;
  padding: 3px 10px;
  margin: 6px 0;
}
tr.has-pmi td:first-child::after {
  content: '';
}

/* ===== Closing costs card ===== */
.closing-costs-card {
  margin: 16px 0;
  border: 1px solid var(--color-border-hairline);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.closing-costs-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--color-surface);
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  color: var(--color-text-heading);
  transition: background 0.15s;
  text-align: left;
}
.closing-costs-toggle:hover { background: var(--color-surface-alt); }
.closing-toggle-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.closing-total-inline {
  font-size: 13px;
  color: var(--color-text-muted);
  font-weight: 400;
}
.closing-chevron {
  color: var(--color-text-muted);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.closing-chevron.open { transform: rotate(180deg); }
.closing-costs-body {
  padding: 16px;
  border-top: 1px solid var(--color-border-hairline);
  background: white;
}
.closing-note {
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-bottom: 14px;
}
.closing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.closing-table td {
  padding: 7px 4px;
  border-bottom: 1px solid var(--color-border-hairline);
  color: var(--color-text-body);
}
.closing-note-cell {
  color: var(--color-text-muted);
  font-size: 12px;
}
.closing-val {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--color-text-heading);
}
.closing-total-row td {
  padding-top: 10px;
  border-top: 2px solid var(--color-border-subtle);
  border-bottom: none;
  font-weight: 600;
  color: var(--color-text-heading);
}
.closing-disclaimer {
  margin-top: 12px;
  font-size: 11px;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* ===== Mobile polish ===== */
@media (max-width: 768px) {
  /* 44px touch targets for sliders */
  .slider::-webkit-slider-thumb {
    width: 44px !important;
    height: 44px !important;
  }
  .slider::-moz-range-thumb {
    width: 44px !important;
    height: 44px !important;
  }

  /* Calc layouts stack on mobile */
  .dti-layout,
  .aff-layout,
  .heloc-layout,
  .refinance-layout,
  .consolidation-layout,
  .cashout-layout,
  .rentbuy-layout {
    grid-template-columns: 1fr !important;
  }

  /* Smaller donut on mobile — but legible */
  .donut-wrap { justify-content: center; }

  /* Input density on mobile */
  .input-section { padding: 16px; }
  .field { gap: 6px; }
}

@media (max-width: 480px) {
  .closing-table { font-size: 12px; }
  .closing-note-cell { display: none; }
}

.dp-readout {
  margin-top: 6px;
  font-size: 12px;
  color: var(--color-text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.dp-derived {
  font-variant-numeric: tabular-nums;
  color: var(--color-text-body);
}

