/* ── Modal Overlay ────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.modal-overlay.is-active {
  opacity: 1;
  pointer-events: auto;
}
.modal-container {
  background: var(--surface, #fff);
  border-radius: 16px;
  width: 90%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  position: relative;
  transform: translateY(20px);
  transition: transform 0.25s ease, max-width 0.25s ease;
}
.modal-overlay.is-active .modal-container {
  transform: translateY(0);
}
/* Prequal results need more room than the form (unit tables + floorplan cards),
   so the prequal modal grows once results render. Scoped to #prequal-modal, so
   the form view and every other modal keep the default 620px. Toggled by the
   `showing-results` class in app.js (renderPrequalResults / start-over). */
#prequal-modal.showing-results .modal-container {
  max-width: 880px;
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.6rem;
  color: var(--text-muted, #6b6356);
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}
.modal-close:hover {
  background: var(--surface-alt, #f5f0eb);
}
.modal-header {
  padding: 28px 28px 0;
}
.modal-header h2 {
  font-size: 1.3rem;
  margin: 0 0 6px;
}
.modal-header p {
  color: var(--text-muted, #6b6356);
  font-size: 0.9rem;
  margin: 0;
  line-height: 1.5;
}
.modal-body {
  padding: 20px 28px 28px;
}

@media (max-width: 600px) {
  .modal-container {
    width: 96%;
    max-height: 94vh;
    border-radius: 12px;
  }
  .modal-header, .modal-body {
    padding-left: 18px;
    padding-right: 18px;
  }
  .hero-cta-card.panel-card {
    padding: 0;
  }
}

/* ── Prequalification Form ────────────────────────────────────── */
.section-subtext {
  color: var(--text-muted, #6b6356);
  font-size: 0.95rem;
  margin-top: 4px;
}
.prequal-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.prequal-field-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.prequal-field-grid .span-2 {
  grid-column: span 2;
}
.prequal-address-fieldset {
  border: 1px solid var(--border, #e0d6cc);
  border-radius: 10px;
  padding: 16px 18px;
  margin: 0;
}
.prequal-address-fieldset legend {
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0 6px;
  color: var(--text, #2c2520);
}
.prequal-disclaimer {
  font-size: 0.8rem;
  color: var(--text-muted, #6b6356);
  margin: 0;
}
.prequal-disclaimer-box {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border, #e0d6cc);
  border-radius: 10px;
  padding: 14px 16px;
  background: var(--bg-soft, #f7f1ea);
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text, #2c2520);
}
.prequal-disclaimer-box:focus {
  outline: 2px solid var(--accent, #b45c38);
  outline-offset: 2px;
}
.prequal-disclaimer-box p {
  margin: 0 0 10px;
}
.prequal-disclaimer-box p:last-child {
  margin-bottom: 0;
}
.prequal-consent-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--text, #2c2520);
  cursor: pointer;
}
.prequal-consent-label input[type="checkbox"] {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: var(--accent, #b45c38);
  flex-shrink: 0;
}
.prequal-turnstile {
  display: flex;
  justify-content: center;
  min-height: 65px;
}
#pq-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.required { color: var(--accent-deep, #8a4528); }
.optional { color: var(--text-muted, #6b6356); font-size: 0.82rem; }
.prequal-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.prequal-results {
  margin-top: 24px;
}
.prequal-results h3 {
  margin-bottom: 16px;
}
.pq-property-result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--border, #e0d6cc);
  border-radius: 10px;
  margin-bottom: 10px;
  background: var(--surface, #fff);
}
.pq-property-name {
  font-weight: 600;
  font-size: 0.95rem;
}
.pq-property-ratio {
  font-size: 0.82rem;
  color: var(--text-muted, #6b6356);
}
.pq-status {
  font-size: 0.84rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
}
.pq-status-qualified {
  background: #e6f4ea;
  color: #1e7e34;
}
.pq-status-conditional {
  background: #fff8e1;
  color: #b8860b;
}
.pq-status-unqualified {
  background: #fce8e6;
  color: #c62828;
}
/* Prequal: consolidated one-card-per-community result. Photo + name on the left,
   status / rent-to-income / availability folded into the right — replaces the old
   stacked "result card + separate units box" that read as cluttered. */
.pq-property-card {
  border: 1px solid var(--line, #e0d6cc);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  background: var(--surface, #fff);
}
.pq-property-head {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 16px;
  align-items: start;
}
.pq-property-photo-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pq-property-photo {
  width: 100%;
  height: 88px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}
.pq-property-photo-placeholder {
  background: var(--surface-strong, #f8f4ee);
}
.pq-property-detail-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}
/* Detail-col controls its own spacing via `gap`, so zero the standalone margins
   the toggle / no-availability note carry when used elsewhere. */
.pq-property-detail-col .pq-units-toggle,
.pq-property-detail-col .pq-units-none {
  margin-top: 0;
}
/* Expandable units panel lives inside the card, full-width beneath the head. */
.pq-property-card .pq-units-panel:not([hidden]) {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line, #e0d6cc);
}
@media (max-width: 600px) {
  .pq-property-head { grid-template-columns: 96px 1fr; gap: 12px; }
  .pq-property-photo { height: 72px; }
}
.pq-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border, #e0d6cc);
  border-top-color: var(--accent, #b45c38);
  border-radius: 50%;
  animation: pq-spin 0.6s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}
@keyframes pq-spin {
  to { transform: rotate(360deg); }
}

/* Prequal: "prequalified up to $X" banner */
.pq-max-rent-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
  background: #e6f4ea;
  border: 1px solid #bfe3c9;
  border-radius: 10px;
  color: #1e7e34;
  font-size: 1rem;
  line-height: 1.4;
}
.pq-max-rent-banner strong { font-weight: 700; }
.pq-max-rent-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 50%;
  background: #1e7e34;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
}
/* Prequal: soft conditional-qualification note (rent-to-income over the 3× line) */
.pq-conditional-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 16px;
  padding: 13px 16px;
  background: #fdf6e9;
  border: 1px solid #ecd9b0;
  border-radius: 10px;
  color: #7a5e23;
  font-size: 0.92rem;
  line-height: 1.45;
}
.pq-conditional-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 50%;
  background: #d9a441;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  font-style: italic;
  margin-top: 1px;
}

/* Prequal: per-property action buttons — the "view homes" toggle and the floor-plans/
   waitlist CTA. Outline pill matching .floorplan-consult-cta; the solid fill stays
   reserved for the "Apply Now" action inside the expanded panel. */
.pq-units-toggle,
.pq-units-link,
.pq-notify-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
  padding: 9px 16px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  color: var(--accent-deep, #2d5b57);
  background: transparent;
  border: 1.5px solid var(--accent-deep, #2d5b57);
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.pq-units-toggle:hover:not(:disabled),
.pq-units-toggle:focus-visible,
.pq-units-link:hover,
.pq-units-link:focus-visible,
.pq-notify-btn:hover:not(:disabled),
.pq-notify-btn:focus-visible {
  background: var(--accent-deep, #2d5b57);
  color: #fff;
}
.pq-units-toggle:disabled,
.pq-notify-btn:disabled { opacity: 0.7; cursor: progress; }
.pq-units-arrow { transition: transform 0.15s ease; }
.pq-units-toggle[aria-expanded="true"] .pq-units-arrow { transform: rotate(90deg); }
.pq-units-panel { margin-top: 8px; }
.pq-units-empty {
  padding: 16px;
  background: var(--surface-strong, #f8f4ee);
  border: 1px solid var(--line, #e0d6cc);
  border-radius: 10px;
  font-size: 0.9rem;
  color: var(--muted, #6b6356);
  line-height: 1.5;
}
/* Floorplan cards inside the (now wider) prequal panel: keep the floorplan
   diagram but shrink it to a compact thumbnail beside the details, so the card
   reads clean instead of a tall image-on-top-of-everything stack. */
.pq-units-panel .floorplan-card { grid-template-columns: 190px 1fr; }
.pq-units-panel .floorplan-image { max-height: 170px; }
.pq-units-panel .floorplan-body { padding: 18px; }
.pq-units-panel .floorplans-grid { margin-bottom: 0; }
/* Below the results-modal breakpoint the diagram is dropped entirely — just the
   floorplan + unit info remains, per the "hide on mobile" call. */
@media (max-width: 700px) {
  .pq-units-panel .floorplan-card { grid-template-columns: 1fr; }
  .pq-units-panel .floorplan-image-wrap { display: none; }
}

/* Prequal: soft screening disclosure under a conditionally-approved community */
.pq-conditional-disclosure {
  margin-top: 8px;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-muted, #6b6356);
  font-style: italic;
}
/* Prequal: "no open homes in range" note — lead line stacked above the CTA button */
.pq-units-none {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--muted, #6b6356);
  line-height: 1.45;
}
.pq-units-none .pq-units-link { margin-top: 0; }

@media (max-width: 600px) {
  .prequal-field-grid {
    grid-template-columns: 1fr;
  }
  .prequal-field-grid .span-2 {
    grid-column: span 1;
  }
  .pq-property-result {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* Responsive: 2 columns at 960px */
@media (max-width: 960px) {
  .property-grid-browse {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}
/* Responsive: 1 column at 600px */
@media (max-width: 600px) {
  .property-grid-browse {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

/* Prequal: "Notify Me" — outline pill matching the other per-property actions
   (.pq-units-toggle / .pq-units-link); shared base + hover/fill live with that rule
   above so it stays visually consistent. Only its supporting text differs. */
.pq-notify-hint {
  margin-top: 6px;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-muted, #6b6356);
}
.pq-notify-done {
  margin-top: 8px;
  font-size: 0.88rem;
  line-height: 1.45;
  font-weight: 600;
  color: var(--accent-deep, #2d5b57);
}

/* Prequal: always-on "add a roommate" nudge at the top of the results. Soft callout. */
.pq-roommate-prompt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 16px;
  padding: 14px 16px;
  background: var(--surface-strong, #f8f4ee);
  border: 1px solid var(--border, #e5ded2);
  border-left: 4px solid var(--accent-deep, #2d5b57);
  border-radius: 10px;
}
.pq-roommate-prompt-text {
  flex: 1 1 260px;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--text, #3a352c);
}
.pq-roommate-add-btn {
  flex: 0 0 auto;
  padding: 9px 18px;
  border: 1px solid var(--accent-deep, #2d5b57);
  border-radius: 999px;
  background: transparent;
  color: var(--accent-deep, #2d5b57);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.pq-roommate-add-btn:hover,
.pq-roommate-add-btn:focus-visible {
  background: var(--accent-deep, #2d5b57);
  color: #fff;
}

/* Prequal: roommate fieldset in the form + its reveal/remove controls. */
.pq-roommate-toggle {
  display: inline-block;
  margin: 4px 0 0;
  padding: 8px 0;
  border: none;
  background: transparent;
  color: var(--accent-deep, #2d5b57);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}
.pq-roommate-intro {
  margin: 0 0 12px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-muted, #6b6356);
}
.pq-rm-error {
  margin-top: 8px;
  min-height: 1em;
  font-size: 0.85rem;
  color: var(--error, #b3261e);
}
.pq-roommate-remove {
  margin-top: 10px;
  padding: 6px 0;
  border: none;
  background: transparent;
  color: var(--text-muted, #6b6356);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  text-decoration: underline;
}

@media (max-width: 600px) {
  .pq-roommate-prompt { flex-direction: column; align-items: stretch; }
  .pq-roommate-add-btn { width: 100%; }
  .pq-notify-btn { width: 100%; }
}
