/* The licence admin's ONE stylesheet (#565): variant F "Desk" (prototypes/admin-dashboard/src/
   variants/f-desk/style.css, itself A "Atelier"'s), ported to the server's markup. Porcelain & Lapis
   (light) / Midnight Lapis (dark): lapis carries structure and action; pyrite gold marks what is "not
   cash yet / not seen again" — withholding and the shown-once key.

   SOURCE, not what is served: `npm run assets` (scripts/build-admin-assets.ts) rewrites each font
   reference (fonts/…) to its content-hashed path and writes the result under static/assets/ (served at the public /assets/ path, #609).

   Themes: `<html data-theme="system|light|dark">`, from the theme cookie (src/admin/Layout.tsx).
   Light is the default (and "system" on a light OS). Every dark rule lives in the ONE region between
   the `@dark` markers at the end of this file, written against `:root[data-theme='dark']`; the build
   repeats that region inside `@media (prefers-color-scheme: dark)` for `:root[data-theme='system']`,
   so "system" follows the OS with no script and the two can never drift. */

/* ── fonts: self-hosted, SIL OFL 1.1 (licences in fonts/LICENSES/, served beside them) ───────── */
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(/assets/fonts/Geist-Variable.a369fcf5.woff2) format('woff2');
}
@font-face {
  font-family: 'Geist Mono';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(/assets/fonts/GeistMono-Variable.fba8f577.woff2) format('woff2');
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/assets/fonts/InstrumentSerif-Regular-latin.5eb09b5a.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/assets/fonts/InstrumentSerif-Regular-latin-ext.290e6267.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(/assets/fonts/InstrumentSerif-Italic-latin.5a51946d.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(/assets/fonts/InstrumentSerif-Italic-latin-ext.d0014821.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}


/* ── tokens ─────────────────────────────────────────────────────────────────────────────────── */
:root {
  --font-ui: 'Geist', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --font-display: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  --sidebar-w: 252px;
  --rail-w: 72px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --r-xs: 6px;
  --r-sm: 9px;
  --r-md: 12px;
  --r-lg: 16px;
  --top-h: 64px;
}

:root {
  color-scheme: light;
  --bg: oklch(97.3% 0.006 262);
  --bg-glow: oklch(94.5% 0.03 268 / 0.55);
  --surface: oklch(100% 0 0);
  --surface-2: oklch(98.3% 0.005 262);
  --surface-sunk: oklch(95.4% 0.009 262);
  --line: oklch(91.5% 0.011 265);
  --line-strong: oklch(85% 0.016 265);
  --ink: oklch(22.5% 0.04 268);
  --ink-2: oklch(40% 0.03 268);
  --ink-3: oklch(53% 0.025 268);
  --accent: oklch(44% 0.185 268);
  --accent-hover: oklch(39% 0.18 268);
  --accent-ink: oklch(99% 0.004 268);
  --accent-soft: oklch(94.5% 0.032 268);
  --accent-line: oklch(80% 0.085 268);
  --gold: oklch(66% 0.125 80);
  --gold-soft: oklch(96% 0.035 88);
  --gold-ink: oklch(44% 0.09 70);
  --ok: oklch(49% 0.115 162);
  --ok-soft: oklch(95.5% 0.032 162);
  --warn: oklch(52% 0.12 62);
  --warn-soft: oklch(96% 0.04 80);
  --bad: oklch(50% 0.185 24);
  --bad-soft: oklch(95.8% 0.026 22);
  --mute-soft: oklch(94.5% 0.007 265);
  --sidebar-bg: oklch(27.5% 0.115 268);
  --sidebar-bg-2: oklch(24% 0.1 268);
  --sidebar-ink: oklch(95% 0.018 268);
  --sidebar-ink-2: oklch(76% 0.055 268);
  --sidebar-hover: oklch(32.5% 0.125 268);
  --sidebar-active: oklch(37% 0.14 268);
  --sidebar-line: oklch(36% 0.11 268);
  --new-bg: oklch(97% 0.012 268);
  --new-ink: oklch(30% 0.14 268);
  --shadow-1: 0 1px 2px oklch(25% 0.06 268 / 0.06), 0 0 0 1px oklch(25% 0.06 268 / 0.01);
  --shadow-2: 0 2px 6px oklch(25% 0.06 268 / 0.06), 0 18px 42px -18px oklch(25% 0.1 268 / 0.28);
  --focus: oklch(55% 0.2 268);
  --scrim: oklch(20% 0.05 268 / 0.38);
}


/* ── base ───────────────────────────────────────────────────────────────────────────────────── */
*,
*::before,
*::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 14px/1.5 var(--font-ui);
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 18% -12%, var(--bg-glow), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
code, kbd { font-family: var(--font-mono); }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-soft); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.block { display: block; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.tnum, .money, .num { font-variant-numeric: tabular-nums; }
.money.strong { font-weight: 600; }
.money.big { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.of { color: var(--ink-3); }
.ok-text { color: var(--ok); display: inline-flex; align-items: center; gap: 5px; }
.bad-text { color: var(--bad); }
.gold-text { color: var(--gold-ink); }
.spacer { flex: 1; }
.ic { width: 16px; height: 16px; flex: none; }
kbd {
  font-size: 11px;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 5px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink-3);
}

/* ── shell ──────────────────────────────────────────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 0.24s var(--ease);
}
.app.collapsed { grid-template-columns: var(--rail-w) minmax(0, 1fr); }

/* The environment band: 3 px across the very top of every page. */
.env-band { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 60; }
.app[data-env='staging'] .env-band { background: repeating-linear-gradient(135deg, oklch(80% 0.15 78) 0 12px, oklch(30% 0.04 70) 12px 24px); }
.app[data-env='production'] .env-band { background: oklch(56% 0.2 25); }

.sidebar {
  background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg-2) 900px);
  color: var(--sidebar-ink);
  border-right: 1px solid var(--sidebar-line);
  view-transition-name: sidebar;
  z-index: 30;
}
.side-inner {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 18px 14px 14px;
  overflow: hidden auto;
}
.brand-link { display: flex; align-items: center; gap: 11px; padding: 2px 6px 0; color: inherit; text-decoration: none !important; }
/* The product's own "SP" icon on a small white rounded tile, so its colours read on lapis and in dark. */
.brand-tile { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 8px; background: oklch(100% 0 0); box-shadow: 0 0 0 1px oklch(100% 0 0 / 0.14), 0 4px 10px -4px oklch(10% 0.1 268 / 0.6); }
.brand-tile img { width: 26px; height: 26px; display: block; }
.brand-text { display: grid; line-height: 1.15; }
.brand-text b { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.brand-text span { font-family: var(--font-display); font-style: italic; font-size: 15px; color: var(--sidebar-ink-2); }

.new-sale {
  margin: 20px 2px 6px;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border-radius: 11px;
  background: var(--new-bg);
  color: var(--new-ink);
  font-weight: 600;
  box-shadow: 0 1px 0 oklch(100% 0 0 / 0.3) inset, 0 6px 18px -10px oklch(10% 0.1 268 / 0.7);
  text-decoration: none !important;
}
.new-sale:hover { filter: brightness(1.04); }
.new-sale kbd { margin-left: auto; background: transparent; border-color: currentColor; color: inherit; opacity: 0.55; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { margin: 18px 10px 6px; font-size: 12px; font-weight: 500; color: var(--sidebar-ink-2); }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  color: var(--sidebar-ink);
  opacity: 0.88;
  text-decoration: none !important;
  transition: background 0.15s, opacity 0.15s;
}
.nav-item:hover { background: var(--sidebar-hover); opacity: 1; }
.nav-item.active { background: var(--sidebar-active); opacity: 1; font-weight: 550; }
.nav-indicator {
  position: absolute;
  left: -14px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: oklch(82% 0.13 86);
  view-transition-name: nav-indicator;
}
.nav-count {
  margin-left: auto;
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font: 600 11.5px/1 var(--font-ui);
  font-variant-numeric: tabular-nums;
  background: oklch(100% 0 0 / 0.12);
}
.nav-count.hot { background: oklch(62% 0.19 22); color: white; }
.nav-count.quiet { background: transparent; color: var(--sidebar-ink-2); }

.side-foot { margin-top: auto; display: grid; gap: 8px; padding-top: 16px; }
.collapse {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 11px;
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  color: var(--sidebar-ink-2);
}
.collapse:hover { background: var(--sidebar-hover); color: var(--sidebar-ink); }
.collapse:focus-visible { outline: 2px solid oklch(82% 0.13 86); }

.app.collapsed .side-inner { padding-inline: 12px; }
.app.collapsed .nav-label,
.app.collapsed .brand-text,
.app.collapsed .nav-group { display: none; }
.app.collapsed .nav { gap: 6px; margin-top: 10px; }
.app.collapsed .new-sale { justify-content: center; padding: 0; margin-inline: 0; }
.app.collapsed .nav-item { justify-content: center; padding: 0; }
.app.collapsed .nav-count { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; font-size: 10px; }
.app.collapsed .nav-indicator { left: -12px; }
.app.collapsed .nav-count.quiet { display: none; }
.app.collapsed .collapse { justify-content: center; padding: 0; }
.app.collapsed .collapse .ic { transform: scaleX(-1); }

.main { min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--top-h);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 3px 28px 0;
  background: color-mix(in oklch, var(--bg) 94%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--line);
  view-transition-name: topbar;
}
.crumbs { display: flex; align-items: center; gap: 4px; min-width: 0; flex: 1; font-size: 13.5px; }
.crumb { color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; flex: 0 1 auto; min-width: 0; }
.crumb.current { flex-shrink: 0; max-width: 320px; }
.crumb.current { color: var(--ink); font-weight: 550; }
.crumb-sep { width: 14px; height: 14px; color: var(--line-strong); }
.search-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 230px;
  height: 36px;
  padding: 0 8px 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-3);
  cursor: pointer;
  font-size: 13px;
  box-shadow: var(--shadow-1);
}
.search-trigger span { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-trigger:hover { border-color: var(--accent-line); color: var(--ink-2); }
.top-right { display: flex; align-items: center; gap: 12px; }

.env-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 12px 0 0;
  border-radius: 8px;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
}
.env-badge b { font-weight: 700; }
.env-badge.staging {
  background: oklch(95% 0.06 85);
  color: oklch(36% 0.08 65);
  border: 1px solid oklch(78% 0.13 78);
}
.env-badge.staging::before {
  content: '';
  align-self: stretch;
  width: 12px;
  background: repeating-linear-gradient(135deg, oklch(78% 0.15 78) 0 4px, oklch(32% 0.05 70) 4px 8px);
}
.env-badge.prod {
  padding-left: 12px;
  background: oklch(52% 0.2 25);
  color: white;
  border: 1px solid oklch(45% 0.18 25);
  box-shadow: 0 0 0 3px oklch(55% 0.2 25 / 0.18);
}
.env-badge.prod span { opacity: 0.85; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: white; animation: pulse 1.8s var(--ease) infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 oklch(100% 0 0 / 0.7); } 70%, 100% { box-shadow: 0 0 0 7px oklch(100% 0 0 / 0); } }

.theme-switch {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 10px;
  background: var(--surface-sunk);
  border: 1px solid var(--line);
}
.theme-switch button {
  all: unset;
  cursor: pointer;
  width: 28px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--ink-3);
}
.theme-switch button:hover { color: var(--ink); }
.theme-switch button[aria-pressed='true'] { background: var(--surface); color: var(--accent); box-shadow: 0 1px 3px oklch(20% 0.05 268 / 0.16); }
.theme-switch button:focus-visible { outline: 2px solid var(--focus); }
.theme-switch .ic { width: 15px; height: 15px; }
.who { display: flex; align-items: center; gap: 10px; }
.who-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 650;
  color: white;
  background: conic-gradient(from 210deg, oklch(45% 0.18 268), oklch(62% 0.14 250), oklch(72% 0.12 86), oklch(45% 0.18 268));
}
.who-text { display: grid; line-height: 1.2; }
.who-text b { font-size: 13px; font-weight: 600; }
.who-text span { font-size: 12px; color: var(--ink-3); }

.content {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 1680px; /* F: fills wide screens (A capped at 1280 and left a dead gutter); centred beyond */
  margin-inline: auto;
  padding: 30px 32px 110px;
}

/* ── page heads + type ──────────────────────────────────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding-bottom: 4px; }
.title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 44px;
  line-height: 1.04;
  letter-spacing: -0.012em;
  color: var(--ink);
  text-wrap: balance;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.title .idchip { font-family: var(--font-mono); }
.lede { margin-top: 10px; color: var(--ink-2); font-size: 15px; max-width: 74ch; text-wrap: pretty; }
.facts-inline { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px; font-size: 13.5px; }
.facts-inline > span { display: inline-flex; align-items: center; gap: 6px; }
.facts-inline .ic { color: var(--ink-3); }
.head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.who-head { display: flex; align-items: center; gap: 18px; }
.section-title { font-family: var(--font-display); font-weight: 400; font-size: 28px; margin: 6px 0 14px; }

/* ── cards ──────────────────────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  padding: 20px 22px;
  min-width: 0;
}
.card-title { display: flex; align-items: center; gap: 9px; font-family: var(--font-ui); font-size: 15px; font-weight: 600; letter-spacing: -0.005em; }
.card-title .ic { color: var(--ink-3); }
.card-title .count { font-size: 12px; font-weight: 600; color: var(--ink-3); background: var(--surface-sunk); padding: 1px 8px; border-radius: 999px; }
.card-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.card > .card-title { margin-bottom: 14px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.stack { display: grid; gap: 20px; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; }

/* ── pills, chips, ids ──────────────────────────────────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 560;
  white-space: nowrap;
  vertical-align: middle;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-bad { background: var(--bad-soft); color: var(--bad); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-accent { background: var(--accent-soft); color: var(--accent); }
.pill-gold { background: var(--gold-soft); color: var(--gold-ink); }
.pill-mute { background: var(--mute-soft); color: var(--ink-3); }
.pill-count { font-weight: 650; margin-left: 2px; }
.pill-row { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.headline .pill { height: 30px; padding: 0 14px; font-size: 14px; font-family: var(--font-ui); }
.grid-main.stretch { align-items: stretch; }
.grid-main.side-narrow { grid-template-columns: minmax(0, 1fr) 292px; }

.idchip {
  all: unset;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 7px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line);
  background: var(--surface-sunk);
  color: var(--ink-2);
  font: 500 12px/1.5 var(--font-mono);
  white-space: nowrap;
  vertical-align: middle;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
  z-index: 1;
}
.idchip .ic { width: 12px; height: 12px; opacity: 0.55; }
.idchip:hover { border-color: var(--accent-line); color: var(--ink); }
.idchip:hover .ic { opacity: 1; color: var(--accent); }
.idchip:focus-visible { outline: 2px solid var(--focus); }
.idchip.copied { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.copy-ic { all: unset; cursor: pointer; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; color: var(--ink-3); vertical-align: middle; position: relative; z-index: 1; }
.copy-ic .ic { width: 13px; height: 13px; }
.copy-ic:hover { background: var(--surface-sunk); color: var(--accent); }
.copy-ic:focus-visible { outline: 2px solid var(--focus); }
.copy-ic.copied { color: var(--ok); }
.id-link code { font-size: 13px; font-weight: 600; color: var(--ink); }
.id-link:hover code { color: var(--accent); }
.title .idchip { font-size: 13px; padding: 4px 9px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none !important;
}
.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.chip-n { margin-left: 7px; font-variant-numeric: tabular-nums; color: var(--ink-3); font-size: 12px; }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip.on .chip-n { color: color-mix(in oklch, var(--bg) 70%, transparent); }
.chip.chip-bad:not(.on) .chip-n { color: var(--bad); font-weight: 650; }

/* ── buttons ────────────────────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 560;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none !important;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, opacity 0.15s;
  box-shadow: var(--shadow-1);
}
.btn:hover { background: var(--surface-2); border-color: var(--ink-3); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); box-shadow: 0 1px 0 oklch(100% 0 0 / 0.18) inset, 0 6px 16px -8px oklch(40% 0.18 268 / 0.6); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); box-shadow: none; }
.btn-ghost:hover { background: var(--surface-sunk); border-color: transparent; color: var(--ink); }
.btn-gold { background: var(--gold-soft); border-color: color-mix(in oklch, var(--gold) 70%, transparent); color: var(--gold-ink); }
.btn-gold:hover { background: color-mix(in oklch, var(--gold-soft) 70%, var(--gold) 30%); border-color: var(--gold); }
.btn-danger { background: var(--bad-soft); border-color: color-mix(in oklch, var(--bad) 40%, transparent); color: var(--bad); }
.btn-danger:not(:disabled) { background: var(--bad); color: white; border-color: transparent; box-shadow: 0 0 0 4px color-mix(in oklch, var(--bad) 18%, transparent); }
.btn-sm { height: 30px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn-xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 7px; }
.btn-col { display: grid; gap: 8px; margin-top: 18px; }
.link-quiet { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); font-size: 13px; }
.link-quiet:hover { color: var(--accent); }
.ext { display: inline-flex; align-items: center; gap: 5px; font-weight: 550; }
.ext .ic { width: 13px; height: 13px; }

/* ── help popovers ──────────────────────────────────────────────────────────────────────────── */
.help {
  all: unset;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  vertical-align: -4px;
  color: var(--ink-3);
  position: relative;
  z-index: 1;
}
.help .ic { width: 15px; height: 15px; }
.help:hover { color: var(--accent); background: var(--accent-soft); }
.help:focus-visible { outline: 2px solid var(--focus); }
.explainer {
  position: fixed;
  inset: auto;
  margin: 0;
  width: 310px;
  max-width: calc(100vw - 24px);
  padding: 14px 16px;
  border-radius: 13px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  box-shadow: var(--shadow-2);
  font-size: 13px;
  line-height: 1.55;
  opacity: 1;
  translate: 0 0;
  transition: opacity 0.16s var(--ease), translate 0.16s var(--ease), overlay 0.16s allow-discrete, display 0.16s allow-discrete;
}
.explainer.wide { width: 440px; }
.explainer p + p { margin-top: 8px; }
.explainer b { color: var(--ink); }
@starting-style { .explainer:popover-open { opacity: 0; translate: 0 4px; } }
.terms { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 2px; }
.terms li { display: flex; justify-content: space-between; gap: 12px; padding: 5px 8px; border-radius: 7px; }
.terms li b { font-variant-numeric: tabular-nums; font-weight: 550; color: var(--ink-2); }
.terms li.binding { background: var(--accent-soft); color: var(--ink); }
.terms li.binding b { color: var(--accent); font-weight: 700; }
.pop-form { width: 300px; }
.pop-form form { display: grid; gap: 12px; }
.pop-form .btn { justify-self: start; }

