/* app.css — Obverse live desk.
 *
 * PALETTE: the 2026-07-31 design rework (docs/live/design/). Only VALUES changed — every variable name is
 * the one this file already used, so the mapping is a repaint and not a restructure. Light is the default
 * because that is what a broker portal looks like and what the desk sits beside.
 *
 * --good/--bad are mapped from the design's own up/down pair, NOT from its surface tints. Colour in this
 * file is spent only on gain and loss (see `money()` in app.js); wiring the design's --up-soft/--down-soft
 * into general surfaces would undo that and put green back on numbers that have no direction.
 *
 * Two conventions worth stating, because both are load-bearing rather than aesthetic:
 *
 * 1. STALE AND UNKNOWN HAVE THEIR OWN VISUAL LANGUAGE. A missing number renders as an em dash in a muted
 *    tone, never as 0.00. A stale figure keeps a marker attached to it. §Workstream F requires degraded
 *    states rendered explicitly rather than as blanks, and the fastest way to break that is a stylesheet
 *    that makes "unknown" look like "fine".
 * 2. DESTRUCTIVE CONTROLS DO NOT LOOK LIKE ORDINARY ONES. Stop and flatten-all get warn styling; Disable
 *    does not, because it is the gentler off-ramp and making them look identical is how the wrong one
 *    gets pressed.
 *
 * Light and dark both supported via prefers-color-scheme. Mobile-first; the grid collapses to one column.
 */

:root {
  --bg: #f2f2f0;
  --panel: #ffffff;
  --panel-2: #fafaf9;
  --ink: #15181b;
  --ink-2: #5d6570;
  --ink-3: #8b9199;
  --line: #dfe0dd;
  --accent: #0a6b4a;
  --good: #0a6b4a;
  --bad: #b4342a;
  --warn: #8a5a00;
  --stale: #8a5a00;
  --stale-bg: #fdf3dc;
  /* 4px, from the 2026-07-31 design. The old 10px read as a consumer app; a broker portal is crisp, and
   * the corner radius is most of why. Everything using var(--radius) follows automatically. */
  --radius: 4px;
  /* The design's own extra surfaces and lines. `--line-strong` is what it borders INPUTS and BUTTONS with —
   * a control has to look like a control, and the hairline used between table rows is too faint for that. */
  --raised: #fafaf9;
  --hover: #f4f4f2;
  --line-strong: #c9cbc7;
  --on-accent: #ffffff;
  --sel: #cfe8dd;
  /* The rest of the 2026-07-31 desk design's palette. THREE line weights is the part that reads as a
   * broker portal: `--line` frames a card, `--line-soft` divides a header from its body, `--line-faint`
   * separates table rows. One weight for all three is most of why a dense table looks like a spreadsheet. */
  --surface: #ffffff;
  --line-soft: #eceded;
  --line-faint: #f1f2f1;
  --up: #0a7a52;
  --live: #0a9c68;
  --down-ink: #a03227;
  --up-soft: #dff1e9;
  --down-soft: #fdf1f0;
  --down-line: #f2d5d1;
  --warn-soft: #fdf3dc;
  --warn-line: #f0dfae;
  --warn-ink: #8a5a00;
  --chip-bg: #eef1f4;
  --chip-ink: #3f4a55;
  /* Per-strategy identity colours, so an allocation bar and its legend agree. */
  --s1: #0a6b4a; --s2: #2f6fa8; --s3: #8a5a00; --s4: #6b4a8a;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* An EXPLICIT choice wins over the OS. The desk is read next to a broker's own portal, which is light,
 * and a dark panel beside it reads as a different application rather than the same desk. The toggle
 * stores a preference; with none stored the OS decides, which is the polite default. */
:root[data-theme="dark"] {
  --bg: #101315; --panel: #191d21; --panel-2: #1f2429;
  --ink: #e9ebec; --ink-2: #9aa4ad; --ink-3: #6f7982;
  --line: #2b3238; --accent: #3fae82;
  --good: #3fae82; --bad: #e2685c; --warn: #e0bd6f;
  --stale: #e0bd6f; --stale-bg: #332a14;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --raised: #1f2429; --hover: #252b31; --line-strong: #3b434a;
    --on-accent: #0b1a14; --sel: #1d4739;
    --surface: #191d21; --line-soft: #242a2f; --line-faint: #222830;
    --up: #4cc08d; --live: #4cc08d; --down-ink: #f09a91;
    --up-soft: #16342a; --down-soft: #341f1d; --down-line: #54302c;
    --warn-soft: #332a14; --warn-line: #4d4022; --warn-ink: #e0bd6f;
    --chip-bg: #262d34; --chip-ink: #b3bec7;
    --s1: #4fb890; --s2: #6ba3d8; --s3: #d0a24e; --s4: #a98ac9;
    --bg: #101315;
    --panel: #191d21;
    --panel-2: #1f2429;
    --ink: #e9ebec;
    --ink-2: #9aa4ad;
    --ink-3: #6f7982;
    --line: #2b3238;
    --accent: #3fae82;
    --good: #3fae82;
    --bad: #e2685c;
    --warn: #e0bd6f;
    --stale: #e0bd6f;
    --stale-bg: #332a14;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  -webkit-text-size-adjust: 100%;
  padding-bottom: env(safe-area-inset-bottom);
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: #fff; padding: 10px 14px; border-radius: 0 0 var(--radius) 0;
}
.skip:focus { left: 0; }

/* ---------------------------------------------------------------- chrome */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg); z-index: 20;
  padding-top: calc(12px + env(safe-area-inset-top));
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; letter-spacing: -0.01em; }
.mark { width: 20px; height: 20px; color: var(--ink-2); }
.top-right { display: flex; align-items: center; gap: 10px; }

