/* ============================================================
   Begin Application wizard (page2) - reuses tokens from styles.css
   ============================================================ */
.apply-body { background: var(--paper); color: var(--ink); min-height: 100vh; display: flex; flex-direction: column; }

.apply-header { background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.apply-header-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.apply-brand img { height: 34px; width: auto; display: block; }
.apply-exit { color: var(--muted); font-weight: 600; font-size: .92rem; }
.apply-exit:hover { color: var(--navy); }

.apply-main { flex: 1; padding: clamp(28px, 5vw, 56px) 0 64px; }
.apply-shell { max-width: 820px; }

/* Step indicator */
.apply-steps { list-style: none; display: flex; gap: 10px; margin: 0 0 28px; padding: 0; flex-wrap: wrap; }
.apply-steps[hidden] { display: none; }
.apply-steps li { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: .9rem; color: var(--muted); }
.apply-steps li span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--line); color: var(--muted); font-size: .82rem; }
.apply-steps li:not(:last-child)::after { content: ""; width: 26px; height: 2px; background: var(--line); margin-left: 4px; }
.apply-steps li.is-active { color: var(--navy); }
.apply-steps li.is-active span { background: var(--navy); color: var(--white); }
.apply-steps li.is-done span { background: var(--navy-500); color: var(--white); }

/* Card */
.apply-step { display: none; }
.apply-step.is-active { display: block; animation: apply-fade .35s var(--ease); }
@keyframes apply-fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.apply-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(24px, 4vw, 40px); box-shadow: var(--shadow-sm); }
.apply-step h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); color: var(--navy); }
.apply-lead { color: var(--muted); margin: 8px 0 26px; font-size: 1.02rem; max-width: 60ch; }

/* Step 0 - choose path */
.choose-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 6px; }
.choose-card { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 8px; background: var(--paper); border: 1.5px solid var(--line-strong); border-radius: 16px; padding: 26px 24px 24px; cursor: pointer; transition: border-color .16s var(--ease), box-shadow .16s var(--ease), transform .16s var(--ease); }
.choose-card:hover { border-color: var(--navy); box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.choose-card:focus-visible { outline: 2px solid var(--navy); outline-offset: 3px; }
.choose-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px; background: rgba(6,33,89,.08); color: var(--navy); margin-bottom: 6px; }
.choose-icon svg { width: 24px; height: 24px; }
.choose-card h2 { color: var(--navy); font-size: 1.2rem; }
.choose-card p { color: var(--muted); font-size: .95rem; line-height: 1.55; margin: 0; }
.choose-go { margin-top: auto; padding-top: 12px; color: var(--navy); font-weight: 700; font-size: .95rem; }
.choose-card-primary { background: var(--navy); border-color: var(--navy); }
.choose-card-primary h2, .choose-card-primary .choose-go { color: var(--white); }
.choose-card-primary p { color: rgba(255,255,255,.82); }
.choose-card-primary .choose-icon { background: rgba(255,255,255,.14); color: var(--white); }
.choose-card-primary:hover { border-color: var(--white); }
@media (max-width: 620px) { .choose-grid { grid-template-columns: 1fr; } }

/* Applicant blocks */
.applicant { border: 1px solid var(--line); border-radius: 14px; padding: 22px; margin-bottom: 16px; background: var(--paper); }
.applicant-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.applicant-head h3 { color: var(--navy); font-size: 1.05rem; }
.applicant-remove { background: none; border: 0; color: var(--muted); font-weight: 600; font-size: .86rem; cursor: pointer; }
.applicant-remove:hover { color: #b3261e; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; color: var(--navy); font-size: .88rem; margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field-row { display: flex; gap: 16px; }
.field-row .field { flex: 1; }
.apply-input { font: inherit; padding: 12px 14px; border: 1.5px solid var(--line-strong); border-radius: 10px; background: var(--white); color: var(--ink); width: 100%; }
.apply-input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(6,33,89,.12); }
.apply-input.invalid, .ff-textarea.invalid { border-color: #b3261e; box-shadow: 0 0 0 3px rgba(179,38,30,.12); }

.add-applicant { background: transparent; border: 1.5px dashed var(--line-strong); color: var(--navy); font-weight: 700; border-radius: 12px; padding: 14px; width: 100%; cursor: pointer; transition: border-color .2s var(--ease), background .2s var(--ease); }
.add-applicant:hover:not(:disabled) { border-color: var(--navy); background: rgba(6,33,89,.03); }
.add-applicant:disabled { opacity: .5; cursor: not-allowed; }

.apply-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 26px; flex-wrap: wrap; }
.apply-nav .btn { min-width: 140px; }