/* ── banners ────────────────────────────────────────────────────────────────────────────────── */
.flash,
.banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 15px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 500;
  transition: opacity 0.4s var(--ease), translate 0.4s var(--ease);
}
.flash { background: var(--ok-soft); color: var(--ok); border: 1px solid color-mix(in oklch, var(--ok) 28%, transparent); }
.flash span { color: var(--ink); }
.flash a { font-weight: 600; }
.banner-bad { background: var(--bad-soft); color: var(--bad); border: 1px solid color-mix(in oklch, var(--bad) 30%, transparent); }
.banner-bad span { color: var(--ink); }
@starting-style { .flash, .banner { opacity: 0; translate: 0 -6px; } }
.callout { border-radius: 14px; padding: 16px 18px; border: 1px solid; }
.callout-gold { background: var(--gold-soft); border-color: color-mix(in oklch, var(--gold) 45%, transparent); }
.callout-warn { background: var(--warn-soft); border-color: color-mix(in oklch, var(--warn) 35%, transparent); margin-top: 14px; }
.callout-head { display: flex; gap: 12px; align-items: flex-start; }
.callout-head > .ic { width: 20px; height: 20px; margin-top: 2px; color: var(--gold-ink); }
.callout-warn .callout-head > .ic { color: var(--warn); }
.callout h2, .callout h3 { font-size: 15px; font-weight: 600; }
.callout p { color: var(--ink-2); font-size: 13.5px; margin-top: 2px; }
.cb-list, .va-pays { list-style: none; padding: 0; margin: 12px 0 0 32px; }
.cb-list li, .va-pays li { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid color-mix(in oklch, var(--gold) 25%, transparent); font-size: 13.5px; }
.cb-list li .btn { margin-left: auto; }
.ok-line, .warn-line, .empty-line { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin-top: 14px; }
.ok-line { color: var(--ok); }
.warn-line { color: var(--warn); }
.empty-line { color: var(--ink-3); padding: 14px; border: 1px dashed var(--line-strong); border-radius: 12px; justify-content: center; }

/* ── tables ─────────────────────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th {
  text-align: left;
  font-size: 12px;
  font-weight: 550;
  color: var(--ink-3);
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  white-space: nowrap;
}
.table th:first-child { border-top-left-radius: 9px; }
.table th:last-child { border-top-right-radius: 9px; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table tbody tr { transition: background 0.12s; }
.table tbody tr:hover td { background: color-mix(in oklch, var(--accent-soft) 38%, transparent); }
.table-click tbody tr { cursor: pointer; }
.table .chev { width: 28px; color: var(--ink-3); text-align: right; }
.table .chev .ic { opacity: 0; transition: opacity 0.15s, translate 0.15s; }
.table-click tbody tr:hover .chev .ic { opacity: 1; translate: 2px 0; }
.table .sr-col { width: 28px; }
.table-sm td { padding: 9px 12px; font-size: 13px; }
.table .row-bad td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.table .row-mute td { color: var(--ink-3); }
.table tr:target td { background: var(--gold-soft); }
.table tr:target td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
.row-link { color: var(--ink); }
.cust-cell { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none !important; }
.cust-cell b { display: block; font-weight: 600; color: var(--ink); }
.cust-cell small { display: block; font-size: 12.5px; color: var(--ink-3); }
.date { display: inline-flex; flex-direction: column; line-height: 1.3; font-variant-numeric: tabular-nums; }
.date .rel { font-size: 12px; color: var(--ink-3); }
.seats { display: inline-flex; align-items: center; gap: 10px; justify-content: flex-end; }
.seat-bar, .meter { position: relative; display: inline-block; width: 48px; height: 5px; border-radius: 999px; background: var(--surface-sunk); overflow: hidden; }
.seat-bar::after, .meter::after { content: ''; position: absolute; inset: 0 auto 0 0; width: calc(var(--v) * 100%); background: var(--accent); border-radius: inherit; }
.count-badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--bad-soft); color: var(--bad); font-size: 12px; font-weight: 650; }
.method { display: inline-flex; align-items: center; gap: 7px; }
.method .ic { color: var(--ink-3); }
.alloc-line { font-size: 13px; line-height: 1.4; }
.alloc-line + .alloc-line { margin-top: 2px; }
.machine b { display: block; font-weight: 600; font-size: 13px; }
.machine small { color: var(--ink-3); font-size: 12px; }
.flag { color: var(--warn); vertical-align: -3px; }
.flag .ic { width: 14px; height: 14px; }
.cap-cell { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rel-meter { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); }
.rel-meter.near .meter::after { background: var(--warn); }
.rel-meter.at-cap .meter::after { background: var(--bad); }
.rel-meter.at-cap { color: var(--bad); font-weight: 600; }
.link-cell { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 16px; margin-top: 4px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 13px; }
.table-foot b { color: var(--ink); font-weight: 600; }
.pager { display: flex; gap: 4px; }
.pg {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  text-decoration: none !important;
  border: 1px solid transparent;
}
a.pg:hover { border-color: var(--line-strong); }
.pg.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.pg.off { opacity: 0.3; }

/* ── avatars ────────────────────────────────────────────────────────────────────────────────── */
.avatar {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
  background: oklch(93% 0.045 var(--h));
  color: oklch(38% 0.11 var(--h));
  box-shadow: inset 0 0 0 1px oklch(40% 0.1 var(--h) / 0.08);
}
.avatar-xl { width: 60px; height: 60px; border-radius: 18px; font-size: 20px; }

/* ── filter bar + search ────────────────────────────────────────────────────────────────────── */
.filter-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.search-field {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 38px;
  padding: 0 10px 0 12px;
  width: min(340px, 100%);
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-3);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 20%, transparent); }
.search-field input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 14px; }
.search-field input::-webkit-search-cancel-button { display: none; }
.search-field .clear { color: var(--ink-3); display: grid; }
.search-field.big { width: 100%; height: 46px; margin: 16px 0; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--surface-sunk); border: 1px solid var(--line); }
.segmented a { padding: 6px 11px; border-radius: 8px; font-size: 13px; color: var(--ink-2); text-decoration: none !important; white-space: nowrap; }
.segmented a span { margin-left: 6px; color: var(--ink-3); font-variant-numeric: tabular-nums; font-size: 12px; }
.segmented a:hover { color: var(--ink); }
.segmented a.on { background: var(--surface); color: var(--ink); font-weight: 560; box-shadow: 0 1px 3px oklch(20% 0.05 268 / 0.14); }

