/* ============================================================
   FLINT BORROWER PORTAL
   Built on assets/flint-brand-LOCKED.css (tokens + Armand Grotesk).
   Warm, concierge fintech surface for an anxious borrower uploading
   their financial life. Editorial rhythm, no card-grid monotony,
   no side-stripe accents, no gradient text.
   ============================================================ */

/* ---- Local extensions to the locked palette ----------------- */
:root {
  /* derived warm neutrals, tinted toward plum (chroma kept low) */
  --plum-tint: #f7e8ef;        /* faint plum wash for received states */
  --plum-line: #d9b9cb;        /* plum-leaning hairline */
  --cream-deep: #ffeada;       /* one step warmer than --cream */
  --ink-faint: #7d6470;        /* low-emphasis ink, plum-leaning, AA on surface */

  /* confidence tiers (from the brief: coral low, gold mid, mint high) */
  --conf-high: #1f9d57;        /* green for ticks + arc accents */
  --conf-high-fill: #6fcf8e;   /* mint-adjacent arc fill */
  --conf-mid: var(--gold);
  --conf-low: var(--coral);
  /* AA-passing text variants for small bold labels on tinted pills */
  --conf-high-text: #117a3f;   /* >= 4.5:1 on the high tint */
  --conf-mid-text: #6a5408;
  --conf-low-text: #a8331b;

  --ring-track: #ecd9cd;

  /* elevation: warm, low, never the generic gray drop shadow */
  --shadow-soft: 0 1px 0 rgba(42, 19, 32, 0.04), 0 8px 24px -18px rgba(77, 0, 50, 0.28);
  --shadow-lift: 0 2px 0 rgba(42, 19, 32, 0.04), 0 22px 48px -26px rgba(77, 0, 50, 0.38);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out-soft: cubic-bezier(0.16, 0.84, 0.44, 1);

  --header-h: 64px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
/* never let a stray wide element introduce a horizontal scrollbar */
html, body { overflow-x: clip; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  /* warm directional wash so the page is not a flat fill */
  background-image:
    radial-gradient(120% 80% at 100% -10%, var(--cream) 0%, transparent 46%),
    radial-gradient(90% 60% at -10% 110%, var(--cream-deep) 0%, transparent 40%);
  background-attachment: fixed;
  text-rendering: optimizeLegibility;
}

.wrap {
  width: min(100% - 2 * var(--s-5), var(--maxw));
  margin-inline: auto;
}

/* utility ---------------------------------------------------- */
.visually-hidden,
.skip-link {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.skip-link:focus {
  position: fixed;
  top: var(--s-3); left: var(--s-3);
  width: auto; height: auto;
  clip: auto; margin: 0;
  padding: var(--s-3) var(--s-4);
  background: var(--plum);
  color: var(--surface);
  border-radius: 10px;
  z-index: 200;
  box-shadow: var(--shadow-lift);
}

:where(a, button, summary, [tabindex], input):focus-visible {
  outline: 2.5px solid var(--plum);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ============================================================
   TRUST BAND
   ============================================================ */
.trust-band {
  background: var(--plum-deep);
  color: var(--cream);
}
.trust-inner {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding-block: var(--s-2);
  min-height: 38px;
}
.trust-lock { display: inline-flex; color: var(--gold); flex: none; }
.trust-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
  color: color-mix(in oklab, var(--cream) 90%, white);
  flex: 1 1 auto;
}
.trust-region {
  flex: none;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--plum-deep);
  background: var(--gold);
  padding: 3px 9px;
  border-radius: 999px;
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 80;
  background: color-mix(in oklab, var(--surface) 86%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
  gap: var(--s-4);
}
.brand-mark { display: inline-flex; }
.brand-logo {
  display: block;
  height: 30px;
  width: auto;
}
.demo-mode {
  margin: 0;
  font-size: 12px;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
  transition: opacity 0.5s var(--ease-out);
}
.demo-mode::before {
  content: "";
  display: inline-block;
  width: 7px; height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--coral);
  vertical-align: middle;
  animation: live-pulse 2.2s var(--ease-out) infinite;
}
.demo-mode.is-faded { opacity: 0; pointer-events: none; }

@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 113, 80, 0.5); }
  50%      { box-shadow: 0 0 0 5px rgba(255, 113, 80, 0); }
}

/* ============================================================
   GREETING
   ============================================================ */