.badge {
  font: 600 11px/1 var(--sans); text-transform: uppercase; letter-spacing: 0.06em;
  padding: 4px 7px; border-radius: 5px; border: 1px solid var(--line); color: var(--ink-2);
}
.badge.env { background: var(--panel-2); }
.badge.env[data-env="live"] { background: var(--bad); border-color: var(--bad); color: #fff; }

.conn { font: 500 12px/1 var(--sans); color: var(--ink-3); }
.conn[data-state="offline"], .conn[data-state="degraded"] { color: var(--warn); font-weight: 650; }

.tabs {
  display: flex; gap: 2px; padding: 0 8px; border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none; position: sticky; top: 53px; background: var(--bg); z-index: 19;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  appearance: none; background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--ink-2); font: 500 14px/1 var(--sans); padding: 12px 12px; cursor: pointer;
  white-space: nowrap;
}
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 650; }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

main { padding: 14px; max-width: 1180px; margin: 0 auto; }
main:focus { outline: none; }

.foot {
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 14px 16px 24px; color: var(--ink-3); font-size: 12px; border-top: 1px solid var(--line);
  margin-top: 20px;
}

/* ---------------------------------------------------------------- cards */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 14px;
}
.card-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.card h2 { margin: 0; font-size: 14px; font-weight: 650; letter-spacing: -0.005em; }
.card h3 { margin: 18px 0 4px; font-size: 13px; font-weight: 650; }
.hint { color: var(--ink-3); font-size: 12.5px; }
.hint em { color: var(--stale); font-style: normal; font-weight: 600; }

.grid { display: grid; gap: 12px; grid-template-columns: 1fr; margin-bottom: 14px; }
.grid.tight { margin-bottom: 6px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px) { .grid { grid-template-columns: repeat(4, 1fr); } }

.kpi { margin-bottom: 0; }
.kpi h2 { color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.big { margin: 6px 0 2px; font: 650 24px/1.1 var(--sans); font-variant-numeric: tabular-nums;
       letter-spacing: -0.02em; }
.sub { margin: 0; color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.asof { margin: 8px 0 0; color: var(--ink-3); font-size: 11.5px; }

.info {
  appearance: none; width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--ink-3); font: 600 10px/1 var(--sans); cursor: help; padding: 0;
}

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); }
.dot[data-s="ok"] { background: var(--good); }
.dot[data-s="warn"] { background: var(--warn); }
.dot[data-s="bad"] { background: var(--bad); }

