/* ══ Mortgage Calculator Plugin v3.3.0 – Homes By Abner Corp ══ */
:root {
  --mpc-brand: #4a3fc0;
  --mpc-brand-dark: #3730a3;
  --mpc-radius: 12px;
  --mpc-border: #e5e7eb;
  --mpc-text: #111827;
  --mpc-muted: #6b7280;
  --mpc-light: #f9fafb;
}

/* ── Root wrapper ── */
* { -webkit-tap-highlight-color: transparent; box-sizing: border-box; }
.mpc-root, .mpc-root * { max-width: 100%; }

.mpc-root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: var(--mpc-text);
  background: #f3f4f8;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 20px rgba(0,0,0,.10);
  max-width: 1020px;
  margin: 0 auto 32px;
}

/* ── Top-level tabs (pill style) ── */
.mpc-top-tabs {
  display: flex;
  background: #f7f7f9;
  padding: 10px 14px;
  gap: 4px;
  align-items: center;
  border-bottom: 1px solid #ebebeb;
}
.mpc-top-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: none;
  border-radius: 100px;
  color: var(--mpc-brand);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 16px;
  cursor: pointer;
  white-space: nowrap;
  opacity: .55;
  transition: opacity .15s;
  letter-spacing: -.1px;
}
.mpc-top-tab:hover { opacity: .8; }
.mpc-top-tab--active {
  background: #fff;
  border: 1.5px solid var(--mpc-brand);
  color: var(--mpc-brand);
  opacity: 1;
  font-weight: 600;
}
.mpc-top-tab--active .mpc-tab-dot { display: inline-block; }
.mpc-tab-dot {
  display: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mpc-brand);
  flex-shrink: 0;
}

.mpc-top-panel { display: none; }
.mpc-top-panel--active { display: block; }

/* ── Inner card (white, single unified card) ── */
.mpc-card {
  background: #fff;
  margin: 20px;
  border-radius: var(--mpc-radius);
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
  overflow: hidden;
  display: grid;
  grid-template-columns: 320px 1fr;
}

/* ── Left: Inputs panel ── */
.mpc-inputs {
  background: #fff;
  border-right: 1px solid var(--mpc-border);
  padding: 28px 24px;
}
.mpc-inputs__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--mpc-text);
  margin: 0 0 20px;
}
.mpc-inputs__sub {
  font-size: 12px;
  color: var(--mpc-muted);
  margin: -14px 0 18px;
  line-height: 1.5;
}
.mpc-optional { font-weight: 400; color: #9ca3af; font-size: 11px; }

.mpc-field { margin-bottom: 16px; }
.mpc-field label {
  display: block;
  font-size: 13px;
  color: var(--mpc-text);
  margin-bottom: 6px;
  font-weight: 400;
}

/* Input rows — dollar prefix inside, right-aligned numbers */
.mpc-input-row {
  display: flex;
  align-items: center;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.mpc-input-row:focus-within {
  border-color: var(--mpc-brand);
  box-shadow: 0 0 0 3px rgba(74,63,192,.12);
}
.mpc-prefix {
  padding: 0 10px;
  font-size: 13px;
  color: var(--mpc-muted);
  background: #fff;
  height: 40px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  border-right: 1px solid #e5e7eb;
}
.mpc-suffix {
  padding: 0 12px;
  font-size: 13px;
  color: var(--mpc-muted);
  background: #fff;
  height: 40px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  border-left: 1px solid #e5e7eb;
}
.mpc-input-row input[type="number"] {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  font-size: 14px;
  font-weight: 400;
  color: var(--mpc-text);
  background: transparent;
  padding: 0 12px;
  width: 100%;
  height: 40px;
  text-align: right;
  -moz-appearance: textfield;
}
.mpc-input-row input[type="number"]::-webkit-outer-spin-button,
.mpc-input-row input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }

.mpc-select, .mpc-date-field {
  width: 100%;
  height: 40px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 0 12px;
  font-size: 14px;
  color: var(--mpc-text);
  background: #fff;
  outline: none;
  cursor: pointer;
  transition: border-color .15s;
  -webkit-appearance: auto;
  appearance: auto;
}
.mpc-select:focus, .mpc-date-field:focus {
  border-color: var(--mpc-brand);
  box-shadow: 0 0 0 3px rgba(74,63,192,.12);
}

/* Slider */
.mpc-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: #e5e7eb;
  outline: none;
  cursor: pointer;
  margin-top: 10px;
  display: block;
}
.mpc-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--mpc-brand);
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(74,63,192,.4);
}
.mpc-slider::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--mpc-brand);
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(74,63,192,.4);
}

