/* ==========================================================================
   Counter & Vault — design system
   Operational register: dark navigation rail, white workspace, flat sections,
   dense tables. Colour is reserved for actions, product navigation and status.
   Single visual world — there is no dark workspace. The rate board is the one
   dark surface, because it is a screen physically on a wall.
   Weights: 400 / 500 / 600 only. Three weights, never more — the discipline is
   part of why this register reads as calm rather than busy.
   ========================================================================== */

:root {
  color-scheme: light;

  /* neutrals ------------------------------------------------------------- */
  --bg: #FFFFFF;
  --surface: #FAFAFB;        /* metric band, search fill, row hover */
  --surface-2: #F5F6F7;      /* deeper tint, sub-table headers */
  --surface-3: #EBECF0;      /* hairline fills, meter track */
  --line: rgba(20, 23, 26, 0.09);   /* alpha, so it darkens over hover and selected rows */
  --line-solid: #E8EAED;
  --line-2: rgba(20, 23, 26, 0.16); /* heavier divider */
  --ink: #14171A;            /* primary text and figures */
  --ink-body: #1B1F21;
  --ink-2: #68707A;          /* secondary text, labels */
  --ink-3: #878E99;          /* tertiary, meta */
  --ink-disabled: #B0B6BF;

  /* brand ---------------------------------------------------------------- */
  /* The accent carries selection, links and focus. It deliberately does NOT
     carry the primary button: a filled indigo/violet button is the single most
     common generated-UI tell, and #612FFF sits one digit from Tailwind's
     default indigo-500 (#615FFF). Flip --action to var(--primary) for an
     accent-filled primary instead. */
  --primary: #612FFF;
  --primary-hi: #5500E5;
  --action: #14171A;
  --action-hi: #2B2F33;
  --primary-300: #867DFF;
  --primary-wash: #F0EFFF;   /* selected */
  --primary-100: #DFDEFF;
  --coral: #FF8E3C;          /* product navigation and accents only */
  --coral-red: #FF4F42;
  /* Direction reads from label and column position, never from hue. */
  --buy: var(--ink);
  --sell: var(--ink);

  /* status: background + ink pairs, used only on chips -------------------- */
  --ok-bg: #BBF2D1;   --ok: #08512E;
  --warn-bg: #FAE891; --warn: #634114;
  --risk-bg: #FFCECC; --risk: #801302;
  --pend-bg: #DFDEFF; --pend: #5500E5;
  --off-bg: #E8EAED;  --off: #2B2F33;

  /* rail ----------------------------------------------------------------- */
  --rail-bg: #14171A;
  --rail-ink: #FFFFFF;
  --rail-ink-2: #D0D4D9;
  --rail-ink-3: #878E99;
  --rail-line: rgba(255, 255, 255, 0.08);
  --rail-hover: rgba(255, 255, 255, 0.06);

  /* board (customer-facing display) -------------------------------------- */
  --board-bg: #14171A;
  --board-ink: #FFFFFF;
  --board-ink-2: #878E99;
  --board-line: rgba(255, 255, 255, 0.10);

  /* geometry ------------------------------------------------------------- */
  --r-1: 4px;    /* chips, checkboxes */
  --r-2: 6px;    /* buttons, inputs, filters, alerts */
  --r-3: 8px;    /* cards, large inputs */
  --r-4: 12px;   /* drawers, dialogs, the board */
  --rail: 236px;
  --row: 56px;
  --shadow-card: 0 1px 2px rgba(20, 23, 26, 0.03), 0 8px 24px -8px rgba(20, 23, 26, 0.10);
  --shadow-pop: 0 4px 6px -2px rgba(20, 23, 26, 0.05), 0 16px 40px -12px rgba(20, 23, 26, 0.18);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --z-sticky: 20; --z-rail: 30; --z-drawer: 40; --z-modal: 50; --z-toast: 60;

  /* type ----------------------------------------------------------------- */
  --sans: 'Archivo', 'Noto Sans SC', 'Helvetica Neue', Arial, system-ui, sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

/* ================================================================== base */
* { box-sizing: border-box; }
/* Every inline icon gets a sane default so a bare ${ico(...)} call dropped
   into a table cell or a pill never renders at its unscaled intrinsic size —
   a rule this file had for buttons, callouts and a handful of other
   containers, but not for icons used inline anywhere else. More specific
   selectors (.btn svg, .callout svg, ...) still win on specificity. */
svg { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
/* The hidden attribute must beat any class that sets display. A UA stylesheet
   loses to author styles, so `.auth-error{display:flex}` on a [hidden] element
   renders an empty error box on page load without this. */
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--ink-body);
  font: 400 14px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; color: var(--ink); text-wrap: balance; }
