/* =============================================================================
   Rogers · Invoice-to-PO Validation — UI theme
   Reference: Erisa's PoC mockup (Rogers_POC.html): brand tokens, shell, buttons,
   cards, stepper, verdict hero, ledger, tables, dashboard and reports are taken
   from it; the app-specific parts (document viewer, reconciliation matrix,
   invoice selection, Manage analyses) are built with the same tokens.
   To match the official brand kit, change only the token block below.
   ============================================================================= */
:root {
  --font: "Figtree", "Helvetica Neue", Arial, sans-serif;
  --red: #DA291C; --red-hover: #B81F14; --red-soft: #FCE9E7; --on-red: #FFFFFF;
  --ink: #1F1F1F; --ink-2: #4D4D4D; --ink-3: #6E6E6E;
  --bg: #F4F4F4; --surface: #FFFFFF; --surface-2: #F5F5F5;
  --line: #E1E1E1; --line-2: #B8B8B8;
  --hero: #1F1F1F; --on-hero: #FFFFFF; --on-hero-2: #C9C9C9;
  --ok: #0A7A3E; --ok-soft: #E3F3E9;
  --warn: #A95300; --warn-soft: #FDEEDB;
  --bad: #C0102C; --bad-soft: #FCE5E8;
  --tc: var(--ink-2); --ts: var(--surface-2);
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.18);
  --hdr-h: 72px;
  --on-tone: #FFFFFF;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --red: #E0352A; --red-hover: #F0483E; --red-soft: #3A1715; --on-red: #FFFFFF;
  --ink: #F2F2F2; --ink-2: #C6C6C6; --ink-3: #9C9C9C;
  --bg: #121212; --surface: #1C1C1C; --surface-2: #262626;
  --line: #323232; --line-2: #4C4C4C;
  --hero: #000000; --on-hero: #FFFFFF; --on-hero-2: #BDBDBD;
  --ok: #4CC38A; --ok-soft: #13301F;
  --warn: #F0A54A; --warn-soft: #352610;
  --bad: #FF6B76; --bad-soft: #3A1519;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.6);
  --on-tone: #000000;
  color-scheme: dark;
}

/* ── Base ──────────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 16px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased;
  min-height: 100vh; display: flex; flex-direction: column; overflow-x: clip; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
h1:focus, h2:focus, main:focus { outline: none; }
[hidden] { display: none !important; }
svg { flex: none; }
.num, .tbl td, .kpi-v, .amt-v { font-variant-numeric: tabular-nums; }
.sr, .ri-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }
.muted { color: var(--ink-3); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 32px; }
.tone-ok { --tc: var(--ok); --ts: var(--ok-soft); }
.tone-warn { --tc: var(--warn); --ts: var(--warn-soft); }
.tone-bad { --tc: var(--bad); --ts: var(--bad-soft); }
.tone-info { --tc: var(--ink); --ts: var(--surface-2); }
.tone-muted { --tc: var(--ink-3); --ts: var(--surface-2); }
.ri-num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ri-mt { margin-top: 14px; }
.ri-trunc { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ri-nowrap { white-space: nowrap; }
.ri-cell-sub { display: block; margin-top: 2px; font-size: 13px; font-weight: 500; color: var(--ink-3); }
.ri-bad-text { color: var(--bad); font-weight: 700; }
.ri-warn-text { color: var(--warn); font-weight: 700; }

/* ── Buttons and links ─────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 24px;
  border-radius: 999px; border: 1.5px solid var(--ink); background: var(--surface); color: var(--ink); font-size: 16px;
  font-weight: 700; line-height: 1.1; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn svg { width: 18px; height: 18px; }
.btn-red { background: var(--red); border-color: var(--red); color: var(--on-red); }
.btn-red:hover { background: var(--red-hover); border-color: var(--red-hover); }
.btn-ghost { background: transparent; border-color: var(--on-hero); color: var(--on-hero); }
.btn-ghost:hover { background: rgba(255,255,255,.1); }
.btn-bad { color: var(--bad); border-color: var(--bad); }
.btn-bad:hover { background: var(--bad-soft); }
.btn-sm { min-height: 36px; padding: 0 16px; font-size: 14px; }
.btn-sm svg { width: 16px; height: 16px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .4; cursor: not-allowed; }
.btn[disabled]:hover { background: var(--surface); }
.btn-red[disabled]:hover { background: var(--red); }
.link { border: 0; background: none; padding: 0; color: var(--ink); font-weight: 700; text-decoration: underline;
  text-underline-offset: 3px; cursor: pointer; font-size: inherit; }
.link:hover { color: var(--red); }
.icon-btn { border: 0; background: none; color: var(--ink-3); cursor: pointer; padding: 6px; display: inline-grid; place-items: center;
  border-radius: 999px; text-decoration: none; }
.icon-btn:hover, .icon-btn[aria-expanded="true"] { color: var(--ink); background: var(--surface-2); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.is-bad:hover { color: var(--bad); background: var(--bad-soft); }
.icon-btn[aria-disabled="true"] { opacity: .35; cursor: not-allowed; }
.icon-btn[aria-disabled="true"]:hover { background: none; color: var(--ink-3); }

/* ── Utility bar, header ───────────────────────────────────────────────────── */
.util { background: var(--hero); color: var(--on-hero); font-size: 13px; }
.util-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 38px; max-width: none; }
.util-r { display: flex; align-items: center; gap: 20px; }
.env { display: inline-flex; align-items: center; gap: 6px; color: var(--on-hero-2); }
.env svg { width: 14px; height: 14px; }
.hdr { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.hdr-in { display: flex; align-items: center; gap: 24px; height: var(--hdr-h); max-width: none; }
.brand { display: flex; align-items: center; gap: 14px; color: var(--ink); text-decoration: none; min-width: 0; }
.brand-logo { height: 26px; width: auto; display: block; }
.brand-logo-dark { display: none; }
[data-theme="dark"] .brand-logo-light { display: none; }
[data-theme="dark"] .brand-logo-dark { display: block; }
.brand-sep { width: 1px; height: 28px; background: var(--line); }
.brand-name { font-size: 21px; font-weight: 800; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--red-soft); color: var(--red); flex: none; }
.hsearch { position: relative; margin-left: auto; width: min(320px, 28vw); }
.hsearch svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--ink-3); pointer-events: none; }
.hsearch input[type="search"] { width: 100%; min-height: 40px; padding: 0 14px 0 40px; border-radius: 999px; border: 1.5px solid var(--line-2);
  background: var(--surface); font-size: 15px; }
.hsearch input[type="search"]:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.theme-sw button { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 14px; }
.theme-sw svg { width: 16px; height: 16px; }
.user { position: relative; }
.user-btn { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 4px 6px 4px 4px; border-radius: 999px;
  cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink); }
.user-btn:hover, .user-btn[aria-expanded="true"] { background: var(--surface-2); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: var(--surface); display: grid; place-items: center;
  font-size: 13px; font-weight: 700; flex: none; }
.user-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; padding: 8px; border-radius: 14px; background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow-lg); z-index: 40; }
.user-menu p { margin: 4px 10px 8px; font-size: 13px; color: var(--ink-3); overflow-wrap: anywhere; }
.user-menu a { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; font-size: 15px; font-weight: 600; text-decoration: none; }
.user-menu a:hover { background: var(--surface-2); }
.user-menu svg { width: 18px; height: 18px; }
.menu-btn { display: none; }

