/* ============================================================
   ezpztrader.com — shared components (UI_REDESIGN.md §11)
   Loaded on every page (marketing + app) right after tokens.css.
   Restyles today's class names so un-migrated markup picks up the
   new look, and adds the new shared components. Visual only: no
   selector here changes what an element does.
   Sections: 1 reset · 2 type · 3 layout · 4 buttons · 5 badges ·
   6 cards · 7 tables · 8 forms · 9 feedback · 10 overlays ·
   11 navigation bits · 12 content · 13 utilities · 14 motion
   ============================================================ */

@layer legacy {

/* ---------- 1. reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-md);
  letter-spacing: var(--tracking-body);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv01" on, "ss03" on;
  overflow-x: hidden;
}
::selection { background: var(--action); color: var(--on-action); }
img, svg { max-width: 100%; display: block; }
/* Icon safety net (§14): zero specificity, icon contexts only — charts are untouched. */
:where(nav, header, aside, button, a, summary, label, .btn) svg:not([width]) { width: 1.25em; height: 1.25em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-xs); }
[data-theme="light"] .icon-moon,
[data-theme="dark"] .icon-sun { display: none; }

/* ---------- 2. type ---------- */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: var(--weight-semi);
  line-height: var(--leading-heading);
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin: 0 0 .5em;
  color: var(--ink);
}
h1 { font-size: var(--text-h1); line-height: var(--leading-tight); letter-spacing: var(--tracking-tight); }
h2 { font-size: var(--text-h2); line-height: 1.15; letter-spacing: var(--tracking-tight); }
h3 { font-size: var(--text-h3); letter-spacing: var(--tracking-tight); }
h4 { font-size: var(--text-lg); letter-spacing: -0.005em; }
p { margin: 0 0 1em; max-width: var(--measure); }
a { color: var(--action-ink); text-decoration: none; transition: color .15s var(--ease-out); }
a:hover { color: var(--link-hover); }
code, pre, kbd, samp, .mono { font-family: var(--font-mono); }
code { font-size: .92em; }
pre {
  background: var(--code-bg);
  color: var(--code-ink);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  overflow-x: auto;
  font-size: var(--text-sm);
  line-height: var(--leading-loose);
}
ul, ol { padding-left: var(--space-5); }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--space-6) 0; }
.num, td.num, th.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
/* A mono input's placeholder ("e.g. AAPL", "10") is a hint, not a value: the UI font. */
input.num::placeholder, input.mono::placeholder, textarea.mono::placeholder { font-family: var(--font-body); letter-spacing: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }

/* Eyebrow: kept as a class, restyled from tracked mono to a quiet label. */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: .02em;
  text-transform: none;
  color: var(--ink-3);
  margin-bottom: var(--space-3);
}
/* A short violet-to-teal sweep line (tokens.css premium layer). */
.eyebrow::before {
  content: "";
  flex: none;
  width: 24px; height: 2px;
  border-radius: 2px;
  background: var(--sweep);
}

/* ---------- 3. layout ---------- */
.container { max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); position: relative; }
.stack { display: flex; flex-direction: column; }
.row { display: flex; flex-wrap: wrap; align-items: center; }
.grid { display: grid; gap: var(--space-6); }
.section { padding: var(--section-y) 0; position: relative; }
.cluster { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }

/* Page header — one pattern everywhere (title · description · actions). */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3) var(--space-6);
  margin-bottom: var(--space-6);
}
.page-head > :first-child { min-width: 0; }
.page-head h1, .page-title {
  font-size: var(--text-3xl);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0;
}
.page-head p, .page-desc { color: var(--ink-2); font-size: var(--text-base); margin: var(--space-1) 0 0; }

/* ---------- 4. buttons ---------- */
.link-btn, .link-button {
  background: none; border: 0; padding: 0; margin: 0;
  font: inherit; font-weight: var(--weight-medium);
  color: var(--action-ink); cursor: pointer;
}
.link-btn:hover, .link-button:hover { color: var(--link-hover); text-decoration: underline; }

/* ---------- 5. badges, pills, chips ---------- */
/* Account type: styles the EXISTING "(Paper)"/"Live" text only. */
.acct-badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 20px; padding: 0 7px;
  border-radius: var(--radius-xs);
  font-size: var(--text-2xs);
  font-weight: var(--weight-semi);
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  vertical-align: middle;
}
.acct-badge.is-live { background: var(--live-soft); color: var(--live); }
.acct-badge.is-live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--live); }
.acct-badge.is-paper { color: var(--ink-2); border: 1px solid var(--border-strong); }

.count {
  display: inline-grid; place-items: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--action);
  color: var(--on-action);
  font-size: var(--text-2xs);
  font-weight: var(--weight-bold);
  line-height: var(--leading-none);
}

/* Legacy colour-cycle badges (some set from templates/Python): Ion tones. */
.badge-violet, .badge-magenta { background: var(--brand-soft); color: var(--brand); }
.badge-gold { background: var(--warn-soft); color: var(--warn); }
.badge-teal { background: var(--action-soft); color: var(--action-ink); }
.badge-blue { background: var(--info-soft); color: var(--info); }
.badge-rose { background: var(--danger-soft); color: var(--danger); }

/* Direction + money colour (from the sign/class templates already have). */
.dir-buy, .pnl-pos, .is-profit { color: var(--buy); }
.dir-sell, .pnl-neg, .is-loss { color: var(--sell); }

/* Fill timing cell — HTML built in Python (trading_extras.py); restyle only. */
.fill-timing { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: var(--weight-medium); white-space: nowrap; }
.fill-timing-icon { width: 16px; height: 16px; flex-shrink: 0; }
.fill-timing-buy { color: var(--ok); }
.fill-timing-accent { color: var(--info); }
.fill-timing-gold { color: var(--warn); }
.fill-timing-sell { color: var(--danger); }
.fill-timing-ms { color: var(--ink-3); font-family: var(--font-mono); font-size: var(--text-xs); font-weight: var(--weight-normal); font-variant-numeric: tabular-nums; }
.fill-timing-note { display: block; min-width: 11rem; max-width: 18rem; margin-top: var(--space-1); color: var(--ink-3); font-size: var(--text-xs); line-height: var(--leading-snug); white-space: normal; }

/* ---------- 6. cards ---------- */
/* KPI / stat tiles */
/* --stat-min ({% stat_grid min= %}): the narrowest tile before the row wraps; 8rem fits two in a 20rem card. */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--stat-min, 8rem)), 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.stat { background: var(--surface); padding: var(--space-3) var(--space-4); display: grid; gap: 2px; min-width: 0; }
.stat-label { font-size: var(--text-xs); color: var(--ink-3); }
.stat-value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: var(--text-xl); font-weight: var(--weight-medium); color: var(--ink); }
.stat-sub { font-size: var(--text-xs); color: var(--ink-3); }
/* Money colour must win over the neutral stat value colour. */
.stat-value.pnl-pos, .pnl-pos .stat-value, .stat-value.is-profit, .stat-value.dir-buy { color: var(--buy); }
.stat-value.pnl-neg, .pnl-neg .stat-value, .stat-value.is-loss, .stat-value.dir-sell { color: var(--sell); }

/* ---------- 7. tables ---------- */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow-x: auto;
  /* Contains the cells' absolutely placed .sr-only text; without it that
     text sits past the scrolled-off columns and widens the whole page. */
  position: relative;
}
table { border-collapse: collapse; width: 100%; font-size: var(--text-base); }
th, td { text-align: left; padding: 0 var(--space-3); height: 44px; border-bottom: 1px solid var(--border); vertical-align: middle; }
td { padding-top: var(--space-2); padding-bottom: var(--space-2); }
thead th {
  height: 36px;
  background: var(--surface);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink-3);
  white-space: nowrap;
}
th.num { font-family: var(--font-body); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--raised) 60%, transparent); }
.truncate { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 1024px) { .table-wrap.is-fit { overflow: visible; } }

/* Pagination (trading/_pagination.html) */
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-4); font-size: var(--text-sm); color: var(--ink-2); }
.pagination a, .pagination span { min-width: 32px; height: 32px; padding: 0 var(--space-2); display: inline-grid; place-items: center; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); color: var(--ink); background: var(--surface); }
.pagination a:hover { border-color: var(--input-border); color: var(--ink); }
.pagination [aria-current="page"] { background: var(--action-soft); border-color: var(--action); color: var(--ink); }

/* ---------- 8. forms ---------- */
.form-field { margin-bottom: var(--space-5); }
.form-field[hidden] { display: none; }
.form-field > label, .field-label, .form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--ink);
  margin-bottom: var(--space-2);
}
.input, .select, .textarea,
.form-field input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="color"]),
.form-field select,
.form-field textarea,
.filter-field select,
.filter-field input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]) {
  width: 100%;
  min-height: var(--control-md);
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  transition: border-color .15s var(--ease-out), box-shadow .15s var(--ease-out);
}
.input::placeholder, .textarea::placeholder, .form-field input::placeholder, .form-field textarea::placeholder, .filter-field input::placeholder { color: var(--ink-3); opacity: .8; }
.select, .form-field select, .filter-field select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: var(--space-8);
  cursor: pointer;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.textarea, .form-field textarea { line-height: var(--leading-relaxed); resize: vertical; }
.input:focus, .select:focus, .textarea:focus,
.form-field input:focus, .form-field select:focus, .form-field textarea:focus,
.filter-field input:focus, .filter-field select:focus {
  outline: 2px solid var(--focus);
  outline-offset: 0;
  border-color: var(--focus);
  box-shadow: none;
}
.input:disabled, .select:disabled, .form-field input:disabled, .form-field select:disabled, .form-field textarea:disabled { opacity: .6; cursor: not-allowed; }
.form-field input[aria-invalid="true"], .input[aria-invalid="true"] { border-color: var(--danger); }
.form-field .helptext, .help, .form-help { display: block; font-size: var(--text-sm); color: var(--ink-2); margin-top: var(--space-2); line-height: var(--leading-snug); }
.form-field .helptext[hidden] { display: none; }
.form-field .errorlist, .errorlist { list-style: none; margin: var(--space-2) 0 0; padding: 0; color: var(--danger); font-size: var(--text-sm); }
.form-field-hint { display: block; font-size: var(--text-sm); color: var(--ink-2); margin-top: var(--space-2); line-height: var(--leading-snug); }
.form-field-error { display: block; margin-top: var(--space-2); color: var(--danger); font-size: var(--text-sm); }
.form-field-error[hidden] { display: none; }
.form-errors {
  list-style: none;
  margin: 0 0 var(--space-5);
  padding: var(--space-3) var(--space-4);
  background: var(--danger-soft);
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
  border-radius: var(--radius-md);
  color: var(--danger);
  font-size: var(--text-sm);
}
.form-row { display: flex; gap: var(--space-4); }
.form-row .form-field { flex: 1; min-width: 0; }
.form-actions { margin-top: var(--space-6); }
.form-footer { margin-top: var(--space-6); text-align: center; font-size: var(--text-base); color: var(--ink-2); }
.form-footer a { font-weight: var(--weight-medium); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--action); }
.checkbox-option {
  display: flex; align-items: flex-start; gap: var(--space-2);
  font-size: var(--text-base); font-weight: var(--weight-normal);
  color: var(--ink-2); cursor: pointer;
}
.checkbox-option input:not(.switch-input) { width: 16px; height: 16px; flex-shrink: 0; margin-top: 3px; }
.checkbox-option a { font-weight: var(--weight-medium); }

/* Segmented control (visually-hidden radios inside labels). */
.segmented, .seg-group {
  display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px;
  background: var(--sunken); border: 1px solid var(--border); border-radius: var(--radius-md);
}
.segmented label, .seg-option {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 30px; padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm); font-weight: var(--weight-medium);
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
  border: 0;
  background: transparent;
}
.segmented input, .seg-option input {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); border: 0; white-space: nowrap;
}
.segmented label:has(input:checked), .seg-option:has(input:checked), .seg-option.is-active, .seg-option.is-on {
  background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-xs), inset 0 0 0 1px var(--border-strong);
}
.segmented label:has(input:focus-visible), .seg-option:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }

/* Switch look for an existing checkbox (input stays the same element). */
.switch-input { appearance: none; -webkit-appearance: none; position: relative; width: 34px; height: 20px; border-radius: var(--radius-pill); background: var(--input-border); cursor: pointer; flex: none; transition: background .15s; margin: 0; }
.switch-input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--knob); transition: transform .15s; box-shadow: var(--shadow-xs); }
.switch-input:checked { background: var(--action); }
.switch-input:checked::after { transform: translateX(14px); }