/* ---------------------------------------------------------------- trader launch
 *
 * This page is intentionally quieter than the trading desk.  It is a short deployment checklist,
 * not an infrastructure console: account choices stay prominent and AWS mechanics stay secondary.
 */
.launch-hero {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 28px;
  margin: 8px 0 18px; padding: 22px 2px 18px; border-bottom: 1px solid var(--line);
}
.launch-hero > div:first-child { max-width: 760px; }
.eyebrow, .step-label {
  margin: 0 0 5px; color: var(--accent); font: 700 10.5px/1.2 var(--sans);
  text-transform: uppercase; letter-spacing: 0.09em;
}
.launch-hero h1 { margin: 0; font-size: clamp(25px, 4vw, 36px); line-height: 1.12; letter-spacing: -0.035em; }
.launch-hero p:last-child { margin: 10px 0 0; color: var(--ink-2); font-size: 14px; max-width: 72ch; }
.launch-state {
  flex: 0 0 auto; min-width: 170px; padding: 11px 13px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--panel-2); font-size: 12px;
}
.launch-state strong { display: block; margin-top: 4px; color: var(--ink); font-size: 14px; }
.deploy-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--ink-3); }
.deploy-dot[data-tone="good"] { background: var(--good); }
.deploy-dot[data-tone="warn"] { background: var(--warn); }
.deploy-dot[data-tone="bad"] { background: var(--bad); }

