/* HouseAmp Contractor Financing — Frontend Styles */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Mono:wght@400;500&display=swap');

:root {
  --ha-teal:      #006478;
  --ha-navy:      #063137;
  --ha-teal-mid:  #2D7989;
  --ha-mint:      #B8DBD9;
  --ha-pale:      #C8D9DB;
  --ha-off-white: #F4F4FA;
  --ha-white:     #ffffff;
  --ha-gray:      #BABABA;
  --ha-text:      #1a1a2e;
  --ha-text-soft: #555;
  --ha-error:     #B71C1C;
  --ha-success:   #2E7D32;
  --ha-warn-bg:   #FFF8E7;
  --ha-warn-bdr:  #FFD54F;
  --ha-info-bg:   #E3F2FD;
  --ha-info-bdr:  #90CAF9;
  --ha-radius:    12px;
  --ha-shadow:    0 2px 20px rgba(6,49,55,.08);
  --ha-shadow-lg: 0 8px 40px rgba(6,49,55,.14);
  --ha-transition: .2s ease;
  font-family: 'DM Sans', system-ui, sans-serif;
}

/* ── Wrapper ─────────────────────────────────────────────────────────────── */
.ha-app {
  max-width: 860px;
  margin: 0 auto;
  padding: 0;
  font-family: 'DM Sans', system-ui, sans-serif;
  color: var(--ha-text);
  line-height: 1.6;
}

/* ── Progress bar ─────────────────────────────────────────────────────────── */
.ha-progress {
  background: var(--ha-white);
  border: 1px solid var(--ha-pale);
  border-radius: var(--ha-radius);
  padding: 20px 28px;
  margin-bottom: 24px;
  box-shadow: var(--ha-shadow);
}
.ha-progress-steps {
  display: flex;
  align-items: center;
  gap: 0;
}
.ha-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.ha-step-num {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ha-pale);
  color: var(--ha-navy);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--ha-transition);
}
.ha-step span {
  font-size: 11px;
  font-weight: 600;
  color: var(--ha-gray);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.ha-step.active .ha-step-num  { background: var(--ha-teal); color: #fff; box-shadow: 0 0 0 4px rgba(0,100,120,.18); }
.ha-step.active span           { color: var(--ha-teal); }
.ha-step.done .ha-step-num     { background: var(--ha-navy); color: #fff; }
.ha-step.done span             { color: var(--ha-navy); }
.ha-step-line {
  flex: 1;
  height: 2px;
  background: var(--ha-pale);
  margin: 0 8px;
  margin-bottom: 18px;
  transition: var(--ha-transition);
}
.ha-step-line.done { background: var(--ha-navy); }

/* ── Panel (card) ─────────────────────────────────────────────────────────── */
.ha-panel {
  background: var(--ha-white);
  border: 1px solid var(--ha-pale);
  border-radius: var(--ha-radius);
  padding: 32px 36px;
  box-shadow: var(--ha-shadow);
  animation: ha-slide-in .25s ease;
}
@keyframes ha-slide-in {
  from { opacity:0; transform:translateY(10px); }
  to   { opacity:1; transform:translateY(0); }
}
.ha-app-body { position: relative; }

/* ── Panel header ─────────────────────────────────────────────────────────── */
.ha-panel-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--ha-pale);
}
.ha-panel-icon {
  font-size: 32px;
  line-height: 1;
  flex-shrink: 0;
}
.ha-panel-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--ha-navy);
  margin: 0 0 4px;
  line-height: 1.2;
}
.ha-panel-header p {
  font-size: 14px;
  color: var(--ha-text-soft);
  margin: 0;
}

/* ── Section title ─────────────────────────────────────────────────────────── */
.ha-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ha-teal-mid);
  margin: 24px 0 14px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--ha-pale);
}
.ha-section-title small {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ha-gray);
}