/* ---------- 9. feedback ---------- */
.toast-stack {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: var(--z-toast);
  display: flex; flex-direction: column; gap: var(--space-2);
  width: min(92vw, 380px);
}
.toast {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--raised);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--neutral);
  box-shadow: var(--shadow-pop);
  font-size: var(--text-base);
  color: var(--ink);
  line-height: var(--leading-snug);
}
.toast-success { border-left-color: var(--ok); }
.toast-error   { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warn); }
.toast-info    { border-left-color: var(--info); }
/* upgrade-modal.js turns this message into #upgrade-modal (ASSET_CLASS_LIMITS.md); hide the toast. */
.toast.toast-upgrade-modal { display: none; }
/* The × is the kit's btn btn-quiet btn-icon; only its placement here. */
.toast-close { flex-shrink: 0; font-size: var(--text-xl); line-height: var(--leading-none); }
@media (max-width: 640px) {
  .toast-stack { left: var(--space-3); right: var(--space-3); width: auto; top: max(var(--space-3), env(safe-area-inset-top)); }
}

.callout, .inline-alert {
  display: flex; gap: var(--space-3); align-items: flex-start;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--sunken);
  font-size: var(--text-sm);
  color: var(--ink-2);
}
.callout.is-warning { border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: var(--warn-soft); color: var(--ink); }
.callout.is-danger { border-color: color-mix(in srgb, var(--danger) 45%, transparent); background: var(--danger-soft); color: var(--ink); }
.callout.is-info { border-color: color-mix(in srgb, var(--info) 45%, transparent); background: var(--info-soft); color: var(--ink); }

.empty {
  display: grid; justify-items: center; text-align: center; gap: var(--space-2);
  padding: var(--space-10) var(--space-4);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  color: var(--ink-2);
}
.empty-icon { width: 40px; height: 40px; border-radius: var(--radius-md); background: var(--sunken); display: grid; place-items: center; color: var(--ink-3); }
.empty-icon svg { width: 20px; height: 20px; }
.empty h2, .empty h3 { font-size: var(--text-lg); margin: 0; }
.empty p { margin: 0 auto; max-width: 44ch; font-size: var(--text-base); }

/* ---------- 10. overlays ---------- */
dialog.modal {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  padding: 0;
  background: var(--raised);
  color: var(--ink);
  box-shadow: var(--shadow-2);
  max-width: min(92vw, 560px);
  width: 100%;
}
dialog.modal::backdrop { background: var(--overlay); backdrop-filter: blur(2px); }
.modal-inner { padding: var(--space-6); }
/* × close: the kit's btn btn-quiet btn-icon; .modal-close only places it top-right. */
.modal-close, .modal-x { position: absolute; top: var(--space-3); right: var(--space-3); }
.modal-close svg, .modal-x svg { width: 16px; height: 16px; }

/* Waitlist modal (base.html) */
dialog.waitlist-modal { max-width: min(92vw, 420px); background: var(--raised); }
.waitlist-modal-inner { padding: var(--space-8) var(--space-6) var(--space-6); position: relative; }
.waitlist-modal-inner .eyebrow { margin-bottom: var(--space-3); }
.waitlist-modal-inner h2 { margin: 0 0 var(--space-2); font-size: var(--text-2xl); }
.waitlist-modal-lede { margin: 0 0 var(--space-5); color: var(--ink-2); line-height: var(--leading-relaxed); }
.waitlist-modal-error { margin: calc(var(--space-3) * -1) 0 var(--space-4); color: var(--danger); font-size: var(--text-sm); }

/* Confirm modal (base.html #confirm-modal — replaces window.confirm, confirm.js) */
dialog.modal-confirm { max-width: min(calc(100vw - 2 * var(--space-4)), 400px); }
dialog.modal-confirm .modal-inner,
dialog.modal-upgrade .modal-inner {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: var(--space-7) var(--space-6) var(--space-6);
}
.modal-confirm-icon {
  display: grid; place-items: center; flex-shrink: 0;
  width: 44px; height: 44px; margin-bottom: var(--space-4);
  border-radius: 50%; background: var(--warn-soft); color: var(--warn);
}
.modal-confirm-icon svg { width: 22px; height: 22px; }
.modal-confirm-message { margin: 0 0 var(--space-6); color: var(--ink); font-size: var(--text-md); line-height: var(--leading-relaxed); overflow-wrap: anywhere; }
.modal-confirm-actions { display: flex; gap: var(--space-3); width: 100%; }
.modal-confirm-actions .btn { flex: 1 1 0; --btn-h: var(--control-md); }

/* Upgrade modal (asset-class plan limit — ASSET_CLASS_LIMITS.md) */
dialog.modal-upgrade { max-width: min(calc(100vw - 2 * var(--space-4)), 720px); }
dialog.modal-upgrade .modal-inner { max-height: calc(100vh - 2 * var(--space-6)); overflow-y: auto; }
dialog.modal-upgrade .modal-confirm-message { max-width: 52ch; }
.upgrade-plan-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-3);
  width: 100%; margin-bottom: var(--space-6); text-align: left;
}
.upgrade-plan-card {
  display: flex; flex-direction: column; padding: var(--space-4);
  background: var(--sunken); border: 1px solid var(--border); border-radius: var(--radius-md);
}
.upgrade-plan-card.is-current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.upgrade-plan-card-name {
  display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap;
  margin: 0 0 var(--space-1); font-size: var(--text-md); font-weight: var(--weight-semi); color: var(--ink);
}
.upgrade-plan-card-badge {
  font-size: var(--text-2xs); font-weight: var(--weight-semi); padding: 2px var(--space-2);
  border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--accent-ink);
}
.upgrade-plan-card-price { margin: 0 0 var(--space-3); font-size: var(--text-2xl); font-weight: var(--weight-bold); color: var(--ink); font-variant-numeric: tabular-nums; }
.upgrade-plan-card-price span { font-size: var(--text-sm); font-weight: var(--weight-normal); color: var(--ink-3); }
.upgrade-plan-specs { margin: 0 0 var(--space-4); font-size: var(--text-sm); }
.upgrade-plan-specs div { display: flex; justify-content: space-between; padding: var(--space-1) 0; }
.upgrade-plan-specs dt { color: var(--ink-2); }
.upgrade-plan-specs dd { margin: 0; color: var(--ink); font-weight: var(--weight-semi); }
.upgrade-plan-card-cta { margin-top: auto; width: 100%; justify-content: center; }
.upgrade-plan-card-cta[aria-disabled="true"] { pointer-events: none; opacity: .6; }
@media (max-width: 480px) {
  .modal-confirm-actions { flex-direction: column-reverse; }
}
.waitlist-modal-success:not([hidden]) { display: flex; flex-direction: column; align-items: center; text-align: center; }
.waitlist-modal-success p { margin: 0 0 var(--space-5); color: var(--ink-2); line-height: var(--leading-relaxed); }
.waitlist-modal-success .btn { width: 100%; }
.waitlist-modal-icon { display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; margin-bottom: var(--space-4); border-radius: 50%; background: var(--ok-soft); color: var(--ok); }
.waitlist-modal-icon svg { width: 24px; height: 24px; }
.waitlist-modal .form-actions .btn { width: 100%; }

/* Disclosure menu (<details data-menu>; menus.js closes on Esc/outside click). */
details.menu { position: relative; }
details.menu > summary { list-style: none; cursor: pointer; }
details.menu > summary::-webkit-details-marker { display: none; }
.menu-panel {
  position: absolute; z-index: var(--z-popover);
  top: calc(100% + 6px); right: 0;
  min-width: 200px;
  padding: var(--space-1);
  background: var(--raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
  display: grid;
}
.menu-panel.is-left { right: auto; left: 0; }
.menu-panel a, .menu-panel button, .menu-item {
  display: flex; align-items: center; gap: var(--space-2);
  width: 100%;
  min-height: 34px; padding: 0 var(--space-3);
  border: 0; border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font: inherit; font-size: var(--text-base); text-align: left;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.menu-panel a:hover, .menu-panel button:hover, .menu-item:hover { background: var(--sunken); color: var(--ink); }
.menu-panel form { margin: 0; display: block; }
.menu-panel hr { margin: var(--space-1) 0; }
.menu-panel .is-danger { color: var(--danger); }
.menu-panel svg { width: 16px; height: 16px; color: var(--ink-3); flex: none; }
.menu-label { padding: var(--space-2) var(--space-3) var(--space-1); font-size: var(--text-xs); color: var(--ink-3); }

/* Tooltip-ish (chart-tooltip.js creates .chart-tooltip) */
.chart-tooltip {
  position: absolute; z-index: var(--z-tooltip); pointer-events: none;   /* chart-tooltip.js adds scroll offsets */
  padding: var(--space-2) var(--space-3);
  background: var(--raised); color: var(--ink);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop);
  font-size: var(--text-xs);
}
.chart-tooltip-title { font-weight: var(--weight-semi); }
.chart-tooltip-sub { color: var(--ink-3); font-family: var(--font-mono); }

/* ---------- 11. navigation bits ---------- */
.tabs { display: flex; gap: var(--space-1); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; margin-bottom: var(--space-5); }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tab {
  flex: none;
  padding: var(--space-2) var(--space-3);
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  font-size: var(--text-base); font-weight: var(--weight-medium);
  color: var(--ink-2); white-space: nowrap;
}
.tabs a:hover, .tab:hover { color: var(--ink); }
.tabs a[aria-current="page"], .tabs a.is-active, .tab.is-active { color: var(--ink); border-bottom-color: var(--action); }

.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: var(--text-sm); color: var(--ink-3); min-width: 0; }
.breadcrumb a { color: var(--ink-2); }
.breadcrumb a:hover { color: var(--ink); }
.breadcrumb .sep { color: var(--ink-3); opacity: .7; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: var(--z-skip);
  background: var(--action); color: var(--on-action);
  padding: var(--space-2) var(--space-4);
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: var(--weight-semi);
}
.skip-link:focus { left: 0; color: var(--on-action); }

/* Logo: the original full lockup (logo_mark.html). Sizes set per place and as attributes. */
.logo-mark { display: block; height: 28px; width: auto; flex-shrink: 0; }
.logo-mark-on-light { display: none; }
[data-theme="light"] .logo-mark-on-dark { display: none; }
[data-theme="light"] .logo-mark-on-light { display: block; }

/* Palette picker swatches (UI_REDESIGN.md §15) — shared by the public header,
   the mobile drawer and the app. Chip colours come from per-element --sw1..3. */
.palette-picker { display: grid; gap: var(--space-2); }
.palette-picker .menu-label { padding: 0; }
.palette-swatches { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); }
.palette-swatch {
  display: flex; flex-direction: column; align-items: stretch; gap: var(--space-1);
  padding: var(--space-1);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink-2);
  font: inherit; font-size: var(--text-xs); text-align: center; white-space: nowrap;
  cursor: pointer;
  transition: border-color .15s var(--ease-out), background-color .15s var(--ease-out);
}
.palette-swatch:hover { background: var(--sunken); border-color: var(--border-strong); color: var(--ink); }
.palette-swatch[aria-pressed="true"] { border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); color: var(--ink); }
.palette-swatch:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.palette-swatch-name { display: block; overflow: hidden; text-overflow: ellipsis; line-height: var(--leading-heading); }
.palette-chip {
  position: relative; display: block; flex: none;
  width: 100%; height: 22px;
  border-radius: var(--radius-sm);
  background: var(--sw1);
  box-shadow: inset 0 0 0 1px var(--border-strong);
  overflow: hidden;
}
.palette-chip > span { position: absolute; display: block; }
.palette-chip > span:first-child { left: 6px; bottom: 6px; width: 45%; height: 4px; border-radius: 2px; background: var(--sw2); }
.palette-chip > span:last-child { right: 6px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--sw3); }