.launch-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.launch-layout .card { margin-bottom: 0; }
.launch-layout .card-head { flex-direction: row; align-items: flex-start; justify-content: space-between; gap: 18px; }
.launch-layout .card-head .hint { max-width: 270px; text-align: right; }
.step-label { color: var(--ink-3); margin-bottom: 4px; }
.launch-checks { display: grid; gap: 0; }
.launch-check {
  display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.launch-check:last-child { border-bottom: 0; padding-bottom: 2px; }
.checkmark {
  display: grid; place-items: center; width: 19px; height: 19px; margin-top: 1px; border-radius: 50%;
  border: 1px solid var(--line); color: var(--ink-3); font: 800 11px/1 var(--sans);
}
.launch-check[data-ok="true"] .checkmark { background: var(--good); border-color: var(--good); color: #fff; }
.launch-check[data-ok="false"] .checkmark { border-color: var(--warn); color: var(--warn); }
.launch-check strong { display: block; font-size: 13px; }
.launch-check p { margin: 2px 0 0; color: var(--ink-3); font-size: 11.5px; }

.mix-list { display: grid; gap: 0; }
.mix-row, .mix-total {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.mix-row strong { display: block; font-size: 13px; }
.mix-row .hint { display: block; margin-top: 1px; }
.mix-share { font: 650 15px/1 var(--mono); font-variant-numeric: tabular-nums; }
.mix-total { border-bottom: 0; padding-bottom: 2px; color: var(--ink-2); font-size: 12px; }
.mix-total strong { color: var(--ink); font-family: var(--mono); }

.disclosure-copy {
  max-height: 190px; overflow-y: auto; padding: 12px; border: 1px solid var(--line);
  border-radius: 7px; background: var(--panel-2); color: var(--ink-2); font-size: 12px;
  white-space: normal;
}
.disclosure-copy p:first-child { margin-top: 0; }
.disclosure-copy p:last-child { margin-bottom: 0; }
.disclosure-copy + .btn { margin-top: 12px; }
.credential-status {
  display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 9px 10px;
  border: 1px solid var(--line); border-radius: 7px; background: var(--panel-2); font-size: 12px;
}
.launch-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.plan-summary { display: grid; gap: 8px; }
.plan-group {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 12px;
}
.plan-group span { font: 700 13px/1 var(--mono); }
.plan-group.danger { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); color: var(--bad); }
.plan-safe { margin: 0; color: var(--good); font-size: 12px; font-weight: 650; }

@media (min-width: 820px) {
  .launch-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .launch-disclosure-card, .launch-plan-card { grid-column: span 1; }
}
@media (max-width: 639px) {
  .launch-hero { display: block; padding-top: 10px; }
  .launch-state { margin-top: 16px; min-width: 0; }
  .launch-layout .card-head { flex-direction: column; gap: 7px; }
  .launch-layout .card-head .hint { max-width: none; text-align: left; }
  .launch-actions .btn { flex: 1 1 100%; }
}

/* ---------------------------------------------------------------- values */
.num { font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 13px;
       letter-spacing: -0.01em; }
/* `.pos`/`.neg` are applied ONLY to figures whose direction is their meaning — P&L and the day's change.
 * See the comment above `money()` in app.js: colouring every positive number made the one number with a
 * direction invisible among the ones without. */
.pos { color: var(--good); }
.neg { color: var(--bad); }
.none { color: var(--ink-3); }
.short { color: var(--ink); }
.short::before { content: "SHORT "; font: 600 9px/1 var(--sans); letter-spacing: 0.06em;
                 color: var(--warn); vertical-align: 1px; }

/* "Unknown" must never be able to look like a number. */
.unpriced {
  color: var(--stale); background: var(--stale-bg); border: 1px dashed var(--stale);
  border-radius: 4px; padding: 0 5px; font: 600 11px/1.6 var(--sans);
}
.staleflag {
  color: var(--stale); font: 600 10px/1 var(--sans); text-transform: uppercase;
  letter-spacing: 0.05em; border: 1px solid var(--stale); border-radius: 3px; padding: 2px 4px;
  margin-left: 6px; vertical-align: middle;
}

/* ---------------------------------------------------------------- tables */
.tw { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--ink-3); font: 600 11px/1 var(--sans); text-transform: uppercase;
     letter-spacing: 0.05em; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }
tr.sub-row td { border-bottom: 0; padding-top: 2px; padding-bottom: 2px; color: var(--ink-2); }
tr.sym-row td { background: var(--panel-2); font-weight: 600; }
tbody tr:last-child td { border-bottom: 0; }

/* ---------------------------------------------------------------- positions
 *
 * A broker's own portal is dense, quiet and aligned: the reader scans a column of numbers, so the numbers
 * get the contrast and everything else recedes. Row GROUPING carries the hierarchy (contract, then the
 * strategies claiming it) instead of colour, because colour is spent on P&L.
 */
table.positions { font-size: 13px; }
table.positions thead th { padding-bottom: 6px; border-bottom: 1px solid var(--ink-3); }
table.positions .unit { display: block; text-transform: none; letter-spacing: 0;
                        font: 400 10px/1.3 var(--sans); color: var(--ink-3); margin-top: 2px; }

/* The contract row opens a group: a top rule and no bottom rule, so it reads as a heading for the rows
 * beneath rather than as a peer of them. */
table.positions tr.sym-row > * {
  background: transparent; border-bottom: 0; border-top: 1px solid var(--line);
  padding-top: 12px; font-weight: 600;
}
table.positions tbody tr:first-child > * { border-top: 0; }
table.positions th.posname { font: inherit; text-transform: none; letter-spacing: 0; color: var(--ink); }
table.positions .sym { font-family: var(--mono); font-size: 12.5px; letter-spacing: -0.02em; }
table.positions .opt { display: block; margin-top: 3px; color: var(--ink-2);
                       font: 500 11.5px/1.3 var(--sans); text-transform: none; letter-spacing: 0; }
table.positions .opt.expiring { color: var(--warn); font-weight: 650; }

/* Strategy rows: indented by a rule rather than by spaces, so the indent survives a narrow screen. */
table.positions tr.sub-row td.posname { padding-left: 22px; position: relative; }
table.positions tr.sub-row td.posname::before {
  content: ""; position: absolute; left: 10px; top: 50%; width: 6px; height: 1px; background: var(--line);
}
table.positions .strat { color: var(--ink); font-weight: 500; }
table.positions tr.sub-row.foreign td { font-style: normal; }
table.positions tr.sub-row:hover td { background: var(--panel-2); }
table.positions .pctpar { color: var(--ink-3); font-size: 11.5px; margin-left: 4px; }

/* The broker column stays out of the way until it disagrees. */
table.positions .brk { color: var(--ink-3); }
table.positions .agree { font: 500 11px/1 var(--sans); color: var(--ink-3); }
table.positions .mismatch { color: var(--bad); font-weight: 700; }

.state {
  font: 600 10.5px/1 var(--sans); text-transform: uppercase; letter-spacing: 0.05em;
  padding: 4px 6px; border-radius: 4px; border: 1px solid var(--line); color: var(--ink-2);
  background: var(--panel-2);
}
.state[data-v="enabled"] { color: var(--good); border-color: var(--good); }
.state[data-v="draining"] { color: var(--bad); border-color: var(--bad); }
.state[data-v="winding_down"] { color: var(--warn); border-color: var(--warn); }
.state[data-v="pending_enable"] { color: var(--accent); border-color: var(--accent); }

.opt { color: var(--ink-3); font-size: 11.5px; }
.expiring { color: var(--warn); font-weight: 650; }

/* ---------------------------------------------------------------- controls */
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; margin-top: 14px; }
.seg { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }

.btn {
  appearance: none; font: 600 13px/1 var(--sans); padding: 9px 12px; border-radius: 7px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer;
  min-height: 38px;
}
.btn:hover { filter: brightness(1.06); }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; filter: none; }
.btn.ghost { background: var(--panel); border-color: var(--line); color: var(--ink); }
.btn.ghost.on { border-color: var(--accent); color: var(--accent); }
.btn.warn { background: var(--bad); border-color: var(--bad); }
.btn.soft { background: var(--panel); border-color: var(--warn); color: var(--warn); }
.btn.sm { padding: 6px 9px; font-size: 12px; min-height: 30px; }

.danger-zone { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }

/* ---------------------------------------------------------------- forms */
.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field label { font-weight: 600; font-size: 12.5px; }
.field .note { color: var(--ink-3); font-size: 11.5px; }
.field .cons { color: var(--warn); font-size: 11.5px; font-weight: 600; }
input[type="text"], input[type="password"], input[type="number"], select {
  font: 14px var(--sans); padding: 9px 10px; border-radius: 7px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); width: 100%; max-width: 340px; min-height: 38px;
}
input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; }
.bounds { color: var(--ink-3); font-size: 11px; font-family: var(--mono); }
.mfa { color: var(--warn); font-size: 11px; font-weight: 650; }

.check { display: flex; align-items: flex-start; gap: 8px; padding: 7px 0; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; }
.check .t { font-size: 13px; }
.check .p { color: var(--ink-3); font-size: 11.5px; }
.check.locked .t::after {
  content: "required"; margin-left: 6px; color: var(--ink-3); font-size: 10px; font-weight: 650;
  text-transform: uppercase; letter-spacing: 0.05em;
}

/* ---------------------------------------------------------------- indicator (§3.9) */
.ind { display: grid; gap: 4px; margin: 8px 0 10px; padding: 9px 10px; border-radius: 7px;
       background: var(--panel-2); border: 1px solid var(--line); }
.ind-row { display: flex; gap: 8px; align-items: baseline; font-size: 12px; }
.ind-row .k { color: var(--ink-3); min-width: 116px; }
.ind-row .v { font-weight: 600; }
.ind-row .v[data-s="pass"] { color: var(--good); }
.ind-row .v[data-s="fail"] { color: var(--bad); }
.ind-row .v[data-s="unknown"], .ind-row .v[data-s="exits_do_not_resolve"] { color: var(--warn); }
.ind-row .d { color: var(--ink-3); margin-left: auto; font-size: 11px; }