h1 { font-size: 40px; line-height: 1.12; letter-spacing: -0.021em; }
h2 { font-size: 20px; line-height: 1.3; letter-spacing: -0.012em; }
h3 { font-size: 16px; line-height: 1.4; letter-spacing: -0.006em; }
h4 { font-size: 14px; line-height: 1.4; }
p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hi); text-decoration: underline; text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; border-radius: var(--r-1); }

/* Figures align in columns, set in the text face — not in a mono. */
table, .num, .tile-v, .kv .v, .board-figure { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }
.muted { color: var(--ink-2); }
.dim { color: var(--ink-3); }
.t-sub { font-size: 12px; color: var(--ink-2); line-height: 1.45; }
.t-strong { font-weight: 500; color: var(--ink); }
.lbl { font-size: 12px; font-weight: 500; color: var(--ink-2); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.rule { height: 1px; background: var(--line); border: 0; margin: 0; }
/* An exception amount takes bare red text — never a coloured chip, never green. */
.neg { color: var(--risk); }

/* ================================================================= shell */
.app { display: grid; grid-template-columns: var(--rail) 1fr; grid-template-rows: 1fr; min-height: 100dvh; }

.rail {
  background: var(--rail-bg); color: var(--rail-ink-2);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh;
  z-index: var(--z-rail); overflow: hidden;
}
/* the organisation switcher — here, the branch */
.brand {
  display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 60px; flex: none;
  border-bottom: 1px solid var(--rail-line); cursor: pointer; border-radius: 0;
  border-left: 0; border-right: 0; border-top: 0; background: none; width: 100%; text-align: left;
}
.brand:hover { background: var(--rail-hover); }
.brand-mark {
  width: 28px; height: 28px; border-radius: var(--r-2); flex: none;
  background: linear-gradient(140deg, var(--coral-red), var(--coral));
  color: #FFF; display: grid; place-items: center; font-size: 11px; font-weight: 600;
}
.brand-text { min-width: 0; flex: 1; }
.brand-name {
  display: block; font-size: 14px; font-weight: 600; color: var(--rail-ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-sub { display: block; font-size: 11px; color: var(--rail-ink-3); }
.brand svg { width: 14px; height: 14px; color: var(--rail-ink-3); flex: none; stroke-width: 1.7; }

.nav { display: flex; flex-direction: column; padding: 8px 8px 16px; overflow-y: auto; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 10px; flex: none;
  border-radius: var(--r-2); color: var(--rail-ink-2); text-decoration: none;
  font-size: 14px; font-weight: 400; transition: background 120ms var(--ease), color 120ms var(--ease);
}
.nav a:hover { background: var(--rail-hover); color: var(--rail-ink); text-decoration: none; }
/* The active state is the product-navigation coral — the only place coral leads. */
.nav a[aria-current='page'] { color: var(--coral); font-weight: 500; }
.nav a svg { flex: none; width: 18px; height: 18px; stroke-width: 1.5; }
.nav a .badge { margin-left: auto; }
.nav-group { font-size: 11px; font-weight: 500; color: var(--rail-ink-3); padding: 16px 10px 6px; }
/* second level: branch rows carrying their own figure */
.nav a.nav-sub {
  display: block; height: auto; padding: 7px 10px 7px 38px; color: var(--rail-ink-2);
  border-radius: var(--r-2); font-size: 13px; font-weight: 400; line-height: 1.35;
}
.nav a.nav-sub:hover { background: var(--rail-hover); color: var(--rail-ink); text-decoration: none; }
.nav a.nav-sub[aria-current='true'] { color: var(--rail-ink); font-weight: 500; }
.nav a.nav-sub em { display: block; font-style: normal; font-size: 12px; color: var(--rail-ink-3); font-variant-numeric: tabular-nums; }

.rail-foot { border-top: 1px solid var(--rail-line); padding: 10px; flex: none; display: grid; gap: 8px; }

/* language switcher, in the rail so it is reachable from any screen */
.lang { display: flex; gap: 2px; padding: 2px; background: rgba(255, 255, 255, 0.06); border-radius: var(--r-2); }
.lang button {
  flex: 1; border: 0; background: none; cursor: pointer; padding: 5px 0; border-radius: var(--r-1);
  font-size: 12px; font-weight: 500; color: var(--rail-ink-3);
  transition: background 120ms var(--ease), color 120ms var(--ease);
}
.lang button:hover { color: var(--rail-ink); }
.lang button[aria-pressed='true'] { background: rgba(255, 255, 255, 0.12); color: var(--rail-ink); }

/* Chinese sets wider and does not want Latin's tightened tracking. */
:root[data-lang='zh'] body { line-height: 1.7; }
:root[data-lang='zh'] h1, :root[data-lang='zh'] h2, :root[data-lang='zh'] h3,
:root[data-lang='zh'] .tile-v, :root[data-lang='zh'] .kv-total .v { letter-spacing: 0; }
:root[data-lang='zh'] .lbl, :root[data-lang='zh'] thead th { font-size: 13px; }

/* workspace ---------------------------------------------------------------- */
.main { padding: 0 32px 72px; min-width: 0; }

/* page header: 40px title, actions right-aligned with the primary one last */
.page-head { display: flex; align-items: flex-start; gap: 24px; padding: 36px 0 0; flex-wrap: wrap; }
.page-head > div:first-child { flex: 1 1 340px; min-width: 0; }
.page-head h1 + p { margin-top: 8px; color: var(--ink-2); max-width: 82ch; }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding-top: 8px; }

/* the measured vertical rhythm: 40 / 40 / 32 / 12 / 32 */
.tabs {
  display: flex; gap: 24px; margin: 40px 0 0; border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  border: 0; background: none; cursor: pointer; padding: 0 0 12px; white-space: nowrap;
  font-size: 16px; font-weight: 400; color: var(--ink-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color 120ms var(--ease), border-color 120ms var(--ease);
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected='true'] { color: var(--ink); font-weight: 500; border-bottom-color: var(--ink); }
.tabs + * { margin-top: 40px; }

.stack { display: grid; gap: 32px; }
.grid { display: grid; gap: 24px; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.cols-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.split { display: grid; gap: 32px; grid-template-columns: minmax(0, 1.62fr) minmax(320px, 0.88fr); align-items: start; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-tight { display: flex; gap: 8px; align-items: center; }
.between { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

@media (max-width: 1180px) {
  :root { --rail: 64px; }
  .brand-text, .brand svg, .nav a span, .nav-group, .nav-sub, .rail-foot .switcher-text { display: none; }
  .nav a { justify-content: center; padding: 0; }
  .brand { justify-content: center; padding: 0; }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .rail {
    position: fixed; inset: auto 0 0 0; height: auto; flex-direction: row; top: auto;
    border-top: 1px solid var(--rail-line);
  }
  .brand { display: none; }
  .rail-foot {
    display: flex; align-items: center; border-top: 0; border-left: 1px solid var(--rail-line);
    padding: 6px 8px; flex: none;
  }
  .rail-foot .switcher { display: none; }
  .lang button { padding: 5px 8px; }
  .nav { flex-direction: row; overflow-x: auto; padding: 6px; gap: 2px; }
  .nav a { padding: 0 12px; }
  .main { padding: 0 16px 88px; }
  h1 { font-size: 28px; }
  .page-head { padding-top: 24px; }
  .denom-row { grid-template-columns: 76px 1fr 64px 92px; gap: 8px; }
}

/* ========================================================== metric band
   Figures sit in one flat tinted band as label-above-value. Not boxed
   cards, and not separated by rules — the band itself is the container.   */
.tiles {
  display: flex; flex-wrap: wrap; align-items: flex-start;
  background: var(--surface); border-radius: var(--r-3); padding: 18px 24px; gap: 20px 48px;
}
/* Figures take their content's width. Equal columns are what makes a metric
   row read as five identical cards. */
.tile { min-width: 0; flex: 0 0 auto; max-width: 280px; }
.tile-dominant { flex: 0 0 auto; margin-right: 8px; }
.tile .lbl { display: block; margin-bottom: 4px; }
.tile-v { font-size: 22px; font-weight: 600; color: var(--ink); letter-spacing: -0.014em; line-height: 1.2; }
.tile-v small { font-size: 14px; font-weight: 500; color: var(--ink-2); letter-spacing: 0; }
.tile-d { margin-top: 4px; font-size: 12px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.tile-dominant .tile-v { font-size: 30px; }
/* cents at half the size of the figure */
.tile-v .dec { font-size: 0.5em; font-weight: 500; color: var(--ink-2); letter-spacing: 0; }

/* ============================================================== sections
   Sections are flat. A table is the page, not a card sitting on the page. */
.panel { min-width: 0; }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 0 0 16px; }
.panel-head h2, .panel-head h3 { flex: 1; min-width: 0; font-size: 20px; font-weight: 600; }
.panel-body { padding: 0; }
.panel-foot { padding: 16px 0 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* the genuine card, for a surface that really must lift off the page */
.card {
  background: var(--bg); border-radius: var(--r-3); box-shadow: var(--shadow-card);
  padding: 20px;
}
.card > .panel-head { padding-bottom: 14px; }
.card > .panel-foot { padding-top: 14px; }

/* ================================================================ tables */
.tw { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left; font-size: 12px; font-weight: 500; color: var(--ink-2);
  padding: 0 16px 10px; white-space: nowrap; border-bottom: 1px solid var(--line);
  background: var(--bg); position: sticky; top: 0; z-index: 1;
}
thead th:first-child, tbody td:first-child, tfoot td:first-child { padding-left: 0; }
thead th:last-child, tbody td:last-child, tfoot td:last-child { padding-right: 0; }
tbody td {
  padding: 0 16px; height: var(--row); border-bottom: 1px solid var(--line);
  vertical-align: middle; color: var(--ink-body);
}
tbody tr { transition: background 100ms var(--ease); }
tbody tr[data-click]:hover { background: var(--surface); cursor: pointer; }
tbody tr[aria-selected='true'] { background: var(--primary-wash); }
tfoot td { padding: 0 16px; height: 52px; font-weight: 500; color: var(--ink); border-top: 1px solid var(--line-2); }
.r { text-align: right; }
/* Identifiers and reference codes never wrap: a broken reference reads as two
   values, and the wrap pushed rows past the 56px they are designed around. */
.ref { white-space: nowrap; }
.c { text-align: center; }
.flash { animation: flash 1.2s var(--ease); }
@keyframes flash { from { background: var(--primary-wash); } to { background: transparent; } }

/* the filter row: search and selects left, table controls right */
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.filters .search { flex: 0 1 280px; }
.filters .spacer { flex: 1 1 auto; }

/* ============================================================== controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--r-2); cursor: pointer; white-space: nowrap;
  font-size: 14px; font-weight: 500;
  border: 1px solid var(--line); background: var(--bg); color: var(--primary);
  transition: background 120ms var(--ease), border-color 120ms var(--ease), color 120ms var(--ease);
}
.btn:hover { background: var(--surface); border-color: var(--line-2); }
.btn[disabled] { background: var(--line); border-color: var(--line); color: var(--ink-disabled); cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; stroke-width: 1.6; }
.btn-primary { background: var(--action); border-color: var(--action); color: #FFF; }
.btn-primary:hover { background: var(--action-hi); border-color: var(--action-hi); }
.btn-primary[disabled] { background: var(--line); border-color: var(--line); color: var(--ink-disabled); }
.btn-ghost { border-color: transparent; background: none; color: var(--primary); }
.btn-ghost:hover { background: var(--primary-wash); border-color: transparent; }
/* There is no destructive variant. A rejection is a plain secondary button. */
.btn-risk { color: var(--risk); }
.btn-risk:hover { background: var(--surface); }
.btn-neutral { color: var(--ink); }
.btn-icon { width: 40px; padding: 0; color: var(--ink-2); }
.btn-icon:hover { color: var(--ink); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; }
.btn-block { width: 100%; }

.field { display: grid; gap: 6px; min-width: 0; }
.field > label { font-size: 12px; font-weight: 500; color: var(--ink-2); }
.input, .select {
  height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-2);
  background: var(--bg); width: 100%; font-size: 14px; color: var(--ink);
  transition: border-color 120ms var(--ease), box-shadow 120ms var(--ease);
}
.input:hover, .select:hover { border-color: var(--line-2); }
.input:focus, .select:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(97, 47, 255, 0.12);
}
.input::placeholder { color: var(--ink-3); }
.input-lg {
  height: 64px; font-size: 28px; font-weight: 600; padding: 0 14px; letter-spacing: -0.016em;
  background: var(--surface); border-color: transparent; font-variant-numeric: tabular-nums;
}
.input-lg:hover { background: var(--surface-2); border-color: transparent; }
.input-lg:focus { background: var(--bg); }
.select {
  appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2368707A' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M4 6.5L8 10.5l4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
.search { position: relative; }
.search .input { padding-left: 36px; background: var(--surface); border-color: transparent; }
.search .input:focus { background: var(--bg); }
.search svg {
  position: absolute; left: 12px; top: 50%; translate: 0 -50%; width: 16px; height: 16px;
  color: var(--ink-3); stroke-width: 1.7; pointer-events: none;
}
input[type='checkbox'] {
  appearance: none; width: 16px; height: 16px; border: 1px solid var(--line-2);
  border-radius: var(--r-1); background: var(--bg); cursor: pointer; flex: none;
  display: inline-grid; place-content: center; margin: 0;
}
input[type='checkbox']:hover { border-color: var(--primary-300); }
input[type='checkbox']:checked { background: var(--primary); border-color: var(--primary); }
input[type='checkbox']:checked::after {
  content: ''; width: 9px; height: 5px; border: 1.8px solid #FFF;
  border-top: 0; border-right: 0; rotate: -45deg; translate: 0 -1px;
}
input[type='range'] { accent-color: var(--primary); width: 100%; }

.seg { display: inline-flex; gap: 4px; padding: 3px; background: var(--surface); border-radius: var(--r-2); }
.seg button {
  border: 0; background: none; cursor: pointer; padding: 6px 14px; border-radius: var(--r-1);
  font-size: 14px; font-weight: 400; color: var(--ink-2);
  transition: background 120ms var(--ease), color 120ms var(--ease);
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed='true'] { background: var(--bg); color: var(--ink); font-weight: 500; box-shadow: 0 1px 2px rgba(20,23,26,.06); }
.seg-dir button { padding: 9px 18px; }

.switcher {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px;
  border: 0; border-radius: var(--r-2); background: none; color: var(--rail-ink-2);
  cursor: pointer; text-align: left;
}
.switcher:hover { background: var(--rail-hover); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: rgba(255,255,255,0.1); color: var(--rail-ink); font-size: 11px; font-weight: 600;
}
/* the same control inside the white workspace */
dialog .switcher { color: var(--ink); border: 1px solid var(--line); }
dialog .switcher:hover { background: var(--surface); }
dialog .avatar { background: var(--surface-2); color: var(--ink-2); }

/* ================================================================ status
   Rectangular chips, 24px tall, 4px radius, sentence case. Colour only
   where a state genuinely needs it; routine states stay neutral.          */
.pill {
  display: inline-flex; align-items: center; height: 24px; padding: 0 8px;
  border-radius: var(--r-1); font-size: 12px; font-weight: 500; white-space: nowrap;
  background: var(--off-bg); color: var(--off);
}
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-risk { background: var(--risk-bg); color: var(--risk); }
.pill-info { background: var(--pend-bg); color: var(--pend); }
/* Direction is not a state: it gets no chip and no colour. */
.pill-buy, .pill-sell { background: none; color: var(--ink-2); padding: 0; height: auto; font-weight: 400; }
/* the routine state: no chip at all, just quiet text */
.pill-plain { background: none; color: var(--ink-2); padding: 0; height: auto; font-weight: 400; }
.badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: grid; place-items: center;
  background: var(--coral); color: var(--rail-bg); font-size: 11px; font-weight: 600;
}
.cc {
  display: inline-grid; place-items: center; width: 22px; height: 16px; border-radius: 2px; flex: none;
  background: var(--surface-2); color: var(--ink-2); font-size: 9px; font-weight: 600; letter-spacing: 0.02em;
}

/* ============================================================= key/value */
.kv { display: grid; }
.kv > div { display: flex; align-items: baseline; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.kv > div:last-child { border-bottom: 0; }
.kv dt, .kv .k { color: var(--ink-2); font-size: 14px; flex: 1; min-width: 0; }
.kv dd, .kv .v { margin: 0; text-align: right; color: var(--ink); font-weight: 500; }
.kv-total { border-top: 1px solid var(--line-2) !important; border-bottom: 0 !important; padding-top: 14px !important; }
.kv-total .k { color: var(--ink); font-weight: 500; }
.kv-total .v { font-size: 22px; font-weight: 600; letter-spacing: -0.014em; }

/* ================================================================ alerts
   A compact row, not a card. One line wherever possible.                  */
.callout {
  display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--r-2);
  background: var(--surface); font-size: 13px; color: var(--ink-2); line-height: 1.5;
}
.callout svg { width: 16px; height: 16px; flex: none; stroke-width: 1.6; margin-top: 2px; color: var(--ink-3); }
.callout strong { color: var(--ink); font-weight: 500; }
.callout-ok svg { color: var(--ok); }
.callout-warn { background: #FEF9E7; color: #6B4A16; }
.callout-warn strong, .callout-warn svg { color: var(--warn); }
.callout-risk { background: #FFF4F3; color: #8A2A1C; }
.callout-risk strong, .callout-risk svg { color: var(--risk); }

/* one attention row — the alternative to a large alert card */
.attention {
  display: flex; align-items: center; gap: 12px; padding: 14px 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 14px;
}
.attention > svg { width: 16px; height: 16px; flex: none; color: var(--risk); stroke-width: 1.7; }
.attention .grow { flex: 1; min-width: 0; color: var(--ink-2); }
.attention strong { color: var(--ink); font-weight: 500; }

/* =============================================================== counter */
.denoms { display: grid; }
.denom-row {
  display: grid; grid-template-columns: 96px 1fr 76px 112px; gap: 16px; align-items: center;
  height: 52px; border-bottom: 1px solid var(--line);
}
.denom-row:last-child { border-bottom: 0; }
.denom-row .input { height: 36px; text-align: right; }
.denom-row.lbl { height: 34px; }
.meter { height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.meter > i { display: block; height: 100%; background: #2B2F33; border-radius: 2px; transition: width 240ms var(--ease); }
.meter-ok > i { background: var(--primary); }
.meter-warn > i { background: var(--coral); }
.meter-risk > i { background: var(--coral-red); }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pad button {
  height: 48px; border: 1px solid var(--line); border-radius: var(--r-2); background: var(--bg);
  font-size: 16px; font-weight: 500; cursor: pointer;
}
.pad button:hover { background: var(--surface); }

/* ============================================================ rate board
   Deliberately its own world: a screen on a wall, read from three metres. */
.board { background: var(--board-bg); color: var(--board-ink); border-radius: var(--r-4); padding: 28px 32px 32px; }
.board-head { display: flex; align-items: baseline; gap: 16px; border-bottom: 1px solid var(--board-line); padding-bottom: 18px; flex-wrap: wrap; }
.board-head h2 { font-size: 22px; color: var(--board-ink); }
.board-head .lbl { color: var(--board-ink-2); }
.board thead th {
  background: none; color: var(--board-ink-2); border-bottom-color: var(--board-line);
  position: static; font-size: 12px; padding-top: 18px;
}
.board tbody td { border-bottom: 1px solid var(--board-line); height: 48px; color: var(--board-ink); }
.board tbody tr:hover { background: rgba(255,255,255,0.03); }
.board .cc { background: rgba(255,255,255,0.10); color: var(--board-ink); }
.board .t-sub { color: var(--board-ink-2); }
.board .b-buy { color: #B9AEFF; }
.board .b-sell { color: var(--coral); }
.board-figure { font-size: 20px; font-weight: 600; letter-spacing: -0.012em; }

/* ============================================================== overlays */
dialog {
  border: 0; border-radius: var(--r-4); padding: 0; background: var(--bg); color: var(--ink-body);
  box-shadow: var(--shadow-pop); max-width: min(560px, calc(100vw - 32px)); width: 100%;
}
dialog::backdrop { background: rgba(20, 23, 26, 0.4); }
dialog .panel-head { padding: 20px 24px 16px; border-bottom: 1px solid var(--line); }
dialog .panel-body { padding: 20px 24px; }
dialog .panel-foot { padding: 16px 24px; border-top: 1px solid var(--line); background: var(--surface); }

.drawer {
  position: fixed; inset: 0 0 0 auto; width: min(600px, 100%); background: var(--bg);
  box-shadow: var(--shadow-pop); z-index: var(--z-drawer);
  display: flex; flex-direction: column; animation: slide 240ms var(--ease);
}
@keyframes slide { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer .panel-head { padding: 20px 24px 16px; border-bottom: 1px solid var(--line); }
.drawer-body { overflow-y: auto; padding: 20px 24px; flex: 1; }
.drawer .panel-foot { padding: 16px 24px; border-top: 1px solid var(--line); background: var(--surface); }
.scrim { position: fixed; inset: 0; background: rgba(20, 23, 26, 0.24); z-index: var(--z-drawer); }

.toasts { position: fixed; bottom: 24px; left: 50%; translate: -50% 0; z-index: var(--z-toast); display: grid; gap: 8px; justify-items: center; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: var(--r-2);
  background: var(--ink); color: #FFF; font-size: 14px; box-shadow: var(--shadow-pop);
  animation: rise 240ms var(--ease);
}
.toast svg { width: 16px; height: 16px; stroke-width: 1.8; color: var(--coral); }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ================================================================== misc */
.spark { display: block; width: 100%; height: 28px; overflow: visible; }
.empty { padding: 56px 24px; text-align: center; color: var(--ink-2); }
.empty h3 { margin-bottom: 6px; color: var(--ink); }
.demo-note { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); }
.demo-note svg { width: 14px; height: 14px; stroke-width: 1.7; flex: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
@media print { .rail, .head-actions, .tabs { display: none; } .main { padding: 0; } }


/* ==========================================================================
   Auth pages (sign in, verification code)
   Archetype taken from the shipped auth CSS of Stripe, Increase and Mercury:
   a centred form column on the SAME pure-white ground as the workspace, with
   no card chrome at all — Stripe's auth "card" declares only position and
   flex-shrink, no background, border, radius or shadow. A card floating on
   tinted grey is the dated form. The logo is left-aligned to the column, not
   centred. The accent does not go on the button here either.
   ========================================================================== */
.auth { background: var(--bg); }
.auth-col { width: 400px; max-width: calc(100vw - 32px); margin: 96px auto 64px; }
.auth-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 32px; text-decoration: none; }
.auth-logo:hover { text-decoration: none; }
.auth-logo .brand-mark { width: 28px; height: 28px; font-size: 11px; }
.auth-logo span { font-size: 15px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
/* Auth headings are quieter than the app's 40px page titles, and getting
   quieter still — Stripe's newest auth heading is 22px/400. */
.auth h1 { font-size: 24px; line-height: 32px; font-weight: 500; letter-spacing: -0.2px; }
.auth-sub { margin-top: 8px; font-size: 14px; color: var(--ink-2); }
.auth-form { margin-top: 24px; display: grid; gap: 16px; }
.auth-form .input { border-color: var(--line-2); }
.auth-pw { position: relative; }
.auth-pw .input { padding-right: 44px; }
.auth-reveal {
  position: absolute; right: 4px; top: 4px; width: 32px; height: 32px; border: 0; padding: 0;
  background: none; color: var(--ink-3); cursor: pointer; border-radius: var(--r-1);
  display: grid; place-items: center;
}
.auth-reveal:hover { color: var(--ink); background: var(--surface); }
.auth-forgot { margin-top: -4px; text-align: right; font-size: 13px; }
.auth-error {
  display: flex; gap: 8px; margin-top: 24px; padding: 10px 12px; border-radius: var(--r-2);
  background: #FFF4F3; color: #8A2A1C; font-size: 13px; line-height: 1.5;
}
.auth-error svg { color: var(--risk); margin-top: 1px; }
.auth-note { margin-top: 24px; font-size: 13px; color: var(--ink-2); }

/* verification code — 6 discrete boxes, 3+3 grouping */
.otp { display: flex; gap: 8px; margin-top: 24px; }
.otp .otp-sep { width: 12px; flex: none; }
.otp input {
  width: 44px; height: 48px; flex: none; text-align: center; padding: 0;
  font-size: 20px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--ink);
  border: 1px solid var(--line-2); border-radius: var(--r-2); background: var(--bg);
}
.otp input:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(97, 47, 255, 0.18);
}
.otp[aria-busy='true'] { opacity: 0.6; pointer-events: none; }
.auth-resend { margin-top: 20px; font-size: 13px; }
.auth-resend .dim { color: var(--ink-3); }
.auth-alt { margin-top: 16px; display: grid; gap: 8px; font-size: 13px; justify-items: start; }
.auth-back {
  margin-top: 16px; border: 0; background: none; padding: 0; cursor: pointer;
  font-size: 13px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px;
}
.auth-back:hover { color: var(--ink); }

/* Licence identification, anti-phishing and access notice. No trust seals:
   a padlock badge is trivially copied onto a phishing clone, so it trains
   people to trust the wrong signal. The licence number stays selectable
   text so it can be checked against the BNM directory. */
.auth-foot {
  margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line);
  display: grid; gap: 12px; font-size: 12px; line-height: 18px; color: var(--ink-2);
}
.auth-foot strong { color: var(--ink); font-weight: 500; }
.auth-links { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.auth-links a { color: var(--ink-2); }
.auth-links a:hover { color: var(--primary); }
.auth-lang { margin-left: auto; display: flex; gap: 2px; }
.auth-lang button {
  border: 0; background: none; cursor: pointer; padding: 3px 7px; border-radius: var(--r-1);
  font-size: 12px; font-weight: 500; color: var(--ink-3);
}
.auth-lang button:hover { color: var(--ink); }
.auth-lang button[aria-pressed='true'] { background: var(--surface-2); color: var(--ink); }

@media (max-width: 480px) {
  .auth-col { margin-top: 48px; }
  .otp input { width: 42px; height: 48px; }
  .otp { gap: 6px; }
  .otp .otp-sep { width: 8px; }
}


/* ==========================================================================
   Split auth layout — the animated half is the product, not an illustration
   The reference products ship no decorative motion on auth (the only
   animation in Stripe's entire login stylesheet is a 600ms shake on failure).
   So rather than add a gradient hero or an illustration panel — both named
   anti-patterns — the second panel is the actual customer-facing rate board,
   with rates ticking the way a real board does. It is informative, it is
   domain-specific, and it collapses away below 1024px, leaving exactly the
   plain industry-standard column.
   ========================================================================== */
.auth-split { display: grid; grid-template-columns: 1fr; min-height: 100dvh; }
.auth-pane { display: flex; justify-content: center; padding: 96px 32px 64px; min-width: 0; }
.auth-pane .auth-col { margin: 0; }

.auth-board {
  display: none; background: var(--board-bg); color: var(--board-ink);
  padding: 56px 48px; flex-direction: column; justify-content: center; min-width: 0;
}
@media (min-width: 1024px) {
  .auth-split { grid-template-columns: minmax(520px, 1fr) minmax(480px, 0.92fr); }
  .auth-board { display: flex; }
}
.auth-board-head { display: flex; align-items: baseline; gap: 12px; padding-bottom: 20px; border-bottom: 1px solid var(--board-line); }
.auth-board-head h2 { font-size: 19px; font-weight: 500; color: var(--board-ink); letter-spacing: -0.01em; }
.auth-board-live { margin-left: auto; display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--board-ink-2); }
.auth-board-live i {
  width: 6px; height: 6px; border-radius: 50%; background: #3FCF8E; flex: none;
  animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.auth-board table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
/* The app's thead rule paints a sticky white header; on the dark board that
   renders as a white band across the panel. Override both. */
.auth-board thead th {
  text-align: left; font-size: 11px; font-weight: 500; color: var(--board-ink-2);
  padding: 18px 0 10px; border-bottom: 1px solid var(--board-line);
  background: none; position: static;
}
.auth-board table { table-layout: fixed; }
.auth-board th:nth-child(1), .auth-board td:nth-child(1) { width: 22%; }
.auth-board th:nth-child(2), .auth-board td:nth-child(2) { width: 34%; }
.auth-board th.r, .auth-board td.r { text-align: right; }
.auth-board td { padding: 0; height: 44px; border-bottom: 1px solid rgba(255,255,255,.06); color: var(--board-ink); font-size: 14px; }
.auth-board .b-buy { color: #B9AEFF; font-weight: 500; }
.auth-board .b-sell { color: var(--coral); font-weight: 500; }
/* a rate that just moved lifts briefly, the way a dealing board reads */
.auth-board .tick { animation: tick 900ms var(--ease); }
@keyframes tick { 0% { opacity: .35; transform: translateY(-2px); } 100% { opacity: 1; transform: none; } }
.auth-board-foot { margin-top: 22px; font-size: 12px; color: var(--board-ink-2); line-height: 1.5; }

/* entrance: plays once, from nothing to a settled state, never scroll-gated */
.auth-rise { animation: rise 520ms var(--ease) both; }
.auth-rise:nth-child(1) { animation-delay: 40ms; }
.auth-rise:nth-child(2) { animation-delay: 90ms; }
.auth-rise:nth-child(3) { animation-delay: 140ms; }
@keyframes rise { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

/* Stripe's evidenced failure shake — the one animation real auth pages ship */
.auth-shake { animation: authshake 600ms ease both; }
@keyframes authshake {
  10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); } 40%, 60% { transform: translateX(4px); }
}

@media (prefers-reduced-motion: reduce) {
  .auth-board-live i, .auth-board .tick, .auth-rise, .auth-shake { animation: none !important; }
}
@media (max-width: 480px) { .auth-pane { padding: 48px 16px 56px; } }