/* ---------- 12. content (DB-seeded HTML: legal, about, blog) ---------- */
.prose { max-width: 72ch; color: var(--ink-2); font-size: var(--text-md); line-height: var(--leading-normal); }
.prose > * + * { margin-top: 1em; }
.prose h2 { font-size: var(--text-2xl); color: var(--ink); margin: 2em 0 .5em; }
.prose h3 { font-size: var(--text-xl); color: var(--ink); margin: 1.6em 0 .4em; }
.prose h4 { font-size: var(--text-lg); color: var(--ink); }
.prose p { max-width: none; margin: 0 0 1em; }
.prose a { text-decoration: underline; text-underline-offset: 2px; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: .35em; }
.prose strong { color: var(--ink); font-weight: var(--weight-semi); }
.prose blockquote { margin: 1.4em 0; padding: .2em 0 .2em 1em; border-left: 3px solid var(--brand); color: var(--ink); }
.prose img { border-radius: var(--radius-md); border: 1px solid var(--border); height: auto; }
.prose table { font-size: var(--text-sm); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; display: block; overflow-x: auto; }
.prose code { background: var(--sunken); padding: .1em .35em; border-radius: var(--radius-xs); color: var(--ink); }
.prose pre code { background: none; padding: 0; }

/* ---------- 13. utilities ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); border: 0; white-space: nowrap; }
.muted { color: var(--ink-2); }
.nowrap { white-space: nowrap; }
   .flex { display: flex; }   .small { font-size: var(--text-sm); }

/* ---------- 14. motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

} /* @layer legacy */

/* Phase 2 components (buttons, cards, partials, page head). The rules above stay in @layer legacy. */
@layer components {
/* ---------- buttons ----------
   Colours come from --btn-* set by the variant; size from --btn-h/--btn-px/--btn-fs,
   read with a fallback (not declared here) so a container can still size its
   buttons. Radius: fully rounded on public pages, 8px in the app (O14). */
.is-app { --btn-radius: var(--radius-md); }

.btn {
  --btn-bg: var(--raised);
  --btn-bg-hover: var(--surface-hover);
  --btn-ink: var(--ink);
  --btn-ink-hover: var(--btn-ink);
  --btn-line: var(--border-strong);
  --btn-line-hover: var(--input-border);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--btn-h, var(--space-10));
  padding: 0 var(--btn-px, var(--space-4));
  border: 1px solid var(--btn-line);
  border-radius: var(--btn-radius, var(--radius-pill));
  background: var(--btn-bg);
  color: var(--btn-ink);
  font-family: var(--font-body);
  font-size: var(--btn-fs, var(--text-base));
  font-weight: var(--weight-medium);
  line-height: var(--leading-heading);
  letter-spacing: 0;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color var(--dur-instant) var(--ease-out),
    border-color var(--dur-instant) var(--ease-out),
    color var(--dur-instant) var(--ease-out);
}
.btn svg { width: var(--space-4); height: var(--space-4); flex: none; }
@media (hover: hover) {
  .btn:hover {
    background: var(--btn-bg-hover);
    border-color: var(--btn-line-hover);
    color: var(--btn-ink-hover);
  }
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.btn:is(:disabled, [aria-disabled="true"]) {
  --btn-bg-hover: var(--btn-bg);
  --btn-line-hover: var(--btn-line);
  --btn-ink-hover: var(--btn-ink);
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}
/* Set by confirm.js and fire-panel-ticker.js while a form posts. */
:is(.fire-panel-actions, form[data-submit-once]).is-sending .btn { opacity: .5; cursor: progress; pointer-events: none; }

.btn-sm, .btn-xs { --btn-h: var(--control-sm); --btn-px: var(--space-3); --btn-fs: var(--text-sm); }
.btn-lg { --btn-h: var(--control-lg); --btn-px: var(--space-5); --btn-fs: var(--text-md); }
.btn-icon { width: var(--btn-h, var(--space-10)); padding: 0; flex: none; }
/* The × close buttons (btn btn-quiet btn-icon + their old hook class): .btn's
   position: relative would beat the @layer legacy placement, so it lives here. */
.btn.modal-close, .btn.modal-x { position: absolute; top: var(--space-3); right: var(--space-3); }
.btn.toast-close { font-size: var(--text-xl); }

/* Legacy names stay mapped until templates move: gold/main = primary,
   warning = secondary, confirm-accept = danger. */
/* Primary: the violet gradient with a lit top edge and a soft glow
   (tokens.css premium layer). --action stays the flat fallback colour. */
.btn-primary, .btn-gold, .btn-main {
  --btn-bg: var(--grad-action, var(--action));
  --btn-bg-hover: var(--grad-action-hover, var(--action-hover));
  --btn-ink: var(--on-action);
  --btn-line: var(--action-border);
  --btn-line-hover: var(--action-border);
  box-shadow: var(--shadow-action, none);
  font-weight: var(--weight-semi);
}
.btn-primary:is(:disabled, [aria-disabled="true"]),
.btn-gold:is(:disabled, [aria-disabled="true"]),
.btn-main:is(:disabled, [aria-disabled="true"]) { box-shadow: none; }
.btn-secondary, .btn-warning {
  --btn-bg: var(--raised);
  --btn-bg-hover: var(--surface-hover);
}
.btn-ghost {
  --btn-bg: transparent;
  --btn-bg-hover: var(--surface-hover);
}
.btn-quiet {
  --btn-bg: transparent;
  --btn-bg-hover: var(--surface-hover);
  --btn-ink: var(--ink-2);
  --btn-ink-hover: var(--ink);
  --btn-line: transparent;
  --btn-line-hover: transparent;
}
.btn-danger, .btn-confirm-accept {
  --btn-bg: var(--danger);
  --btn-bg-hover: color-mix(in srgb, var(--danger) 88%, var(--ink));
  --btn-ink: var(--on-danger);
  --btn-line: transparent;
  --btn-line-hover: transparent;
  font-weight: var(--weight-semi);
}
/* Tone text is mixed 15% toward --ink so it stays AA on --danger-soft in light themes. */
.btn-danger-ghost {
  --btn-bg: transparent;
  --btn-bg-hover: var(--danger-soft);
  --btn-ink: color-mix(in srgb, var(--danger) 85%, var(--ink));
  --btn-line: color-mix(in srgb, var(--danger) 40%, transparent);
  --btn-line-hover: var(--danger);
}
.btn-buy, .btn-sell {
  --btn-line: transparent;
  --btn-line-hover: transparent;
  font-weight: var(--weight-semi);
}
.btn-buy {
  --btn-bg: var(--buy);
  --btn-bg-hover: color-mix(in srgb, var(--buy) 88%, var(--ink));
  --btn-ink: var(--on-buy);
}
.btn-sell {
  --btn-bg: var(--sell);
  --btn-bg-hover: color-mix(in srgb, var(--sell) 88%, var(--ink));
  --btn-ink: var(--on-sell);
}

/* Small buttons keep their size but get a 44px hit area on touch screens. */
@media (pointer: coarse) {
  .btn::after {
    content: "";
    position: absolute;
    inset: min(0px, calc(50% - var(--control-lg) / 2));
  }
}
@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
  .btn:active { transform: none; }
}

/* ---------- card and panel ---------- */
.card {
  position: relative;
  padding: var(--space-5);
  background: var(--card-sheen, none), var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-inset);
  transition:
    border-color var(--dur-quick) var(--ease-out),
    background-color var(--dur-quick) var(--ease-out),
    transform var(--dur-quick) var(--ease-out);
}
.card p:last-child { margin-bottom: 0; }
@media (hover: hover) {
  .card--interactive:hover, .card-hover:hover { border-color: var(--border-strong); }
}
/* The lift is public-only: the app has no decorative motion (§10.6). */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  :root:not(.is-app) .card--interactive:hover,
  :root:not(.is-app) .card-hover:hover { transform: translateY(-2px); }
}
/* Cursor spotlight on interactive public cards. motion.js writes --mx/--my
   for a fine pointer; without it the light sits at the top centre. */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  :root:not(.is-app) :is(.card--interactive, .card-hover)::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 0%), var(--spot), transparent 65%);
    transition: opacity 280ms var(--ease-out);
  }
  :root:not(.is-app) :is(.card--interactive, .card-hover):hover::after { opacity: 1; }
}

.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-inset);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
}
.panel-head h2, .panel-head h3, .panel-head h4 {
  margin: 0;
  font-size: var(--text-base);
  font-weight: var(--weight-semi);
  letter-spacing: 0;
}
.panel-body { padding: var(--space-4); }

/* ---------- pills and tags ----------
   Pill: a rounded category chip (asset class, side, support). Tag: a squarer
   outlined attribute label (auth method, key type). Tone text is mixed 15%
   toward --ink so it stays AA on its soft tint in every palette. */
.pill {
  --pill-bg: var(--surface-hover);
  --pill-ink: var(--ink-2);
  --pill-line: var(--border);
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  height: var(--space-6);
  padding: 0 calc(var(--space-2) + var(--space-1) / 2);
  border: 1px solid var(--pill-line);
  border-radius: var(--radius-pill);
  background: var(--pill-bg);
  color: var(--pill-ink);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  line-height: var(--leading-none);
  white-space: nowrap;
}
.pill-buy    { --pill-bg: var(--buy-soft);   --pill-ink: color-mix(in srgb, var(--buy) 85%, var(--ink));   --pill-line: transparent; }
.pill-sell   { --pill-bg: var(--sell-soft);  --pill-ink: color-mix(in srgb, var(--sell) 85%, var(--ink));  --pill-line: transparent; }
.pill-gold   { --pill-bg: var(--warn-soft);  --pill-ink: color-mix(in srgb, var(--warn) 85%, var(--ink));  --pill-line: transparent; }
.pill-accent { --pill-bg: var(--brand-soft); --pill-ink: color-mix(in srgb, var(--brand) 85%, var(--ink)); --pill-line: transparent; }
.pill-btn { font-family: inherit; cursor: pointer; }
@media (hover: hover) {
  .pill-btn:hover { --pill-line: var(--input-border); }
}
.pill-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.tag {
  display: inline-flex;
  align-items: center;
  height: var(--space-6);
  padding: 0 var(--space-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  line-height: var(--leading-none);
  white-space: nowrap;
}

/* ---------- status badge ----------
   <span class="badge" data-tone="ok|warn|danger|info|neutral|pending|live">.
   The word carries the meaning and stays --ink-2 (AA on every tint); the dot
   and tint carry the tone. success/warning are the old tone names. */
.badge {
  --badge-c: var(--neutral);
  --badge-soft: var(--neutral-soft);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--space-6);
  padding: 0 calc(var(--space-2) + var(--space-1) / 2);
  border-radius: var(--radius-pill);
  background: var(--badge-soft);
  color: var(--ink-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  line-height: var(--leading-none);
  white-space: nowrap;
}
.badge::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--badge-c);
}
.badge:is([data-tone="ok"], [data-tone="success"]) { --badge-c: var(--ok); --badge-soft: var(--ok-soft); }
/* live = a real-money account ({% status_badge "account" %}): the amber --live tone, no motion. */
.badge[data-tone="live"] { --badge-c: var(--live); --badge-soft: var(--live-soft); }
.badge:is([data-tone="warn"], [data-tone="warning"]) { --badge-c: var(--warn); --badge-soft: var(--warn-soft); }
.badge[data-tone="danger"] { --badge-c: var(--danger); --badge-soft: var(--danger-soft); }
.badge[data-tone="info"] { --badge-c: var(--info); --badge-soft: var(--info-soft); }
.badge[data-tone="pending"]::before { background: transparent; border: 1.5px solid var(--neutral); }

