/* apply-1003 — mobile-first, no CDN */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand:       #00509f;
  --brand-dk:    #003366;
  --brand-light: #e8f0fe;
  --text:        #1a1a1a;
  --muted:       #555;
  --muted-lt:    #7a8394;
  --border:      #d0d5dd;
  --bg:          #f4f7fb;
  --card-bg:     #ffffff;
  --err:         #c0392b;
  --success:     #15694f;
  --radius:      8px;
  --shadow:      0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.07);
  --shadow-card: 0 2px 8px rgba(0,0,0,.05), 0 8px 28px rgba(0,0,0,.08);
}

html { font-size: 16px; }

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Header ---- */
.hdr {
  background: linear-gradient(135deg, var(--brand-dk) 0%, var(--brand) 100%);
  color: #fff;
}
.hdr-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .875rem 1.25rem;
}
.hdr-logo {
  display: flex;
  align-items: center;
  gap: .625rem;
}
.logo-icon { flex-shrink: 0; }
.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.logo-name {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -.01em;
}
.logo-nmls {
  font-size: .68rem;
  opacity: .75;
  letter-spacing: .03em;
}
.hdr-secure {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .72rem;
  opacity: .8;
}

/* Progress area */
.hdr-progress {
  padding: 0 1.25rem .875rem;
}
.hdr-step-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: .375rem;
}
.step-name {
  font-size: .875rem;
  font-weight: 600;
  color: #fff;
}
.step-label {
  font-size: .75rem;
  color: rgba(255,255,255,.72);
  flex-shrink: 0;
  margin-left: .75rem;
}
.progress-bar {
  height: 6px;
  background: rgba(255,255,255,.2);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: #fff;
  border-radius: 99px;
  transition: width .4s ease;
}

/* ---- Main ---- */
.main {
  flex: 1;
  max-width: 660px;
  width: 100%;
  margin: 2rem auto;
  padding: 0 1rem 2rem;
}

/* ---- Card ---- */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 2rem;
  border-top: 3px solid var(--brand);
}
.card-title {
  font-size: 1.375rem;
  font-weight: 700;
  margin-bottom: .375rem;
  color: var(--brand-dk);
}
.card-sub {
  font-size: .9rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

/* ---- Form elements ---- */
.fg, .form-group { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1.125rem; }
.fg:last-of-type, .form-group:last-of-type { margin-bottom: 0; }
.form-err { background: #fef2f2; color: #991b1b; border-left: 3px solid #ef4444; padding: .65rem 1rem; border-radius: 4px; margin-bottom: 1.25rem; font-size: .875rem; }

label { font-size: .875rem; font-weight: 600; color: var(--text); }
.req { color: var(--err); font-weight: 400; margin-left: .1em; }
.hint { font-size: .8rem; color: var(--muted); }
.field-hint { font-size: .78rem; color: var(--muted); display: block; margin-top: .25rem; }

input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="tel"],
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: .6875rem .875rem;
  font-size: 1rem;
  font-family: inherit;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  appearance: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0,80,159,.14);
}
input.invalid, select.invalid { border-color: var(--err); }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23555' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .875rem center;
  padding-right: 2.5rem;
}

.ssn-input { letter-spacing: .1em; }

/* ---- Grid rows ---- */
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .875rem; }
.row-3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: .875rem; }

@media (max-width: 480px) {
  .row-2, .row-3 { grid-template-columns: 1fr; }
  .btn-primary { width: 100%; }
  .main { margin: 1.25rem auto; }
  .card { padding: 1.5rem 1.25rem; }
}

/* ---- Fieldset ---- */
.fs {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.125rem;
  margin-bottom: 1.125rem;
}
.fs legend { font-weight: 700; font-size: .875rem; padding: 0 .4rem; color: var(--muted); }

/* ---- Dynamic rows (assets/liabilities) ---- */
.dynamic-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.125rem;
  margin-bottom: .875rem;
  position: relative;
}
.btn-remove {
  background: none;
  border: none;
  color: var(--err);
  font-size: .8rem;
  cursor: pointer;
  padding: .25rem 0;
  margin-top: .5rem;
  text-decoration: underline;
}
.btn-add {
  margin-bottom: 1.25rem;
  font-size: .875rem;
}

/* ---- Declarations ---- */
.decl-list { margin-bottom: 1.25rem; }
.decl-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: .875rem 0;
  border-bottom: 1px solid var(--border);
}
.decl-row:last-child { border-bottom: none; }
.decl-q { font-size: .875rem; flex: 1; }
.decl-btns { display: flex; gap: .75rem; flex-shrink: 0; }
.radio-label { display: flex; align-items: center; gap: .3rem; font-size: .875rem; cursor: pointer; font-weight: 400; }