/* ---------------------------------------------------------------- banners */
.banner {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; font-size: 13px;
  border-bottom: 1px solid var(--line); background: var(--stale-bg); color: var(--ink);
}
.banner.bad { background: color-mix(in srgb, var(--bad) 16%, var(--bg)); }
.banner strong { flex: none; }

/* ---------------------------------------------------------------- dialog */
dialog {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
  color: var(--ink); max-width: 560px; width: calc(100% - 28px); padding: 18px;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
dialog h2 { margin: 0 0 10px; font-size: 16px; }
#confirm-body { font-size: 13.5px; }
#confirm-body ul { margin: 8px 0; padding-left: 20px; }
#confirm-body li { margin: 3px 0; }
#confirm-body .warnbox {
  border-left: 3px solid var(--warn); background: var(--stale-bg); padding: 8px 10px;
  margin: 10px 0; border-radius: 0 6px 6px 0;
}

.empty { color: var(--ink-3); font-size: 13px; padding: 14px 2px; }

.curve { display: block; width: 100%; height: 120px; }
.curve path { fill: none; stroke: var(--accent); stroke-width: 1.8; }
.curve .zero { stroke: var(--line); stroke-width: 1; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------------------------------------------------------------- allocation
 *
 * A slider and a number field are two views of ONE value, so they sit on one line and update each other.
 * Saving is a separate press: an allocation that applied on drag would rewrite a risk limit on every pixel
 * of travel, while the user was still deciding what they wanted.
 */
table.alloc td { vertical-align: middle; }
table.alloc .allocw { width: 46%; min-width: 260px; white-space: normal; }
.allocrow { display: flex; align-items: center; gap: 8px; }
.allocrow input[type="range"] { flex: 1 1 auto; min-width: 90px; accent-color: var(--accent); }
.allocrow input[type="number"] {
  width: 72px; text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 13px; padding: 5px 6px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--panel); color: var(--ink);
}
.allocrow .pctsign { color: var(--ink-3); font-size: 12px; margin-left: -4px; }
.btn.small { padding: 5px 9px; font-size: 12px; }

/* Deployed against this strategy's OWN budget — a bar scaled to the whole account would make every
 * strategy look empty and hide the one that is nearly full. */
.bar { height: 4px; background: var(--panel-2); border-radius: 2px; margin-top: 7px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 2px; }

table.alloc tfoot td { border-top: 1px solid var(--ink-3); border-bottom: 0; padding-top: 10px; }
table.alloc tfoot .hint { margin-left: 8px; font-size: 11.5px; }

/* The per-trade share sits beside the allocation because they are two halves of one decision: the
 * allocation is the strategy's total budget, this is how much of it a single signal may take. */
.allocrow .perlbl { color: var(--ink-3); font: 500 11px/1 var(--sans); white-space: nowrap; cursor: help; }
.allocrow input.pernum { width: 62px; }
@media (max-width: 720px) { .allocrow { flex-wrap: wrap; } }


/* ================================================================ THE 2026-07-31 DESIGN LANGUAGE
 *
 * Ported from docs/live/design/ — the shapes and type scale, not only the palette. The mockup carries its
 * styling as inline attributes on each element (it is a React artifact), so what follows is that vocabulary
 * expressed once as CSS rather than repeated per element.
 *
 * The four things that actually change how it reads:
 *   1. 4px corners instead of 10px — see --radius above
 *   2. CONTROLS are bordered with --line-strong, not the table hairline. An input that shares its border
 *      with a row separator does not look interactive
 *   3. labels are UPPERCASE, 12px, 600, 0.05em tracked, muted — the strongest single cue in the design
 *   4. numerals are tabular AND lining everywhere, so columns align and digits sit on one baseline
 */