/* ---------- data table ----------
   <table class="table table--cards"> with data-label on every cell.
   Under 640px each row becomes a card of "label  value" lines. */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-base);
}
.table > caption:not(.sr-only) {
  padding: var(--space-3) var(--space-4);
  caption-side: top;
  text-align: left;
  color: var(--ink-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}
.table > thead > tr > th,
.table > tbody > tr > th,
.table > tbody > tr > td,
.table > tfoot > tr > th,
.table > tfoot > tr > td {
  height: var(--control-lg);
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
.table > thead > tr > th {
  height: var(--control-md);
  padding-block: 0;
  background: var(--surface);
  color: var(--ink-3);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  white-space: nowrap;
}
.table > tbody > tr:last-child > th,
.table > tbody > tr:last-child > td { border-bottom: 0; }
.table th.num, .table td.num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.table td.num { font-family: var(--font-mono); }
@media (hover: hover) {
  .table > tbody > tr:hover > th,
  .table > tbody > tr:hover > td { background: var(--surface-hover); }
}

/* .table-cards is the old name. .sg-table keeps its own grid card mode
   (app.css) until it moves to this one. */
@media (max-width: 640px) {
  .table--cards, .table-cards:not(.sg-table),
  /* :not(.sr-only) — a hidden caption keeps its 1px box; full width it sat
     past the gutter and widened the whole page on a phone (E2E_TEST_PLAN.md §12). */
  .table--cards > caption:not(.sr-only), .table-cards:not(.sg-table) > caption:not(.sr-only),
  .table--cards > tbody, .table-cards:not(.sg-table) > tbody,
  .table--cards > tbody > tr, .table-cards:not(.sg-table) > tbody > tr { display: block; width: 100%; }
  .table--cards > thead, .table-cards:not(.sg-table) > thead { display: none; }
  .table--cards > tbody > tr, .table-cards:not(.sg-table) > tbody > tr {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
  }
  .table--cards > tbody > tr:last-child, .table-cards:not(.sg-table) > tbody > tr:last-child { border-bottom: 0; }
  .table--cards > tbody > tr > th, .table-cards:not(.sg-table) > tbody > tr > th,
  .table--cards > tbody > tr > td, .table-cards:not(.sg-table) > tbody > tr > td {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-1) var(--space-3);
    width: 100%;
    height: auto;
    padding: var(--space-1) 0;
    border: 0;
    text-align: right;
    overflow-wrap: anywhere;
  }
  .table--cards > tbody > tr > th[data-label]::before, .table-cards:not(.sg-table) > tbody > tr > th[data-label]::before,
  .table--cards > tbody > tr > td[data-label]::before, .table-cards:not(.sg-table) > tbody > tr > td[data-label]::before {
    content: attr(data-label);
    flex: none;
    color: var(--ink-3);
    font-family: var(--font-body);
    font-size: var(--text-xs);
    font-weight: var(--weight-normal);
    text-align: left;
  }
  .table--cards > tbody > tr:hover > th, .table-cards:not(.sg-table) > tbody > tr:hover > th,
  .table--cards > tbody > tr:hover > td, .table-cards:not(.sg-table) > tbody > tr:hover > td { background: none; }
}

/* ---------- sample label (components/sample_label.html) ---------- */
.sample-label {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: var(--weight-medium);
  line-height: var(--leading-snug);
  letter-spacing: .02em;
  white-space: nowrap;
  color: var(--ink-3);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
}

/* ---------- empty state (components/empty_state.html) ---------- */
.empty-state {
  display: grid;
  justify-items: center;
  gap: var(--space-2);
  grid-column: 1 / -1;
  padding: var(--space-10) var(--space-5);
  text-align: center;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
}
.empty-state[hidden] { display: none; }
.empty-state-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: var(--space-1);
  color: var(--ink-2);
  background: var(--sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.empty-state-icon svg { display: block; width: 20px; height: 20px; }
.empty-state-heading {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-lg);
  font-weight: var(--weight-semi);
  line-height: var(--leading-heading);
  letter-spacing: -0.01em;
  color: var(--ink);
}
.empty-state-text {
  margin: 0;
  max-width: 52ch;
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--ink-2);
}
.empty-state-action { margin-top: var(--space-2); }
.empty-state--inline {
  display: block;
  padding: var(--space-6) var(--space-5);
  background: transparent;
}
.empty-state--inline .empty-state-heading { margin-bottom: var(--space-1); font-size: var(--text-md); }
.empty-state--inline .empty-state-text { max-width: none; }

/* ---------- filter bar (components/filter_bar.html) ---------- */
.filter-bar {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: 0 0 var(--space-5);
}
.filter-bar-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}
.filter-bar-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3) var(--space-4);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.filter-bar-panel[hidden] { display: none; }

/* Row: everything on one wrapping line. display: contents drops the panel box. */
.filter-bar--row {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;
}
.filter-bar--row > .filter-bar-main,
.filter-bar--row > .filter-bar-panel { display: contents; }

@media (min-width: 641px) {
  .filter-bar--drawer-mobile {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
  }
  .filter-bar--drawer-mobile > .filter-bar-main,
  .filter-bar--drawer-mobile > .filter-bar-panel,
  .filter-bar--drawer-mobile > .filter-bar-panel[hidden] { display: contents; }
  .filter-bar--drawer-mobile .filter-bar-toggle { display: none; }
}

.filter-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 16rem;
  min-width: 0;
  max-width: 28rem;
}
.filter-search > svg {
  position: absolute;
  left: var(--space-3);
  width: 16px;
  height: 16px;
  color: var(--ink-3);
  pointer-events: none;
}
.filter-search-input {
  width: 100%;
  min-height: var(--control-lg);
  padding: 0 var(--space-3) 0 var(--space-9);
  font-size: var(--text-base);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
}
.filter-search-input::placeholder { color: var(--ink-3); }
.filter-search-input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

.filter-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1 1 10rem;
  min-width: 0;
}
.filter-field--narrow { flex: 0 1 8rem; }
.filter-field--wide { flex: 2 1 14rem; }
.filter-field > label,
.filter-field-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--ink-3);
}
/* the controls take the shared input/select look (form controls, above) */

.filter-bar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}
.filter-bar--drawer-always .filter-bar-actions { margin-left: auto; }

.filter-bar-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 var(--space-1);
  font-size: var(--text-2xs);
  font-weight: var(--weight-semi);
  font-variant-numeric: tabular-nums;
  color: var(--action-ink);
  background: var(--action-soft);
  border-radius: var(--radius-pill);
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}
.filter-pill {
  display: inline-flex;
  align-items: center;
  min-height: var(--control-sm);
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  cursor: pointer;
}
.filter-pill:hover { color: var(--ink); background: var(--surface-hover); }
.filter-pill.is-active {
  color: var(--ink);
  background: var(--action-soft);
  border-color: var(--border-brand);
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  flex-basis: 100%;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: var(--control-sm);
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
  color: var(--ink);
  background: var(--raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
}
.filter-chip:hover { color: var(--ink); border-color: var(--border-brand); }

/* ---------- list toolbar ({% filterbar %}…{% filterbar_more %}…) ----------
   One row, every control the same height: search (grows), at most two key
   dropdowns with the label inside the control, the Filters button and its
   panel. Active filters as chips + "Clear all" under the row. */
.filter-bar--toolbar { --filter-h: var(--control-md); gap: var(--space-3); }
.filter-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}
.filter-bar--toolbar .filter-search { flex: 1 1 14rem; max-width: 26rem; }
.filter-bar--toolbar .filter-search-input { min-height: var(--filter-h); font-size: var(--text-sm); }

.filter-select {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  min-height: var(--filter-h, var(--control-md));
  background: var(--surface);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
}
.filter-select:hover { border-color: var(--border-strong); }
.filter-select:focus-within { outline: 2px solid var(--focus); outline-offset: 1px; }
.filter-select-label {
  flex: none;
  padding-left: var(--space-3);
  font-size: var(--text-sm);
  color: var(--ink-3);
  white-space: nowrap;
  cursor: pointer;
}
.filter-select select {
  min-width: 0;
  max-width: 14rem;
  min-height: calc(var(--filter-h, var(--control-md)) - 2px);
  padding: 0 var(--space-8) 0 var(--space-2);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--ink);
  background-color: transparent;
  border: 0;
  border-radius: var(--radius-md);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.filter-select select:focus { outline: none; }
.filter-select-value { padding: 0 var(--space-3) 0 var(--space-2); font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--ink); white-space: nowrap; }

/* Filter menus ({% filtermulti %} tick boxes, {% filterselect %} radios;
   components/filter_multi.html): our own panel, never the browser's select
   menu, so every browser and OS shows the same thing. The button sizes to
   "Label: value" (no clipped "Ass…"); a long value ends in an ellipsis and
   keeps its full text in a title. */
.filter-menu { position: relative; min-width: 0; max-width: 100%; }
.filter-menu > summary { list-style: none; }
.filter-menu > summary::-webkit-details-marker { display: none; }
.filter-menu-toggle {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: var(--filter-h, var(--control-md));
  padding: 0 var(--space-8) 0 var(--space-3);
  font-size: var(--text-sm);
  color: var(--ink);
  white-space: nowrap;
  background-color: var(--surface);
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  user-select: none;
}
.filter-menu-toggle:hover { border-color: var(--border-strong); }
.filter-menu-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.filter-menu[open] > .filter-menu-toggle { border-color: var(--border-brand); }
.filter-menu-label { flex: none; color: var(--ink-3); white-space: pre; }
.filter-menu-value {
  min-width: 0;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: var(--weight-medium);
}
.filter-menu-panel {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  z-index: var(--z-popover);
  display: grid;
  gap: var(--space-2);
  min-width: 100%;
  width: max-content;
  max-width: min(20rem, calc(100vw - 2 * var(--space-4)));
  padding: var(--space-2);
  background: var(--raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
}
.filter-menu-options { display: grid; max-height: 18rem; overflow-y: auto; overscroll-behavior: contain; }
.filter-menu-option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 34px;
  padding: 0 var(--space-2);
  font-size: var(--text-sm);
  color: var(--ink);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.filter-menu-option:hover { background: var(--sunken); }
.filter-menu-option:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: -2px; }
.filter-menu-option input { flex: none; margin: 0; accent-color: var(--action); }
.filter-menu-option > span { min-width: 0; overflow-wrap: anywhere; }
.filter-menu-group { display: grid; margin-top: var(--space-1); padding-top: var(--space-1); border-top: 1px solid var(--border); }
.filter-menu-group-label { padding: var(--space-1) var(--space-2); font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--ink-3); }
.filter-menu-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
}
.filter-menu-actions [data-filter-menu-done] { margin-left: auto; }
/* Inside the Filters panel: a full-width button, and its options open in the flow under it. */
.filter-more-panel .filter-menu { display: block; }
.filter-more-panel .filter-menu-toggle { display: flex; width: 100%; min-height: var(--control-md); border-radius: var(--radius-sm); }
.filter-more-panel .filter-menu-value { max-width: none; }
.filter-more-panel .filter-menu-panel { position: static; width: auto; max-width: none; margin-top: var(--space-1); box-shadow: none; }

.filter-more { position: relative; }
.filter-more > summary { list-style: none; }
.filter-more > summary::-webkit-details-marker { display: none; }
.filter-more-toggle { --btn-h: var(--filter-h, var(--control-md)); gap: var(--space-2); }
.filter-more[open] > .filter-more-toggle { color: var(--ink); border-color: var(--border-brand); }
.filter-more-panel {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  z-index: var(--z-popover);
  display: grid;
  gap: var(--space-4);
  width: min(22rem, calc(100vw - 2 * var(--space-4)));
  padding: var(--space-4);
  background: var(--raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
}
/* Inside the panel every field is a label above a full-width control. */
.filter-more-panel .filter-select {
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-1);
  min-height: 0;
  background: none;
  border: 0;
  border-radius: 0;
}
.filter-more-panel .filter-select:focus-within { outline: none; }
.filter-more-panel .filter-select-label,
.filter-more-panel .filter-field > label,
.filter-more-panel .filter-field-label {
  padding: 0;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--ink-2);
}
.filter-more-panel .filter-select select {
  max-width: none;
  min-height: var(--control-md);
  padding-left: var(--space-3);
  font-weight: var(--weight-normal);
  background-color: var(--surface);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
}
.filter-more-panel .filter-select select:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.filter-more-panel .filter-field { flex: none; }
.filter-more-panel .form-field-error { margin-top: 0; }

.filter-bar-active {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}
.filter-bar-active .filter-chips { flex-basis: auto; }

@media (max-width: 640px) {
  .filter-bar--toolbar .filter-search { flex-basis: 100%; max-width: none; }
  .filter-toolbar > .filter-select { flex: 1 1 9rem; }
  .filter-toolbar > .filter-select select { flex: 1; max-width: none; }
  .filter-toolbar > .filter-menu { flex: 1 1 9rem; }
  .filter-toolbar > .filter-menu > .filter-menu-toggle { display: flex; width: 100%; }
  .filter-toolbar > .filter-menu .filter-menu-value { max-width: none; }
  /* The second key filter sits on the right half: its panel opens from its right edge. */
  .filter-toolbar > .filter-menu + .filter-menu > .filter-menu-panel { left: auto; right: 0; }
  /* The panel opens in the flow under the row on a phone, full width. */
  .filter-more { flex: 1 1 100%; }
  .filter-more-toggle { width: 100%; justify-content: center; }
  .filter-more-panel { position: static; width: auto; margin-top: var(--space-2); box-shadow: none; }
}
@media (pointer: coarse) {
  .filter-bar--toolbar { --filter-h: var(--control-lg); }
}

/* ---------- bulk-action bar (components/bulk_bar.html, static/js/bulk-select.js) ----------
   Shown only while rows are ticked; floats at the bottom of the screen. */