/* ── App shell: left menu + main ───────────────────────────────────────────── */
.app { flex: 1; display: grid; grid-template-columns: 264px minmax(0, 1fr); align-items: start;
  background: linear-gradient(to right, var(--surface) 263px, var(--line) 263px 264px, transparent 264px); }
.side { position: sticky; top: var(--hdr-h); height: calc(100vh - var(--hdr-h)); overflow-y: auto; background: var(--surface);
  border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; }
.side > .btn-red { width: 100%; margin-bottom: 12px; }
.side-h { font-size: 13px; font-weight: 700; color: var(--ink-3); margin: 18px 12px 6px; }
.side ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.si { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 10px;
  font-size: 15px; font-weight: 600; color: var(--ink-2); text-decoration: none; white-space: nowrap; }
.si:hover { background: var(--surface-2); color: var(--ink); }
.si:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.si svg { width: 20px; height: 20px; }
.si[aria-current="page"] { background: var(--red-soft); color: var(--ink); font-weight: 800; }
.si[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--red); }
.si[aria-current="page"] > svg { color: var(--red); }
.cnt { margin-left: auto; font-size: 12.5px; font-weight: 700; min-width: 26px; height: 22px; padding: 0 7px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2); display: inline-grid; place-items: center; border: 1px solid var(--line); }
.cnt.hot { background: var(--red); border-color: var(--red); color: #fff; }
.side-foot { margin: auto 0 0; padding: 20px 12px 0; font-size: 12.5px; color: var(--ink-3); }
main { min-width: 0; display: flex; flex-direction: column; min-height: calc(100vh - var(--hdr-h)); }
.side-overlay { display: none; }

/* ── Page band (title strip) and content ───────────────────────────────────── */
.band { background: var(--surface); padding: 32px 0 26px; border-bottom: 1px solid var(--line); }
.band-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.band h1 { font-size: 36px; line-height: 1.1; font-weight: 800; letter-spacing: -.025em; margin: 0 0 8px; overflow-wrap: anywhere; }
.band h1 .icon-btn { vertical-align: middle; margin-left: 4px; }
.band-sub { margin: 0; color: var(--ink-2); font-size: 17px; max-width: 70ch; }
.band-r { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.back { margin: 0 0 14px; font-size: 15px; }
.back .link { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }
.back .link:hover { text-decoration: underline; }
.back svg { width: 16px; height: 16px; }
.content { padding: 28px 0 56px; flex: 1; }
.content > .wrap > * + *, .stack > * + * { margin-top: 20px; }
.foot { background: var(--hero); color: var(--on-hero-2); font-size: 13.5px; padding: 20px 0; }

/* ── Segmented control ─────────────────────────────────────────────────────── */
.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); flex-wrap: wrap; }
.seg button { border: 0; background: none; min-height: 36px; padding: 0 16px; border-radius: 999px; font-size: 14px; font-weight: 700;
  color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--ink); color: var(--surface); }
.seg .num { font-weight: 600; opacity: .7; }

/* ── Stepper ───────────────────────────────────────────────────────────────── */
.stepper { list-style: none; margin: 26px 0 0; padding: 0; display: flex; max-width: 900px; }
.st { flex: 1; display: flex; align-items: center; min-width: 0; }
.st:last-child { flex: none; }
.st:not(:last-child)::after { content: ""; flex: 1; height: 2px; background: var(--line); margin: 0 14px; border-radius: 2px; }
.st-done:not(:last-child)::after { background: var(--ink); }
.st-btn { all: unset; display: inline-flex; align-items: center; gap: 10px; border-radius: 999px; }
button.st-btn { cursor: pointer; }
button.st-btn:hover .st-l { text-decoration: underline; text-underline-offset: 3px; }
button.st-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
.st-n { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 14px; font-weight: 800;
  border: 2px solid var(--line-2); color: var(--ink-3); background: var(--surface); }
.st-n svg { width: 16px; height: 16px; }
.st-current .st-n { background: var(--red); border-color: var(--red); color: var(--on-red); }
.st-done .st-n { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.st-l { font-size: 15px; font-weight: 700; color: var(--ink-3); white-space: nowrap; }
.st-current .st-l, .st-done .st-l { color: var(--ink); }

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 30px; min-width: 0; }
.card-h h2 { font-size: 26px; line-height: 1.2; font-weight: 800; letter-spacing: -.015em; margin: 0 0 6px; }
.card-h p { margin: 0 0 26px; color: var(--ink-2); max-width: 70ch; }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 36px; }
.split-even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.card-f { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 30px;
  padding-top: 24px; border-top: 1px solid var(--line); }
.card-f-info { font-size: 15px; color: var(--ink-2); }
.card-f-r { display: flex; gap: 10px; flex-wrap: wrap; margin-left: auto; }
.aside { background: var(--surface-2); border-radius: 12px; padding: 22px 24px; }
.aside h3 { font-size: 16px; font-weight: 700; margin: 0 0 4px; }
.aside p { margin: 0 0 18px; color: var(--ink-2); font-size: 15px; }
.aside p:last-child { margin-bottom: 0; }
.alt { margin: 16px 0 0; font-size: 15px; color: var(--ink-2); }
.err { display: flex; gap: 8px; align-items: flex-start; margin: 14px 0 0; color: var(--bad); font-size: 15px; font-weight: 600; }
.err:empty { display: none; }
.err svg { width: 18px; height: 18px; margin-top: 2px; }
.note { display: flex; gap: 10px; align-items: flex-start; margin: 20px 0 0; padding: 12px 16px; border-radius: 10px; background: var(--surface-2);
  font-size: 14px; color: var(--ink-2); }