/* Document force-read */
.doc-scroll { height: 46vh; min-height: 320px; overflow-y: auto; border: 1px solid var(--line-strong); border-radius: 12px; padding: 24px 26px; background: var(--white); scroll-behavior: smooth; }
.doc-scroll h2 { color: var(--navy); font-size: 1.15rem; margin: 26px 0 8px; }
.doc-scroll h2:first-child { margin-top: 0; }
.doc-scroll h3 { color: var(--navy); font-size: .98rem; margin: 16px 0 4px; }
.doc-scroll p, .doc-scroll li { color: var(--ink); font-size: .92rem; line-height: 1.6; margin-bottom: 10px; }
.doc-scroll ul { padding-left: 20px; margin-bottom: 10px; }
.doc-scroll .doc-meta { color: var(--muted); font-size: .82rem; }
.doc-table { width: 100%; border-collapse: collapse; margin: 8px 0 14px; font-size: .9rem; }
.doc-table th, .doc-table td { text-align: left; padding: 7px 10px; border: 1px solid var(--line); vertical-align: top; }
.doc-table th { background: var(--paper); color: var(--navy); width: 38%; }
.doc-end { height: 1px; }

.doc-hint { text-align: center; color: var(--muted); font-weight: 600; font-size: .9rem; margin: 14px 0 0; transition: opacity .3s var(--ease); }
.doc-progress { height: 4px; background: var(--line); border-radius: 999px; margin-top: 10px; overflow: hidden; }
.doc-progress span { display: block; height: 100%; width: 0; background: var(--navy); transition: width .1s linear; }

.consent-block { margin-top: 24px; }
.consent-block[hidden] { display: none; }
.consent-download { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--navy-500); margin-bottom: 18px; }
.consent-intro { color: var(--navy); font-weight: 700; margin-bottom: 14px; }
.sign-block { border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin-bottom: 14px; background: var(--paper); }
.sign-statement { font-size: .92rem; line-height: 1.55; color: var(--ink); margin-bottom: 14px; }
.sign-statement strong { color: var(--navy); }
.sign-row { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.sign-row .field { flex: 1; min-width: 220px; margin-bottom: 0; }
.sign-check { display: flex; align-items: flex-start; gap: 10px; margin-top: 14px; font-size: .9rem; color: var(--ink); font-weight: 500; cursor: pointer; }
.sign-check input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--navy); flex: 0 0 auto; }

/* Success */
.apply-success { text-align: center; padding: 10px 0; }
.apply-success .success-mark { width: 72px; height: 72px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 50%; background: rgba(6,33,89,.08); color: var(--navy); }
.apply-success .success-mark svg { width: 38px; height: 38px; }
.apply-success h1 { margin-bottom: 8px; }
.apply-success p { color: var(--muted); max-width: 46ch; margin: 0 auto 18px; }
.apply-success .btn { margin-top: 6px; }
.next-note { color: var(--muted); font-size: .9rem; margin-top: 20px; }