.bulk-bar {
  position: fixed;
  left: 50%;
  bottom: var(--space-5);
  z-index: var(--z-sticky);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  max-width: calc(100vw - 2 * var(--space-4));
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--raised);
  box-shadow: var(--shadow-pop);
  transform: translateX(-50%);
}
.bulk-bar[hidden] { display: none; }
.bulk-bar-count { margin-right: var(--space-2); color: var(--ink); font-size: var(--text-sm); font-weight: var(--weight-medium); white-space: nowrap; }
form:has(> .bulk-bar:not([hidden])) { padding-bottom: var(--space-18); }
.bulk-check { width: var(--space-10); padding-right: 0; }
.bulk-check input { position: relative; z-index: 1; width: var(--space-4); height: var(--space-4); margin: 0; cursor: pointer; }
@media (pointer: coarse) {
  .bulk-check input { width: var(--space-5); height: var(--space-5); }
}

/* ---------- pagination (components/pagination.html) ---------- */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-4);
}
.pager-count,
.pager-status {
  margin: 0;
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
}
.pager-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}
.pager-link {
  min-width: var(--control-sm);
  padding: 0 var(--space-2);
  font-variant-numeric: tabular-nums;
}
.pager-link[aria-current="page"] {
  color: var(--ink);
  background: var(--action-soft);
  border-color: var(--border-brand);
  cursor: default;
}
.pager-gap { padding: 0 var(--space-1); color: var(--ink-3); }
.pager--simple {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
}
.pager--simple .pager-status { grid-column: 2; grid-row: 1; }
.pager-prev { grid-column: 1; grid-row: 1; justify-self: start; }
.pager-next { grid-column: 3; grid-row: 1; justify-self: end; }

/* ---------- touch targets ---------- */
@media (pointer: coarse) {
  .pager-link,
  .filter-pill,
  .filter-chip,
  .filter-bar-toggle,
  .filter-bar-clear { min-height: var(--control-lg); }
  .pager-link { min-width: var(--control-lg); }
}

/* ---------- public type: eyebrow shared by hero and section head ---------- */
.hero-eyebrow,
.sec-head-eyebrow {
  margin: 0 0 var(--space-3);
  max-width: none;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  line-height: var(--leading-snug);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ---------- section head (components/section_head.html) ----------
   Centred by default (link under the lead); .sec-head--start is the opt-out
   (text left, link to the right). .sec-head--center is the default kept as a
   class so align="center" still renders the same. */
.sec-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
  margin: 0 0 var(--space-8);
  text-align: center;
}
.sec-head-text { min-width: 0; max-width: 64ch; margin-inline: auto; }
.sec-head-title {
  margin: 0;
  font-size: var(--text-h2);
  font-weight: var(--weight-semi);
  line-height: var(--leading-heading);
  letter-spacing: var(--tracking-tight);
  color: var(--ink);
  text-wrap: balance;
}
.sec-head-lead {
  margin: var(--space-3) auto 0;
  max-width: 60ch;
  font-size: var(--text-lead);
  line-height: var(--leading-relaxed);
  color: var(--ink-2);
}
.sec-head-link { flex-shrink: 0; }
.sec-head--start {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4) var(--space-6);
  text-align: start;
}
.sec-head--start .sec-head-text,
.sec-head--start .sec-head-lead { margin-inline: 0; }

/* ---------- hero (components/hero.html) ---------- */
.hero {
  position: relative;
  isolation: isolate;
  padding-block: var(--space-18) var(--space-14);
}
/* Lit from the top: violet + the logo's teal, over a 64px hairline grid that
   fades out (tokens.css premium layer). Static, no motion. */
.hero::before,
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
.hero::before { background: var(--hero-glow, none); }
.hero::after {
  background-image:
    linear-gradient(var(--grid-line, transparent) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line, transparent) 1px, transparent 1px);
  background-size: 64px 64px;
  background-position: center top;
  -webkit-mask-image: radial-gradient(58% 70% at 50% 18%, #000 0%, transparent 75%);
  mask-image: radial-gradient(58% 70% at 50% 18%, #000 0%, transparent 75%);
}
.hero-inner {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.hero-copy { min-width: 0; }
.hero--centred .hero-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 46rem;
  margin-inline: auto;
  text-align: center;
}
.hero--split .hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: var(--space-16);
  align-items: center;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: var(--control-sm);
  padding: 0 var(--space-3);
  margin-bottom: var(--space-5);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  border: 1px solid var(--border-brand);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-inset);
}
.hero-title {
  margin: 0 0 var(--space-5);
  font-family: var(--font-display);
  font-size: var(--text-display);
  font-weight: var(--weight-semi);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--ink);
  text-wrap: balance;
}
.hero-accent {
  display: block;
  color: transparent;
  background: var(--grad-accent-text, linear-gradient(90deg, var(--ink), var(--brand)));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-lead {
  margin: 0 0 var(--space-7);
  max-width: 54ch;
  font-size: var(--text-xl);
  line-height: var(--leading-relaxed);
  color: var(--ink-2);
}
.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}
.hero--centred .hero-ctas { justify-content: center; }
.hero-note {
  margin: var(--space-5) 0 0;
  max-width: 60ch;
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  color: var(--ink-3);
}
.hero-visual { min-width: 0; }

/* ---------- CTA band (components/cta_band.html) ---------- */
.cta-band {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-block: var(--section-y);
  text-align: center;
  border-top: 1px solid var(--border);
}
.cta-band--glow::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--hero-glow, radial-gradient(60% 80% at 50% 100%, var(--brand-soft), transparent 70%));
}
.cta-band-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 46rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.cta-band-title {
  margin: 0 0 var(--space-4);
  font-size: var(--text-h2);
  font-weight: var(--weight-semi);
  line-height: var(--leading-heading);
  letter-spacing: var(--tracking-tight);
  color: var(--ink);
  text-wrap: balance;
}
.cta-band-text {
  margin: 0 0 var(--space-7);
  max-width: 52ch;
  font-size: var(--text-lead);
  line-height: var(--leading-relaxed);
  color: var(--ink-2);
}
.cta-band-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
}
.cta-band-note {
  margin: var(--space-4) 0 0;
  max-width: 52ch;
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  color: var(--ink-3);
}

/* ---------- disclaimer (components/disclaimer.html) ---------- */
.disclaimer {
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  color: var(--ink-2);
}
.disclaimer p { margin: 0; max-width: 72ch; }
.disclaimer p + p { margin-top: var(--space-2); }
.disclaimer-title {
  margin: 0 0 var(--space-2);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-semi);
  line-height: var(--leading-snug);
  letter-spacing: 0;
  color: var(--ink);
}
/* footer fine print: hairline above, no box; the points flow in two
   columns on wide screens, one on phones */
.disclaimer--footer {
  padding-top: var(--space-6);
  border-top: 1px solid var(--border);
  font-size: var(--text-xs);
  color: var(--ink-3);
}
.disclaimer--footer .disclaimer-title {
  margin-bottom: var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--ink-2);
}
.disclaimer--footer .disclaimer-list {
  columns: 2;
  column-gap: var(--space-10);
  margin: 0;
  padding: 0;
  list-style: none;
}
.disclaimer--footer .disclaimer-list li {
  margin: 0 0 var(--space-2);
  break-inside: avoid;
}
.disclaimer--inline {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.disclaimer--warn {
  color: var(--ink);
  background: var(--warn-soft);
  border-color: color-mix(in srgb, var(--warn) 45%, transparent);
}
.disclaimer-icon {
  display: block;
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  color: var(--warn);
}
.disclaimer-body { min-width: 0; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .hero--split .hero-inner { grid-template-columns: minmax(0, 1fr); gap: var(--space-10); }
}
@media (max-width: 640px) {
  .hero { padding-block: var(--space-12) var(--space-10); }
  .hero-ctas .btn,
  .cta-band-actions .btn { flex: 1 1 auto; }
  .pager { justify-content: center; }
  .sec-head { margin-bottom: var(--space-6); }
  .disclaimer--footer .disclaimer-list { columns: 1; }
}

/* ---------- motion and forced colours ---------- */
@media (prefers-reduced-motion: no-preference) {
  .filter-pill,
  .filter-chip { transition: color var(--dur-instant) var(--ease-out), background-color var(--dur-instant) var(--ease-out), border-color var(--dur-instant) var(--ease-out); }
}
@media (forced-colors: active) {
  .hero-accent {
    color: CanvasText;
    background: none;
    -webkit-text-fill-color: CanvasText;
  }
  .filter-pill.is-active,
  .pager-link[aria-current="page"] { border-color: Highlight; }
}

/* ---------- Page head ({% pagehead %}, common/templatetags/ui.py) ----------
   Breadcrumb, the page's one h1, optional eyebrow, lede, lead and meta
   slots, then actions. The actions drop under the title once the row is
   too narrow for both. */
.pagehead { margin: 0 0 var(--space-6); min-width: 0; }

.pagehead-crumbs { margin: 0 0 var(--space-2); }
.pagehead-crumbs ol {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--space-2);
  margin: 0; padding: 0; list-style: none;
  font-size: var(--text-sm); line-height: var(--leading-snug); color: var(--ink-3);
}
.pagehead-crumbs li { display: inline-flex; align-items: center; gap: var(--space-2); min-width: 0; overflow-wrap: anywhere; }
.pagehead-crumbs li + li::before { content: "/"; content: "/" / ""; color: var(--ink-3); }
.pagehead-crumbs a {
  display: inline-flex; align-items: center; min-height: var(--space-6);
  border-radius: var(--radius-xs);
  color: var(--ink-2); text-decoration: none;
}
.pagehead-crumbs a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: .2em; }
.pagehead-crumbs a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.pagehead-crumbs [aria-current="page"] { color: var(--ink-3); }

.pagehead-body {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: var(--space-4) var(--space-6);
}
.pagehead-id { flex: 1 1 24rem; min-width: 0; display: flex; align-items: center; gap: var(--space-3); }
.pagehead-lead { flex: none; display: flex; align-items: center; }
.pagehead-text { flex: 1 1 auto; min-width: 0; }
.pagehead-heading { margin: 0; }
.pagehead-eyebrow {
  max-width: none; margin: 0 0 var(--space-1);
  font-family: var(--font-mono); font-size: var(--text-xs); font-weight: var(--weight-medium);
  line-height: var(--leading-snug); letter-spacing: .02em; color: var(--ink-3);
}
.pagehead-title {
  margin: 0;
  font-family: var(--font-display); font-size: var(--text-3xl); font-weight: var(--weight-semi);
  line-height: var(--leading-heading); letter-spacing: -0.02em; color: var(--ink);
  overflow-wrap: anywhere; text-wrap: balance;
}
:root:not(.is-app) .pagehead-title { font-size: var(--text-4xl); }
.pagehead-lede {
  max-width: var(--measure); margin: var(--space-2) 0 0;
  font-size: var(--text-base); line-height: var(--leading-relaxed); color: var(--ink-2);
}
.pagehead-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3);
  margin: var(--space-2) 0 0;
  font-size: var(--text-sm); line-height: var(--leading-snug); color: var(--ink-2);
}
.pagehead-meta p { margin: 0; max-width: none; }
.pagehead-actions { flex: 0 1 auto; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.pagehead-actions form { display: inline-flex; margin: 0; }

@media (max-width: 640px) {
  .pagehead-title,
  :root:not(.is-app) .pagehead-title { font-size: var(--text-2xl); }
}

/* ---------- Info dialog ({% infodialog %}) ----------
   The dialog box itself is dialog.modal (components.css); modal.js opens
   and closes it. The trigger is 28px to the eye with a 44px hit area. */
.infodialog-trigger {
  position: relative; flex: none;
  display: inline-grid; place-items: center;
  width: var(--space-7); height: var(--space-7); padding: 0;
  border: 1px solid var(--border-strong); border-radius: var(--radius-pill);
  background: transparent; color: var(--ink-2);
  font-family: var(--font-mono); font-size: var(--text-sm); font-weight: var(--weight-semi);
  line-height: var(--leading-none);
  cursor: pointer;
  transition: color var(--dur-instant) var(--ease-out), background-color var(--dur-instant) var(--ease-out),
    border-color var(--dur-instant) var(--ease-out);
}
.infodialog-trigger::after { content: ""; position: absolute; inset: calc((var(--space-7) - var(--control-lg)) / 2); }
.infodialog-trigger:hover { background: var(--surface-hover); border-color: var(--input-border); color: var(--ink); }
.infodialog-trigger:focus-visible,
.infodialog-close:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Wide, with a gap on the left and right (15% of the screen each, 2rem on phones). */
dialog.infodialog { width: 100%; max-width: 70vw; }
@media (max-width: 640px) {
  dialog.infodialog { max-width: calc(100vw - 2 * var(--space-8)); }
}
.infodialog-inner {
  max-height: calc(100dvh - 2 * var(--space-6)); overflow-y: auto;
  padding: var(--space-4) var(--space-6) var(--space-6);
}
.infodialog-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  margin: 0 calc(var(--space-3) * -1) var(--space-3) 0;
}
.infodialog-title {
  margin: 0;
  font-family: var(--font-body); font-size: var(--text-lg); font-weight: var(--weight-semi);
  line-height: var(--leading-heading); letter-spacing: -0.01em; color: var(--ink);
}
/* × close: the kit's btn btn-quiet btn-icon; only the glyph size here. */
.infodialog-close { flex: none; font-size: var(--text-2xl); line-height: var(--leading-none); }
.infodialog-body { font-size: var(--text-sm); line-height: var(--leading-snug); color: var(--ink-2); }
.infodialog-body > :first-child { margin-top: 0; }
.infodialog-body > :last-child { margin-bottom: 0; }
.infodialog-body p { max-width: none; margin: 0 0 var(--space-3); }
.infodialog-body dl { display: grid; gap: var(--space-1); margin: 0; }
.infodialog-body dt { margin: var(--space-3) 0 0; font-weight: var(--weight-semi); color: var(--ink); }
.infodialog-body dt:first-child { margin-top: 0; }
.infodialog-body dd { margin: 0; }
.infodialog-body ul { margin: var(--space-1) 0 0; padding: 0 0 0 var(--space-5); }
.infodialog-body li + li { margin-top: var(--space-1); }