.note svg { width: 18px; height: 18px; margin-top: 1px; }
.note.tone-bad { background: var(--bad-soft); color: var(--bad); font-weight: 600; }
.note.tone-warn { background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.sub { font-size: 16px; font-weight: 700; margin: 0 0 12px; }

/* ── Dropzone, file row ────────────────────────────────────────────────────── */
.dropzone { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 46px 24px; border: 2px dashed var(--line-2);
  border-radius: 12px; background: var(--surface-2); color: var(--ink-2); cursor: pointer; }
.dropzone:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.dz-ic { width: 56px; height: 56px; border-radius: 50%; background: var(--red-soft); color: var(--red); display: grid; place-items: center; margin-bottom: 4px; }
.dz-ic svg { width: 26px; height: 26px; }
.dropzone.is-over { border-color: var(--red); background: var(--red-soft); }
.dz-t { font-size: 18px; font-weight: 700; color: var(--ink); }
.dz-s { font-size: 15px; }
.filerow { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); }
.fr-ic { width: 44px; height: 44px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; }
.fr-ic svg { width: 22px; height: 22px; }
.fr-t { display: grid; flex: 1; min-width: 0; }
.fr-n { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
a.fr-n:hover, button.fr-n:hover { text-decoration: underline; }
button.fr-n { all: unset; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.fr-m { font-size: 14px; color: var(--ink-3); }
.ok-line { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; font-size: 14px; font-weight: 600; color: var(--ok); }
.ok-line.is-warn { color: var(--warn); }
.ok-line.is-bad { color: var(--bad); }
.ok-line.is-busy { color: var(--ink-2); }
.ok-line svg { width: 16px; height: 16px; }
.upl { margin-top: 14px; }
.upl-l { font-size: 14px; color: var(--ink-2); margin-bottom: 6px; }

/* PO summary after reading (step 1) */
.po-sum { margin-top: 16px; padding: 20px 22px; border-radius: 12px; background: var(--surface-2); }
.po-sum-h { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.po-sum-l { font-size: 14px; font-weight: 700; color: var(--ink-3); }
.po-sum-n { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.wpill.is-rev { background: var(--surface); }

/* ── Facts (definition grid), notes, disclosures ───────────────────────────── */
.facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 18px; margin: 0; font-size: 14.5px; }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.factgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px 24px; margin: 0; }
.factgrid dt { font-size: 13.5px; font-weight: 600; color: var(--ink-3); }
.factgrid dd { margin: 2px 0 0; font-size: 17px; font-weight: 800; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.ri-notes { margin: 6px 0 0; padding-left: 18px; font-size: 14px; color: var(--ink-2); line-height: 1.5; }
.disc { margin-top: 18px; }
.disc > summary { display: inline-flex; align-items: center; gap: 8px; list-style: none; cursor: pointer; font-size: 15px; font-weight: 700; }
.disc > summary::-webkit-details-marker { display: none; }
.disc > summary svg { width: 18px; height: 18px; transition: transform .15s; }
.disc[open] > summary svg { transform: rotate(180deg); }
.disc > summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 4px; }
.disc > :not(summary) { margin-top: 12px; }

/* ── Processing (running analysis) ─────────────────────────────────────────── */
.proc { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 40px; }
.tasks, .stages { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.task { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 12px;
  background: var(--surface-2); }
button.task { all: unset; box-sizing: border-box; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 14px 16px; border-radius: 12px; background: var(--surface-2); cursor: pointer; width: 100%; }
button.task:hover { box-shadow: inset 0 0 0 1.5px var(--line-2); }
button.task:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.tk-t { display: grid; min-width: 0; }
.tk-n { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-k { font-size: 13.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-r { font-size: 14px; color: var(--ink-3); text-align: right; font-weight: 600; white-space: nowrap; }
.task.is-done .tk-r { color: var(--ink); }
.task.is-failed .tk-r { color: var(--bad); }
.stage { display: flex; align-items: center; gap: 14px; padding: 10px 4px; font-size: 15px; color: var(--ink-3); font-weight: 600; }
.stage.is-working, .stage.is-done { color: var(--ink); }
.tk-i { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.is-done > .tk-i { background: var(--ok); color: #fff; }
.is-failed > .tk-i { background: var(--bad); color: #fff; }
.tk-i svg { width: 15px; height: 15px; }
.ic-q { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line-2); }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--red); animation: spin .8s linear infinite; }
.spin-sm { width: 14px; height: 14px; border-width: 2px; display: inline-block; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.prog { margin: 0 0 26px; }
.prog-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.prog-v { font-size: 34px; font-weight: 800; letter-spacing: -.025em; }
.prog-l { font-size: 15px; color: var(--ink-2); font-weight: 600; }
.pbar { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.pbar span { display: block; height: 100%; border-radius: 999px; background: var(--red); transition: width .3s ease; }
.now { margin: 14px 0 0; font-size: 15px; color: var(--ink-2); overflow-wrap: anywhere; }

/* ── Verdict hero ──────────────────────────────────────────────────────────── */
.vhero { background: var(--hero); color: var(--on-hero); border-radius: 16px; padding: 34px 38px; display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 44px; align-items: start; }
.vpill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 10px; border-radius: 999px; font-size: 15px; font-weight: 800;
  background: var(--tc); color: var(--on-tone); }
.vpill svg { width: 18px; height: 18px; }
.vhero h2 { font-size: 44px; line-height: 1.05; font-weight: 800; letter-spacing: -.03em; margin: 16px 0 8px; }
.vref { margin: 0 0 14px; font-size: 17px; color: var(--on-hero-2); font-weight: 600; }
.vsum { margin: 0 0 24px; font-size: 17px; max-width: 58ch; line-height: 1.55; }
.vbtns { display: flex; flex-wrap: wrap; gap: 12px; }
.wf { border-top: 1px solid rgba(255,255,255,.16); padding-top: 20px; }
.wf-s { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 16px; font-size: 14.5px; color: var(--on-hero-2); font-weight: 600; }
.wf-n { margin: 14px 0 0; font-size: 14px; color: var(--on-hero-2); max-width: 58ch; overflow-wrap: anywhere; }
.wf-n b { color: var(--on-hero); }
.vside { background: rgba(255,255,255,.07); border-radius: 12px; padding: 24px; }
.amts { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 24px; margin: 0 0 20px; }
.amts dd { margin: 0; }
.amt-l { display: block; font-size: 13.5px; color: var(--on-hero-2); }
.amt-v { font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
.amt-bad .amt-v { color: #FF8A8A; }
.bar { height: 8px; border-radius: 999px; background: rgba(255,255,255,.18); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 999px; background: var(--tc); }
.bar-cap { margin: 10px 0 0; font-size: 13.5px; color: var(--on-hero-2); }
.vmeta { margin: 20px 0 0; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.16); font-size: 13.5px; color: var(--on-hero-2); }
.srcs { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.srcs li { max-width: 100%; min-width: 0; }
.srcs button { all: unset; display: inline-flex; align-items: center; gap: 6px; max-width: 100%; box-sizing: border-box; font-size: 13px; font-weight: 600;
  padding: 4px 12px; border-radius: 999px; background: rgba(255,255,255,.1); color: var(--on-hero); cursor: pointer; }
.srcs button:hover { background: rgba(255,255,255,.18); }
.srcs button:focus-visible { outline: 2px solid var(--on-hero); outline-offset: 2px; }
.srcs span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srcs svg { width: 14px; height: 14px; }

/* ── Pills ─────────────────────────────────────────────────────────────────── */
.hpill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px 3px 8px; border-radius: 999px; font-size: 13.5px; font-weight: 800;
  color: var(--tc); background: var(--ts); white-space: nowrap; max-width: 100%; }
.hpill svg { width: 15px; height: 15px; }
.wpill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px; font-size: 13.5px; font-weight: 700;
  white-space: nowrap; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line-2); }
.wpill svg { width: 14px; height: 14px; }
.wpill.tone-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.wpill.tone-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.wpill.tone-bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.wpill.tone-info { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.ri-mark { display: inline-flex; align-items: center; gap: 5px; font-size: 13.5px; font-weight: 700; white-space: nowrap; color: var(--tc); }
.ri-mark svg { width: 15px; height: 15px; }

/* ── Sections, filters, ledger ─────────────────────────────────────────────── */
.sec-h { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 14px; margin-bottom: 18px; }
.sec-h h2, .sec-h h3 { font-size: 22px; font-weight: 800; letter-spacing: -.015em; margin: 0; }
.sec-h p { margin: 2px 0 0; font-size: 14px; color: var(--ink-3); max-width: 80ch; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.flt { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line-2);
  background: var(--surface); font-size: 14px; font-weight: 700; cursor: pointer; color: var(--ink); }
.flt:hover { border-color: var(--ink); }
.flt[class*="tone-"]::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--tc); }
.flt .num { font-weight: 600; color: var(--ink-3); }
.flt[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.flt[aria-pressed="true"] .num { color: inherit; opacity: .75; }
.flt:disabled { opacity: .4; cursor: default; }
.flt:disabled:hover { border-color: var(--line-2); }
.lhead, .lrow-main { display: grid; grid-template-columns: minmax(0, 1fr) 190px minmax(0, 1fr) 28px; gap: 16px; }
.lhead { padding: 0 12px 12px; font-size: 13.5px; font-weight: 700; color: var(--ink-3); border-bottom: 1px solid var(--line); }
.lhead span:nth-child(2) { text-align: center; }
.ledger { list-style: none; margin: 0; padding: 0; }
.lrow { border-bottom: 1px solid var(--line); }
.lrow:last-child { border-bottom: 0; }
.lrow-main { all: unset; box-sizing: border-box; display: grid; grid-template-columns: minmax(0, 1fr) 190px minmax(0, 1fr) 28px; gap: 16px;
  align-items: center; width: 100%; padding: 18px 12px; cursor: pointer; border-radius: 10px; }
.lrow-main:hover { background: var(--surface-2); }
.lrow-main:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.lcell { display: grid; gap: 2px; min-width: 0; }
.lc-ref { font-size: 13px; font-weight: 600; color: var(--ink-3); }
.lc-desc { font-weight: 700; overflow-wrap: anywhere; }
.lc-num { font-size: 14.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.lc-num mark { background: var(--bad-soft); color: var(--bad); font-weight: 800; padding: 0 4px; border-radius: 4px; }
.lc-empty { color: var(--ink-3); font-weight: 600; }
.lcell-r .lc-ref:not(:first-child) { margin-top: 8px; }
.lmid { position: relative; display: grid; justify-items: center; gap: 5px; text-align: center; }
.lmid::before { content: ""; position: absolute; top: 15px; left: -8px; right: -8px; height: 2px; background: var(--tc); opacity: .45; border-radius: 2px; }
.lmid.no-right::before { right: 50%; }
.lmid.no-left::before { left: 50%; }
.chip { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 9px; border-radius: 999px; font-size: 13.5px;
  font-weight: 800; line-height: 18px; color: var(--tc); background: var(--ts); border: 1.5px solid var(--tc); white-space: nowrap; }
.chip svg { width: 15px; height: 15px; }
.st-missing .chip { background: var(--surface); border-style: dashed; }
.chip-cap { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.lexp { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: var(--ink); }
.lexp svg { width: 18px; height: 18px; transition: transform .15s; }
.is-open .lexp svg { transform: rotate(180deg); }
.ldetail { margin: 0 12px 18px; padding: 18px 22px; border-radius: 12px; background: var(--surface-2); border-left: 4px solid var(--tc); }
.ldetail[hidden] { display: none; }
.ldetail > p { margin: 0 0 12px; font-size: 15px; color: var(--ink-2); max-width: 80ch; }
.empty-filter { padding: 28px 12px; color: var(--ink-3); }

/* ── Tables ────────────────────────────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th, .tbl td { text-align: left; vertical-align: middle; padding: 13px 14px; border-bottom: 1px solid var(--line); }
.tbl tbody tr:last-child > th, .tbl tbody tr:last-child > td { border-bottom: 0; }
.tbl thead th { font-size: 13.5px; font-weight: 700; color: var(--ink-3); padding-top: 0; white-space: nowrap; vertical-align: bottom; }
.tbl tbody th { font-weight: 700; }
.tbl .r { text-align: right; }
.tbl .po { font-weight: 800; white-space: nowrap; }
.tbl tbody tr.hov { cursor: pointer; }
.tbl tbody tr.hov:hover { background: var(--surface-2); }
.tbl tfoot td { font-weight: 800; border-top: 1.5px solid var(--line-2); border-bottom: 0; }
.tbl-h td { vertical-align: top; }
.mk { display: flex; align-items: center; gap: 5px; margin-top: 3px; font-size: 13.5px; font-weight: 600; color: var(--ok); }
.mk svg { width: 14px; height: 14px; }
.mk-norm { color: var(--ink-2); }
.mk-bad { color: var(--bad); }
/* compact tables (data inside sections and the document viewer) */
.ri-table-compact { font-size: 14px; }
.ri-table-compact th, .ri-table-compact td { padding: 9px 10px; vertical-align: top; }
.ri-table-compact thead th { padding-top: 6px; font-size: 12.5px; }
.ri-table-compact .ri-wrap { min-width: 200px; }
.ri-items .ri-reason-row td { padding-top: 0; color: var(--ink-3); font-size: 13px; }
.ri-items tr:not(.ri-reason-row) td { border-bottom: 0; }
.ri-row-bad { background: color-mix(in srgb, var(--bad) 6%, transparent); }
.ri-cell-warn { background: var(--warn-soft); color: var(--warn); font-weight: 800; }
/* a compact table that does not fit its box becomes one card per row (labels from the header, see app.js) */
.ri-table-compact.is-stacked, .ri-table-compact.is-stacked > tbody, .ri-table-compact.is-stacked > tfoot { display: block; }
.ri-table-compact.is-stacked > thead { display: none; }
.ri-table-compact.is-stacked > tbody > tr { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px 16px;
  padding: 12px 4px; border-bottom: 1px solid var(--line); }
.ri-table-compact.is-stacked > tbody > tr > * { display: block; min-width: 0; padding: 0; border: 0; text-align: left !important; white-space: normal;
  overflow-wrap: anywhere; background: transparent; }
.ri-table-compact.is-stacked > tbody > tr > [data-label]::before { content: attr(data-label); display: block; margin-bottom: 2px;
  font-size: 12px; font-weight: 600; color: var(--ink-3); }
.ri-table-compact.is-stacked > tbody > tr > [data-label=""]::before { display: none; }
.ri-table-compact.is-stacked > tbody > tr > .ri-stack-main,
.ri-table-compact.is-stacked > tbody > tr > .ri-wrap,
.ri-table-compact.is-stacked > tbody > tr > .ri-stack-span,
.ri-table-compact.is-stacked > tbody > tr:not(:has(> .ri-stack-main)) > :first-child { grid-column: 1 / -1; }
.ri-table-compact.is-stacked > tbody > tr > .ri-stack-main { font-weight: 700; }
.ri-table-compact.is-stacked > tbody > tr > .ri-stack-main::before { display: none; }
.ri-table-compact.is-stacked > tbody > tr > .ri-stack-hide { display: none; }
.ri-table-compact.is-stacked .ri-wrap { min-width: 0; }
.ri-table-compact.is-stacked .ri-nowrap { white-space: normal; }
.ri-table-compact.is-stacked > tfoot > tr { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding: 10px 4px; }
.ri-table-compact.is-stacked > tfoot > tr > td { display: block; padding: 0; border: 0; }
.ri-table-compact.is-stacked > tfoot > tr > td:empty { display: none; }
.ri-table-compact.is-stacked.ri-items > tbody > tr:not(.ri-reason-row) { border-bottom: 0; padding-bottom: 4px; }
.ri-table-compact.is-stacked.ri-items > tbody > tr.ri-reason-row { padding-top: 0; }
.ri-stack-only { display: none; }
.ri-table-compact.is-stacked .ri-stack-only { display: inline; }

/* ── Footer of a result, queue bar, search, empty states ───────────────────── */
.vfoot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; margin-top: 28px; }
.vfoot .vbtns { gap: 10px; }
.qbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 18px; }
.search { position: relative; flex: 1 1 280px; max-width: 420px; min-width: 0; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink-3); pointer-events: none; }
.search input[type="search"] { padding-left: 42px; border-radius: 999px; }
.search-lg { max-width: none; }
.search-lg input[type="search"] { min-height: 52px; font-size: 17px; }
.qcount { font-size: 14.5px; color: var(--ink-2); font-weight: 600; }
.empty { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 48px 20px; color: var(--ink-2); }
.empty-ic { width: 56px; height: 56px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; }
.empty-ic.is-neutral { background: var(--surface-2); color: var(--ink-3); }
.empty-ic svg { width: 26px; height: 26px; }
.empty h3 { margin: 4px 0 0; font-size: 19px; color: var(--ink); }
.empty p { margin: 0 0 8px; max-width: 56ch; }

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form { display: grid; gap: 16px; }
.fld { display: grid; gap: 6px; }
.fld label, .lbl { font-size: 14px; font-weight: 700; }
input[type="text"], input[type="search"], textarea, .inp { width: 100%; font-size: 16px; background: var(--surface); border: 1.5px solid var(--line-2);
  border-radius: 8px; padding: 11px 14px; }
textarea { resize: vertical; line-height: 1.5; }
input[type="text"]:focus, input[type="search"]:focus, textarea:focus, .inp:focus, .sel:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.sel { min-height: 44px; padding: 0 12px; border: 1.5px solid var(--line-2); border-radius: 8px; background: var(--surface); font-size: 15px;
  font-weight: 600; min-width: 180px; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--red); cursor: pointer; }
input[type="checkbox"]:disabled { cursor: default; }

/* ── Dashboard ─────────────────────────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 22px 24px; min-width: 0; }
.kpi-l { margin: 0; font-size: 14.5px; font-weight: 700; color: var(--ink-2); }
.kpi-v { margin: 8px 0 2px; font-size: 34px; line-height: 1.1; font-weight: 800; letter-spacing: -.025em; overflow-wrap: anywhere; }
.kpi-bad .kpi-v { color: var(--red); }
.kpi-s { margin: 0; font-size: 13.5px; color: var(--ink-3); }
.dgrid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 16px; }
.dgrid .card { padding: 24px 26px; }
.legend { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-wrap: wrap; gap: 16px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.legend li { display: inline-flex; align-items: center; gap: 7px; }
.sw { width: 11px; height: 11px; border-radius: 3px; background: var(--tc); flex: none; }
.chart { display: block; width: 100%; height: auto; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart text { fill: var(--ink-3); font-size: 12px; font-family: var(--font); font-weight: 600; }
.chart .tot { fill: var(--ink); font-size: 13px; font-weight: 800; }
.chart rect { stroke: var(--surface); stroke-width: 1.5; }
.b-ok { fill: var(--ok); } .b-warn { fill: var(--warn); } .b-bad { fill: var(--bad); }
.donut-wrap { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.donut circle { fill: none; stroke-width: 18; }
.seg-bg { stroke: var(--surface-2); } .seg-ok { stroke: var(--ok); } .seg-warn { stroke: var(--warn); } .seg-bad { stroke: var(--bad); }
.donut .ctr { fill: var(--ink); font-size: 28px; font-weight: 800; font-family: var(--font); }
.donut .ctr-s { fill: var(--ink-3); font-size: 12px; font-weight: 600; font-family: var(--font); }
.mix { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; flex: 1; min-width: 170px; }
.mix li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; font-size: 15px; font-weight: 600; }
.mix .pc { color: var(--ink-3); font-weight: 600; font-size: 14px; }
.hbars { display: grid; gap: 16px; }
.hb-top { display: flex; justify-content: space-between; gap: 12px; font-size: 14.5px; font-weight: 600; margin-bottom: 6px; }
.hb-top span:last-child { color: var(--ink-2); white-space: nowrap; }
.hb-track { height: 10px; border-radius: 999px; background: var(--surface-2); }
.hb-fill { height: 100%; border-radius: 999px; background: var(--bad); min-width: 6px; }
.hb-fill.is-warn { background: var(--warn); }
.att { list-style: none; margin: 0; padding: 0; }
.att li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.att li:last-child { border-bottom: 0; }
.att-t { display: grid; gap: 2px; min-width: 0; }
.att-t b { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-t span { font-size: 14px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.minibar { display: inline-block; vertical-align: middle; width: 70px; height: 8px; border-radius: 999px; background: var(--surface-2); margin-right: 10px; overflow: hidden; }
.minibar span { display: block; height: 100%; background: var(--bad); border-radius: 999px; }

/* ── Reports ───────────────────────────────────────────────────────────────── */
.rtiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 24px; }
.rtile { display: grid; gap: 6px; align-content: start; text-align: left; padding: 18px 18px 20px; border-radius: 12px; border: 1.5px solid var(--line-2);
  background: var(--surface); cursor: pointer; color: var(--ink); }
.rtile:hover { border-color: var(--ink); }
.rtile[aria-pressed="true"] { border: 2px solid var(--red); padding: 17.5px 17.5px 19.5px; background: var(--red-soft); }
.rtile-ic { width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; margin-bottom: 6px; }
.rtile[aria-pressed="true"] .rtile-ic { background: var(--surface); color: var(--red); }
.rtile-ic svg { width: 20px; height: 20px; }
.rtile b { font-size: 16px; }
.rtile span { font-size: 14px; color: var(--ink-2); }
.rfilters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px; padding: 18px 0 22px; border-top: 1px solid var(--line); }
.rf { display: grid; gap: 6px; }
.rf label { font-size: 14px; font-weight: 700; }
.rfilters .btn { margin-left: auto; }
.rmeta { margin: 14px 0 0; font-size: 14px; color: var(--ink-3); }
.ri-preview th, .ri-preview td { white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.ri-preview th:first-child, .ri-preview td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: inset -1px 0 0 var(--line); }

/* ── Against the PO maximum (Erisa's spend bars, one per PO line) ──────────── */
.sp-sum { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden; margin-bottom: 28px; }
.sp-sum > div { background: var(--surface); padding: 16px 20px; min-width: 0; }
.sp-l { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink-3); }
.sp-v { font-size: 22px; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.sp-bad .sp-v { color: var(--bad); }
.sbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 22px; }
.sb-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.sb-l { display: grid; min-width: 0; }
.sb-l b { font-weight: 800; }
.sb-l span { font-size: 13.5px; color: var(--ink-3); }
.sb-r { font-size: 14.5px; color: var(--ink-2); text-align: right; font-variant-numeric: tabular-nums; }
.sb-r b { color: var(--ink); }
.sb-pc { display: inline-block; min-width: 46px; margin-left: 6px; font-weight: 800; color: var(--ink); }
.sb-over { display: block; color: var(--bad); font-weight: 700; font-size: 13.5px; }
.sb-bar { position: relative; height: 18px; margin-top: 9px; }
.sb-track { position: absolute; inset: 0 auto 0 0; border-radius: 5px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.sb-fill { position: absolute; inset: 0 auto 0 0; border-radius: 5px; background: var(--ink); }
.sb-overb { position: absolute; top: 0; bottom: 0; border-radius: 0 5px 5px 0; background: repeating-linear-gradient(135deg, var(--bad) 0 4px, var(--bad-soft) 4px 7px); }
.sb-max { position: absolute; top: -5px; bottom: -5px; width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--ink); }
.sb-q { margin: 7px 0 0; font-size: 13px; color: var(--ink-3); }
.sp-key { list-style: none; margin: 24px 0 0; padding: 16px 0 0; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 10px 22px;
  font-size: 13.5px; color: var(--ink-2); font-weight: 600; }