/* ── Form fields ──────────────────────────────────────────────────────────── */
.ha-field-row {
  display: flex;
  gap: 16px;
  margin-bottom: 0;
  flex-wrap: wrap;
}
.ha-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 160px;
  margin-bottom: 16px;
}
.ha-field.ha-field-wide { flex: 2; min-width: 220px; }
.ha-field.ha-field-sm   { flex: 0 0 100px; min-width: 80px; }
.ha-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ha-navy);
}
.ha-field input,
.ha-field select,
.ha-field textarea {
  padding: 10px 14px;
  border: 1.5px solid var(--ha-pale);
  border-radius: 8px;
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  color: var(--ha-text);
  background: var(--ha-off-white);
  transition: border-color var(--ha-transition), box-shadow var(--ha-transition);
  width: 100%;
}
.ha-field input:focus,
.ha-field select:focus,
.ha-field textarea:focus {
  outline: none;
  border-color: var(--ha-teal);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0,100,120,.12);
}
.ha-field input[type="checkbox"] {
  width: auto;
  margin-right: 6px;
}
.ha-input-prefix {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--ha-pale);
  border-radius: 8px;
  overflow: hidden;
  background: var(--ha-off-white);
  transition: border-color var(--ha-transition), box-shadow var(--ha-transition);
}
.ha-input-prefix:focus-within {
  border-color: var(--ha-teal);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0,100,120,.12);
}
.ha-input-prefix span {
  padding: 10px 12px;
  background: var(--ha-pale);
  font-weight: 600;
  color: var(--ha-teal);
  font-size: 14px;
}
.ha-input-prefix input {
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent;
  flex: 1;
}
.ha-hint {
  font-size: 12px;
  color: var(--ha-text-soft);
  margin-top: 2px;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.ha-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--ha-pale);
  flex-wrap: wrap;
}
.ha-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--ha-transition);
  text-decoration: none;
}
.ha-btn-primary {
  background: var(--ha-teal);
  color: #fff;
  border-color: var(--ha-teal);
}
.ha-btn-primary:hover { background: var(--ha-navy); border-color: var(--ha-navy); }
.ha-btn-primary:disabled { background: var(--ha-gray); border-color: var(--ha-gray); cursor: not-allowed; }
.ha-btn-ghost {
  background: transparent;
  color: var(--ha-teal);
  border-color: var(--ha-pale);
}
.ha-btn-ghost:hover { background: var(--ha-off-white); border-color: var(--ha-teal); }
.ha-btn-sm { padding: 7px 14px; font-size: 13px; }
.ha-btn-danger { color: var(--ha-error) !important; border-color: #FFCDD2 !important; }
.ha-btn-danger:hover { background: #FFEBEE !important; }

/* ── Spinner ──────────────────────────────────────────────────────────────── */
.ha-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ha-spin .7s linear infinite;
}
@keyframes ha-spin { to { transform: rotate(360deg); } }

/* ── Notices ──────────────────────────────────────────────────────────────── */
.ha-error {
  background: #FFEBEE;
  border: 1px solid #FFCDD2;
  border-left: 4px solid var(--ha-error);
  color: var(--ha-error);
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 14px;
  margin-top: 12px;
}
.ha-notice {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
  border: 1px solid;
}
.ha-notice-warn { background: var(--ha-warn-bg); border-color: var(--ha-warn-bdr); color: #6D4C00; }
.ha-notice-info { background: var(--ha-info-bg); border-color: var(--ha-info-bdr); color: #0D47A1; }
.ha-notice-success { background: #E8F5E9; border-color: #A5D6A7; color: var(--ha-success); }

/* ── Offer cards ──────────────────────────────────────────────────────────── */
.ha-offers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.ha-offer-card {
  border: 2px solid var(--ha-pale);
  border-radius: var(--ha-radius);
  padding: 20px;
  cursor: pointer;
  transition: all var(--ha-transition);
  background: var(--ha-off-white);
  position: relative;
}
.ha-offer-card:hover { border-color: var(--ha-teal); background: #fff; box-shadow: var(--ha-shadow); }
.ha-offer-card.selected { border-color: var(--ha-teal); background: #fff; box-shadow: 0 0 0 3px rgba(0,100,120,.15); }
.ha-offer-selected-badge {
  position: absolute;
  top: -10px;
  right: 12px;
  background: var(--ha-teal);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  display: none;
}
.ha-offer-card.selected .ha-offer-selected-badge { display: block; }
.ha-offer-lender { font-size: 13px; font-weight: 600; color: var(--ha-text-soft); margin-bottom: 8px; }
.ha-offer-amount { font-size: 26px; font-weight: 700; color: var(--ha-navy); line-height: 1.1; }
.ha-offer-amount span { font-size: 14px; color: var(--ha-text-soft); font-weight: 400; }
.ha-offer-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}
.ha-offer-stat { font-size: 12px; color: var(--ha-text-soft); }
.ha-offer-stat strong { display: block; font-size: 14px; color: var(--ha-text); font-weight: 600; }
.ha-offer-fees {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--ha-pale);
}
.ha-offer-fees-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ha-gray); margin-bottom: 6px; }
.ha-offer-fee-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--ha-text-soft); margin-bottom: 3px; }
.ha-offer-select-btn {
  width: 100%;
  margin-top: 14px;
  padding: 9px;
  background: var(--ha-teal);
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: background var(--ha-transition);
}
.ha-offer-select-btn:hover { background: var(--ha-navy); }
.ha-offer-card.selected .ha-offer-select-btn { background: var(--ha-navy); }