.greeting { padding-top: clamp(var(--s-7), 7vw, var(--s-9)); }
.greeting-inner { max-width: 58ch; }
.eyebrow {
  margin: 0 0 var(--s-3);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--plum);
}
.greeting-title {
  margin: 0;
  max-width: 16ch;
  font-size: var(--t-h1);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.02em;
  text-wrap: pretty;
}
@media (min-width: 720px) {
  .greeting-title { max-width: 14ch; text-wrap: balance; }
}
.greeting-lead {
  margin: var(--s-5) 0 0;
  max-width: 56ch;
  font-size: var(--t-lead);
  line-height: 1.5;
  color: var(--ink-soft);
}

/* ============================================================
   BROKER PRESENCE
   ============================================================ */
.broker { padding-top: var(--s-6); }
.broker-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--s-4) var(--s-5);
  padding: var(--s-5);
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}
.broker-avatar {
  display: grid;
  place-items: center;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--plum);
  color: var(--cream);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.broker-body { min-width: 0; }
.broker-line {
  margin: 0;
  font-size: 16px;
  line-height: 1.45;
  max-width: 64ch;
}
.broker-name { font-weight: 700; }
.broker-sub {
  margin: var(--s-2) 0 0;
  font-size: 14px;
  color: var(--ink-soft);
  max-width: 60ch;
}
.broker-action {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 11px var(--s-4);
  border-radius: 999px;
  background: var(--plum);
  color: var(--cream);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}
.broker-action svg { transition: transform 0.25s var(--ease-out); }
.broker-action:hover { background: var(--plum-deep); }
.broker-action:hover svg { transform: translateX(3px); }
.broker-action:active { transform: translateY(1px); }

/* ============================================================
   READER SECTION (dropzone + live reader)
   ============================================================ */
.reader-section { padding-top: clamp(var(--s-7), 6vw, var(--s-8)); }
.reader-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  grid-template-areas:
    "intro intro"
    "drop  reader";
  gap: var(--s-5) var(--s-6);
  align-items: start;
}
.reader-intro { grid-area: intro; max-width: 60ch; }
.dropzone-col { grid-area: drop; position: sticky; top: calc(var(--header-h) + var(--s-4)); }
.reader-col { grid-area: reader; }

.section-title {
  margin: 0;
  font-size: var(--t-h2);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.018em;
  text-wrap: pretty;
}
@media (min-width: 720px) { .section-title { text-wrap: balance; } }
.section-sub {
  margin: var(--s-3) 0 0;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 58ch;
}

/* ---- Dropzone ---------------------------------------------- */
.dropzone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: var(--s-6) var(--s-5);
  text-align: center;
  background:
    repeating-linear-gradient(135deg, transparent 0 11px, rgba(110, 0, 72, 0.012) 11px 12px),
    var(--surface);
  border: 1.5px dashed var(--plum-line);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition:
    border-color 0.25s var(--ease-out),
    background-color 0.25s var(--ease-out),
    transform 0.25s var(--ease-out),
    box-shadow 0.25s var(--ease-out);
}
.dropzone:hover { border-color: var(--plum); }
.dropzone[data-dz-state="dragover"] {
  border-style: solid;
  border-color: var(--coral);
  background: var(--cream);
  transform: scale(1.015);
  box-shadow: var(--shadow-lift);
}
.dropzone[data-dz-state="uploading"],
.dropzone[data-dz-state="reading"] {
  cursor: default;
  border-style: solid;
  border-color: var(--plum-line);
}

.dz-stage {
  display: grid;
  justify-items: center;
  gap: var(--s-2);
  transition: opacity 0.3s var(--ease-out), transform 0.3s var(--ease-out);
}
.dz-glyph {
  display: grid;
  place-items: center;
  width: 60px; height: 60px;
  margin-bottom: var(--s-2);
  border-radius: 50%;
  background: var(--cream);
  color: var(--plum);
  transition: color 0.25s var(--ease-out), background 0.25s var(--ease-out), transform 0.3s var(--ease-out);
}
.dropzone[data-dz-state="dragover"] .dz-glyph {
  color: var(--coral);
  background: var(--surface);
  transform: translateY(-2px);
}
.dz-headline {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: color 0.2s var(--ease-out);
}
.dropzone[data-dz-state="dragover"] .dz-headline { color: var(--coral); }
.dz-sub { margin: 0; font-size: 15px; color: var(--ink-soft); }
.dz-browse {
  color: var(--plum);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}
.dz-hint {
  margin: var(--s-2) 0 0;
  font-size: 13px;
  color: var(--ink-faint);
  max-width: 34ch;
}