/* ── empty + skeleton ───────────────────────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 52px 20px; display: grid; justify-items: center; gap: 8px; }
.empty.small { padding: 22px; }
.empty.tall { padding: 110px 20px; }
.empty .empty-ic { width: 46px; height: 46px; padding: 11px; border-radius: 50%; background: var(--surface-sunk); color: var(--ink-3); margin-bottom: 6px; }
.empty h3 { font-family: var(--font-display); font-weight: 400; font-size: 28px; color: var(--ink); }
.empty p { color: var(--ink-3); max-width: 50ch; }
.empty-actions { display: flex; gap: 10px; margin-top: 10px; }
.skel { display: inline-block; height: 11px; border-radius: 6px; vertical-align: middle; background: linear-gradient(90deg, var(--surface-sunk) 0%, var(--line) 50%, var(--surface-sunk) 100%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.skel-av { width: 34px; height: 34px; border-radius: 10px; margin-right: 12px; }
.skel-row td { height: 59px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── KPIs ───────────────────────────────────────────────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: 1.55fr 1fr 1fr 1.25fr; gap: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); padding: 18px 20px 16px; min-width: 0; position: relative; overflow: hidden; }
.kpi header { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.kpi-value { font-family: var(--font-display); font-size: 38px; line-height: 1.08; margin: 10px 0 4px; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi-value.small { font-size: 34px; margin-top: 4px; }
.kpi-value .of { font-size: 22px; }
.kpi-sub { font-size: 12.5px; color: var(--ink-3); }
.kpi-sub a { font-weight: 550; }
.kpi-bad .kpi-value { color: var(--bad); }
.kpi-wide { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: 'h h' 'v s' 'sub ax'; column-gap: 20px; }
.kpi-wide header { grid-area: h; }
.kpi-wide .kpi-value { grid-area: v; }
.kpi-wide .kpi-sub { grid-area: sub; }
.kpi-wide .spark { grid-area: s; align-self: end; width: 100%; height: 62px; margin-bottom: 2px; }
.kpi-wide .spark-axis { grid-area: ax; }
.spark-axis { display: flex; justify-content: space-between; align-self: start; font-size: 11px; color: var(--ink-3); margin-top: 4px; }
.delta { font-weight: 650; padding: 1px 6px; border-radius: 6px; }
.delta.up { color: var(--ok); background: var(--ok-soft); }
.delta.down { color: var(--bad); background: var(--bad-soft); }
.kpi-ring { display: flex; align-items: center; gap: 18px; }
.ring {
  --p: 0;
  flex: none;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), color-mix(in oklch, var(--gold) 55%, transparent) 0 calc(var(--p) * 1% + 0.6%), var(--surface-sunk) 0);
  mask: radial-gradient(farthest-side, transparent calc(100% - 9px), #000 calc(100% - 8.5px));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 9px), #000 calc(100% - 8.5px));
  position: relative;
}
.ring-wrap { position: relative; flex: none; display: grid; place-items: center; }
.ring-wrap > * { grid-area: 1 / 1; }
.ring-label { font-family: var(--font-display); font-size: 26px; font-variant-numeric: tabular-nums; }
.ring-label small { font-size: 15px; color: var(--ink-3); margin-left: 1px; }
.ring-sm { width: 54px; height: 54px; mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6.5px)); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6.5px)); }

/* ── Needs attention ────────────────────────────────────────────────────────────────────────── */
.att-card { padding-bottom: 10px; display: block; } /* a block, not the legacy `.content section` grid (#567) */
.att-card > .card-bar { margin-bottom: 4px; }
.att-group { margin-top: 10px; }
.att-group + .att-group { margin-top: 22px; }
.group-title { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; color: var(--ink-2); padding: 0 12px 8px; }
.group-n { color: var(--ink-3); font-weight: 500; font-variant-numeric: tabular-nums; }
.group-cap { font-weight: 400; color: var(--ink-3); margin-left: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--ink-3); flex: none; }
.dot.tone-bad { background: var(--bad); }
.dot.tone-warn { background: var(--warn); }
.dot.tone-accent { background: var(--accent); }
.dot.tone-gold { background: var(--gold); }
.dot.tone-ok { background: var(--ok); }
.att-list { list-style: none; margin: 0; padding: 0; }
.att-row {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(170px, 230px) minmax(0, 1fr) auto 30px;
  gap: 16px;
  align-items: center;
  padding: 14px 12px;
  border-top: 1px solid var(--line);
  border-radius: 12px;
  transition: background 0.12s;
}
.att-row + .att-row { border-top-color: var(--line); }
.att-row:hover { background: color-mix(in oklch, var(--accent-soft) 45%, transparent); border-top-color: transparent; }
.att-row:hover + .att-row { border-top-color: transparent; }
.att-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; }
.att-icon .ic { width: 17px; height: 17px; }
.tone-bad.att-icon { background: var(--bad-soft); color: var(--bad); }
.tone-warn.att-icon { background: var(--warn-soft); color: var(--warn); }
.tone-accent.att-icon { background: var(--accent-soft); color: var(--accent); }
.tone-gold.att-icon { background: var(--gold-soft); color: var(--gold-ink); }
.tone-mute.att-icon { background: var(--mute-soft); color: var(--ink-2); }
.att-what { display: grid; line-height: 1.3; min-width: 0; }
.att-label { font-weight: 600; font-size: 13.5px; }
.att-customer { color: var(--ink-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-detail { min-width: 0; display: grid; gap: 4px; }
.att-main { font-size: 13.5px; color: var(--ink); display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.att-main code { font-size: 12.5px; color: var(--ink-2); }
.att-meta { font-size: 12.5px; color: var(--ink-3); display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.att-meta b { color: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.att-meta .rel.bad, .att-meta .bad { color: var(--bad); font-weight: 600; }
.sep { width: 1px; height: 12px; background: var(--line-strong); display: inline-block; }
.att-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 560;
  color: var(--accent);
  white-space: nowrap;
  text-decoration: none !important;
}
.att-action::after { content: ''; position: absolute; inset: 0; border-radius: 12px; }
.att-action .ic { transition: translate 0.15s; }
.att-row:hover .att-action .ic { translate: 3px 0; }
.att-row .idchip, .att-row .help { z-index: 2; }
.att-row:has(.att-action:focus-visible) { outline: 2px solid var(--focus); outline-offset: -2px; }
.att-action:focus-visible { outline: none; }

/* ── forms ──────────────────────────────────────────────────────────────────────────────────── */
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field > label, .field .label { font-size: 13px; font-weight: 550; color: var(--ink-2); }
.opt { font-weight: 400; color: var(--ink-3); font-size: 12px; margin-left: 4px; }
.control {
  display: flex;
  align-items: center;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.control:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 20%, transparent); }
.control input, .control select { flex: 1; min-width: 0; height: 100%; padding: 0 12px; border: 0; outline: 0; background: transparent; font-size: 14px; }
.control select { cursor: pointer; padding-right: 8px; }
.control input[type='date'] { font-variant-numeric: tabular-nums; }
.control input[type='date'][data-empty='true']::-webkit-datetime-edit { color: var(--ink-3); opacity: 0.55; }
.prefix { padding-left: 12px; color: var(--ink-3); font-size: 13.5px; font-weight: 500; }
.prefix + input { padding-left: 6px; }
.field .hint { font-size: 12.5px; color: var(--ink-3); }
.field .err { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--bad); font-weight: 500; }
.field .err .ic { width: 14px; height: 14px; }
.field.invalid .control,
.field:has(input:user-invalid) .control { border-color: var(--bad); }
.field.invalid > label { color: var(--bad); }
.field.static .static-val { height: 40px; display: flex; align-items: center; color: var(--ink-2); font-size: 13.5px; }
.footnote { display: flex; align-items: center; gap: 7px; color: var(--ink-3); font-size: 12.5px; margin-top: 16px; }
.check { display: inline-flex; align-items: center; gap: 9px; font-size: 13.5px; cursor: pointer; color: var(--ink); }
.check input { width: 17px; height: 17px; accent-color: var(--accent); margin: 0; }
q { quotes: '“' '”'; font-weight: 650; color: var(--ink); }

.type-pick { border: 0; padding: 0; margin: 0 0 18px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.type-pick.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.type-pick legend { font-size: 13px; font-weight: 550; color: var(--ink-2); margin-bottom: 8px; padding: 0; }
.type-opt { position: relative; cursor: pointer; }
.type-opt input { position: absolute; opacity: 0; pointer-events: none; }
.type-opt > span { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); transition: 0.15s; }
.type-opt > span > .ic { grid-row: span 2; color: var(--ink-3); width: 18px; height: 18px; }
.type-opt b { font-weight: 600; font-size: 14px; }
.type-opt small { color: var(--ink-3); font-size: 12.5px; grid-column: 2; }
.type-opt > span:not(:has(.ic)) b, .type-opt > span:not(:has(.ic)) small { grid-column: 1 / -1; }
.type-opt:has(input:checked) > span { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.type-opt:has(input:checked) .ic { color: var(--accent); }
.type-opt:has(input:focus-visible) > span { outline: 2px solid var(--focus); outline-offset: 2px; }
.type-opt.off { cursor: not-allowed; }
.type-opt.off > span { opacity: 0.55; border-style: dashed; }
.set-field .type-pick { box-shadow: none; background: none; margin: 0 0 10px; }
.wizard:has(input[name='agreement_type'][value='evaluation']:checked) .commercial-only { display: none; }
/* #756: a New sale's TOP date is a company's; a person pays before activation (the kind control decides). */
.wizard:has(select[name='kind'] option[value='person']:checked) .company-only { display: none; }
.wizard:not(:has(select[name='kind'] option[value='person']:checked)) .person-only { display: none; }
.wizard .top-warn { margin-top: 6px; }
/* #762: a buyer outside Indonesia — no NPWP / NITKU asked, and the tax warning (the country control decides). */
form:has(select[name='country'] option[value='ID']:checked) .foreign-only { display: none; }
form:has(select[name='country']):not(:has(select[name='country'] option[value='ID']:checked)) .id-only { display: none; }
.foreign-only.warning { margin-top: 6px; }
.va-only[hidden] { display: none; }

/* typed-label gates */
.typed-control input { font-weight: 550; letter-spacing: 0.005em; }
.typed-control input::placeholder { color: color-mix(in oklch, var(--ink-3) 55%, transparent); font-weight: 400; }
.typed-state { display: grid; place-items: center; width: 36px; color: var(--ink-3); }
.typed-state .armed { display: none; }
.field.typed[data-match='yes'] .control { border-color: var(--ok); background: var(--ok-soft); }
.field.typed[data-match='yes'] .typed-state { color: var(--ok); }
.field.typed[data-match='yes'] .locked { display: none; }
.field.typed[data-match='yes'] .armed { display: block; }
.field.typed[data-match='no'] .control { border-color: color-mix(in oklch, var(--warn) 60%, transparent); }
.gate-row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.gate-row .field { flex: 1 1 260px; max-width: 520px; }
.gate-row > .btn { height: 40px; }
.gate-row[data-needed='no'] .field.typed { opacity: 0.6; }
.gate-row[data-needed='no'] .field.typed .control { border-style: dashed; }
.confirm-box { display: grid; gap: 18px; max-width: 560px; }
.confirm-box > p { color: var(--ink-2); }

/* ── wizard ─────────────────────────────────────────────────────────────────────────────────── */
.wizard { padding: 0; overflow: hidden; }
.stepper { list-style: none; margin: 0; padding: 16px 22px; display: flex; gap: 10px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.stepper li { display: flex; align-items: center; gap: 9px; color: var(--ink-3); font-size: 13px; font-weight: 500; flex: 1; }
.stepper li:not(:last-child)::after { content: ''; flex: 1; height: 1px; background: var(--line-strong); margin-left: 4px; }
.stepper li.done:not(:last-child)::after { background: var(--ok); }
.step-n { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-strong); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; background: var(--surface); }
.step-n .ic { width: 13px; height: 13px; }
.stepper li.now { color: var(--ink); font-weight: 600; }
.stepper li.now .step-n { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: 0 0 0 4px var(--accent-soft); }
.stepper li.done { color: var(--ink-2); }
.stepper li.done .step-n { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.wiz-body { padding: 24px 22px 26px; }
.wiz-title { font-family: var(--font-display); font-weight: 400; font-size: 30px; margin-bottom: 18px; }
.wiz-step[hidden] { display: none; }
.wiz-foot, .form-foot { display: flex; align-items: center; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); }
.form-foot { margin: 20px -22px -20px; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.wiz-count { color: var(--ink-3); font-size: 12.5px; margin-right: 6px; }
.summary { position: sticky; top: calc(var(--top-h) + 20px); }
.sum-list { margin: 0; display: grid; }
.sum-list > div { display: grid; grid-template-columns: 96px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.sum-list dt { font-size: 12.5px; color: var(--ink-3); }
.sum-list dd { margin: 0; font-size: 13.5px; min-width: 0; overflow-wrap: anywhere; }
.sum-list dd small { display: block; color: var(--ink-3); font-size: 12.5px; }
.sum-list .is-off { opacity: 0.35; }
.sum-sub { font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 18px 0 8px; }
.consequences { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.consequences li { display: flex; gap: 10px; font-size: 13px; color: var(--ink-2); }
.consequences li .ic { color: var(--accent); margin-top: 2px; }
.consequences li.is-off { display: none; }

/* ── the key vault: a slab of lapis with pyrite flecks ─────────────────────────────────────── */
.vault {
  position: relative;
  border-radius: 20px;
  padding: 22px 24px 20px;
  color: oklch(97% 0.01 268);
  background:
    radial-gradient(circle at 12% 22%, oklch(85% 0.13 86 / 0.9) 0 0.8px, transparent 1.4px),
    radial-gradient(circle at 63% 71%, oklch(85% 0.13 86 / 0.7) 0 0.7px, transparent 1.3px),
    radial-gradient(circle at 81% 18%, oklch(85% 0.13 86 / 0.8) 0 1px, transparent 1.6px),
    radial-gradient(circle at 37% 88%, oklch(85% 0.13 86 / 0.6) 0 0.6px, transparent 1.2px),
    radial-gradient(120% 140% at 0% 0%, oklch(40% 0.17 268), oklch(24% 0.11 268) 60%, oklch(18% 0.07 270));
  background-size: 97px 83px, 131px 109px, 173px 149px, 89px 113px, 100% 100%;
  border: 1px solid oklch(50% 0.14 268 / 0.6);
  box-shadow: 0 30px 60px -30px oklch(25% 0.15 268 / 0.7), inset 0 1px 0 oklch(100% 0 0 / 0.12);
  overflow: hidden;
}
.vault-head { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 14px; color: oklch(90% 0.04 268); }
.vault-head .ic { color: oklch(84% 0.13 86); }
.vault-head small { margin-left: auto; font-weight: 400; color: oklch(80% 0.05 268); font-size: 12.5px; }
.vault-key { position: relative; margin: 18px 0 20px; padding: 20px 18px; border-radius: 14px; background: oklch(12% 0.04 268 / 0.45); border: 1px solid oklch(100% 0 0 / 0.08); text-align: center; }
.vault-key code { display: block; font-size: clamp(20px, 2.6vw, 32px); font-weight: 500; letter-spacing: 0.1em; color: white; filter: blur(9px); transition: filter 0.35s var(--ease); user-select: all; }
/* Unblurred only once revealed (#572 review): keyboard focus on the hidden Reveal shows its ring (below), not the key. */
.vault-key.revealed code { filter: none; }
.vault-reveal { all: unset; cursor: pointer; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; font-size: 14px; color: white; border-radius: 14px; }
.vault-reveal:hover { background: oklch(100% 0 0 / 0.04); }
.vault-reveal:focus-visible { outline: 2px solid oklch(84% 0.13 86); }
.vault-key.revealed .vault-reveal { display: none; }
.vault-actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.vault-actions .btn-gold { background: oklch(84% 0.13 86); color: oklch(25% 0.06 70); border-color: transparent; }
.vault-actions .btn-gold:hover { background: oklch(88% 0.12 88); }
.vault-warn { display: flex; gap: 9px; flex: 1 1 320px; font-size: 13px; color: oklch(86% 0.03 268); }
.vault-warn .ic { margin-top: 2px; color: oklch(84% 0.13 86); }
.vault-warn b { color: white; }
.link-out { margin: 4px 0 10px; overflow-wrap: anywhere; }
.link-out a { display: inline-flex; gap: 6px; align-items: center; font-family: var(--font-mono); font-size: 13px; }
.regen-reveal { max-width: 760px; }

/* ── customer + contract ────────────────────────────────────────────────────────────────────── */
.facts { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 11px 14px; margin: 0; font-size: 13.5px; }
.facts dt { color: var(--ink-3); font-size: 12.5px; padding-top: 1px; }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.side-feed { position: sticky; top: calc(var(--top-h) + 20px); }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { position: relative; display: grid; grid-template-columns: 14px 1fr; gap: 12px; padding-bottom: 14px; }
.feed li:not(:last-child)::before { content: ''; position: absolute; left: 6px; top: 14px; bottom: 0; width: 1px; background: var(--line); }
.feed-dot { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--accent-line); background: var(--surface); margin-top: 3px; }
.feed li:first-child .feed-dot { border-color: var(--accent); background: var(--accent-soft); }
.feed b { display: block; font-size: 13px; font-weight: 600; }
.feed small { display: block; font-size: 12.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.feed-meta { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.va-list { display: flex; flex-wrap: wrap; gap: 6px; }

.headline { display: grid; grid-template-columns: 1.1fr 1.2fr 1.3fr; grid-template-rows: 1fr auto; gap: 18px 22px; align-items: start; }
.hl { display: grid; gap: 4px; align-content: start; }
.hl-label { font-size: 12.5px; color: var(--ink-3); }
.hl-value { font-family: var(--font-display); font-size: 34px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hl-sub { font-size: 12.5px; color: var(--ink-3); }
.hl-seats { display: flex; align-items: center; gap: 14px; }
.hl-seats > div:last-child { display: grid; gap: 4px; }
.hl-note { grid-column: 1 / -1; display: flex; align-items: center; gap: 7px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-3); }
.subnav {
  position: sticky;
  top: calc(var(--top-h) + 8px);
  z-index: 12;
  align-self: flex-start;
  display: flex;
  gap: 2px;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: color-mix(in oklch, var(--surface) 95%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-1);
}
.subnav a { padding: 7px 13px; border-radius: 9px; font-size: 13px; font-weight: 500; color: var(--ink-2); text-decoration: none !important; }
.subnav a span { color: var(--ink-3); margin-left: 5px; font-variant-numeric: tabular-nums; }
.subnav a:hover { background: var(--surface-sunk); color: var(--ink); }
#agreements, #slots, #controls, #audit, #allocations, #refunds, #revoke { scroll-margin-top: calc(var(--top-h) + 70px); }

.drawer { margin-top: 18px; }
.drawer > summary { list-style: none; display: inline-flex; }
.drawer > summary::-webkit-details-marker { display: none; }
.drawer[open] > summary { background: transparent; color: var(--accent); border: 1px solid var(--accent-line); box-shadow: none; }
.drawer-body { margin-top: 14px; padding: 20px; border-radius: 14px; border: 1px dashed var(--line-strong); background: var(--surface-2); display: grid; gap: 18px; }
.drawer-lede { color: var(--ink-2); font-size: 13.5px; max-width: 80ch; }
.retire { border: 0; padding: 0; margin: 0; display: grid; gap: 10px; }
.retire legend { font-size: 13px; font-weight: 550; color: var(--ink-2); padding: 0; margin-bottom: 8px; }
.retire .hint { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-3); }
.retire.invalid legend { color: var(--bad); }
.slot-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.slot-pick { position: relative; cursor: pointer; }
.slot-pick input { position: absolute; opacity: 0; }
.slot-pick span { width: 38px; height: 34px; display: grid; place-items: center; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 13px; font-weight: 550; font-variant-numeric: tabular-nums; transition: 0.12s; }
.slot-pick:hover span { border-color: var(--ink-3); }
.slot-pick input:checked + span { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); text-decoration: line-through; }
.slot-pick input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.slot-pick.occupied { cursor: not-allowed; }
.slot-pick.occupied span { color: var(--ink-3); background: repeating-linear-gradient(135deg, var(--surface-sunk) 0 4px, transparent 4px 8px); border-style: dashed; }

.controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.ctl { display: flex; flex-direction: column; gap: 12px; }
.ctl-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; }
.ctl-title .ic { color: var(--ink-3); }
.ctl-now { font-size: 13px; color: var(--ink-3); }
.ctl-now b { color: var(--ink); font-variant-numeric: tabular-nums; }
.ctl-text { font-size: 13px; color: var(--ink-2); }
.ctl > .btn, .ctl > .gate-row { margin-top: auto; }
.ctl > .btn { align-self: flex-start; }
.ctl .gate-row { flex-direction: column; align-items: stretch; }
.ctl .gate-row .field { flex: none; }
.ctl .gate-row > .btn { align-self: flex-start; }
.ctl.danger {
  grid-column: 1 / -1;
  border-color: color-mix(in oklch, var(--bad) 35%, var(--line));
  background: linear-gradient(180deg, color-mix(in oklch, var(--bad-soft) 70%, var(--surface)), var(--surface) 70%);
}
.ctl.danger .ctl-title, .ctl.danger .ctl-title .ic { color: var(--bad); }
.ctl.danger .gate-row { flex-direction: row; align-items: flex-end; }
.ctl.danger .gate-row .field { flex: 0 1 520px; }
.ctl.danger .gate-row > .btn { align-self: flex-end; }
.ctl.danger > .field { max-width: 640px; }
.ctl.revoked { background: var(--bad-soft); }
/* #583: the commercial grace control's review step spans the row, so its effect table reads whole. */
.ctl.grace-review { grid-column: 1 / -1; }
.ctl-section .controls { grid-auto-flow: dense; }
.ctl.grace-review .table-wrap { max-width: 720px; }
.grace-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: auto; }
.past { margin-top: 16px; }
.past summary { cursor: pointer; display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 550; color: var(--ink-2); }
.past summary .count { font-size: 12px; color: var(--ink-3); background: var(--surface-sunk); padding: 1px 8px; border-radius: 999px; }
.past .table-wrap { margin-top: 12px; }
.audit code { font-size: 11.5px; }

/* ── payment ────────────────────────────────────────────────────────────────────────────────── */
.balance { padding: 22px 24px 18px; }
.eq { display: flex; align-items: stretch; gap: 12px; flex-wrap: wrap; }
.eq-term { flex: 1 1 160px; display: grid; gap: 4px; padding: 14px 16px; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.eq-label { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-3); }
.eq-value { font-family: var(--font-display); font-size: 31px; line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.eq-op { align-self: center; font-family: var(--font-display); font-size: 30px; color: var(--ink-3); }
.eq-term.t-open.hot { background: var(--accent-soft); border-color: var(--accent-line); }
.eq-term.t-open.hot .eq-value { color: var(--accent); }
.eq-term.t-wh { margin-left: 18px; background: var(--gold-soft); border: 1px dashed color-mix(in oklch, var(--gold) 70%, transparent); position: relative; }
.eq-term.t-wh::before { content: ''; position: absolute; left: -16px; top: 12px; bottom: 12px; width: 1px; background: var(--line-strong); }
.eq-term.t-wh .eq-value { color: var(--gold-ink); }
.eq-note { font-size: 12px; color: var(--gold-ink); font-weight: 550; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sw-alloc { background: var(--accent); }
.sw-open { background: repeating-linear-gradient(135deg, var(--accent) 0 2px, transparent 2px 4px); box-shadow: inset 0 0 0 1px var(--accent); }
.sw-wh { background: var(--gold); }
.bar { display: flex; gap: 3px; height: 10px; margin: 18px 0 12px; }
.bar > span { border-radius: 999px; min-width: 0; }
.bar-alloc { background: var(--accent); }
.bar-open { background: repeating-linear-gradient(135deg, color-mix(in oklch, var(--accent) 65%, transparent) 0 3px, transparent 3px 6px); box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--accent) 55%, transparent); }
.bar-wh { flex: none; background: var(--gold); margin-left: 10px; }
.bal-note { font-size: 12.5px; color: var(--ink-3); max-width: 100ch; }
.verify { display: grid; gap: 12px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.verify .btn { justify-self: start; }
.refunds p { font-size: 13.5px; color: var(--ink-2); }
.refunds p + p { margin-top: 8px; }
.link-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.link-list a { display: inline-flex; align-items: center; gap: 8px; color: var(--bad); font-weight: 550; font-size: 13.5px; }

.alloc { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); display: grid; gap: 14px; }
.alloc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; flex-wrap: wrap; }
.alloc-head .ctl-title { font-family: var(--font-display); font-weight: 400; font-size: 26px; }
.alloc-head > div:first-child { flex: 1 1 300px; }
.alloc-head p { margin-top: 4px; max-width: 60ch; }
.prefill-note { display: inline-flex; align-items: center; gap: 5px; color: var(--ok); font-weight: 550; }
.remainder { min-width: 230px; padding: 12px 14px; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--line); display: grid; gap: 4px; transition: border-color 0.2s, background 0.2s; }
.rem-label { font-size: 12px; color: var(--ink-3); }
.rem-value { font-family: var(--font-display); font-size: 28px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.rem-bar { height: 5px; border-radius: 999px; background: var(--surface-sunk); overflow: hidden; }
.rem-bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width 0.25s var(--ease); }
.remainder[data-state='zero'] { border-color: var(--ok); background: var(--ok-soft); }
.remainder[data-state='zero'] .rem-value { color: var(--ok); }
.remainder[data-state='zero'] .rem-bar span { background: var(--ok); }
.remainder[data-state='over'] { border-color: var(--bad); background: var(--bad-soft); }
.remainder[data-state='over'] .rem-value { color: var(--bad); font-size: 22px; }
.remainder[data-state='over'] .rem-bar span { background: var(--bad); }
.rule-strip { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 11px; background: var(--gold-soft); border-left: 3px solid var(--gold); font-size: 13px; color: var(--ink-2); }
.rule-strip .ic { color: var(--gold-ink); margin-top: 1px; }
.rule-strip b { color: var(--ink); }
.alloc-rows { display: grid; gap: 10px; }
.alloc-row { border: 1px solid var(--line); border-radius: 13px; padding: 14px 16px; display: grid; gap: 12px; background: var(--surface); }
.alloc-row:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.alloc-row.is-paid { background: var(--surface-2); }
.ar-what { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; font-size: 13.5px; }
.ar-what > a { font-size: 12.5px; }
.ar-facts { display: inline-flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12.5px; color: var(--ink-3); margin-left: 6px; }
.ar-facts b { color: var(--ink-2); font-weight: 600; }
.hints { margin-left: auto; display: inline-flex; gap: 5px; flex-wrap: wrap; }
.hint-chip { font-size: 11.5px; font-variant-numeric: tabular-nums; padding: 2px 8px; border-radius: 6px; background: var(--surface-sunk); color: var(--ink-3); border: 1px dashed var(--line-strong); white-space: nowrap; }
.hint-chip i { font-style: normal; font-weight: 650; margin-right: 6px; color: var(--ink-2); }
.ar-inputs { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1fr); gap: 10px; }
.control input { width: 100%; }
.field.mini { position: relative; gap: 5px; }
.field.mini > label { font-size: 12px; }
.field.mini .control { height: 36px; }
.fill { all: unset; cursor: pointer; position: absolute; right: 6px; top: 25px; padding: 3px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; color: var(--accent); background: var(--accent-soft); }
.fill:hover { background: color-mix(in oklch, var(--accent-soft) 60%, var(--accent) 20%); }
.fill:focus-visible { outline: 2px solid var(--focus); }
.form-card { padding-bottom: 20px; }
.rule-card { background: linear-gradient(180deg, var(--accent-soft), var(--surface) 65%); }
.rule-steps { list-style: none; counter-reset: s; margin: 0 0 14px; padding: 0; display: grid; gap: 14px; }
.rule-steps li { counter-increment: s; display: grid; grid-template-columns: 26px 1fr; gap: 2px 10px; font-size: 13px; color: var(--ink-2); }
.rule-steps li::before { content: counter(s); grid-row: span 2; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 650; font-size: 12px; }
.rule-steps b { color: var(--ink); font-size: 14px; }
.rule-foot { font-family: var(--font-display); font-size: 19px; line-height: 1.3; color: var(--ink); padding-top: 12px; border-top: 1px solid var(--line); }

/* ── callback ───────────────────────────────────────────────────────────────────────────────── */
.join-path { display: flex; align-items: center; margin-top: 4px; }
.jp-node { flex: 0 1 260px; display: grid; gap: 2px; padding: 13px 15px; border-radius: 13px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink); text-decoration: none !important; min-width: 0; }
.jp-k { font-size: 12px; color: var(--ink-3); }
.jp-node b { font-size: 15px; font-weight: 600; }
.jp-node small { font-size: 12.5px; color: var(--ink-3); }
.jp-node.target { border-color: var(--accent-line); background: var(--accent-soft); }
a.jp-node.target:hover { border-color: var(--accent); }
.jp-node.target.warn { border-color: color-mix(in oklch, var(--warn) 50%, transparent); background: var(--warn-soft); }
.jp-node.target.bad { border-color: color-mix(in oklch, var(--bad) 45%, transparent); background: var(--bad-soft); }
.jp-edge { flex: 1 1 90px; min-width: 70px; position: relative; height: 2px; margin: 0 4px; background: var(--ok); }
.jp-edge::after { content: ''; position: absolute; right: -2px; top: -4px; border: 5px solid transparent; border-left-color: inherit; border-left: 7px solid var(--ok); }
.jp-edge span { position: absolute; left: 50%; bottom: 6px; translate: -50% 0; white-space: nowrap; font-size: 11.5px; font-weight: 600; color: var(--ok); }
.jp-edge.virtual_account { background: repeating-linear-gradient(90deg, var(--warn) 0 5px, transparent 5px 9px); }
.jp-edge.virtual_account::after { border-left-color: var(--warn); }
.jp-edge.virtual_account span { color: var(--warn); }
.jp-edge.unmatched { background: repeating-linear-gradient(90deg, var(--bad) 0 3px, transparent 3px 8px); }
.jp-edge.unmatched::after { border-left-color: var(--bad); }
.jp-edge.unmatched span { color: var(--bad); }
.act-steps { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 14px; }
.act-steps li { display: flex; gap: 12px; font-size: 13.5px; color: var(--ink-2); }
.act-steps b { color: var(--ink); }
.act-steps .step-n { width: 24px; height: 24px; }
.act-steps .ext { margin-left: 4px; }
.act-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.act .field { margin: 12px 0 0; max-width: 460px; }
.pick-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.pick-list a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--ink); text-decoration: none !important; border: 1px solid transparent; }
.pick-list a:hover { background: var(--accent-soft); border-color: var(--accent-line); }
.pick-list b { display: block; font-weight: 600; }
.pick-list small { display: block; font-size: 12.5px; color: var(--ink-3); }
.pick-go { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-size: 13px; font-weight: 560; }
.pick .hint { font-size: 12.5px; color: var(--ink-3); margin-top: 10px; }

