/* ============================================================
   Fact-Find specific styles
   ============================================================ */

.ff-page { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg-app); }

/* ── Header ── */
.ff-header {
  background: var(--olive-deep); color: var(--white);
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 32px;
  position: sticky; top: 0; z-index: 50;
}
.ff-logo { display: flex; align-items: center; gap: 0; }
/* The reverse lockup is already cream artwork, so no filter is applied.
   Minimum digital width in the brand guide is 140px. */
.ff-logo-img { height: 34px; width: auto; min-width: 148px; display: block; }
.ff-logo-mark { width: 34px; height: 34px; display: block; }
.ff-logo-wordmark { color: var(--white); font-size: 14px; font-weight: 700; letter-spacing: 0.02em; }
.ff-header-tag {
  font-size: 10px; font-weight: 700; letter-spacing: 0.25em;
  color: var(--amber-light); text-transform: uppercase;
}
@media (max-width: 720px) {
  .ff-logo-img { height: 26px; min-width: 140px; }
}

/* ── Hero ── */
.ff-hero {
  background: var(--olive-deep); color: var(--white);
  padding: 56px 48px 64px;
  position: relative; overflow: hidden;
}
.ff-hero::before {
  content: ''; position: absolute; top: -120px; right: -120px;
  width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle, rgba(128,143,114,.45), transparent 70%);
}
.ff-hero-inner {
  position: relative; max-width: 1180px; margin: 0 auto;
}
.ff-hero-copy { min-width: 0; }
.ff-hero-eyebrow { color: var(--amber-light); }
.ff-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(34px, 4.2vw, 56px); font-weight: 700;
  line-height: 1.08; letter-spacing: 0;
  margin: 12px 0 14px; max-width: 720px;
  color: var(--white);
}
.ff-hero h1 em { font-style: normal; color: var(--amber-light); }
.ff-hero-sub {
  max-width: 560px; color: rgba(255,255,255,.65);
  font-size: 15px; line-height: 1.55; margin: 0;
}
.ff-hero-meta {
  display: flex; gap: 24px; margin-top: 28px; flex-wrap: wrap;
  font-size: 12px; font-weight: 600; color: rgba(255,255,255,.6);
}
.ff-hero-meta .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--amber-light); display: inline-block; margin-right: 8px; vertical-align: middle; }

/* Save strip ON hero, not stuffed below */
.ff-save-strip {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--r-md);
  padding: 14px 18px;
  display: flex; align-items: center; gap: 12px;
  margin-top: 28px; flex-wrap: wrap;
}
.ff-save-strip .lbl { font-size: 11px; font-weight: 700; letter-spacing: 0.2em; color: var(--amber-light); text-transform: uppercase; white-space: nowrap; }
.ff-save-strip input {
  flex: 1; min-width: 180px;
  background: rgba(0,0,0,.25); border: 1px solid rgba(255,255,255,.18); color: white;
  padding: 10px 12px; border-radius: var(--r-sm);
  font-family: ui-monospace, monospace; font-size: 12px; letter-spacing: 0.12em;
  outline: none;
}
.ff-save-strip input::placeholder { color: rgba(255,255,255,.28); }
.ff-save-strip input:focus { border-color: var(--amber-light); }
.ff-save-strip .saved-code {
  font-family: ui-monospace, monospace; font-size: 13px; font-weight: 700;
  color: var(--amber-light); padding: 10px 12px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(234,190,85,.35); border-radius: var(--r-sm);
  letter-spacing: 0.15em;
}

/* ── Progress rail ── */
.ff-rail {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 66px; z-index: 40;
}
.ff-rail-inner {
  max-width: 1180px; margin: 0 auto;
  padding: 14px 32px;
  display: flex; align-items: center; gap: 24px;
}
.ff-rail-label { font-size: 11px; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; color: var(--mute); white-space: nowrap; }
.ff-rail-steps {
  display: flex; gap: 8px; flex: 1;
}
.ff-rail-step {
  flex: 1; display: flex; flex-direction: column; gap: 6px;
  cursor: pointer; padding: 4px 0;
}
.ff-rail-bar {
  height: 4px; border-radius: 2px; background: var(--line);
  transition: background var(--t-med) var(--ease);
}
.ff-rail-step.complete .ff-rail-bar { background: var(--green); }
.ff-rail-step.active .ff-rail-bar { background: var(--accent); }
.ff-rail-txt {
  /* --mute-2 is 3.2:1 on white; the step labels need --mute (5.4:1). */
  font-size: 11px; font-weight: 700; color: var(--mute);
  text-transform: uppercase; letter-spacing: 0.08em;
  transition: color var(--t-fast) var(--ease);
}
.ff-rail-step.active .ff-rail-txt { color: var(--navy); }
.ff-rail-step.complete .ff-rail-txt { color: var(--navy); }
.ff-rail-step:hover .ff-rail-txt { color: var(--navy); }
.ff-rail-pct {
  font-size: 13px; font-weight: 800; color: var(--navy);
  white-space: nowrap;
}