@media (prefers-reduced-motion: reduce) {
  .infodialog-trigger { transition: none; }
}

/* ---------- Product status ({% product_status %}) ----------
   Public availability: Live, Beta, Waitlist, Roadmap, Launching. Text in
   the tone colour on the page background (every tone is AA there); the
   hairline and dot are decoration. */
.product-status {
  --product-status-c: var(--neutral);
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: 2px var(--space-2);
  border: 1px solid color-mix(in srgb, var(--product-status-c) 45%, transparent);
  border-radius: var(--radius-pill);
  background: transparent; color: var(--product-status-c);
  font-family: var(--font-mono); font-size: var(--text-2xs); font-weight: var(--weight-medium);
  line-height: var(--leading-snug); letter-spacing: .04em; text-transform: uppercase;
  white-space: nowrap;
}
.product-status::before {
  content: ""; flex: none;
  width: 6px; height: 6px; border-radius: var(--radius-pill);
  background: currentColor;
}
.product-status[data-status="live"] { --product-status-c: var(--ok); }
.product-status[data-status="beta"] { --product-status-c: var(--info); }
.product-status[data-status="waitlist"] { --product-status-c: var(--action-ink); border-color: var(--border-brand); }
.product-status[data-status="roadmap"] { --product-status-c: var(--neutral); }
.product-status[data-status="launching"] { --product-status-c: var(--warn); }

@media (forced-colors: active) {
  .product-status::before { forced-color-adjust: none; background: CanvasText; }
}
/* ============================================================
   UI kit (DESIGN_SYSTEM.md): each pattern defined once. Markup in
   templates/components/, tags in common/templatetags/ui.py.
   ============================================================ */

/* ---------- stat tiles (components/stat_grid.html, {% stat %}) ----------
   .stat-grid / .stat / .stat-label / .stat-value / .stat-sub are above (legacy
   layer); these add the tones and the link tile. */
.stat[data-tone="pos"] .stat-value { color: var(--buy); }
.stat[data-tone="neg"] .stat-value { color: var(--sell); }
.stat--link { color: inherit; text-decoration: none; }
.stat--link:hover { color: inherit; background: var(--surface-hover); }
.stat--link:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.stat--link .stat-label { text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: .2em; }

/* ---------- tabs (components/tabs.html) ----------
   The bar itself is `.tabs` above; a count badge inside a tab sits on its line. */
.tabs a .count { margin-left: var(--space-1); vertical-align: 1px; }

/* ---------- notice (components/notice.html) ---------- */
.notice {
  --notice-c: var(--info);
  --notice-soft: var(--info-soft);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1) var(--space-3);
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid color-mix(in srgb, var(--notice-c) 45%, transparent);
  border-left-width: 3px;
  border-radius: var(--radius-md);
  background: var(--notice-soft);
  color: var(--ink);
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
}
.notice[hidden] { display: none; }
.notice[data-tone="success"] { --notice-c: var(--ok); --notice-soft: var(--ok-soft); }
.notice[data-tone="warning"] { --notice-c: var(--warn); --notice-soft: var(--warn-soft); }
.notice[data-tone="danger"] { --notice-c: var(--danger); --notice-soft: var(--danger-soft); }
.notice-text { flex: 1 1 20rem; min-width: 0; max-width: none; margin: 0; overflow-wrap: anywhere; }
.notice-action { flex: none; color: var(--ink); font-weight: var(--weight-medium); text-decoration: underline; text-underline-offset: .2em; }
.notice-action:hover { color: var(--ink); text-decoration-thickness: 2px; }

/* ---------- sortable header (components/th_sort.html) ---------- */
.th-sort-link { display: inline-flex; align-items: center; gap: var(--space-1); color: inherit; text-decoration: none; }
/* The arrow shows only on the sorted column; the others show a faint one on
   hover or keyboard focus. It always takes its space, so labels never shift.
   Number columns are right-aligned with the arrow after the label. */
.th-sort-link::after { content: ""; flex: none; width: 0; height: 0; border: 4px solid transparent; border-top-color: currentColor; opacity: 0; translate: 0 2px; }
.th-sort-link:hover::after,
.th-sort-link:focus-visible::after { opacity: .4; }
.th-sort[aria-sort="ascending"] .th-sort-link::after { border-top-color: transparent; border-bottom-color: currentColor; opacity: 1; translate: 0 -2px; }
.th-sort[aria-sort="descending"] .th-sort-link::after { opacity: 1; }
.th-sort[aria-sort] .th-sort-link { color: var(--ink); }
.th-sort-link:hover { color: var(--ink); }
.th-sort-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.th-sort.num { text-align: right; }
.th-sort.num .th-sort-link { justify-content: flex-end; }

/* ---------- row actions (components/row_actions.html) ---------- */
.row-actions { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--space-1); }
.row-actions .row-action-form { display: inline-flex; margin: 0; }
.menu-panel .row-action-form { display: block; }
.menu-panel .row-action-form button { width: 100%; }

/* ---------- form sections (components/form_section.html) ---------- */
.form-section { scroll-margin-top: calc(var(--topbar-h) + var(--space-4)); margin: 0 0 var(--space-4); }
.form-section-head { justify-content: flex-start; align-items: flex-start; padding: var(--space-4) var(--space-5); }
.form-section-text { flex: 1; min-width: 0; }
.panel-head .form-section-title { font-size: var(--text-lg); font-weight: var(--weight-semi); line-height: var(--leading-snug); color: var(--ink); }
.form-section-desc { margin: 2px 0 0; max-width: 72ch; font-size: var(--text-sm); line-height: var(--leading-snug); color: var(--ink-2); }
.form-section-step {
  flex: none;
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--sunken);
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
}
.form-section-body { padding: var(--space-5); }
.form-section-body > .form-field:last-child { margin-bottom: 0; }
@media (max-width: 640px) {
  .form-section-head { padding: var(--space-3) var(--space-4); }
  .form-section-body { padding: var(--space-4); }
}

/* ---------- sticky save bar: <div class="save-bar"> with "Save changes" ----------
   One per form, last thing in it. Full-width buttons on a phone. */
.save-bar {
  position: sticky;
  bottom: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0 calc(var(--space-4) * -1);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-strong);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
}
.save-bar .btn { flex: 1; }
@media (min-width: 641px) {
  .save-bar { margin: 0; border: 1px solid var(--border-strong); border-radius: var(--radius-lg); }
  .save-bar .btn { flex: none; }
}
/* .save-bar--inline: a page of several small forms (Settings, account settings).
   Not sticky, so the bars never stack on top of each other. */
.save-bar.save-bar--inline {
  position: static;
  z-index: auto;
  flex-wrap: wrap;
  margin: var(--space-4) 0 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}
.save-bar--inline .btn { flex: none; }

/* ---------- stat tiles: a value a script fills ({% stat value_attrs= %}) ---------- */
.stat-value {
  /* A price is one value: never split its sign, separators or cents. */
  overflow-wrap: normal;
  word-break: normal;
}
.stat-value .num { white-space: nowrap; }

/* ---------- notice: title and a body of its own ({% notice %}…{% endnotice %}) ---------- */
.notice-title { color: var(--ink); font-weight: var(--weight-semi); }
.notice-body > * { max-width: none; margin: 0; }
.notice-body > * + * { margin-top: var(--space-1); }
.notice-body a { color: var(--ink); text-decoration: underline; text-underline-offset: .2em; }

/* ---------- tabs: a badge in a tab ({% tab badge= %}) ---------- */
.tabs a .badge { margin-left: var(--space-1); vertical-align: 1px; }

/* ---------- panel head actions: buttons on the right of a .panel-head ---------- */
.panel-head-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--space-2); }

/* ---------- sortable header in the browser (static/js/sort-table.js) ---------- */
button.th-sort-link {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
}

/* ---------- empty state: a second action ---------- */
.empty-state-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); margin-top: var(--space-2); }
.empty-state-actions .empty-state-action { margin-top: 0; }

/* ---------- collapsible form section ({% formsection collapsible=True %}) ----------
   A <details>: the summary is the head (title, one line of help, a chevron). */
.form-section--collapsible > .form-section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px var(--space-3);
  list-style: none;
  cursor: pointer;
}
.form-section--collapsible > .form-section-head::-webkit-details-marker { display: none; }
.form-section--collapsible > .form-section-head > * { grid-column: 1; }
.form-section--collapsible > .form-section-head::after {
  content: "";
  grid-column: 2;
  grid-row: 1 / span 2;
  width: var(--space-2);
  height: var(--space-2);
  margin-right: var(--space-1);
  border-right: 2px solid var(--ink-3);
  border-bottom: 2px solid var(--ink-3);
  rotate: 45deg;
  translate: 0 -2px;
}
.form-section--collapsible[open] > .form-section-head::after { rotate: 225deg; translate: 0 2px; }
.form-section--collapsible:not([open]) > .form-section-head { border-bottom: 0; }
.form-section--collapsible > .form-section-head .form-section-title { margin: 0; font-size: var(--text-lg); font-weight: var(--weight-semi); line-height: var(--leading-snug); color: var(--ink); }
.form-section--collapsible > .form-section-head:hover .form-section-title { text-decoration: underline; text-underline-offset: .2em; }
.form-section--collapsible > .form-section-head:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.form-section-info { display: flex; justify-content: flex-end; margin: calc(var(--space-2) * -1) 0 var(--space-2); }
/* group=True: a collapsible wrapper around other sections, no panel of its own. */
.form-section--group { display: grid; gap: var(--space-4); }
.form-section--group > .form-section-head {
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.form-section--group:not([open]) > .form-section-head { border-bottom: 1px solid var(--border); }
.form-section--group > .form-section-body { display: grid; gap: var(--space-4); padding: 0; }
.form-section--group > .form-section-body > .form-section { margin: 0; }
@media (max-width: 640px) {
  .form-section--group > .form-section-head { padding: var(--space-3) var(--space-4); }
}

/* ---------- meter ({% meter pct label %}): a usage / progress bar ---------- */
.meter {
  --meter-c: var(--action);
  display: block;
  width: 100%;
  height: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--sunken);
}
.meter[data-tone="warn"] { --meter-c: var(--warn); }
.meter[data-tone="danger"] { --meter-c: var(--danger); }
.meter-fill { display: block; width: var(--pct, 0%); height: 100%; border-radius: inherit; background: var(--meter-c); }
@media (forced-colors: active) {
  .meter-fill { forced-color-adjust: none; background: CanvasText; }
}

/* ---------- choice chips: radio / checkbox options as chips ----------
   <div class="choice-chips"><label class="choice-chip"><input type="radio" …> Label</label>…</div> */