/* ── reminders ──────────────────────────────────────────────────────────────────────────────── */
.rem-group + .rem-group { margin-top: 26px; }
.rem-group .group-title { padding-left: 4px; }
.rem-list { list-style: none; margin: 0; padding: 0; }
.rem {
  display: grid;
  grid-template-columns: 140px minmax(0, 1.2fr) minmax(0, 1fr) 236px 180px;
  gap: 18px;
  align-items: center;
  padding: 16px 8px;
  border-top: 1px solid var(--line);
  transition: opacity 0.26s var(--ease), translate 0.26s var(--ease);
}
.rem.leaving { opacity: 0; translate: 16px 0; }
.rem-step { display: grid; gap: 6px; }
.track { display: inline-flex; gap: 3px; }
.tk { font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; padding: 3px 6px; border-radius: 6px; background: var(--surface-sunk); color: var(--ink-3); }
.tk.sent { background: var(--ok-soft); color: var(--ok); }
.tk.sent::before { content: "✓ "; }
.tk.now { background: var(--accent); color: var(--accent-ink); }
.rem.late .tk.now { background: var(--bad); color: white; }
.rem-due { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.rem-due small { display: block; color: var(--ink-3); }
.rem-who { display: flex; align-items: center; gap: 11px; min-width: 0; }
.rem-who a { color: var(--ink); }
.rem-who b { display: block; font-weight: 600; }
.rem-who small { display: block; font-size: 12.5px; color: var(--ink-3); }
.rem-dates { display: grid; gap: 3px; font-size: 12.5px; color: var(--ink-3); }
.rem-dates b { color: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.rem-flags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.rem-flags:empty { display: none; }
.rem-send .btn { width: 100%; justify-content: flex-start; }
.rem-send .btn-ghost { padding-left: 11px; }
.rem-send { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.rem-send .btn { max-width: 100%; }
.trunc { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.rem-mark { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface-2); }

/* ── ⌘K palette ─────────────────────────────────────────────────────────────────────────────── */
.palette {
  width: min(640px, 92vw);
  margin: 12vh auto auto;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-2), 0 40px 80px -30px oklch(15% 0.1 268 / 0.5);
  opacity: 1;
  translate: 0 0;
  scale: 1;
  transition: opacity 0.18s var(--ease), translate 0.18s var(--ease), scale 0.18s var(--ease), overlay 0.18s allow-discrete, display 0.18s allow-discrete;
}
.palette::backdrop { background: var(--scrim); backdrop-filter: blur(3px); }
@starting-style { .palette[open] { opacity: 0; translate: 0 -8px; scale: 0.98; } }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--ink-3); }
.palette-input .ic { width: 18px; height: 18px; }
.palette-input input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 16px; color: var(--ink); }
.palette-list { list-style: none; margin: 0; padding: 6px; max-height: min(52vh, 440px); overflow: auto; }
.palette-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px; cursor: pointer; }
.palette-list li .ic { color: var(--ink-3); }
.palette-list li span { flex: 1; min-width: 0; }
.palette-list li b { display: block; font-weight: 550; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-list li small { display: block; font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-list li kbd { opacity: 0; }
.palette-list li[aria-selected='true'] { background: var(--accent-soft); }
.palette-list li[aria-selected='true'] .ic { color: var(--accent); }
.palette-list li[aria-selected='true'] kbd { opacity: 1; }
.pal-empty { color: var(--ink-3); justify-content: center; cursor: default !important; padding: 26px 12px !important; }
.palette-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); }
.palette-foot kbd { margin-right: 3px; }
/* #580: the trigger is a link (the search page with no script); the palette's rows are links. */
a.search-trigger { text-decoration: none !important; }
.search-trigger kbd { flex: none; }
.palette-input input::-webkit-search-cancel-button { display: none; }
.palette-list li > a { display: contents; color: inherit; text-decoration: none !important; }

/* ── #580: the search page ──────────────────────────────────────────────────────────────────── */
.search-page-form { display: flex; align-items: center; gap: 10px; margin: 18px 0 20px; }
.search-page-form .search-field.big { margin: 0; flex: 1; }
.search-groups { display: grid; gap: 18px; }
.search-group > .card-title { margin-bottom: 8px; }
.search-hits { list-style: none; margin: 0 -10px; padding: 0; }
.search-hit { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 11px; color: inherit; text-decoration: none !important; }
.search-hit:hover { background: var(--surface-2); }
.search-hit .hit-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-sunk); color: var(--ink-3); flex: none; }
.search-hit .hit-text { flex: 1; min-width: 0; }
.search-hit b { display: block; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-hit small { display: block; font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-hit .hit-aside { font-size: 13.5px; color: var(--ink-2); white-space: nowrap; }
.search-hit .hit-go { color: var(--ink-3); }
.search-hits li + li .search-hit { border-top: 1px solid var(--line); border-radius: 0; }
.search-hits li + li .search-hit:hover { border-radius: 0; }
.search-more { margin-top: 10px; font-size: 13.5px; }
.search-more a { display: inline-flex; align-items: center; gap: 4px; font-weight: 550; }

/* ── view transitions: the sidebar stays, its gold indicator glides ─────────────────────────── */
::view-transition-group(nav-indicator) { animation-duration: 0.34s; animation-timing-function: cubic-bezier(0.3, 0.9, 0.2, 1); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.18s; }
html.vt-theme .sidebar, html.vt-theme .topbar, html.vt-theme .nav-indicator { view-transition-name: none; }

/* ── responsive ─────────────────────────────────────────────────────────────────────────────── */
@media (max-width: 1240px) {
  .who-text { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rem { grid-template-columns: 140px minmax(0, 1fr) minmax(0, 1fr); }
  .rem-send, .rem-mark { grid-column: span 1; }
}
@media (max-width: 1080px) {
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .summary, .side-feed { position: static; }
  .search-trigger span { display: none; }
  .search-trigger { width: auto; }
  .ar-inputs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .att-row { grid-template-columns: 36px minmax(0, 1fr) 30px; }
  .att-detail, .att-action { grid-column: 2; }
  .att-row .row-menu-wrap { grid-column: 3; grid-row: 1; }
}
@media (max-width: 820px) {
  .app, .app.collapsed { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
  .app .nav-label, .app .brand-text, .app .nav-group { display: none; }
  .content { padding: 22px 16px 100px; }
  .topbar { padding-inline: 16px; }
  .crumbs { display: none; }
  .title { font-size: 34px; }
  .kpis, .grid-2, .grid-3, .controls, .headline { grid-template-columns: minmax(0, 1fr); }
  .rem { grid-template-columns: minmax(0, 1fr); }
  .env-badge span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .skel { animation: none; }
}

/* ── F · scorecards: "the statement band" ──────────────────────────────────────────────────────
   One ruled surface, cells split by hairlines (the 1px gap shows the band's own colour through).
   Caption → serif figure → footnote → a viz that bleeds to the bottom edge. */
.sc-grid {
  display: grid;
  grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-1);
}
.sc {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 18px 22px 18px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  isolation: isolate;
}
.sc.has-viz { padding-bottom: 0; }
.sc-label { display: flex; align-items: center; gap: 8px; min-width: 0; padding-right: 26px; font-size: 11px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-3); line-height: 1.35; }
.sc-label .help { text-transform: none; letter-spacing: 0; }
.sc-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--sc-c); box-shadow: 0 0 0 3px var(--sc-halo); }
.sc-value { margin-top: 12px; font-family: var(--font-display); font-size: 42px; line-height: 1; letter-spacing: -0.015em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.sc.tone-bad .sc-value { color: var(--bad); }
.sc-unit { margin-left: 6px; font-family: var(--font-ui); font-size: 14px; letter-spacing: 0; color: var(--ink-3); }
.sc-foot { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-top: 10px; font-size: 12.5px; line-height: 1.45; color: var(--ink-3); }
.sc-delta { font-family: var(--font-mono); font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.sc-delta.tone-ok { color: var(--ok); }
.sc-delta.tone-bad { color: var(--bad); }
.sc-delta.tone-mute { color: var(--ink-3); }
.sc-sub { min-width: 0; }
.sc-sub b { color: var(--ink-2); }
.sc-sub b.bad { color: var(--bad); }
/* the viz sits on the floor of the cell, full width */
.sc-viz { display: block; margin: auto -22px 0; padding-top: 14px; }
.sc-spark { display: block; width: 100%; height: 40px; }
.sc-spark-area { fill: var(--sc-c); opacity: 0.1; }
.sc-spark-line { fill: none; stroke: var(--sc-c); stroke-width: 1.5; stroke-linejoin: round; }
.sc-meter { --v: 0; display: block; height: 4px; background: linear-gradient(90deg, var(--sc-c) calc(var(--v) * 100%), var(--surface-sunk) 0); }
.sc:not(.has-viz) .sc-foot { margin-bottom: 4px; }
/* tones: one dot colour, nothing else (bad also colours the figure) */
.sc.tone-accent { --sc-c: var(--accent); --sc-halo: var(--accent-soft); }
.sc.tone-ok { --sc-c: var(--ok); --sc-halo: var(--ok-soft); }
.sc.tone-warn { --sc-c: var(--warn); --sc-halo: var(--warn-soft); }
.sc.tone-bad { --sc-c: var(--bad); --sc-halo: var(--bad-soft); }
.sc.tone-gold { --sc-c: var(--gold); --sc-halo: var(--gold-soft); }
.sc.tone-mute { --sc-c: var(--line-strong); --sc-halo: transparent; }
.sc.tone-mute .sc-value { color: var(--ink-3); }
/* clickable: a faint ↗ that wakes up, and a lapis wash over the whole cell */
.sc-link, .sc-link:hover { text-decoration: none; color: inherit; }
.sc-go { position: absolute; top: 14px; right: 14px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 99px; color: var(--ink-3); opacity: 0.55; transition: opacity 0.15s var(--ease), background 0.15s var(--ease), color 0.15s var(--ease), transform 0.2s var(--ease); }
.sc-go .ic { width: 15px; height: 15px; }
.sc-link { transition: background 0.15s var(--ease); }
.sc-link:hover { background: color-mix(in oklch, var(--accent-soft) 60%, var(--surface)); }
.sc-link:hover .sc-go, .sc-link:focus-visible .sc-go { opacity: 1; background: var(--accent); color: var(--accent-ink); transform: translate(2px, -2px); }
.sc-link:hover .sc-label { color: var(--ink-2); }
.sc-link:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
/* a cell that is the active filter reads as a selected tab: lapis cap + wash */
.sc.on { background: color-mix(in oklch, var(--accent-soft) 75%, var(--surface)); box-shadow: inset 0 3px 0 var(--accent); }
.sc.on .sc-label { color: var(--accent); }
@media (max-width: 1180px) { .sc-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .sc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* The Needs-attention filter band carries up to 11 cells (#635 / #765 / #766 add theirs only while
   open), so a fixed column count squeezed each to ~100px and clipped a label like CALLBACKS. It is
   a wrapping flex row instead, each cell's basis picked by the width alone (no script):
     one row  — when every cell gets at least --sc-min (A = 100% / n);
     two rows — else, when ceil(n/2) cells per row still do (B = 100% / (n/2 + 0.9) puts exactly
                ceil(n/2) on the first row);
     --sc-min — else, as many as fit.
   `min(max(M, B), (M − A) · 1e5)` is max(M, B) while A < M and ≤ 0 once A ≥ M, so the outer max()
   picks A then. Cells grow to close each row, so the 1px hairline gap never shows a hole. */
.sc-grid.sc-filter {
  --sc-min: 150px;
  --sc-a: calc((100% - var(--n) * 1px) / var(--n));
  --sc-b: calc(100% / (var(--n) / 2 + 0.9));
  display: flex;
  flex-wrap: wrap;
}
.sc-grid.sc-filter > .sc { flex: 1 1 max(var(--sc-a), min(max(var(--sc-min), var(--sc-b)), (var(--sc-min) - var(--sc-a)) * 100000)); }

/* ── F · environment switcher (the badge opens a menu; each option is a link to the other admin) */
.env-switch { cursor: pointer; font: inherit; }
.env-switch .env-chev { width: 14px; height: 14px; margin-left: 2px; opacity: 0.75; }
.env-menu { position: fixed; inset: auto; margin: 0; top: 58px; width: 360px; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-2); }
.env-menu-h { margin: 2px 6px 8px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); }
.env-opt { display: grid; grid-template-columns: 12px 1fr auto; align-items: start; gap: 10px; padding: 10px; border-radius: var(--r-sm); color: inherit; text-decoration: none; }
.env-opt:hover { background: var(--surface-sunk); }
.env-opt.on { background: var(--accent-soft); }
.env-opt b { display: block; font-size: 13.5px; }
.env-opt small { display: block; color: var(--ink-2); font-size: 12px; }
.env-opt code { display: block; margin-top: 3px; font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); word-break: break-all; }
.env-dot { width: 10px; height: 10px; margin-top: 4px; border-radius: 50%; }
.env-opt.staging .env-dot { background: repeating-linear-gradient(135deg, oklch(80% 0.15 85) 0 3px, oklch(25% 0.02 268) 3px 6px); }
.env-opt.production .env-dot { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.env-check { width: 16px; height: 16px; color: var(--accent); margin-top: 2px; }
.env-menu-foot { margin: 8px 6px 2px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--ink-3); line-height: 1.45; }
.env-menu-foot code { font-family: var(--font-mono); }

/* ── the server's shell: what the real build adds to F's frame (#565) ──────────────────────────── */
/* An unset or unknown ENVIRONMENT fails closed: a loud band and badge, never a guess. */
.app[data-env='unknown'] .env-band { height: 5px; background: repeating-linear-gradient(135deg, oklch(56% 0.2 25) 0 10px, oklch(18% 0.03 268) 10px 20px); }
.env-badge.unknown {
  padding: 0 12px;
  background: oklch(18% 0.03 268);
  color: oklch(95% 0.03 25);
  border: 2px solid oklch(60% 0.2 25);
  box-shadow: 0 0 0 3px oklch(55% 0.2 25 / 0.25);
}
.env-badge.unknown span { opacity: 0.8; }
/* The environment menu (#568). With the page script blocked it still opens (Popover API); it sits
   under the badge by CSS anchor positioning, or at the top bar's right end where that is missing. */
.env-menu { right: 16px; max-width: calc(100vw - 24px); }
@supports (position-anchor: --a) {
  .env-switch { anchor-name: --env-badge; }
  .env-menu { position-anchor: --env-badge; top: calc(anchor(bottom) + 8px); right: auto; left: clamp(12px, calc(anchor(center) - 180px), calc(100vw - 372px)); }
}
.env-opt.off { color: var(--ink-2); }
.env-opt-why { margin-top: 3px; color: var(--bad) !important; font-weight: 550; }
.env-opt-note { margin: 0 6px 4px; padding: 10px; border-radius: var(--r-sm); background: var(--bad-soft); color: var(--ink); font-size: 12.5px; line-height: 1.45; }
.env-opt-note code { font-family: var(--font-mono); }
/* The search trigger is a link to Customers until search lands (#580). */
a.search-trigger { text-decoration: none !important; }
/* The theme switch and the collapse control are forms: they work with the page script blocked. */
form.theme-switch, .side-foot form { margin: 0; }
.side-foot form { display: grid; }
.theme-switch button:disabled, .collapse:disabled { cursor: not-allowed; opacity: 0.5; }
.new-sale[aria-current='page'] { box-shadow: 0 0 0 2px oklch(82% 0.13 86), 0 6px 18px -10px oklch(10% 0.1 268 / 0.7); }
.who-text b { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app.collapsed .brand-link { justify-content: center; padding-inline: 0; }

/* ── today's page markup, until each page is restyled (#565: "keep their current content") ───── */
/* Old pages print plain h1/h2, tables, fieldsets and bare inputs. These rules make that
   markup read in F's tokens; a restyled page uses F's components and is not touched by them. */
:where(.content) > h1, :where(.content) > .page-h1 { font-family: var(--font-display); font-weight: 400; font-size: 40px; line-height: 1.08; letter-spacing: -0.012em; text-wrap: balance; }
:where(.content) h1 code { font-family: var(--font-mono); font-size: 0.45em; vertical-align: middle; color: var(--ink-2); }
:where(.content) h2 { font-family: var(--font-display); font-weight: 400; font-size: 26px; line-height: 1.15; margin: 0; }
:where(.content) h3 { font-size: 15px; font-weight: 600; margin: 0; }
:where(.content) section { display: grid; gap: 12px; min-width: 0; }
:where(.content) section > h2 { margin-top: 6px; }
:where(.content) p { max-width: 100ch; }
:where(.content) small, .hint { color: var(--ink-3); font-size: 12.5px; }
p.hint { font-size: 13.5px; color: var(--ink-2); }
:where(.content) code { font-size: 0.92em; }
:where(.content) ul:not([class]), :where(.content) ol:not([class]) { margin: 0; padding-left: 20px; display: grid; gap: 4px; }

:where(.content) table:not(.table) {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
:where(.content) table:not(.table) th { text-align: left; font-size: 12px; font-weight: 550; color: var(--ink-3); padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
:where(.content) table:not(.table) td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
:where(.content) table:not(.table) tbody tr:last-child td { border-bottom: 0; }
:where(.content) table:not(.table) tbody tr:hover td { background: color-mix(in oklch, var(--accent-soft) 38%, transparent); }
:where(.content) table:not(.table) :is(td, th).num { text-align: right; font-variant-numeric: tabular-nums; }
:where(.content) table:not(.table) tr:target td { background: var(--gold-soft); }
table.audit td { vertical-align: top; }

/* Contract statuses (today's `<span class="status status-…">`) read as F's pills. */
.status { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; margin-right: 6px; border-radius: 999px; font-size: 12px; font-weight: 560; white-space: nowrap; vertical-align: middle; }
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.status-active { background: var(--ok-soft); color: var(--ok); }
.status.status-past_due { background: var(--bad-soft); color: var(--bad); }
.status.status-revoked { background: var(--mute-soft); color: var(--ink-3); }
.status-past_due, .error { color: var(--bad); }
.status-revoked { color: var(--ink-3); }

p.flash { color: var(--ink); }
p.flash::before { content: '✓'; color: var(--ok); font-weight: 700; }
.banner.error { background: var(--bad-soft); color: var(--ink); border: 1px solid color-mix(in oklch, var(--bad) 30%, transparent); box-shadow: inset 3px 0 0 var(--bad); }
.warning { padding: 11px 15px; border-radius: 12px; background: var(--warn-soft); color: var(--ink); border: 1px solid color-mix(in oklch, var(--warn) 35%, transparent); box-shadow: inset 3px 0 0 var(--warn); font-size: 13.5px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* forms */
:where(.content) fieldset { margin: 0 0 16px; padding: 16px 22px 18px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-1); min-width: 0; }
:where(.content) fieldset fieldset { box-shadow: none; background: var(--surface-2); }
:where(.content) legend { padding: 0 6px; margin-left: -6px; font-size: 14px; font-weight: 600; color: var(--ink); }
:where(.content) fieldset.invalid, form.danger fieldset { border-color: color-mix(in oklch, var(--bad) 45%, var(--line)); }
form.danger fieldset { background: linear-gradient(180deg, color-mix(in oklch, var(--bad-soft) 70%, var(--surface)), var(--surface) 70%); }
:where(.content) :is(input:not([type='checkbox'], [type='radio'], [type='hidden'], [type='file']), select, textarea):not(.control *, .search-field *) {
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  min-width: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}
:where(.content) textarea:not(.control *) { height: auto; min-height: 80px; padding: 10px 12px; }
:where(.content) :is(input, select, textarea):not(.control *, .search-field *):focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 20%, transparent); }
:where(.content) input[type='file'] { font-size: 13px; }
:where(.content) :is(input[type='checkbox'], input[type='radio']) { width: 16px; height: 16px; accent-color: var(--accent); vertical-align: -3px; margin: 0 6px 0 0; }
:where(.content) label:has(> input[type='checkbox']) { display: inline-flex; align-items: center; gap: 2px; cursor: pointer; }
form.inline, form.search { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
form.search input[type='search'] { width: min(340px, 100%); }
:where(.content) :is(button:not([class]), a.button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 560;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none !important;
  box-shadow: var(--shadow-1);
  transition: background 0.15s, border-color 0.15s;
}
:where(.content) :is(button:not([class]), a.button):hover { background: var(--surface-2); border-color: var(--ink-3); }
:where(.content) button[type='submit']:not([class]) { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
:where(.content) button[type='submit']:not([class]):hover { background: var(--accent-hover); }
form.danger button[type='submit']:not([class]) { background: var(--bad); color: oklch(100% 0 0); }

/* facts and headlines */
:where(.content) dl:not([class]) { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 9px 14px; margin: 0; font-size: 13.5px; }
:where(.content) dl:not([class]) dt, dl.facts dt { color: var(--ink-3); font-size: 12.5px; padding-top: 1px; }
:where(.content) dl:not([class]) dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
dl.facts { grid-template-columns: 180px minmax(0, 1fr); gap: 9px 14px; }
dl.headline { display: flex; flex-wrap: wrap; gap: 14px 48px; margin: 0; }
dl.headline > div { display: grid; gap: 4px; }
dl.headline dt { font-size: 12.5px; color: var(--ink-3); }
dl.headline dd { margin: 0; font-family: var(--font-display); font-size: 30px; line-height: 1.1; font-variant-numeric: tabular-nums; }
ul.retire { display: block; list-style: none; padding: 0; margin: 0; columns: 3; }

/* ── F · shared list parts (#567): the pager's gap, the row ⋯ menu, the bulk bar, the search bar ─ */
.pg.gap { width: 20px; color: var(--ink-3); }
.table-foot nav.pager { flex-wrap: wrap; }
/* The row ⋯ menu: a Popover API menu, `position: absolute` so it scrolls with the page. With no script
   it opens where it sits in the row (its static position, nudged to end under the button); the script
   places it beside the button, above it when there is no room below. */
.row-menu-wrap { position: relative; z-index: 2; display: inline-grid; }
.row-menu-btn {
  all: unset;
  cursor: pointer;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: var(--ink-3);
  transition: background 0.15s, color 0.15s;
}
.row-menu-btn:hover, .row-menu-btn:focus-visible { background: var(--surface-sunk); color: var(--ink); }
.row-menu-btn:focus-visible { outline: 2px solid var(--focus); }
.row-menu {
  position: absolute;
  inset: auto;
  margin: 0;
  translate: calc(-100% + 30px) 34px;
  width: 280px;
  max-width: calc(100vw - 24px);
  padding: 6px;
  border-radius: 13px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-2);
  font-size: 13.5px;
}
.row-menu[data-placed] { translate: none; }
.row-menu ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.row-menu li + li:has(> .rm-form.confirm), .row-menu li:has(> .rm-form.confirm) + li { border-top: 1px solid var(--line); padding-top: 1px; }
.rm-item {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none !important;
  line-height: 1.35;
}
.rm-item .ic { flex: none; width: 15px; height: 15px; margin-top: 1px; color: var(--ink-3); }
.rm-item:hover, .rm-item:focus-visible { background: var(--accent-soft); }
.rm-item:hover .ic { color: var(--accent); }
.rm-item:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.rm-item.danger, .rm-item.danger .ic { color: var(--bad); }
.rm-item.danger:hover { background: var(--bad-soft); }
.rm-item > span { display: grid; min-width: 0; }
.rm-value { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); word-break: break-all; user-select: all; }
.rm-item.copied .ic { color: var(--ok); }
.rm-form { margin: 0; display: grid; gap: 2px; padding: 4px 0; }
.rm-confirm { display: flex; align-items: flex-start; gap: 8px; padding: 6px 10px 2px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; line-height: 1.4; }
.rm-confirm input { flex: none; width: 15px; height: 15px; margin: 1px 0 0; accent-color: var(--accent); }
.rm-form.confirm .rm-item { font-weight: 600; color: var(--accent); }
.rm-form.confirm .rm-item .ic { color: var(--accent); }
@starting-style { .row-menu:popover-open { opacity: 0; } }
.att-row .row-menu-wrap { align-self: center; }

/* The bulk bar: one plain form. With no script it is always shown; the script hides it until a
   row is ticked (`data-empty`) and writes the count. */
.bulk-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin: 0 0 14px;
  padding: 10px 12px 10px 16px;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line, var(--line-strong));
  font-size: 13.5px;
}
.bulk-bar[data-empty] { display: none; }
.bulk-count { color: var(--ink-2); }
.bulk-count b { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }
.bulk-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.bulk-check { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; vertical-align: middle; position: relative; z-index: 2; }
.bulk-report { display: grid; gap: 8px; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-1); }
.bulk-report.ok { border-color: color-mix(in oklch, var(--ok) 30%, transparent); background: var(--ok-soft); }
.bulk-report.mixed { border-color: color-mix(in oklch, var(--warn) 35%, transparent); background: var(--warn-soft); }
.bulk-report.bad { border-color: color-mix(in oklch, var(--bad) 30%, transparent); background: var(--bad-soft); }
.bulk-report-head { display: flex; align-items: center; gap: 8px; font-weight: 550; }
.bulk-report.ok .bulk-report-head .ic { color: var(--ok); }
.bulk-report:not(.ok) .bulk-report-head .ic { color: var(--warn); }
.bulk-report ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.bulk-report li { display: grid; grid-template-columns: 16px minmax(140px, auto) minmax(0, 1fr); gap: 8px; align-items: baseline; }
.bulk-report li .ic { width: 14px; height: 14px; align-self: center; }
.bulk-report li.done .ic { color: var(--ok); }
.bulk-report li.refused .ic { color: var(--bad); }
.bulk-report-why { color: var(--ink-2); }

