/* =========================================================
   Zeal Portal — finance components (arc P)
   /css/system/components/finance.css

   The components the arc P boards draw and the system lacked, built once.
   Every value is a --fin-* token (css/system/finance.css) or a font role;
   no colour is written here. Type follows the boards' two translations:
   a 125% width is --font-ex, 75% is --font-cd, everything else --font-std.

   The page shell           .fin-page
   The head                 .fin-head (+ __eyebrow __title __meta __fresh __links)
   Figure tiles             .fin-tiles > .fin-tile (--bad --warn --ok --accent, button)
   Tabs                     .fin-tabs > .fin-tab (.is-on, __count)
   Filters                  .fin-filters > .fin-field (__label, input, select)
   Tables                   .fin-table (th, td, __title __sub, .is-attention)
   State chips              .fin-chip (--ok --warn --bad --plain --accent) + __dot
   Panels                   .fin-panel (__bar __label __meta __body)
   Buttons                  .fin-btn (--primary --big --chosen, [disabled])
   The step track           .fin-steps > .fin-step (.is-done .is-current)
   The close list           .fin-close > .fin-close__item (.is-met)
   Key and value            .fin-kv
   The drop zone            .fin-drop
   Banners                  .fin-banner (--warn --bad --ok)
   The gate                 .fin-gate (a surface whose switch is off)
   ========================================================= */

/* ── the page ────────────────────────────────────────────── */
.fin-page {
  max-width: var(--fin-page-max);
  margin: 0 auto;
  padding: var(--fin-pad-page);
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
}
.fin-cols { display: flex; gap: 24px; align-items: flex-start; }
.fin-cols__main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.fin-cols__side { flex: 0 0 400px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.fin input[type="checkbox"] { accent-color: var(--fin-accent); width: 15px; height: 15px; }
.fin-link { color: var(--fin-link); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; background: none; border: 0; padding: 0; font: inherit; }
.fin-link:hover { color: var(--fin-link-hover); }
.fin-muted { color: var(--fin-muted); }
.fin-muted-2 { color: var(--fin-muted-2); }
.fin-num { font-variant-numeric: tabular-nums; }
.fin-note { font-size: var(--fin-t-label); color: var(--fin-muted); }
.fin-footnote { font-size: var(--fin-t-label); color: var(--fin-muted-2); margin: 0; }

/* ── the head ────────────────────────────────────────────── */
.fin-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--fin-rule-strong);
}
.fin-head__left { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fin-head__eyebrow {
  font-family: var(--font-cd);
  font-size: var(--fin-t-label);
  font-weight: 600;
  letter-spacing: var(--fin-track-label);
  text-transform: uppercase;
  color: var(--fin-muted);
}
.fin-head__eyebrow a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.fin-head__title {
  margin: 0;
  font-family: var(--font-ex);
  font-size: var(--fin-t-title);
  line-height: 1;
  font-weight: 700;
  letter-spacing: var(--fin-track-head);
}
.fin-head--detail .fin-head__left { gap: 8px; }
.fin-head--detail .fin-head__title { font-size: var(--fin-t-title-detail); }
.fin-head__sub { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: var(--fin-t-body); color: var(--fin-muted-2); }
.fin-head__meta { display: flex; align-items: center; gap: 20px; font-size: var(--fin-t-body); color: var(--fin-muted-2); flex-wrap: wrap; justify-content: flex-end; }
/* a page's tabs that are PAGES (the CFO hub, finance settings; the quote
   page run, 17 Oct 2026): a nav of links under the title, full width, the
   current one marked; never a tablist, which is for views within a page */
.fin-head--tabs { flex-wrap: wrap; padding-bottom: 0; }
.fin-head--tabs .fin-head__left, .fin-head--tabs .fin-head__meta { padding-bottom: 18px; }
.fin-pagetabs { display: flex; gap: 28px; flex-wrap: wrap; width: 100%; flex-basis: 100%; margin-top: 6px; }
.fin-pagetab {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 2px;
  font-size: var(--fin-t-lead); font-weight: 500; color: var(--fin-muted-2); text-decoration: none;
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.fin-pagetab:hover { color: var(--fin-ink); }
.fin-pagetab.is-on { color: var(--fin-ink); font-weight: 600; border-bottom-color: var(--fin-accent); }
.fin-pagetab:focus-visible { outline: 2px solid var(--fin-ink); outline-offset: 2px; }
.fin-fresh { display: inline-flex; align-items: center; gap: 6px; }
.fin-fresh::before { content: ""; width: 8px; height: 8px; border-radius: 4px; background: var(--fin-ok); }
.fin-fresh.is-stale::before { background: var(--fin-bad); }
.fin-beta {
  font-family: var(--font-cd);
  font-size: var(--fin-t-micro);
  font-weight: 700;
  letter-spacing: var(--fin-track-label);
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: var(--fin-r-1);
  background: var(--fin-accent-soft);
  color: var(--fin-ink);
  vertical-align: middle;
}
.fin-tag { font-size: var(--fin-t-micro); font-weight: 600; padding: 3px 8px; border-radius: var(--fin-r-2); background: var(--fin-plain); }

/* ── figure tiles ───────────────────────────────────────── */
.fin-tiles {
  display: grid;
  grid-template-columns: repeat(var(--fin-tiles, 5), minmax(0, 1fr));
  border: 1px solid var(--fin-rule-strong);
}
.fin-tile {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 0;
  border-right: 1px solid var(--fin-rule-strong);
  background: var(--fin-paper);
  color: inherit;
  text-align: left;
  font: inherit;
  min-width: 0;
}
.fin-tile:last-child { border-right: 0; }
.fin-tiles--compact .fin-tile { padding: 14px 18px; gap: 5px; }
.fin-tiles--compact .fin-tile__num { font-size: var(--fin-t-figure-2); }
.fin-tile__label { font-family: var(--font-cd); font-size: var(--fin-t-label); font-weight: 600; letter-spacing: var(--fin-track-label); text-transform: uppercase; }
.fin-tile__num { font-family: var(--font-ex); font-size: var(--fin-t-figure); line-height: 1; font-weight: 700; letter-spacing: var(--fin-track-figure); font-variant-numeric: tabular-nums; }
.fin-tile__sub { font-size: var(--fin-t-label); color: var(--fin-muted-2); }
.fin-tile--bad { background: var(--fin-bad-soft); }
.fin-tile--warn { background: var(--fin-warn-soft); }
.fin-tile--ok { background: var(--fin-ok-soft); }
.fin-tile--accent { background: var(--fin-accent-soft); }
button.fin-tile { cursor: pointer; }
button.fin-tile:focus-visible { outline: 2px solid var(--fin-accent); outline-offset: -2px; }

/* ── tabs and filters ───────────────────────────────────── */
.fin-bar { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.fin-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--fin-rule-2); }
.fin-tab {
  height: 44px;
  padding: 0 14px;
  font-size: var(--fin-t-lead);
  font-weight: 500;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--fin-ink);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.fin-tab.is-on { border-bottom-color: var(--fin-accent); font-weight: 700; }
.fin-tab__count { font-size: var(--fin-t-label); font-weight: 400; color: var(--fin-muted); margin-left: 4px; }
.fin-tab:focus-visible { outline: 2px solid var(--fin-accent); outline-offset: 2px; }
.fin-filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.fin-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fin-field__label { font-family: var(--font-cd); font-size: var(--fin-t-micro); font-weight: 600; letter-spacing: var(--fin-track-label); text-transform: uppercase; color: var(--fin-muted); }
.fin-field__label--plain { font-family: var(--font-std); font-size: var(--fin-t-label); font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--fin-ink); }
/* Selects are the portal's own device (.select, form.css: its chevron and
   reset) sized to the boards; background-color only, so the chevron stays. */
