/* base.css — primitives shared by every page.
 * Reads the variables of tokens.css (linked before it). Inter is linked in the
 * page head (templates/base.html, display=swap), never imported here: an
 * @import would hold up the first paint of every page (WUX-23). */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  min-height: 100dvh;
  overflow-x: hidden;
  max-width: 100%;
}

/* ---------- Layout shell ---------- */
.app-shell {
  display: grid;
  /* minmax(0, 1fr) is critical: without an explicit column the implicit
     grid column is `auto` and sizes to the widest child's max-content, so a
     single over-wide row (e.g. the teller rate ticker) would drag the whole
     column — and every form field in .app-main — past the viewport and clip
     it under `overflow-x: hidden`. minmax(0,1fr) pins the column to the
     viewport and lets wide children scroll/clip themselves. */
  grid-template-columns: minmax(0, 1fr);
  /* auto, not var(--header-h): a page without the header (offline, gate, pair)
     puts its main in the first row, and a taller header never overlaps it. */
  grid-template-rows: auto 1fr auto;
  min-height: 100dvh;
}
.app-main {
  padding: var(--space-4);
}
/* Focus is never hidden under the sticky header or the fixed bottom-nav (WCAG 2.2
   SC 2.4.11): the scrolling that Tab (and scrollIntoView) does keeps the focused
   control clear of them (the bottom-nav's room is in the phone block below).
   Inside the /app shell the page's header is hidden. */
html { scroll-padding-top: calc(var(--header-h) + 8px); }
html.is-embedded { scroll-padding-top: 8px; }
/* Only a page with the fixed bottom-nav (base.html sets body.has-bottom-nav)
   reserves room under the last card, so the nav never crowds the bottom CTA.
   space-7 = 32 px is the breathing room between the card edge and the nav. */
@media (max-width: 767.98px) {
  body.has-bottom-nav .app-main {
    padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0) + var(--space-7));
  }
  html:has(> body.has-bottom-nav) {
    scroll-padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px) + 8px);
  }
}
@media (min-width: 768px) {
  .app-main {
    padding: var(--space-6);
    padding-bottom: var(--space-7);
  }
}
@media (min-width: 1024px) {
  .app-main {
    padding: var(--space-7) var(--space-8);
  }
}
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
}

/* ---------- Mobile: edge-to-edge + overflow containment (≤767px) ----------
   Two jobs:
   1. Break the `min-width: auto` floor down the flex/grid chain. Without this,
      `.app-shell { grid-template-columns: minmax(0,1fr) }` caps the track but a
      single wide descendant (a flex wizard step, the FX leaderboard, the
      560px cash-drawer table, a long unbreakable string) re-expands the box
      past the viewport — and the mobile browser then zooms out, rendering the
      page as a narrow card floating in grey. `min-width: 0` lets children
      shrink so their own overflow-x:auto scrolls internally instead.
   2. Make authenticated surfaces full-bleed (the original "edge to edge" ask)
      so the form reads as a native screen, not a card floating on a canvas. */
@media (max-width: 767px) {
  .app-main,
  .container,
  .card,
  .tab,
  .wizard-step,
  .wizard-step > *,
  .row2,
  .row3,
  .field { min-width: 0; }

  /* Intrinsically-wide / replaced elements never exceed the viewport. */
  .card img,
  .card table,
  .card pre,
  .card .fxlb,
  .table-wrap { max-width: 100%; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Full-bleed: drop the side gutters and let content cards span the screen. */
  .app-main { padding-left: 0; padding-right: 0; }
  .card:not(.pre-login):not(.login-card) {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    margin-left: 0;
    margin-right: 0;
  }
  .card:not(.pre-login):not(.login-card) + .card { margin-top: var(--space-3); }

  /* Login / centered cards keep comfortable side breathing room. */
  .pre-login,
  .login-card { margin-left: var(--space-4); margin-right: var(--space-4); }
}

/* ---------- Header ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-4);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.app-header .brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--ink);
  text-decoration: none;
  font-weight: var(--fw-semibold);
}
/* The brand monogram (templates/components/brand_mark.html: the letters in the
   accent on a primary tile, the deployment theme's colours) fills this box; it
   never shrinks. */
.brand-mark {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-2);
  overflow: hidden;
  background: var(--brand-primary);
  color: var(--accent);
  font-weight: var(--fw-bold);
  font-size: var(--fs-sm);
}
.brand-mark svg { display: block; width: 100%; height: 100%; }
/* The deployment's logo (BRAND_LOGO_FILE) in place of the monogram: the box drops its
   fill and may grow to 96 px wide for a wide mark (docs/p0/TELLER_CLASSIC_SPEC.md §3.5). */
