/* ===== RESET ===== */
.fha-wrap *, .fha-wrap *::before, .fha-wrap *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ===== BASE ===== */
.fha-wrap {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: clamp(13px, 1.5vw, 15px);
  color: #1e293b; max-width: 1060px; margin: 0 auto;
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: 16px; overflow: hidden;
}

/* ===== HEADER ===== */
.fha-header {
  padding: clamp(14px, 2vw, 22px) clamp(14px, 2.5vw, 24px);
  background: #064e3b;
  display: flex; align-items: center; gap: clamp(10px, 1.5vw, 14px);
}
.fha-header-icon {
  width: clamp(40px, 5vw, 50px); height: clamp(40px, 5vw, 50px);
  border-radius: 12px; background: rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center;
  color: #86efac; flex-shrink: 0;
}
.fha-title    { font-size: clamp(16px, 2vw, 20px); font-weight: 700; color: #fff; margin-bottom: 3px; }
.fha-subtitle { font-size: clamp(11px, 1.3vw, 13px); color: rgba(255,255,255,0.7); line-height: 1.4; }

/* ===== BODY — default stacked ===== */
.fha-body    { display: flex; flex-direction: column; }
.fha-form    { padding: 16px; display: flex; flex-direction: column; gap: 13px; width: 100%; }
.fha-results { padding: 16px; display: flex; flex-direction: column; gap: 12px; background: #f0fdf4; width: 100%; border-top: 1px solid #e2e8f0; }

/* ===== SECTION LABELS ===== */
.fha-section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: #64748b;
  padding-bottom: 4px; border-bottom: 1px solid #f1f5f9; margin-top: 2px;
}

/* ===== FIELDS ===== */
.fha-field     { display: flex; flex-direction: column; gap: 6px; }
.fha-label     { font-size: 13px; font-weight: 600; color: #334155; }
.fha-field-hint { font-size: 12px; color: #64748b; line-height: 1.5; }

/* ===== INPUTS ===== */
.fha-prefix-wrap, .fha-suffix-wrap {
  display: flex; align-items: center;
  border: 1.5px solid #cbd5e1; border-radius: 8px;
  overflow: hidden; background: #f8fafc; min-width: 0;
}
.fha-prefix-wrap:focus-within, .fha-suffix-wrap:focus-within { border-color: #064e3b; background: #fff; }
.fha-prefix, .fha-suffix {
  padding: 0 10px; height: 42px;
  display: flex; align-items: center;
  font-size: 14px; font-weight: 600; color: #64748b;
  background: #f1f5f9; white-space: nowrap; flex-shrink: 0;
}
.fha-prefix { border-right: 1px solid #e2e8f0; }
.fha-suffix { border-left: 1px solid #e2e8f0; }
.fha-input {
  flex: 1; border: none; background: transparent;
  padding: 0 12px; height: 42px;
  font-size: 14px; color: #1e293b; outline: none; min-width: 0;
  -moz-appearance: textfield;
}
.fha-input::-webkit-outer-spin-button,
.fha-input::-webkit-inner-spin-button { -webkit-appearance: none; }

/* ===== ROW 2 ===== */
.fha-row-2 { display: grid; grid-template-columns: 1fr; gap: 10px; }

/* ===== DOWN PAYMENT BUTTONS ===== */
.fha-down-group { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; }
.fha-down-btn {
  padding: 10px 6px; border: 1.5px solid #e2e8f0;
  border-radius: 8px; background: #f8fafc;
  font-size: 13px; font-weight: 700; color: #475569;
  cursor: pointer; transition: all .15s; text-align: center;
}
.fha-down-btn.active { background: #064e3b; border-color: #064e3b; color: #fff; }
.fha-down-btn:hover:not(.active) { border-color: #064e3b; color: #ffffff; }

/* ===== TERM + FEE BUTTONS ===== */
.fha-btn-group, .fha-fee-group { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.fha-term-btn, .fha-fee-btn {
  padding: 10px 0; border: 1.5px solid #cbd5e1;
  border-radius: 8px; font-size: 13px; font-weight: 600;
  cursor: pointer; background: #f8fafc; color: #475569; transition: all .15s;
}
.fha-term-btn.active, .fha-fee-btn.active { background: #064e3b; border-color: #064e3b; color: #fff; }
.fha-term-btn:hover:not(.active), .fha-fee-btn:hover:not(.active) { border-color: #064e3b; color: #ffffff; }

/* ===== CREDIT SCORE BUTTONS ===== */
.fha-credit-group { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; }
.fha-credit-btn {
  padding: 9px 4px; border: 1.5px solid #e2e8f0;
  border-radius: 8px; background: #f8fafc;
  font-size: 12px; font-weight: 600; color: #475569;
  cursor: pointer; transition: all .15s; text-align: center;
  white-space: nowrap;
}
.fha-credit-btn.active { background: #064e3b; border-color: #064e3b; color: #fff; }
.fha-credit-btn:hover:not(.active) { border-color: #064e3b; color: #ffffff; }

/* ===== DISCLAIMER ===== */
.fha-disclaimer {
  background: #fefce8; border: 1px solid #fde68a;
  border-radius: 8px; padding: 12px 14px;
  font-size: 12px; color: #78350f; line-height: 1.5;
}

/* ===== HERO ===== */
.fha-hero-card {
  background: #064e3b; border-radius: 14px;
  padding: clamp(16px, 2vw, 22px) 20px; text-align: center; color: #fff;
}
.fha-hero-label  { font-size: 12px; font-weight: 600; opacity: .7; text-transform: uppercase; letter-spacing: .07em; margin-bottom: 6px; }
.fha-hero-amount { font-size: clamp(34px, 5vw, 46px); font-weight: 800; line-height: 1; color: #86efac; }
.fha-hero-sub    { font-size: 12px; opacity: .65; margin-top: 6px; }

/* ===== MIP CARD ===== */
.fha-mip-card {
  background: #fff; border-radius: 12px;
  border: 1.5px solid #fde68a; overflow: hidden;
}
.fha-mip-header { padding: 14px 16px; border-bottom: 1px solid #f1f5f9; }
.fha-mip-title-row { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.fha-mip-icon  { font-size: 18px; }
.fha-mip-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #94a3b8; }
.fha-mip-verdict { font-size: 14px; font-weight: 700; line-height: 1.4; }
.fha-mip-verdict.mip-lifetime  { color: #dc2626; }
.fha-mip-verdict.mip-11yr      { color: #d97706; }
.fha-mip-verdict.mip-cancel    { color: #15803d; }
.fha-mip-details { padding: 12px 16px; display: flex; flex-direction: column; gap: 6px; }
.fha-mip-row { display: flex; justify-content: space-between; font-size: 13px; color: #475569; padding: 5px 0; border-bottom: 1px solid #f8fafc; }
.fha-mip-row:last-child { border-bottom: none; }
.fha-mip-row span:last-child { font-weight: 600; color: #1e293b; }
.fha-mip-total span:last-child { color: #dc2626; font-size: 14px; }

/* ===== BREAKDOWN ===== */
.fha-breakdown-card {
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: 12px; padding: 14px 16px;
}
.fha-breakdown-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #94a3b8; margin-bottom: 10px; }
.fha-breakdown-row {
  display: flex; justify-content: space-between;
  padding: 7px 0; font-size: 13px; color: #475569;
  border-bottom: 1px solid #f1f5f9;
}
.fha-breakdown-row:last-child { border-bottom: none; }
.fha-breakdown-row span:last-child { font-weight: 600; color: #1e293b; }
.fha-mip-line span { color: #d97706; }
.fha-mip-line span:last-child { color: #d97706; }
.fha-red { color: #dc2626; }

/* ===== VERDICT CARD ===== */
.fha-verdict-card {
  display: flex; align-items: flex-start; gap: 12px;
  border-radius: 12px; padding: 14px 16px;
  border: 1.5px solid #e2e8f0; background: #fff;
}
.fha-verdict-card.verdict-fha  { background: #f0fdf4; border-color: #bbf7d0; }
.fha-verdict-card.verdict-conv { background: #eff6ff; border-color: #bfdbfe; }
.fha-verdict-card.verdict-close { background: #fffbeb; border-color: #fde68a; }
.fha-verdict-icon    { font-size: 24px; flex-shrink: 0; }
.fha-verdict-title   { font-size: 13px; font-weight: 700; color: #1e293b; margin-bottom: 4px; }
.fha-verdict-text    { font-size: 13px; color: #475569; line-height: 1.5; }

/* ===== COMPARE CARD ===== */
.fha-compare-card {
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: 12px; padding: 16px;
}
.fha-compare-title { font-size: 13px; font-weight: 700; color: #1e293b; margin-bottom: 12px; }
.fha-compare-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.fha-col           { border-radius: 10px; padding: 14px 12px; text-align: center; }
.fha-col-fha       { background: #f0fdf4; border: 1.5px solid #86efac; }
.fha-col-conv      { background: #eff6ff; border: 1.5px solid #93c5fd; }
.fha-col-header    { font-size: 11px; font-weight: 700; text-transform: uppercase; color: #64748b; margin-bottom: 5px; }
.fha-col-amount    { font-size: clamp(18px, 2.5vw, 22px); font-weight: 800; color: #1e293b; }
.fha-col-sub       { font-size: 11px; color: #64748b; margin-top: 4px; }
.fha-compare-rows  { border-top: 1px solid #f1f5f9; padding-top: 10px; display: flex; flex-direction: column; gap: 7px; }
.fha-compare-row   { display: flex; justify-content: space-between; font-size: 13px; color: #475569; }
.fha-compare-winner { font-size: 14px; padding-top: 8px; border-top: 1px solid #e2e8f0; }

/* ===== REFI CARD ===== */
.fha-refi-card {
  background: #fff; border: 1.5px solid #bfdbfe;
  border-radius: 12px; padding: 16px;
}
.fha-refi-title { font-size: 13px; font-weight: 700; color: #1d4ed8; margin-bottom: 3px; }
.fha-refi-hint  { font-size: 12px; color: #64748b; margin-bottom: 12px; }
.fha-refi-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fha-refi-item  { background: #eff6ff; border-radius: 8px; padding: 10px 12px; }
.fha-refi-label { font-size: 11px; font-weight: 600; color: #64748b; margin-bottom: 3px; }
.fha-refi-val   { font-size: 15px; font-weight: 700; color: #1d4ed8; }

/* ===== STATS ===== */
.fha-stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.fha-stat       { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px 14px; }
.fha-stat-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #94a3b8; margin-bottom: 4px; }
.fha-stat-val   { font-size: clamp(13px, 1.5vw, 16px); font-weight: 700; color: #1e293b; }
.fha-stat-sub   { font-size: 11px; color: #94a3b8; margin-top: 2px; }

/* ==============================================
   SCREEN 1 — MOBILE: max 480px
   ============================================== */
@media (max-width: 480px) {
  .fha-wrap  { font-size: 13px; border-radius: 12px; }
  .fha-header { padding: 14px; gap: 10px; }
  .fha-header-icon { width: 38px; height: 38px; }
  .fha-title { font-size: 15px; }
  .fha-subtitle { font-size: 11px; }
  .fha-form, .fha-results { padding: 14px; gap: 12px; }
  .fha-body  { flex-direction: column; }
  .fha-row-2 { grid-template-columns: 1fr; }
  .fha-credit-group { grid-template-columns: repeat(2,1fr); }
  .fha-stats-grid   { grid-template-columns: 1fr; }
  .fha-compare-grid { grid-template-columns: 1fr; }
  .fha-refi-grid    { grid-template-columns: 1fr; }
  .fha-hero-amount  { font-size: 30px; }
}

/* ==============================================
   SCREEN 2 — TABLET: 481px – 899px
   ============================================== */
@media (min-width: 481px) and (max-width: 899px) {
  .fha-wrap  { font-size: 14px; }
  .fha-header { padding: 18px 20px; }
  .fha-form, .fha-results { padding: 18px; gap: 14px; }
  .fha-body  { flex-direction: column; }
  .fha-results { border-top: 1px solid #e2e8f0; }
  .fha-row-2 { grid-template-columns: 1fr 1fr; }
  .fha-credit-group { grid-template-columns: repeat(6,1fr); }
  .fha-stats-grid   { grid-template-columns: repeat(4,1fr); }
  .fha-compare-grid { grid-template-columns: 1fr 1fr; }
  .fha-refi-grid    { grid-template-columns: repeat(4,1fr); }
  .fha-hero-amount  { font-size: 40px; }
}

/* ==============================================
   SCREEN 3 — DESKTOP: 900px+
   ============================================== */
@media (min-width: 900px) {
  .fha-wrap  { font-size: 15px; }
  .fha-header { padding: 22px 24px; }
  .fha-form, .fha-results { padding: 20px; gap: 14px; }
  .fha-body  { flex-direction: row; align-items: flex-start; }
  .fha-form  { width: 50%; border-right: 1px solid #e2e8f0; border-top: none; }
  .fha-results { width: 50%; border-top: none; }
  .fha-row-2 { grid-template-columns: 1fr 1fr; }
  .fha-credit-group { grid-template-columns: repeat(3,1fr); }
  .fha-stats-grid   { grid-template-columns: 1fr 1fr; }
  .fha-compare-grid { grid-template-columns: 1fr 1fr; }
  .fha-refi-grid    { grid-template-columns: 1fr 1fr; }
  .fha-hero-amount  { font-size: 44px; }
}