/* Advanced Options */
.mpc-advanced {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  overflow: hidden;
  margin-top: 6px;
  background: #fff;
}
.mpc-advanced summary {
  padding: 11px 14px;
  font-size: 13px;
  color: var(--mpc-brand);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  font-weight: 500;
}
.mpc-advanced summary::-webkit-details-marker { display: none; }
.mpc-advanced summary::after { content: '+'; font-size: 18px; font-weight: 300; line-height: 1; }
.mpc-advanced[open] summary::after { content: '−'; }
.mpc-advanced__body { padding: 4px 14px 14px; border-top: 1px solid #e5e7eb; }

.mpc-credit-note {
  font-size: 11px;
  color: var(--mpc-muted);
  margin-top: 5px;
  padding: 5px 9px;
  background: #f3f4f6;
  border-radius: 5px;
  line-height: 1.4;
}
.mpc-reset {
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 12px;
  cursor: pointer;
  padding: 14px 0 0;
  display: block;
}
.mpc-reset:hover { color: var(--mpc-muted); text-decoration: underline; }

/* ── Right: Results panel ── */
.mpc-results { display: flex; flex-direction: column; }

/* Inner tabs (pill style) */
.mpc-tabs {
  display: flex;
  background: #f7f7f9;
  padding: 10px 14px;
  gap: 4px;
  align-items: center;
  border-bottom: 1px solid #ebebeb;
}
.mpc-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: none;
  border-radius: 100px;
  color: var(--mpc-brand);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 16px;
  cursor: pointer;
  white-space: nowrap;
  opacity: .55;
  transition: opacity .15s;
  letter-spacing: -.1px;
}
.mpc-tab:hover { opacity: .8; }
.mpc-tab--active {
  background: #fff;
  border: 1.5px solid var(--mpc-brand);
  color: var(--mpc-brand);
  opacity: 1;
  font-weight: 600;
}
.mpc-tab--active .mpc-tab-dot { display: inline-block; }

.mpc-panel { display: none; padding: 24px; flex-direction: column; gap: 20px; }
.mpc-panel--active { display: flex; }

/* ── Payment Breakdown tab ── */
.mpc-breakdown-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  align-items: start;
}

.mpc-monthly-label { font-size: 22px; font-weight: 700; margin-bottom: 2px; color: var(--mpc-text); }
.mpc-monthly-sub { font-size: 12px; color: var(--mpc-muted); margin-bottom: 16px; }

.mpc-donut-container { position: relative; width: 200px; height: 200px; }
.mpc-donut-center {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  text-align: center; pointer-events: none;
}
.mpc-donut-center span { font-size: 22px; font-weight: 700; display: block; line-height: 1.1; color: var(--mpc-text); }
.mpc-donut-center small { font-size: 11px; color: var(--mpc-muted); }

/* Breakdown list */
.mpc-breakdown-list { padding-top: 4px; }
.mpc-breakdown-list h4 { font-size: 14px; font-weight: 700; margin-bottom: 14px; color: var(--mpc-text); }

.mpc-breakdown-items { list-style: none; padding: 0; margin: 0; }
.mpc-breakdown-items li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 13px;
}
.mpc-breakdown-items li:last-child { border-bottom: none; }
.mpc-breakdown-items li > .mpc-item-label { flex: 1; color: var(--mpc-text); }
.mpc-breakdown-items li > strong { font-size: 13px; font-weight: 600; color: var(--mpc-text); }