.brand-mark:has(> img.brand-logo) { width: auto; max-width: 96px; background: transparent; border-radius: 0; }
.brand-mark > img.brand-logo { display: block; width: auto; height: 32px; max-width: 96px; object-fit: contain; }
.app-header .spacer { flex: 1; }
.app-header .user-pill {
  font-size: var(--fs-sm);
  color: var(--muted);
  min-width: 0;
}
/* Flex children that hold horizontally-scrolling content (the FX tickers)
   MUST be allowed to shrink below their content width, or they expand the
   header past the viewport. min-width:0 lets their own overflow-x:auto
   scroll internally instead. */
.app-header .strip,
.app-header .rate-strip { min-width: 0; }
.app-header .brand { min-width: 0; }
.app-header .brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rate-strip {
  display: none;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.rate-strip::-webkit-scrollbar { display: none; }
.rate-strip .rate {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--brand-primary-soft);
  color: var(--ink-soft);
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
@media (min-width: 768px) {
  .rate-strip { display: flex; }
}

/* ---------- Bottom nav (mobile only) ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-sticky);
  display: flex;
  height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0));
  padding-bottom: env(safe-area-inset-bottom, 0);
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -1px 4px rgba(15, 23, 42, 0.04);
}
.bottom-nav a,
.bottom-nav .bn-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: var(--muted);
  background: transparent;
  border: 0;
  font-family: inherit;
  font-size: 11px;
  min-height: 56px;
  padding: 4px 2px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--dur-fast) var(--ease-out);
}
.bottom-nav a .ico,
.bottom-nav .bn-btn .ico {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
}
.bottom-nav a[aria-current="page"],
.bottom-nav .bn-btn[aria-current="page"] {
  color: var(--brand-primary);
  font-weight: var(--fw-semibold);
}
.bottom-nav a:active,
.bottom-nav .bn-btn:active { background: var(--brand-primary-soft); }
@media (min-width: 768px) {
  .bottom-nav { display: none; }
  .app-main { padding-bottom: var(--space-7); }
}

/* ---------- Top tab bar (desktop replacement for bottom nav, optional) ---------- */
.top-tabs {
  display: none;
  align-items: center;
  gap: var(--space-1);
  padding: 0 var(--space-4);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.top-tabs a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  color: var(--ink-soft);
  text-decoration: none;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  border-bottom: 2px solid transparent;
}
.top-tabs a[aria-current="page"] {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
}
@media (min-width: 768px) {
  .top-tabs { display: flex; }
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-3);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: var(--space-4); }
.card h1, .card h2, .card h3 { margin-top: 0; }
.card-title {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  margin: 0 0 var(--space-3);
}
.card-sub {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin: 0 0 var(--space-4);
}

/* ---------- Typography ---------- */
h1, h2, h3, h4 { font-weight: var(--fw-semibold); color: var(--ink); line-height: var(--lh-tight); }
/* On a dark band (.on-dark: the landing CTA band, the signup aside) a heading takes
   the band's light text, never the ink above (1.3-1.7:1 on navy). */
.on-dark h1, .on-dark h2, .on-dark h3, .on-dark h4 { color: inherit; }
h1 { font-size: var(--fs-2xl); margin: 0 0 var(--space-4); }
h2 { font-size: var(--fs-xl); margin: 0 0 var(--space-3); }
h3 { font-size: var(--fs-lg); margin: 0 0 var(--space-3); }
p { margin: 0 0 var(--space-3); }
a { color: var(--brand-primary); text-decoration: none; }
/* Focus (WUI-14): one visible 2px outline on every focusable element, offset so
   it never hides a border or changes an element's shape. Inside a dark
   container (.on-dark: the landing hero, the CTA band, the signup aside) the
   ring turns gold, which keeps >= 3:1 on navy where the navy ring would not. */
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}
.on-dark :focus-visible { outline-color: var(--focus-ring-on-dark); }
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn:hover { background: var(--surface-strong); }
.btn:active { transform: scale(0.98); }
.btn[disabled], .btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.btn.primary {
  background: var(--brand-primary);
  color: var(--on-brand);
  border-color: var(--brand-primary);
}
.btn.primary:hover { background: var(--brand-primary-strong); border-color: var(--brand-primary-strong); }
.btn.accent {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}
.btn.accent:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--brand-primary); }
.btn.ghost:hover { background: var(--brand-primary-soft); }
.btn.danger { background: var(--err-ink); color: var(--on-brand); border-color: var(--err-ink); }
.btn-row {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: var(--space-4);
}
.btn.sm { min-height: 36px; padding: 0 var(--space-3); font-size: var(--fs-sm); }
.btn.lg { min-height: 52px; padding: 0 var(--space-6); font-size: var(--fs-md); }