/* ── Layout ── */
.ff-layout { max-width: 1180px; margin: 0 auto; padding: 40px 32px 80px; display: flex; gap: 40px; }
.ff-sidebar { width: 240px; flex-shrink: 0; position: sticky; top: 146px; align-self: flex-start; }
.ff-main { flex: 1; min-width: 0; }

.ff-nav { display: flex; flex-direction: column; gap: 4px; }
.ff-nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--r-md);
  cursor: pointer;
  font-size: 13px; font-weight: 700; color: var(--mute);
  border: 1.5px solid transparent;
  transition: all var(--t-fast) var(--ease);
  text-align: left; width: 100%;
}
.ff-nav-item:hover { background: var(--white); color: var(--navy); }
.ff-nav-item.active { background: var(--olive-deep); color: var(--white); border-color: var(--olive-deep); }
/* Amber badge on the deep-olive active row - the number needs to read against
   the row, so it cannot reuse the row's own fill. */
.ff-nav-item.active .ff-nav-num { background: var(--amber); color: var(--charcoal); }
.ff-nav-item.complete .ff-nav-num { background: var(--olive-deep); color: var(--white); }
.ff-nav-item.complete { color: var(--navy); }
.ff-nav-num {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--line); color: var(--navy);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; flex-shrink: 0;
  transition: all var(--t-fast) var(--ease);
}
.ff-nav-check { margin-left: auto; color: var(--olive-deep); font-weight: 800; }
.ff-nav-item.active .ff-nav-check { color: var(--amber-light); }

.ff-privacy {
  margin-top: 20px; padding: 16px;
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-size: 12px; line-height: 1.55; color: var(--mute);
}
.ff-privacy-title { font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--navy); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.ff-privacy-title .lock { color: var(--olive-deep); }
.ff-privacy-link { color: var(--navy); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.ff-privacy-link:hover { color: var(--olive-deep); }

/* ── Section heading ── */
.ff-section-head {
  margin-bottom: 24px;
}
/* --accent is Amber Gold, only 2.4:1 on the cream canvas at 11px.
   Small amber text uses the deeper ochre. */
.ff-section-head .eyebrow { color: var(--amber-ink); }
.ff-section-head h2 {
  margin: 8px 0 6px; font-size: 34px; font-weight: 800; letter-spacing: 0;
  line-height: 1.05; color: var(--navy);
}
.ff-section-head p { margin: 0; color: var(--mute); font-size: 15px; max-width: 640px; }

/* ── Cards ── */
.section-body .card { margin-bottom: 20px; }
.card-title {
  font-size: 17px; font-weight: 800; color: var(--navy);
  letter-spacing: 0;
  padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 20px;
}

/* ── Sub-heading inside a card ── */
.sub-heading {
  font-size: 13px; font-weight: 800; color: var(--navy);
  letter-spacing: 0.02em; text-transform: uppercase;
  margin: 0 0 10px;
}

/* ── Grids ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 20px; }

/* ── Reveal ── */
.reveal { animation: ffUp var(--t-med) var(--ease) both; }
@keyframes ffUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Callout ── */
.callout-box {
  display: flex; gap: 12px; margin-top: 16px;
  padding: 14px 16px; border-radius: var(--r-md);
  font-size: 13px; line-height: 1.55;
}
.callout-icon {
  width: 24px; height: 24px; border-radius: 50%;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 12px;
}
.callout-info { background: rgba(27,48,88,.05); color: var(--navy); border-left: 3px solid var(--accent); }
.callout-info .callout-icon { background: var(--accent); color: var(--white); }
.callout-warn { background: #FFF7E0; color: #7A5B00; border-left: 3px solid #F59E0B; }
.callout-warn .callout-icon { background: #F59E0B; color: white; }

/* ── Person tabs ── */
.person-tabs {
  display: inline-flex; gap: 4px; background: var(--off-white);
  padding: 4px; border-radius: var(--r-md); margin-bottom: 20px;
  border: 1px solid var(--line);
}
.ptab {
  padding: 10px 18px; border-radius: var(--r-sm);
  font-size: 12px; font-weight: 800; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--mute);
  transition: all var(--t-fast) var(--ease);
}
.ptab:hover { color: var(--navy); }
.ptab.on { background: var(--olive-deep); color: var(--white); }
/* --accent is Amber Gold, 2.5:1 on the inset. Small amber text uses the ink. */
.ptab-add { color: var(--amber-ink); border: 1.5px dashed var(--line); }
.ptab-add:hover { background: var(--accent-soft); border-color: var(--accent); }

/* ── Repeat items ── */
.repeat-item {
  padding: 16px 18px; background: var(--off-white);
  border: 1.5px solid var(--line); border-radius: var(--r-md);
  margin-bottom: 14px;
}
.repeat-item-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px;
}
.repeat-item-title {
  font-size: 11px; font-weight: 800; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--accent);
}
.repeat-remove {
  font-size: 11px; font-weight: 700; color: var(--magenta);
  letter-spacing: 0.05em;
}
.repeat-remove:hover { text-decoration: underline; }
.add-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  border: 1.5px dashed var(--line); border-radius: var(--r-md);
  font-size: 12px; font-weight: 800; letter-spacing: 0.05em;
  color: var(--accent); background: transparent;
  transition: all var(--t-fast) var(--ease);
  margin-top: 8px;
}
.add-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.add-btn-plus { font-size: 15px; line-height: 1; font-weight: 800; }