/* Inline editable fields in breakdown */
.mpc-inline-edit {
  display: flex;
  align-items: center;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  transition: border-color .15s;
}
.mpc-inline-edit:focus-within { border-color: var(--mpc-brand); }
.mpc-inline-edit > span {
  padding: 0 8px;
  font-size: 12px;
  color: var(--mpc-muted);
  background: #fff;
  height: 32px;
  display: flex;
  align-items: center;
  border-right: 1px solid #e5e7eb;
}
.mpc-inline-edit input {
  border: none !important;
  outline: none !important;
  width: 70px;
  height: 32px;
  font-size: 13px;
  font-weight: 400;
  color: var(--mpc-text);
  padding: 0 8px;
  text-align: right;
  background: #fff;
  -moz-appearance: textfield;
}
.mpc-inline-edit input::-webkit-outer-spin-button,
.mpc-inline-edit input::-webkit-inner-spin-button { -webkit-appearance: none; }

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

.mpc-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0 0;
  border-top: 1.5px solid #e5e7eb;
  margin-top: 2px;
  font-size: 15px;
  font-weight: 700;
  color: var(--mpc-text);
}

/* Additional Filters accordion */
.mpc-accordion {
  border: 1px solid var(--mpc-border);
  border-radius: 8px;
  overflow: hidden;
}
.mpc-accordion summary {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--mpc-brand);
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 500;
}
.mpc-accordion summary::-webkit-details-marker { display: none; }
.mpc-accordion summary::after { content: '▾'; font-size: 11px; }
.mpc-accordion[open] summary::after { content: '▴'; }
.mpc-accordion__body { padding: 12px 16px; border-top: 1px solid var(--mpc-border); font-size: 12px; color: var(--mpc-muted); }

/* Loan Summary card in breakdown tab */
.mpc-loan-summary-card {
  border: 1px solid var(--mpc-border);
  border-radius: 8px;
  overflow: hidden;
}
.mpc-loan-summary-card__title {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--mpc-brand);
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--mpc-light);
  border-bottom: 1px solid var(--mpc-border);
}
.mpc-summary-list { list-style: none; padding: 8px 16px 12px 16px; margin: 0; }
.mpc-summary-list li { display: flex; align-items: center; gap: 8px; padding: 8px 0; font-size: 13px; border-bottom: 1px solid #f9fafb; }
.mpc-summary-list li:last-child { border-bottom: none; }
.mpc-summary-list li > .mpc-sum-label { flex: 1; color: var(--mpc-muted); }
.mpc-summary-list li > strong { font-size: 13px; font-weight: 600; text-align: right; padding-right: 2px; }

/* ── Loan Summary tab ── */
.mpc-summary-top { display: grid; grid-template-columns: 1fr 230px; gap: 16px; align-items: start; }
.mpc-loan-info h4, .mpc-extra-payment h4 { font-size: 13px; font-weight: 700; margin-bottom: 12px; color: var(--mpc-text); }

.mpc-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mpc-stat {
  background: #fff;
  border: 1px solid var(--mpc-border);
  border-radius: 8px;
  padding: 14px 16px;
}
.mpc-stat__val { font-size: 20px; font-weight: 700; color: var(--mpc-text); margin-bottom: 3px; }
.mpc-stat__label { font-size: 12px; color: var(--mpc-text); font-weight: 600; }
.mpc-stat__sub { font-size: 11px; color: #9ca3af; margin-top: 2px; }

.mpc-extra-payment {
  background: var(--mpc-light);
  border: 1px solid var(--mpc-border);
  border-radius: 8px;
  padding: 16px;
}
.mpc-extra-payment p { font-size: 12px; color: var(--mpc-muted); margin-bottom: 12px; line-height: 1.6; }

/* Chart header + subtabs */
.mpc-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--mpc-border);
  margin-bottom: 0;
}
.mpc-subtabs { display: flex; }
.mpc-subtab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 12px 18px;
  font-size: 13px;
  color: var(--mpc-muted);
  cursor: pointer;
  font-weight: 500;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}
.mpc-subtab:hover { color: var(--mpc-brand); }
.mpc-subtab--active { color: var(--mpc-brand); border-bottom-color: var(--mpc-brand); font-weight: 600; }

.mpc-export {
  background: none;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--mpc-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 500;
}
.mpc-export:hover { background: var(--mpc-light); }

.mpc-subpanel { display: none; padding-top: 16px; }
.mpc-subpanel--active { display: block; }

