/* Britannia Direct Payout — design system.
   Warm porcelain ground, ink actions, Britannia red only for the brand. Status colour carries meaning, never decoration. */
:root {
  --bg: #F6F5F2;
  --surface: #FFFFFF;
  --surface-2: #FAF9F7;
  --sunken: #F1EFEB;
  --ink: #17171A;
  --ink-2: #3D3D44;
  --muted: #6D6D76;
  --faint: #9C9CA5;
  --line: #E8E5E0;
  --line-2: #D9D5CE;
  --brand: #C8102E;
  --brand-2: #A30D25;
  --brand-wash: #FCF1F2;
  --ok: #1F7A45;   --ok-wash: #EEF7F1;   --ok-line: #CBE6D5;
  --warn: #A15C07; --warn-wash: #FDF6EA; --warn-line: #F0DDBA;
  --bad: #B42318;  --bad-wash: #FDF1EF;  --bad-line: #F3CFC9;
  --run: #2F5D8A;  --run-wash: #EFF4F9;  --run-line: #D3E0EC;
  --chart-a: #17171A; --chart-b: #1F7A45; --chart-c: #C9A227; --chart-d: #B42318;
  --sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Newsreader', 'Iowan Old Style', Georgia, serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --r-sm: 6px; --r: 9px; --r-lg: 14px;
  --sh-1: 0 1px 2px rgb(23 23 26 / 0.04), 0 0 0 1px rgb(23 23 26 / 0.06);
  --sh-2: 0 6px 24px -12px rgb(23 23 26 / 0.18), 0 0 0 1px rgb(23 23 26 / 0.06);
  --sh-3: 0 24px 64px -24px rgb(23 23 26 / 0.35), 0 0 0 1px rgb(23 23 26 / 0.08);
  --ring: 0 0 0 2px var(--surface), 0 0 0 4px rgb(23 23 26 / 0.55);
  --ease: 150ms cubic-bezier(.2, .7, .2, 1);
  --rail: 240px;
  --gutter: 32px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 14px/1.5 var(--sans); letter-spacing: -0.006em; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure, fieldset { margin: 0; }
ul, ol { padding: 0; list-style: none; }
fieldset { border: 0; padding: 0; min-width: 0; }
img, svg, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
:focus { outline: none; }
:focus-visible { box-shadow: var(--ring); border-radius: var(--r-sm); }
::selection { background: #F3D9DC; }
.vh { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.mono { font-family: var(--mono); font-size: 0.92em; letter-spacing: 0; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.ico { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.ico-lg { width: 20px; height: 20px; }
.ico-xl { width: 28px; height: 28px; }

/* ---------------------------------------------------------------- app shell */
.app { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.rail { position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding: 18px 14px 14px; background: var(--surface-2); border-right: 1px solid var(--line); z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; text-decoration: none; }
.brand img { height: 26px; width: auto; }
.brand-name { display: grid; line-height: 1.15; }
.brand-name b { font-size: 13px; font-weight: 650; letter-spacing: -0.01em; }
.brand-name span { font-size: 11px; color: var(--muted); letter-spacing: 0.02em; }
.nav-group { padding-top: 10px; }
.nav-group > p { padding: 6px 10px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--faint); }
.nav a { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: var(--r-sm); color: var(--ink-2); text-decoration: none; font-size: 13.5px; font-weight: 500; transition: background var(--ease), color var(--ease); }
.nav a:hover { background: var(--sunken); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); font-weight: 600; }
.nav a[aria-current="page"] .ico { color: var(--brand); }
.nav a .ico { color: var(--muted); }
.nav .count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: inline-grid; place-items: center; font-size: 11px; font-weight: 650; background: var(--sunken); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.nav .count.hot { background: var(--bad-wash); color: var(--bad); }
.rail-foot { margin-top: auto; padding: 12px 10px 2px; font-size: 11.5px; color: var(--faint); display: flex; justify-content: space-between; gap: 8px; }
.mode-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; background: var(--warn-wash); color: var(--warn); }
.mode-chip.live { background: var(--ok-wash); color: var(--ok); }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 var(--gutter); background: rgb(246 245 242 / 0.86); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; color: var(--muted); }
.crumbs a { text-decoration: none; color: var(--muted); }
.crumbs a:hover { color: var(--ink); }
.crumbs b { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-tools { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.gsearch { position: relative; width: 300px; }
.gsearch .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.gsearch input { width: 100%; height: 36px; padding: 0 12px 0 34px; border-radius: var(--r); border: 0; background: var(--surface); box-shadow: var(--sh-1); font-size: 13.5px; }
.gsearch input:focus { box-shadow: var(--ring); }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: var(--r); background: none; color: var(--ink-2); cursor: pointer; transition: background var(--ease); }
.icon-btn:hover { background: var(--sunken); color: var(--ink); }
.icon-btn .dot { position: absolute; top: 7px; right: 7px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--brand); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--bg); }
.who { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 8px 0 4px; border: 0; border-radius: var(--r); background: none; cursor: pointer; text-align: left; }
.who:hover { background: var(--sunken); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: #fff; font-size: 11.5px; font-weight: 650; letter-spacing: 0.02em; }
.who-text { display: grid; line-height: 1.2; }
.who-text b { font-size: 13px; font-weight: 600; }
.who-text span { font-size: 11.5px; color: var(--muted); }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; padding: 6px; border-radius: var(--r); background: var(--surface); box-shadow: var(--sh-3); z-index: 50; }
.menu a, .menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: var(--r-sm); background: none; text-align: left; text-decoration: none; font-size: 13.5px; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--sunken); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.menu-head { padding: 8px 10px; }
.rail-toggle { display: none; }
.content { width: 100%; max-width: 1440px; margin: 0 auto; padding: 28px var(--gutter) 64px; }
.content.narrow { max-width: 920px; }
.scrim { display: none; }