.fin-input, .fin-select {
  height: var(--fin-control-h);
  padding: 0 10px;
  font: inherit;
  font-size: var(--fin-t-body);
  color: var(--fin-ink);
  border: 1px solid var(--fin-rule-3);
  border-radius: var(--fin-r-1);
  background-color: var(--fin-paper);
  min-width: 0;
  width: 100%;
}
.fin-select { padding-right: 32px; }
.fin-input::placeholder { color: var(--fin-muted); }
.fin-input:focus, .fin-select:focus { outline: 2px solid var(--fin-accent); outline-offset: -1px; }
.fin-textarea { height: auto; min-height: 72px; padding: 8px 10px; resize: vertical; line-height: 1.4; }
/* Round 11 (B2): a PO's line is a type, a description and a total, each a
   field with its label above it; the fields read as fields at 3:1 (v2's
   text-3, as v2's own inputs), set into the panel, with a focus ring. */
.fin-po-line { display: grid; grid-template-columns: 160px minmax(0, 1fr) 180px auto; gap: 12px; align-items: end; }
.fin-po-line .fin-field { width: auto !important; }
.fin-po-line__x { padding-bottom: 10px; }
/* boards.css's .zb-skin .fin-input draws the board's input line (16%
   black, about 1.4:1) and loads later at the same weight, so these name
   the form twice to win wherever the page sits */