.mpc-chart-legend {
  display: flex;
  gap: 20px;
  justify-content: center;
  font-size: 12px;
  color: var(--mpc-text);
  margin-top: 12px;
}
.mpc-chart-legend span { display: flex; align-items: center; gap: 6px; }
.mpc-chart-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 2px; flex-shrink: 0; }

/* Amortization */
.mpc-amort-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}
.mpc-amort-year-select {
  height: 32px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 0 10px;
  font-size: 12px;
  color: var(--mpc-text);
  background: #fff;
  outline: none;
  margin-left: 6px;
  cursor: pointer;
}
.mpc-view-toggle { display: flex; align-items: center; }
.mpc-view-btn {
  background: none;
  border: none;
  font-size: 12px;
  padding: 4px 8px;
  cursor: pointer;
  color: var(--mpc-muted);
  border-bottom: 2px solid transparent;
}
.mpc-view-btn--active { color: var(--mpc-brand); font-weight: 600; border-bottom-color: var(--mpc-brand); }

.mpc-amort-wrap { overflow-x: auto; max-height: 340px; overflow-y: auto; border: 1px solid var(--mpc-border); border-radius: 8px; }
.mpc-amort-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.mpc-amort-table th {
  background: var(--mpc-light);
  padding: 10px 14px;
  text-align: right;
  font-weight: 600;
  color: var(--mpc-muted);
  position: sticky;
  top: 0;
  border-bottom: 1px solid var(--mpc-border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.mpc-amort-table th:first-child { text-align: left; }
.mpc-amort-table td { padding: 9px 14px; text-align: right; border-bottom: 1px solid #f3f4f6; color: #374151; }
.mpc-amort-table td:first-child { text-align: left; font-weight: 500; color: var(--mpc-text); }
.mpc-amort-table tr:last-child td { border-bottom: none; }
.mpc-amort-table tr:hover td { background: #fafafa; }

/* CTA bar */
.mpc-cta-bar {
  text-align: center;
  padding: 28px 32px 24px;
  border-top: 1px solid var(--mpc-border);
  margin-top: 4px;
}
.mpc-cta-bar p {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.6;
  margin-bottom: 18px;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
  color: var(--mpc-text);
}
.mpc-cta-btn {
  display: inline-block;
  background: var(--mpc-brand);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 13px 32px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s;
  letter-spacing: .1px;
}
.mpc-cta-btn:hover { background: var(--mpc-brand-dark); transform: translateY(-1px); }
.mpc-cta-btn:active { transform: scale(.98); }

/* Transfer buttons */
.mpc-transfer-btn {
  display: block;
  width: 100%;
  margin-top: 16px;
  background: var(--mpc-brand);
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s;
  text-align: center;
}
.mpc-transfer-btn:hover { background: var(--mpc-brand-dark); transform: translateY(-1px); }
.mpc-transfer-btn--amber { background: #d97706; }
.mpc-transfer-btn--amber:hover { background: #b45309; }

/* Footer / disclosure */
.mpc-footer-area {
  background: #fff;
  margin: 0 20px 20px;
  border-radius: 0 0 var(--mpc-radius) var(--mpc-radius);
  border: 1px solid var(--mpc-border);
  border-top: none;
}
.mpc-disclosure {
  font-size: 11px;
  color: #9ca3af;
  line-height: 1.7;
  text-align: center;
  padding: 12px 28px 14px;
}

/* ══ Affordability results (right panel) ══ */
.mpc-afford-results {
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.mpc-afford-results__title { font-size: 15px; font-weight: 700; color: var(--mpc-text); }

.mpc-result-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mpc-result-card { border-radius: 10px; padding: 22px; border: 1px solid var(--mpc-border); }
.mpc-result-card--green { background: #f0fdf4; border-color: #86efac; }
.mpc-result-card--amber { background: #fffbeb; border-color: #fcd34d; }

.mpc-result-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 5px 13px;
  border-radius: 20px;
  margin-bottom: 14px;
  letter-spacing: .6px;
  text-transform: uppercase;
}
.mpc-badge-green { background: #16a34a; color: #fff; }
.mpc-badge-amber { background: #d97706; color: #fff; }

.mpc-result-card__price-label { font-size: 12px; color: var(--mpc-muted); margin-bottom: 4px; }
.mpc-result-card__price { font-size: 30px; font-weight: 700; color: var(--mpc-text); margin-bottom: 16px; line-height: 1; }

.mpc-result-card__stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.mpc-result-stat__label { font-size: 11px; color: var(--mpc-muted); margin-bottom: 3px; }
.mpc-result-stat__val { font-size: 16px; font-weight: 700; color: var(--mpc-text); }

.mpc-result-card__note { font-size: 11px; line-height: 1.6; border-radius: 6px; padding: 10px 12px; }
.mpc-result-card--green .mpc-result-card__note { background: #dcfce7; color: #166534; }
.mpc-result-card--amber .mpc-result-card__note { background: #fef3c7; color: #92400e; }

/* ══ Modal ══ */
.mpc-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 99999;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.mpc-modal-overlay.mpc-modal--open { display: flex; }
.mpc-modal {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 36px;
  position: relative;
  box-shadow: 0 24px 64px rgba(0,0,0,.22);
  animation: mpcSlideUp .2s ease;
}
@keyframes mpcSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.mpc-modal__close {
  position: absolute;
  top: 16px; right: 18px;
  background: none;
  border: none;
  font-size: 24px;
  color: #9ca3af;
  cursor: pointer;
  line-height: 1;
}
.mpc-modal__close:hover { color: var(--mpc-text); }

/* ══ Responsive ══ */
/* ════════════════════════════════════════
   RESPONSIVE — TABLET (max 900px)
════════════════════════════════════════ */
@media (max-width: 900px) {
  .mpc-card { grid-template-columns: 280px 1fr; }
  .mpc-summary-top { grid-template-columns: 1fr; }
}

/* ════════════════════════════════════════
   RESPONSIVE — MOBILE (max 700px)
════════════════════════════════════════ */
@media (max-width: 700px) {
  /* Root */
  .mpc-root { border-radius: 0; margin: 0 0 16px; box-shadow: none; max-width: 100%; }

  /* Top tabs */
  .mpc-top-tabs { padding: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; scroll-snap-type: x mandatory; }
  .mpc-top-tab { padding: 14px 16px; font-size: 13px; flex-shrink: 0; scroll-snap-align: start; }

  /* Card — stack vertically, no side margins */
  .mpc-card {
    grid-template-columns: 1fr;
    margin: 0;
    border-radius: 0;
    border-left: none;
    border-right: none;
    overflow: visible;
  }

  /* Inputs panel */
  .mpc-inputs {
    border-right: none;
    border-bottom: 1px solid var(--mpc-border);
    padding: 20px 16px;
    width: 100%;
    box-sizing: border-box;
  }
  .mpc-inputs__title { font-size: 15px; }

  /* Ensure all inputs and rows fit within screen */
  .mpc-input-row {
    width: 100%;
    box-sizing: border-box;
    max-width: 100%;
  }
  .mpc-input-row input[type="number"] {
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }
  .mpc-select, .mpc-date-field {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  .mpc-field { width: 100%; box-sizing: border-box; }
  .mpc-slider { width: 100%; box-sizing: border-box; }
  .mpc-footer-area { margin: 0; border-radius: 0; border-left: none; border-right: none; }

  /* iOS font-size fix — prevents auto-zoom on input focus */
  .mpc-input-row input[type="number"],
  .mpc-select,
  .mpc-date-field,
  .mpc-inline-edit input {
    font-size: 16px !important;
  }
  /* Keep text visible — remove right-align that hides value on small screens */
  .mpc-input-row input[type="number"] {
    text-align: left;
  }

  /* Results panel */
  .mpc-results { min-height: auto; }

  /* Inner tabs */
  .mpc-tabs {
    padding: 0 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    white-space: nowrap;
  }
  .mpc-tab { padding: 12px 14px; font-size: 12px; }

  /* Panel padding — full width, no overflow */
  .mpc-panel { padding: 16px; gap: 16px; width: 100%; box-sizing: border-box; overflow: hidden; }
  .mpc-results { width: 100%; overflow: hidden; }
  .mpc-afford-results { width: 100%; box-sizing: border-box; }

  /* Payment Breakdown — stack donut and list */
  .mpc-breakdown-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .mpc-donut-container { width: 180px; height: 180px; margin: 0 auto; }
  .mpc-donut-center span { font-size: 18px; }
  .mpc-monthly-label { font-size: 18px; text-align: center; }
  .mpc-monthly-sub { text-align: center; }

  /* Breakdown list */
  .mpc-breakdown-list h4 { font-size: 13px; }
  .mpc-breakdown-items li { padding: 9px 12px; }
  .mpc-inline-edit input { width: 55px; }

  /* Loan Summary tab */
  .mpc-summary-top { grid-template-columns: 1fr; gap: 12px; }
  .mpc-stat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .mpc-stat { padding: 12px; }
  .mpc-stat__val { font-size: 16px; }
  .mpc-extra-payment { padding: 14px; }

  /* Chart */
  .mpc-chart-header { flex-wrap: wrap; gap: 8px; padding-bottom: 8px; }
  .mpc-subtabs { overflow-x: auto; }
  .mpc-subtab { padding: 10px 12px; font-size: 12px; }
  .mpc-export { font-size: 11px; padding: 5px 10px; }
  .mpc-chart-legend { font-size: 11px; gap: 12px; flex-wrap: wrap; justify-content: center; }

  /* Amortization */
  .mpc-amort-controls { flex-direction: column; align-items: flex-start; gap: 6px; }
  .mpc-amort-wrap { max-height: 260px; }
  .mpc-amort-table th, .mpc-amort-table td { padding: 7px 8px; font-size: 11px; }

  /* CTA bar */
  .mpc-cta-bar { padding: 20px 16px; }
  .mpc-cta-bar p { font-size: 14px; }
  .mpc-cta-btn { width: 100%; text-align: center; padding: 14px 20px; }

  /* Footer */
  .mpc-footer-area { margin: 0 12px 12px; }
  .mpc-disclosure { font-size: 10px; padding: 10px 16px; }

  /* Affordability result cards */
  .mpc-afford-results { padding: 16px; gap: 14px; }
  .mpc-result-cards { grid-template-columns: 1fr; gap: 14px; }
  .mpc-result-card { padding: 16px; }
  .mpc-result-card__price { font-size: 24px; }
  .mpc-result-card__stats { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
  .mpc-result-stat__val { font-size: 13px; }
  .mpc-result-stat__label { font-size: 10px; }
  .mpc-transfer-btn { font-size: 12px; padding: 11px 12px; }

  /* Loan summary mobile */
  .mpc-loan-summary-card { overflow: hidden; }
  .mpc-summary-list { padding: 8px 12px 12px; }
  .mpc-summary-list li { padding: 8px 0; gap: 6px; }
  .mpc-summary-list li > strong { font-size: 12px; min-width: 80px; text-align: right; }
  .mpc-summary-list li > .mpc-sum-label { font-size: 12px; }

  /* Closing costs */
  .mpc-cash-close-card h4 { font-size: 12px; padding: 14px 16px 10px; }
  .mpc-cash-row { padding: 12px 16px; font-size: 12px; }
  .mpc-cash-row--total { padding: 14px 16px; }
  .mpc-cash-row--total span { font-size: 13px; }
  .mpc-cash-row--total strong { font-size: 18px; }
  .mpc-cc-header { padding: 10px 14px; font-size: 12px; }
  .mpc-cc-line { padding: 7px 14px; font-size: 11px; }
  .mpc-cc-total-row { font-size: 13px; }
  .mpc-cc-total-row strong { font-size: 16px; }

  /* Modal */
  .mpc-modal { padding: 24px 20px; }
}

/* ════════════════════════════════════════
   RESPONSIVE — SMALL MOBILE (max 400px)
════════════════════════════════════════ */
@media (max-width: 400px) {
  .mpc-top-tab { padding: 12px 10px; font-size: 12px; }
  .mpc-stat-grid { grid-template-columns: 1fr 1fr; }
  .mpc-result-card__stats { grid-template-columns: 1fr 1fr; }
  .mpc-donut-container { width: 160px; height: 160px; }
  .mpc-donut-center span { font-size: 16px; }
  .mpc-amort-table th:nth-child(4),
  .mpc-amort-table td:nth-child(4),
  .mpc-amort-table th:nth-child(5),
  .mpc-amort-table td:nth-child(5) { display: none; } /* hide Interest + Extra on tiny screens */
}

/* ── DTI Text ── */
.mpc-dti-text {
  display: inline;
  font-size: 12px;
  font-weight: 500;
  margin-left: 8px;
  vertical-align: middle;
  transition: color .2s;
}
.mpc-dti-green  { color: #15803d; }
.mpc-dti-amber  { color: #92400e; }
.mpc-dti-orange { color: #c2410c; }
.mpc-dti-red    { color: #b91c1c; }

/* ── Loan Type notice ── */
.mpc-upfront-notice {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  color: #1d4ed8;
  font-weight: 500;
  margin-bottom: 4px;
}

/* ── Cash to Close card ── */
.mpc-cash-close-card {
  background: #fff;
  border: 1px solid var(--mpc-border);
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
}
.mpc-cash-close-card h4 {
  font-size: 13px;
  font-weight: 600;
  margin: 0;
  color: var(--mpc-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--mpc-border);
}
.mpc-cash-rows { display: flex; flex-direction: column; }
.mpc-cash-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding: 14px 20px;
  border-bottom: 1px solid #f3f4f6;
  color: var(--mpc-text);
}
.mpc-cash-row:last-child { border-bottom: none; }
.mpc-cash-row strong { font-size: 14px; font-weight: 600; color: var(--mpc-text); }
.mpc-cash-row--total {
  background: #f5f3ff;
  border-bottom: none !important;
  border-top: 1.5px solid #e0d9ff;
  padding: 18px 20px;
}
.mpc-cash-row--total span { font-size: 15px; font-weight: 700; color: var(--mpc-brand); }
.mpc-cash-row--total strong { font-size: 22px; font-weight: 700; color: var(--mpc-brand); }

/* ── Closing cost sections ── */
.mpc-cc-section {
  border: 1px solid var(--mpc-border);
  border-radius: 8px;
  overflow: hidden;
}
.mpc-cc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--mpc-light);
  font-size: 13px;
  font-weight: 600;
  color: var(--mpc-text);
  cursor: pointer;
}
.mpc-cc-header strong { font-size: 13px; color: var(--mpc-brand); }
.mpc-cc-body { padding: 4px 0; }
.mpc-cc-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  font-size: 12px;
  color: var(--mpc-muted);
  border-bottom: 1px solid #f9fafb;
}
.mpc-cc-line:last-child { border-bottom: none; }
.mpc-cc-line span:last-child { font-weight: 500; color: var(--mpc-text); }

.mpc-cc-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0 4px;
  border-top: 2px solid var(--mpc-border);
  font-size: 15px;
  font-weight: 700;
  color: var(--mpc-text);
}
.mpc-cc-total-row strong { color: var(--mpc-brand); font-size: 18px; }

/* ── Affordability result cards — 3-col stats ── */
.mpc-result-card__stats { grid-template-columns: 1fr 1fr; }

/* ── Responsive tab labels ── */
/* Desktop: show full label, hide short */
.mpc-tab-short { display: none; }
.mpc-tab-full  { display: inline; }

@media (max-width: 700px) {
  /* Mobile: show short label, hide full */
  .mpc-tab-short { display: inline; }
  .mpc-tab-full  { display: none; }

  /* Mobile pill tabs */
  .mpc-top-tabs { padding: 8px 10px; gap: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }
  .mpc-top-tab  { padding: 6px 14px; font-size: 12px; flex-shrink: 0; }
  .mpc-tabs     { padding: 8px 10px; gap: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }
  .mpc-tab      { padding: 6px 13px; font-size: 12px; flex-shrink: 0; }
}

/* ── Loan type hint ── */
.mpc-field-hint {
  font-size: 11px;
  color: var(--mpc-brand);
  margin-top: 5px;
  padding: 4px 8px;
  background: #f0eeff;
  border-radius: 5px;
  display: none;
}
.mpc-field-hint.visible { display: block; }
