/* Calculator styles: mortgage */

/* ====================================
   Mortgage Calculator - 2-Step Wizard Layout
   Step 1: Your Mortgage (hero field + loan terms card + monthly costs card)
   Step 2: Pay It Off Faster (extra payments card)
   → Results
   ==================================== */

/* ── Wizard Step Fields Container ── */
.mortgage-wizard__step-fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Restart button inside results ── */
.mortgage-wizard__restart {
  margin-top: 16px;
  width: 100%;
}

/* ========== Card Component ========== */
.mortgage-card {
  background: var(--sc-card-bg, #ffffff);
  border: 1px solid var(--sc-card-border, #e5e7eb);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.mortgage-card__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--sc-input-bg, #f9fafb);
  border-bottom: 1px solid var(--sc-card-border, #e5e7eb);
}

.mortgage-card__header:empty {
  display: none;
}

.mortgage-card__icon {
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
}

.mortgage-card__title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--sc-card-text, #111827);
  letter-spacing: 0.01em;
  text-transform: none;
}

.mortgage-card__badge {
  margin-left: auto;
  padding: 2px 8px;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sc-muted-text, #6b7280);
  background: var(--sc-card-bg, #ffffff);
  border: 1px solid var(--sc-card-border, #e5e7eb);
  border-radius: 100px;
  line-height: 1.6;
}

/* Collapsible card variant */
.mortgage-card--collapsible {
  border-color: var(--sc-card-border, #e5e7eb);
}

.mortgage-card__header--toggle {
  cursor: pointer;
  width: 100%;
  border: 0;
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  text-align: left;
  color: inherit;
  transition: background 0.15s ease;
}

.mortgage-card__header--toggle:hover {
  background: var(--sc-input-bg, #f9fafb);
}

.mortgage-card__header--toggle:focus {
  outline: none;
}

.mortgage-card__header--toggle:focus-visible {
  box-shadow: inset 0 0 0 2px var(--sc-card-border, #cbd5e1);
}

.mortgage-card__header--toggle[aria-expanded="true"] {
  border-bottom: 1px solid var(--sc-card-border, #e5e7eb);
}

.mortgage-card__chevron {
  margin-left: auto;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1;
  color: var(--sc-muted-text, #6b7280);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.mortgage-card__header--toggle[aria-expanded="true"] .mortgage-card__chevron {
  transform: rotate(90deg);
}

/* When badge + chevron both present, chevron takes auto-margin */
.mortgage-card__header--toggle .mortgage-card__badge {
  margin-left: auto;
}

.mortgage-card__header--toggle .mortgage-card__chevron {
  margin-left: 8px;
}

.mortgage-card__body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mortgage-card__body[hidden] {
  display: none !important;
}

.mortgage-card__body .vareoncalc-field {
  margin-bottom: 0;
}

/* ── Card row (label + inputs) ── */
.mortgage-card__row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mortgage-card__row > label {
  display: block;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--sc-label-text, #374151);
}

/* ── 2-column grid within cards ── */
.mortgage-card__grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.mortgage-card__grid-2 .vareoncalc-field {
  margin-bottom: 0;
}

.mortgage-card__grid-2 > * {
  min-width: 0;
}

/* ── Start date (inside card) ── */
.mortgage-card__start-date {
  max-width: 220px;
}

/* ========== Hero Field (Home Price) ========== */
.mortgage-hero-field {
  margin-bottom: 0;
}

.mortgage-hero-field label {
  font-size: 0.9375rem;
  font-weight: 600;
}

.mortgage-hero-field__input {
  font-size: 1.25rem;
  font-weight: 700;
  padding: 14px 16px;
  letter-spacing: -0.01em;
}

/* ========== Down Payment Row ========== */
.mortgage-dp-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: flex-end;
}

.mortgage-dp-row__amount,
.mortgage-dp-row__percent {
  margin-bottom: 0;
}

.mortgage-dp-row__percent {
  width: 148px;
}

.mortgage-dp-row__percent .vareoncalc-input-adorned.vareoncalc-input-adorned--suffix-rail {
  --sc-stepper-zone-width: 0px;
}

.mortgage-dp-row__percent input {
  text-align: center;
  height: 48px;
  min-height: 48px;
  font-size: 1rem;
}

/* ========== Escrow Estimate Fields ========== */
.mortgage-escrow__estimate-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.mortgage-escrow__estimate-card {
  background: var(--sc-input-bg, #f9fafb);
  border: 1px solid var(--sc-card-border, #e5e7eb);
  border-radius: 10px;
  padding: 12px;
}

.mortgage-escrow__estimate-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.mortgage-escrow__estimate-header label {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--sc-card-text, #111827);
}

.mortgage-escrow__mode-toggle {
  min-width: 92px;
}

.mortgage-escrow__mode-toggle .mortgage-escrow__mode-option {
  min-width: 38px;
  padding: 3px 10px;
}

.mortgage-escrow__mode-toggle[data-mode="amount"] .mortgage-escrow__mode-option--amount,
.mortgage-escrow__mode-toggle[data-mode="percent"] .mortgage-escrow__mode-option--percent {
  color: var(--sc-button-text, #ffffff);
}

.mortgage-escrow__estimate-input-wrap {
  display: flex;
  align-items: center;
}

.mortgage-escrow__estimate-input-wrap input {
  flex: 1;
}

/* Unit indicator (sits inline inside the label) */
.mortgage-escrow__estimate-unit {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--sc-muted-text, #6b7280);
  text-transform: none;
  letter-spacing: 0;
  margin-left: 4px;
}

.mortgage-escrow__estimate-helper {
  margin-top: 4px;
}

/* ── HOA / PMI grid ── */
.mortgage-escrow__dues-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mortgage-escrow__dues-grid .vareoncalc-field {
  margin-bottom: 0;
}

/* ========== Extra Payments ========== */
.mortgage-extra__advanced {
  margin-top: 6px;
  min-width: 0;
  max-width: 100%;
}

.mortgage-extra__advanced-header {
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
}

.mortgage-extra__advanced-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mortgage-extra__advanced-fields[hidden] {
  display: none !important;
}

/* ========== Results Container ========== */
.mortgage-studio__result {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  gap: 16px;
  padding: var(--sc-card-padding);
  background: var(--sc-card-bg, #ffffff);
  border-radius: var(--sc-border-radius, 12px);
  border: 1px solid var(--sc-card-border, #e5e7eb);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.mortgage-studio__result.has-result .mortgage-studio__empty {
  display: none;
}

/* Empty state */
.mortgage-studio__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  color: var(--sc-muted-text, #6b7280);
  padding: var(--sc-card-padding);
}

.mortgage-studio__empty-icon {
  font-size: 48px;
  opacity: 0.5;
  line-height: 1;
}

.mortgage-studio__empty-text {
  font-size: 0.9375rem;
  opacity: 0.7;
  max-width: 200px;
}

/* ========== Results Section ========== */

/* --- Hero: Monthly Payment --- */
.mortgage-results__hero {
  text-align: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--sc-card-border, #e5e7eb);
}

.mortgage-results__hero-eyebrow {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sc-muted-text, #6b7280);
  margin-bottom: 4px;
}

.mortgage-results__hero-amount {
  font-size: 2.75rem;
  font-weight: 800;
  color: var(--sc-hero-accent, #3b82f6);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.mortgage-results__hero-period {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--sc-muted-text, #6b7280);
  margin-top: 2px;
}

.mortgage-results__hero-detail {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 0.8125rem;
}

.mortgage-results__hero-detail-item {
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--sc-card-text, #111827);
  font-weight: 500;
  white-space: nowrap;
}

.mortgage-results__hero-detail-item--extra {
  background: rgba(34, 197, 94, 0.1);
  color: #16a34a;
}

.mortgage-results__hero-detail-sep {
  color: var(--sc-muted-text, #6b7280);
  font-weight: 600;
}

/* --- Breakdown: Donut + Legend --- */
.mortgage-results__breakdown {
  padding: var(--sc-card-padding) 0;
}

.mortgage-results__breakdown-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sc-muted-text, #6b7280);
  text-align: center;
  margin-bottom: 12px;
}

.mortgage-results__breakdown-chart {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}

.mortgage-results__donut {
  position: relative;
  width: 150px;
  height: 150px;
  flex-shrink: 0;
}

.mortgage-donut__svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.mortgage-donut__segment {
  transition: stroke-dasharray 0.5s ease, stroke-dashoffset 0.5s ease;
}

.mortgage-donut__labels-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mortgage-donut__labels-col--left {
  align-items: flex-end;
  text-align: right;
}

.mortgage-donut__labels-col--right {
  align-items: flex-start;
  text-align: left;
}

.mortgage-donut__label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mortgage-donut__label-line {
  font-size: 0.8125rem;
  color: var(--sc-card-text, #111827);
}

.mortgage-donut__label-name {
  font-weight: 600;
}

.mortgage-donut__label-pct {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--sc-card-text, #111827);
}

.mortgage-results__legend-fallback {
  display: none;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.mortgage-results__legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--sc-card-bg, #ffffff);
  border-radius: 8px;
  border: 1px solid var(--sc-card-border, #e5e7eb);
}

.mortgage-results__legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.mortgage-results__legend-name {
  font-size: 0.8125rem;
  color: var(--sc-muted-text, #6b7280);
  flex: 1;
}

.mortgage-results__legend-amount {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--sc-card-text, #111827);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mortgage-results__legend-pct {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--sc-muted-text, #6b7280);
  min-width: 32px;
  text-align: right;
}

/* --- Loan Metrics Grid (2x2 cards) --- */
.mortgage-results__metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mortgage-results__metric-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 14px 12px;
  background: var(--sc-input-bg, #f8fafc);
  border: 1px solid var(--sc-card-border, #e5e7eb);
  border-radius: 10px;
}

.mortgage-results__metric-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #3b82f6;
  flex-shrink: 0;
}

.mortgage-results__metric-icon svg {
  width: 20px;
  height: 20px;
}

.mortgage-results__metric-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.mortgage-results__metric-label {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--sc-muted-text, #6b7280);
  line-height: 1.3;
}

.mortgage-results__metric-value {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--sc-card-text, #111827);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mortgage-results__metric-unit {
  font-weight: 500;
  font-size: 0.75rem;
  color: var(--sc-muted-text, #6b7280);
}

.mortgage-results__metric-sub {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--sc-muted-text, #6b7280);
  margin-top: 1px;
}

/* --- Amortization Chart --- */
.mortgage-results__amort {
  padding: 16px 0;
}

.mortgage-results__amort-header {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--sc-muted-text, #6b7280);
  margin-bottom: 12px;
  text-align: center;
}

.mortgage-results__amort-chart {
  width: 100%;
  position: relative;
}

.mortgage-amortization__svg {
  width: 100%;
  height: auto;
}

.mortgage-amortization__label,
.mortgage-amortization__axis-label {
  font-size: 0.6875rem;
  fill: var(--sc-muted-text, #6b7280);
}

.mortgage-amortization__ylabel {
  font-size: 0.625rem;
  fill: var(--sc-muted-text, #6b7280);
}

.mortgage-amortization__gridline {
  stroke: rgba(148, 163, 184, 0.3);
  stroke-width: 1;
}

.mortgage-amortization__crossover {
  stroke: var(--sc-card-border, #e5e7eb);
  stroke-dasharray: 4 4;
  stroke-width: 1;
}

.mortgage-amortization__crosshair {
  stroke: rgba(148, 163, 184, 0.75);
  stroke-width: 1.2;
  stroke-dasharray: 4 4;
  pointer-events: none;
}

.mortgage-amortization__dot {
  pointer-events: none;
  stroke: var(--sc-card-bg, #ffffff);
  stroke-width: 2;
}

.mortgage-amortization__dot--principal {
  fill: var(--vareoncalc-chart-principal, #3b82f6);
}

.mortgage-amortization__dot--interest {
  fill: var(--vareoncalc-chart-interest, #f97316);
}

.mortgage-amortization__tooltip {
  position: absolute;
  z-index: 6;
  min-width: 156px;
  background: var(--sc-card-bg, #ffffff);
  border: 1px solid var(--sc-card-border, #d1d5db);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.14);
  padding: 8px 10px;
  font-size: 12px;
  color: var(--sc-card-text, #111827);
  display: none;
  pointer-events: none;
}

.mortgage-amortization__tooltip-year {
  font-weight: 700;
  margin-bottom: 6px;
}

.mortgage-amortization__tooltip-row {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: 6px;
}

.mortgage-amortization__tooltip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.mortgage-amortization__tooltip-dot--principal {
  background: var(--vareoncalc-chart-principal, #3b82f6);
}

.mortgage-amortization__tooltip-dot--interest {
  background: var(--vareoncalc-chart-interest, #f97316);
}

.mortgage-amortization__tooltip-label {
  color: var(--sc-muted-text, #6b7280);
}

.mortgage-amortization__tooltip-value {
  font-weight: 600;
}

.mortgage-amortization__crossover-point {
  fill: var(--sc-card-bg, #ffffff);
  stroke: var(--sc-card-text, #111827);
  stroke-width: 2;
}

.mortgage-amortization__crossover-label {
  font-size: 0.625rem;
  font-weight: 600;
  fill: var(--sc-card-text, #111827);
  paint-order: stroke;
  stroke: var(--sc-card-bg, #ffffff);
  stroke-width: 3;
  stroke-linejoin: round;
}

.mortgage-results__amort-legend {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 10px;
  font-size: 0.8125rem;
  color: var(--sc-muted-text, #6b7280);
  flex-wrap: wrap;
}

.mortgage-results__amort-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mortgage-results__amort-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.mortgage-results__amort-dot--principal {
  background: var(--vareoncalc-chart-principal, #3b82f6);
}

.mortgage-results__amort-dot--interest {
  background: var(--vareoncalc-chart-interest, #f97316);
}

/* --- Total Cost Cards --- */
.mortgage-results__cost {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mortgage-results__cost-card {
  padding: 14px;
  border-radius: 10px;
  background: var(--sc-card-bg, #ffffff);
  border: 1px solid var(--sc-card-border, #e5e7eb);
}

.mortgage-results__cost-card--solo {
  grid-column: 1 / -1;
}

.mortgage-results__cost-card--extra {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.05) 0%, rgba(34, 197, 94, 0.1) 100%);
  border-color: rgba(34, 197, 94, 0.25);
}

.mortgage-results__cost-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sc-muted-text, #6b7280);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--sc-card-border, #e5e7eb);
}

.mortgage-results__cost-card--extra .mortgage-results__cost-title {
  color: #16a34a;
  border-color: rgba(34, 197, 94, 0.2);
}

.mortgage-results__cost-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mortgage-results__cost-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
}

.mortgage-results__cost-label {
  color: var(--sc-muted-text, #6b7280);
}

.mortgage-results__cost-value {
  font-weight: 600;
  color: var(--sc-card-text, #111827);
}

/* --- Savings Banner --- */
.mortgage-results__savings {
  padding: 16px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.06) 0%, rgba(34, 197, 94, 0.12) 100%);
  border: 1px solid rgba(34, 197, 94, 0.2);
  text-align: center;
}

.mortgage-results__savings-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #16a34a;
  margin-bottom: 10px;
}

.mortgage-results__savings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mortgage-results__savings-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.mortgage-results__savings-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #16a34a;
  margin-bottom: 2px;
}

.mortgage-results__savings-icon svg {
  width: 18px;
  height: 18px;
}

.mortgage-results__savings-amount {
  font-size: 1.125rem;
  font-weight: 700;
  color: #16a34a;
}

.mortgage-results__savings-label {
  font-size: 0.75rem;
  color: var(--sc-muted-text, #6b7280);
}

/* --- Mobile Results Tabs (<=460px rendering path) --- */
.mortgage-results-tabs {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mortgage-results-tabs__header {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 6px;
  border: 1px solid var(--sc-card-border, #e5e7eb);
  border-radius: 12px;
  background: var(--sc-input-bg, #f3f4f6);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.mortgage-results-tabs__header::-webkit-scrollbar {
  display: none;
}

.mortgage-results-tab {
  flex: 1 1 auto;
  min-width: 84px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--sc-muted-text, #6b7280);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.mortgage-results-tab:hover {
  color: var(--sc-card-text, #111827);
}

.mortgage-results-tab--active {
  color: var(--sc-accent, #3b82f6);
  border-color: var(--sc-card-border, #d1d5db);
  background: var(--sc-card-bg, #ffffff);
}

.mortgage-results-panel[hidden] {
  display: none !important;
}

/* ========== Dark Theme ========== */
.vareoncalc-root.theme-dark .mortgage-card,
.vareoncalc-root[data-theme="dark"] .mortgage-card {
  background: var(--sc-card-bg, #1f2937);
  border-color: rgba(255, 255, 255, 0.1);
}

.vareoncalc-root.theme-dark .mortgage-card__header,
.vareoncalc-root[data-theme="dark"] .mortgage-card__header {
  background: rgba(0, 0, 0, 0.15);
  border-color: rgba(255, 255, 255, 0.08);
}

.vareoncalc-root.theme-dark .mortgage-card__header--toggle:hover,
.vareoncalc-root[data-theme="dark"] .mortgage-card__header--toggle:hover {
  background: rgba(255, 255, 255, 0.05);
}

.vareoncalc-root.theme-dark .mortgage-card__header--toggle:focus-visible,
.vareoncalc-root[data-theme="dark"] .mortgage-card__header--toggle:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.14);
}

.vareoncalc-root.theme-dark .mortgage-card__badge,
.vareoncalc-root[data-theme="dark"] .mortgage-card__badge {
  background: rgba(0, 0, 0, 0.2);
  border-color: rgba(255, 255, 255, 0.1);
}

.vareoncalc-root.theme-dark .mortgage-escrow__estimate-card,
.vareoncalc-root[data-theme="dark"] .mortgage-escrow__estimate-card {
  background: rgba(0, 0, 0, 0.12);
  border-color: rgba(255, 255, 255, 0.08);
}

.vareoncalc-root.theme-dark .mortgage-studio__result,
.vareoncalc-root[data-theme="dark"] .mortgage-studio__result {
  background: var(--sc-card-bg, #1f2937);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.vareoncalc-root.theme-dark .mortgage-results__hero-detail-item,
.vareoncalc-root[data-theme="dark"] .mortgage-results__hero-detail-item {
  background: rgba(0, 0, 0, 0.2);
}

.vareoncalc-root.theme-dark .mortgage-results__hero-detail-item--extra,
.vareoncalc-root[data-theme="dark"] .mortgage-results__hero-detail-item--extra {
  background: rgba(34, 197, 94, 0.15);
}

.vareoncalc-root.theme-dark .mortgage-donut__label-line,
.vareoncalc-root[data-theme="dark"] .mortgage-donut__label-line,
.vareoncalc-root.theme-dark .mortgage-donut__label-pct,
.vareoncalc-root[data-theme="dark"] .mortgage-donut__label-pct {
  color: var(--sc-card-text, #e5e7eb);
}

.vareoncalc-root.theme-dark .mortgage-results__legend-row,
.vareoncalc-root[data-theme="dark"] .mortgage-results__legend-row {
  background: rgba(0, 0, 0, 0.15);
  border-color: rgba(255, 255, 255, 0.1);
}

.vareoncalc-root.theme-dark .mortgage-results__metric-card,
.vareoncalc-root[data-theme="dark"] .mortgage-results__metric-card {
  background: rgba(0, 0, 0, 0.15);
  border-color: rgba(255, 255, 255, 0.1);
}

.vareoncalc-root.theme-dark .mortgage-results__metric-icon,
.vareoncalc-root[data-theme="dark"] .mortgage-results__metric-icon {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
}

.vareoncalc-root.theme-dark .mortgage-results__savings-icon,
.vareoncalc-root[data-theme="dark"] .mortgage-results__savings-icon {
  background: rgba(34, 197, 94, 0.15);
}

.vareoncalc-root.theme-dark .mortgage-results__cost-card,
.vareoncalc-root[data-theme="dark"] .mortgage-results__cost-card {
  background: rgba(0, 0, 0, 0.15);
  border-color: rgba(255, 255, 255, 0.1);
}

.vareoncalc-root.theme-dark .mortgage-results__cost-card--extra,
.vareoncalc-root[data-theme="dark"] .mortgage-results__cost-card--extra {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.2);
}

.vareoncalc-root.theme-dark .mortgage-results__savings,
.vareoncalc-root[data-theme="dark"] .mortgage-results__savings {
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.15);
}

.vareoncalc-root.theme-dark .mortgage-results-tabs__header,
.vareoncalc-root[data-theme="dark"] .mortgage-results-tabs__header {
  background: var(--sc-input-bg, #1f2937);
  border-color: rgba(255, 255, 255, 0.1);
}

.vareoncalc-root.theme-dark .mortgage-results-tab,
.vareoncalc-root[data-theme="dark"] .mortgage-results-tab {
  color: var(--sc-muted-text, #9ca3af);
}

.vareoncalc-root.theme-dark .mortgage-results-tab:hover,
.vareoncalc-root[data-theme="dark"] .mortgage-results-tab:hover {
  color: var(--sc-card-text, #f3f4f6);
}

.vareoncalc-root.theme-dark .mortgage-results-tab--active,
.vareoncalc-root[data-theme="dark"] .mortgage-results-tab--active {
  color: var(--sc-accent, #60a5fa);
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
}

.vareoncalc-root.theme-dark .mortgage-amortization__crossover-label,
.vareoncalc-root[data-theme="dark"] .mortgage-amortization__crossover-label {
  fill: var(--sc-card-text, #e5e7eb);
  stroke: var(--sc-card-bg, #1f2937);
}

.vareoncalc-root.theme-dark .mortgage-amortization__gridline,
.vareoncalc-root[data-theme="dark"] .mortgage-amortization__gridline {
  stroke: rgba(148, 163, 184, 0.25);
}

.vareoncalc-root.theme-dark .mortgage-amortization__tooltip,
.vareoncalc-root[data-theme="dark"] .mortgage-amortization__tooltip {
  background: var(--sc-card-bg, #1f2937);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 10px 24px rgba(2, 6, 23, 0.45);
}

/* ========== Responsive ========== */
@media (max-width: 560px) {
  .mortgage-card__grid-2 {
    grid-template-columns: 1fr;
  }

  .mortgage-escrow__dues-grid {
    grid-template-columns: 1fr;
  }

  .mortgage-escrow__estimate-header {
    align-items: flex-start;
  }

  .mortgage-dp-row {
    grid-template-columns: 1fr 120px;
  }

  .mortgage-card__start-date {
    max-width: 100%;
  }

  .mortgage-donut__labels-col {
    display: none;
  }

  .mortgage-results__breakdown-chart {
    display: flex;
    justify-content: center;
  }

  .mortgage-results__legend-fallback {
    display: flex;
  }

  .mortgage-results__donut {
    width: 120px;
    height: 120px;
  }

  .mortgage-results__metrics-grid {
    grid-template-columns: 1fr 1fr;
  }

  .mortgage-results__cost {
    grid-template-columns: 1fr;
  }

  .mortgage-results__savings-grid {
    grid-template-columns: 1fr;
  }

  .mortgage-results__hero-detail {
    flex-direction: column;
    gap: 4px;
  }

  .mortgage-results__hero-detail-sep {
    display: none;
  }
}

@media (max-width: 400px) {
  .mortgage-results__hero-amount {
    font-size: 2rem;
  }

  .mortgage-results__donut {
    width: 100px;
    height: 100px;
  }

  .mortgage-card__body {
    padding: 12px;
  }
}

@media (max-width: 460px) {
  .mortgage-studio__result {
    padding: 16px;
    gap: 14px;
  }
}

@media (max-width: 410px) {
  .mortgage-card__body {
    padding: 14px;
  }

  .mortgage-extra__advanced {
    padding: 10px;
  }

  .mortgage-extra__advanced-fields {
    gap: 10px;
  }

  .mortgage-dp-row,
  .mortgage-results__metrics-grid,
  .mortgage-results__cost,
  .mortgage-results__savings-grid {
    grid-template-columns: 1fr;
  }

  .mortgage-results__hero-amount {
    font-size: 2rem;
  }

  .mortgage-results__legend-row {
    padding: 6px 10px;
    gap: 8px;
  }

  .mortgage-results__legend-name {
    font-size: 0.75rem;
  }

  .mortgage-results__legend-amount {
    font-size: 0.8125rem;
  }

  .mortgage-results__legend-pct {
    display: none;
  }

  .mortgage-results__metric-value {
    font-size: 0.875rem;
  }

  .mortgage-studio__result {
    padding: 14px;
    gap: 12px;
  }
}

@media (max-width: 360px) {
  .mortgage-results__hero-amount {
    font-size: 1.85rem;
  }

  .mortgage-card__body,
  .mortgage-studio__result {
    padding: 12px;
  }

  .mortgage-extra__advanced {
    padding: 8px;
  }

  .mortgage-extra__advanced-fields {
    gap: 8px;
  }

  .mortgage-results__donut {
    width: 90px;
    height: 90px;
  }

  .mortgage-results__legend-row {
    padding: 5px 8px;
    gap: 6px;
  }

  .mortgage-results__legend-name {
    font-size: 0.6875rem;
  }

  .mortgage-results__legend-amount {
    font-size: 0.75rem;
  }

  .mortgage-results__metric-card {
    padding: 10px 12px;
    gap: 8px;
  }

  .mortgage-results__metric-value {
    font-size: 0.8125rem;
  }

  .mortgage-results__cost-row {
    font-size: 0.75rem;
  }
}

@container vareoncalc (max-width: 560px) {
  .mortgage-card__grid-2 {
    grid-template-columns: 1fr;
  }

  .mortgage-escrow__dues-grid {
    grid-template-columns: 1fr;
  }

  .mortgage-escrow__estimate-header {
    align-items: flex-start;
  }

  .mortgage-dp-row {
    grid-template-columns: 1fr 120px;
  }

  .mortgage-card__start-date {
    max-width: 100%;
  }

  .mortgage-donut__labels-col {
    display: none;
  }

  .mortgage-results__breakdown-chart {
    display: flex;
    justify-content: center;
  }

  .mortgage-results__legend-fallback {
    display: flex;
  }

  .mortgage-results__donut {
    width: 120px;
    height: 120px;
  }

  .mortgage-results__metrics-grid {
    grid-template-columns: 1fr 1fr;
  }

  .mortgage-results__cost {
    grid-template-columns: 1fr;
  }

  .mortgage-results__savings-grid {
    grid-template-columns: 1fr;
  }

  .mortgage-results__hero-detail {
    flex-direction: column;
    gap: 4px;
  }

  .mortgage-results__hero-detail-sep {
    display: none;
  }
}

@container vareoncalc (max-width: 410px) {
  .mortgage-card__body {
    padding: 14px;
  }

  .mortgage-extra__advanced {
    padding: 10px;
  }

  .mortgage-extra__advanced-fields {
    gap: 10px;
  }

  .mortgage-dp-row,
  .mortgage-results__metrics-grid,
  .mortgage-results__cost,
  .mortgage-results__savings-grid {
    grid-template-columns: 1fr;
  }

  .mortgage-results__hero-amount {
    font-size: 2rem;
  }

  .mortgage-results__legend-row {
    padding: 6px 10px;
    gap: 8px;
  }

  .mortgage-results__legend-name {
    font-size: 0.75rem;
  }

  .mortgage-results__legend-amount {
    font-size: 0.8125rem;
  }

  .mortgage-results__legend-pct {
    display: none;
  }

  .mortgage-results__metric-value {
    font-size: 0.875rem;
  }

  .mortgage-studio__result {
    padding: 14px;
    gap: 12px;
  }
}

@container vareoncalc (max-width: 360px) {
  .mortgage-results__hero-amount {
    font-size: 1.85rem;
  }

  .mortgage-card__body,
  .mortgage-studio__result {
    padding: 12px;
  }

  .mortgage-extra__advanced {
    padding: 8px;
  }

  .mortgage-extra__advanced-fields {
    gap: 8px;
  }

  .mortgage-results__donut {
    width: 90px;
    height: 90px;
  }

  .mortgage-results__legend-row {
    padding: 5px 8px;
    gap: 6px;
  }

  .mortgage-results__legend-name {
    font-size: 0.6875rem;
  }

  .mortgage-results__legend-amount {
    font-size: 0.75rem;
  }

  .mortgage-results__metric-card {
    padding: 10px 12px;
    gap: 8px;
  }

  .mortgage-results__metric-value {
    font-size: 0.8125rem;
  }

  .mortgage-results__cost-row {
    font-size: 0.75rem;
  }
}
