/* Fact find — bridgingeye.co.uk design (tokens match public/index.html).
   Everything is scoped under .ff-root so it can sit inside the portal or
   admin without clashing with their own styles. */
.ff-root {
  --ff-navy: #0F2A44;
  --ff-navy-deep: #0A1F33;
  --ff-teal: #0B7A70;
  --ff-teal-dark: #08594F;
  --ff-mint: #5FD3C4;
  --ff-ground: #F7F5F0;
  --ff-surface: #FFFFFF;
  --ff-line: #E3DED3;
  --ff-border: #CFC9BC;
  --ff-muted: #3E4C5B;
  --ff-soft: #4A5868;
  --ff-tint: #F2F7F6;
  --ff-error: #B42318;
  --ff-radius: 16px;
  --ff-radius-control: 10px;
  --ff-display: "Fraunces", Georgia, serif;
  --ff-body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-family: var(--ff-body);
  color: var(--ff-navy);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.ff-root *, .ff-root *::before, .ff-root *::after { box-sizing: border-box; }
.ff-root [hidden] { display: none !important; }
/* :where() keeps these resets at zero specificity so component colours (e.g. .ff-btn-primary) win. */
.ff-root :where(button, input, select, textarea) { font: inherit; color: inherit; }
.ff-root :where(:focus-visible) { outline: 3px solid var(--ff-teal); outline-offset: 2px; border-radius: 4px; }

/* ---- layout */
.ff-root .ff-app { display: grid; grid-template-columns: 280px minmax(0, 1fr); grid-template-areas: "side main" "bar bar"; gap: 0 48px; align-items: start; }
.ff-root .ff-side { grid-area: side; position: sticky; top: 24px; background: var(--ff-surface); border: 1px solid var(--ff-line); border-radius: var(--ff-radius); padding: 12px; max-height: calc(100vh - 48px); overflow-y: auto; }
.ff-root .ff-main { grid-area: main; min-width: 0; padding: 0 0 32px; max-width: none; }
.ff-root .ff-bar { grid-area: bar; position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 16px 0; margin-top: 8px; background: var(--ff-ground); border-top: 1px solid var(--ff-line); }
.ff-root .ff-savenote { margin-right: auto; font-size: 14px; color: var(--ff-soft); }

/* ---- steps */
.ff-root .ff-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ff-root .ff-steps button { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 10px; border: 0; border-radius: 10px; background: none; text-align: left; font-size: 15px; color: var(--ff-muted); cursor: pointer; }
.ff-root .ff-steps button:hover { background: var(--ff-ground); color: var(--ff-navy); }
.ff-root .ff-step-dot { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--ff-border); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--ff-soft); background: var(--ff-surface); }
.ff-root .ff-steps .is-current button { background: var(--ff-tint); color: var(--ff-navy); font-weight: 700; }
.ff-root .ff-steps .is-current .ff-step-dot { background: var(--ff-navy); border-color: var(--ff-navy); color: #fff; }
.ff-root .ff-steps .is-done .ff-step-dot { background: var(--ff-teal); border-color: var(--ff-teal); color: #fff; }
.ff-root .ff-steps .has-problems .ff-step-dot { border-color: var(--ff-error); color: var(--ff-error); }

/* ---- headings */
.ff-root .ff-kicker { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ff-teal); }
.ff-root .ff-title { margin: 8px 0 20px; font-family: var(--ff-display); font-weight: 600; font-size: clamp(30px, 3.2vw, 42px); line-height: 1.08; letter-spacing: -0.02em; }
.ff-root .ff-title:focus { outline: none; }
.ff-root .ff-for { margin: -8px 0 16px; color: var(--ff-soft); }

/* ---- applicant tabs */
.ff-root .ff-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }
.ff-root .ff-tab { min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--ff-border); background: var(--ff-surface); font-size: 15px; font-weight: 500; cursor: pointer; }
.ff-root .ff-tab[aria-selected="true"] { background: var(--ff-navy); border-color: var(--ff-navy); color: #fff; }
.ff-root .ff-count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: #FDECEA; color: var(--ff-error); font-size: 12px; font-weight: 700; }

/* ---- questions */
.ff-root fieldset.ff-page { margin: 0; min-width: 0; }
.ff-root .ff-item-section { margin-top: 8px; padding-top: 20px; border-top: 1px solid var(--ff-line); }
.ff-root .ff-grid + .ff-item-section:first-of-type, .ff-root .ff-item-section:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.ff-root .ff-item-title { margin: 0 0 16px; font-size: 18px; font-weight: 700; color: var(--ff-navy); }
.ff-root fieldset.ff-page[disabled] { opacity: 0.85; }
.ff-root .ff-note { margin: 0 0 16px; padding: 12px 16px; border-radius: 12px; background: var(--ff-tint); border: 1px solid #CFE6E2; font-size: 15px; color: var(--ff-muted); }
.ff-root .ff-add-party-row { margin: -8px 0 12px; }
.ff-root .ff-page { background: var(--ff-surface); border: 1px solid var(--ff-line); border-radius: var(--ff-radius); padding: 32px; }
.ff-root .ff-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 20px; }
.ff-root .ff-q { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ff-root .ff-q.is-wide { grid-column: 1 / -1; }
.ff-root .ff-label { margin: 0; font-size: 15px; font-weight: 700; color: var(--ff-navy); }
.ff-root .ff-optional { font-weight: 400; color: var(--ff-soft); }
.ff-root .ff-tag { display: inline-block; margin-left: 4px; padding: 2px 8px; border-radius: 999px; background: var(--ff-ground); border: 1px solid var(--ff-line); font-size: 12px; font-weight: 500; color: var(--ff-muted); vertical-align: 1px; }
.ff-root .ff-help { margin: -4px 0 0; font-size: 14px; line-height: 1.5; color: var(--ff-soft); }
.ff-root .ff-error { margin: 0; font-size: 14px; color: var(--ff-error); }
.ff-root .ff-q.is-invalid > .ff-control, .ff-root .ff-q.is-invalid .ff-money, .ff-root .ff-q.is-invalid > .ff-pills .ff-pill { border-color: var(--ff-error); }

.ff-root .ff-control { width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid var(--ff-border); border-radius: var(--ff-radius-control); background: var(--ff-surface); font-size: 16px; }
.ff-root textarea.ff-control { padding: 12px 14px; min-height: 96px; resize: vertical; line-height: 1.5; }
.ff-root select.ff-control { appearance: none; -webkit-appearance: none; padding-right: 40px; 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 d='M1 1.5l5 5 5-5' fill='none' stroke='%230F2A44' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; cursor: pointer; }
.ff-root .ff-control:hover { border-color: var(--ff-soft); }
.ff-root .ff-control:focus-visible { outline: 3px solid var(--ff-teal); outline-offset: 0; border-color: var(--ff-teal); }
.ff-root .ff-other { margin-top: 8px; }
.ff-root .ff-mono { font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }

.ff-root .ff-money { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 14px; border: 1px solid var(--ff-border); border-radius: var(--ff-radius-control); background: var(--ff-surface); font-size: 17px; }
.ff-root .ff-money:focus-within { border: 2px solid var(--ff-teal); padding: 0 13px; }
.ff-root .ff-money span { color: #5A6675; }
.ff-root .ff-money input:focus-visible { outline: none; }
.ff-root .ff-money input { padding: 0; width: auto; box-shadow: none; }
.ff-root .ff-money input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; min-height: 44px; font-size: 17px; }
.ff-root .ff-money-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ff-root .ff-money-row .ff-money { flex: 1 1 220px; }
.ff-root .ff-money.is-max { background: var(--ff-tint); border-color: var(--ff-teal); }
.ff-root .ff-money.is-max input::placeholder { color: var(--ff-teal-dark); font-weight: 700; opacity: 1; }
.ff-root .ff-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--ff-border); background: var(--ff-surface); font-size: 15px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.ff-root .ff-chip:hover { border-color: var(--ff-navy); }
.ff-root .ff-chip svg { display: none; color: var(--ff-mint); }
.ff-root .ff-chip[aria-pressed="true"] { background: var(--ff-navy); border-color: var(--ff-navy); color: #fff; }
.ff-root .ff-chip[aria-pressed="true"] svg { display: block; }
.ff-root .ff-affix { position: relative; }
.ff-root .ff-affix.is-percent .ff-control { padding-right: 36px; }
.ff-root .ff-affix span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: #5A6675; }
.ff-root .ff-duration, .ff-root .ff-date-or { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ff-root .ff-duration label, .ff-root .ff-date-or label { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; color: var(--ff-muted); }
.ff-root .ff-duration .ff-control, .ff-root .ff-date-or label .ff-control { width: 92px; }
.ff-root .ff-date-or > .ff-control { width: auto; min-width: 180px; }
.ff-root .ff-or { font-size: 14px; color: var(--ff-soft); }

.ff-root .ff-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.ff-root .ff-pill { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--ff-border); background: var(--ff-surface); font-size: 15px; font-weight: 500; cursor: pointer; transition: background-color 0.15s ease, border-color 0.15s ease; }
.ff-root .ff-pill:hover { border-color: var(--ff-navy); }
.ff-root .ff-pill svg { display: none; flex: none; color: var(--ff-mint); }
.ff-root .ff-pill[aria-pressed="true"] { background: var(--ff-navy); border-color: var(--ff-navy); color: #fff; }
.ff-root .ff-pill[aria-pressed="true"] svg { display: block; }

.ff-root .ff-consent { display: flex; align-items: flex-start; gap: 12px; padding: 16px; border: 1px solid var(--ff-line); border-radius: 12px; background: var(--ff-ground); font-size: 15px; cursor: pointer; }
.ff-root .ff-consent input { flex: none; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--ff-teal); }
.ff-root .ff-computed { min-height: 48px; display: flex; align-items: center; padding: 0 14px; border-radius: var(--ff-radius-control); background: var(--ff-tint); font-weight: 700; font-size: 17px; }

/* ---- address suggestions (places.js) */
.ff-root .ff-suggest-wrap { position: relative; }
.ff-root .ff-suggest { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20; background: var(--ff-surface); border: 1px solid var(--ff-border); border-radius: var(--ff-radius-control); box-shadow: 0 12px 28px rgba(15, 42, 68, 0.18); overflow: hidden; }
.ff-root .ff-suggest-item { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; cursor: pointer; }
.ff-root .ff-suggest-item:hover, .ff-root .ff-suggest-item[aria-selected="true"] { background: var(--ff-tint); }
.ff-root .ff-suggest-main { font-weight: 700; font-size: 15px; }
.ff-root .ff-suggest-rest { font-size: 13px; color: var(--ff-soft); }
.ff-root .ff-suggest-credit { padding: 6px 14px; border-top: 1px solid var(--ff-line); font-size: 11.5px; color: var(--ff-soft); text-align: right; }

/* ---- lists */
.ff-root .ff-list { display: flex; flex-direction: column; gap: 14px; }
.ff-root .ff-item { border: 1px solid var(--ff-line); border-radius: 14px; padding: 20px; background: var(--ff-ground); }
.ff-root .ff-item .ff-item { background: var(--ff-surface); }
.ff-root .ff-item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.ff-root .ff-item-num { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ff-navy); color: #fff; font-size: 13px; font-weight: 700; }
.ff-root .ff-add { align-self: flex-start; min-height: 44px; padding: 0 18px; border-radius: var(--ff-radius-control); border: 1px dashed var(--ff-teal); background: var(--ff-surface); color: var(--ff-teal-dark); font-weight: 700; font-size: 15px; cursor: pointer; }
.ff-root .ff-add:hover { background: var(--ff-tint); }
.ff-root .ff-link { background: none; border: 0; padding: 0 4px; min-height: 44px; color: var(--ff-teal); font-weight: 700; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ---- buttons */
.ff-root .ff-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 22px; border-radius: var(--ff-radius-control); border: 1px solid transparent; font-size: 16px; font-weight: 700; cursor: pointer; }
.ff-root .ff-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.ff-root .ff-btn-primary { background: var(--ff-navy); color: #fff; border-color: var(--ff-navy); }
.ff-root .ff-btn-primary:hover:not(:disabled) { background: #173A5C; }
.ff-root .ff-btn-outline { background: var(--ff-surface); color: var(--ff-navy); border-color: var(--ff-navy); }
.ff-root .ff-btn-ghost { background: transparent; color: var(--ff-navy); border-color: var(--ff-border); }
.ff-root .ff-btn-block { display: flex; width: 100%; margin-top: 16px; }

/* ---- submit */
.ff-root .ff-summary, .ff-root .ff-ready { margin-top: 24px; padding: 20px 24px; border-radius: 14px; }
.ff-root .ff-summary { background: #FFF7ED; border: 1px solid #F5D0A9; }
.ff-root .ff-summary ul { margin: 8px 0 0; padding-left: 18px; }
.ff-root .ff-summary li { display: flex; align-items: center; gap: 8px; }
.ff-root .ff-ready { background: var(--ff-tint); border: 1px solid #CFE6E2; }
.ff-root .ff-submit-result { margin-top: 12px; font-weight: 700; }
.ff-root .ff-submit-result.is-ok { color: var(--ff-teal-dark); }
.ff-root .ff-submit-result.is-error { color: var(--ff-error); }

@media (max-width: 899.98px) {
  .ff-root .ff-app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "side" "main" "bar"; gap: 16px; }
  .ff-root .ff-side { position: static; max-height: none; padding: 8px; overflow-x: auto; }
  .ff-root .ff-steps { flex-direction: row; gap: 4px; }
  .ff-root .ff-steps li { flex: none; }
  .ff-root .ff-steps button { white-space: nowrap; font-size: 14px; }
  .ff-root .ff-steps li:not(.is-current) button span:last-child { display: none; }
  .ff-root .ff-page { padding: 20px; }
  .ff-root .ff-grid { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .ff-root .ff-item { padding: 16px; }
  .ff-root .ff-bar { flex-wrap: wrap; }
  .ff-root .ff-bar .ff-btn { flex: 1; }
  .ff-root .ff-savenote { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) { .ff-root * { transition: none !important; } }

/* ---- host pages (portal/admin) have their own global element styles; keep ours */
.ff-root label, .ff-root p { margin: 0; }
.ff-root .ff-label { display: block; }
.ff-root .ff-duration label, .ff-root .ff-date-or label { margin: 0; }
.ff-root input[type="checkbox"] { width: 20px; height: 20px; padding: 0; }
.ff-root h1 { border: 0; padding: 0; }

/* ---- gate & dialog used by the portal */
.ff-root .ff-gate { max-width: 640px; margin: 24px auto; background: var(--ff-surface); border: 1px solid var(--ff-line); border-radius: var(--ff-radius); padding: 32px; display: flex; flex-direction: column; gap: 16px; }
.ff-root .ff-gate h1 { margin: 0; font-family: var(--ff-display); font-weight: 600; font-size: 32px; letter-spacing: -0.02em; }
.ff-root .ff-gate-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.ff-root .ff-error-text { color: var(--ff-error); font-size: 14px; }
.ff-dialog-backdrop { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px; background: rgba(10, 31, 51, 0.6); }
.ff-dialog-backdrop .ff-dialog { width: min(520px, 100%); background: #fff; border-radius: 20px; padding: 28px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 30px 60px rgba(4, 16, 28, 0.35); }
.ff-dialog-backdrop .ff-dialog h2 { margin: 0; font-family: var(--ff-display); font-weight: 600; font-size: 26px; }