.sp-key li { display: inline-flex; align-items: center; gap: 8px; }
.k-fill { width: 20px; height: 10px; border-radius: 3px; background: var(--ink); }
.k-track { width: 20px; height: 10px; border-radius: 3px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.k-over { width: 20px; height: 10px; border-radius: 3px; background: repeating-linear-gradient(135deg, var(--bad) 0 4px, var(--bad-soft) 4px 7px); }
.k-max { width: 3px; height: 16px; border-radius: 2px; background: var(--ink); }

/* ── Reconciliation matrix (one column per invoice) ────────────────────────── */
.ri-recon-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; max-height: 72vh;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.ri-recon { border-collapse: separate; border-spacing: 0; font-size: 14px; min-width: 100%; }
.ri-recon th, .ri-recon td { padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); }
.ri-recon thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); font-weight: 700; color: var(--ink-3); font-size: 13px; vertical-align: bottom; }
.ri-recon .ri-sticky { position: sticky; left: 0; z-index: 1; min-width: 200px; max-width: 300px; white-space: normal; text-align: left;
  border-right: 1.5px solid var(--line-2); }
.ri-recon thead .ri-sticky { z-index: 3; }
.ri-recon .ri-col-inv { border-left: 1px solid var(--line); text-align: center; }
.ri-recon .ri-col-head { all: unset; display: inline-flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; }
.ri-recon .ri-col-head b { color: var(--ink); font-size: 14px; }
.ri-recon .ri-col-head:hover b { text-decoration: underline; }
.ri-recon .ri-col-head:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
.ri-recon .ri-col-head svg { width: 15px; height: 15px; color: var(--tc); }
.ri-recon td.ri-rem { border-left: 1px solid var(--line); min-width: 92px; text-align: right; }
.ri-recon-legend { display: block; margin-top: 4px; font-size: 12px; font-weight: 500; line-height: 1.35; color: var(--ink-3); }
.ri-recon-legend b { color: var(--ink); font-weight: 700; }
.ri-rc-billed { display: block; font-weight: 700; color: var(--ink); }
.ri-rc-billed.is-empty { font-weight: 500; color: var(--ink-3); }
.ri-rc-left { display: block; margin-top: 2px; font-size: 12.5px; color: var(--ink-3); }
.ri-recon td.is-over { background: var(--bad-soft); }
.ri-recon td.is-over .ri-rc-left { color: var(--bad); font-weight: 800; }
.ri-recon td.is-first-over { box-shadow: inset 0 0 0 2px var(--bad); }
.ri-recon td.is-vendor-diff { background: var(--warn-soft); }
.ri-recon tfoot td { position: sticky; bottom: 0; background: var(--surface-2); font-weight: 800; border-top: 1.5px solid var(--line-2); text-align: right; }
.ri-recon tfoot td.ri-sticky { text-align: left; }
.ri-line-no { display: inline-block; min-width: 22px; font-weight: 800; color: var(--red); }
.ri-line-desc { font-weight: 700; color: var(--ink); }
.ri-line-ordered { display: block; color: var(--ink-3); font-size: 12.5px; margin-top: 2px; }