/* The search bar: a GET form; its Search button is for the no-script path (Enter also submits). */
.search-bar { display: flex; align-items: center; gap: 8px; margin: 0; }
.search-bar[data-live] .search-go { display: none; }
.page-head .search-bar { align-self: flex-end; }

/* ── F · the contract page (#573): headline + Agreement gantt, the two paged lists, bulk, danger zone ─ */
.contract-f { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.contract-f section.card:not(.headline), .contract-f .danger-zone, .contract-f .ctl-section { display: block; }
.contract-f .table td.tnum { white-space: nowrap; }
.contract-f .audit .detail { overflow-wrap: anywhere; }
.contract-f .audit td:last-child { max-width: 520px; }
.contract-f .list-card .filter-bar { justify-content: space-between; }
.contract-f .list-card .table-foot { margin-top: 10px; }
.contract-f .row-actions { width: 38px; text-align: right; }
.contract-f .table td.sr-col, .contract-f .table th.sr-col { width: 28px; padding-right: 0; }
.contract-f .headline .hl-value .pill { height: 30px; padding: 0 14px; font-size: 14px; }
.contract-f .err { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--bad); font-weight: 500; margin: 6px 0 0; }
.contract-f .err .ic { width: 14px; height: 14px; }
.contract-f .stack-sm { display: grid; gap: 14px; min-width: 0; }
.contract-f .drawer-body fieldset.retire { margin: 0; padding: 14px 16px; box-shadow: none; background: var(--surface); }
.contract-f .drawer-body .gate-row { margin-top: 0; }
.contract-f .alloc-panel { margin-top: 16px; padding: 16px 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); display: grid; gap: 10px; }
.contract-f .alloc-panel .card-bar { margin-bottom: 0; }

/* The Agreement gantt (C's, in F's tokens — prototypes/…/f-desk/customer.css), server-rendered SVG. */
.tl-scroll { padding: 6px 0 4px; overflow-x: auto; }
.tl { display: block; width: 100%; min-width: 560px; height: auto; overflow: visible; font-family: var(--font-ui); }
.tl text { fill: var(--ink-2); font-size: 11.5px; }
.tl-empty { padding: 26px; text-align: center; color: var(--ink-3); }
.tl .tl-lane-label { fill: var(--ink); font-size: 12.5px; font-weight: 600; font-family: var(--font-mono); }
.tl .tl-lane-label.strong { font-weight: 750; fill: var(--accent); }
.tl .tl-tick { stroke: var(--line); }
.tl .tl-tick-label { fill: var(--ink-3); font-size: 11px; }
.tl .tl-tick-label.yr { fill: var(--ink); font-weight: 700; }
.tl .tl-today { stroke: var(--accent); stroke-width: 2; }
.tl .tl-today-label { fill: var(--accent); font-weight: 700; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; }
.tl .tl-end-rule { stroke: var(--gold); stroke-width: 1.6; stroke-dasharray: 5 4; }
.tl .tl-end-label { fill: var(--gold-ink); font-weight: 700; font-size: 11.5px; }
.tl .tl-note { font-size: 10.5px; font-weight: 600; fill: var(--ink-2); }
.tl-mk { cursor: pointer; outline: none; color: var(--accent); }
.tl-mk .tl-span { fill: currentColor; opacity: 0.85; transition: opacity 0.15s; }
.tl-mk .tl-fill { fill: currentColor; }
.tl-mk .tl-hollow { fill: var(--surface); stroke: currentColor; stroke-width: 2; }
.tl-mk:hover .tl-span, .tl-mk:focus-visible .tl-span { opacity: 1; }
.tl-mk:hover, .tl-mk:focus-visible { filter: drop-shadow(0 0 4px color-mix(in oklch, currentColor 55%, transparent)); }
.tl-mk:focus-visible .tl-span { stroke: var(--focus); stroke-width: 2; }
.tl .tone-ok, .tl-legend .tone-ok { color: var(--ok); }
.tl .tone-warn, .tl-legend .tone-warn { color: var(--warn); }
.tl .tone-bad, .tl-legend .tone-bad { color: var(--bad); }
.tl .tone-pending, .tl-legend .tone-pending { color: var(--accent); }
.tl .tone-eval, .tl-legend .tone-eval { color: var(--ink-3); }
.tl .tone-pending .tl-span { opacity: 0.45; }
.tl .tone-eval .tl-span { opacity: 0.5; }
.tl-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 8px 0 0; margin-top: 4px; font-size: 11.5px; color: var(--ink-3); }
.tl-legend span { display: inline-flex; align-items: center; gap: 7px; }
.tl-legend .lg { display: inline-block; flex: none; }
.tl-legend .lg.bar { width: 20px; height: 8px; border-radius: 4px; background: currentColor; }
.tl-legend .lg.bar.tone-pending { opacity: 0.5; }
.tl-legend .lg.bar.tone-eval { opacity: 0.55; }
.tl-legend .lg.dia { width: 8px; height: 8px; border-radius: 1.5px; background: currentColor; transform: rotate(45deg); margin: 0 1px; }
.tl-legend .lg.dia.hollow { background: transparent; box-shadow: inset 0 0 0 1.6px currentColor; }
.tl-legend .lg.today { width: 2px; height: 12px; background: var(--accent); }
.headline .hl-timeline { grid-column: 1 / -1; margin: 0; border-top: 1px solid var(--line); padding-top: 10px; }
.headline .hl-timeline .hl-note { border-top: 0; padding-top: 6px; }

/* A row ⋯ menu's optional free-text field (RowMenu `text`, #573: a Release's reason). */
.rm-text { display: grid; gap: 4px; padding: 6px 10px 2px; font-size: 12.5px; color: var(--ink-2); }
.rm-text input { height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-size: 13px; }

/* The Seat Slots' bulk bar: the typed gate and the reason on one row, the retire terms on demand. */
.bulk-bar .bulk-gate { flex: 1 1 100%; order: 2; margin-top: 0; }
.bulk-bar .bulk-gate .field { flex: 1 1 260px; max-width: 420px; }
.bulk-bar .bulk-terms { flex: 1 1 100%; order: 3; }
.bulk-bar .bulk-terms > summary { cursor: pointer; display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 550; color: var(--ink-2); }
.bulk-bar .bulk-terms[open] { display: grid; gap: 10px; }
.bulk-bar .bulk-terms .hint { max-width: 90ch; }
.bulk-bar .bulk-err { flex: 1 1 100%; order: 1; }

/* The garnet danger zone (story 62): the typed-label acts, each its own card. */
.danger-zone { padding: 18px 20px 20px; border-radius: var(--r-lg); border: 1px solid color-mix(in oklch, var(--bad) 35%, var(--line)); background: color-mix(in oklch, var(--bad-soft) 35%, transparent); }
.danger-zone .danger-head { display: grid; gap: 4px; margin-bottom: 14px; }
.danger-zone .danger-head .section-title { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--bad); }
.danger-zone .danger-head .section-title .ic { width: 22px; height: 22px; }
.danger-zone .danger-head p { color: var(--ink-2); font-size: 13.5px; }
.danger-zone .danger-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.danger-zone .ctl.danger { grid-column: auto; }
.danger-zone .ctl.danger .gate-row { flex-wrap: wrap; }
@media (max-width: 1080px) { .danger-zone .danger-grid { grid-template-columns: minmax(0, 1fr); } }
/* ── F · the payment page, record payment, the callback review (#574) ───────────────────────────── */
/* Rendered `hidden` and revealed by the page script (with no script it would mislead): a component's
   own `display` (`.remainder`'s grid, `.fill`'s `all: unset`) must not show it early. */
[data-needs-script][hidden] { display: none !important; }
/* An error line outside a `.field` (the method cards, Verify). */
.err.method-err, .verify > .err { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--bad); font-weight: 500; }
.err.method-err { margin: -8px 0 14px; }
.err .ic { width: 14px; height: 14px; }
/* Record payment: the Virtual Account belongs to Midtrans only — with no script too (`:has`), unless it
   carries the server's refusal (then it stays, so the refusal is seen). */