.apply-error { color: #b3261e; font-weight: 600; font-size: .9rem; margin-top: 12px; }

/* Fact find - panels + tap-first controls */
.ff-panel { display: none; }
.ff-panel.is-active { display: block; animation: apply-fade .3s var(--ease); }
.ff-section-title { font-size: clamp(1.5rem, 2.8vw, 2.1rem); color: var(--navy); }
.ff-q { margin-top: 24px; }
.ff-q-label { display: block; font-weight: 700; color: var(--navy); margin-bottom: 10px; font-size: .98rem; }
.ff-q-label .ff-hint { color: var(--muted); font-weight: 500; font-size: .84rem; }
.ff-choice, .ff-multi { display: flex; flex-wrap: wrap; gap: 10px; }
.ff-opt { background: var(--white); border: 1.5px solid var(--line-strong); border-radius: 999px; padding: 10px 18px; font-weight: 600; color: var(--navy); cursor: pointer; font-size: .92rem; transition: border-color .15s var(--ease), background .15s var(--ease), color .15s var(--ease); }
.ff-opt:hover { border-color: var(--navy); }
.ff-opt.is-on { background: var(--navy); border-color: var(--navy); color: var(--white); }
.ff-yesno { display: inline-flex; border: 1.5px solid var(--line-strong); border-radius: 999px; overflow: hidden; }
.ff-yesno button { background: var(--white); border: 0; padding: 10px 24px; font-weight: 700; color: var(--navy); cursor: pointer; }
.ff-yesno button + button { border-left: 1.5px solid var(--line-strong); }
.ff-yesno button.is-on { background: var(--navy); color: var(--white); }
.ff-reveal[hidden] { display: none; }
.ff-reveal { margin-top: 12px; }
.ff-text, .ff-textarea { font: inherit; padding: 12px 14px; border: 1.5px solid var(--line-strong); border-radius: 10px; background: var(--white); color: var(--ink); width: 100%; }
.ff-textarea { resize: vertical; }
.ff-text:focus, .ff-textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(6,33,89,.12); }
.ff-choice.invalid, .ff-multi.invalid { outline: 2px solid rgba(179,38,30,.5); outline-offset: 6px; border-radius: 12px; }

/* repeatable item cards + per-applicant cards */
.ff-item, .ff-appcard { border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin-bottom: 14px; background: var(--paper); }
.ff-item-head, .ff-appcard-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.ff-item-head strong, .ff-appcard-head strong { color: var(--navy); }
.ff-item-x { background: none; border: 0; color: var(--muted); font-weight: 600; font-size: .84rem; cursor: pointer; }
.ff-item-x:hover { color: #b3261e; }
.ff-item .ff-q-label, .ff-appcard .ff-q-label { margin-top: 14px; }
.ff-item .field, .ff-appcard .field { margin-bottom: 0; }
.ff-add { background: transparent; border: 1.5px dashed var(--line-strong); color: var(--navy); font-weight: 700; border-radius: 12px; padding: 12px; width: 100%; cursor: pointer; transition: border-color .2s var(--ease), background .2s var(--ease); }
.ff-add:hover { border-color: var(--navy); background: rgba(6,33,89,.03); }

/* dates + currency */
.ff-date { font: inherit; padding: 12px 14px; border: 1.5px solid var(--line-strong); border-radius: 10px; background: var(--white); color: var(--ink); width: 100%; }
.ff-date:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(6,33,89,.12); }
.ff-money-wrap { display: inline-flex; align-items: center; border: 1.5px solid var(--line-strong); border-radius: 10px; background: var(--white); padding-left: 12px; width: 100%; }
.ff-money-wrap:focus-within { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(6,33,89,.12); }
.ff-money-pre { color: var(--muted); font-weight: 700; }
.ff-money { font: inherit; border: 0; background: transparent; padding: 12px 12px 12px 4px; width: 100%; color: var(--ink); }
.ff-money:focus { outline: none; }
.ff-money-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ff-money-item { display: flex; flex-direction: column; gap: 6px; font-weight: 600; color: var(--navy); font-size: .88rem; }
.ff-expense-total { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin-bottom: 18px; color: var(--navy); font-weight: 600; }
.ff-expense-total strong { font-size: 1.15rem; }