/* ---------------------------------------------------------------- page head */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head .eyebrow { margin-bottom: 6px; }
.title { font-family: var(--display); font-size: 30px; line-height: 1.12; font-weight: 500; letter-spacing: -0.02em; }
.sub { margin-top: 6px; color: var(--muted); font-size: 14px; max-width: 760px; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 30px 0 12px; }
.section-title h2 { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }

/* ---------------------------------------------------------------- buttons, inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border: 0; border-radius: var(--r); background: none; font-size: 13.5px; font-weight: 600; line-height: 1; white-space: nowrap; text-decoration: none; cursor: pointer; transition: background var(--ease), box-shadow var(--ease), color var(--ease), transform var(--ease); }
.btn:active { transform: translateY(0.5px); }
.btn-primary { background: var(--ink); color: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / 0.18), inset 0 1px 0 rgb(255 255 255 / 0.08); }
.btn-primary:hover { background: #2C2C31; }
.btn-brand { background: var(--brand); color: #fff; box-shadow: 0 1px 2px rgb(163 13 37 / 0.3); }
.btn-brand:hover { background: var(--brand-2); }
.btn-secondary { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }
.btn-secondary:hover { background: var(--surface-2); box-shadow: 0 1px 2px rgb(23 23 26 / 0.05), 0 0 0 1px rgb(23 23 26 / 0.12); }
.btn-ghost { color: var(--ink-2); padding: 0 10px; }
.btn-ghost:hover { background: var(--sunken); color: var(--ink); }
.btn-danger { background: var(--surface); color: var(--bad); box-shadow: 0 0 0 1px var(--bad-line); }
.btn-danger:hover { background: var(--bad-wash); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn-lg { height: 44px; padding: 0 18px; font-size: 14.5px; }
.btn-xl { height: 52px; padding: 0 22px; font-size: 15.5px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn .spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.link { color: var(--ink); font-weight: 500; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; text-decoration-thickness: 1px; background: none; border: 0; padding: 0; cursor: pointer; }
.link:hover { text-decoration-color: var(--ink); }

.input { width: 100%; height: 38px; padding: 0 12px; border: 0; border-radius: var(--r); background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); font-size: 14px; transition: box-shadow var(--ease); }
.input:hover { box-shadow: inset 0 0 0 1px #BDB8AF; }
.input:focus { box-shadow: inset 0 0 0 1.5px var(--ink), 0 0 0 4px rgb(23 23 26 / 0.06); }
.input[aria-invalid="true"] { box-shadow: inset 0 0 0 1.5px var(--bad); }
.input[readonly], .input:disabled { background: var(--surface-2); color: var(--ink-2); }
textarea.input { height: auto; min-height: 84px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
select.input { appearance: none; padding-right: 34px; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%236D6D76' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input-lg { height: 48px; font-size: 15.5px; padding: 0 14px; border-radius: 11px; }
.fld { display: grid; gap: 6px; }
.fld > .lbl { font-size: 13px; font-weight: 550; color: var(--ink); display: flex; justify-content: space-between; gap: 8px; }
.fld > .lbl .opt { font-weight: 400; color: var(--faint); }
.fld .help { font-size: 12.5px; color: var(--muted); }
.fld .ferr { font-size: 12.5px; color: var(--bad); font-weight: 550; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: var(--r); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--ink); flex: none; }
.radio-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.radio-card { position: relative; display: grid; gap: 3px; padding: 14px; border-radius: var(--r); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-2); cursor: pointer; }
.radio-card input { position: absolute; opacity: 0; }
.radio-card b { font-size: 13.5px; }
.radio-card span { font-size: 12.5px; color: var(--muted); }
.radio-card:has(input:checked) { box-shadow: inset 0 0 0 2px var(--ink); background: var(--surface-2); }
.radio-card:has(input:focus-visible) { box-shadow: inset 0 0 0 2px var(--ink), var(--ring); }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filters .input { width: auto; min-width: 150px; height: 34px; font-size: 13px; }
.search { position: relative; flex: 1 1 260px; max-width: 360px; }
.search .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search .input { padding-left: 34px; width: 100%; height: 34px; font-size: 13px; }

/* ---------------------------------------------------------------- surfaces */
.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-1); }
.card-pad { padding: 22px 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { font-size: 14.5px; font-weight: 650; letter-spacing: -0.01em; }
.card-body { padding: 18px 22px; }
.card-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.split-wide { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-content: start; }
.sticky { position: sticky; top: 84px; }
.kv { display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: 9px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.note { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); font-size: 13.5px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.note .ico { margin-top: 2px; }
.note-warn { background: var(--warn-wash); box-shadow: inset 0 0 0 1px var(--warn-line); color: #6E3F05; }
.note-bad { background: var(--bad-wash); box-shadow: inset 0 0 0 1px var(--bad-line); color: #7A1B12; }
.note-ok { background: var(--ok-wash); box-shadow: inset 0 0 0 1px var(--ok-line); color: #165B33; }
.note-run { background: var(--run-wash); box-shadow: inset 0 0 0 1px var(--run-line); color: #23476B; }
.note ul { list-style: disc; padding-left: 18px; margin-top: 4px; }
.note b { font-weight: 650; }

/* ---------------------------------------------------------------- KPIs and charts */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi { position: relative; display: grid; gap: 6px; padding: 18px 20px; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-1); text-decoration: none; transition: box-shadow var(--ease), transform var(--ease); }
a.kpi:hover { box-shadow: var(--sh-2); transform: translateY(-1px); }
.kpi .k-label { font-size: 12.5px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi .k-value { font-family: var(--display); font-size: 30px; line-height: 1.05; letter-spacing: -0.02em; font-variant-numeric: tabular-nums lining-nums; }
.kpi .k-sub { font-size: 12.5px; color: var(--muted); }
.kpi .k-tone { position: absolute; left: 0; top: 18px; bottom: 18px; width: 3px; border-radius: 0 3px 3px 0; }
.tone-ok { background: var(--ok); } .tone-warn { background: var(--warn); } .tone-bad { background: var(--bad); } .tone-run { background: var(--run); } .tone-brand { background: var(--brand); }
.hero { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; margin-bottom: 14px; }
.money-card { padding: 24px 26px; background: var(--ink); color: #fff; border-radius: var(--r-lg); box-shadow: var(--sh-2); display: grid; gap: 18px; }
.money-card .eyebrow { color: rgb(255 255 255 / 0.6); }
.money-card .big { font-family: var(--display); font-size: 44px; line-height: 1; letter-spacing: -0.025em; font-variant-numeric: tabular-nums lining-nums; }
.money-card .split-bar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: rgb(255 255 255 / 0.12); }
.money-card .split-bar span { display: block; height: 100%; }
.money-card .legend { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.money-card .legend div { display: grid; gap: 2px; }
.money-card .legend b { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.money-card .legend span { font-size: 12px; color: rgb(255 255 255 / 0.62); display: flex; align-items: center; gap: 6px; }
.swatch { width: 8px; height: 8px; border-radius: 2px; display: inline-block; flex: none; }
.funnel { display: grid; gap: 10px; }
.funnel-row { display: grid; grid-template-columns: 170px minmax(0, 1fr) 110px; gap: 12px; align-items: center; font-size: 13px; text-decoration: none; }
.funnel-row:hover .f-bar span { filter: brightness(1.08); }
.f-bar { height: 22px; background: var(--sunken); border-radius: 5px; overflow: hidden; }
.f-bar span { display: block; height: 100%; border-radius: 5px; min-width: 2px; }
.bars { display: grid; gap: 14px; }
.bar-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) 150px; gap: 14px; align-items: center; font-size: 13px; }
.bar-track { position: relative; height: 18px; background: var(--sunken); border-radius: 4px; overflow: hidden; }
.bar-track span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; }
.bar-claimed { background: #CFCAC2; }
.bar-released { background: var(--ok); }
.legend-inline { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); align-items: center; flex-wrap: wrap; }
.legend-inline span { display: inline-flex; align-items: center; gap: 6px; }
.health { display: flex; gap: 10px; flex-wrap: wrap; }
.health a { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 99px; background: var(--surface); box-shadow: var(--sh-1); font-size: 13px; text-decoration: none; }
.health a.bad { box-shadow: inset 0 0 0 1px var(--bad-line); background: var(--bad-wash); color: var(--bad); }
.health a.warn { box-shadow: inset 0 0 0 1px var(--warn-line); background: var(--warn-wash); color: var(--warn); }

/* ---------------------------------------------------------------- section tabs (pages sharing one rail entry) */
.subnav { display: flex; gap: 24px; margin: -6px 0 22px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.subnav a { display: inline-flex; align-items: center; gap: 7px; padding: 10px 0 11px; margin-bottom: -1px; border-bottom: 2px solid transparent; font-size: 13.5px; font-weight: 550; color: var(--muted); text-decoration: none; white-space: nowrap; transition: color var(--ease), border-color var(--ease); }
.subnav a:hover { color: var(--ink); }
.subnav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--brand); }
.subnav .count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: inline-grid; place-items: center; font-size: 10.5px; font-weight: 650; background: var(--bad-wash); color: var(--bad); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- tabs, pills */
.tabs { display: flex; gap: 2px; padding: 3px; background: var(--sunken); border-radius: 11px; margin-bottom: 16px; width: max-content; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: 8px; font-size: 13px; font-weight: 550; color: var(--ink-2); text-decoration: none; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }
.tabs .c { font-size: 11.5px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--sunken); color: var(--ink-2); }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.pill.ok { background: var(--ok-wash); color: var(--ok); }
.pill.warn { background: var(--warn-wash); color: var(--warn); }
.pill.bad { background: var(--bad-wash); color: var(--bad); }
.pill.run { background: var(--run-wash); color: var(--run); }
.pill.dim { background: var(--sunken); color: var(--faint); }
.pill.plain::before { display: none; }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11.5px; font-weight: 600; background: var(--sunken); color: var(--ink-2); white-space: nowrap; }

/* ---------------------------------------------------------------- tables */
.table-card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-1); overflow: hidden; }
.tbl-scroll { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.tbl th { position: sticky; top: 0; z-index: 1; padding: 10px 14px; background: var(--surface-2); color: var(--muted); font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tbody tr[data-href] { cursor: pointer; }
.tbl tbody tr[data-href]:hover td { background: var(--surface-2); }
.tbl tbody tr[data-href]:focus-visible td { background: var(--surface-2); }
.tbl tbody tr.sel td { background: #FBF7F0; }
.tbl .primary { font-weight: 600; color: var(--ink); }
.tbl .sub { display: block; margin-top: 1px; font-size: 12px; color: var(--muted); font-weight: 400; }
.tbl .chk { width: 40px; }
.tbl .chk input { width: 16px; height: 16px; accent-color: var(--ink); }
.tbl tfoot td { background: var(--surface-2); font-weight: 650; border-top: 1px solid var(--line); border-bottom: 0; }
.tbl-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--surface-2); font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.pager { display: flex; align-items: center; gap: 6px; }
.empty { padding: 56px 24px; text-align: center; display: grid; justify-items: center; gap: 8px; color: var(--muted); }
.empty .ico { width: 28px; height: 28px; color: var(--faint); }
.empty b { color: var(--ink); font-size: 14.5px; }
.bulkbar { position: sticky; bottom: 18px; z-index: 15; display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 14px; padding: 12px 16px; border-radius: 12px; background: var(--ink); color: #fff; box-shadow: var(--sh-3); flex-wrap: wrap; }
.bulkbar .btn-secondary { box-shadow: none; }

/* ---------------------------------------------------------------- timeline, steps */
.timeline { display: grid; gap: 0; }
.tl { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; position: relative; padding-bottom: 16px; }
.tl:last-child { padding-bottom: 0; }
.tl::before { content: ''; position: absolute; left: 10px; top: 22px; bottom: 0; width: 1.5px; background: var(--line); }
.tl:last-child::before { display: none; }
.tl-dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--sunken); color: var(--muted); }
.tl-dot .ico { width: 13px; height: 13px; }
.tl.done .tl-dot { background: var(--ink); color: #fff; }
.tl.now .tl-dot { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.tl.bad .tl-dot { background: var(--bad); color: #fff; }
.tl.warn .tl-dot { background: var(--warn); color: #fff; }
.tl-body b { font-size: 13.5px; font-weight: 600; display: block; }
.tl-body span { font-size: 12.5px; color: var(--muted); }
.steps { display: flex; gap: 6px; margin-bottom: 22px; }
.step { flex: 1; display: grid; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 550; }
.step i { display: block; height: 4px; border-radius: 2px; background: var(--line-2); }
.step.done i, .step.now i { background: var(--ink); }
.step.now { color: var(--ink); }
.log { display: grid; gap: 0; }
.log-row { display: grid; grid-template-columns: 136px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.log-row:last-child { border-bottom: 0; }
.log-row time { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- documents */
.docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.doc { display: grid; grid-template-rows: auto 1fr; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-1); overflow: hidden; }
.doc-img { position: relative; height: 150px; background: var(--sunken) center / cover no-repeat; border-bottom: 1px solid var(--line); cursor: zoom-in; }
.doc-img .pill { position: absolute; top: 10px; left: 10px; }
.doc-img.empty-slot { display: grid; place-items: center; cursor: pointer; color: var(--muted); font-size: 13px; }
.doc-body { padding: 12px 14px; display: grid; gap: 8px; align-content: start; }
.doc-body h4 { font-size: 13.5px; font-weight: 650; }
.ocr { display: grid; gap: 5px; font-size: 12.5px; }
.ocr-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 8px; align-items: baseline; }
.ocr-row .k { color: var(--muted); }
.ocr-row .v { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.conf { font-size: 11px; font-weight: 650; padding: 1px 6px; border-radius: 4px; background: var(--sunken); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.conf.hi { background: var(--ok-wash); color: var(--ok); } .conf.mid { background: var(--warn-wash); color: var(--warn); } .conf.lo { background: var(--bad-wash); color: var(--bad); }
.match { font-size: 11.5px; font-weight: 600; }
.match.yes { color: var(--ok); } .match.no { color: var(--bad); }
.upload-slot { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--sh-1); }
.upload-slot .thumb { width: 56px; height: 56px; border-radius: 10px; background: var(--sunken) center / cover; display: grid; place-items: center; color: var(--faint); }
.upload-slot.done .thumb { box-shadow: inset 0 0 0 2px var(--ok-line); }
.upload-slot.rejected { box-shadow: inset 0 0 0 1.5px var(--bad-line), var(--sh-1); }
.upload-list { display: grid; gap: 10px; }

/* ---------------------------------------------------------------- invoice paper (HTML rendering of the draft) */
.paper { background: #fff; border-radius: 6px; box-shadow: var(--sh-2); padding: 34px 36px; font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif; color: #1F2836; font-size: 12px; line-height: 1.45; position: relative; overflow: hidden; }
.paper .watermark { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; font: 700 54px/1 Arial, sans-serif; color: rgb(200 16 46 / 0.08); transform: rotate(-24deg); letter-spacing: 0.04em; }
.paper h3 { font: 700 22px/1.1 Arial, sans-serif; color: #1D3A89; letter-spacing: 0; margin-bottom: 14px; }
.paper .p-grid { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid #C9CED6; margin: 14px 0; }
.paper .p-grid > div { padding: 10px 12px; }
.paper .p-grid > div + div { border-left: 1px solid #C9CED6; }
.paper .p-band { background: #E4E6EB; font-weight: 700; padding: 6px 12px; }
.paper table { width: 100%; border-collapse: collapse; margin: 12px 0; }
.paper th { background: #1D3A89; color: #fff; padding: 8px 6px; font-size: 11px; text-align: center; font-weight: 700; }
.paper td { border: 1px solid #D5DDE7; padding: 8px 6px; font-size: 11.5px; }
.paper td.r { text-align: right; font-variant-numeric: tabular-nums; }
.paper .words { border: 1px solid #C9CED6; background: #F9F9FB; padding: 8px 12px; font-weight: 700; }
.paper .foot { display: grid; grid-template-columns: 1fr 200px; gap: 18px; margin-top: 16px; align-items: end; }
.paper .sign { text-align: center; }
.paper .sign canvas, .paper .sign svg { margin: 6px auto; height: 52px; width: 170px; }
.paper.navy h3 { color: #1A365D; }
.paper.navy th { background: #1A365D; }
.paper .legal { font-style: italic; color: #708095; font-size: 11px; margin-bottom: 12px; }
.paper-scroll { overflow-x: auto; }
.paper-scroll .paper { min-width: 640px; }
/* On a phone the draft reflows (one column, tighter table) so the partner reads it without sideways scrolling before signing.
   The PDF keeps the exact template layout. */
@media (max-width: 600px) {
  .paper-scroll .paper { min-width: 0; padding: 20px 14px; overflow-wrap: anywhere; }
  .paper h3 { font-size: 18px; }
  .paper .p-grid { grid-template-columns: minmax(0, 1fr); }
  .paper .p-grid > div + div { border-left: 0; border-top: 1px solid #C9CED6; }
  .paper th, .paper td { padding: 6px 4px; font-size: 10.5px; }
  .paper table { overflow-wrap: normal; }
  .paper .foot { grid-template-columns: minmax(0, 1fr); }
  .paper .watermark { font-size: 40px; }
}

/* ---------------------------------------------------------------- modal, sheet, toast */
.layer { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.layer-scrim { position: absolute; inset: 0; background: rgb(23 23 26 / 0.42); animation: fade 140ms ease-out; }
.modal { position: relative; width: min(560px, 100%); max-height: calc(100dvh - 40px); display: flex; flex-direction: column; background: var(--surface); border-radius: 16px; box-shadow: var(--sh-3); animation: pop 160ms cubic-bezier(.2, .9, .3, 1.1); }
.modal.wide { width: min(880px, 100%); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 4px; }
.modal-head h2 { font-family: var(--display); font-size: 22px; font-weight: 500; letter-spacing: -0.015em; line-height: 1.2; }
.modal-body { padding: 12px 22px 18px; overflow-y: auto; display: grid; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 16px 16px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.985); } }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 120; display: grid; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 420px; padding: 12px 14px; border-radius: 11px; background: var(--ink); color: #fff; box-shadow: var(--sh-3); font-size: 13.5px; animation: pop 160ms ease-out; }
.toast.bad { background: var(--bad); }
.confirm-amount { display: grid; gap: 4px; padding: 16px; border-radius: var(--r); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.confirm-amount b { font-family: var(--display); font-size: 30px; font-weight: 500; letter-spacing: -0.02em; }
.viewer { width: min(1000px, 100%); max-height: calc(100dvh - 40px); }
.viewer img { max-height: calc(100dvh - 140px); margin: 0 auto; border-radius: 8px; }

/* ---------------------------------------------------------------- skeleton, states */
.skel { display: block; height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--sunken) 25%, #ECE9E4 50%, var(--sunken) 75%); background-size: 200% 100%; animation: sk 1.2s ease-in-out infinite; }
@keyframes sk { to { background-position: -200% 0; } }
.state-page { min-height: 70vh; display: grid; place-items: center; padding: 24px; }
.state-card { width: min(460px, 100%); text-align: center; display: grid; gap: 12px; justify-items: center; padding: 36px 30px; background: var(--surface); border-radius: 18px; box-shadow: var(--sh-2); }
.state-icon { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: var(--sunken); color: var(--ink-2); }
.state-icon.bad { background: var(--bad-wash); color: var(--bad); } .state-icon.ok { background: var(--ok-wash); color: var(--ok); } .state-icon.warn { background: var(--warn-wash); color: var(--warn); }

/* ---------------------------------------------------------------- auth */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-art { position: relative; background: var(--ink); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
.auth-art::after { content: ''; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, rgb(200 16 46 / 0.55), rgb(200 16 46 / 0) 70%); }
.auth-art h1 { font-family: var(--display); font-size: 44px; font-weight: 400; line-height: 1.08; letter-spacing: -0.025em; max-width: 480px; }
.auth-art p { color: rgb(255 255 255 / 0.66); max-width: 440px; margin-top: 14px; font-size: 15px; }
.auth-points { display: grid; gap: 12px; position: relative; z-index: 1; }
.auth-points li { display: flex; gap: 10px; align-items: center; color: rgb(255 255 255 / 0.82); font-size: 14px; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-box { width: min(380px, 100%); display: grid; gap: 18px; }
.auth-box .brand img { height: 32px; }
.demo-box { padding: 14px; border-radius: var(--r); background: var(--surface); box-shadow: var(--sh-1); font-size: 13px; }
.demo-box summary { cursor: pointer; font-weight: 600; }
.demo-box table { width: 100%; margin-top: 10px; border-collapse: collapse; }
.demo-box td { padding: 6px 4px; border-top: 1px solid var(--line); }

/* ---------------------------------------------------------------- partner-facing pages (claim, invoice, registration) */
.pp { min-height: 100vh; min-height: 100dvh; background: var(--bg); }
.pp-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.pp-top img { height: 26px; }
.pp-top .secure { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 550; }
.pp-main { width: min(720px, 100%); margin: 0 auto; padding: 24px 18px 80px; display: grid; gap: 16px; }
.pp-amount { padding: 24px; border-radius: 18px; background: var(--ink); color: #fff; display: grid; gap: 6px; }
.pp-amount .eyebrow { color: rgb(255 255 255 / 0.62); }
.pp-amount b { font-family: var(--display); font-size: 46px; font-weight: 400; line-height: 1; letter-spacing: -0.025em; font-variant-numeric: tabular-nums lining-nums; }
.pp-amount span { color: rgb(255 255 255 / 0.72); font-size: 14px; }
.pp-card { padding: 20px; border-radius: 16px; background: var(--surface); box-shadow: var(--sh-1); display: grid; gap: 14px; }
.pp-card h2 { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.code-boxes { display: flex; gap: 8px; }
.code-boxes input { width: 48px; height: 56px; text-align: center; font: 600 22px var(--mono); border-radius: 11px; border: 0; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line-2); }
.code-boxes input:focus { box-shadow: inset 0 0 0 2px var(--ink); }
.sig-pad { position: relative; height: 190px; border-radius: 14px; background: var(--surface-2); box-shadow: inset 0 0 0 1.5px var(--line-2); touch-action: none; }
.sig-pad canvas { width: 100%; height: 100%; cursor: crosshair; }
.sig-pad .sig-line { position: absolute; left: 24px; right: 24px; bottom: 44px; border-top: 1.5px dashed var(--line-2); pointer-events: none; }
.sig-pad .sig-hint { position: absolute; left: 24px; bottom: 18px; font-size: 12px; color: var(--faint); pointer-events: none; }
.progress-steps { display: grid; gap: 0; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1180px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .split { grid-template-columns: minmax(0, 1fr); } .split-wide { grid-template-columns: minmax(0, 1fr); } .hero { grid-template-columns: minmax(0, 1fr); } .sticky { position: static; } }
@media (max-width: 920px) {
  :root { --gutter: 18px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; left: 0; top: 0; bottom: 0; width: 272px; transform: translateX(-102%); transition: transform 200ms ease; box-shadow: var(--sh-3); }
  .app.rail-open .rail { transform: none; }
  .app.rail-open .scrim { display: block; position: fixed; inset: 0; background: rgb(23 23 26 / 0.35); z-index: 25; }
  .rail-toggle { display: inline-grid; }
  .gsearch { display: none; }
  .who-text { display: none; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .bar-row { grid-template-columns: 110px minmax(0, 1fr); }
  .bar-row > :last-child { grid-column: 2; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { display: none; }
}
@media (max-width: 640px) {
  .content { padding: 20px 16px 56px; }
  .top { padding: 0 12px; height: 56px; }
  .title { font-size: 25px; }
  .kpis { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .kpi { padding: 14px 15px; }
  .kpi .k-value { font-size: 24px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .radio-cards { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .kv dt { margin-top: 8px; }
  .money-card .legend { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .money-card .big { font-size: 34px; }
  .funnel-row { grid-template-columns: 1fr 90px; }
  .funnel-row .f-bar { grid-column: 1 / -1; grid-row: 2; }
  .page-head { align-items: flex-start; }
  .actions { width: 100%; }
  /* tables become cards on phones */
  .tbl.cards thead { display: none; }
  .tbl.cards, .tbl.cards tbody, .tbl.cards tr, .tbl.cards td { display: block; width: 100%; }
  .tbl.cards tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .tbl.cards td { padding: 3px 0; border: 0; text-align: left !important; }
  .tbl.cards td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
  .tbl.cards td.chk::before { display: none; }
  .code-boxes input { width: 44px; height: 52px; }
  .filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .filters .search { grid-column: 1 / -1; max-width: none; }
  .filters .input { min-width: 0; width: 100%; }
  .filters .btn { justify-self: start; }
  .health a { font-size: 12.5px; }
  .pp-amount b { font-size: 38px; }
  .log-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .ocr-row { grid-template-columns: 84px minmax(0, 1fr) auto; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; } }
@media print { .rail, .top, .actions, .bulkbar { display: none !important; } .app { grid-template-columns: 1fr; } }

/* JSON payloads (webhooks) */
.json-box { margin: 0; padding: 12px 14px; border-radius: 10px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); font: 12px/1.55 var(--mono); white-space: pre; overflow: auto; max-height: 420px; }