/* ---------- Form primitives ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-3);
  min-width: 0;   /* at every width: a long value never widens a .row2/.row3 cell (WUI-22) */
}
.field > label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.field input,
.field select,
.field textarea {
  font-family: inherit;
  font-size: var(--fs-base);
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  /* --line-strong: the field's edge reaches 3:1 on white and --bg (WUI-14). */
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-2);
  background: var(--surface);
  color: var(--ink);
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}
.field textarea { min-height: 88px; padding: var(--space-3); }
.field input::placeholder, .field textarea::placeholder { color: var(--muted-soft); opacity: 1; }
/* The :focus-visible outline above shows on every field; focus also darkens the border. */
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand-primary);
}
.field .helper { font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; }
.field .err-msg {
  font-size: var(--fs-xs);
  color: var(--err-ink);
  display: none;
  margin-top: 2px;
}
.field[data-invalid="true"] input,
.field[data-invalid="true"] select,
.field[data-invalid="true"] textarea {
  border-color: var(--err);
  box-shadow: 0 0 0 3px var(--err-soft);
}
.field[data-invalid="true"] .err-msg { display: block; }
.field[data-valid="true"] input,
.field[data-valid="true"] select,
.field[data-valid="true"] textarea {
  border-color: var(--ok-ink);   /* the green edge keeps 3:1, unlike --ok (2.54:1) */
}
/* Phones: 16px text in every form control, so iOS never zooms on focus (WUI-13). */
@media (max-width: 767.98px) {
  input, select, textarea,
  .field input, .field select, .field textarea { font-size: 16px; }
}
/* minmax(0, 1fr): equal columns that a long value can never widen (WUI-22). */
.row2 { display: grid; gap: var(--space-3); grid-template-columns: minmax(0, 1fr); }
.row3 { display: grid; gap: var(--space-3); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 768px) {
  .row2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ---------- Pills ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  background: var(--surface-strong);
  color: var(--ink-soft);
  white-space: nowrap;
}
/* Status text on its (opaque) tint: the inks keep AA wherever a pill sits (WUI-09). */
.pill.ok { background: var(--ok-soft); color: var(--ok-ink); }
.pill.warn { background: var(--warn-soft); color: var(--warn-ink); }
.pill.err { background: var(--err-soft); color: var(--err-ink); }
.pill.info { background: var(--info-soft); color: var(--info-ink); }
.pill.muted { background: var(--surface-strong); color: var(--muted); }

/* ---------- Chips (selectable) ---------- */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 36px;
  padding: 0 var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.chip[aria-pressed="true"], .chip.selected {
  background: var(--brand-primary-soft);
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  font-weight: var(--fw-semibold);
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
table.data th, table.data td {
  text-align: left;
  padding: var(--space-3) var(--space-2);
  border-bottom: 1px solid var(--line-soft);
}
table.data thead th {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  background: var(--surface-soft);
  position: sticky;
  top: 0;
}
table.data tbody tr { transition: background var(--dur-fast); }
table.data tbody tr:hover { background: var(--brand-primary-soft); cursor: default; }
table.data tbody tr.clickable { cursor: pointer; }
/* Phones: each row is a card of label/value lines. Screens only: in print the
   media queries see the A4 portrait width (703 px), and paper keeps the table,
   on the landscape page too (WUI-21, the LANDBANK report). */
@media screen and (max-width: 767.98px) {
  table.data, table.data thead, table.data tbody, table.data tr, table.data th, table.data td { display: block; }
  table.data thead { position: absolute; left: -9999px; }
  table.data tbody tr {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-2);
    margin-bottom: var(--space-3);
    padding: var(--space-3);
  }
  table.data td {
    border: none;
    padding: var(--space-1) 0;
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
  }
  table.data td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: var(--fw-medium);
  }
  /* A cell that spans the row (an empty, loading or error row) is one plain line,
     not a label/value pair that pushes its text to the right edge. */
  table.data td[colspan] { display: block; text-align: center; }
  table.data td[colspan]::before { content: none; }
}