/* uploading overlay */
.dz-uploading {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: var(--s-3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease-out);
}
.dropzone[data-dz-state="uploading"] .dz-stage,
.dropzone[data-dz-state="reading"] .dz-stage { opacity: 0; transform: scale(0.96); }
.dropzone[data-dz-state="uploading"] .dz-uploading,
.dropzone[data-dz-state="reading"] .dz-uploading { opacity: 1; }
.dz-ring { transform: rotate(-90deg); }
.dz-ring-track { stroke: var(--ring-track); }
.dz-ring-fill {
  stroke: var(--plum);
  stroke-dasharray: 119.4;        /* 2*pi*19 */
  stroke-dashoffset: 119.4;
  transition: stroke-dashoffset 0.4s var(--ease-out);
}
.dz-uploading-text { margin: 0; font-size: 15px; font-weight: 700; color: var(--plum); }

.dz-privacy {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  margin: var(--s-4) 0 0;
  padding-inline: var(--s-1);
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-soft);
}
.dz-privacy svg { color: var(--plum); margin-top: 2px; flex: none; }

/* ---- Reader panel ------------------------------------------ */
.reader {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

/* [hidden] must win over the display rules below */
[hidden] { display: none !important; }

/* empty */
.reader-empty {
  display: grid;
  justify-items: start;
  gap: var(--s-3);
  padding: var(--s-7) var(--s-6);
}
.empty-glyph {
  display: grid;
  place-items: center;
  width: 54px; height: 54px;
  border-radius: 16px;
  background: var(--cream);
  color: var(--plum);
}
.empty-title {
  margin: var(--s-2) 0 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.empty-sub {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 46ch;
}

/* recognised header */
.reader-active { padding: var(--s-5) var(--s-5) var(--s-6); }
.recog {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-4);
}
.recog-eyebrow {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--plum);
}
.recog-name {
  margin: var(--s-1) 0 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.1;
}
.recog-confidence {
  display: flex;
  align-items: baseline;
  gap: 5px;
  flex: none;
}
.recog-pct {
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--plum);
  letter-spacing: -0.01em;
}
.recog-pct-label { font-size: 13px; color: var(--ink-soft); }

.recog-meter {
  height: 5px;
  margin-top: var(--s-4);
  border-radius: 999px;
  background: var(--cream);
  overflow: hidden;
}
.recog-meter-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--plum);
  transition: width 0.7s var(--ease-out);
}
.recog-status {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin: var(--s-3) 0 0;
  font-size: 13.5px;
  color: var(--ink-soft);
  min-height: 18px;
}
.recog-status::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--coral);
  flex: none;
}
.recog-status.is-done::before { background: var(--conf-high); }

/* extracted field list */
.fields {
  list-style: none;
  margin: var(--s-5) 0 0;
  padding: 0;
  display: grid;
  gap: 0;
}
.field {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: var(--s-3) var(--s-4);
  padding: var(--s-3) var(--s-1);
  border-top: 1px solid var(--line);
  opacity: 0;
  transform: translateY(6px);
}
.field:first-child { border-top: 0; }
.field.is-in {
  animation: field-in 0.4s var(--ease-out) forwards;
}
@keyframes field-in {
  to { opacity: 1; transform: translateY(0); }
}
.field-text { min-width: 0; }
.field-label {
  font-size: 12.5px;
  color: var(--ink-soft);
  letter-spacing: 0.005em;
}
.field-value {
  margin-top: 1px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.field-flag {
  display: inline-grid;
  place-items: center;
  color: var(--gold);
  cursor: help;
}
.field-meter {
  display: flex;
  flex-direction: row-reverse;   /* ring anchors to a clean right column; pill sits to its left */
  align-items: center;
  gap: var(--s-2);
  flex: none;
}
.conf-ring {
  --ring: var(--conf-high-fill);
  width: 24px; height: 24px;
  flex: none;
  cursor: help;
}
.conf-ring circle { fill: none; stroke-width: 3; }
.conf-ring .ring-track { stroke: var(--ring-track); }
.conf-ring .ring-fill {
  stroke: var(--ring);
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset 0.5s var(--ease-out) 0.1s;
}
.conf-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.conf-badge[data-tier="high"] { color: var(--conf-high-text); background: color-mix(in oklab, var(--mint) 30%, var(--surface)); }
.conf-badge[data-tier="mid"]  { color: var(--conf-mid-text);  background: color-mix(in oklab, var(--gold) 22%, var(--surface)); }
.conf-badge[data-tier="low"]  { color: var(--conf-low-text);  background: color-mix(in oklab, var(--coral) 18%, var(--surface)); }

.reader-model {
  margin: var(--s-5) 0 0;
  padding-top: var(--s-4);
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink-faint);
}
.reader-model strong { color: var(--ink-soft); font-weight: 700; }
#reader-tokens { color: var(--ink-faint); }