/* ---- Demographics ---- */
.check-group { display: flex; flex-direction: column; gap: .4rem; }
.checkbox-label { display: flex; align-items: center; gap: .4rem; font-size: .875rem; font-weight: 400; cursor: pointer; }

/* ---- Buttons ---- */
.btn-row {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  margin-top: 2rem;
  align-items: center;
}
.btn-primary {
  background: var(--brand);
  color: #fff;
  border: none;
  padding: 0 1.75rem;
  min-height: 48px;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, box-shadow .15s;
  flex-shrink: 0;
  line-height: 1;
}
.btn-primary:hover {
  background: var(--brand-dk);
  box-shadow: 0 4px 14px rgba(0,51,102,.22);
}
.btn-primary:active { background: var(--brand-dk); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }

.btn-ghost {
  background: none;
  color: var(--brand);
  border: 1.5px solid var(--border);
  padding: 0 1.25rem;
  min-height: 44px;
  border-radius: var(--radius);
  font-size: .9rem;
  cursor: pointer;
  transition: border-color .15s;
  line-height: 1;
}
.btn-ghost:hover { border-color: var(--brand); }

.btn-link {
  background: none;
  border: none;
  color: var(--muted);
  font-size: .85rem;
  cursor: pointer;
  padding: .25rem 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.btn-link:hover { color: var(--brand); }

/* ---- Status / toast ---- */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: .7rem 1.375rem;
  border-radius: 99px;
  font-size: .875rem;
  white-space: nowrap;
  z-index: 999;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}
.toast.show { opacity: 1; }
.toast.err { background: var(--err); }

/* ---- Resume link box ---- */
.resume-box {
  background: var(--brand-light);
  border: 1px solid rgba(0,80,159,.18);
  border-radius: var(--radius);
  padding: .875rem 1.125rem;
  margin-top: 1.125rem;
  font-size: .875rem;
}
.resume-box strong { display: block; margin-bottom: .2rem; color: var(--brand-dk); }
.resume-box span { display: block; color: var(--muted); margin-bottom: .3rem; }
.resume-box input[type="text"] {
  background: #fff;
  font-size: .82rem;
  color: var(--muted);
  margin-top: .3rem;
  min-height: 40px;
}
.copy-btn { margin-top: .5rem; font-size: .8rem; padding: 0 .875rem; min-height: 36px; }