/* ---------- Drawer / bottom sheet ---------- */
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(560px, 94vw);
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-drawer);
  transform: translateX(100%);
  transition: transform var(--dur-slow) var(--ease-out);
  overflow-y: auto;
  padding: var(--space-5);
}
.drawer[aria-hidden="false"] { transform: translateX(0); }
/* A closed drawer is only moved off screen: hide it once it has slid out, so Tab never
   lands on its controls (opening shows it at once). */
.drawer[aria-hidden="true"] {
  visibility: hidden;
  transition: transform var(--dur-slow) var(--ease-out), visibility 0s linear var(--dur-slow);
}
.drawer .drawer-close {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
}
@media (max-width: 767px) {
  .drawer {
    top: auto;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 90dvh;
    border-left: 0;
    border-top: 1px solid var(--line);
    border-top-left-radius: var(--radius-4);
    border-top-right-radius: var(--radius-4);
    transform: translateY(100%);
  }
  .drawer[aria-hidden="false"] { transform: translateY(0); }
}
.drawer-scrim {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: calc(var(--z-drawer) - 1);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-out);
}
.drawer-scrim[aria-hidden="false"] { opacity: 1; pointer-events: auto; }

/* ---------- Modal (the card inside a page's own .modal-bg; new dialogs use
   <dialog class="ui-dialog"> from ui.css and ui_dialog.js) ---------- */
.modal {
  background: var(--surface);
  border-radius: var(--radius-3);
  width: min(480px, 100%);
  padding: var(--space-6);
  box-shadow: var(--shadow-lg);
}

/* ---------- Step bar ---------- */
.step-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}
.step-bar .step {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  background: var(--surface-strong);
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--muted);
}
.step-bar .step.current { background: var(--brand-primary); color: var(--on-brand); }
.step-bar .step.done { background: var(--ok-soft); color: var(--ok-ink); }
.step-bar .step .dot {
  width: 18px;
  height: 18px;
  border-radius: var(--radius-pill);
  background: rgba(0,0,0,0.08);
  display: inline-grid;
  place-items: center;
  font-size: 10px;
  font-weight: var(--fw-bold);
}
.step-bar .step.current .dot { background: rgba(255,255,255,0.25); color: var(--on-brand); }
.step-bar .step.done .dot { background: var(--ok-ink); color: var(--on-brand); }

/* ---------- Risk gauge ---------- */
.risk-gauge {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--surface-soft);
  border-radius: var(--radius-2);
  border: 1px solid var(--line);
}
.risk-gauge .meter {
  flex: 1;
  height: 8px;
  background: var(--surface-strong);
  border-radius: var(--radius-pill);
  position: relative;
  overflow: hidden;
}
.risk-gauge .meter::after {
  content: "";
  position: absolute;
  inset: 0;
  width: var(--risk-pct, 0%);
  background: linear-gradient(90deg, var(--risk-low) 0%, var(--risk-med) 50%, var(--risk-high) 100%);
  transition: width var(--dur-slow) var(--ease-out);
}
.risk-gauge .label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: var(--fw-semibold);
}
/* The bar keeps the bright risk hues; the label text uses the inks (WUI-09). */
.risk-gauge[data-level="low"] .label { color: var(--ok-ink); }
.risk-gauge[data-level="med"] .label { color: var(--warn-ink); }
.risk-gauge[data-level="high"] .label { color: var(--err-ink); }

/* ---------- Read-back card ---------- */
.read-back {
  background: linear-gradient(180deg, var(--brand-primary-soft), var(--surface));
  border: 1px solid var(--brand-primary);
  border-radius: var(--radius-3);
  padding: var(--space-5);
}
.read-back .row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px dashed var(--line);
}
.read-back .row:last-of-type { border-bottom: none; }
.read-back .label { color: var(--muted); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.04em; }
.read-back .value { font-weight: var(--fw-semibold); text-align: right; }
.read-back .value.big { font-size: var(--fs-xl); }
.read-back .amount-in-words {
  margin-top: var(--space-3);
  font-style: italic;
  color: var(--ink-soft);
}

/* ---------- Receipt ---------- */
.receipt {
  font-family: var(--font-mono);
  background: var(--surface-soft);
  border: 1px dashed var(--line);
  border-radius: var(--radius-2);
  padding: var(--space-4);
  font-size: var(--fs-sm);
}
.receipt .kv { display: flex; justify-content: space-between; padding: 2px 0; }