/* ============================================================
   LEDGER: checklist + income
   ============================================================ */
.ledger-section { padding-top: clamp(var(--s-7), 6vw, var(--s-8)); }
.ledger-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.85fr);
  gap: var(--s-6);
  align-items: start;
}

/* ---- Progress ---------------------------------------------- */
.checklist-head { margin-bottom: var(--s-5); }
.progress { margin-bottom: var(--s-5); }
.progress-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-3);
}
.progress-count {
  margin: 0;
  font-size: 17px;
  color: var(--ink-soft);
}
.progress-count #received-count,
.progress-count #total-count {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.progress-of { color: var(--ink-faint); }
.progress-word { margin-left: 4px; }
.progress-remaining {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--conf-low-text);
}
.progress-remaining.is-complete { color: var(--conf-high-text); }
.progress-track {
  height: 9px;
  border-radius: 999px;
  background: var(--cream);
  overflow: hidden;
}
.progress-fill {
  display: block;
  height: 100%;
  width: 75%;
  border-radius: 999px;
  background: var(--plum);
  transition: width 0.5s var(--ease-out);
}
.progress-fill.is-pulse { animation: prog-pulse 0.6s var(--ease-out); }
@keyframes prog-pulse {
  40% { background: var(--coral); }
}
.progress-track.is-complete .progress-fill {
  background: var(--conf-high);
  box-shadow: 0 0 0 0 rgba(31, 157, 87, 0);
  animation: prog-glow 0.8s var(--ease-out);
}
@keyframes prog-glow {
  30% { box-shadow: 0 0 14px 1px rgba(111, 207, 142, 0.7); }
}

/* ---- Checklist groups -------------------------------------- */
.checklist { display: grid; gap: var(--s-5); }
.group { display: grid; gap: var(--s-1); }
.group-list { display: block; }
.group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  padding-bottom: var(--s-2);
}
.group-name {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--plum);
}
.group-progress {
  font-size: 12px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

.doc-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: background 0.6s var(--ease-out), border-color 0.4s var(--ease-out);
}
.doc-row + .doc-row { margin-top: var(--s-2); }
.doc-row.is-droptarget {
  border-style: dashed;
  border-color: var(--plum);
  background: var(--plum-tint);
}
.doc-row.is-justreceived { animation: row-tick 0.7s var(--ease-out); }
@keyframes row-tick {
  0%   { background: color-mix(in oklab, var(--mint) 42%, var(--surface)); }
  100% { background: var(--surface); }
}

/* checkbox */
.doc-check {
  display: grid;
  place-items: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  flex: none;
}
.doc-row[data-status="received"] .doc-check { background: color-mix(in oklab, var(--mint) 34%, var(--surface)); }
.doc-row[data-status="outstanding"] .doc-check {
  border: 1.5px dashed var(--plum-line);
  background: var(--surface);
}
.check-svg { width: 14px; height: 14px; color: var(--conf-high); }
.check-svg path {
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  stroke-dasharray: 22;
  stroke-dashoffset: 0;
}
.doc-row[data-status="outstanding"] .check-svg { display: none; }
.doc-row.is-drawing .check-svg path { animation: check-draw 0.32s var(--ease-out); }
@keyframes check-draw { from { stroke-dashoffset: 22; } to { stroke-dashoffset: 0; } }

.doc-info { min-width: 0; }
.doc-name {
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.004em;
  line-height: 1.25;
}
.doc-meta {
  margin-top: 2px;
  font-size: 12px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.doc-meta .conf-inline { color: var(--ink-faint); font-variant-numeric: tabular-nums; }

.doc-status {
  flex: none;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.doc-row[data-status="received"] .doc-status { color: var(--conf-high-text); background: color-mix(in oklab, var(--mint) 26%, var(--surface)); }
.doc-row[data-status="outstanding"] .doc-status { color: var(--conf-low-text); background: color-mix(in oklab, var(--coral) 14%, var(--surface)); }

/* ---- Income summary ---------------------------------------- */
.income {
  position: sticky;
  top: calc(var(--header-h) + var(--s-4));
  padding: var(--s-6) var(--s-5);
  background: var(--cream);
  border: 1px solid var(--line);
  border-top: 1px solid var(--gold);   /* allowed: 1px full hairline, not a stripe accent */
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}
.income-eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--plum);
}
.income-title {
  margin: var(--s-2) 0 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: 0.005em;
}
.income-total {
  margin: var(--s-2) 0 0;
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
}
.income-currency {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
}
.income-figure {
  font-size: clamp(32px, 4.4vw, 40px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--plum);
  font-variant-numeric: tabular-nums;
  transition: opacity 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}