.record-form:has(input[name='method']:checked:not([value='midtrans'])) .va-only:not(:has(.field.invalid)) { display: none; }
.lede .method { font-weight: 550; color: var(--ink); }
.head-actions .pill { height: 26px; }
/* Proof cards (F's proofs.css): a tile, the file, its ⋯ menu (Open · Download · Remove). */
.proofs .count.is-full { background: var(--warn-soft); color: var(--warn); }
.proofs .banner { margin: 0 0 12px; }
.proof-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.proof {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 2px 12px;
  padding: 10px; border: 1px solid var(--line); border-radius: var(--r-sm, 10px); background: var(--surface-2);
  transition: border-color 0.15s;
}
.proof:hover { border-color: var(--line-strong); }
.proof-tile {
  width: 44px; height: 44px; border-radius: 8px; display: grid; place-items: center; align-content: center; gap: 1px;
  overflow: hidden; border: 1px solid var(--line); background: var(--surface);
}
.proof-tile .ic { width: 16px; height: 16px; }
.proof-tile b { font-size: 9.5px; font-weight: 650; letter-spacing: 0.04em; }
.proof-tile.t-pdf { color: var(--bad); background: var(--bad-soft); border-color: color-mix(in oklch, var(--bad) 25%, transparent); }
.proof-tile.t-img { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }
.proof-what { min-width: 0; display: grid; gap: 2px; }
.proof-name { font-size: 13.5px; font-weight: 550; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proof-meta { font-size: 12px; color: var(--ink-3); overflow-wrap: anywhere; }
.proof-by { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proof-acts { align-self: start; }
/* #763: the payment page's refunds — one block each, no file tile */
.refund-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.refund { display: grid; gap: 3px; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-sm, 10px); background: var(--surface-2); }
.refund .rf-head { font-size: 13.5px; color: var(--ink); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.refund .rf-meta { font-size: 12px; color: var(--ink-3); overflow-wrap: anywhere; }
.refund form { display: grid; gap: 8px; margin-top: 6px; }
.refund form .btn { justify-self: start; }
.led-refund td, .led-refund th { font-size: 12.5px; }
.attach { display: grid; gap: 8px; margin-top: 12px; }
.attach .btn { justify-self: start; }
.dropzone {
  position: relative; display: grid; justify-items: center; gap: 4px; margin: 12px 0 0; padding: 16px 14px;
  border: 1.5px dashed var(--accent-line); border-radius: var(--r-md, 12px); background: color-mix(in oklch, var(--accent-soft) 45%, transparent);
  text-align: center; cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.attach .dropzone { margin: 0; }
.dropzone:hover { background: var(--accent-soft); border-color: var(--accent); }
.dropzone:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.dropzone input[type='file'] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.dropzone .dz-main { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); }
.dropzone .dz-main b { color: var(--accent); font-weight: 600; }
.dropzone .dz-main .ic { width: 17px; height: 17px; color: var(--accent); }
.dropzone .dz-sub { font-size: 12px; color: var(--ink-3); }
.dropzone.is-full { cursor: not-allowed; border-color: var(--line-strong); background: var(--surface-sunk); }
.dropzone.is-full .dz-main, .dropzone.is-full .dz-main b, .dropzone.is-full .dz-main .ic { color: var(--ink-3); }
.proof-note { display: flex; gap: 8px; align-items: flex-start; margin: 12px 0 0; font-size: 12.5px; color: var(--ink-3); }
.proof-note .ic { width: 15px; height: 15px; flex: none; margin-top: 1px; }
/* The side cards' facts at F's width (the old pages' `dl.facts` rule above is wider). */
:is(#facts, #callback-facts) > dl.facts { grid-template-columns: 112px minmax(0, 1fr); gap: 11px 14px; }
.attach [data-attach-submit][hidden] { display: none; }
#allocations .table td { white-space: nowrap; }
/* A fully allocated payment: the form folds away (a withholding-only row is still possible). */
.alloc-more { margin-top: 14px; }
.alloc-more > summary { cursor: pointer; font-size: 13px; color: var(--ink-3); width: fit-content; }
.alloc-more > summary:hover { color: var(--accent); }
.alloc-more[open] > summary { margin-bottom: 4px; }
/* The callback review: the act cards' Midtrans link; the picker's search across the card. */
.act .ext { display: inline-flex; align-items: center; gap: 5px; color: var(--accent); font-weight: 550; }
.act .ext .ic { width: 14px; height: 14px; }
.pick .search-bar { margin: 14px 0; }
.pick .search-bar .search-field { width: 100%; height: 46px; }
.pick .empty-line { margin-top: 0; }

/* ── #572 New sale / New contract as F's steps ─────────────────────────────────────────────────
   One form, one Save. Without the script every step is on the page, stacked, and the stepper's items
   are in-page links; the script sets [data-stepped] and shows one step at a time. */
.stepper a { display: contents; color: inherit; text-decoration: none; }
.step-n .step-done { display: none; }
.stepper li.done .step-n .step-num { display: none; }
.stepper li.done .step-n .step-done { display: block; }
.wizard:not([data-stepped]) .wiz-step + .wiz-step { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.wiz-foot [hidden] { display: none; }
.type-pick .err { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--bad); font-weight: 500; }
/* A refused amount / TOP stays visible under an Evaluation, so its message can be read. */
.wizard:has(input[name='agreement_type'][value='evaluation']:checked) .commercial-only:has(.field.invalid) { display: block; }
/* The vault's Reveal is a checkbox label: CSS alone unblurs the key, with or without the script. */
.vault-toggle { position: absolute; opacity: 0; pointer-events: none; }
.vault-key:has(.vault-toggle:checked) code { filter: none; }
.vault-key:has(.vault-toggle:checked) .vault-reveal { display: none; }
.vault-key:has(.vault-toggle:focus-visible) .vault-reveal { outline: 2px solid oklch(84% 0.13 86); }
.vault-key:has(.vault-toggle:checked:focus-visible) { outline: 2px solid oklch(84% 0.13 86); } /* revealed: the label is gone, so the slab shows focus */
.vault-gone { margin: 0; color: oklch(86% 0.03 268); font-size: 14px; }

/* @dark — every dark-theme rule, and only them (see the header). */
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: oklch(15.2% 0.028 268);
  --bg-glow: oklch(30% 0.1 268 / 0.42);
  --surface: oklch(19.2% 0.033 268);
  --surface-2: oklch(21.8% 0.036 268);
  --surface-sunk: oklch(16.8% 0.03 268);
  --line: oklch(27.5% 0.04 268);
  --line-strong: oklch(35% 0.05 268);
  --ink: oklch(94.5% 0.012 268);
  --ink-2: oklch(80% 0.022 268);
  --ink-3: oklch(66% 0.03 268);
  --accent: oklch(74% 0.135 271);
  --accent-hover: oklch(80% 0.12 271);
  --accent-ink: oklch(17% 0.05 268);
  --accent-soft: oklch(28% 0.075 268);
  --accent-line: oklch(46% 0.12 268);
  --gold: oklch(81% 0.125 86);
  --gold-soft: oklch(27% 0.045 80);
  --gold-ink: oklch(86% 0.11 86);
  --ok: oklch(79% 0.13 162);
  --ok-soft: oklch(26% 0.05 165);
  --warn: oklch(82% 0.13 76);
  --warn-soft: oklch(27% 0.05 70);
  --bad: oklch(74% 0.155 20);
  --bad-soft: oklch(26.5% 0.06 20);
  --mute-soft: oklch(25% 0.025 268);
  --sidebar-bg: oklch(12.4% 0.027 268);
  --sidebar-bg-2: oklch(11% 0.024 268);
  --sidebar-ink: oklch(92% 0.016 268);
  --sidebar-ink-2: oklch(65% 0.035 268);
  --sidebar-hover: oklch(18.5% 0.04 268);
  --sidebar-active: oklch(22.5% 0.065 268);
  --sidebar-line: oklch(21% 0.035 268);
  --new-bg: oklch(74% 0.135 271);
  --new-ink: oklch(16% 0.05 268);
  --shadow-1: inset 0 1px 0 oklch(100% 0 0 / 0.035);
  --shadow-2: inset 0 1px 0 oklch(100% 0 0 / 0.05), 0 24px 50px -20px oklch(0% 0 0 / 0.7);
  --focus: oklch(78% 0.14 271);
  --scrim: oklch(5% 0.02 268 / 0.62);
}

:root[data-theme='dark'] .env-badge.staging { background: oklch(30% 0.06 72); color: oklch(90% 0.11 85); border-color: oklch(55% 0.12 75); }
:root[data-theme='dark'] .theme-switch button[aria-pressed='true'] { background: var(--surface-2); }
:root[data-theme='dark'] .chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
:root[data-theme='dark'] .btn-danger:not(:disabled) { color: oklch(18% 0.04 20); }
:root[data-theme='dark'] .explainer { background: var(--surface-2); }
:root[data-theme='dark'] .row-menu { background: var(--surface-2); }
:root[data-theme='dark'] .avatar { background: oklch(31% 0.065 var(--h)); color: oklch(89% 0.07 var(--h)); }
:root[data-theme='dark'] .segmented a.on { background: var(--surface-2); }
:root[data-theme='dark'] .control { background: var(--surface-sunk); }
:root[data-theme='dark'] .type-opt > span { background: var(--surface-sunk); }
:root[data-theme='dark'] .drawer-body { background: var(--surface-sunk); }
:root[data-theme='dark'] .eq-term { background: var(--surface-sunk); }
:root[data-theme='dark'] .remainder { background: var(--surface-sunk); }
:root[data-theme='dark'] .rem-bar { background: var(--line); }
:root[data-theme='dark'] .alloc-row.is-paid { background: var(--surface-sunk); }
:root[data-theme='dark'] .jp-node { background: var(--surface-sunk); }
:root[data-theme='dark'] .rem.late .tk.now { color: oklch(18% 0.04 20); }
:root[data-theme='dark'] .rem-mark { background: var(--surface-sunk); }
:root[data-theme='dark'] .palette { background: var(--surface-2); }
:root[data-theme='dark'] :where(.content) :is(input:not([type='checkbox'], [type='radio'], [type='hidden'], [type='file']), select, textarea):not(.control *, .search-field *) { background: var(--surface-sunk); }
/* #581 Settings: the review dialog on the dark surfaces */
:root[data-theme='dark'] .apply-dlg { background: var(--surface-2); border: 1px solid var(--line-strong); }
:root[data-theme='dark'] .apply-body textarea { background: var(--surface-sunk); }
:root[data-theme='dark'] .apply-foot { background: var(--surface); }
/* #578 the Dashboard's chart tokens and step line */
:root[data-theme='dark'] { --m-bank: oklch(56% 0.1 262); --ghost-fill: oklch(74% 0.135 271 / 0.06); }
:root[data-theme='dark'] .ch-step { stroke: oklch(70% 0.09 271); }
/* #579 the aging card's deepest red */
:root[data-theme='dark'] { --deep: oklch(58% 0.19 18); }
/* @end-dark */

/* ── #575 Reminders due as F: the row's ⋯ menu column, its error line, the filters ───────────── */
.rem-card { display: block; padding-bottom: 10px; } /* a block, not the legacy `.content section` grid */
.rem-card > .rem-group:first-child { margin-top: 4px; }
.rem-filters { margin-bottom: 0; }
.rem { grid-template-columns: 140px minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 236px) auto 30px; }
.rem .rem-mark { margin: 0; }
.rem-error { grid-column: 1 / -1; margin: -6px 0 0; font-size: 12.5px; font-weight: 500; }
@media (max-width: 1240px) {
  .rem { grid-template-columns: 140px minmax(0, 1fr) minmax(0, 1fr) 30px; }
  .rem .rem-send { grid-column: 2; }
  .rem .rem-mark { grid-column: 3; justify-self: start; }
  .rem .row-menu-wrap { grid-column: 4; grid-row: 1; }
}
@media (max-width: 820px) {
  .rem { grid-template-columns: minmax(0, 1fr) 30px; }
  .rem > :not(.row-menu-wrap) { grid-column: 1; }
  .rem .row-menu-wrap { grid-column: 2; grid-row: 1; }
}

/* ── #569 Customers as F: the money columns, the bulk + ⋯ columns, the export ───────────────── */
.cust-card { display: block; } /* a block, not the legacy `.content section` grid */
.cust-card .bulk-bar { margin-bottom: 12px; }
.cust-table .bulk-col { width: 28px; padding-right: 0; }
.cust-table .menu-col { width: 36px; text-align: right; padding-left: 4px; }
.cust-table td.menu-col .row-menu-wrap { vertical-align: middle; }
.money.owed { display: inline-flex; flex-direction: column; align-items: flex-end; line-height: 1.2; color: var(--gold-ink); font-weight: 550; }
.money.owed small { font-size: 11px; font-weight: 600; letter-spacing: 0.01em; }
.money.owed-bad { color: var(--bad); }
#customers-export .btn[aria-disabled='true'] { opacity: 0.45; cursor: not-allowed; }
.cust-table .pill-row { flex-wrap: nowrap; }
.cust-table td[data-col='last-payment'] { white-space: nowrap; }

/* ── #570 The customer page as F: six scorecards, "Contracts on time", the two paged tables ──── */
#contracts.card, #payments.card, #timeline.card, #activity.card, #callbacks.callout { display: block; } /* blocks, not the legacy `.content section` grid */
.sc-grid.sc-six { margin-bottom: 20px; }
@media (max-width: 1640px) { .sc-grid.sc-six { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .sc-grid.sc-six { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
#callbacks.callout { margin-bottom: 20px; }
.tl-card { margin-bottom: 20px; }
.tl-card .tl-scroll { padding: 6px 0 4px; }
.tl.tl-customer { min-width: 760px; }
.tl .tl-lane { stroke: var(--line-strong); stroke-dasharray: 2 5; }
.tl .tl-lane-label.st-past_due { fill: var(--bad); }
.tl .tl-lane-label.st-revoked { fill: var(--ink-3); }
.tl .tl-revoked { fill: var(--bad); opacity: 0.1; }
.tl .tl-note.bad { fill: var(--bad); }
.tl .tone-gold, .tl-legend .tone-gold { color: var(--gold); }
.tl-mk:focus-visible .tl-fill { stroke: var(--focus); stroke-width: 2; }
.tl-legend .lg.drop { width: 9px; height: 9px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: currentColor; }
.tl-card .tl-legend { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 6px; }
#contracts .filter-bar, #payments .filter-bar { margin-bottom: 12px; }
#contracts .menu-col, #payments .menu-col { width: 36px; text-align: right; padding-left: 4px; }
#payments .va-under { margin-top: 4px; }
#payments .alloc-line { min-width: 180px; white-space: normal; } /* the side feed leaves the table ~600 px: let "to #n of …" wrap rather than scroll the ⋯ away */

#activity .feed-all { margin: 4px 0 0; font-size: 13px; }
#activity .feed-all a { display: inline-flex; align-items: center; gap: 4px; }
#activity .feed-all .ic { width: 14px; height: 14px; }
#callbacks.callout h2 { font-family: var(--font-ui); }
#payments td .method.block { display: flex; margin-top: 3px; font-size: 12px; color: var(--ink-3); gap: 5px; }
#payments td .method.block .ic { width: 13px; height: 13px; }

/* ── #571 Edit details: the form, "What will change", the rename confirm, the dialog ─────────────── */
.edit-card { display: block; max-width: 920px; }
.edit-card > .banner, .edit-card > .flash { margin: 0 0 16px; }
.edit-card .card-title { margin-bottom: 14px; }
.edit-card .edit-sub { margin-top: 24px; }
.edit-card .edit-wide { grid-column: 1 / -1; }
.edit-card textarea { width: 100%; min-height: 64px; resize: vertical; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); font: inherit; font-size: 14px; color: var(--ink); }
.edit-card textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 20%, transparent); }
.edit-diff { margin-top: 20px; padding: 12px 16px; border: 1px dashed var(--line-strong); border-radius: 12px; background: var(--surface-2); }
.edit-diff[hidden], .edit-rename[hidden], .edit-card .form-foot [hidden] { display: none; }
.edit-diff .sum-sub { margin: 0 0 6px; }
.diff-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 13.5px; }
.diff-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.diff-list b { min-width: 120px; font-weight: 600; color: var(--ink-2); }
.edit-card del { color: var(--ink-3); text-decoration-color: color-mix(in oklch, var(--bad) 60%, transparent); }
.edit-card ins { text-decoration: none; color: var(--ink); font-weight: 600; background: var(--ok-soft); padding: 0 4px; border-radius: 4px; }
.diff-table { margin-top: 2px; }
.diff-table th[scope='row'] { font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.edit-rename { display: grid; gap: 10px; }
.edit-rename p { margin: 0; }
.stale-typed b { font-weight: 600; }
.dialog { width: min(880px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1), 0 24px 64px rgb(0 0 0 / 0.28); overflow: auto; }
.dialog::backdrop { background: rgb(10 14 24 / 0.45); }
.dialog-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--line); background: var(--surface); }
.dialog-head h2 { font-family: var(--font-display); font-weight: 400; font-size: 26px; }
.dialog-head small { font-family: var(--font-ui); font-size: 14px; color: var(--ink-3); margin-left: 6px; }
.dialog-close { font-size: 20px; line-height: 1; }
.dialog .edit-card { max-width: none; border: 0; box-shadow: none; border-radius: 0; }
.dialog .edit-card .form-foot { position: sticky; bottom: -20px; }

/* ── #581 Settings: sections, fields with range + "changed", locked reminders, System / Access, the
   draft bar, the server-rendered review dialog (F's settings page) ─────────────────────────────── */
.set-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 28px; align-items: start; padding-bottom: 84px; margin-top: 18px; }
.set-nav { position: sticky; top: calc(var(--top-h) + 20px); display: grid; gap: 2px; }
.set-nav a { display: flex; align-items: flex-start; gap: 10px; padding: 8px 12px; border-radius: 9px; color: var(--ink-2); text-decoration: none; font-size: 13.5px; font-weight: 500; }
.set-nav a .ic { flex: none; width: 16px; height: 16px; margin-top: 2px; color: var(--ink-3); }
.set-nav a small { display: block; font-size: 11.5px; font-weight: 400; color: var(--ink-3); }
.set-nav a:hover { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.set-body { display: grid; gap: 18px; min-width: 0; }
.set-card { display: block; scroll-margin-top: calc(var(--top-h) + 20px); }
.set-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.set-head .card-title { margin: 0; }
.set-lede { margin: 4px 0 0; font-size: 13px; color: var(--ink-3); max-width: 64ch; }
.set-lede code { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-2); }
.set-sub { margin: 18px 0 10px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); }
.set-head + .set-sub { margin-top: 4px; }
.scope { display: inline-flex; align-items: center; gap: 6px; flex: none; padding: 3px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; font-family: var(--font-mono); background: var(--accent-soft); color: var(--accent); }
.scope .ic { width: 12px; height: 12px; }
.scope-ro { background: var(--mute-soft); color: var(--ink-2); font-family: var(--font-ui); }
.aud { display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 6px; font-size: 10.5px; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase; background: var(--mute-soft); color: var(--ink-3); vertical-align: 1px; }
.aud-cust { background: var(--warn-soft); color: var(--warn); }
.src { display: flex; align-items: flex-start; gap: 7px; margin: 16px 0 0; font-size: 12px; line-height: 1.5; color: var(--ink-3); max-width: 80ch; }
.src .ic { flex: none; width: 13px; height: 13px; margin-top: 3px; }
.src code { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-2); }
.set-footnote { margin: 0 4px; }
.set-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 22px; }
.set-field { position: relative; }
.set-field .unit { font-weight: 400; color: var(--ink-3); font-size: 12px; margin-left: 5px; }
.set-field .control input { font-variant-numeric: tabular-nums; }
.range { flex: none; padding: 0 10px; font-size: 11.5px; font-family: var(--font-mono); color: var(--ink-3); white-space: nowrap; }
.chg { display: none; margin-left: 8px; padding: 0 6px; border-radius: 5px; font-size: 10.5px; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; background: var(--accent-soft); color: var(--accent); vertical-align: 1px; }
.changed .chg { display: inline-block; }
.set-field.changed::before { content: ''; position: absolute; left: -11px; top: 2px; bottom: 2px; width: 3px; border-radius: 3px; background: var(--accent); }
.set-field.changed .control { border-color: var(--accent-line); }
.set-field.invalid .control { border-color: var(--bad); }
.protocol { margin-top: 20px; padding: 12px 14px; border-radius: 12px; background: var(--surface-sunk); border: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); }
.protocol h3 { display: flex; align-items: center; gap: 7px; margin: 0 0 4px; font-size: 12px; font-weight: 650; color: var(--ink-2); }
.protocol h3 .ic { width: 13px; height: 13px; color: var(--ink-3); }
.protocol p { margin: 0; line-height: 1.5; }
.rem-legal { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 10px; font-size: 12.5px; color: var(--ink-3); }
.rem-legal .ic { flex: none; width: 14px; height: 14px; margin-top: 2px; }
.rem-edits { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rem-edit { position: relative; display: grid; grid-template-columns: 28px 70px minmax(0, 1fr); align-items: center; gap: 12px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.rem-n { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--accent); font-size: 11.5px; font-weight: 700; color: var(--accent); }
.rem-days b { font-family: var(--font-mono); font-size: 13px; }
.rem-what { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; font-size: 13px; color: var(--ink-2); }
.rem-contract { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 1px 7px; border-radius: 99px; font-size: 11px; font-weight: 600; background: var(--mute-soft); color: var(--ink-2); }
.rem-contract .ic { width: 11px; height: 11px; }
.kv-list { margin: 0; display: grid; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.kv { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 16px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.kv:last-child { border-bottom: 0; }
.kv:nth-child(odd) { background: var(--surface-2); }
.kv dt { color: var(--ink-3); font-weight: 500; }
.kv dd { margin: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.kv code { font-family: var(--font-mono); font-size: 12px; overflow-wrap: anywhere; }
.secret { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); }
.secret .ic { width: 13px; height: 13px; }
.admin-cell { display: flex; align-items: center; gap: 12px; }
.admin-cell b { display: block; font-weight: 600; }
.you { font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; padding: 1px 6px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); margin-left: 4px; }
.dirty-bar { position: fixed; z-index: 20; left: calc(var(--sidebar-w) + 28px); right: 28px; bottom: 18px; display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--accent-line); box-shadow: var(--shadow-2); font-size: 13.5px; }
.collapsed .dirty-bar { left: calc(var(--rail-w) + 28px); }
.dirty-bar[data-dirty='no'] { border-color: var(--line); }
.dirty-bar[data-dirty='no'] b { font-weight: 500; color: var(--ink-3); }
.dirty-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.dirty-bar[data-dirty='no'] .dirty-dot { background: var(--line-strong); box-shadow: none; }
.flash.applied { margin-top: 14px; }
.flash.applied > span:first-of-type { flex: 1; }
.flash.applied .spacer { display: none; }
.flash.applied .undo-form { display: inline; margin: 0; }
/* The review dialog is rendered OPEN by the server (works with the script blocked); the script
   re-opens it modal. Non-modal, it is still centred over a scrim. */
.apply-scrim { position: fixed; inset: 0; z-index: 40; background: var(--scrim); backdrop-filter: blur(3px); }
.apply-dlg { width: min(820px, calc(100vw - 40px)); max-height: calc(100vh - 40px); padding: 0; border: 0; border-radius: 18px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-2), 0 30px 80px -20px oklch(0% 0 0 / 0.5); overflow: hidden; }
.apply-dlg[open]:not(:modal) { position: fixed; inset: 0; margin: auto; z-index: 41; }
.apply-dlg::backdrop { background: var(--scrim); backdrop-filter: blur(3px); }
.apply-box { display: flex; flex-direction: column; max-height: calc(100vh - 40px); }
.apply-env { display: flex; align-items: center; gap: 10px; padding: 12px 22px; font-size: 13px; letter-spacing: 0.08em; }
.apply-env b { font-weight: 800; }
.apply-env span { font-weight: 500; letter-spacing: 0.02em; }
.env-staging .apply-env { color: oklch(20% 0.03 80); background: repeating-linear-gradient(-45deg, oklch(82% 0.16 85) 0 14px, oklch(76% 0.16 80) 14px 28px); }
.env-staging .apply-env b, .env-staging .apply-env span { background: oklch(97% 0.03 90 / 0.92); padding: 2px 8px; border-radius: 6px; }
.env-production .apply-env { color: white; background: oklch(50% 0.2 25); }
.env-unknown .apply-env { color: white; background: oklch(35% 0.02 268); }
.apply-body { padding: 20px 22px 6px; overflow: auto; display: grid; gap: 16px; }
.apply-body h2 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 28px; line-height: 1.1; }
.apply-lede { margin: -8px 0 0; font-size: 13px; color: var(--ink-3); }
.apply-body .footnote { margin-top: 0; }
.diff td { vertical-align: top; }
.diff code.block { display: block; margin-top: 2px; font-family: var(--font-mono); font-size: 11px; }
.diff .aud { margin-left: 6px; }
.diff del { color: var(--ink-3); }
.diff ins { text-decoration: none; font-weight: 600; }
.diff .effect { font-size: 12.5px; color: var(--ink-2); min-width: 220px; }
.diff .effect.tone-bad { color: var(--bad); font-weight: 550; }
.diff .effect.tone-warn { color: var(--warn); }
.apply-body textarea { width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; resize: vertical; }
.apply-body textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 20%, transparent); }
.apply-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); }
@media (max-width: 1100px) {
  .set-layout { grid-template-columns: minmax(0, 1fr); }
  .set-nav { position: static; display: flex; flex-wrap: wrap; }
}
@media (max-width: 760px) {
  .set-grid { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .dirty-bar { left: 12px; right: 12px; }
}
/* ── #582 Settings: Emails (the invoice email template, its preview and test send in the review
   dialog) and the Vendor tax profile ──────────────────────────────────────────────────────────── */
.set-stack { display: grid; gap: 18px; }
.set-field .control:has(textarea) { height: auto; align-items: stretch; }
/* #752: a plain multi-line setting (the vendor's address) — the body font, not the template's mono */
.set-field .control textarea:not(.tpl-body) { flex: 1; min-width: 0; padding: 10px 12px; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: 14px; line-height: 1.5; resize: vertical; min-height: 64px; }
.tpl-body { flex: 1; min-width: 0; padding: 10px 12px; border: 0; outline: 0; background: transparent; color: var(--ink); font-family: var(--font-mono); font-size: 12.5px; line-height: 1.55; resize: vertical; min-height: 180px; }
.tpl-body.tpl-short { min-height: 64px; } /* #601: the footer, a line or two */
.tpl-placeholders { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 18px; margin: 14px 0 0; font-size: 12.5px; }
.tpl-placeholders > div { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.tpl-placeholders dt code { font-family: var(--font-mono); font-size: 11.5px; padding: 1px 6px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.tpl-placeholders dd { margin: 0; color: var(--ink-3); }
.tpl-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0; padding: 0; list-style: none; } /* #621: a field's variables */
.tpl-chips li { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--ink-3); }
.tpl-chip { font-family: var(--font-mono); font-size: 11.5px; padding: 1px 7px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.tpl-chips li[data-required] .tpl-chip { box-shadow: inset 0 0 0 1px var(--accent); font-weight: 600; }
.tpl-chip[role='button'] { cursor: grab; user-select: none; }
.tpl-chip[role='button']:hover { background: color-mix(in oklch, var(--accent-soft) 70%, var(--accent) 30%); }
.tpl-chip[role='button']:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.email-va span { color: var(--ink-2); }
.email-va b { color: var(--warn); }
.email-review { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.email-review h3 { display: flex; align-items: center; gap: 7px; margin: 0; font-size: 13px; font-weight: 650; }
.email-review h3 .ic { width: 14px; height: 14px; color: var(--ink-3); }
.email-pick label { display: block; margin-bottom: 4px; font-size: 12.5px; font-weight: 600; }
.email-pick .opt { font-weight: 400; color: var(--ink-3); }
.email-pick-row { display: flex; gap: 8px; align-items: center; }
.email-pick-row .control { flex: 1; }
.email-pick-row .control input { font-family: var(--font-mono); font-size: 12.5px; }
.email-preview { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.email-preview dl { margin: 0; padding: 8px 14px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; font-size: 13px; }
/* The dialog body scrolls: with the preview in it, the diff table must keep its height, not shrink to 0. */
.apply-body { grid-auto-rows: max-content; }
.diff tr[data-change^='invoice_email_'] td.nowrap { white-space: normal; overflow-wrap: anywhere; min-width: 150px; text-align: left; }
.email-preview dl > div { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 10px; }
.email-preview dt { color: var(--ink-3); }
.email-preview dd { margin: 0; overflow-wrap: anywhere; }
.email-preview [data-preview-subject] { font-weight: 600; }
.email-preview pre { margin: 0; padding: 12px 14px; max-height: 260px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--font-mono); font-size: 12px; line-height: 1.55; color: var(--ink-2); }
.email-preview .email-frame { display: block; width: 100%; height: 520px; border: 0; border-bottom: 1px solid var(--line); background: #f2f4f7; } /* #601: the HTML card as sent */
.email-test { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; font-size: 12.5px; }
.email-notice, .email-sent { display: flex; align-items: flex-start; gap: 7px; margin: 0; font-size: 12.5px; color: var(--warn); }
.email-notice .ic, .email-sent .ic { flex: none; width: 14px; height: 14px; margin-top: 2px; }
.email-sent.ok { color: var(--ok); font-weight: 550; }
.email-sent.bad { color: var(--bad); font-weight: 550; }
[data-pkp] { margin-top: 18px; }
/* ── #578 the Dashboard, part 1: the period bar, Money in (bars, dense mode) and the all-time strip ──
   F's dashboard.css. The three methods are lapis (Midtrans), a lighter lapis (bank transfer) and pyrite
   gold (cash), so money reads as one family; the invoiced ghost behind each bar is only an outline. */
:root { --m-midtrans: var(--accent); --m-bank: oklch(66% 0.11 262); --m-cash: var(--gold); --ghost-fill: oklch(44% 0.185 268 / 0.05); }
.dash-sc { margin-top: 18px; }
.dash-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 18px; margin-top: 18px; }
.dash-money { grid-column: span 8; }
.dash-grid.solo .dash-money { grid-column: 1 / -1; }
.dash-side { grid-column: span 4; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.dash-empty { margin-top: 18px; }
.dash-empty .empty { background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r-lg); }
.muted-sm { font-size: 12.5px; font-weight: 450; color: var(--ink-3); }
.banner-warn { margin-top: 14px; background: var(--warn-soft); color: var(--warn); border: 1px solid color-mix(in oklch, var(--warn) 30%, transparent); }
.banner-warn span { color: var(--ink); }

.sw.m-midtrans { background: var(--m-midtrans); }
.sw.m-bank_transfer { background: var(--m-bank); }
.sw.m-cash { background: var(--m-cash); }
.sw.ghost { background: var(--ghost-fill); border: 1.5px dashed var(--accent-line); }
.sw.step { width: 16px; height: 0; border-radius: 0; background: none; border-top: 2px dashed var(--accent-line); }

/* period bar */
.period-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; margin-top: 14px; }
.pb-custom { position: relative; }
.pb-custom summary { list-style: none; display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface-sunk); font-size: 13px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.pb-custom summary::-webkit-details-marker { display: none; }
.pb-custom summary .ic { width: 15px; height: 15px; color: var(--ink-3); }
.pb-custom summary:hover { color: var(--ink); }
.pb-custom.on summary { background: var(--surface); color: var(--ink); font-weight: 560; border-color: var(--accent-line); box-shadow: 0 1px 3px oklch(20% 0.05 268 / 0.14); }
.pb-custom form { position: absolute; z-index: 20; top: calc(100% + 8px); left: 0; display: flex; align-items: flex-end; gap: 10px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-2); }
.pb-custom label { display: grid; gap: 4px; font-size: 12px; color: var(--ink-3); }
.pb-custom input[type='month'] { width: 150px; height: 32px; padding: 0 8px; font-size: 13px; }
.pb-label { display: grid; line-height: 1.2; font-size: 14px; font-weight: 600; color: var(--ink); }
.pb-label small { font-size: 11.5px; font-weight: 450; color: var(--ink-3); }
.period-step { display: inline-flex; gap: 2px; padding: 2px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-sunk); }
.step-btn { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: var(--ink-2); text-decoration: none !important; }
.step-btn .ic { width: 16px; height: 16px; }
a.step-btn:hover { background: var(--surface); color: var(--accent); box-shadow: 0 1px 3px oklch(20% 0.05 268 / 0.14); }
.step-btn.off { opacity: 0.35; cursor: not-allowed; }