/* ---------- Toast ---------- */
.toast-region {
  position: fixed;
  top: calc(var(--header-h) + var(--space-2));
  right: var(--space-3);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
  max-width: min(360px, 92vw);
}
.toast {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand-primary);
  border-radius: var(--radius-2);
  box-shadow: var(--shadow-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--fs-sm);
  pointer-events: auto;
}
.toast.ok { border-left-color: var(--ok); }
.toast.warn { border-left-color: var(--warn); }
.toast.err { border-left-color: var(--err); }

/* ---------- Bal-grid (LANDBANK funding cards) ---------- */
.bal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: var(--space-3);
}
.bal-card {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  padding: var(--space-4);
}
.bal-card .ccy {
  font-size: var(--fs-xs);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.bal-card .amt {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
  margin-top: var(--space-1);
}

/* ---------- Service grid (LANDBANK pick) ---------- */
.svc-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: 1fr;
}
@media (min-width: 768px) {
  .svc-grid { grid-template-columns: 1fr 1fr; }
}
.svc {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  padding: var(--space-4);
  cursor: pointer;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.svc:hover { border-color: var(--brand-primary); }
.svc.selected { border-color: var(--brand-primary); background: var(--brand-primary-soft); }
.svc .code { font-weight: var(--fw-bold); color: var(--brand-primary); }
.svc .name { font-size: var(--fs-sm); }

/* ---------- Quote box ---------- */
.quote {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  margin-top: var(--space-3);
}

/* ---------- Filters row ---------- */
.filters {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: 1fr;
}
@media (min-width: 600px) { .filters { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .filters { grid-template-columns: repeat(5, 1fr); } }

/* ---------- Utility ---------- */
.hide { display: none !important; }
.role-hide { display: none !important; }   /* hidden for this signed-in role */
.flex { display: flex; }
.grid { display: grid; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.center { text-align: center; }
.fs-xs { font-size: var(--fs-xs); }
.fs-sm { font-size: var(--fs-sm); }
.fw-bold { font-weight: var(--fw-bold); }
.text-muted { color: var(--muted); }
.text-ok { color: var(--ok-ink); }
.text-warn { color: var(--warn-ink); }
.text-err { color: var(--err-ink); }

/* ---------- Amount shortcut chips ---------- */
.amount-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.amount-chips .amt-chip {
  min-height: 36px;
  padding: 0 var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: var(--fs-sm);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.amount-chips .amt-chip:hover { border-color: var(--brand-primary); background: var(--brand-primary-soft); }
.amount-chips .amt-chip:active { transform: scale(0.97); }

/* ---------- Commit buttons ----------
   The old tap-and-hold gate is retired (WUI-05): `.hold-commit` buttons are
   plain buttons now (see hold_commit.js), so the class carries no styling. */

/* ---------- Banners (inline notices; pages may restyle, e.g. teller.css) ---------- */
.banner {
  display: block;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: var(--radius-2);
  background: var(--surface-soft);
  color: var(--ink);
  margin-bottom: var(--space-3);
}
.banner[hidden] { display: none; }
.banner.warn { background: var(--warn-soft); border-color: var(--warn); color: var(--warn-ink); }
.banner.err  { background: var(--err-soft);  border-color: var(--err);  color: var(--err-ink); }
.banner.ok   { background: var(--ok-soft);   border-color: var(--ok);   color: var(--ok-ink); }
.banner.info { background: var(--info-soft); border-color: var(--info); color: var(--info-ink); }

/* Text for screen readers only. */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

/* ---------- Reduced motion (WUI-27) ----------
   tokens.css zeroes the --dur-* variables; this also stops the animations and
   transitions written with literal durations, and smooth scrolling. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Print (WUI-21) ---------- */
@page { size: A4; margin: 12mm; }
@page landscape { size: A4 landscape; margin: 10mm; }
@media print {
  .app-header, .bottom-nav, .top-tabs, .drawer, .drawer-scrim, .console-tabs, .stepbar, .step-bar,
  .stepnav, .sub-tabs, .lb-session, .toast-region, .btn, .skip-link { display: none !important; }
  /* Staff-only notes (holds, rule codes, risk) never reach paper (WUX-10). */
  .no-print, .banner { display: none !important; }
  /* Wide report tables (the LANDBANK report) print on a landscape page. */
  .print-landscape { page: landscape; }
  .receipt { width: 100%; }
  body, .app-shell { min-height: 0; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #000; }
}