/* ── Dividers in cards ── */
.section-body .card .divider { margin: 22px 0; background: var(--line); height: 1px; border: 0; }

/* ── Expense tabs ── */
.exp-tabs { display: flex; margin-bottom: 18px; border-radius: var(--r-md); overflow: hidden; border: 1.5px solid var(--line); width: fit-content; }
.exp-tab {
  padding: 10px 20px; font-size: 12px; font-weight: 800;
  letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--mute); background: var(--off-white);
}
.exp-tab.on { background: var(--accent); color: white; }

/* ── Risk questions ── */
.risk-intro {
  padding: 14px 16px; background: var(--off-white);
  border-radius: var(--r-md); font-size: 13px; color: var(--ink-soft);
  margin-bottom: 20px; line-height: 1.55;
}
.risk-q { margin-bottom: 24px; }
.risk-q:last-child { margin-bottom: 0; }
.risk-q-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.risk-q-num {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: white;
  font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.risk-q-text { font-size: 14px; font-weight: 700; color: var(--navy); line-height: 1.4; }
.risk-q-opts { display: flex; flex-direction: column; gap: 8px; }
.risk-opt {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-radius: var(--r-md);
  background: var(--white); border: 1.5px solid var(--line);
  text-align: left; width: 100%;
  font-size: 14px; font-weight: 600; color: var(--navy);
  transition: all var(--t-fast) var(--ease);
}
.risk-opt:hover { border-color: var(--line-strong); background: var(--off-white); }
.risk-opt.on {
  border-color: var(--accent); background: var(--accent-soft); color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.risk-letter {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--off-white); color: var(--mute);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; flex-shrink: 0;
}
.risk-opt.on .risk-letter { background: var(--accent); color: white; }

/* ── Goals ── */
.goals-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.goals-sub { font-size: 13px; color: var(--mute); }
.goals-count {
  font-size: 12px; font-weight: 800; letter-spacing: 0.05em;
  padding: 4px 10px; border-radius: var(--r-pill);
  background: var(--accent-soft); color: var(--accent);
}
.goals-count.full { background: rgba(128,143,114,.12); color: #3F4A36; }
.goals-bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.goals-bar-fill {
  height: 100%; background: var(--accent);
  border-radius: 3px; transition: width var(--t-med) var(--ease);
}
.chip-disabled { opacity: 0.4; cursor: not-allowed; }

.goals-priority {
  margin-top: 22px; padding: 16px; background: var(--off-white);
  border-radius: var(--r-md); border: 1px solid var(--line);
}
.goals-priority-title {
  font-size: 11px; font-weight: 800; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 10px;
}
.priority-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; background: var(--white);
  border-radius: var(--r-sm); margin-bottom: 6px;
  border: 1px solid var(--line);
}
.priority-row:last-child { margin-bottom: 0; }
.priority-num {
  width: 24px; height: 24px; border-radius: 50%; color: white;
  font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.priority-label { flex: 1; font-size: 13px; font-weight: 700; color: var(--navy); }
.priority-remove {
  font-size: 18px; color: var(--mute); width: 24px; height: 24px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.priority-remove:hover { background: var(--magenta); color: white; }

.empty-hint { font-size: 13px; color: var(--mute); padding: 18px; background: var(--off-white); border-radius: var(--r-md); text-align: center; border: 1.5px dashed var(--line); }

/* ── Nav footer ── */
.ff-footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 32px; padding-top: 24px; border-top: 1.5px solid var(--line);
  gap: 12px; flex-wrap: wrap;
}
.ff-footer-status {
  font-size: 12px; color: var(--mute); font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.ff-footer-status .ok { color: var(--olive-deep); }
.ff-footer-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.9); } }