.fin .fin-po-form .fin-input, .zb-skin .fin-po-form .fin-input,
.fin .fin-po-form .eta__input, .zb-skin .fin-po-form .eta__input { border-color: var(--fin-muted); }
:root[data-v2] .fin .fin-po-form .fin-input, :root[data-v2] .zb-skin .fin-po-form .fin-input,
:root[data-v2] .fin .fin-po-form .eta__input, :root[data-v2] .zb-skin .fin-po-form .eta__input { border-color: var(--z-text-3); background-color: var(--z-bg-sunk); }
.fin-po-form .fin-input:focus-visible, .fin-po-form .eta__input:focus-visible { outline: 2px solid var(--fin-accent); outline-offset: 1px; }
@media (max-width: 599px) {
  .fin-po-line { grid-template-columns: minmax(0, 1fr); }
}
/* the house picker (EntityTypeahead), sized as a finance control inside the scope */
.fin .eta__input { height: var(--fin-control-h); padding: 0 10px; font: inherit; font-size: var(--fin-t-body); border: 1px solid var(--fin-rule-3); border-radius: var(--fin-r-1); background-color: var(--fin-paper); color: var(--fin-ink); }
.fin .eta__input:focus { outline: 2px solid var(--fin-accent); outline-offset: -1px; }

/* ── tables ──────────────────────────────────────────────── */
.fin-table { width: 100%; border-collapse: collapse; border-top: 1px solid var(--fin-rule-strong); }
.fin-table th {
  font-family: var(--font-cd);
  font-size: var(--fin-t-micro);
  font-weight: 600;
  letter-spacing: var(--fin-track-label);
  text-transform: uppercase;
  color: var(--fin-muted);
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--fin-rule-2);
  white-space: nowrap;
}
.fin-table td { padding: 12px 14px; border-bottom: 1px solid var(--fin-rule-1); font-size: var(--fin-t-body); vertical-align: middle; line-height: 1.25; }
.fin-table th.is-num, .fin-table td.is-num { text-align: right; font-variant-numeric: tabular-nums; }
.fin-table td.is-money { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fin-table tr.is-link { cursor: pointer; }
.fin-table tr.is-link:hover td { background: var(--fin-well); }
.fin-table tr.is-attention td { background: var(--fin-bad-soft); }
.fin-table--bare { border-top: 0; }
/* the project tab's tables: tighter, and a 13px title (the board) */
.fin-table--compact th { padding: 8px 10px; }
.fin-table--compact td { padding: 10px; }
.fin-table--compact .fin-cell__title { font-size: var(--fin-t-body); }
.fin-table td.is-money.is-plain { font-weight: 400; }
.fin-table td.is-money.is-semi { font-weight: 600; }
.fin-cell__title { display: block; font-size: var(--fin-t-lead); font-weight: 700; }
.fin-cell__title.is-plain { font-weight: 400; }
.fin-cell__sub { display: block; font-size: var(--fin-t-label); color: var(--fin-muted); margin-top: 3px; }
.fin-cell__strong { font-weight: 700; }
.fin-cell__code { font-weight: 700; }
.fin-cell__home { font-weight: 700; }
.fin-cell__home.is-link { color: var(--fin-link); text-decoration: none; }
.fin-cell__home.is-link:hover { color: var(--fin-link-hover); text-decoration: underline; }
.fin-stack { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.fin-row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.fin-row-actions--tight { flex-wrap: nowrap; white-space: nowrap; gap: 12px; }

/* ── state chips ─────────────────────────────────────────── */
.fin-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fin-t-label);
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--fin-r-2);
  background: var(--fin-plain);
  color: var(--fin-ink);
  white-space: nowrap;
  line-height: 1.2;
}
.fin-chip__dot { width: 7px; height: 7px; border-radius: 4px; background: var(--fin-plain-dot); flex: 0 0 7px; }
.fin-chip--ok { background: var(--fin-ok-soft); }  .fin-chip--ok .fin-chip__dot { background: var(--fin-ok); }
.fin-chip--warn { background: var(--fin-warn-soft); } .fin-chip--warn .fin-chip__dot { background: var(--fin-warn); }
.fin-chip--bad { background: var(--fin-bad-soft); } .fin-chip--bad .fin-chip__dot { background: var(--fin-bad); }
.fin-chip--plain { background: var(--fin-plain); }
.fin-chip--nodot .fin-chip__dot { display: none; }
.fin-chip--wrap { white-space: normal; }
.fin-at { font-size: var(--fin-t-micro); font-weight: 700; padding: 2px 6px; border-radius: var(--fin-r-1); background: var(--fin-tag); color: var(--fin-tag-ink); }