/* ── Findings, invoice cards, audit trail ──────────────────────────────────── */
.ri-findings { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ri-finding { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2);
  border-left: 4px solid var(--tc); }
.ri-finding > svg { width: 20px; height: 20px; color: var(--tc); margin-top: 1px; }
.ri-finding-title { font-weight: 800; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ri-finding-msg { font-size: 14.5px; color: var(--ink-2); line-height: 1.5; margin-top: 2px; }
.ri-inv-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.ri-inv-card { all: unset; box-sizing: border-box; cursor: pointer; padding: 18px 20px; border-radius: 12px; background: var(--surface);
  border: 1.5px solid var(--line); border-top: 5px solid var(--tc); display: grid; gap: 8px; }
.ri-inv-card:hover { border-color: var(--line-2); border-top-color: var(--tc); }
.ri-inv-card:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.ri-ic-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ri-ic-num { font-size: 18px; font-weight: 800; }
.ri-ic-meta { font-size: 14px; color: var(--ink-3); display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ri-ic-amount { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ri-ic-issues { font-size: 13.5px; color: var(--ink-2); line-height: 1.45; }
.ri-timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.ri-timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.ri-timeline li { position: relative; padding: 0 0 16px 30px; font-size: 15px; }
.ri-timeline li::before { content: ""; position: absolute; left: 1px; top: 5px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface);
  border: 3px solid var(--ink); box-sizing: border-box; }
.ri-tl-when { color: var(--ink-3); font-size: 13.5px; }
.ri-tl-msg { overflow-wrap: anywhere; }

/* ── Invoice selection list (set-up step 2) ────────────────────────────────── */
.inv-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 28px 0 8px; padding-top: 24px; border-top: 1px solid var(--line); }
.inv-tools .search { flex: 1 1 240px; }
.inv-group { margin-top: 22px; }
.inv-group h3 { margin: 0; font-size: 17px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.inv-group > p { margin: 2px 0 10px; font-size: 14px; color: var(--ink-3); }
.inv-group h3 .cnt { margin-left: 0; }
.inv-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.inv { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); }
.inv.is-selected { border-color: var(--line-2); }
.inv.is-forced { border-color: var(--warn); background: var(--warn-soft); }
.inv-st { display: grid; place-items: center; color: var(--tc); }
.inv-st svg { width: 20px; height: 20px; }
.inv-main { min-width: 0; display: grid; gap: 1px; }
.inv-name { all: unset; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.inv-name:hover { text-decoration: underline; }
.inv-name:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
.inv-reason { font-size: 13.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-meta { font-size: 14px; color: var(--ink-2); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.inv-actions { display: flex; align-items: center; gap: 2px; }

/* ── Manage analyses list: adapts to its own width, never scrolls sideways ─── */
.ri-manage { container: ripage / inline-size; }
.ri-list { container: rilist / inline-size; }
.ri-mtable { table-layout: fixed; }
.ri-mtable .ri-col-inv { width: 88px; }
.ri-mtable .ri-col-status { width: 168px; }
.ri-mtable .ri-col-result { width: 160px; }
.ri-mtable .ri-col-billed { width: 180px; }
.ri-mtable .ri-col-started { width: 168px; }
.ri-mtable .ri-row-actions { width: 156px; text-align: right; white-space: nowrap; }
.ri-mtable td.ri-row-actions > * { vertical-align: middle; }
.ri-mname { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; font-weight: 800; text-decoration: none; }
.ri-mname:hover { text-decoration: underline; }
.ri-mtable .ri-only-compact { display: none; }
.ri-status-run { display: grid; gap: 6px; min-width: 0; }
.ri-status-run-l { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; font-weight: 700; }
.ri-progress-mini { display: flex; align-items: center; gap: 8px; }
.ri-progress-mini .pbar { flex: 1; height: 6px; }
.ri-progress-mini span { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
tr.is-new > td { background: var(--red-soft); }
tr.is-new > td:first-child { box-shadow: inset 4px 0 0 var(--red); }
@container rilist (max-width: 1039px) {
  .ri-mtable .ri-col-inv, .ri-mtable .ri-col-started { display: none; }
  .ri-mtable .ri-only-compact { display: block; }
}
@container rilist (max-width: 819px) {
  .ri-mtable, .ri-mtable tbody { display: block; }
  .ri-mtable thead { display: none; }
  .ri-mtable tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
    grid-template-areas: "name name name actions" "status result billed billed"; gap: 14px 20px; padding: 18px 4px; border-bottom: 1px solid var(--line); }
  .ri-list .ri-mtable td { display: block; width: auto; min-width: 0; padding: 0; border: 0; text-align: left; }
  .ri-list .ri-mtable td.ri-row-actions { text-align: right; }
  .ri-list .ri-mtable td.ri-col-inv, .ri-list .ri-mtable td.ri-col-started { display: none; }
  .ri-mtable td.ri-col-name { grid-area: name; }
  .ri-mtable td.ri-row-actions { grid-area: actions; align-self: start; }
  .ri-mtable td.ri-col-status { grid-area: status; }
  .ri-mtable td.ri-col-result { grid-area: result; }
  .ri-mtable td.ri-col-billed { grid-area: billed; }
  .ri-mtable td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 6px; font-size: 13px; font-weight: 700; color: var(--ink-3); }
  .ri-mtable tr.is-new { background: var(--red-soft); box-shadow: inset 4px 0 0 var(--red); }
  .ri-mtable tr.is-new > td { background: transparent; box-shadow: none; }
}
@container rilist (max-width: 539px) {
  .ri-mtable tr { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    grid-template-areas: "name name actions" "status result result" "billed billed billed"; }
  .ri-mtable td.ri-row-actions .btn { display: none; }
}

/* ── Menus, dialogs, tooltip, toast, skeleton ──────────────────────────────── */
.ri-menu { position: fixed; z-index: 1200; min-width: 260px; max-width: 330px; padding: 8px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow-lg); }
.ri-menu-item { display: grid; gap: 1px; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--ink);
  font-size: 15px; font-weight: 700; text-align: left; cursor: pointer; }
.ri-menu-item small { font-size: 13px; font-weight: 500; color: var(--ink-3); }
.ri-menu-item:hover:not(:disabled), .ri-menu-item:focus-visible { background: var(--surface-2); outline: none; }
.ri-menu-item:disabled { color: var(--ink-3); cursor: default; }
.dlg-overlay { position: fixed; inset: 0; z-index: 100000; background: rgba(0,0,0,.45); display: grid; place-items: center; padding: 20px;
  opacity: 0; transition: opacity .15s ease; }
.dlg-overlay.show { opacity: 1; }
.dlg { width: min(520px, 100%); max-height: 90vh; overflow: auto; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 28px; }
.dlg h2 { margin: 0 0 10px; font-size: 22px; font-weight: 800; letter-spacing: -.015em; }
.dlg-body { color: var(--ink-2); font-size: 15.5px; }
.dlg-body p { margin: 0 0 10px; }
.dlg-body .fld { margin-top: 6px; }
.dlg-f { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.ri-tooltip { position: fixed; z-index: 100020; pointer-events: none; padding: 8px 12px; border-radius: 10px; background: var(--ink); color: var(--surface);
  font-size: 13.5px; max-width: 300px; box-shadow: var(--shadow-lg); }
.ri-tooltip strong { display: block; font-size: 14px; }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 100030; transform: translate(-50%, 16px); background: var(--ink); color: var(--surface);
  padding: 12px 20px; border-radius: 999px; font-size: 15px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px); }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast svg { width: 18px; height: 18px; }