/* ── Confirm screen ── */
/* Read-only "Open fact-find" view: block editing everywhere in the section
   body, but keep the primary/partner tabs clickable so staff can switch
   between the two people's answers. */
.ff-ro-lock { pointer-events: none; }
.ff-ro-lock .person-tabs, .ff-ro-lock .person-tabs * { pointer-events: auto; }

/* Staff banner across the top of an "Open fact-find" session. Grey while
   read-only, magenta once a rank-5 adviser unlocks editing - the colour
   change is the main signal that keystrokes now reach the client's record. */
.ff-staff-bar {
  display: flex; align-items: center; justify-content: center;
  gap: 14px; flex-wrap: wrap;
  padding: 8px 14px; text-align: center;
  font-size: 13px; font-weight: 600; color: #fff;
}
.ff-staff-bar-ro { background: #5F5E5A; }
.ff-staff-bar-edit { background: #A6412F; }
.ff-staff-bar-btn {
  flex: 0 0 auto;
  padding: 4px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.55);
  color: #fff; font: inherit; font-size: 12px; font-weight: 700;
  cursor: pointer; white-space: nowrap;
  transition: background 0.15s ease;
}
.ff-staff-bar-btn:hover { background: rgba(255, 255, 255, 0.3); }
.ff-staff-bar-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.ff-confirm {
  max-width: 760px; margin: 60px auto; text-align: center;
  padding: 60px 56px;
  background: var(--white); border-radius: var(--r-xl);
  border: 1px solid var(--line); box-shadow: var(--shadow-2);
}
.ff-confirm-icon {
  width: 80px; height: 80px; margin: 0 auto 20px;
  background: var(--olive-deep); color: var(--white);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 36px; font-weight: 800;
}
.ff-confirm h2 { font-size: 36px; font-weight: 800; letter-spacing: 0; margin: 0 0 12px; }
.ff-confirm p { color: var(--mute); line-height: 1.6; margin: 0 0 28px; }
.ff-confirm .ref {
  display: inline-block; padding: 10px 18px;
  background: var(--off-white); border-radius: var(--r-md);
  font-family: ui-monospace, monospace; font-size: 14px; font-weight: 800;
  letter-spacing: 0.1em; color: var(--navy); margin-bottom: 28px;
}

/* ── Tweaks panel ── */
.tweaks-panel {
  position: fixed; bottom: 20px; right: 20px;
  background: var(--olive-deep); color: white;
  padding: 18px 20px; border-radius: var(--r-md);
  box-shadow: var(--shadow-3); z-index: 80;
  min-width: 280px;
}
.tweaks-title { font-size: 11px; font-weight: 700; letter-spacing: 0.15em; color: var(--amber-light); margin-bottom: 12px; text-transform: uppercase; }
.tweaks-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tweak-sw {
  padding: 6px 10px; border-radius: var(--r-sm);
  font-size: 11px; font-weight: 800; letter-spacing: 0.04em;
  border: 1.5px solid rgba(255,255,255,.2);
  color: white;
}
.tweak-sw:hover { border-color: rgba(255,255,255,.5); }
.tweak-sw.on { border-color: var(--olive-deep); background: var(--olive-deep); color: var(--white); }

/* ── Toast ── */
.ff-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  padding: 12px 18px; border-radius: var(--r-md);
  background: var(--olive-deep); color: white;
  font-size: 13px; font-weight: 700;
  box-shadow: var(--shadow-3); z-index: 90;
  animation: ffUp var(--t-med) var(--ease);
}
.ff-toast-ok { background: var(--olive-deep); color: var(--white); }
.ff-toast-err { background: var(--magenta); color: white; }