/* ---- controls: inputs and selects, per the mockup's 14px / 11-12px padding / 4px spec */
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="search"], select, textarea {
  font: inherit; font-size: 14px; padding: 11px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface, var(--panel)); color: var(--ink);
  font-variant-numeric: tabular-nums lining-nums;
}
input::placeholder { color: var(--ink-3); }
/* Inset so the ring never shifts layout, which is why the design chose -1px. */
input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: -1px;
}
::selection { background: var(--sel); }

/* ---- labels: the design's loudest cue */
.fieldlabel, .card label > span.lbl, form label {
  display: block; font-size: 12px; font-weight: 600; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--ink-2);
}

/* ---- buttons: 4px, 600, and a filled accent for the primary action */
.btn {
  font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--panel); color: var(--ink); cursor: pointer;
}
.btn:hover { background: var(--hover); }
.btn.primary, .btn.cta {
  border-color: var(--accent); background: var(--accent); color: var(--on-accent);
}
.btn.primary:hover, .btn.cta:hover { background: var(--accent-hi, var(--accent)); }
.btn.ghost { background: none; border-color: var(--line); color: var(--ink-2); }
.btn.ghost:hover { background: var(--hover); color: var(--ink); }
/* Destructive controls keep their own language — the design has no opinion here and this repo does:
 * flatten-all and Stop must not look like ordinary buttons. */
.btn.warn { border-color: var(--bad); color: var(--bad); background: none; }
.btn.warn:hover { background: var(--down-soft, var(--panel-2)); }

/* ---- headings on the design's scale */
.card h2 { font-size: 14px; font-weight: 600; letter-spacing: -0.005em; }
.big { font-weight: 600; letter-spacing: -0.02em; }
h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 6px; }

/* ---- numerals: tabular AND lining, so a column of figures aligns and sits on one baseline */
.num, .big, .sub, td.r, th.r, table.positions, table.alloc { font-variant-numeric: tabular-nums lining-nums; }

/* ---- surfaces: the design separates panel from raised, which our cards flattened together */
.card { background: var(--panel); }
tr.sym-row > * { background: var(--raised); }
:root[data-theme="dark"] tr.sym-row > *, .card.danger-zone { background: var(--raised); }


/* ================================================================ DESK DESIGN — structure
 * From the full seven-tab design (docs/live/design/). What is ported here is its visual system; the
 * CONTENT stays ours, because that design is drawn against an equities desk with share quantities and our
 * v1 is options-only, and its Risk figures are illustrative rather than our real limit set.
 */

/* ---- the KPI row: a 1px grid gap over a --line background, so the "gutters" ARE the hairlines.
 * One border around the group instead of four around each card is the single biggest reason the design
 * reads as one instrument panel rather than four floating boxes. */
.grid.kpis {
  display: grid; gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: 6px; overflow: hidden; margin-bottom: 22px;
}
.grid.kpis > .card { margin: 0; border: 0; border-radius: 0; background: var(--surface); padding: 20px 22px 18px; }
.grid.kpis > .card h2 {
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--ink-2); margin-bottom: 10px;
}

/* ---- the big number: 42px whole, muted $ and cents. The cents being small and grey is what stops a
 * six-figure equity from reading as noise. */
.figure { display: flex; align-items: baseline; white-space: nowrap; letter-spacing: -0.025em;
          font-variant-numeric: tabular-nums lining-nums; }
.figure .cur { font-size: 19px; font-weight: 500; color: var(--ink-2); margin-right: 1px; }
.figure .whole { font-size: 42px; font-weight: 500; line-height: 1; }
.figure .cents { font-size: 21px; font-weight: 500; color: var(--ink-2); }
.figure.word { font-size: 34px; font-weight: 500; line-height: 1; letter-spacing: -0.02em; }
.card .sub { margin-top: 10px; font-size: 12.5px; color: var(--ink-2); }

/* The trader dot gets a halo, which is how a status light reads as lit rather than printed. */
.dot.lit { box-shadow: 0 0 0 4px var(--up-soft); background: var(--live); width: 10px; height: 10px; }