/* ── panels ──────────────────────────────────────────────── */
.fin-panel { display: flex; flex-direction: column; border: 1px solid var(--fin-rule-strong); background: var(--fin-paper); min-width: 0; }
.fin-panel--soft { border-color: var(--fin-rule-2); }
.fin-panel__bar { padding: 10px 14px; border-bottom: 1px solid var(--fin-rule-2); display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.fin-panel__label { font-family: var(--font-cd); font-size: var(--fin-t-micro); font-weight: 600; letter-spacing: var(--fin-track-label); text-transform: uppercase; color: var(--fin-muted); }
.fin-panel__meta { font-size: var(--fin-t-label); color: var(--fin-muted); text-align: right; }
.fin-panel__body { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.fin-panel__row { padding: 12px 14px; border-bottom: 1px solid var(--fin-rule-1); display: flex; gap: 12px; align-items: center; }
.fin-panel__row:last-child { border-bottom: 0; }
/* snag round 6 (D1): a strip WRAPS onto another row rather than shrinking a
   figure: each starts at its own width and never shrinks below it (so
   "£1,399,472" never runs into its neighbour), grows to share the row, and
   is never wider than the strip (on a phone its sentence wraps inside it) */
.fin-figures { display: flex; flex-wrap: wrap; }
.fin-figure { flex: 1 0 auto; max-width: 100%; padding: 16px; display: flex; flex-direction: column; gap: 4px; border-right: 1px solid var(--fin-rule-1); }
.fin-figure:last-child { border-right: 0; }
/* snag round 6b: a strip that has to wrap splits evenly. FinanceUI measures
   how many figures fit a row and evens the rows (four and three for seven),
   setting data-fin-per-row; each figure then starts at that share of the row
   and grows to fill a shorter last row */
.fin-figures[data-fin-per-row] > .fin-figure { flex: 1 0 calc(100% / var(--fin-per-row) - 1px); }
.fin-figure--warn { background: var(--fin-warn-soft); }
.fin-figure__label { font-size: var(--fin-t-label); font-weight: 600; }
.fin-figure__num { font-family: var(--font-ex); font-size: var(--fin-t-h2); font-weight: 700; letter-spacing: var(--fin-track-figure); font-variant-numeric: tabular-nums; line-height: 1.05; white-space: nowrap; }
.fin-figure__sub { font-size: var(--fin-t-label); color: var(--fin-muted); }

/* section heads inside a page (the project tab's "income lines.") */
.fin-section { display: flex; flex-direction: column; border-top: 1px solid var(--fin-rule-strong); }
.fin-section__head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 10px 0; }
.fin-section__title { margin: 0; font-family: var(--font-ex); font-size: var(--fin-t-h3); font-weight: 700; letter-spacing: var(--fin-track-section); }
.fin-section__meta { font-size: var(--fin-t-label); color: var(--fin-muted-2); display: flex; gap: 12px; align-items: center; }

/* ── buttons ─────────────────────────────────────────────── */
.fin-btn {
  height: var(--fin-control-h);
  padding: 0 14px;
  font: inherit;
  font-size: var(--fin-t-body);
  font-weight: 600;
  border-radius: var(--fin-r-1);
  border: 1px solid var(--fin-rule-strong);
  background: var(--fin-paper);
  color: var(--fin-ink);
  cursor: pointer;
  white-space: nowrap;
}
.fin-btn--soft { border-color: var(--fin-rule-3); }
.fin-btn--chosen { background: var(--fin-well); border-color: var(--fin-rule-strong); }
.fin-btn--primary { background: var(--fin-accent); color: var(--fin-accent-ink); border-color: var(--fin-rule-strong); }
.fin-btn--big { height: 44px; padding: 0 18px; font-size: var(--fin-t-lead); font-weight: 700; }
.fin-btn--mid { height: 34px; padding: 0 12px; }
.fin-btn--lg { height: 40px; padding: 0 16px; font-size: var(--fin-t-lead); }
.fin-btn--primary.fin-btn--lg { font-weight: 700; }
.fin-btn--small { height: 30px; padding: 0 10px; font-size: var(--fin-t-label); font-weight: 700; }
.fin-btn[disabled], .fin-btn.is-disabled { background: var(--fin-quiet); color: var(--fin-faint); border-color: var(--fin-rule-3); cursor: default; }
.fin-btn:focus-visible { outline: 2px solid var(--fin-accent); outline-offset: 2px; }
.fin-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ── the step track (an order's invoicing path) ─────────── */
.fin-steps { display: grid; grid-template-columns: repeat(var(--fin-steps, 6), minmax(0, 1fr)); border: 1px solid var(--fin-rule-strong); }
.fin-step { padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; border-right: 1px solid var(--fin-rule-strong); min-width: 0; }
.fin-step:last-child { border-right: 0; }
.fin-step__n { font-family: var(--font-cd); font-size: var(--fin-t-micro); font-weight: 600; letter-spacing: var(--fin-track-label); text-transform: uppercase; color: var(--fin-muted); }
.fin-step__label { font-size: var(--fin-t-step); font-weight: 700; }
.fin-step__sub { font-size: var(--fin-t-label); color: var(--fin-muted-2); }
.fin-step.is-done { background: var(--fin-ok-soft); }
.fin-step.is-current { background: var(--fin-accent-soft); }

/* ── the close list ──────────────────────────────────────── */
.fin-close { display: flex; flex-direction: column; }
.fin-close__item { display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: start; padding: 9px 14px; border-bottom: 1px solid var(--fin-rule-1); font-size: var(--fin-t-body); line-height: 1.4; }
.fin-close__mark { width: 14px; height: 14px; border-radius: 7px; border: 1px solid var(--fin-muted); margin-top: 2px; }
.fin-close__item.is-met .fin-close__mark { border: 0; border-radius: 0; width: 14px; height: 14px; position: relative; }
.fin-close__item.is-met .fin-close__mark::after {
  content: "";
  position: absolute;
  left: 3px; top: 0;
  width: 5px; height: 10px;
  border: solid var(--fin-ok);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.fin-close__foot { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }

/* ── key and value ───────────────────────────────────────── */
.fin-kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: var(--fin-t-body); margin: 0; }
.fin-kv dt { color: var(--fin-muted-2); }
.fin-kv dd { margin: 0; text-align: right; font-weight: 600; }

/* ── the drop zone ───────────────────────────────────────── */
.fin-drop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1.5px dashed var(--fin-rule-dash);
  border-radius: var(--fin-r-2);
  font-size: var(--fin-t-body);
}
.fin-drop--tight { padding: 8px 12px; background: var(--fin-paper); }
.fin-drop.is-over { background: var(--fin-well); }
/* the POs received space (P6.6) */
.fin-cpo { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.fin-cpo--form { padding: 12px 14px; border: 1.5px dashed var(--fin-rule-dash); border-radius: var(--fin-r-2); background: var(--fin-paper); }
.fin-cpo__fields { display: grid; grid-template-columns: repeat(2, minmax(0, 200px)); gap: 12px; }
.fin-cpo__right { display: flex; gap: 12px; align-items: center; flex: 0 0 auto; }
.fin-cpo__peek { width: 100%; height: 420px; border: 1px solid var(--fin-rule-2); background: var(--fin-canvas); }
.fin-drop__text { display: flex; flex-direction: column; gap: 2px; }
.fin-drop__title { font-weight: 700; }

/* ── banners, history, empty ─────────────────────────────── */
.fin-banner { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--fin-r-2); background: var(--fin-plain); font-size: var(--fin-t-lead); font-weight: 600; }
.fin-banner::before { content: ""; width: 8px; height: 8px; border-radius: 4px; background: var(--fin-plain-dot); flex: 0 0 8px; }
.fin-banner--warn { background: var(--fin-warn-soft); } .fin-banner--warn::before { background: var(--fin-warn); }
.fin-banner--bad { background: var(--fin-bad-soft); } .fin-banner--bad::before { background: var(--fin-bad); }
.fin-banner--ok { background: var(--fin-ok-soft); } .fin-banner--ok::before { background: var(--fin-ok); }
.fin-history { display: grid; grid-template-columns: 90px 1fr; gap: 10px; font-size: var(--fin-t-body); margin: 0; }
.fin-history dt { color: var(--fin-muted); }
.fin-history dd { margin: 0; line-height: 1.4; }
.fin-empty { padding: 28px 14px; font-size: var(--fin-t-body); color: var(--fin-muted-2); }
.fin-error { padding: 14px; font-size: var(--fin-t-body); background: var(--fin-bad-soft); border-radius: var(--fin-r-2); }
.fin-loading { padding: 28px 14px; font-size: var(--fin-t-body); color: var(--fin-muted); }

/* ── the gate: a surface whose switch is off ─────────────── */
.fin-gate { display: flex; flex-direction: column; gap: 8px; padding: 32px 0; max-width: 640px; }
.fin-gate__title { margin: 0; font-family: var(--font-ex); font-size: var(--fin-t-h2); font-weight: 700; letter-spacing: var(--fin-track-figure); }
.fin-gate p { margin: 0; font-size: var(--fin-t-lead); color: var(--fin-muted-2); line-height: 1.45; }

/* ── the hub ─────────────────────────────────────────────── */
.fin-hub { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border: 1px solid var(--fin-rule-strong); }
.fin-hub__card { padding: 18px 20px; border-right: 1px solid var(--fin-rule-2); border-bottom: 1px solid var(--fin-rule-2); display: flex; flex-direction: column; gap: 6px; color: inherit; text-decoration: none; min-width: 0; }
.fin-hub__card:hover { background: var(--fin-well); }
.fin-hub__card:nth-child(3n) { border-right: 0; }
.fin-hub__title { font-family: var(--font-ex); font-size: var(--fin-t-h3); font-weight: 700; letter-spacing: var(--fin-track-figure); }
.fin-hub__what { font-size: var(--fin-t-body); color: var(--fin-muted-2); }
.fin-hub__count { font-size: var(--fin-t-label); font-weight: 600; }
.fin-hub__card.is-off { color: var(--fin-faint); }

/* ── the queue and its detail (bills; invoice requests; POs) ── */
.fin-split { display: grid; grid-template-columns: minmax(0, 600px) minmax(0, 1fr); gap: 24px; align-items: start; }
.fin-queue { border-top: 1px solid var(--fin-rule-strong); display: flex; flex-direction: column; }
.fin-queue__head { display: grid; grid-template-columns: 1fr 120px; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--fin-rule-2); }
.fin-queue__head span { font-family: var(--font-cd); font-size: var(--fin-t-micro); font-weight: 600; letter-spacing: var(--fin-track-label); text-transform: uppercase; color: var(--fin-muted); }
.fin-queue__head span:last-child { text-align: right; }
.fin-queue__item { display: grid; grid-template-columns: 1fr 120px; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--fin-rule-1); background: var(--fin-paper); color: inherit; font: inherit; cursor: pointer; }
.fin-queue__item:hover { background: var(--fin-well); }
.fin-queue__item.is-on { background: var(--fin-well); }
.fin-queue__item:focus-visible { outline: 2px solid var(--fin-accent); outline-offset: -2px; }
.fin-queue__main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fin-queue__who { font-size: var(--fin-t-row); font-weight: 700; }
.fin-queue__ctx { font-size: var(--fin-t-body); font-weight: 400; color: var(--fin-muted-2); margin-left: 6px; }
.fin-queue__sub { font-size: var(--fin-t-label); color: var(--fin-muted-2); }
.fin-queue__chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 2px; }
.fin-queue__right { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.fin-queue__amount { font-size: var(--fin-t-row); font-weight: 700; font-variant-numeric: tabular-nums; }
.fin-queue__wait { font-size: var(--fin-t-label); color: var(--fin-muted-2); }

.fin-detail { display: flex; flex-direction: column; gap: 18px; border-top: 1px solid var(--fin-rule-strong); padding-top: 16px; min-width: 0; }
.fin-detail__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.fin-detail__left { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fin-detail__name { display: flex; align-items: baseline; gap: 10px; }
.fin-detail__right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.fin-detail__title { margin: 0; font-family: var(--font-ex); font-size: var(--fin-t-detail); font-weight: 700; letter-spacing: var(--fin-track-figure); line-height: 1.05; }
.fin-detail__aside { font-size: var(--fin-t-body); color: var(--fin-muted-2); }
.fin-detail__amount { font-family: var(--font-ex); font-size: var(--fin-t-detail); font-weight: 700; letter-spacing: var(--fin-track-figure); font-variant-numeric: tabular-nums; line-height: 1; text-align: right; }
.fin-detail__amount-sub { font-size: var(--fin-t-label); color: var(--fin-muted); text-align: right; }
.fin-detail__meta { font-size: var(--fin-t-body); color: var(--fin-muted-2); }
.fin-detail__cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 20px; align-items: start; }

.fin-doc { border: 1px solid var(--fin-rule-strong); display: flex; flex-direction: column; min-width: 0; }
.fin-doc__bar { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; font-size: var(--fin-t-label); color: var(--fin-muted-2); }
.fin-doc__tools { display: flex; gap: 6px; }
.fin-doc__tool { width: 30px; height: 30px; border: 1px solid var(--fin-rule-3); border-radius: var(--fin-r-1); background: var(--fin-paper); cursor: pointer; font: inherit; }
.fin-doc__body { background: var(--fin-canvas); padding: 18px; min-height: 420px; display: flex; align-items: flex-start; justify-content: center; }
.fin-doc__page { width: 100%; min-height: 380px; background: var(--fin-paper); border: 1px solid var(--fin-rule-2); }
.fin-doc__empty { font-size: var(--fin-t-body); color: var(--fin-muted-2); padding: 24px; text-align: center; line-height: 1.45; }
.fin-doc__foot { display: flex; justify-content: space-between; padding: 8px 10px; border-top: 1px solid var(--fin-rule-1); font-size: var(--fin-t-label); }

.fin-match { display: flex; flex-direction: column; }
.fin-match__row { display: grid; grid-template-columns: 18px 72px 1fr auto; gap: 10px; align-items: baseline; padding: 11px 14px; border-bottom: 1px solid var(--fin-rule-1); font-size: var(--fin-t-body); }
.fin-match__row:last-child { border-bottom: 0; }
.fin-match__mark { font-weight: 700; color: var(--fin-ok); }
.fin-match__mark.is-warn, .fin-match__mark.is-bad { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border: 2px solid currentColor; border-radius: 50%; font-size: 10px; line-height: 1; align-self: center; }
.fin-match__mark.is-warn { color: var(--fin-warn); }
.fin-match__mark.is-bad { color: var(--fin-bad); }
.fin-match__what { font-weight: 700; }
.fin-match__amount { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.fin-sublabel { display: flex; justify-content: space-between; font-family: var(--font-cd); font-size: var(--fin-t-micro); font-weight: 600; letter-spacing: var(--fin-track-label); text-transform: uppercase; color: var(--fin-muted); }
.fin-sublabel span:last-child { font-family: var(--font-std); letter-spacing: 0; text-transform: none; font-weight: 400; font-size: var(--fin-t-label); }
.fin-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.fin-notes { display: grid; grid-template-columns: 160px 1fr; gap: 10px 16px; font-size: var(--fin-t-body); }
.fin-notes__who { font-weight: 700; display: flex; flex-direction: column; }
.fin-notes__who span { font-weight: 400; font-size: var(--fin-t-label); color: var(--fin-muted-2); }
.fin-compose { display: flex; gap: 8px; }
.fin-compose .fin-input { flex: 1; height: 40px; }

/* ── bills: the table and the panel that stays put (snag round 9) ── */
.fin-split--table { grid-template-columns: minmax(0, 1fr) minmax(0, 560px); }
.fin-split__panel { position: sticky; top: 72px; max-height: calc(100vh - 88px); overflow: auto; min-width: 0; }
.fin-split__panel .fin-detail__cols { grid-template-columns: minmax(0, 1fr); }
.fin-bills tr.is-on td { background: var(--fin-well); }
.fin-bills__tick, .fin-bills__pdf { width: 1%; white-space: nowrap; }
.fin-bills__open { border: 0; background: transparent; padding: 0; font: inherit; font-weight: 700; color: inherit; cursor: pointer; text-align: left; }
.fin-bills__open:focus-visible { outline: 2px solid var(--fin-accent); outline-offset: 2px; }
.fin-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.fin-clip-wrap { position: relative; display: inline-flex; align-items: center; gap: 6px; }
.fin-clip { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--fin-rule-3); border-radius: var(--fin-r-1); background: var(--fin-paper); color: var(--fin-ink); cursor: pointer; padding: 0; }
.fin-clip.is-dashed { border-style: dashed; color: var(--fin-faint); }
.fin-clip:focus-visible { outline: 2px solid var(--fin-accent); outline-offset: 1px; }
.fin-clip__word { font-size: var(--fin-t-micro); color: var(--fin-muted); white-space: nowrap; }
.fin-clip__peek { pointer-events: none; position: absolute; left: 34px; top: -8px; z-index: 35; width: 220px; height: 290px; padding: 6px; background: var(--fin-canvas); border: 1px solid var(--fin-rule-strong); border-radius: var(--fin-r-2); }
.fin-clip__page { width: 100%; height: 100%; border: 0; background: var(--fin-paper); }
.fin-batch { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 14px; margin-bottom: 12px; border: 1px solid var(--fin-rule-strong); background: var(--fin-well); }
.fin-batch__what { font-weight: 700; }
.fin-batch__to { width: 280px; max-width: 100%; }
.fin-batch__refused { flex-basis: 100%; color: var(--fin-bad); font-size: var(--fin-t-body); }
.fin-alloc { display: flex; flex-direction: column; gap: 6px; width: 260px; max-width: 100%; }
.fin-alloc__side { display: inline-flex; gap: 6px; }
.fin-alloc__opt { border: 1px solid var(--fin-rule-3); border-radius: var(--fin-r-1); background: var(--fin-paper); color: inherit; font: inherit; font-size: var(--fin-t-label); padding: 4px 9px; cursor: pointer; }
.fin-alloc__opt.is-on { border-color: var(--fin-accent); color: var(--fin-accent); }

/* ── bills: one layout on every tab (snag round 9b) ──────────
   The list keeps its own column and narrows when the bill opens; it never
   runs under the panel. The panel is solid, its content scrolls, and its
   acts sit in a footer pinned to its foot. */
/* the list keeps about 640px (its eight columns' least) until the panel is
   down to 320px; past that the panel grows to the board's 560px */
/* Round 12 (item 3): the bills page fills the content area at every width
   (.fin--wide lifts the finance page's 1440px maximum), and the extra room
   is shared: the panel grows past 560px only to 30% of the split, so the
   list takes most of it and its columns stop squashing. */
.fin--wide .fin-page { max-width: none; }
.fin-split--bills { grid-template-columns: minmax(0, 1fr) clamp(320px, calc(100% - 800px), max(560px, 30%)); }
.fin-split--bills > .fin-table-wrap { min-width: 0; overflow-x: auto; }
.fin-split--bills .fin-bills th { padding: 8px 5px; white-space: normal; }
.fin-split--bills .fin-bills th .cf-head { white-space: normal; }
.fin-split--bills .fin-bills td { padding: 10px 5px; }
/* Round 11 (B6): the list never grows past its own column, so no header
   (flags last) is pushed under the panel. The table is laid out fixed at
   the column's width; the tick and PDF columns take what they need, and
   the rest share what's left, wrapping (a long name, a pound total that
   names its foreign part) rather than widening. */
/* Round 12 (item 8): words wrap at spaces, never inside a word
   ("Entertainm ent", "approve d"). So the table lays itself out by its
   content again (auto): no column is narrower than its longest word, and a
   long reference breaks only after its hyphens. The full width of item 3 is
   what leaves room for that beside the panel. */
.fin-split--bills .fin-bills { table-layout: auto; width: 100%; }
.fin-split--bills .fin-bills .fin-bills__tick { width: 34px; }
.fin-split--bills .fin-bills .fin-bills__pdf { width: 56px; }
.fin-split--bills .fin-bills td, .fin-split--bills .fin-bills th { overflow-wrap: normal; word-break: normal; hyphens: manual; }
.fin-split--bills .fin-bills td.is-money { white-space: normal; }
.fin-split--bills .fin-bills .fin-clip-wrap { flex-direction: column; align-items: flex-start; gap: 2px; }
.fin-split--bills .fin-bills .fin-clip__word { white-space: normal; max-width: 4.5em; line-height: 1.15; }
.fin-split--bills .fin-split__panel { display: flex; flex-direction: column; overflow: hidden; background: var(--fin-paper); position: sticky; z-index: 2; }
.fin-split--bills .fin-detail { flex: 1 1 auto; min-height: 0; gap: 0; padding-top: 0; }
.fin-detail__scroll { flex: 1 1 auto; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 18px; padding: 16px 4px 16px 0; }
.fin-detail__foot { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 12px 0 6px; border-top: 1px solid var(--fin-rule-strong); background: var(--fin-paper); }
.fin-detail__foot .fin-note { font-size: var(--fin-t-label); }

/* ── narrow screens (the boards draw 1440 only) ─────────── */
@media (max-width: 960px) {
  .fin-page { padding: 24px 16px 40px; }
  .fin-head { flex-direction: column; align-items: flex-start; }
  .fin-head__meta { justify-content: flex-start; }
  .fin-head__title { font-size: var(--fin-t-h2); }
  .fin-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fin-tile { border-bottom: 1px solid var(--fin-rule-strong); }
  .fin-cols { flex-direction: column; }
  .fin-cols__side { flex-basis: auto; width: 100%; }
  .fin-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fin-hub { grid-template-columns: 1fr; }
  .fin-table-wrap { overflow-x: auto; }
  .fin-split, .fin-detail__cols, .fin-detail__head, .fin-grid-2 { grid-template-columns: 1fr; }
  /* the bill's panel stacks under the list on a phone (snag round 9) */
  .fin-split--table { grid-template-columns: minmax(0, 1fr); }
  .fin-split__panel { position: static; max-height: none; overflow: visible; }
  /* snag round 9b: on a phone the panel stacks, its content runs on, and
     the acts stick to the foot of the screen while the bill is in view */
  .fin-split--bills .fin-split__panel { display: block; overflow: visible; position: static; }
  .fin-detail__scroll { overflow: visible; }
  .fin-detail__foot { position: sticky; bottom: 0; z-index: 2; }
  .fin-detail__foot .fin-btn { min-height: 44px; }
  /* a finger's target at phone widths */
  .fin-clip { width: 44px; height: 44px; }
  .fin-alloc__opt { min-height: 44px; }
  .fin-notes { grid-template-columns: 1fr; }
}