/* ── Responsive ── */
@media (max-width: 900px) {
  /* Top-level shell: every layout container fits the viewport with no
     horizontal overflow. Without these min-width/overflow rules, a single
     wide child (e.g. a Field with `span={2}` that opens an implicit grid
     track) cascades upwards through flex/grid and forces the whole page
     past viewport width. */
  html, body { overflow-x: hidden; }
  .ff-page, .ff-layout, .ff-main, .section-body, .section-body .card,
  .ff-sidebar, .ff-header, .ff-hero, .ff-rail {
    max-width: 100vw;
    min-width: 0;
  }
  .ff-layout { flex-direction: column; padding: 20px 16px; gap: 20px; }
  /* Sidebar hidden on mobile — the .ff-rail at the top already provides
     section navigation, and the "Your data is safe" copy is non-essential
     for the touch flow. Removes the confusing duplicate "01 Personal"
     card that didn't auto-scroll when the user jumped sections. */
  .ff-sidebar { display: none; }
  .ff-hero { padding: 36px 20px 44px; }
  .ff-hero h1 { font-size: 32px; }
  .ff-header { padding: 14px 20px; }
  /* Rail polish — clear three-state design + no overlap with the % badge.
     ─────────────────────────────────────────────────────────────────────
     Layout: a horizontally-scrolling row of step pills on the LEFT and a
     fixed percentage badge on the RIGHT, with a proper gap between so
     "17%" never bumps into "05 RISK". State colours are now distinct so
     the current section is unambiguous:
       • ACTIVE   → solid navy fill, white text (current section)
       • COMPLETE → soft green tint, navy text, green check
       • PENDING  → neutral, mute text
     A right-edge gradient hints there's more to scroll past the visible
     edge. */
  .ff-rail-inner {
    padding: 12px 12px 12px 16px; gap: 0;
    display: flex; align-items: center;
  }
  .ff-rail-label { display: none; }
  .ff-rail-steps {
    flex: 1; min-width: 0;
    display: flex; gap: 6px;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Soft fade on the right so users see there's content past the edge */
    -webkit-mask-image: linear-gradient(to right, #000 0, #000 92%, transparent 100%);
            mask-image: linear-gradient(to right, #000 0, #000 92%, transparent 100%);
  }
  .ff-rail-steps::-webkit-scrollbar { display: none; }
  .ff-rail-step {
    flex-shrink: 0;
    min-width: 76px;
    padding: 7px 10px 9px;
    border-radius: 10px;
    background: transparent;
    transition: background 0.15s ease, color 0.15s ease;
  }
  .ff-rail-step.complete { background: rgba(128,143,114, 0.12); }
  .ff-rail-step.active   { background: var(--olive-deep); }
  .ff-rail-step .ff-rail-bar {
    height: 4px; border-radius: 2px; margin-bottom: 6px;
    background: var(--line);
  }
  .ff-rail-step.complete .ff-rail-bar { background: var(--green); }
  .ff-rail-step.active   .ff-rail-bar { background: var(--green); }
  .ff-rail-step .ff-rail-txt {
    font-size: 11px; line-height: 1.25; font-weight: 700;
    letter-spacing: 0.04em; white-space: normal;
    color: var(--mute);
  }
  .ff-rail-step.complete .ff-rail-txt { color: var(--navy); }
  .ff-rail-step.active   .ff-rail-txt { color: #fff; }
  /* Percentage badge pinned to the right, OUTSIDE the scrolling steps so
     the last step never collides with it. */
  .ff-rail-pct {
    flex-shrink: 0;
    margin-left: 12px; padding-left: 12px;
    border-left: 1px solid var(--line);
    font-size: 15px; font-weight: 800;
    color: var(--navy);
  }
  .ff-section-head h2 { font-size: 26px; }
  /* Card padding tightens so 28px each side doesn't eat half the screen. */
  .section-body .card { padding: 20px 18px; }
  /* Footer buttons — uniform vertical stack on mobile.
     ────────────────────────────────────────────────
     Desktop has three items on one row (Back+Save left, Status middle,
     Next right). On a phone they used to wrap haphazardly into a 2-row
     mess. Now: primary Next button is full-width at the TOP (where the
     thumb sits), Back + Save sit side-by-side below, and the autosave
     status is muted micro-copy underneath. */
  .ff-footer {
    flex-direction: column; align-items: stretch;
    gap: 14px; margin-top: 24px; padding-top: 20px;
  }
  .ff-footer > button {
    order: -1;                       /* primary Next button jumps to top */
    width: 100%;
    padding: 14px 20px;              /* bigger touch target */
    font-size: 15px;
    justify-content: center;
  }
  .ff-footer > .row {                /* Back + Save group */
    order: 1;
    display: flex; gap: 10px;
    justify-content: space-between;
  }
  .ff-footer > .row .btn { flex: 1; padding: 12px 16px; text-align: center; }
  .ff-footer > .ff-footer-status {
    order: 2;
    justify-content: center;
    font-size: 11px;
    padding-top: 4px;
  }
  /* Grid collapse — force single column AND override any implicit tracks
     opened by `span` props. Without the second rule, items with
     `gridColumn: span 2` from the Field primitive open a phantom second
     column and the layout reflows to fit both. */
  .grid-2, .grid-3 {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-auto-columns: minmax(0, 1fr);
  }
  .grid-2 > *, .grid-3 > * {
    grid-column: 1 / -1 !important;     /* every cell takes the single column */
    min-width: 0;                        /* allow shrink-to-fit inside */
    max-width: 100%;
  }
  /* Form primitives: inputs/selects/textareas already have width:100%, but
     long unbroken content can still push width. Cap and wrap. */
  .input, .select, .textarea { max-width: 100%; min-width: 0; }
  .field, .field-label, .field-hint { max-width: 100%; min-width: 0; word-wrap: break-word; overflow-wrap: anywhere; }
  /* Chip-groups wrap nicely already, but ensure they don't push wider than
     the container if a chip has a long label. */
  .chip-group { flex-wrap: wrap; max-width: 100%; }
  .chip { max-width: 100%; }
  /* RepeatItem container (super fund, property, etc.) — tighten its inner
     padding on mobile so two stacked cards don't burn margin. */
  .repeat-item { padding: 16px; }
}

/* ── Inline "I'm not sure" checkbox under money inputs ── */
.muted-checkbox {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--mute); cursor: pointer;
  user-select: none;
}
.muted-checkbox input[type="checkbox"] {
  width: 14px; height: 14px; cursor: pointer; accent-color: var(--accent);
}

/* ── Modal (used for travel disclaimer etc.) ── */
.ff-modal-backdrop {
  position: fixed; inset: 0; background: rgba(63,74,54, 0.55);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 24px;
  animation: ffModalFade 0.18s var(--ease) both;
}
.ff-modal {
  position: relative; background: var(--white);
  border-radius: var(--r-lg); max-width: 520px; width: 100%;
  padding: 28px 30px 24px; box-shadow: 0 24px 60px rgba(63,74,54, 0.35);
  animation: ffModalUp 0.22s var(--ease) both;
}
.ff-modal-close {
  position: absolute; top: 10px; right: 12px;
  width: 32px; height: 32px; border-radius: 50%;
  background: transparent; border: 0; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--mute);
}
.ff-modal-close:hover { background: rgba(0,0,0,0.05); color: var(--ink); }
.modal-title {
  font-size: 19px; font-weight: 800; color: var(--navy);
  letter-spacing: 0; margin: 0 0 12px;
}
.modal-body {
  font-size: 14px; line-height: 1.6; color: var(--ink);
  margin: 0 0 12px;
}
.modal-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 18px; flex-wrap: wrap;
}
.modal-actions .btn-primary {
  background: var(--accent); color: var(--white);
  padding: 10px 18px; border-radius: var(--r-sm);
  border: 0; font-weight: 700; font-size: 13px; cursor: pointer;
}
.modal-actions .btn-primary:hover { background: var(--accent); opacity: 0.85; }
.modal-actions .btn-secondary {
  background: transparent; color: var(--ink);
  padding: 10px 18px; border-radius: var(--r-sm);
  border: 1.5px solid var(--line); font-weight: 700; font-size: 13px; cursor: pointer;
}
.modal-actions .btn-secondary:hover { background: var(--off-white); }