/* ── Review summary ───────────────────────────────────────────────────────── */
.ha-review-block {
  background: var(--ha-off-white);
  border: 1px solid var(--ha-pale);
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 16px;
}
.ha-review-block h4 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ha-teal); margin-bottom: 12px; }
.ha-review-row { display: flex; justify-content: space-between; align-items: flex-start; padding: 5px 0; border-bottom: 1px solid var(--ha-pale); font-size: 14px; }
.ha-review-row:last-child { border-bottom: none; }
.ha-review-row span:first-child { color: var(--ha-text-soft); }
.ha-review-row span:last-child  { font-weight: 500; color: var(--ha-navy); text-align: right; }

/* ── Success panel ────────────────────────────────────────────────────────── */
.ha-success-panel { text-align: center; padding: 48px 36px; }
.ha-success-icon { font-size: 56px; margin-bottom: 16px; animation: ha-pop .4s ease; }
@keyframes ha-pop { 0%{transform:scale(0)} 70%{transform:scale(1.15)} 100%{transform:scale(1)} }
.ha-success-panel h2 { font-size: 26px; font-weight: 700; color: var(--ha-navy); margin-bottom: 12px; }
.ha-success-panel p  { font-size: 16px; color: var(--ha-text-soft); max-width: 460px; margin: 0 auto 20px; }

/* ── Loan status pipeline ─────────────────────────────────────────────────── */
.ha-loan-pipeline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0;
  overflow-x: auto;
}
.ha-pipe-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.ha-pipe-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  transition: var(--ha-transition);
}
.ha-pipe-future .ha-pipe-dot  { background: var(--ha-pale); color: var(--ha-gray); }
.ha-pipe-done .ha-pipe-dot    { background: var(--ha-navy); color: #fff; font-size: 16px; }
.ha-pipe-active .ha-pipe-dot  { background: var(--ha-teal); color: #fff; box-shadow: 0 0 0 5px rgba(0,100,120,.2); }
.ha-pipe-label { font-size: 11px; font-weight: 600; text-align: center; max-width: 80px; }
.ha-pipe-future .ha-pipe-label { color: var(--ha-gray); }
.ha-pipe-done .ha-pipe-label   { color: var(--ha-navy); }
.ha-pipe-active .ha-pipe-label { color: var(--ha-teal); }
.ha-pipe-line {
  flex: 1;
  height: 2px;
  margin: 0 4px;
  margin-bottom: 22px;
}
.ha-pipe-done   { } /* line above handled differently per state */
.ha-pipe-line { background: var(--ha-pale); }

.ha-loan-details { margin-top: 16px; }
.ha-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--ha-pale);
  font-size: 14px;
}
.ha-detail-row span:first-child { color: var(--ha-text-soft); }
.ha-detail-row strong { color: var(--ha-navy); font-weight: 600; }