/* ---- tables: three line weights, and a GROUP row that announces itself */
table.positions thead tr, table.alloc thead tr { background: var(--raised); }
table.positions thead th, table.alloc thead th {
  font-size: 11px; letter-spacing: 0.06em; border-bottom: 1px solid var(--line-soft);
}
table.positions tbody tr { border-bottom: 1px solid var(--line-faint); }
table.positions tr.sym-row > * { background: var(--raised); border-top: 0; }
table.positions tr.sym-row .grouplbl {
  font: 500 11px/1 var(--sans); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3);
}

/* ---- event chips for Activity: fill / refusal / order each get their own tone */
.kind {
  display: inline-block; padding: 2px 7px; border-radius: 3px; font: 600 11px/1.5 var(--sans);
  letter-spacing: 0.04em; text-transform: uppercase; background: var(--chip-bg); color: var(--chip-ink);
}
.kind[data-k="fill"] { background: var(--up-soft); color: var(--accent); }
.kind[data-k="refusal"], .kind[data-k="rejection"] { background: var(--down-soft); color: var(--down-ink); }

/* ---- the environment chip, in the design's warn palette rather than a grey badge */
.badge.env { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn-ink);
             font-weight: 700; letter-spacing: 0.1em; }

/* ---- the allocation stacked bar: shares of one account, so one bar rather than four meters */
.allocbar { display: flex; height: 12px; border-radius: 6px; overflow: hidden;
            background: var(--line-soft); margin: 4px 0 18px; }
.allocbar > span { height: 100%; display: block; }
.swatch { width: 9px; height: 9px; border-radius: 2px; flex: none; display: inline-block; }


/* ---- the kill switch, in the header beside the connection state. In the CHROME rather than the page,
 * because it is what you reach when something is wrong and a tab or a scroll away is too far. Both
 * buttons confirm before acting, which is what makes this placement safe. */
.kill { display: inline-flex; gap: 6px; padding-left: 10px; margin-left: 4px;
        border-left: 1px solid var(--line); }
.btn.sm { font-size: 11.5px; padding: 5px 9px; }
@media (max-width: 560px) { .kill { padding-left: 6px; margin-left: 0; } }


/* ---- the equity chart, now with a real coordinate space so labels are legible */
svg.curve { width: 100%; height: 200px; display: block; }
svg.curve path { fill: none; stroke: var(--accent); stroke-width: 2;
                 stroke-linejoin: round; vector-effect: non-scaling-stroke; }
svg.curve .grid { stroke: var(--line-soft); stroke-width: 1; }
svg.curve .ytick { fill: var(--ink-3); font: 500 11px var(--sans); text-anchor: end;
                   font-variant-numeric: tabular-nums lining-nums; }
svg.curve .xtick { fill: var(--ink-3); font: 500 11px var(--sans); }

/* ---- reorderable tabs: the affordance has to be visible or nobody discovers it */
.tab { cursor: grab; }
.tab:active { cursor: grabbing; }
.tab.dragging { opacity: 0.45; background: var(--hover); }
.tabs { scroll-behavior: smooth; }

/* ---- why a disabled deploy button is disabled. Visible, not a tooltip: a title on a disabled control
 * needs a hover, never appears on touch, and the old one could render as the bare string "Complete: ".
 * Warn-toned rather than error-toned — "you have not finished the checklist" is not a fault. */
.launch-blocked-why {
  margin: 10px 0 0; padding: 8px 11px; border-radius: 5px;
  background: var(--warn-soft); border: 1px solid var(--warn-line); color: var(--warn-ink);
  font-size: 12.5px; line-height: 1.45; max-width: 68ch;
}

/* ---- banner dismiss button. A sticky refusal needs a way out, or it becomes furniture. */
.banner { position: relative; padding-right: 34px; }
.banner-x {
  position: absolute; top: 6px; right: 8px;
  background: none; border: 0; cursor: pointer; padding: 2px 6px; border-radius: 4px;
  font: 400 17px/1 var(--sans); color: inherit; opacity: 0.55;
}
.banner-x:hover { opacity: 1; background: rgba(127, 127, 127, 0.16); }