/* Modal eyebrow — small status row at the top of a popout (e.g. travel confirm) */
.ff-confirm-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 800; letter-spacing: 0.08em;
  text-transform: uppercase; color: #B45309;
  background: #FEF3C7; border: 1px solid #FDE68A;
  padding: 6px 10px; border-radius: 999px;
}
.ff-confirm-eyebrow-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #D97706; box-shadow: 0 0 0 3px rgba(200,149,32, 0.18);
}

/* ── Inline emphasis on field labels (for "definite", etc.) ── */
.label-emph {
  background: #FFF3CD; padding: 0 4px; border-radius: 3px;
  font-weight: 800; color: var(--navy);
}

/* ── Insurance section — opening disclosure banner & prep card ── */
.ff-disclosure-banner {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 18px 20px; margin-bottom: 18px;
  background: #FFF7E0; border: 1.5px solid #F59E0B;
  border-left-width: 4px;
  border-radius: var(--r-md);
}
.ff-disclosure-icon {
  flex-shrink: 0;
  width: 28px; height: 28px; border-radius: 50%;
  background: #F59E0B; color: white;
  font-weight: 800; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px;
}
.ff-disclosure-title {
  font-size: 15px; font-weight: 800; color: #7A5B00;
  letter-spacing: 0; margin-bottom: 6px;
}
.ff-disclosure-body p {
  font-size: 13px; line-height: 1.55; color: #5C4500;
  margin: 0 0 8px;
}
.ff-disclosure-body p:last-child { margin-bottom: 0; }
.ff-disclosure-body strong { color: #4A3700; }

.ff-prep-card {
  padding: 20px 22px; margin-bottom: 22px;
  background: var(--white);
  border: 1.5px solid var(--line); border-radius: var(--r-md);
}
.ff-prep-title {
  font-size: 15px; font-weight: 800; color: var(--navy);
  letter-spacing: 0; margin: 0 0 6px;
}
.ff-prep-intro {
  font-size: 13px; line-height: 1.55; color: var(--mute);
  margin: 0 0 16px;
}
.ff-prep-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 22px;
}
.ff-prep-item {
  padding: 12px 14px;
  background: var(--off-white); border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.ff-prep-h {
  font-size: 11px; font-weight: 800; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--accent);
  margin-bottom: 6px;
}
.ff-prep-item ul {
  margin: 0; padding-left: 16px;
  font-size: 12.5px; line-height: 1.5; color: var(--ink);
}
.ff-prep-item li { margin-bottom: 3px; }
.ff-prep-item li:last-child { margin-bottom: 0; }
.ff-prep-item strong { font-weight: 700; color: var(--navy); }
.ff-prep-foot {
  font-size: 12px; line-height: 1.5; color: var(--mute);
  margin: 14px 0 0; font-style: italic;
}