.choice-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.choice-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-md);
  padding: 0 var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: 1.2;
  cursor: pointer;
}
.choice-chip:hover { border-color: var(--input-border); }
.choice-chip input { flex: none; width: 15px; height: 15px; margin: 0; }
.choice-chip:has(input:checked) { border-color: var(--action); background: var(--action-soft); }
.choice-chip:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }
.choice-chip:has(input:disabled) { opacity: .55; cursor: not-allowed; }
@media (pointer: coarse) {
  .choice-chip { min-height: var(--control-lg); }
}

/* ---------- table--cards-tablet: cards up to 1023px, not just on phones ----------
   <table class="table table--cards table--cards-tablet"> for a wide table (Orders). */
@media (min-width: 641px) and (max-width: 1023px) {
  .table--cards-tablet, .table--cards-tablet > tbody, .table--cards-tablet > tbody > tr { display: block; width: 100%; }
  .table--cards-tablet > thead { display: none; }
  .table--cards-tablet > tbody > tr { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); }
  .table--cards-tablet > tbody > tr:last-child { border-bottom: 0; }
  .table--cards-tablet > tbody > tr > th,
  .table--cards-tablet > tbody > tr > td {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-1) var(--space-3);
    width: 100%;
    height: auto;
    padding: var(--space-1) 0;
    border: 0;
    text-align: right;
    overflow-wrap: anywhere;
  }
  .table--cards-tablet > tbody > tr > th[data-label]::before,
  .table--cards-tablet > tbody > tr > td[data-label]::before {
    content: attr(data-label);
    flex: none;
    color: var(--ink-3);
    font-family: var(--font-body);
    font-size: var(--text-xs);
    font-weight: var(--weight-normal);
    text-align: left;
  }
  .table--cards-tablet > tbody > tr:hover > th,
  .table--cards-tablet > tbody > tr:hover > td { background: none; }
}

/* ============================================================
   Broker blotter kit (DESIGN_SYSTEM.md "Broker blotter kit", 2026-11-24)
   Dense, calm trading tables and account chrome. Tokens only; green/red
   only for side and money (rule 11); every number, symbol, time and
   ••1234 in --font-mono; no animation, hover/focus ≤ --dur-instant.
   ============================================================ */

/* ---------- blotter panel: the card around a blotter ---------- */
.blotter-panel {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
}
.blotter-panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  min-height: var(--space-12);
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--border);
}
.blotter-panel__title {
  margin: 0;
  color: var(--ink);
  font-size: var(--text-base);
  font-weight: var(--weight-semi);
  line-height: var(--leading-snug);
}
.blotter-panel__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
/* A .table-wrap inside the panel drops its own frame (the panel is the frame). */
.blotter-panel > .table-wrap,
.blotter-panel > .blotter-scroll { border: 0; border-radius: 0; background: transparent; }
/* Optional scroll box: the sticky header sticks inside it. */
.blotter-scroll { max-height: var(--blotter-max-h, 70vh); overflow: auto; position: relative; }

/* ---------- .table--blotter: compact rows, sticky header ---------- */
.table.table--blotter { font-size: var(--text-sm); }
.table.table--blotter > thead > tr > th {
  position: sticky;
  top: 0;
  z-index: 1;
  height: var(--control-sm);
  padding: 0 var(--space-3);
  border-bottom: 0;
  box-shadow: inset 0 -1px 0 var(--border);
  background: var(--surface);
  color: var(--ink-3);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: .03em;
  text-transform: uppercase;
}
.table.table--blotter > tbody > tr > th,
.table.table--blotter > tbody > tr > td,
.table.table--blotter > tfoot > tr > th,
.table.table--blotter > tfoot > tr > td {
  height: var(--control-md);
  padding: var(--space-1) var(--space-3);
  border-bottom: 1px solid var(--border);
  line-height: var(--leading-snug);
}
.table.table--blotter td.num,
.table.table--blotter th.num { text-align: right; white-space: nowrap; }
.table.table--blotter td.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.table.table--blotter > tbody > tr > td { transition: background-color var(--dur-instant) var(--ease-out); }
.table.table--blotter > tbody > tr[aria-selected="true"] > th,
.table.table--blotter > tbody > tr[aria-selected="true"] > td { background: var(--action-soft); }
.table.table--blotter > tbody > tr[aria-selected="true"] > :first-child { box-shadow: inset 2px 0 0 var(--action); }
/* Date divider: <tr class="blotter-date"><th colspan="7" scope="colgroup">Today · Nov 24</th></tr> */
.table.table--blotter > tbody > tr.blotter-date > th {
  height: var(--space-7);
  padding: 0 var(--space-3);
  background: var(--sunken);
  color: var(--ink-3);
  font-size: var(--text-2xs);
  font-weight: var(--weight-semi);
  letter-spacing: .04em;
  text-align: left;
  text-transform: uppercase;
}
@media (hover: hover) {
  .table.table--blotter > tbody > tr.blotter-date:hover > th { background: var(--sunken); }
}
/* Expandable rows (blotter.js): <tr data-expand="d-42"> then <tr id="d-42" class="blotter-detail"> */
.table.table--blotter > tbody > tr[data-expand] { cursor: pointer; }
.table.table--blotter > tbody > tr[data-expand]:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.table.table--blotter > tbody > tr[data-expand][aria-expanded="true"] > td,
.table.table--blotter > tbody > tr[data-expand][aria-expanded="true"] > th { background: var(--surface-hover); border-bottom-color: transparent; }
.blotter-caret { display: inline-block; color: var(--ink-3); }
[aria-expanded="true"] .blotter-caret { transform: rotate(90deg); }
.table.table--blotter > tbody > tr.blotter-detail > td {
  height: auto;
  padding: var(--space-3) var(--space-4) var(--space-4);
  background: var(--surface-hover);
  color: var(--ink-2);
  font-size: var(--text-sm);
}
/* With JS on, a detail row stays shut until blotter.js opens it (.is-open);
   without JS it shows, so nothing is ever out of reach. */
html.js .table > tbody > tr.blotter-detail:not(.is-open),
.table > tbody > tr.is-filtered,
.table > tbody > tr.blotter-detail[hidden] { display: none; }
.table.table--blotter > tbody > tr.blotter-nomatch > td {
  height: var(--control-lg);
  color: var(--ink-3);
  text-align: center;
}
@media (max-width: 640px) {
  .table.table--blotter.table--cards > tbody > tr > th,
  .table.table--blotter.table--cards > tbody > tr > td { height: auto; padding: var(--space-1) 0; border: 0; }
  .table.table--blotter.table--cards > tbody > tr.blotter-date { padding: var(--space-2) var(--space-4); background: var(--sunken); }
  .table.table--blotter.table--cards > tbody > tr.blotter-date > th { height: auto; padding: 0; justify-content: flex-start; text-align: left; }
  .table.table--blotter.table--cards > tbody > tr.blotter-detail { background: var(--surface-hover); }
  .table.table--blotter.table--cards > tbody > tr.blotter-detail > td { display: block; padding: 0; text-align: left; }
  .table.table--blotter.table--cards > tbody > tr[aria-selected="true"] { background: var(--action-soft); }
  .table.table--blotter.table--cards > tbody > tr[aria-selected="true"] > :first-child { box-shadow: none; }
}
@media (min-width: 641px) and (max-width: 1023px) {
  .table.table--blotter.table--cards-tablet > tbody > tr > th,
  .table.table--blotter.table--cards-tablet > tbody > tr > td { height: auto; padding: var(--space-1) 0; border: 0; }
  .table.table--blotter.table--cards-tablet > tbody > tr.blotter-date > th { height: auto; padding: 0; justify-content: flex-start; text-align: left; }
  .table.table--blotter.table--cards-tablet > tbody > tr.blotter-detail > td { display: block; padding: 0; text-align: left; }
}

/* ---------- symbol cell ---------- */
.sym {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--weight-semi);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.sym-sub {
  display: block;
  margin-top: 2px;
  color: var(--ink-3);
  font-family: var(--font-body);
  font-size: var(--text-2xs);
  font-weight: var(--weight-normal);
  line-height: var(--leading-snug);
  white-space: nowrap;
}
.sym-sub .num, .sym-sub .mono { font-family: var(--font-mono); }

/* ---------- dot pill: <span class="dot-pill" data-tone="live">Live</span> ---------- */
.dot-pill {
  --dot-c: var(--neutral);
  --dot-soft: var(--neutral-soft);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--space-5);
  padding: 0 var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--dot-soft);
  color: var(--ink-2);
  font-family: var(--font-body);
  font-size: var(--text-2xs);
  font-weight: var(--weight-medium);
  line-height: var(--leading-none);
  white-space: nowrap;
}
.dot-pill::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dot-c);
}
/* Same tones as {% status_badge "account" %} (common/status.py): Live = --live (amber, real money), Paper = neutral. */
.dot-pill[data-tone="live"] { --dot-c: var(--live); --dot-soft: var(--live-soft); }
.dot-pill[data-tone="paper"] { --dot-c: var(--neutral); --dot-soft: var(--neutral-soft); }
.dot-pill[data-tone="ok"] { --dot-c: var(--ok); --dot-soft: var(--ok-soft); }
.dot-pill[data-tone="warn"] { --dot-c: var(--warn); --dot-soft: var(--warn-soft); }
.dot-pill[data-tone="danger"] { --dot-c: var(--danger); --dot-soft: var(--danger-soft); }
.dot-pill[data-tone="info"] { --dot-c: var(--info); --dot-soft: var(--info-soft); }
.dot-pill[data-tone="muted"] { --dot-c: var(--ink-3); --dot-soft: var(--surface-hover); }
/* Same tone names as .badge ({% status_badge %}): neutral is the default above; pending is a hollow dot. */
.dot-pill[data-tone="pending"]::before { background: transparent; border: 1.5px solid var(--neutral); }

/* ---------- account scope line (trading/_orders_scope.html), on every scoped list ----------
   "Showing Main ••1234 Live · Show all accounts" / "Showing all accounts". */
.blotter-scope {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  min-width: 0;
  color: var(--ink-2);
  font-size: var(--text-sm);
}
.blotter-scope strong { color: var(--ink); font-weight: var(--weight-semi); }
.blotter-scope .num { color: var(--ink-3); font-family: var(--font-mono); }
.blotter-scope__sep { color: var(--ink-3); }
.blotter-scope__form { display: inline; margin: 0; }

/* ---------- one row count ("Orders 42"): every list head ---------- */
.blotter-count {
  margin-inline-start: var(--space-1);
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: var(--weight-normal);
}

/* ---------- one instant search box ("Search this page", blotter.js) ---------- */
.blotter-search { width: 14rem; max-width: 100%; min-height: var(--control-sm); padding: var(--space-1) var(--space-3); font-size: var(--text-sm); }
@media (max-width: 640px) { .blotter-search { width: 100%; } }

/* ---------- the default-account marker: ★ (pages open on this account first) ---------- */
.default-mark { display: inline-flex; align-items: center; gap: var(--space-1); color: var(--ink-2); font-size: var(--text-sm); }

/* ---------- a narrow quantity input in a row action (Close part of a position) ---------- */
.input.input--qty { width: 6rem; max-width: 6rem; }

/* ---------- paper markers: neutral grey, like the Paper status badge ---------- */
.paper-chip {
  display: inline-flex;
  align-items: center;
  height: var(--space-5);
  padding: 0 var(--space-2);
  border: 1px solid color-mix(in srgb, var(--neutral) 45%, transparent);
  border-radius: var(--radius-sm);
  background: var(--neutral-soft);
  color: color-mix(in srgb, var(--neutral) 70%, var(--ink));
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: var(--weight-semi);
  letter-spacing: .08em;
  line-height: var(--leading-none);
  text-transform: uppercase;
  white-space: nowrap;
}
.paper-band { display: block; width: 100%; height: 3px; background: var(--neutral); }
.paper-band[hidden] { display: none; }

/* ---------- account strip: the slim line of numbers under the top bar ----------
   Each item is a small caps label over a mono value, with a thin divider
   between items. Optional parts:
   .acct-strip__scroll  holds the items that scroll on a phone while
                        .acct-strip__meta (freshness, Refresh) stays put
   a.acct-strip__link   a number that opens its list (hover + focus ring)
   .acct-strip__value--lead  the headline number (Equity)
   .acct-strip__value.is-muted  0 or —
   .acct-strip__scope   the Live / Paper .dot-pill (and "All live accounts")
   .acct-strip__dot[data-tone=ok|neutral|warn]  balance freshness */
