/* Bonus Round design system. Dark-only by design (arcade-premium). Every page links this file.
   Fonts: <link href="https://fonts.googleapis.com/css2?family=Sora:wght@500;600;700;800&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;600&display=swap" rel="stylesheet">
   Shared by the marketing site and the app. App-only refinements live under `.app` (the shell from BR.shell) so they
   never change a marketing page. */
:root {
  color-scheme: dark;
  /* surfaces */
  --bg: #0a0b10; --surface-1: #12141c; --surface-2: #181b26; --surface-3: #202433;
  --surface-inset: #0d0e14;              /* fields, code and tooltips sit "into" a card */
  --line: #262a38; --line-strong: #353a4d; --line-hover: #4a5068;
  /* text (all AA on every surface: text 14:1+, text-2 8.4:1+, muted 5.0:1+) */
  --text: #f2f4f8; --text-2: #b9c0cf; --muted: #8a93a6; --placeholder: #737c90;
  /* brand */
  --gold: #ffc93c; --gold-2: #ffb000; --gold-ink: #1a1405;
  --violet: #7c5cff; --cyan: #22d3ee; --coral: #ff5d8f; --mint: #34d399;
  --grad: linear-gradient(135deg, #7c5cff 0%, #22d3ee 100%);
  --grad-gold: linear-gradient(135deg, #ffd66b 0%, #ffb000 100%);
  /* status (reserved: never series colours; always with icon + label) */
  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
  /* status tints for pills, banners and boxes: ink (text) / bg / line. Ink is 9:1+ on its bg. */
  --good-ink: #7ee07e; --good-bg: #0f2214; --good-line: #1f4d2a;
  --warn-ink: #ffd27a; --warn-bg: #1f1806; --warn-line: #5a4512;
  --bad-ink: #ff9b9b;  --bad-bg: #240f0f;  --bad-line: #5a2222;
  --info-ink: #c4b8ff; --info-bg: #17132b; --info-line: #3b3170;
  /* chart series (dark steps, validated on --surface-1: all checks pass) */
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
  /* shape */
  --r-sm: 8px; --r: 12px; --r-lg: 18px; --r-xl: 28px;
  --shadow: 0 10px 40px rgba(0,0,0,.35);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.22);
  --ring: 0 0 0 3px rgba(124,92,255,.24);  /* field focus glow */
  --font: Inter, system-ui, -apple-system, Segoe UI, sans-serif;
  --display: Sora, Inter, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  /* app layout */
  --nav-w: 240px; --app-max: 1520px; --app-narrow: 1120px; --app-form: 880px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
img, svg, video, canvas { max-width: 100%; }
h1, h2, h3, h4 { font-family: var(--display); letter-spacing: -.02em; line-height: 1.1; margin: 0 0 .5em; }
h1 { font-size: clamp(34px, 5.4vw, 64px); font-weight: 800; }
h2 { font-size: clamp(26px, 3.4vw, 40px); font-weight: 700; }
h3 { font-size: 19px; font-weight: 650; }
p { margin: 0 0 1em; color: var(--text-2); }
code, pre, .mono { font-family: var(--mono); font-size: .92em; }
pre { background: #07080c; border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; overflow-x: auto; color: #dfe6f3; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.gold-text { background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; color: transparent; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
@media (max-width: 640px) { .container { padding: 0 16px; } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* keyboard focus: one visible ring everywhere (fields keep their own glow) */
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 999px; padding: 11px 20px; font: 650 14.5px/1 var(--font); cursor: pointer; text-decoration: none; transition: transform .12s ease, background .2s, border-color .2s, opacity .2s, box-shadow .2s, color .2s; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--grad-gold); color: var(--gold-ink); box-shadow: 0 6px 24px rgba(255,190,40,.25); }
.btn-primary:hover { filter: brightness(1.05); }
/* A disabled primary reads as "not yet", not as a muddy gold: neutral fill, readable label. */
.btn-primary:disabled, .btn-primary[aria-disabled="true"] { background: var(--surface-3); color: var(--muted); box-shadow: none; filter: none; opacity: 1; border-color: var(--line-strong); }
.btn-secondary { background: var(--surface-2); border-color: var(--line-strong); color: var(--text); }
.btn-secondary:hover { border-color: var(--line-hover); background: var(--surface-3); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { color: var(--text); }
.btn-danger { background: transparent; border-color: #5a2a2a; color: #ff8a8a; }
.btn-danger:hover { background: var(--bad-bg); border-color: #7a3434; }
.btn-lg { padding: 15px 26px; font-size: 16px; }
.btn-sm { padding: 7px 12px; font-size: 13px; }

/* forms */
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
input, select, textarea { background-color: var(--surface-1); border: 1px solid var(--line-strong); color: var(--text); border-radius: var(--r-sm); padding: 11px 13px; font: inherit; font-size: 15px; outline: none; width: 100%; transition: border-color .15s, box-shadow .15s, background .15s; }
input::placeholder, textarea::placeholder { color: var(--placeholder); opacity: 1; }
input:hover:not(:focus):not(:disabled), select:hover:not(:focus):not(:disabled), textarea:hover:not(:focus):not(:disabled) { border-color: var(--line-hover); }
input:focus, select:focus, textarea:focus { border-color: var(--violet); box-shadow: var(--ring); }
input:disabled, select:disabled, textarea:disabled { opacity: .55; cursor: not-allowed; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--critical); box-shadow: 0 0 0 3px rgba(208,59,59,.18); }
.field-error { font-size: 12.5px; color: var(--bad-ink); }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--gold); }
/* one chevron for every select (the native arrow sits flush to the edge and differs per OS) */
select:not([multiple]):not([size]) { appearance: none; -webkit-appearance: none; padding-right: 36px !important; /* inline paddings must not run text under the chevron */ cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a93a6' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; }
select option { background: var(--surface-2); color: var(--text); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* surfaces */
.card { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; min-width: 0; }
.card h3 { margin-bottom: 10px; }
.card-hd { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.card-hd > :first-child { min-width: 0; }
.card-hd .aside { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.4; white-space: nowrap; border: 1px solid var(--line-strong); color: var(--text-2); background: var(--surface-2); }
.pill.good { color: var(--good-ink); border-color: var(--good-line); background: var(--good-bg); }
.pill.warn { color: var(--warn-ink); border-color: var(--warn-line); background: #261d08; }
.pill.bad { color: var(--bad-ink); border-color: var(--bad-line); background: var(--bad-bg); }
.pill.gold { color: var(--gold); border-color: var(--warn-line); background: var(--warn-bg); }
.pill.info { color: var(--info-ink); border-color: var(--info-line); background: var(--info-bg); }
.pill.muted { color: var(--muted); border-color: var(--line); background: transparent; } /* Draft, Ended: recede */
.pill .why { font-weight: 500; opacity: .85; } /* the reason after a status word: "Paused · out of funds" */
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.pill.busy .dot { animation: br-breathe 1.8s ease-in-out infinite; } /* work in progress (learning, generating) */
@keyframes br-breathe { 50% { opacity: .35; } }
.divider { height: 1px; background: var(--line); margin: 18px 0; }

/* stat tiles */
.stat { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; min-width: 0; }
.stat .k { font-size: 12.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.stat .v { font: 750 28px/1.15 var(--display); margin-top: 6px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .d { font-size: 12.5px; margin-top: 4px; color: var(--muted); }
.stat .d.up::before { content: "▲ "; color: #7ee07e; } .stat .d.down::before { content: "▼ "; color: #ff9b9b; }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12.5px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-1); white-space: nowrap; }
table.data td { padding: 11px 12px; border-bottom: 1px solid var(--line); }
table.data tr:last-child td { border-bottom: 0; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tbody tr:hover { background: rgba(255,255,255,.02); }

/* ---------- app shell (rendered by BR.shell in ui.js) ---------- */
/* The nav column is painted on .app so it runs the full page height however long the page is. */
.app { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); min-height: 100vh;
  background: linear-gradient(90deg, #0c0d13 0, #0c0d13 calc(var(--nav-w) - 1px), var(--line) calc(var(--nav-w) - 1px), var(--line) var(--nav-w), transparent var(--nav-w)); }
.app-nav { padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; scrollbar-width: thin; }
.app-nav .logo { display: flex; align-items: center; gap: 8px; font: 800 17.5px var(--display); letter-spacing: -.01em; text-decoration: none; padding: 6px 10px 18px; border-radius: 10px; }
.app-nav .nav-toggle { display: none; }
.app-nav .nav-items { display: flex; flex-direction: column; flex: 1; gap: 1px; }
.app-nav .section { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin: 18px 10px 6px; font-weight: 700; }
.app-nav .section.account { margin-top: auto; padding-top: 18px; }
.app-nav .item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 9px; background: none; color: var(--text-2); text-decoration: none; text-align: left; cursor: pointer; font: 550 14px/1.4 var(--font); transition: background .15s, color .15s; }
.app-nav .item svg { flex: none; color: var(--muted); transition: color .15s; }
.app-nav .item:hover { background: var(--surface-1); color: var(--text); }
.app-nav .item:hover svg { color: var(--text-2); }
.app-nav .item.active { background: var(--surface-2); color: var(--text); box-shadow: inset 2px 0 0 var(--gold); }
.app-nav .item.active svg { color: var(--gold); }
.app-nav .item:disabled { opacity: .6; cursor: progress; }
.app-nav .who { display: flex; align-items: center; gap: 10px; margin-top: 6px; padding: 10px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); min-width: 0; }
.app-nav .who .av { width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center; font: 700 12px var(--display); color: var(--text); background: linear-gradient(135deg, #2b2550, #1c3a4a); border: 1px solid var(--line-strong); }
.app-nav .who .id { display: flex; flex-direction: column; gap: 4px; min-width: 0; align-items: flex-start; }
.app-nav .who .email { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-nav .who .role { font-size: 11.5px; color: var(--gold); font-weight: 600; }
/* workspace switcher (BR.shell): the account block is a button; the list opens inline above it (no clipping in the phone sheet) */
.app-nav .ws-switch { width: 100%; background: none; border: 0; border-top: 1px solid var(--line); border-radius: 0; text-align: left; cursor: pointer; font: 13px/1.4 var(--font); color: var(--muted); transition: background .15s; }
.app-nav .ws-switch:hover { background: var(--surface-1); }
.app-nav .ws-switch .ws-name { color: var(--text); font-weight: 650; font-size: 13.5px; }
.app-nav .ws-switch .id { flex: 1; }
.app-nav .ws-switch .chev { flex: none; color: var(--muted); transition: transform .15s; }
.app-nav .ws-switch[aria-expanded="true"] .chev { transform: rotate(180deg); }
.app-nav .ws-menu { margin: 8px 0 4px; padding: 6px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface-1); display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow-sm); }
.app-nav .ws-menu[hidden] { display: none; }
.app-nav .ws-hd { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; padding: 4px 8px 6px; }
.app-nav .ws-opt { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: 8px; background: none; color: var(--text-2); text-align: left; cursor: pointer; font: 550 13.5px/1.3 var(--font); text-decoration: none; min-height: 40px; }
.app-nav .ws-opt:hover, .app-nav .ws-opt:focus-visible { background: var(--surface-2); color: var(--text); }
.app-nav .ws-opt[aria-current="true"] { color: var(--text); background: var(--surface-2); }
.app-nav .ws-opt .nm { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.app-nav .ws-opt .nm > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-nav .ws-opt .rl { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.app-nav .ws-opt .ck { color: var(--gold); font-weight: 800; }
.app-nav .ws-opt svg { color: var(--muted); flex: none; margin: 0 5px; }
.app-nav .av.sm { width: 24px; height: 24px; border-radius: 7px; font-size: 11px; flex: none; display: grid; place-items: center; font-family: var(--display); font-weight: 700; color: var(--text); background: linear-gradient(135deg, #2b2550, #1c3a4a); border: 1px solid var(--line-strong); }
.app-nav .ws-new { border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; margin-top: 4px; padding-top: 10px; }
@media (min-width: 861px) { .app-nav .ws-menu { position: absolute; left: 12px; right: 12px; bottom: 78px; z-index: 30; margin: 0; max-height: calc(100vh - 120px); overflow-y: auto; box-shadow: var(--shadow); } }
/* Content column: full width up to --app-max, then centred so big monitors don't stretch tables and charts edge to edge. */
.app-main { padding: 28px 32px 64px; min-width: 0; }
.app-main > * { max-width: var(--app-max); margin-inline: auto; }
.app-main.narrow > * { max-width: var(--app-narrow); }
.app-main.form > * { max-width: var(--app-form); }
.app-main.form .gx-steps, .app-main.form .onb { max-width: none; } /* the page measure already sets the width */
#content:focus { outline: none; }
.app-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px 20px; margin-bottom: 24px; flex-wrap: wrap; }
.app-top > div:first-child { min-width: 0; }
.app-top h1 { font-size: 28px; font-weight: 750; letter-spacing: -.025em; line-height: 1.15; margin: 0; overflow-wrap: anywhere; }
.app-top .sub { margin-top: 6px; font-size: 14px; color: var(--muted); max-width: 72ch; }
.app-top .actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.app-top .actions .pill { height: 26px; }
.app-top .crumb:empty { display: none; }
.app-top .crumb { margin-bottom: 8px; }
.app-top .crumb .adv-back { margin: 0; display: inline-flex; gap: 6px; align-items: center; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 500; padding: 2px 0; }
.app-top .crumb .adv-back:hover { color: var(--text); }
.app-top .app-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.app-top .app-meta:empty { display: none; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--gold); color: var(--gold-ink); padding: 8px 14px; border-radius: 999px; font-weight: 700; text-decoration: none; }
.skip-link:focus { top: 12px; }
.app-fatal { max-width: 460px; margin: 14vh auto 0; padding: 0 20px; text-align: center; }
.app-fatal .logo { display: inline-flex; align-items: center; gap: 8px; font: 800 18px var(--display); text-decoration: none; margin-bottom: 28px; }
.app-fatal h1 { font-size: 28px; }
/* loading: the shell shows this until the page script renders (any el.innerHTML replaces it) */
.page-skel { display: grid; gap: 16px; }
.page-skel .r { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.page-skel .skel { border-radius: var(--r-lg); }

/* app refinements: a calmer, denser type scale and quieter chrome inside the dashboards */
.app .card { padding: 20px; }
.app .card-hd { margin-bottom: 14px; min-height: 24px; flex-wrap: wrap; row-gap: 8px; }
.app .card-hd .aside { margin-left: auto; }
:where(.app) .card h3, :where(.app) .card-hd h3 { font-size: 16.5px; font-weight: 700; letter-spacing: -.015em; line-height: 1.3; }
:where(.app) .card h4 { font-size: 14.5px; font-weight: 650; letter-spacing: -.01em; }
.app .card-hd .note, .app .card-hd > .small.muted, .app .card-hd > .muted.small { font-size: 12.5px; color: var(--muted); text-align: right; }
.app .btn-primary { box-shadow: 0 1px 0 rgba(255,255,255,.35) inset, 0 4px 16px rgba(255,176,0,.16); }
.app .btn-primary:hover { filter: brightness(1.06); box-shadow: 0 1px 0 rgba(255,255,255,.35) inset, 0 6px 22px rgba(255,176,0,.24); }
.app .btn-primary:disabled, .app .btn-primary[aria-disabled="true"] { box-shadow: none; }
.app .btn-ghost:hover { background: rgba(255,255,255,.04); }
.app .btn { padding: 10px 18px; font-size: 14px; }
.app .btn-sm { padding: 6px 12px; font-size: 13px; }
.app .btn-lg { padding: 14px 24px; font-size: 15.5px; }
.app input:where(:not([type=checkbox], [type=radio], [type=range], [type=file], [type=color])), .app select, .app textarea { background-color: var(--surface-inset); padding: 10px 12px; }
.app label.field { color: var(--text-2); font-weight: 500; }
.app .stat { padding: 16px 18px 15px; }
.app .stat .k { font-size: 11.5px; letter-spacing: .07em; display: flex; align-items: center; gap: 2px; }
.app .stat .v { font-size: 26px; font-weight: 750; margin-top: 8px; }
.app .stat .d { margin-top: 5px; }
/* tables in the app: quiet header band, roomier rows, scroll shadows when a table is wider than its card */
.app .table-wrap { background:
    linear-gradient(90deg, var(--surface-1) 30%, rgba(18,20,28,0)) left / 40px 100% no-repeat local,
    linear-gradient(270deg, var(--surface-1) 30%, rgba(18,20,28,0)) right / 40px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(0,0,0,.55), transparent) left / 14px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.55), transparent) right / 14px 100% no-repeat scroll,
    var(--surface-1);
  -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.app table.data th { background: rgba(255,255,255,.025); font-size: 12px; padding: 10px 14px; letter-spacing: .01em; }
.app table.data td { padding: 12px 14px; }
.app table.data th:first-child, .app table.data td:first-child { padding-left: 16px; }
.app table.data th:last-child, .app table.data td:last-child { padding-right: 16px; }
.app table.data tbody tr { transition: background .12s; }
.app table.data tbody tr:hover { background: rgba(255,255,255,.028); }
.app table.data td .pill { vertical-align: middle; }
.app table.data td a:not(.btn) { text-decoration-color: rgba(255,255,255,.25); text-underline-offset: 3px; }
/* sortable headers (BR.sortable): the whole header is a button; ▲/▼ on the sorted column, a faint ▼ on hover elsewhere */
table.data th:has(> .th-sort) { padding-top: 0; padding-bottom: 0; }
table.data .th-sort { display: inline-flex; align-items: center; gap: 5px; min-height: 38px; vertical-align: middle; margin: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; letter-spacing: inherit; text-align: inherit; cursor: pointer; border-radius: 4px; transition: color .15s; }
table.data th.num .th-sort { flex-direction: row-reverse; } /* indicator left of a right-aligned label */
table.data th > .th-sort + * { margin-left: 4px; vertical-align: middle; } /* a help tip after the label */
.sort-sm { display: none; } /* phone-only sort control for cards-sm tables (BR.sortable) */
table.data .th-sort .ind { font-size: 9px; line-height: 1; width: 9px; flex: none; opacity: 0; transition: opacity .15s; }
table.data .th-sort:hover, table.data th[aria-sort="ascending"] .th-sort, table.data th[aria-sort="descending"] .th-sort { color: var(--text); }
table.data .th-sort:hover .ind, table.data .th-sort:focus-visible .ind { opacity: .45; }
table.data th[aria-sort="ascending"] .ind, table.data th[aria-sort="descending"] .ind { opacity: 1; color: var(--gold); }
/* Phone: table.data.cards-sm becomes one card per row below 520px. Each td carries data-label (its column header);
   td.card-title spans the card as its heading, td.card-full spans without a label, td.card-act holds a full-width row action; .cols-3 lays fields out three across.
   Desktop markup stays a real table. */
@media (max-width: 520px) {
  .app .table-wrap:has(> table.cards-sm) { border: 0; background: none; overflow: visible; border-radius: 0; }
  .app table.data.cards-sm, .app table.data.cards-sm tbody { display: block; }
  .app table.data.cards-sm thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .app table.data.cards-sm tbody { display: grid; gap: 10px; }
  .app table.data.cards-sm tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; padding: 14px 16px; background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r); }
  .app table.data.cards-sm.cols-3 tr { grid-template-columns: repeat(3, minmax(0, 1fr)); } /* three short fields: one row */
  .app table.data.cards-sm tr[hidden] { display: none; }
  .app table.data.cards-sm tbody tr:hover { background: var(--surface-1); }
  .app table.data.cards-sm td { display: block; padding: 0 !important; border: 0; text-align: left; min-width: 0; white-space: normal; }
  .app table.data.cards-sm td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 3px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
  .app table.data.cards-sm td.card-title, .app table.data.cards-sm td.card-full, .app table.data.cards-sm td[colspan] { grid-column: 1 / -1; }
  .app table.data.cards-sm td.card-title { order: -1; padding-bottom: 10px !important; border-bottom: 1px solid var(--line); font-size: 15px; }
  .app table.data.cards-sm td.card-title::before { display: none; }
  .app table.data.cards-sm td.num { font-variant-numeric: tabular-nums; }
  .app table.data.cards-sm td:empty { display: none; }
  .app table.data.cards-sm td.hide-sm, .app table.data.cards-sm td.bl-hide-sm { display: block; } /* labelled cards have room for every column */
  .app table.data.cards-sm div.bl-only-sm { display: none; } /* phone-only extras inside a cell repeat a column the card already shows */
  .app table.data.cards-sm td.card-act { grid-column: 1 / -1; } .app table.data.cards-sm td.card-act .btn { width: 100%; }
  .sort-sm { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; font-size: 13px; color: var(--muted); font-weight: 500; }
  .sort-sm select { flex: 1; min-width: 0; width: auto; padding-top: 8px; padding-bottom: 8px; font-size: 14px; }
}
@media (max-width: 860px) {
  /* Phone/tablet: a sticky top bar; the Menu button opens the full nav as a drop-down sheet. */
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; background: none; } /* bar keeps its height on short pages */
  .app-nav { position: sticky; top: 0; z-index: 60; height: auto; overflow: visible; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line); background: rgba(12,13,19,.94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); display: block; }
  .app-nav .nav-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .app-nav .logo { padding: 4px 0; }
  .app-nav .nav-toggle { display: inline-flex; }
  .app-nav .nav-items { display: none; }
  .app-nav.open .nav-items { display: flex; position: absolute; left: 0; right: 0; top: 100%; max-height: calc(100vh - 60px); overflow-y: auto; padding: 6px 12px 14px; background: #0c0d13; border-bottom: 1px solid var(--line-strong); box-shadow: 0 24px 50px rgba(0,0,0,.55); animation: br-sheet .18s ease-out; }
  .app-nav .section { margin-top: 12px; }
  .app-nav .section.account { margin-top: 12px; padding-top: 0; }
  .app-nav .item { padding: 11px 10px; font-size: 15px; } /* 44px touch targets */
  .app-main { padding: 20px 16px 56px; }
  .app-top { margin-bottom: 18px; }
  .app-top h1 { font-size: 24px; }
  .app-top > div:first-child { flex: 1 1 100%; }
  .app-top .actions { justify-content: flex-start; }
  .app .card { padding: 16px; }
  .page-skel .r { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@keyframes br-sheet { from { opacity: 0; transform: translateY(-6px); } }

/* marketing nav */
.site-nav { position: sticky; top: 0; z-index: 50; backdrop-filter: blur(14px); background: rgba(10,11,16,.72); border-bottom: 1px solid rgba(255,255,255,.06); }
.site-nav .container { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.site-nav .links { display: flex; gap: 22px; align-items: center; font-size: 14.5px; }
.site-nav .links a { color: var(--text-2); text-decoration: none; } .site-nav .links a:hover { color: var(--text); }
@media (max-width: 760px) { .site-nav .links a.hide-sm { display: none; } }

/* toast */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 10px; background: var(--surface-2); border: 1px solid var(--line-strong); padding: 11px 14px; border-radius: 12px; box-shadow: var(--shadow); font-size: 14px; max-width: 380px; color: var(--text); pointer-events: auto; animation: br-toast .22s cubic-bezier(.2,.9,.3,1.2); }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--good-ink); flex: none; margin-top: 6px; }
.toast.err { border-color: var(--bad-line); background: #1c1013; }
.toast.err::before { background: var(--bad-ink); }
@keyframes br-toast { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@media (max-width: 640px) { .toasts { left: 12px; right: 12px; bottom: 12px; } .toast { max-width: none; } }

/* empty + skeleton */
.empty { border: 1px dashed var(--line-strong); border-radius: var(--r-lg); padding: 34px; text-align: center; color: var(--muted); }
.app .empty { padding: 32px 24px; color: var(--text-2); font-size: 14px; background: rgba(255,255,255,.012); border-color: #2e3344; }
.app .empty h3 { color: var(--text); font-size: 17px; margin-bottom: 8px; }
.app .empty p { color: var(--text-2); max-width: 56ch; margin-inline: auto; font-size: 14px; }
.app .empty > .btn, .app .empty .row { margin-top: 4px; }
/* "how it works" row inside a big empty state, so a first-time page teaches the flow */
.empty-steps { list-style: none; counter-reset: es; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; max-width: 820px; margin: 28px auto 0; padding: 0; text-align: left; }
.empty-steps li { counter-increment: es; position: relative; background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 14px 14px 50px; font-size: 13.5px; color: var(--text-2); line-height: 1.5; }
.empty-steps li::before { content: counter(es); position: absolute; left: 14px; top: 14px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font: 700 12px var(--font); background: var(--surface-3); border: 1px solid var(--line-strong); color: var(--text); }
.empty-steps li.done::before { content: "✓"; background: var(--good-bg); border-color: var(--good-line); color: var(--good-ink); }
.empty-steps b { display: block; color: var(--text); font: 650 14px var(--display); margin-bottom: 2px; }
@media (max-width: 760px) { .empty-steps { grid-template-columns: minmax(0, 1fr); } }
.skel { background: linear-gradient(90deg, var(--surface-1) 20%, var(--surface-2) 50%, var(--surface-1) 80%); background-size: 200% 100%; animation: skel 1.4s ease-in-out infinite; border-radius: 8px; }
.stat.skel, .card.skel { border-color: var(--line); }
@keyframes skel { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .skel, .pill.busy .dot { animation: none; } .toast, .app-nav.open .nav-items { animation: none; } }

/* ---------- shared controls: one look on every page ---------- */
/* Segmented control: date ranges, status filters, small exclusive choices. Children are <button> (state via .on,
   aria-pressed or aria-selected) or <label><input type=radio></label> (the radio is hidden but stays focusable). */
.seg { display: inline-flex; align-items: center; padding: 3px; gap: 2px; border-radius: 999px; background: var(--surface-1); border: 1px solid var(--line-strong); max-width: 100%; }
.seg > button, .seg > label { position: relative; border: 0; background: none; color: var(--muted); font: 600 13px/1 var(--font); padding: 8px 13px; border-radius: 999px; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s; display: inline-flex; align-items: center; gap: 6px; }
.seg > button:hover, .seg > label:hover { color: var(--text); }
.seg > .on, .seg > [aria-pressed="true"], .seg > [aria-selected="true"], .seg > label:has(input:checked) { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.35); }
.seg > label input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.seg > label:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 1px; }
.seg .muted, .seg .count { font-variant-numeric: tabular-nums; font-weight: 500; color: var(--muted); }
@media (max-width: 640px) { .seg { overflow-x: auto; scrollbar-width: none; } .seg::-webkit-scrollbar { display: none; } }
/* Toggle chip: multi-select (categories, ratings, tone). <label class="chip"><input type=checkbox>Text</label>; the box
   is hidden but focusable and a check mark shows the state. .gx-chip and .togglechips label are the page aliases. */
.chip, .gx-chip, .togglechips label { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text-2); font: 500 13px/1.3 var(--font); cursor: pointer; user-select: none; transition: border-color .15s, background .15s, color .15s; }
.chip:hover, .gx-chip:hover, .togglechips label:hover { border-color: var(--line-hover); color: var(--text); }
.chip input, .gx-chip input, .togglechips label input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.chip:has(input:focus-visible), .gx-chip:has(input:focus-visible), .togglechips label:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; }
.chip:has(input:checked), .chip.on, .gx-chip:has(input:checked), .gx-chip.on, .togglechips label:has(input:checked) { border-color: rgba(255,201,60,.55); color: var(--text); background: rgba(255,201,60,.08); }
.chip:has(input:checked)::before, .gx-chip:has(input:checked)::before, .togglechips label:has(input:checked)::before { content: "✓"; font-size: 11px; font-weight: 800; color: var(--gold); margin-left: -2px; }
.chips-row, .gx-chips, .togglechips { display: flex; flex-wrap: wrap; gap: 8px; }

/* charts (charts.js) */
.chart { position: relative; }
.chart .plot svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .plot svg text { font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .chart-hd { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; min-height: 18px; }
.chart .chart-hd:not(:has(.legend)):not(:has(.tablebtn)) { display: none; }
.chart .legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--text-2); }
.chart .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart .tip { position: absolute; pointer-events: none; background: rgba(11,12,18,.96); border: 1px solid var(--line-strong); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; box-shadow: var(--shadow); white-space: nowrap; z-index: 5; display: none; font-variant-numeric: tabular-nums; backdrop-filter: blur(6px); }
.chart .tip b { font-weight: 650; color: var(--text); } .chart .tip .r { display: flex; justify-content: space-between; gap: 14px; color: var(--text-2); }
.chart-empty { display: grid; place-items: center; min-height: 200px; border: 1px dashed var(--line-strong); border-radius: var(--r); color: var(--muted); font-size: 13.5px; text-align: center; padding: 20px; }
.tablebtn { flex: none; margin-left: auto; display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 8px; font: 600 12px/1.4 var(--font); color: var(--muted); background: none; border: 1px solid var(--line); cursor: pointer; transition: color .15s, border-color .15s, background .15s; }
.tablebtn svg { flex: none; }
.tablebtn:hover { color: var(--text); border-color: var(--line-strong); background: var(--surface-2); }
.tablebtn[aria-pressed="true"] { color: var(--text); background: var(--surface-3); border-color: var(--line-strong); }
.chart .tbl .table-wrap { max-height: 360px; overflow: auto; }
.chart .tbl thead th { position: sticky; top: 0; background: var(--surface-2); z-index: 1; }