/* running totals (assets, liabilities, expenses) */
.ff-total { display: flex; align-items: center; justify-content: space-between; gap: 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 13px 18px; margin-top: 14px; color: var(--navy); font-weight: 600; }
.ff-total strong { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.ff-total-lg { margin-top: 20px; border: 1.5px solid var(--navy); background: rgba(6,33,89,.03); }
.ff-total-lg strong { font-size: 1.35rem; }

/* logic-driven deal branches + category prompts */
.ff-note { background: var(--paper); border: 1px solid var(--line); border-left: 3px solid var(--navy-500); border-radius: 8px; padding: 12px 14px; color: var(--muted); font-size: .88rem; line-height: 1.5; }
.deal-detail { border: 1px solid var(--line); border-radius: 14px; padding: 22px; margin-bottom: 16px; background: var(--paper); }
.deal-detail-title { color: var(--navy); font-size: 1.05rem; margin-bottom: 6px; }
.ff-catprompts { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 6px; }
.ff-cat { background: var(--white); border: 1.5px solid var(--line-strong); border-radius: 999px; padding: 9px 16px; font-weight: 600; color: var(--navy); cursor: pointer; font-size: .9rem; transition: border-color .15s var(--ease), background .15s var(--ease); }
.ff-cat:hover { border-color: var(--navy); background: rgba(6,33,89,.03); }
.ff-cat::before { content: "+ "; color: var(--navy-500); font-weight: 800; }

/* review */
.review-summary { display: flex; flex-direction: column; gap: 12px; }
.review-row { border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; background: var(--paper); }
.review-row h4 { color: var(--navy); font-size: .88rem; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; }
.review-row p { color: var(--ink); font-size: .92rem; line-height: 1.5; }
@media (max-width: 560px) { .ff-money-grid { grid-template-columns: 1fr; } }

/* Fact find - deal type builder */
.deal-list { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 6px; }
.deal-list:empty { margin: 0; }
.deal-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--paper); border: 1px solid var(--line-strong); border-radius: 999px; padding: 8px 6px 8px 16px; font-weight: 600; color: var(--navy); font-size: .9rem; }
.deal-chip .deal-chip-x { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1.15rem; line-height: 1; padding: 0 6px; }
.deal-chip .deal-chip-x:hover { color: #b3261e; }
.deal-builder { margin-top: 16px; }
.deal-q { font-weight: 700; color: var(--navy); margin-bottom: 12px; }
.deal-cats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.deal-cat { text-align: left; background: var(--white); border: 1.5px solid var(--line-strong); border-radius: 14px; padding: 18px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; transition: border-color .2s var(--ease), box-shadow .2s var(--ease), transform .2s var(--ease); }
.deal-cat strong { color: var(--navy); font-size: 1.05rem; }
.deal-cat span { color: var(--muted); font-size: .84rem; font-weight: 500; }
.deal-cat:hover { border-color: var(--navy); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.deal-cat.is-selected { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(6,33,89,.12); }
.deal-unsure { margin-top: 12px; background: none; border: 0; color: var(--navy-500); font-weight: 700; font-size: .9rem; cursor: pointer; text-decoration: underline; padding: 0; }
.deal-examples { margin-top: 12px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.deal-examples[hidden] { display: none; }
.deal-examples h4 { color: var(--navy); font-size: .9rem; margin-bottom: 4px; }
.deal-examples p { color: var(--muted); font-size: .84rem; line-height: 1.5; }
.deal-purpose { margin-top: 22px; }
.deal-purpose[hidden] { display: none; }
.deal-purposes { display: flex; flex-wrap: wrap; gap: 10px; }
.deal-purpose-btn { background: var(--white); border: 1.5px solid var(--line-strong); border-radius: 999px; padding: 10px 18px; font-weight: 600; color: var(--navy); cursor: pointer; font-size: .92rem; transition: border-color .2s var(--ease), background .2s var(--ease); }
.deal-purpose-btn:hover { border-color: var(--navy); background: rgba(6,33,89,.03); }
.deal-added-note { color: var(--muted); font-size: .88rem; margin-top: 14px; }
@media (max-width: 640px) { .deal-cats, .deal-examples { grid-template-columns: 1fr; } }

.apply-foot { background: var(--navy-900); color: rgba(255,255,255,.6); padding: 22px 0; font-size: .82rem; }
.apply-foot p { max-width: 820px; }

@media (max-width: 560px) {
  .field-row { flex-direction: column; gap: 0; }
  .apply-nav .btn { flex: 1; min-width: 0; }
}