/* ── Invoice cards ────────────────────────────────────────────────────────── */
.ha-inv-list { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.ha-inv-card {
  border: 1.5px solid var(--ha-pale);
  border-radius: 10px;
  padding: 16px 20px;
  background: var(--ha-off-white);
}
.ha-inv-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.ha-inv-num { font-weight: 700; font-size: 14px; color: var(--ha-navy); margin-right: 10px; }
.ha-inv-amount { font-size: 20px; font-weight: 700; color: var(--ha-teal); }
.ha-inv-note { font-size: 13px; color: var(--ha-text-soft); margin-bottom: 12px; }
.ha-inv-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ha-sub-card { background: var(--ha-off-white); border: 1px solid var(--ha-pale); border-radius: 10px; padding: 20px 24px; margin-bottom: 20px; }
.ha-muted-block { color: var(--ha-text-soft); font-style: italic; padding: 20px 0; text-align: center; }

/* ── Disclosures ──────────────────────────────────────────────────────────── */
.ha-lender-block { background: var(--ha-off-white); border: 1px solid var(--ha-pale); border-radius: 8px; padding: 16px 20px; margin-bottom: 20px; }
.ha-lender-block h4 { color: var(--ha-navy); margin-bottom: 8px; }
.ha-disclosure-item { background: var(--ha-off-white); border: 1px solid var(--ha-pale); border-radius: 8px; padding: 16px 20px; margin-bottom: 12px; }
.ha-disclosure-item h5 { font-size: 14px; font-weight: 700; color: var(--ha-navy); margin-bottom: 8px; }
.ha-disclosure-item p { font-size: 13px; color: var(--ha-text-soft); line-height: 1.6; margin: 0; }
.ha-confirm-label { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; font-weight: 500; cursor: pointer; }
.ha-disclosure-confirm { margin-top: 20px; padding: 20px; background: var(--ha-off-white); border-radius: 8px; }

/* ── Status pill ──────────────────────────────────────────────────────────── */
.ha-status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #fff;
}

/* ── Eligibility result ───────────────────────────────────────────────────── */
.ha-elig-result {
  background: #E8F5E9;
  border: 1px solid #A5D6A7;
  border-left: 4px solid var(--ha-success);
  border-radius: 8px;
  padding: 16px 20px;
  margin-top: 16px;
}
.ha-elig-result h4 { color: var(--ha-success); margin-bottom: 6px; }
.ha-elig-stat-row { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 10px; }
.ha-elig-stat { text-align: center; }
.ha-elig-stat strong { display: block; font-size: 20px; font-weight: 700; color: var(--ha-navy); }
.ha-elig-stat span { font-size: 12px; color: var(--ha-text-soft); }

/* ── Inline checkbox (SMS opt-in etc) ─────────────────────────────────────── */
.ha-inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ha-text-soft);
  cursor: pointer;
}
.ha-inline-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--ha-teal);
  cursor: pointer;
}
.ha-inline-check span { line-height: 1.4; }

/* ── Services checkboxes ──────────────────────────────────────────────────── */
.ha-services-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}
.ha-service-check {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--ha-off-white);
  border: 1.5px solid var(--ha-pale);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--ha-transition);
  user-select: none;
}
.ha-service-check:hover { border-color: var(--ha-teal); background: #fff; }
.ha-service-check input[type="checkbox"] {
  width: auto;
  margin: 0;
  accent-color: var(--ha-teal);
}
.ha-service-check input[type="checkbox"]:checked + span,
.ha-service-check:has(input:checked) {
  color: var(--ha-teal);
  border-color: var(--ha-teal);
  background: #fff;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .ha-panel { padding: 20px 18px; }
  .ha-field-row { flex-direction: column; }
  .ha-field.ha-field-sm, .ha-field.ha-field-wide { flex: 1; min-width: 100%; }
  .ha-offers-grid { grid-template-columns: 1fr; }
  .ha-progress-steps { gap: 0; }
  .ha-step span { display: none; }
  .ha-loan-pipeline { gap: 6px; }
}