.income-figure.is-revising { opacity: 0; transform: translateY(6px); }
.income-note {
  margin: var(--s-3) 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-soft);
  max-width: 40ch;
}

.income-lines {
  list-style: none;
  margin: var(--s-5) 0 0;
  padding: var(--s-4) 0 0;
  border-top: 1px solid var(--plum-line);
  display: grid;
  gap: var(--s-3);
}
.income-line {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: var(--s-2) var(--s-3);
}
.income-line-label {
  font-size: 13.5px;
  color: var(--ink);
}
.income-line-amount {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.005em;
}
.income-line-note {
  grid-column: 1 / -1;
  font-size: 11.5px;
  color: var(--ink-faint);
  display: flex;
  align-items: center;
  gap: 6px;
}
.income-line-note .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex: none;
}
.income-line-note .dot[data-tier="high"] { background: var(--conf-high-fill); }
.income-line-note .dot[data-tier="mid"]  { background: var(--gold); }
.income-line-note .dot[data-tier="low"]  { background: var(--coral); }

.income-foot {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  margin: var(--s-5) 0 0;
  padding-top: var(--s-4);
  border-top: 1px solid var(--plum-line);
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-soft);
}
.income-foot-flag { color: var(--gold); flex: none; margin-top: 1px; }

/* ============================================================
   LOAN PROGRESS (back-channel, progressive disclosure)
   ============================================================ */