@media (max-width: 600px) {
  .ff-prep-grid { grid-template-columns: 1fr; }
}

/* ── Beneficiary % total readout ── */
.bene-total {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; margin-top: 10px;
  background: var(--off-white); border: 1.5px solid var(--line);
  border-radius: var(--r-sm); font-size: 13px; font-weight: 700;
}
.bene-total .ok { color: var(--accent); }
.bene-total .bad { color: var(--magenta); }

@keyframes ffModalFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ffModalUp {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Validation: per-field error ──
   IMPORTANT: keep the error border *the same width* as the default
   (1.5px) so toggling the error state doesn't change the input's bounding
   box by 1px and cause the textarea/input to visibly "jump" while the
   user is typing. The visual emphasis comes from the box-shadow halo +
   tinted background instead. */
.field-error {
  padding: 4px 0;
}
.field-error .field-label {
  color: #B91C1C;
  margin-bottom: 8px;
}
.field-error .input,
.field-error .textarea,
.field-error .select {
  border-color: #DC2626 !important;
  background: #FEF2F2;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.10);
}
.field-error .chip-group {
  margin-top: 4px;
}
.field-error .chip-group .chip:not(.on) {
  border-color: #DC2626;
}
.field-error-msg {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 700;
  color: #B91C1C;
  display: flex; align-items: center; gap: 6px;
}
.field-error-msg::before {
  content: '!';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #DC2626;
  color: white;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

/* ── Validation: top-of-section error banner ── */
.ff-error-banner {
  background: #FEF2F2;
  border: 1.5px solid #FECACA;
  border-left: 4px solid #DC2626;
  border-radius: var(--r-md);
  padding: 18px 22px;
  margin-bottom: 24px;
  animation: ffErrorBannerIn 220ms var(--ease);
}
@keyframes ffErrorBannerIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.ff-error-banner-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 10px;
}
.ff-error-banner-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #DC2626;
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800;
  flex-shrink: 0;
}
.ff-error-banner-title {
  font-size: 15px; font-weight: 800;
  color: #7F1D1D;
  letter-spacing: 0;
}
.ff-error-banner-list {
  margin: 0; padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 4px 18px;
}
.ff-error-banner-list li {
  font-size: 13px;
  color: #991B1B;
  position: relative;
  padding-left: 14px;
}
.ff-error-banner-list li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: #DC2626;
  font-weight: 800;
}
.ff-error-banner-link {
  background: none; border: 0; padding: 4px 0;
  font-size: 13px;
  color: #991B1B;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: #DC2626;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
  display: inline-flex; align-items: baseline; gap: 8px;
  flex-wrap: wrap;
}
.ff-error-banner-link-cta {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #7F1D1D;
  background: rgba(220, 38, 38, 0.12);
  border-radius: 4px;
  padding: 2px 6px;
  text-decoration: none;
  white-space: nowrap;
}
.ff-error-banner-link:hover {
  color: #7F1D1D;
  text-decoration-color: #7F1D1D;
}
.ff-error-banner-link:hover .ff-error-banner-link-cta {
  background: rgba(220, 38, 38, 0.22);
  color: #5B1010;
}
.ff-error-banner-link:focus-visible {
  outline: 2px solid #DC2626;
  outline-offset: 2px;
  border-radius: 3px;
}
.ff-error-banner-helper {
  margin: 8px 0 14px;
  padding: 8px 12px;
  background: rgba(220, 38, 38, 0.08);
  border-left: 3px solid #DC2626;
  border-radius: 4px;
  font-size: 13px;
  color: #7F1D1D;
  line-height: 1.55;
}
.ff-error-banner-more {
  font-style: italic;
  color: #7F1D1D;
  opacity: 0.8;
}
.ff-error-banner-group + .ff-error-banner-group {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed #FECACA;
}
.ff-error-banner-section-label {
  display: flex; align-items: baseline; gap: 10px;
  margin-bottom: 6px;
}
.ff-error-banner-section-link {
  background: none; border: 0; padding: 0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7F1D1D;
  cursor: pointer;
  transition: color var(--t-fast) var(--ease);
}
.ff-error-banner-section-link:hover {
  color: #DC2626;
}
.ff-error-banner-section-count {
  font-size: 11px;
  font-weight: 700;
  color: #B91C1C;
  opacity: 0.7;
}