/* ---- Complete page ---- */
.complete-circle {
  width: 72px;
  height: 72px;
  background: var(--brand-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.375rem;
  color: var(--brand);
}
.complete-center { text-align: center; margin-bottom: 1.5rem; }
.complete-center .card-title { margin-bottom: .375rem; }

.complete-what-next {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.complete-what-next h2 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: .875rem;
  color: var(--text);
}
.complete-steps { display: flex; flex-direction: column; gap: .75rem; }
.complete-step { display: flex; gap: .875rem; align-items: flex-start; font-size: .9rem; line-height: 1.5; }
.complete-step-num {
  width: 24px;
  height: 24px;
  min-width: 24px;
  background: var(--brand);
  color: #fff;
  border-radius: 50%;
  font-size: .75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: .15rem;
}

/* ---- Spinner (on submit button) ---- */
@keyframes spin { to { transform: rotate(360deg); } }
.spinning::after {
  content: '';
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid rgba(255,255,255,.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  vertical-align: middle;
  margin-left: .5rem;
}

/* ---- Footer ---- */
.ftr {
  padding: 1.75rem 1rem 2.25rem;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.ftr-trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: .875rem;
}
.ftr-trust-item {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .78rem;
  color: var(--muted);
  white-space: nowrap;
}
.ftr-trust-item svg { color: var(--muted-lt); flex-shrink: 0; }
.ftr-legal {
  text-align: center;
  font-size: .72rem;
  color: var(--muted-lt);
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.55;
}

/* ---- Picker page ---- */
.picker-pg { padding: .5rem 0; }
.picker-pg-hdr { text-align: center; margin-bottom: 1.5rem; }
.picker-pg-hdr .card-title { margin-bottom: .5rem; }
.picker-pg-hdr .hint { max-width: 480px; margin-left: auto; margin-right: auto; }

/* ---- Picker cards ---- */
.picker-grid { display: flex; flex-direction: column; gap: .625rem; }
.picker-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.125rem 1.25rem;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, box-shadow .15s, background .15s;
  -webkit-tap-highlight-color: transparent;
  min-height: 76px;
  cursor: pointer;
}
.picker-card:not(.picker-disabled):hover,
.picker-card:not(.picker-disabled):focus {
  border-color: var(--brand);
  box-shadow: 0 2px 14px rgba(0,80,159,.1);
  background: var(--brand-light);
  text-decoration: none;
  outline: none;
}
.picker-card:not(.picker-disabled):active {
  background: #dce8f8;
}
.picker-disabled { opacity: .58; cursor: default; }
.picker-icon {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.picker-body { flex: 1; min-width: 0; }
.picker-title { font-size: 1rem; font-weight: 700; margin-bottom: .2rem; color: var(--brand-dk); }
.picker-desc { font-size: .8125rem; color: var(--muted); line-height: 1.45; }
.picker-cta {
  flex-shrink: 0;
  font-weight: 700;
  color: var(--brand);
  font-size: 1.375rem;
  padding-left: .25rem;
  line-height: 1;
}
.picker-soon {
  flex-shrink: 0;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  background: #f1f5f9;
  color: var(--muted-lt);
  border: 1px solid var(--border);
  padding: .2rem .6rem;
  border-radius: 99px;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .picker-card { padding: 1rem; gap: .75rem; }
  .picker-icon { width: 40px; height: 40px; border-radius: 8px; }
  .ftr-trust { gap: .875rem; }
}

/* ---- Income breakdown table ---- */
.income-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: .5rem;
  font-size: .875rem;
}
.income-table th {
  text-align: left;
  font-weight: 700;
  padding: .4rem .5rem;
  border-bottom: 2px solid var(--border);
  color: var(--muted);
}
.income-table td {
  padding: .35rem .5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.income-table td:first-child { width: 55%; }
.income-table input.income-cell {
  width: 100%;
  padding: .4rem .6rem;
  font-size: .875rem;
  min-height: 40px;
}

/* ---- REO property card ---- */
.reo-row {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}
.row-tag {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--brand);
  margin-bottom: .75rem;
}
.fs-inner {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: .75rem;
  margin-top: .75rem;
}
.fs-inner legend {
  font-size: .8rem;
  font-weight: 700;
  color: var(--muted);
  padding: 0 .3rem;
}

/* ---- Declaration sub-questions ---- */
.decl-sub {
  width: 100%;
  margin-top: .5rem;
  padding: .5rem .75rem;
  background: var(--bg);
  border-left: 3px solid var(--brand);
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* ---- HMDA subcategories ---- */
.subcats {
  margin-left: 1.5rem;
  margin-top: .3rem;
  padding: .5rem .75rem;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.checkbox-label.sub {
  font-size: .82rem;
  padding: .1rem 0;
}

/* ---- Authorization / Certification Step ---- */
.cert-block {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
  padding: 1rem 1.125rem;
  font-size: .875rem;
  line-height: 1.65;
  color: #334155;
  margin-bottom: 1.5rem;
}
.cert-checks {
  display: flex;
  flex-direction: column;
  gap: .875rem;
  margin-bottom: 1.5rem;
}
.cert-check-row {
  display: grid;
  grid-template-columns: 1.25rem 1fr;
  gap: .625rem;
  align-items: start;
  cursor: pointer;
  font-size: .875rem;
  line-height: 1.6;
  color: #1e293b;
}
.cert-check-row input[type="checkbox"] {
  margin-top: .2rem;
  width: 1rem;
  height: 1rem;
  accent-color: var(--brand);
  flex-shrink: 0;
}
.cert-check-row a { color: var(--brand); }
.cert-date {
  font-size: .9rem;
  color: #475569;
  font-weight: 500;
  padding: .4rem 0;
}
.cert-sig-label {
  display: block;
  font-size: .875rem;
  font-weight: 600;
  margin-bottom: .4rem;
  color: #1e293b;
}
.cert-sig-hint {
  font-size: .78rem;
  color: var(--muted);
  margin-top: .3rem;
}
.cert-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.25rem 0;
}

/* Reverse mortgage — senior-friendly sizing */
.rev-senior { font-size: 1.0625rem; }
.rev-senior .fg { margin-bottom: 1.5rem; }
.rev-senior label { font-size: 1rem; font-weight: 600; }
.rev-senior input,
.rev-senior select,
.rev-senior textarea { font-size: 1rem; padding: .7rem .9rem; }
.rev-senior .field-hint { font-size: .9rem; }
.rev-senior .hint { font-size: 1rem; line-height: 1.65; margin-bottom: 1.5rem; }
.rev-senior h2.section-sub { font-size: 1rem; font-weight: 700; margin: 1.5rem 0 .75rem; color: var(--muted); }

/* Decline pages */
.decline-card { text-align: center; padding: 2.5rem 2rem; }
.decline-icon { font-size: 3rem; margin-bottom: 1rem; }
.decline-card h1 { font-size: 1.4rem; margin-bottom: .75rem; }
.decline-card p { color: var(--muted); line-height: 1.65; margin-bottom: 1rem; }
.decline-card .phone-large { font-size: 1.5rem; font-weight: 700; color: var(--brand); display: block; margin: 1rem 0; }