.loan-section { padding-block: clamp(var(--s-7), 6vw, var(--s-8)); }
.loan {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}
.loan-summary {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-5);
  cursor: pointer;
  list-style: none;
}
.loan-summary::-webkit-details-marker { display: none; }
.loan-summary-main { flex: 1 1 auto; min-width: 0; }
.loan-summary-title {
  display: block;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.loan-summary-sub {
  display: block;
  margin-top: 3px;
  font-size: 14px;
  color: var(--ink-soft);
}
.loan-countdown {
  flex: none;
  display: grid;
  justify-items: center;
  padding: 7px var(--s-4);
  border-radius: var(--radius);
  background: var(--cream);
  text-align: center;
}
.loan-countdown-num {
  font-size: 24px;
  font-weight: 700;
  color: var(--plum);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.loan-countdown-label {
  margin-top: 3px;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.loan-chevron { flex: none; color: var(--ink-soft); transition: transform 0.3s var(--ease-out); }
.loan[open] .loan-chevron { transform: rotate(180deg); }

.loan-body {
  padding: 0 var(--s-5) var(--s-5);
  border-top: 1px solid var(--line);
}
.loan-steps {
  list-style: none;
  margin: var(--s-5) 0 0;
  padding: 0;
  display: grid;
  gap: var(--s-1);
}
.loan-step {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) 0;
  border-top: 1px solid var(--line);
}
.loan-step:first-child { border-top: 0; }
.loan-node {
  display: grid;
  place-items: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  flex: none;
  font-size: 11px;
  font-weight: 700;
}
.loan-step[data-status="complete"] .loan-node { background: color-mix(in oklab, var(--mint) 36%, var(--surface)); color: var(--conf-high-text); }
.loan-step[data-status="in-progress"] .loan-node { background: color-mix(in oklab, var(--gold) 30%, var(--surface)); color: var(--conf-mid-text); }
.loan-step[data-status="awaiting-borrower"] .loan-node { background: color-mix(in oklab, var(--coral) 18%, var(--surface)); color: var(--conf-low-text); }
.loan-step[data-status="not-started"] .loan-node { background: var(--cream); color: var(--ink-faint); border: 1px solid var(--line); }
.loan-node svg { width: 12px; height: 12px; }

.loan-step-label { font-size: 14.5px; line-height: 1.3; }
.loan-step[data-status="not-started"] .loan-step-label { color: var(--ink-faint); }
.loan-step-tag {
  flex: none;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.loan-step[data-status="in-progress"] .loan-step-tag { color: var(--conf-mid-text); }
.loan-step[data-status="awaiting-borrower"] .loan-step-tag { color: var(--conf-low-text); }

.loan-foot {
  margin: var(--s-5) 0 0;
  padding-top: var(--s-4);
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 70ch;
}
.loan-foot strong { color: var(--ink); font-weight: 700; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  margin-top: var(--s-8);
  border-top: 1px solid var(--line);
  background: color-mix(in oklab, var(--cream) 55%, var(--surface));
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-5);
  flex-wrap: wrap;
  padding-block: var(--s-6);
}
.footer-help {
  margin: 0;
  font-size: 14px;
  color: var(--ink-soft);
  max-width: 52ch;
}
.cobrand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  flex: none;
}
.cobrand-text { font-size: 12px; color: var(--ink-faint); letter-spacing: 0.02em; }
.cobrand-nbh { display: block; height: 22px; width: auto; opacity: 0.82; }
.demo-disclaimer {
  margin: 0;
  padding-bottom: var(--s-6);
  font-size: 12px;
  color: var(--ink-faint);
}

/* ============================================================
   TOAST
   ============================================================ */
.toast-region {
  position: fixed;
  left: 50%;
  bottom: var(--s-6);
  transform: translateX(-50%);
  z-index: 150;
  display: grid;
  gap: var(--s-2);
  width: min(100% - 2 * var(--s-4), 420px);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--ink);
  color: var(--cream);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(12px);
  animation: toast-in 0.35s var(--ease-out) forwards;
}
.toast.is-out { animation: toast-out 0.3s var(--ease-out) forwards; }
.toast-ico { flex: none; display: inline-grid; place-items: center; }
.toast[data-tone="success"] .toast-ico { color: var(--conf-high-fill); }
.toast[data-tone="info"] .toast-ico { color: var(--gold); }
.toast-strong { color: var(--surface); font-weight: 700; }
@keyframes toast-in { to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ============================================================
   TOOLTIP
   ============================================================ */
.tooltip {
  position: fixed;
  z-index: 160;
  max-width: 240px;
  padding: 8px 11px;
  background: var(--ink);
  color: var(--cream);
  font-size: 12.5px;
  line-height: 1.4;
  border-radius: 9px;
  box-shadow: var(--shadow-lift);
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}
.tooltip.is-visible { opacity: 1; transform: translateY(0); }
.tooltip::after {
  content: "";
  position: absolute;
  left: var(--arrow-x, 50%);
  width: 8px; height: 8px;
  background: var(--ink);
  transform: translateX(-50%) rotate(45deg);
}
.tooltip[data-place="top"]::after { bottom: -4px; }
.tooltip[data-place="bottom"]::after { top: -4px; }

.info-note { font-size: 14px; color: var(--ink-soft); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 980px) {
  .reader-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "intro"
      "drop"
      "reader";
  }
  .dropzone-col { position: static; }
  .ledger-grid { grid-template-columns: 1fr; }
  .income {
    position: static;
    order: -1;          /* show the headline outcome first on narrow screens */
  }
}

@media (max-width: 620px) {
  :root { --header-h: 56px; }
  .trust-region { display: none; }
  .trust-text { font-size: 12px; }
  .trust-inner { gap: var(--s-2); }
  /* the live-extraction note is decorative; reclaim the room for the logo */
  .demo-mode { display: none; }
  .broker-inner {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "avatar body"
      "action action";
    row-gap: var(--s-4);
  }
  .broker-avatar { grid-area: avatar; }
  .broker-body { grid-area: body; }
  .broker-action { grid-area: action; justify-content: center; }
  .recog { flex-direction: column; align-items: flex-start; gap: var(--s-2); }
  .recog-confidence { align-self: flex-start; }
  .loan-summary { position: relative; flex-wrap: wrap; }
  .loan-countdown { order: 3; flex: 1 0 100%; flex-direction: row; gap: var(--s-2); justify-content: center; }
  .loan-chevron { position: absolute; top: var(--s-5); right: var(--s-5); }
  .toast { font-size: 13px; }
}

/* fields go 2-col on wide reader panels (desktop scanning) */
@media (min-width: 1180px) {
  .fields { grid-template-columns: 1fr 1fr; column-gap: var(--s-5); }
  .field { border-top: 1px solid var(--line); }
  .fields .field:nth-child(1),
  .fields .field:nth-child(2) { border-top: 0; }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .field { opacity: 1; transform: none; }
  .demo-mode::before { animation: none; }
}