/* Money in */
.dash-money .card-title { min-width: 0; flex: 1; white-space: nowrap; }
.dash-money .card-title .muted-sm { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.seg-quiet { padding: 2px; }
.seg-quiet a, .seg-quiet span { padding: 4px 10px; font-size: 12px; border-radius: 7px; }
.seg-quiet span.off { color: var(--ink-3); opacity: 0.45; cursor: not-allowed; }
.ch-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: -4px 0 8px; font-size: 12.5px; color: var(--ink-2); }
.ch-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ch-legend b { font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.chart { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--font-ui); }
.chart text { font-variant-numeric: tabular-nums; }
.ch-grid { stroke: var(--line); stroke-width: 1; }
.ch-grid.base { stroke: var(--line-strong); }
.ch-axis { fill: var(--ink-3); font-size: 11px; }
.ch-month { fill: var(--ink-2); font-size: 11.5px; font-weight: 500; }
.ch-month.cur { fill: var(--accent); font-weight: 650; }
.ch-year { fill: var(--ink-3); font-size: 10.5px; }
.ch-year.cur { fill: var(--accent); font-weight: 600; }
.ch-val { fill: var(--ink-3); font-size: 10.5px; font-weight: 550; }
.ch-val.cur { fill: var(--accent); font-weight: 700; }
.ch-now { fill: var(--accent-soft); opacity: 0.7; }
.ch-ghost { fill: var(--ghost-fill); stroke: var(--accent-line); stroke-width: 1.25; stroke-dasharray: 3 3; }
.ch-bar { transition: opacity 0.15s; }
.ch-bar.m-midtrans { fill: var(--m-midtrans); }
.ch-bar.m-bank_transfer { fill: var(--m-bank); }
.ch-bar.m-cash { fill: var(--m-cash); }
.money-bars:hover .ch-bar { opacity: 0.55; }
.money-bars .ch-bar:hover { opacity: 1; }
.money-bars.dense .ch-bar { shape-rendering: crispEdges; }
.money-bars.dense:hover .ch-bar { opacity: 1; }
.ch-yearline { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 2 3; }
.ch-hit { fill: transparent; }
.ch-col:hover .ch-hit { fill: var(--accent-soft); }
.ch-step { fill: none; stroke: var(--accent-line); stroke-width: 1.4; stroke-dasharray: 4 3; stroke-linejoin: round; }
.ch-empty { display: grid; place-items: center; align-content: center; gap: 8px; height: 220px; color: var(--ink-3); border: 1px dashed var(--line-strong); border-radius: var(--r-md); font-size: 13.5px; text-align: center; }
.ch-empty .ic { width: 28px; height: 28px; }

/* the all-time strip */
.nav-wrap { margin-top: 6px; padding-top: 10px; border-top: 1px dashed var(--line); }
.nav-strip-wrap { position: relative; padding-bottom: 22px; }
.nav-sel { fill: var(--accent-soft); stroke: var(--accent-line); stroke-width: 1; }
.nav-bar { fill: var(--line-strong); }
.nav-bar.in { fill: var(--accent); }
.nav-tick { stroke: var(--line-strong); stroke-width: 1; }
.nav-years { position: absolute; left: 0; right: 0; bottom: 0; height: 20px; }
.nav-year { position: absolute; top: 0; padding: 1px 4px; border-radius: 5px; font-size: 11px; font-weight: 600; color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 2px; font-variant-numeric: tabular-nums; }
.nav-year:hover, .nav-year:focus-visible { color: var(--accent); text-decoration-color: currentColor; }
.nav-year.on { color: var(--accent-ink); background: var(--accent); text-decoration: none; }
.nav-months { position: absolute; left: 0; right: 0; top: 0; bottom: 22px; z-index: 1; }
.nav-months a { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.nav-months a:hover { background: color-mix(in oklch, var(--accent) 16%, transparent); box-shadow: inset 0 0 0 1px var(--accent-line); }

@media (max-width: 1180px) {
  .dash-money, .dash-side { grid-column: span 12; }
}

/* ── #576 the Payments ledger, and the keyset pager (reused by #577) ─────────────────────────────── */
.ledger-card { display: block; } /* a block, as `.cust-card`: not the legacy `.content section` grid */
.ledger-card .bulk-bar { margin-bottom: 12px; }
.ledger-card .fb-second { margin-top: -4px; gap: 10px; }
.seg-scroll { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.ledger td { vertical-align: middle; }
.ledger th, .ledger td { padding-left: 9px; padding-right: 9px; } /* ten columns in the content width at 1440 px */
.ledger .bulk-col { width: 28px; padding-right: 0; }
.ledger .menu-col { width: 36px; text-align: right; padding-left: 4px; }
.ledger td.menu-col .row-menu-wrap { vertical-align: middle; }
.ledger .rel { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.led-cust { color: var(--ink); font-weight: 550; text-decoration: none; }
.led-cust:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.led-ref { margin-top: 4px; }
.ledger .money.strong { font-weight: 600; }
.ledger tfoot th, .ledger tfoot td {
  padding: 12px;
  font-size: 13px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  background: var(--surface-2);
  border-top: 2px solid var(--line-strong);
  text-align: left;
}
.ledger tfoot td.num { text-align: right; }
.ledger tfoot th:first-child { border-bottom-left-radius: 9px; }
.ledger tfoot td:last-child { border-bottom-right-radius: 9px; }
.filter-chip { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 6px 0 11px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface-2); font-size: 13px; font-weight: 550; }
.filter-chip .ic { width: 14px; height: 14px; color: var(--ink-3); }
.filter-chip a { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: var(--ink-3); }
.filter-chip a:hover { background: var(--surface-sunk); color: var(--ink); }
.date-range { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--ink-3); }
.date-range label { display: inline-flex; align-items: center; gap: 6px; }
.date-range input[type='date'] { height: 30px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; font-variant-numeric: tabular-nums; }
.date-range input[type='date'][data-empty='true']::-webkit-datetime-edit { color: var(--ink-3); opacity: 0.55; }
.date-range input[type='date']:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 20%, transparent); }
.field-note { margin: -6px 0 12px; font-size: 12.5px; color: var(--ink-3); }
.field-note.bad { color: var(--bad); font-weight: 500; }
.pager.keyset { gap: 6px; }
.pg.pg-text { width: auto; display: inline-flex; align-items: center; gap: 4px; padding: 0 10px; font-size: 13px; }
.pg.pg-text .ic { width: 14px; height: 14px; }

/* ── #577 the Audit Events page (F's audit log) ──────────────────────────────────────────────────── */
.audit-card { display: block; } /* a block, as `.ledger-card` */
.audit-card .fb-second { margin-top: -4px; gap: 10px; }
.audit-filter select { height: 30px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); color: var(--ink); font-size: 13px; max-width: 260px; }
.audit-log { display: grid; gap: 18px; }
.audit-date {
  position: sticky;
  top: var(--top-h);
  z-index: 1;
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 -22px 4px;
  padding: 8px 22px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0;
  color: var(--ink);
  background: color-mix(in oklch, var(--surface) 88%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.audit-date time { font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-size: 12.5px; }
.audit-date small { font-weight: 500; color: var(--ink-3); }
.audit-date span { margin-left: auto; font-weight: 500; font-size: 12px; color: var(--ink-3); }
.audit-list { list-style: none; margin: 0; padding: 0; position: relative; }
.audit-list::before { content: ''; position: absolute; left: 77px; top: 8px; bottom: 8px; width: 1px; background: var(--line); }
.audit-row {
  display: grid;
  grid-template-columns: 52px 30px minmax(0, 1fr) minmax(0, 210px) minmax(0, 210px) auto auto;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  font-size: 13px;
  border-bottom: 1px dashed color-mix(in oklch, var(--line) 70%, transparent);
}
.audit-row:last-child { border-bottom: 0; }
.audit-time { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.audit-ic { position: relative; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--surface-sunk); color: var(--ink-3); box-shadow: 0 0 0 3px var(--surface); }
.audit-ic .ic { width: 14px; height: 14px; }
.audit-ic.fam-money { background: var(--ok-soft); color: var(--ok); }
.audit-ic.fam-contracts { background: var(--accent-soft); color: var(--accent); }
.audit-ic.fam-keys { background: var(--gold-soft); color: var(--gold-ink); }
.audit-ic.fam-seats { background: var(--mute-soft); color: var(--ink-2); }
.audit-ic.fam-admin { background: var(--warn-soft); color: var(--warn); }
.audit-what { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.audit-what b { font-weight: 600; }
.audit-detail { color: var(--ink-3); font-size: 12.5px; line-height: 1.6; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.audit-row:hover .audit-detail, .audit-row:focus-within .audit-detail { -webkit-line-clamp: unset; line-clamp: unset; } /* the whole detail, one hover or Tab away */
.audit-detail .ad-key { color: var(--ink-3); }
.audit-detail .ad-name, .audit-detail .money { color: var(--ink-2); font-weight: 550; }
.audit-detail .ad-id { display: inline-flex; align-items: center; gap: 5px; vertical-align: middle; }
.audit-detail .idchip { height: 20px; padding: 0 5px; font-size: 11px; }
.audit-detail .ad-hash { font-size: 11.5px; padding: 1px 5px; border-radius: 6px; background: var(--surface-sunk); }
.audit-subject { min-width: 0; display: flex; align-items: center; gap: 8px; overflow: hidden; }
.audit-subject a { color: var(--ink-2); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audit-subject a:hover { color: var(--accent); text-decoration: underline; }
.audit-k code { font-size: 11.5px; padding: 1px 6px; border-radius: 6px; background: var(--surface-sunk); color: var(--ink-3); }
.actor { display: inline-flex; align-items: center; gap: 6px; min-width: 0; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actor .ic { flex: none; width: 13px; height: 13px; }
.actor-admin .ic { color: var(--accent); }
.actor-customer .ic { color: var(--ok); }
.actor-system .ic { color: var(--ink-3); }

@media (max-width: 1100px) {
  .audit-row { grid-template-columns: 52px 30px minmax(0, 1fr) minmax(0, 180px) auto; }
  .audit-row .actor, .audit-row > .idchip { grid-column: 3 / -2; }
  .audit-list::before { display: none; }
}

/* ── #579 the Dashboard, part 2: Settled, The book, Book movement, Receivables aging, Renewals, Top
   customers. F's dashboard.css; each figure is a link to the list behind it (story 96). */
:root { --deep: oklch(36% 0.15 22); }
.dash-mix { display: flex; flex-direction: column; }
.dash-aging, .dash-renew, .dash-top { grid-column: span 4; }
.dash-total { font-family: var(--font-display); font-size: 24px; line-height: 1; font-variant-numeric: tabular-nums; color: var(--ink); }
.now-tag { display: inline-flex; align-items: center; height: 18px; padding: 0 7px; border-radius: 99px; background: var(--surface-sunk); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-3); font-size: 10.5px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; }
.dash-more { margin-top: 10px; }
.sw { flex: none; }
.sw.tone-accent { background: var(--accent); }
.sw.tone-ok { background: var(--ok); }
.sw.tone-warn { background: var(--warn); }
.sw.tone-bad { background: var(--bad); }
.sw.tone-deep { background: var(--deep); }
.sw.tone-mute { background: var(--line-strong); }

/* Settled = allocated cash + withheld, under Money in */
.settle-eq { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin: 14px 0 0; padding-top: 14px; border-top: 1px solid var(--line); }
.settle-eq > div { display: grid; gap: 2px; }
.settle-eq dt { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-3); }
.settle-eq dd { margin: 0; font-family: var(--font-display); font-size: 22px; line-height: 1.1; color: var(--ink); }
.settle-eq dd small { font-family: var(--font-ui); font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--gold-ink); margin-left: 4px; }
.settle-eq .gold { padding: 6px 12px; border-radius: 10px; background: var(--gold-soft); box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--gold) 35%, transparent); }
.settle-eq .gold dd { color: var(--gold-ink); }
.settle-eq .op { font-family: var(--font-display); font-size: 22px; color: var(--ink-3); }
.settle-when { margin-left: auto; font-size: 11.5px; color: var(--ink-3); align-self: flex-end; }

/* The book */
.mix-row { display: flex; align-items: center; gap: 22px; margin: 4px 0 18px; }
.donut { flex: none; width: 168px; height: 168px; }
.dn-track { fill: none; stroke: var(--surface-sunk); }
.dn { fill: none; stroke-linecap: butt; }
.dn.tone-ok { stroke: var(--ok); }
.dn.tone-bad { stroke: var(--bad); }
.dn.tone-mute { stroke: var(--line-strong); }
.dn-center { font-family: var(--font-display); font-size: 34px; fill: var(--ink); }
.dn-sub { font-size: 11px; fill: var(--ink-3); letter-spacing: 0.04em; }
.mix-legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 0; display: grid; gap: 2px; }
.mix-legend a { display: flex; align-items: center; gap: 9px; padding: 6px 8px; margin: 0 -8px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-size: 13.5px; }
.mix-legend a:hover { background: var(--surface-2); color: var(--ink); }
.mix-legend span { flex: 1; }
.mix-legend b { font-weight: 600; color: var(--ink); }