/* Brief highlight when banner-link nav lands on a field */
.ff-field-flash {
  animation: ffFieldFlash 1.5s ease-out;
}
@keyframes ffFieldFlash {
  0%   { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.45); }
  20%  { box-shadow: 0 0 0 12px rgba(220, 38, 38, 0.18); }
  100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

/* Sticky target highlight — applied when a banner link navigates the user
   here and stays until they interact with the field */
.ff-field-target {
  position: relative;
  border-radius: var(--r-md);
  /* Outline + soft halo. !important to win over compact field paddings. */
  box-shadow:
    0 0 0 2px #DC2626,
    0 0 0 6px rgba(220, 38, 38, 0.18) !important;
  /* Slight inset so the ring isn't clipped by adjacent fields */
  outline-offset: 2px;
  scroll-margin-top: 120px;
  animation: ffFieldTargetIn 260ms var(--ease);
}
.ff-field-target .field-label {
  color: #B91C1C;
}
.ff-field-target .input,
.ff-field-target .textarea,
.ff-field-target .select {
  border-color: #DC2626 !important;
  background: #FFF7F7;
}
@keyframes ffFieldTargetIn {
  0%   { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0), 0 0 0 0 rgba(220, 38, 38, 0); }
  60%  { box-shadow: 0 0 0 3px #DC2626, 0 0 0 14px rgba(220, 38, 38, 0.28); }
  100% { box-shadow: 0 0 0 2px #DC2626, 0 0 0 6px rgba(220, 38, 38, 0.18); }
}


/* ───────────────────────────────────────────────────
   Medical history — categorised tickbox list
   ─────────────────────────────────────────────────── */

/* Category grouping */
.ff-med-cat {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--white);
  overflow: hidden;
}
.ff-med-cat-title {
  padding: 10px 16px;
  font-size: 11.5px; font-weight: 800;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--mute);
  background: #FAF8F2;
  border-bottom: 1px solid var(--line);
}

/* Individual condition row */
.ff-med-item {
  border-bottom: 1px solid var(--line-soft, #E8E3D4);
}
.ff-med-item:last-child { border-bottom: 0; }
.ff-med-item-active {
  background: #FFFBEB;
}
.ff-med-item-toggle {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
  transition: background var(--t-fast) var(--ease);
}
.ff-med-item-toggle:hover {
  background: #FAF8F2;
}
.ff-med-item-active .ff-med-item-toggle:hover {
  background: #FEF6D9;
}
.ff-med-item-tick {
  flex: 0 0 20px; width: 20px; height: 20px;
  border-radius: 5px;
  border: 1.5px solid var(--line);
  background: var(--white);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; color: var(--white);
  transition: all var(--t-fast) var(--ease);
}
.ff-med-item-toggle.on .ff-med-item-tick {
  background: #F59E0B; border-color: #F59E0B;
}
.ff-med-item-toggle:hover .ff-med-item-tick {
  border-color: var(--accent);
}
.ff-med-item-label {
  font-size: 14px; line-height: 1.45;
  color: var(--ink);
}
.ff-med-item-toggle.on .ff-med-item-label {
  font-weight: 600;
  color: var(--navy);
}

/* Inline body for ticked condition */
.ff-med-item-body {
  padding: 14px 18px 18px 48px;
  background: var(--white);
  border-top: 1px dashed #FCD34D;
  animation: ffMedExpand 0.22s var(--ease) both;
}
@keyframes ffMedExpand {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (max-width: 640px) {
  .ff-med-item-body { padding-left: 16px; }
}


/* ───────────────────────────────────────────────────
   Required-field asterisk + dependants display
   ─────────────────────────────────────────────────── */
.field-label .req,
.card-title .req,
.req {
  display: inline-block;
  margin-left: 4px;
  color: #DC2626;
  font-weight: 800;
  font-size: 14px;
  line-height: 1;
  vertical-align: middle;
  position: relative;
  top: -1px;
}

/* "Required" pill that can replace the asterisk on dense forms — currently unused */
.field-label-required-pill {
  display: inline-block;
  margin-left: 8px;
  font-size: 9.5px; font-weight: 800;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: #B91C1C;
  background: #FEE2E2;
  padding: 2px 6px; border-radius: 3px;
  vertical-align: middle;
}

/* Dependants display (read-only) on Insurance section */
.ff-deps-list {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--white);
  overflow: hidden;
}
.ff-deps-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft, #E8E3D4);
}
.ff-deps-row:last-child { border-bottom: 0; }
.ff-deps-name {
  font-size: 14px; font-weight: 700; color: var(--navy);
}
.ff-deps-meta {
  font-size: 12.5px; color: var(--mute); font-weight: 500;
}