.toast.is-ok svg { color: #4CC38A; } .toast.is-bad svg { color: #FF8A8A; } .toast.is-warn svg { color: #F0A54A; }
.ri-skel { height: 96px; border-radius: 12px; background: linear-gradient(90deg, var(--surface-2) 0%, var(--line) 50%, var(--surface-2) 100%);
  background-size: 200% 100%; animation: shimmer 1.2s ease-in-out infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.is-loading { opacity: .55; transition: opacity .2s ease; }

/* ── Document viewer: PDF (left) + extracted data (right) ──────────────────── */
.ri-docmodal-overlay { position: fixed; inset: 0; z-index: 100000; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center;
  padding: 2vh 2vw; opacity: 0; transition: opacity .2s ease; }
.ri-docmodal-overlay.show { opacity: 1; }
.ri-docmodal { width: min(1500px, 96vw); height: 94vh; display: flex; flex-direction: column; border-radius: 16px; overflow: hidden;
  background: var(--surface); box-shadow: var(--shadow-lg); }
.ri-docmodal-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px 14px 22px; border-bottom: 1px solid var(--line); }
.ri-docmodal-kind { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--red-soft); color: var(--red); flex: none; }
.ri-docmodal-title { margin: 0; font-size: 18px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.ri-docmodal-acts { display: flex; align-items: center; gap: 8px; flex: none; }
.ri-docmodal-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 52fr) minmax(0, 48fr); }
.ri-docmodal-pdf { background: var(--surface-2); border-right: 1px solid var(--line); min-height: 0; }
.ri-docmodal-pdf iframe { width: 100%; height: 100%; border: 0; display: block; }
.ri-docmodal-data { overflow: auto; padding: 22px 24px 32px; min-height: 0; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.ri-dm-sec { margin-bottom: 26px; }
.ri-dm-sec > h3 { margin: 0 0 10px; font-size: 16px; font-weight: 800; }
.ri-kv { display: grid; grid-template-columns: minmax(130px, 36%) minmax(0, 1fr); gap: 0; margin: 0; font-size: 14.5px; }
.ri-kv-row { display: contents; }
.ri-kv dt, .ri-kv dd { padding: 8px 0; border-bottom: 1px solid var(--line); }
.ri-kv dt { color: var(--ink-3); padding-right: 14px; }
.ri-kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.ri-kv-row:last-child dt, .ri-kv-row:last-child dd { border-bottom: 0; }
.ri-precheck { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 12px; font-size: 15px; line-height: 1.45; }
.ri-precheck svg { width: 20px; height: 20px; color: var(--tc); margin-top: 1px; }
.ri-forced { display: flex; gap: 8px; align-items: center; color: var(--warn); font-size: 14px; font-weight: 700; margin: 0 0 12px; }
.ri-forced svg { width: 18px; height: 18px; }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rtiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vhero { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .dgrid { grid-template-columns: minmax(0, 1fr); }
  .hsearch { display: none; }
}
@media (max-width: 1024px) {
  .proc { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .ri-docmodal-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: 45% 55%; }
  .ri-docmodal-pdf { border-right: 0; border-bottom: 1px solid var(--line); }
  .lhead { display: none; }
  .lrow-main { grid-template-columns: minmax(0, 1fr) 28px; row-gap: 12px; padding: 16px 4px; }
  .lmid { grid-column: 1; grid-row: 2; display: flex; align-items: center; gap: 10px; text-align: left; }
  .lmid::before { display: none; }
  .lcell-r { grid-column: 1; grid-row: 3; }
  .lexp { grid-column: 2; grid-row: 1; }
  .ldetail { margin: 0 0 16px; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); background: none; }
  .menu-btn { display: inline-grid; margin-left: -6px; }
  .side { position: fixed; top: 0; bottom: 0; left: 0; z-index: 60; height: auto; width: min(300px, 86vw); transform: translateX(-102%);
    transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  body.side-open .side { transform: none; }
  .side-overlay { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,.4); opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.side-open .side-overlay { opacity: 1; pointer-events: auto; }
  .user-name { display: none; }
  main { min-height: 0; }
  .split, .split-even { grid-template-columns: minmax(0, 1fr); gap: 20px; }
}
@media (max-width: 760px) {
  :root { --hdr-h: 60px; }
  .wrap { padding: 0 16px; }
  .util-in > span:first-child { display: none; }
  .util-in { justify-content: flex-end; }
  .hdr-in { gap: 12px; }
  .brand-name { font-size: 17px; }
  .brand-sep, .brand .tag { display: none; }
  .theme-sw span { display: none; }
  .theme-sw button { padding: 0 10px; }
  .band { padding: 22px 0 20px; }
  .band h1 { font-size: 28px; }
  .band-sub { font-size: 16px; }
  .stepper .st-l { display: none; }
  .stepper .st-current .st-l { display: inline; }
  .card { padding: 22px 18px; border-radius: 14px; }
  .kpis, .rtiles { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .card-f { flex-wrap: wrap; }
  .vhero { padding: 26px 20px; }
  .vhero h2 { font-size: 34px; }
  .amts { grid-template-columns: minmax(0, 1fr); }
  .sp-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rfilters .btn { margin-left: 0; }
  .search { max-width: none; }
  .inv { grid-template-columns: auto auto minmax(0, 1fr) auto; }
  .inv-meta { grid-column: 3; grid-row: 2; text-align: left; }
  .ri-recon .ri-sticky { min-width: 150px; max-width: 170px; }
  .ri-docmodal { height: 96vh; width: 98vw; }
  .ri-docmodal-acts .btn { display: none; }
}
@media (max-width: 440px) { .theme-sw { display: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
  .spin { border-right-color: var(--red); }
}

/* ── Erisa's mockup v2: invoice check, controls, billing by invoice ────────── */
:root { --cat1: #1F1F1F; --cat2: #5C5C5C; --cat3: #939393; --cat4: #C8C8C8; --cum: #DA291C; }
:root[data-theme="dark"] { --cat1: #F2F2F2; --cat2: #B3B3B3; --cat3: #7A7A7A; --cat4: #4D4D4D; --cum: #F2463A; }
.c1 { --cc: var(--cat1); } .c2 { --cc: var(--cat2); } .c3 { --cc: var(--cat3); } .c4 { --cc: var(--cat4); }
.tone-neutral { --tc: var(--ink-3); --ts: var(--surface-2); }
/* Controls list */
.ctl { list-style: none; margin: 0; padding: 0; }
.ctl li { display: grid; grid-template-columns: 32px minmax(150px, 220px) 124px minmax(0, 1fr); gap: 14px; align-items: start;
  padding: 14px 4px; border-bottom: 1px solid var(--line); }
.ctl li:last-child { border-bottom: 0; }
.ctl-i { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--ts); color: var(--tc); }
.ctl-i svg { width: 17px; height: 17px; }
.ctl-n { font-weight: 800; padding-top: 4px; }
.ctl-r { padding-top: 2px; }
.ctl-d { margin: 0; padding-top: 4px; color: var(--ink-2); font-size: 14.5px; max-width: 80ch; }
/* Controls across invoices (matrix) */
.mx { width: 100%; border-collapse: collapse; font-size: 14px; }
.mx th, .mx td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: center; }
.mx tbody tr:last-child th, .mx tbody tr:last-child td { border-bottom: 0; }
.mx th:first-child { text-align: left; font-weight: 600; white-space: nowrap; }
.mx thead th { font-size: 12.5px; color: var(--ink-3); font-weight: 700; white-space: nowrap; }
.mx thead button { all: unset; cursor: pointer; }
.mx thead button:hover { color: var(--ink); text-decoration: underline; }
.dotr { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--ts); color: var(--tc); cursor: help; }
.dotr svg { width: 15px; height: 15px; }
.mx-key { margin: 14px 0 0; }
.legend .sw { width: 11px; height: 11px; border-radius: 3px; background: var(--tc); }
.legend .c1 .sw, .legend .c2 .sw, .legend .c3 .sw, .legend .c4 .sw { background: var(--cc); }
.legend .sw-line { height: 3px; border-radius: 2px; background: var(--cum); }
/* Billing by invoice (stacked columns + billed to date) */
.chart .s-c1 { fill: var(--cat1); } .chart .s-c2 { fill: var(--cat2); } .chart .s-c3 { fill: var(--cat3); } .chart .s-c4 { fill: var(--cat4); }
.chart .cum { fill: none; stroke: var(--cum); stroke-width: 2.5; }
.chart .cum-dot { fill: var(--surface); stroke: var(--cum); stroke-width: 2.5; }
.chart .cum-t { fill: var(--cum); font-weight: 800; font-size: 12px; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.chart .sub { font-size: 11px; font-weight: 500; }
/* Billing against the PO for one invoice: donut by PO line, bars before / this invoice / above */
.sp-grid { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.5fr); gap: 44px; align-items: start; }
.sp-h { font-size: 16px; font-weight: 800; margin: 0 0 16px; }
.sp-mix { display: grid; gap: 20px; justify-items: center; }
.donut .seg-cat { stroke: var(--cc); }
.donut-sp .ctr { font-size: 22px; }
.sp-leg { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; width: 100%; }
.sp-leg li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 14.5px; font-weight: 600; }
.sp-leg .sw { width: 11px; height: 11px; border-radius: 3px; background: var(--cc); }
.sp-leg .amt { text-align: right; font-variant-numeric: tabular-nums; }
.sp-leg .amt small { display: block; color: var(--ink-3); font-size: 12.5px; font-weight: 600; }
.sb-before { position: absolute; inset: 0 auto 0 0; border-radius: 5px 0 0 5px; background: var(--cat3); }
.sb-this { position: absolute; top: 0; bottom: 0; background: var(--ink); }
.k-before { width: 20px; height: 10px; border-radius: 3px; background: var(--cat3); }
.k-this { width: 20px; height: 10px; border-radius: 3px; background: var(--ink); }
.bar-2 { display: flex; }
.bar-2 span { display: block; height: 100%; border-radius: 0; }
.bar-2 .b-before { background: rgba(255,255,255,.5); }
.bar-2 .b-this { background: var(--tc); }
/* Progress claims of a PO line in the invoice */
.claims { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: 14.5px; max-width: 280px; }
.claims li { display: flex; justify-content: space-between; gap: 16px; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.claims .claims-t { color: var(--ink); font-weight: 800; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }
.mk-warn { color: var(--warn); }
/* Invoice check: invoice list and sub-view */
.ri-inv-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.ri-inv-check > * + * { margin-top: 20px; }
.ri-inv-check .vhero h2 { font-size: 36px; }
.ri-ctl-sum { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.ri-ctl-sum .dotr { width: 22px; height: 22px; cursor: default; }
.ri-ctl-sum .dotr svg { width: 13px; height: 13px; }
/* Dashboard: controls across invoices (stacked bars per control) */
.cbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.cb-top { display: flex; justify-content: space-between; gap: 12px; font-size: 14.5px; font-weight: 600; margin-bottom: 6px; }
.cb-top span:last-child { color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cb-track { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.cb-track span { display: block; height: 100%; }
.cb-track .is-ok { background: var(--ok); } .cb-track .is-warn { background: var(--warn); } .cb-track .is-bad { background: var(--bad); }
.cb-track .is-na { background: var(--line-2); }
@media (max-width: 1180px) {
  .sp-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .sp-mix { grid-template-columns: auto minmax(0, 1fr); justify-items: start; align-items: center; gap: 28px; }
}
@media (max-width: 760px) {
  .ctl li { grid-template-columns: 32px minmax(0, 1fr); row-gap: 6px; }
  .ctl-r, .ctl-d { grid-column: 2; }
  .sp-mix { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .ri-inv-check .vhero h2 { font-size: 30px; }
}
.dgrid-even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.mx-wrap { position: relative; overflow-x: auto; scrollbar-width: thin; }
@media (max-width: 1180px) { .dgrid-even { grid-template-columns: minmax(0, 1fr); } }
.ri-inv-bar .link { display: inline-flex; align-items: center; gap: 4px; }
.ri-inv-bar .link svg, .ri-inv-bar .btn svg { width: 16px; height: 16px; }