.acct-strip {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0;
  min-height: var(--space-12);
  padding: 0 var(--space-2);
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  scrollbar-width: thin;
  white-space: nowrap;
}
.acct-strip__scroll {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}
.acct-strip__item {
  position: relative;
  display: flex;
  flex: none;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: var(--space-1) var(--space-4);
  border-radius: var(--radius-sm);
  color: inherit;
  text-decoration: none;
}
.acct-strip__item + .acct-strip__item::before {
  content: "";
  position: absolute;
  top: var(--space-2);
  bottom: var(--space-2);
  left: 0;
  width: 1px;
  background: var(--border);
}
.acct-strip__label {
  color: var(--ink-3);
  font-size: var(--text-2xs);
  font-weight: var(--weight-medium);
  letter-spacing: .06em;
  line-height: var(--leading-snug);
  text-transform: uppercase;
}
.acct-strip__value {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  font-variant-numeric: tabular-nums;
  line-height: var(--leading-heading);
}
.acct-strip__value--lead { font-size: var(--text-md); font-weight: var(--weight-semi); }
.acct-strip__value.is-muted { color: var(--ink-3); }
.acct-strip__scope { flex-direction: row; align-items: center; gap: var(--space-2); }
.acct-strip__scope-text { color: var(--ink-2); font-size: var(--text-sm); font-weight: var(--weight-medium); }
.acct-strip__link { cursor: pointer; transition: background-color var(--dur-instant) var(--ease-out); }
.acct-strip__link .acct-strip__label { transition: color var(--dur-instant) var(--ease-out); }
@media (hover: hover) {
  .acct-strip__link:hover { background: var(--surface-hover); }
  .acct-strip__link:hover .acct-strip__label { color: var(--ink-2); }
  /* The hovered link's own dividers would cut its hover box. */
  .acct-strip__link:hover::before,
  .acct-strip__link:hover + .acct-strip__item::before { visibility: hidden; }
}
.acct-strip__link:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.acct-strip__meta {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
  padding-left: var(--space-4);
  color: var(--ink-3);
  font-size: var(--text-xs);
}
.acct-strip__meta time { font-variant-numeric: tabular-nums; }
.acct-strip__dot {
  --dot-c: var(--neutral);
  --dot-soft: var(--neutral-soft);
  flex: none;
  order: -1;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dot-c);
  box-shadow: 0 0 0 3px var(--dot-soft);
}
.acct-strip__dot[data-tone="ok"] { --dot-c: var(--ok); --dot-soft: var(--ok-soft); }
.acct-strip__dot[data-tone="warn"] { --dot-c: var(--warn); --dot-soft: var(--warn-soft); }
.acct-strip__refresh { display: flex; margin: 0 0 0 var(--space-1); }
.acct-strip__refresh .btn { --btn-h: var(--space-7); --btn-px: var(--space-2); --btn-fs: var(--text-xs); gap: var(--space-1); }
.acct-strip__refresh .btn[aria-busy="true"] { cursor: progress; opacity: .6; }
@media (max-width: 640px) {
  .acct-strip { padding-inline: var(--space-1); }
  .acct-strip__item { padding-inline: var(--space-3); }
}

/* ---------- account switcher (top bar) ----------
   <details class="menu acct-switcher-wrap" data-menu>
     <summary class="acct-switcher">…</summary>
     <div class="acct-switcher__menu" role="menu">…</div></details> */
.acct-switcher {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  max-width: 100%;
  height: var(--control-md);
  padding: 0 var(--space-2) 0 var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  list-style: none;
  transition: border-color var(--dur-instant) var(--ease-out), background-color var(--dur-instant) var(--ease-out);
}
.acct-switcher::-webkit-details-marker { display: none; }
@media (hover: hover) {
  .acct-switcher:hover { border-color: var(--input-border); background: var(--surface-hover); }
}
.acct-switcher:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.acct-switcher__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-switcher__caret { flex: none; width: 16px; height: 16px; color: var(--ink-3); }
.acct-switcher__menu {
  position: absolute;
  z-index: var(--z-popover);
  top: calc(100% + 6px);
  left: 0;
  width: min(360px, calc(100vw - var(--space-8)));
  max-height: min(480px, 70vh);
  overflow-y: auto;
  padding: var(--space-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--raised);
  box-shadow: var(--shadow-pop);
}
.acct-switcher__menu.is-right { right: 0; left: auto; }
.acct-switcher__group {
  padding: var(--space-2) var(--space-3) var(--space-1);
  color: var(--ink-3);
  font-size: var(--text-2xs);
  font-weight: var(--weight-semi);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.acct-switcher__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  width: 100%;
  min-height: var(--control-lg);
  padding: var(--space-1) var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--text-sm);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--dur-instant) var(--ease-out);
}
@media (hover: hover) {
  .acct-switcher__item:hover { background: var(--surface-hover); color: var(--ink); }
}
.acct-switcher__item:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.acct-switcher__item[aria-current="true"] { background: var(--action-soft); }
.acct-switcher__main { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.acct-switcher__label { display: flex; align-items: center; gap: var(--space-2); min-width: 0; font-weight: var(--weight-medium); }
.acct-switcher__label > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-switcher__item.is-default .acct-switcher__label::after {
  content: "\2605";
  flex: none;
  color: var(--ink-3);
  font-size: var(--text-2xs);
}
.acct-switcher__meta { color: var(--ink-3); font-size: var(--text-2xs); white-space: nowrap; }
.acct-switcher__meta .num, .acct-switcher__mask { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.acct-switcher__equity {
  flex: none;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}
.acct-switcher__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-top: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border-top: 1px solid var(--border);
  font-size: var(--text-sm);
}

/* ---------- step trail: Received → Sent → Filled ---------- */
.step-trail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) 0;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-xs);
}
.step-trail__step {
  --step-c: var(--ink-3);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-3);
  white-space: nowrap;
}
.step-trail__step::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border: 1.5px solid var(--step-c);
  border-radius: 50%;
  background: transparent;
}
.step-trail__step:not(:last-child)::after {
  content: "";
  flex: none;
  width: var(--space-5);
  height: 1px;
  margin: 0 var(--space-2);
  background: var(--border-strong);
}
.step-trail__step[data-state="done"] { --step-c: var(--ok); color: var(--ink-2); }
.step-trail__step[data-state="done"]::before { background: var(--step-c); }
.step-trail__step[data-state="active"] { --step-c: var(--action); color: var(--ink); font-weight: var(--weight-medium); }
.step-trail__step[data-state="active"]::before { background: var(--action-soft); }
.step-trail__step[data-state="failed"] { --step-c: var(--danger); color: var(--ink); font-weight: var(--weight-medium); }
.step-trail__step[data-state="failed"]::before { background: var(--step-c); }
.step-trail__step[data-state="skipped"] { color: var(--ink-3); text-decoration: line-through; }
.step-trail__step[data-state="skipped"]::before { border-style: dashed; }
.step-trail__time { color: var(--ink-3); font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ---------- skeleton row: static placeholders while JS fills a table ---------- */
.skeleton-row > td { height: var(--control-md); }
.skeleton-row > td::after,
.skeleton-bar {
  content: "";
  display: block;
  width: var(--skeleton-w, 70%);
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-hover);
}
.skeleton-row > td.num::after { margin-left: auto; width: var(--skeleton-w, 48%); }

/* ---------- live indicator (blotter.js writes the words) ---------- */
.blotter-live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-3);
  font-size: var(--text-xs);
  white-space: nowrap;
}
.blotter-live-indicator::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
}
.blotter-live-indicator[data-state="paused"]::before { background: var(--neutral); }
.blotter-live-indicator[data-state="stopped"]::before { background: var(--warn); }
.blotter-live-indicator[hidden] { display: none; }


/* ---------- Member workspace refinement ----------
   Shared hierarchy for every data page. Public display styles keep their
   own scale. Metrics get room before adding columns; the container-based
   type size keeps long currency amounts legible inside narrow cards. */
.is-app .pagehead { margin-bottom: var(--space-7); }
.is-app .pagehead-title { font-size: var(--workspace-heading-size); letter-spacing: var(--tracking-tight); }
.is-app .pagehead-lede { font-size: var(--text-md); line-height: var(--leading-relaxed); }
.is-app .pagehead-actions { gap: var(--space-2); }
.is-app .card,
.is-app .panel { box-shadow: none; }
.is-app .panel,
.is-app .blotter-panel { border-radius: var(--radius-xl); }
.is-app .panel-head { padding: var(--space-4) var(--space-5); }
.is-app .panel-head h2,
.is-app .panel-head h3,
.is-app .blotter-panel__title { font-size: var(--text-md); }
.is-app .blotter-panel__head { padding: var(--space-3) var(--space-4); }
.is-app .stat-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, max(var(--stat-min, 8rem), var(--workspace-metric-min))), 1fr));
}
.is-app .stat {
  container-type: inline-size;
  align-content: start;
  gap: var(--space-2);
  padding: var(--space-4);
}
.is-app .stat-label { color: var(--ink-2); font-size: var(--text-sm); line-height: var(--leading-snug); }
.is-app .stat-value {
  font-family: var(--font-body);
  font-size: var(--workspace-metric-size);
  font-size: clamp(var(--text-lg), 11cqi, var(--workspace-metric-size));
  font-weight: var(--weight-semi);
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-heading);
  white-space: nowrap;
}
.is-app .stat-value > .num { font-family: inherit; }
/* A paired win/loss metric is two intact values, including on Performance
   pages which do not load the Journal layout stylesheet. */
.is-app .stat-value:has(> .jv2-slash) { display: grid; gap: var(--space-1); }
.is-app .stat-value > .jv2-slash { display: none; }
.is-app .stat-sub { font-size: var(--text-xs); line-height: var(--leading-relaxed); }
.is-app .stat--link .stat-label { text-decoration: none; }
.is-app .stat--link:hover .stat-label { color: var(--action-ink); }
.is-app .btn-primary,
.is-app .btn-gold,
.is-app .btn-main { box-shadow: var(--shadow-inset); }
@media (max-width: 640px) {
  .is-app .pagehead { margin-bottom: var(--space-5); }
  .is-app .pagehead-title { font-size: var(--text-3xl); }
  .is-app .panel-head { padding: var(--space-3) var(--space-4); }
  .is-app .stat-grid > .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

}

@layer components {
.is-app .panel, .is-app .blotter-panel, .is-app .card { background-image: none; box-shadow: var(--shadow-1); }
.is-app .menu-panel, .is-app .filter-menu-panel { border-color: var(--border-strong); box-shadow: var(--shadow-pop), var(--shadow-inset); }
.is-app .stat--link { transition: background var(--dur-quick) var(--ease-out); }
.is-app .stat--link:hover { background: var(--surface-hover); }
.is-app .btn-primary { background-image: var(--grad-action); box-shadow: var(--shadow-inset), var(--shadow-xs); }
.is-app .table--blotter tbody tr:hover > td { background-color: var(--surface-hover); }
.is-app .tabs a[aria-current="page"] { color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .is-app .stat--link { transition: none; } }
/* One workspace rhythm across trading, automation, analysis and settings. */
.is-app .pagehead { margin-bottom: var(--space-5); padding-bottom: var(--space-4); border-bottom: 1px solid var(--border); }
.is-app .pagehead-body { align-items: center; gap: var(--space-3) var(--space-5); }
.is-app .pagehead-lede { max-width: 70ch; }
.is-app .panel, .is-app .blotter-panel, .is-app .card { border-radius: var(--radius-lg); }
.is-app .panel-head, .is-app .blotter-panel__head { min-height: var(--space-12); padding: var(--space-3) var(--space-4); }
.is-app .panel-head :is(h2, h3, h4), .is-app .blotter-panel__title { font-size: var(--text-sm); font-weight: var(--weight-semi); }
.is-app .table > thead > tr > th { background: var(--raised); color: var(--ink-2); }
.is-app .table > tbody > tr:focus-within > :is(th, td) { background: var(--surface-hover); }
.is-app .table > tbody > tr[aria-selected="true"] > :is(th, td) { background: var(--action-soft); }
.is-app :is(.input, .select, .textarea):not(:disabled) { background-color: var(--sunken); }
.is-app .pagehead-actions { row-gap: var(--space-2); }
@media (max-width: 640px) {
  .is-app .pagehead { padding-bottom: var(--space-3); margin-bottom: var(--space-4); }
  .is-app .pagehead-actions { width: 100%; }
  .is-app :is(.input, .select, .textarea) { font-size: max(1rem, var(--text-base)); }
}

}