/* Book movement: growth in (+), churn out (−) */
.dash-move { flex: 1; }
.move-list { list-style: none; margin: 12px 0 0; padding: 0; }
.move-list li { border-bottom: 1px solid var(--line); }
.move-list li:last-child { border-bottom: 0; }
.move-list a { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px; padding: 7px 6px; margin: 0 -6px; border-radius: 8px; font-size: 13.5px; color: var(--ink-2); text-decoration: none; }
.move-list a:hover { background: var(--surface-2); color: var(--ink); }
.move-list b { font-size: 15px; font-weight: 650; color: var(--ink); }
.move-list li.tone-ok b { color: var(--ok); }
.move-list li.tone-bad b { color: var(--bad); }
.move-list li.zero b { color: var(--ink-3); font-weight: 500; }
.move-ic { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--surface-sunk); color: var(--ink-3); }
.move-ic .ic { width: 15px; height: 15px; }
.move-list li.tone-ok .move-ic { background: var(--ok-soft); color: var(--ok); }
.move-list li.tone-bad .move-ic { background: var(--bad-soft); color: var(--bad); }
.move-seats { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line-strong); display: grid; gap: 7px; }
.ms-head { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.ms-row { display: grid; grid-template-columns: 56px 1fr 44px; align-items: center; gap: 10px; font-size: 12.5px; color: var(--ink-3); }
.ms-row b { text-align: right; color: var(--ink-2); font-weight: 600; }
.ms-bar { --v: 0; display: block; height: 8px; border-radius: 99px; background: linear-gradient(90deg, var(--c) calc(var(--v) * 100%), var(--surface-sunk) 0); }
.ms-bar.ok { --c: var(--ok); }
.ms-bar.bad { --c: var(--bad); }

/* Receivables aging */
.stackbar { display: flex; gap: 3px; width: 100%; border-radius: 6px; overflow: hidden; background: var(--surface-sunk); }
.stackbar .sb { min-width: 4px; border-radius: 4px; background: var(--line-strong); }
.stackbar .sb.tone-accent { background: var(--accent); }
.stackbar .sb.tone-warn { background: var(--warn); }
.stackbar .sb.tone-bad { background: var(--bad); }
.stackbar .sb.tone-deep { background: var(--deep); }
.aging-legend { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 14px 0 6px; padding: 0; }
.aging-legend a { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 7px; padding: 2px 4px; margin: 0 -4px; border-radius: 8px; font-size: 12px; color: var(--ink-3); text-decoration: none; }
.aging-legend a:hover { background: var(--surface-2); }
.aging-legend span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aging-legend b { grid-column: 2; font-size: 15px; font-weight: 600; color: var(--ink); }
.aging-legend small { display: none; }

/* lists (aging, renewals) */
.dash-list, .renew-group ul { list-style: none; margin: 0; padding: 0; }
.dash-list { margin-top: 12px; border-top: 1px solid var(--line); }
.dash-list li, .renew-group li { border-bottom: 1px solid var(--line); }
.dash-list li:last-child, .renew-group li:last-child { border-bottom: 0; }
.dash-list a, .renew-group a { display: flex; align-items: center; gap: 12px; padding: 10px 6px; margin: 0 -6px; color: var(--ink); text-decoration: none; border-radius: 10px; }
.dash-list a:hover, .renew-group a:hover { background: var(--surface-2); text-decoration: none; }
.dl-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.dl-main b { font-weight: 560; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dl-main small { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dl-num { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: none; }
.dl-num b { font-weight: 600; font-size: 13.5px; }
.dl-num small { font-size: 12px; }
.avatar.avatar-sm { width: 30px; height: 30px; border-radius: 9px; font-size: 11px; }
.renew-group + .renew-group { margin-top: 10px; }
.renew-group h3 { display: flex; justify-content: space-between; font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); padding: 4px 0 6px; border-bottom: 1px solid var(--line); }
.renew-group.lapsed h3 { color: var(--bad); }
.renew-group > ul > li > a > b { font-size: 13.5px; font-weight: 600; flex: none; }
.renew-group .rn-eval { flex: none; }
.rn-date { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); line-height: 1; }
.rn-date b { font-family: var(--font-display); font-size: 19px; font-weight: 400; }
.rn-date small { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.renew-group.lapsed .rn-date { background: var(--bad-soft); color: var(--bad); }

/* Top customers */
.dash-top .card-bar { flex-wrap: nowrap; }
.dash-top .card-title { min-width: 0; flex: 1; white-space: nowrap; }
.dash-top .card-title .muted-sm { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.top-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.top-list a { display: flex; gap: 12px; align-items: flex-start; padding: 8px 6px; margin: 0 -6px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.top-list a:hover { background: var(--surface-2); }
.top-rank { flex: none; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 7px; background: var(--surface-sunk); font-size: 11.5px; font-weight: 600; color: var(--ink-3); margin-top: 1px; }
.top-main { flex: 1; min-width: 0; display: grid; gap: 6px; }
.top-name { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.top-name b { font-weight: 560; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-name span { flex: none; font-weight: 600; }
.top-bar { --v: 0; position: relative; height: 6px; border-radius: 99px; background: var(--surface-sunk); overflow: hidden; }
.top-bar::before { content: ''; position: absolute; inset: 0 auto 0 0; width: calc(var(--v) * 100%); border-radius: inherit; background: linear-gradient(90deg, var(--accent-line), var(--accent)); }

@media (max-width: 1180px) {
  .dash-aging, .dash-renew { grid-column: span 6; }
  .dash-top { grid-column: span 12; }
  .dash-mix .mix-row { justify-content: flex-start; }
}
@media (max-width: 920px) {
  .dash-aging, .dash-renew, .dash-top { grid-column: span 12; }
}

/* ── #602 an email that did not reach the customer: the send log's reason line, a send's page ─── */
.rem-why { display: block; margin-top: 2px; font-size: 12.5px; line-height: 1.4; color: var(--ink-3); overflow-wrap: anywhere; }
.rem-why.bad { color: var(--bad); }
.email-act .card-title .ic { color: var(--bad); }
.email-why { margin: 0 0 14px; font-size: 13.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.email-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 16px; align-items: start; }
.email-again, .email-hand { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.email-again .hint, p.email-again { margin: 0; font-size: 12.5px; color: var(--ink-3); }
.email-again .btn, .email-hand .btn { justify-self: start; }
.email-hand .field { margin: 0; }
:root[data-theme='dark'] .email-again, :root[data-theme='dark'] .email-hand { background: var(--surface-sunk); }
@media (max-width: 820px) {
  .email-actions { grid-template-columns: minmax(0, 1fr); }
}

/* ── #609 the customer portal (src/portal/Layout.tsx): the public login card, the signed-in home ── */
/* Tokens only, so the dark theme needs no rule of its own. */
.portal-public { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; justify-items: center; padding: 28px 20px 80px; gap: 28px; }
.portal-top { width: min(100%, 480px); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.portal-top .brand-link { padding: 0; color: var(--ink); }
.portal-top .brand-text span { font-size: 12.5px; color: var(--ink-3); }
.portal-top .brand-tile { box-shadow: 0 0 0 1px var(--line), var(--shadow-1); }
.portal-card { width: min(100%, 480px); align-self: start; display: grid; gap: 16px; padding: 30px 30px 26px; box-shadow: var(--shadow-2); }
.portal-card .lede { margin: -6px 0 0; font-size: 14.5px; }
.portal-title { font-size: 36px; margin: 0; }
.portal-form { display: grid; gap: 14px; margin-top: 4px; }
.portal-submit { justify-self: stretch; justify-content: center; height: 42px; }
.portal-note { margin: 0; text-align: center; }
.portal-notice { margin: 0; display: flex; align-items: center; gap: 8px; }
.portal-card > .btn { justify-self: start; }
.portal-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.portal-screens { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.portal-screen { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--ink); font-weight: 550; text-decoration: none !important; }
.portal-screen:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.portal-screen .ic { color: var(--accent); }
.portal-screen .portal-go { margin-left: auto; color: var(--ink-3); }
.portal-sub { margin: 18px 0 4px; font-size: 13.5px; font-weight: 600; }
.portal-grid .card p { margin: 0 0 10px; }
.portal-grid .card form { margin: 4px 0 0; }
.portal-until { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 900px) {
  .portal-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ── #614 the portal's Seats screen (src/portal/pages/seats.tsx): one card per contract, Release behind a <details> confirm ── */
.portal-seats { display: grid; gap: 20px; }
.portal-seats .card-title .pill { margin-left: 4px; }
.portal-seat-table th.portal-act, .portal-seat-table td.portal-act { width: 1%; white-space: nowrap; text-align: right; }
.portal-returns { display: block; margin-top: 4px; font-size: 12px; }
.portal-at-cap { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); white-space: normal; width: 190px; text-align: left; }
.portal-release { display: inline-block; text-align: left; }
.portal-release > summary { list-style: none; cursor: pointer; }
.portal-release > summary::-webkit-details-marker { display: none; }
.portal-release[open] > summary { color: var(--accent); border-color: var(--accent-line); }
.portal-release-form { display: grid; gap: 10px; margin-top: 8px; padding: 12px 14px; width: 280px; white-space: normal; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); font-size: 13px; }
.portal-release-form p { margin: 0; }
.portal-release-form .btn { justify-self: start; }

/* ── #618 the portal's Send proof (src/portal/pages/proof.tsx): the transfer form, the open-invoice ticks, a plain file input (no script) ── */
.portal-proof { display: grid; gap: 16px; }
.portal-proof .form-foot { margin-top: 4px; }
.portal-proof fieldset.portal-ticks { margin: 0; padding: 0; border: 0; background: none; box-shadow: none; display: grid; gap: 8px; min-width: 0; }
.portal-proof fieldset.portal-ticks legend { padding: 0; margin: 0 0 6px; font-size: 13px; font-weight: 550; color: var(--ink-2); }
.portal-proof .portal-ticks.invalid legend { color: var(--bad); }
.portal-ticks .hint { margin: 0; font-size: 12.5px; color: var(--ink-3); }
.portal-ticks .err { margin: 0; display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--bad); font-weight: 500; }
.portal-tick-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.portal-tick { display: flex; align-items: flex-start; gap: 12px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.portal-tick:has(input:checked) { border-color: var(--accent-line); background: var(--accent-soft); }
.portal-tick input { width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.portal-tick label { display: grid; gap: 4px; min-width: 0; cursor: pointer; }
.portal-tick-what { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.portal-tick-what code { overflow-wrap: anywhere; }
.portal-tick-facts b { color: var(--ink); }
.portal-file { font: inherit; font-size: 13.5px; color: var(--ink-2); padding: 10px 12px; border: 1.5px dashed var(--line-strong, var(--line)); border-radius: 12px; background: var(--surface-2); width: 100%; }
.portal-file::file-selector-button { font: inherit; font-weight: 550; margin-right: 12px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--accent); cursor: pointer; }
.field.invalid .portal-file { border-color: var(--bad); }

/* ── #619 Login Emails: the customer page's card and the portal's list (tokens only: no dark rule needed) ── */
.le-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.le-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.le-email { font-weight: 550; font-size: 13.5px; overflow-wrap: anywhere; min-width: 0; }
.le-meta { order: 9; flex-basis: 100%; font-size: 12px; }
.le-remove { margin: 0 0 0 auto; }
.le-add { display: grid; gap: 10px; }
.le-add .field { margin: 0; }
.le-add .btn { justify-self: start; }

/* ── #635 Costs: the table's row actions, rates pending, the source cards (tokens only: no dark rule needed) ── */
.inline-form { display: inline; margin: 0; }
.cost-table td:last-child { text-align: right; }
.rate-list, .domain-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.rate-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.rate-form label { min-width: 96px; }
.rate-form .control { display: inline-flex; align-items: center; gap: 6px; }
.rate-form input { width: 120px; }
.rate-form .err { flex-basis: 100%; margin: 0; }
.domain-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); overflow-wrap: anywhere; }
.source-card p { margin: 8px 0 0; }
.quota-list .meter.near::after { background: var(--bad); }

/* ── #635 Part B (D98): "incl. PPN" under Received and Invoiced; the money path; a payment's Midtrans fee ── */
.sc-ppn { display: block; margin-top: 2px; font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.warn-text { color: var(--warn); font-weight: 600; }
.dash-path { grid-column: 1 / -1; }
.mp-row { display: flex; align-items: stretch; flex-wrap: wrap; gap: 14px 18px; }
.mp-path { flex: 1 1 640px; display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px; margin: 0; }
.mp-step { flex: 1 1 130px; display: grid; align-content: start; gap: 3px; padding: 10px 12px; border-radius: 10px; background: var(--surface-sunk); box-shadow: inset 0 0 0 1px var(--line); min-width: 0; }
.mp-step dt { font-size: 12px; color: var(--ink-3); }
.mp-step dt a { color: inherit; }
.mp-step dd { margin: 0; font-family: var(--font-display); font-size: 19px; line-height: 1.15; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-step.mp-minus dd { color: var(--ink-2); }
.mp-step.mp-total { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); }
.mp-step.mp-total dt { color: var(--ink-2); font-weight: 600; }
.mp-step[data-path='kept'] dd { color: var(--accent); }
.mp-note { font-size: 11.5px; color: var(--ink-3); line-height: 1.3; }
.mp-credit { flex: 0 1 220px; display: grid; align-content: start; gap: 3px; padding: 10px 12px; border-radius: 10px; background: var(--gold-soft); box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--gold) 35%, transparent); }
.mp-credit-k { font-size: 12px; color: var(--gold-ink); font-weight: 600; }
.mp-credit b { font-family: var(--font-display); font-size: 19px; font-weight: 400; color: var(--gold-ink); }
.fee-form { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.fee-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* generated by scripts/build-admin-assets.ts: "system" on a dark OS */
@media (prefers-color-scheme: dark) {
  :root[data-theme='system'] {
    color-scheme: dark;
    --bg: oklch(15.2% 0.028 268);
    --bg-glow: oklch(30% 0.1 268 / 0.42);
    --surface: oklch(19.2% 0.033 268);
    --surface-2: oklch(21.8% 0.036 268);
    --surface-sunk: oklch(16.8% 0.03 268);
    --line: oklch(27.5% 0.04 268);
    --line-strong: oklch(35% 0.05 268);
    --ink: oklch(94.5% 0.012 268);
    --ink-2: oklch(80% 0.022 268);
    --ink-3: oklch(66% 0.03 268);
    --accent: oklch(74% 0.135 271);
    --accent-hover: oklch(80% 0.12 271);
    --accent-ink: oklch(17% 0.05 268);
    --accent-soft: oklch(28% 0.075 268);
    --accent-line: oklch(46% 0.12 268);
    --gold: oklch(81% 0.125 86);
    --gold-soft: oklch(27% 0.045 80);
    --gold-ink: oklch(86% 0.11 86);
    --ok: oklch(79% 0.13 162);
    --ok-soft: oklch(26% 0.05 165);
    --warn: oklch(82% 0.13 76);
    --warn-soft: oklch(27% 0.05 70);
    --bad: oklch(74% 0.155 20);
    --bad-soft: oklch(26.5% 0.06 20);
    --mute-soft: oklch(25% 0.025 268);
    --sidebar-bg: oklch(12.4% 0.027 268);
    --sidebar-bg-2: oklch(11% 0.024 268);
    --sidebar-ink: oklch(92% 0.016 268);
    --sidebar-ink-2: oklch(65% 0.035 268);
    --sidebar-hover: oklch(18.5% 0.04 268);
    --sidebar-active: oklch(22.5% 0.065 268);
    --sidebar-line: oklch(21% 0.035 268);
    --new-bg: oklch(74% 0.135 271);
    --new-ink: oklch(16% 0.05 268);
    --shadow-1: inset 0 1px 0 oklch(100% 0 0 / 0.035);
    --shadow-2: inset 0 1px 0 oklch(100% 0 0 / 0.05), 0 24px 50px -20px oklch(0% 0 0 / 0.7);
    --focus: oklch(78% 0.14 271);
    --scrim: oklch(5% 0.02 268 / 0.62);
  }

  :root[data-theme='system'] .env-badge.staging { background: oklch(30% 0.06 72); color: oklch(90% 0.11 85); border-color: oklch(55% 0.12 75); }
  :root[data-theme='system'] .theme-switch button[aria-pressed='true'] { background: var(--surface-2); }
  :root[data-theme='system'] .chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
  :root[data-theme='system'] .btn-danger:not(:disabled) { color: oklch(18% 0.04 20); }
  :root[data-theme='system'] .explainer { background: var(--surface-2); }
  :root[data-theme='system'] .row-menu { background: var(--surface-2); }
  :root[data-theme='system'] .avatar { background: oklch(31% 0.065 var(--h)); color: oklch(89% 0.07 var(--h)); }
  :root[data-theme='system'] .segmented a.on { background: var(--surface-2); }
  :root[data-theme='system'] .control { background: var(--surface-sunk); }
  :root[data-theme='system'] .type-opt > span { background: var(--surface-sunk); }
  :root[data-theme='system'] .drawer-body { background: var(--surface-sunk); }
  :root[data-theme='system'] .eq-term { background: var(--surface-sunk); }
  :root[data-theme='system'] .remainder { background: var(--surface-sunk); }
  :root[data-theme='system'] .rem-bar { background: var(--line); }
  :root[data-theme='system'] .alloc-row.is-paid { background: var(--surface-sunk); }
  :root[data-theme='system'] .jp-node { background: var(--surface-sunk); }
  :root[data-theme='system'] .rem.late .tk.now { color: oklch(18% 0.04 20); }
  :root[data-theme='system'] .rem-mark { background: var(--surface-sunk); }
  :root[data-theme='system'] .palette { background: var(--surface-2); }
  :root[data-theme='system'] :where(.content) :is(input:not([type='checkbox'], [type='radio'], [type='hidden'], [type='file']), select, textarea):not(.control *, .search-field *) { background: var(--surface-sunk); }
  /* #581 Settings: the review dialog on the dark surfaces */
  :root[data-theme='system'] .apply-dlg { background: var(--surface-2); border: 1px solid var(--line-strong); }
  :root[data-theme='system'] .apply-body textarea { background: var(--surface-sunk); }
  :root[data-theme='system'] .apply-foot { background: var(--surface); }
  /* #578 the Dashboard's chart tokens and step line */
  :root[data-theme='system'] { --m-bank: oklch(56% 0.1 262); --ghost-fill: oklch(74% 0.135 271 / 0.06); }
  :root[data-theme='system'] .ch-step { stroke: oklch(70% 0.09 271); }
  /* #579 the aging card's deepest red */
  :root[data-theme='system'] { --deep: oklch(58% 0.19 18); }
}
