:root {
  --bg: #0b1114;
  --panel: #0f1619;
  --panel-2: #131c20;
  --line: #1e2b30;
  --text: #d7e3e6;
  --muted: #6b8189;
  --green: #1fa67a;
  --green-dim: rgba(31, 166, 122, 0.14);
  --red: #d4576b;
  --red-dim: rgba(212, 87, 107, 0.14);
  --accent: #50d2c1;
}

* {
  box-sizing: border-box;
}

/* macOS trackpads rubber-band the document past its ends, which slides the
   whole page (sticky topbar included) and reveals the browser's own ground
   behind it (owner's report 2026-09-12). Kill the bounce on the root
   scroller, and paint html the page color so any edge the browser does
   reveal matches the theme instead of flashing light. */
html {
  background: var(--bg);
  overscroll-behavior-y: none;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
  /* A touch of lift from the page below, matching the login card. */
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent), var(--panel);
  /* The nav stays put while the page scrolls (owner's call 2026-09-12).
     The trading page never scrolls its body, so this only bites on the
     document-scrolling pages; the background above is already opaque. */
  position: sticky;
  top: 0;
  z-index: 10;
}

/* The lockup is the way home (owner's call 2026-09-12): on the app pages
   it links to the accounts page. Login and admin keep it inert — one is
   before home exists, the other is not part of the website. */
a.brand {
  text-decoration: none;
  color: inherit;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
/* Same lockup as the login screen, so the pages read as one product. The
   height is the brand's whole layout contract with the topbar: the SVG keeps
   its own aspect ratio, so nothing else needs to know its width. */
.brand img {
  height: 22px;
  display: block;
}

/*
 * Both destinations are always present, with the current one marked — the
 * bar used to show only the page you were *not* on, which reads as a button
 * that moves rather than as navigation.
 */
/* Plain links with room between them, not a segmented control. The pill
   group read as a widget you operate — three buttons in a box, one of them
   pressed — where this is a set of places the product has. Spacing does the
   separating, and the current page is simply the one that is not dimmed. */
.nav {
  display: flex;
  align-items: center;
  gap: 26px;
  margin-left: 8px;
}
.nav a {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  padding: 4px 0;
  transition: color 120ms ease;
}
.nav a:hover {
  color: var(--text);
}
.nav a[aria-current="page"] {
  color: var(--text);
  font-weight: 600;
}

/* The loyalty figure (§4.10). Deliberately quiet: it lives in the same row
   as the connection state and the sign-out control, and a score that shouts
   louder than the feed status would be telling the trader the wrong thing
   about what matters on this screen. */
.points-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  transition: border-color 120ms ease;
  /* The chip's room is kept from the first frame ("◆ 0" is 44px) and the
     chip merely invisible until the figure lands, so the badge beside it
     does not hop when it appears. (display:flex above beats the [hidden]
     default anyway — the documented trap — so [hidden] was never hiding it.)
     The height too: an empty value leaves a shorter line box. */
  min-width: 44px;
  min-height: 25px;
}
.points-chip[hidden] {
  visibility: hidden;
}
.points-chip:hover {
  border-color: var(--accent);
}
.points-chip .mark {
  color: var(--accent);
  font-size: 9px;
}

/* The bell (decision 50): the trader's own news, on every page. Injected by
   notify.js before the whoami block; hidden until the server says who. */
.bell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  transition: border-color 120ms ease, color 120ms ease;
  flex: none;
}
.bell:hover, .bell[aria-expanded="true"] { border-color: var(--accent); color: var(--text); }
.bell[hidden] { display: none; }
.bell .count {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #06211d;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}
.bell .count[hidden] { display: none; }
.bell-panel {
  position: fixed;
  top: 44px;
  right: 12px;
  width: min(360px, calc(100vw - 24px));
  max-height: min(70vh, 520px);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 18px 50px -22px rgba(0, 0, 0, 0.9);
  z-index: 50;
  padding: 6px;
}
.bell-panel[hidden] { display: none; }
.bell-panel .bp-head { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 8px 8px; font-size: 12px; color: var(--muted); }
.bell-panel .bp-empty { padding: 18px 8px 22px; text-align: center; color: var(--muted); font-size: 12px; }
.notif {
  display: flex;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  font-size: 12.5px;
  position: relative;
}
.notif:hover { background: rgba(255, 255, 255, 0.03); }
.notif.fresh::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.notif .n-glyph { flex: none; width: 22px; text-align: center; font-size: 14px; line-height: 1.3; }
.notif .n-glyph.good { color: var(--green); }
.notif .n-glyph.bad { color: var(--red); }
.notif .n-glyph.warn { color: #f0b90b; }
.notif .n-col { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif .n-main { font-weight: 600; }
.notif .n-sub { color: var(--muted); font-size: 11.5px; }
.notif .n-time { color: var(--muted); font-size: 11px; margin-left: auto; flex: none; }

.badge {
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 9px;
}

.spacer {
  flex: 1;
}

/*
 * The documented trap, hit again: `hidden` loses to an author `display:`
 * rule, so without this the demo mode's hidden whoami block still rendered —
 * an empty email and a Sign out button for an ambient login that has nobody
 * to sign out. Any element toggled with `hidden` needs its own opt-out.
 */
.banner a {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.whoami[hidden] {
  display: none;
}
.whoami {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  color: var(--muted);
  /* A long address must not push the connection badge off the bar. */
  min-width: 0;
}
/* The name is a door to the profile page (decision 49). */
.whoami #whoami-email {
  max-width: 22ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}
.whoami #whoami-email:hover,
.whoami #whoami-email[aria-current="page"] {
  color: var(--accent);
}
.whoami button {
  font-size: 11px;
  color: var(--muted);
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease, background-color 120ms ease;
  flex: none;
}
.whoami button:hover {
  color: var(--text);
  border-color: #2b3d43;
  background: rgba(255, 255, 255, 0.03);
}

.conn {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
}
/* Three words, three widths: the widest ("reconnecting", 75px) is reserved
   for the word and the word keeps to the right edge, so "connecting"
   becoming "connected" moves neither the dot beside it nor anything to
   its left. */
#conn-text {
  display: inline-block;
  min-width: 75px;
  text-align: right;
}

.conn .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}
.conn.live .dot {
  background: var(--green);
}
.conn.down .dot {
  background: var(--red);
}

.banner {
  padding: 8px 16px;
  background: var(--red-dim);
  color: var(--red);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

/*
 * A JavaScript failure, made visible. Above the status bar rather than at the
 * top, so it does not shove the whole layout down, but solid enough not to be
 * mistaken for a hint.
 */
.ui-problem {
  padding: 8px 16px;
  background: #7a1d2b;
  color: #fff;
  font-size: 12px;
  border-top: 1px solid var(--line);
}
.ui-problem[hidden] {
  display: none;
}

/*
 * Losing the socket freezes every number on the page, so it cannot be reported
 * as quietly as a degraded feed — that state at least still has live prices.
 * Solid rather than tinted, and it pulses, because the failure it describes is
 * otherwise completely invisible: the page looks entirely normal.
 */
.banner-critical {
  background: var(--red);
  color: #fff;
  font-weight: 500;
  animation: banner-pulse 2s ease-in-out infinite;
}

@keyframes banner-pulse {
  50% {
    opacity: 0.75;
  }
}

@media (prefers-reduced-motion: reduce) {
  .banner-critical {
    animation: none;
  }
}

.stats {
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  overflow-x: auto;
}

/*
 * The strip paints at its final size (owner's report 2026-10-20: the page
 * twitched twice on open). Every placeholder in it is as wide and as tall
 * as what replaces it, so the first frame and the settled frame agree: the
 * ticker select is as wide as a symbol, each market stat as wide as its
 * value with a digit of headroom, the account chip as tall as the Target
 * slot it shows once the progress read lands, and its money stats as wide
 * as a figure. Measured at 1440px (tabular figures, so a width is a digit
 * count); `test/ui/boot-shift.test.mjs` holds the page to it. These are
 * floors, not caps — a wider value still widens its stat.
 */
/*
 * The market picker (decision 89, 2026-11-15). The heading is a button in
 * the select's old clothes — same height, 600 weight (the owner's call of
 * 2026-08-31: a heading, not a shout) — with the leverage cap as a badge
 * and a caret; the native select lives underneath, one pixel square, so
 * it still holds the value for the keyboard, the tests and the handler.
 * The width is a floor for the widest symbol with its badge, so the first
 * frame and the settled frame agree (boot-shift.test.mjs).
 */
.symbol {
  position: relative;
}
.market-native {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.market-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 190px;
  min-height: 34px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px 6px 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  text-align: left;
}
.market-btn:hover,
.market-btn[aria-expanded="true"] {
  border-color: var(--accent);
}
.market-btn .market-caret {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}
.lev-badge {
  display: inline-block;
  min-width: 28px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(80, 210, 193, 0.12);
  border-radius: 4px;
  padding: 2px 6px;
  letter-spacing: 0;
}
.lev-badge:empty {
  visibility: hidden;
}
.market-menu {
  /* Fixed, placed under the heading by markets.js on open: the strip scrolls
     sideways (overflow-x: auto), and an absolutely positioned panel inside
     it is clipped to the strip's height — the first render showed only the
     search box. */
  position: fixed;
  z-index: 40;
  width: min(760px, calc(100vw - 32px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.market-menu[hidden] {
  display: none;
}
.market-search {
  padding: 10px;
  border-bottom: 1px solid var(--line);
}
.market-search input {
  width: 100%;
  box-sizing: border-box;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  font: inherit;
  font-size: 13px;
}
.market-search input:focus {
  outline: none;
  border-color: var(--accent);
}
.market-table-wrap {
  max-height: min(60vh, 520px);
  overflow-y: auto;
}
.market-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.market-table th {
  position: sticky;
  top: 0;
  background: var(--panel);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-transform: none;
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.market-table th.num,
.market-table td.num {
  text-align: right;
}
.market-table th.sorted {
  color: var(--text);
}
.market-table th .sort-arrow {
  margin-left: 4px;
  color: var(--accent);
}
.market-table td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(30, 43, 48, 0.6);
  white-space: nowrap;
}
.market-table tr[data-coin] {
  cursor: pointer;
}
.market-table tr[data-coin]:hover,
.market-table tr.cursor {
  background: rgba(255, 255, 255, 0.035);
}
.market-table tr.sel td.sym .market-sym {
  color: var(--accent);
}
.market-table tr.sel {
  box-shadow: inset 2px 0 0 var(--accent);
}
.market-table td.star {
  width: 28px;
  padding-right: 0;
}
.market-table .fav-btn {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.market-table tr.fav .fav-btn,
.market-table .fav-btn:hover {
  color: var(--accent);
}
.market-table td.sym {
  font-weight: 600;
}
.market-table td.sym .lev-badge {
  margin-left: 8px;
}
.market-table td.pos {
  color: var(--green);
}
.market-table td.neg {
  color: var(--red);
}
.market-table tr.empty td {
  color: var(--muted);
  text-align: center;
  padding: 18px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  white-space: nowrap;
}

.stat label {
  font-size: 11px;
  color: var(--muted);
}

/* display:flex above beats the [hidden] default (the documented trap): a
   funded account's empty Target slot painted as "—" until this rule. */
.stat[hidden] {
  display: none;
}

.stat span {
  font-variant-numeric: tabular-nums;
}
/* The market stats' floors: a six-figure price, a change with its percent,
   a volume, an open interest, a carry rate — each one digit wider than the
   figure on screen when this was measured. */
.stat-mark,
.stat-oracle {
  min-width: 66px;
}
.stat-change {
  min-width: 118px;
}
.stat-volume {
  min-width: 64px;
}
.stat-oi {
  min-width: 72px;
}
.stat-carry {
  min-width: 60px;
}

/* Equity and Balance are the trader's money among the market's facts — a
   different category, so a different shape rather than a different colour.
   Colour is spoken for on this screen: green and red mean PnL, the accent
   means "act here". A quiet chip separates them without shouting. */
.account-chip {
  display: flex;
  gap: 22px;
  margin-left: auto;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  /* As tall as it is with the Target slot (label, figure, the mini bar:
     47px inside this padding and border, 61px in all) from the first frame.
     The slot is hidden until the progress read answers, and the chip
     growing 10px when it appeared pushed the whole workspace down. */
  min-height: 61px;
}
.account-chip .stat {
  /* A dollar figure's width, so "—" and "$10.00K" take the same room. */
  min-width: 56px;
}
.account-chip .stat span {
  font-weight: 600;
}
/* The strip's live target read: same green as the Progress tab's fill, a
   size down. The bar is a preview of that tab, not a third dialect. */
/* Decision 47: the funded phase's strip slot — the payout in the target's
   place. The pill is the one accent on the strip: it is the one action. */
.payout-row { display: flex; align-items: center; gap: 10px; }
.payout-pill {
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: rgba(80, 210, 193, 0.1);
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
  /* One width for every label it carries ("Request payout", "Close
     positions first", "Under review"), so the chip's edge does not move
     when a position opens or closes. */
  min-width: 136px;
  text-align: center;
}
.payout-pill:hover { background: rgba(80, 210, 193, 0.2); }
.payout-pill:disabled { border-color: var(--line); background: none; color: var(--muted); cursor: not-allowed; }
.payout-pill[hidden] { display: none; }

.payout-dialog {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  width: min(440px, 92vw);
}
.payout-dialog::backdrop { background: rgba(0, 0, 0, 0.62); }
.payout-dialog h3 { margin: 0 0 6px; font-size: 15px; }
.payout-dialog .payout-meta { color: var(--muted); font-size: 12px; margin: 0 0 12px; }
.payout-dialog label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 6px; }
.payout-amount-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
}
.payout-amount-row:focus-within { border-color: var(--accent); }
.payout-cur { color: var(--muted); }
.payout-amount-row input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  padding: 9px 0;
  outline: none;
}
.payout-max {
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.payout-max:hover { color: var(--accent); border-color: var(--accent); }
.payout-split { display: grid; gap: 6px; margin: 12px 0; font-size: 13px; }
.payout-split > div { display: flex; justify-content: space-between; }
.payout-split span { color: var(--muted); }
.payout-split b { color: var(--text); font-variant-numeric: tabular-nums; }
.payout-consequences { font-size: 12px; color: var(--muted); line-height: 1.45; margin: 0; }
.payout-error { color: var(--red); font-size: 12.5px; margin-top: 10px; }
.payout-error[hidden] { display: none; }
.payout-dialog .dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.payout-dialog .dialog-actions button {
  border-radius: 8px;
  border: 1px solid var(--line);
  background: none;
  color: var(--text);
  padding: 7px 14px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.payout-dialog .dialog-actions button.primary { border-color: var(--accent); background: rgba(80, 210, 193, 0.12); color: var(--accent); font-weight: 600; }
.payout-dialog .dialog-actions button.danger { border-color: var(--red); background: rgba(212, 87, 107, 0.12); color: var(--red); font-weight: 600; }
.payout-dialog .dialog-actions button:disabled { opacity: 0.6; cursor: not-allowed; }

/* A payout under review: the account is on hold by the trader's own request — not a fault. */
.banner-hold {
  background: rgba(80, 210, 193, 0.1);
  color: var(--accent);
}
/* §4.12: a competition stake's banner — the competition, its clock, your standing. Information, not a fault. */
.banner-stake {
  background: rgba(227, 179, 65, 0.1);
  color: #e3b341;
}
.banner-stake a, .banner-hold a { color: inherit; margin-left: 6px; }

.target-mini { width: 96px; height: 4px; background: #1e2530; border-radius: 2px; overflow: hidden; margin-top: 4px; }
.target-mini-fill { height: 100%; width: 0%; background: #2ebd85; border-radius: 2px; transition: width 0.4s ease; }

/*
 * The order ticket runs the full height of the window, and the tables below
 * stop short of it.
 *
 * It used to sit inside the chart row, with the Positions panel cutting across
 * underneath — which left the ticket about 200px shorter than its own content
 * on a laptop screen, so it scrolled internally and the size field was clipped
 * out of view. A trader should never have to scroll to reach the button that
 * places the order.
 */
.workspace {
  --rail-w: 300px;
  flex: 1;
  display: grid;
  grid-template-columns: var(--rail-w) 1fr 300px;
  grid-template-rows: 1fr auto;
  grid-template-areas:
    "rail charts ticket"
    "rail tables ticket";
  gap: 1px;
  background: var(--line);
  min-height: 0;
}

.grid {
  grid-area: charts;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  background: var(--line);
  min-height: 0;
}

.panel {
  background: var(--panel);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

/* The interval strip is as tall as its buttons (29px) before they render —
   the market list brings them — so the chart's head, and the chart under
   it, do not drop 2px on open. */
.intervals {
  min-height: 29px;
}

.intervals button,
.tab {
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 5px 10px;
  border-radius: 5px;
  cursor: pointer;
  font: inherit;
}

.intervals button:hover,
.tab:hover {
  color: var(--text);
}

.intervals button.active {
  background: var(--panel-2);
  color: var(--accent);
}

.tab.active {
  color: var(--text);
  border-bottom: 2px solid var(--accent);
  border-radius: 0;
}

.chart {
  flex: 1;
  min-height: 0;
  /* The trader marks layer is positioned against the chart box. */
  position: relative;
}

/* Decision 51: the trader marks — lettered circles over the chart. */
.marks-toggle {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 4px 10px;
  border-radius: 5px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}
.marks-toggle:hover {
  color: var(--text);
}
.marks-toggle.active {
  color: var(--accent);
  border-color: var(--accent);
}
.marks-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  /* The chart underneath keeps its pan and crosshair; only the circles catch the pointer. */
  pointer-events: none;
  z-index: 3;
}
.marks-layer .mark {
  position: absolute;
  left: -10px;
  top: -10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #0b1114;
  text-decoration: none;
  pointer-events: auto;
  cursor: pointer;
  border: 2px solid var(--green);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  will-change: transform;
}
/* Every rule here is scoped to the layer: the points chip's diamond in the
   top nav also carries class "mark", and an unscoped .mark turned it into a
   circle at the page's origin (seen live 2026-09-23).
   display:flex above would otherwise beat the [hidden] default, and a
   folded mark (past the stack's four) would sit unpositioned at the
   chart's origin — seen live 2026-09-23 as half a circle in the corner. */
.marks-layer .mark[hidden] {
  display: none;
}
.marks-layer .mark.side-sell {
  border-color: var(--red);
}
.marks-layer .mark.you {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  z-index: 1;
}
.marks-layer .mark:hover {
  z-index: 2;
  transform-origin: center;
  filter: brightness(1.15);
}
.marks-layer .mark-card {
  position: absolute;
  left: 0;
  top: 0;
  /* Anchored by its right edge and vertical centre; `transform` then carries it beside the circle. */
  translate: -100% -50%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 9px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--text);
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  z-index: 4;
}
.marks-layer .mark-card .mc-who {
  font-weight: 700;
}
.marks-layer .mark-card .mc-when {
  color: var(--muted);
  font-size: 11px;
}
.marks-layer .mark-more {
  width: auto;
  min-width: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--muted);
  border-color: var(--line);
  font-weight: 600;
}

/*
 * Both of these need min-width: 0, and for the same reason the tables did.
 *
 * A grid item defaults to min-width: auto, which resolves to its min-content
 * width. The chart's canvas carries an intrinsic width from whatever size the
 * library last drew it at, so without this the chart panel refuses to shrink,
 * `.grid` inherits that floor, and the whole workspace stops fitting: the page
 * was measured stuck at 1139px wide and scrolling sideways at every viewport
 * between 1101px and 1439px — 1366x768 and 1280x800 among them. The chart is
 * `autoSize`, so once the container is allowed to shrink the canvas follows.
 */
.grid,
.chart-panel {
  min-width: 0;
}

.tab-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* display:flex above would otherwise beat the [hidden] default and show both
   tabs stacked. */
.tab-body[hidden] {
  display: none;
}

/* The left rail (owner's call 2026-09-14): the leaderboard beside the
   chart, collapsible to a 44px icon strip. The collapsed state is a class
   on the workspace so the grid column and the rail's two faces switch
   together; the browser remembers the choice per viewer. */
.rail {
  grid-area: rail;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
.rail-head {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 4px 6px 0;
}
.rail-tab {
  flex: 1;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  padding: 8px 0 7px;
  cursor: pointer;
}
.rail-tab.active {
  color: var(--text);
  font-weight: 600;
  border-bottom-color: var(--accent);
}
.rail-chevron {
  background: none;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 16px;
  padding: 4px 8px;
  cursor: pointer;
}
.rail-chevron:hover,
.rail-icon:hover {
  color: var(--text);
}
.rail-mini {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-top: 6px;
}
.rail-icon {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
}
/* The emoji dims when its tab is not the open one; the unread dot beside
   it must not — a filter on the button would grey the dot too. */
.rail-icon .glyph {
  filter: grayscale(1) opacity(0.7);
}
.rail-icon.active .glyph {
  filter: none;
}
.rail-body {
  overflow-y: auto;
  min-height: 0;
  flex: 1;
}
.rail-you[hidden] {
  display: none;
}
.rail-you {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.rail-lbl {
  font-size: 11px;
  color: var(--muted);
}
.rail-rank {
  font-size: 18px;
  font-weight: 700;
}
.rail-pnl {
  font-size: 15px;
  font-weight: 600;
  text-align: right;
}
.rail-row {
  display: grid;
  grid-template-columns: 26px 1fr auto 18px;
  gap: 8px;
  align-items: center;
  padding: 9px 14px;
  border-bottom: 1px solid rgba(30, 43, 48, 0.6);
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
}
.rail-row:hover {
  background: var(--panel-2);
}
.rail-row .rk {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
/* The podium, the board page's own colours. */
.rail-row .rk.p1 { color: #f0b90b; font-weight: 700; }
.rail-row .rk.p2 { color: #c8d1dc; font-weight: 700; }
.rail-row .rk.p3 { color: #b0793f; font-weight: 700; }
.rail-row .hd {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  /* The overflow clip is one text line tall; a trader's picture (16px plus
     its ring) is taller than the line and lost its top and bottom (seen
     live 2026-11-04). Two pixels of padding, taken back by the margin so
     the row keeps its height, give the clip box the room. */
  padding: 2px 0;
  margin: -2px 0;
}
.rail-row .hd .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
}
.rail-row .hd .size {
  color: var(--muted);
  font-size: 11px;
}
.rail-row .v {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
/* PnL in the product's own dialect (owner's call 2026-09-14, option B of
   three rendered): green up, red down — the accounts page, the strip and
   the daily table already speak it, and a glance surface needs the sign
   to be visible without reading the digit. The approved mock had these;
   the first build lost them. */
.rail-row .v.pos,
.rail-pnl.pos {
  color: var(--green);
}
.rail-row .v.neg,
.rail-pnl.neg {
  color: var(--red);
}
.rail-foot {
  padding: 10px 14px;
  font-size: 12px;
}
.rail-foot a {
  color: var(--accent);
  text-decoration: none;
}
/* §4.12: on a stake the rail shows the competition's board — the viewer's
   row lit, busted entries greyed, and the viewer pinned below a cut when
   they sit outside the top ten (owner's call 2026-10-24). */
.rail-row.you { background: rgba(80, 210, 193, 0.06); }
.rail-row.bust { opacity: 0.6; }
.rail-sep {
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  padding: 2px 0;
}
.dot-bronze { background: #b0793f; }
.dot-silver { background: #c8d1dc; }
.dot-gold { background: #f0b90b; }
.dot-platinum { background: #9fd8cb; }
.dot-diamond { background: #7cc3ff; }
.dot-elite { background: var(--accent); }
/* A profile picture (owner's call 2026-11-03): a round image where a row
   shows the trader. In a dot's place it is a little bigger than the dot so
   a face reads, and the badge colour becomes its ring; before a handle on
   a board it has no ring. */
.pic {
  border-radius: 50%;
  object-fit: cover;
  flex: none;
  vertical-align: middle;
  background: #0b1114;
}
.rail-row .hd .dot.pic,
.fi-who .dot.pic,
.top-who .dot.pic,
.dot.pic {
  width: 16px;
  height: 16px;
}
.dot.pic.dot-bronze { box-shadow: 0 0 0 1.5px #b0793f; }
.dot.pic.dot-silver { box-shadow: 0 0 0 1.5px #c8d1dc; }
.dot.pic.dot-gold { box-shadow: 0 0 0 1.5px #f0b90b; }
.dot.pic.dot-platinum { box-shadow: 0 0 0 1.5px #9fd8cb; }
.dot.pic.dot-diamond { box-shadow: 0 0 0 1.5px #7cc3ff; }
.dot.pic.dot-elite { box-shadow: 0 0 0 1.5px var(--accent); }
/* The badge ring is a picture's; the brand placeholder stands alone (seen
   in the render 2026-11-04: a dark ring where the mark should be, the
   dot rule's background over the brand colour). */
.dot.pic.brand { box-shadow: none; }
.handle .pic {
  width: 22px;
  height: 22px;
  margin-right: 7px;
}
.pic.pic-lg {
  width: 56px;
  height: 56px;
  align-self: center;
}
.pic.pic-md {
  width: 40px;
  height: 40px;
}
.marks-layer .mark img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  pointer-events: none;
}
/* No picture (owner's call 2026-11-04): the Rally mark, dark, centred on
   the brand colour — one look for everyone without one, where a row or
   circle shows a trader. The mark is the SVG as a mask, so its colour is
   this stylesheet's and the placeholder stays one element. */
.pic.brand {
  position: relative;
  display: inline-block;
  background: var(--accent);
  overflow: hidden;
}
.pic.brand::after,
.marks-layer .mark.brand::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #0b1114;
  -webkit-mask: url(/rally-mark.svg) center / 64% 64% no-repeat;
  mask: url(/rally-mark.svg) center / 64% 64% no-repeat;
}
.marks-layer .mark.brand {
  background: var(--accent);
}

/* The Alerts tab (decision 46, part two). */
.rail-count {
  font-size: 10px;
  background: var(--red-dim);
  color: var(--red);
  border-radius: 999px;
  padding: 1px 6px;
  margin-left: 4px;
}
.rail-count[hidden] {
  display: none;
}
.rail-icon {
  position: relative;
}
.rail-dot {
  position: absolute;
  top: -2px;
  right: -4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
}
.rail-dot[hidden] {
  display: none;
}
.rail-body[hidden] {
  display: none;
}
/* Feed cards (option B, 2026-09-14): glyph column, asset + side tag as the
   headline, the close's number leading in its colour, relative time, an
   accent edge on what is newer than the viewer's last look. */
.feed-item {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(30, 43, 48, 0.6);
  color: var(--text);
  text-decoration: none;
  position: relative;
}
.feed-item:hover {
  background: var(--panel-2);
}
.feed-item.fresh::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
}
.feed-item.passed {
  background: linear-gradient(90deg, rgba(80, 210, 193, 0.08), transparent);
}
.feed-item.arrived {
  animation: feed-in 400ms ease-out;
}
@keyframes feed-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .feed-item.arrived {
    animation: none;
  }
}
.fi-glyph {
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  color: var(--muted);
}
.fi-glyph.long {
  color: var(--green);
}
.fi-glyph.short {
  color: var(--red);
}
.fi-glyph.pass {
  font-size: 13px;
}
.fi-col {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.fi-head {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
}
.fi-who {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text);
  font-weight: 600;
}
.fi-who .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.fi-body {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.fi-main {
  font-size: 13px;
  font-weight: 600;
}
.fi-sub {
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.fi-lev {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}
.side {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 700;
}
.side.long {
  background: var(--green-dim);
  color: var(--green);
}
.side.short {
  background: var(--red-dim);
  color: var(--red);
}
.fi-pnl {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 13px;
}
.fi-pnl.pos {
  color: var(--green);
}
.fi-pnl.neg {
  color: var(--red);
}
.fi-ret {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.85;
}
.empty-state a {
  color: var(--accent);
  text-decoration: none;
}
/* The rail row's follow toggle: a tiny mark, accent when on. */
.rail-row {
  grid-template-columns: 26px 1fr auto 18px;
}
.rail-follow {
  background: none;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  text-align: center;
}
.rail-follow:hover,
.rail-follow.on {
  color: var(--accent);
}

/* The fold is a class on <html>: set before the first paint by the page's
   head script from the browser's memory, toggled by rail.js after. */
html.rail-collapsed .workspace {
  --rail-w: 44px;
}
html.rail-collapsed .rail-head,
html.rail-collapsed .rail-body {
  display: none;
}
html.rail-collapsed .rail-mini {
  display: flex;
}

.statusbar {
  display: flex;
  /* One child now that the simulated-trading label is gone; the tick stays
     where it has always been rather than sliding to the left edge. */
  justify-content: flex-end;
  padding: 6px 16px;
  border-top: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 11px;
}

/* --- order entry panel --------------------------------------------------- */

.order-panel {
  grid-area: ticket;
  min-width: 0;
}

.order-type-tabs {
  gap: 2px;
}
.order-type-tabs .tab {
  flex: 1;
  text-align: center;
}

.side-toggle {
  display: flex;
  gap: 2px;
  padding: 10px;
}

/* Leverage sits above the side toggle (owner's call 2026-09-12) — outside
   the form, so it carries the form's side padding itself. */
.leverage-field {
  padding: 10px 10px 0;
}

/* The chosen multiple sits centered in the bar (owner's call 2026-09-12).
   text-align alone doesn't move a closed select's value in Chrome —
   text-align-last is the property that does. */
.leverage-field select {
  text-align: center;
  text-align-last: center;
}

.side-btn {
  flex: 1;
  padding: 9px 0;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
}

.side-btn:hover {
  color: var(--text);
}

.side-btn.buy.active {
  background: var(--green);
  border-color: var(--green);
  color: #05130e;
}

.side-btn.sell.active {
  background: var(--red);
  border-color: var(--red);
  color: #200608;
}

.order-form {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  /* Content stays top-aligned and the spare height falls below the button.
     Pinning the button to the bottom instead opened a 500px void between the
     inputs and the summary on a tall window, which reads as a broken layout
     rather than a deliberate one. */
  justify-content: flex-start;
  gap: 12px;
  padding: 0 10px 12px;
  /* Only bites on a genuinely tiny window now that the ticket owns the full
     column height — the layout is meant to fit, not to scroll. Sideways is
     never right here: the ticket is a fixed-width column, so anything too wide
     is a layout bug to fix rather than something to let the trader scroll to.
     (`overflow-y: auto` alone would compute overflow-x to `auto` as well.) */
  overflow-y: auto;
  overflow-x: hidden;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  /* Grid and flex children default to min-width: auto, which is min-content —
     so a label that cannot wrap sets a floor the column has to honour, and the
     ticket is pushed wider than its own panel. Two 192px labels in a 280px box
     is exactly how the TP/SL row grew a sideways scrollbar. */
  min-width: 0;
}

/* Same fix as .tab-body[hidden]: an author display:flex rule ties in
   specificity with the UA's [hidden]{display:none} and, on a tie, the later
   (author) rule wins — silently un-hiding the element. */
.field[hidden] {
  display: none;
}

/* The Mid chip lives inside the price field's right edge (owner's round
   2026-09-12): one press brings the price back to the market. */
.input-with-chip { position: relative; display: flex; }
.input-with-chip input { flex: 1; padding-right: 44px; }
.mid-chip {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  cursor: pointer;
}
.mid-chip:hover { color: var(--text); border-color: var(--accent); }

.field label {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
}

.field .unit {
  color: var(--muted);
  font-weight: 500;
}

.field input,
.field select {
  min-width: 0;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
  font-variant-numeric: tabular-nums;
}

.field input:focus-visible,
.field select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

/* The unit selector sits inside the size field, so "how much" and "in what"
   read as one control rather than two. */
.input-with-unit {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-unit input {
  flex: 1;
  min-width: 0;
  padding-right: 78px;
}

.input-with-unit select {
  position: absolute;
  right: 4px;
  background: transparent;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  padding: 4px 2px;
  cursor: pointer;
}

.input-with-unit select:focus-visible {
  outline: 2px solid var(--accent);
  border-radius: 4px;
}

.size-slider-field {
  gap: 6px;
  padding: 2px 2px 0;
}

/* Percentage of the largest position the account can currently open. The
   filled portion is driven by --pct from JS: a bare track gives no sense of
   how much of the account a size represents, which is the whole point. */
.size-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 18px;
  background: transparent;
  cursor: pointer;
}

.size-slider::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--accent) 0%,
    var(--accent) var(--pct, 0%),
    var(--panel-2) var(--pct, 0%),
    var(--panel-2) 100%
  );
}

.size-slider::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: var(--panel-2);
}
.size-slider::-moz-range-progress {
  height: 4px;
  border-radius: 999px;
  background: var(--accent);
}

.size-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--panel);
  border: 2px solid var(--accent);
}

.size-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--panel);
  border: 2px solid var(--accent);
}

.size-slider:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.slider-scale {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
}

.tpsl-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
/* The standing trap: an author display rule beats the hidden attribute. */
.tpsl-row[hidden] { display: none; }

/* TP/SL folds away behind a switch (owner's call 2026-09-12): most orders
   ship without exits, and two empty inputs were permanent ticket noise. */
.tpsl-toggle-row { display: flex; align-items: center; gap: 10px; }
.tpsl-toggle-label { font-size: 12px; color: var(--muted); }
.switch {
  width: 34px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  cursor: pointer;
  padding: 0 2px;
  display: flex;
  align-items: center;
}
.switch .knob {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #5c6a80;
  transition: transform 0.15s ease, background 0.15s ease;
}
.switch[aria-checked="true"] { background: var(--green-dim); border-color: transparent; }
.switch[aria-checked="true"] .knob { transform: translateX(15px); background: var(--green); }

.tpsl-cell {
  display: flex;
  gap: 4px;
  align-items: center;
}

.tpsl-cell input {
  width: 74px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 4px;
  padding: 3px 5px;
  font: inherit;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.tp-val {
  color: var(--green);
}
.sl-val {
  color: var(--red);
}

.order-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.row-kv {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

.row-kv span:last-child {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* A summary figure the account cannot cover — flagged where it is read, so
   the problem is visible before the button is pressed. */
.row-kv span.value-bad {
  color: var(--red);
}

.place-order-btn {
  padding: 11px 0;
  border: 0;
  border-radius: 6px;
  background: var(--green);
  color: #05130e;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.place-order-btn:hover {
  filter: brightness(1.08);
}

.place-order-btn:disabled {
  background: var(--panel-2);
  color: var(--muted);
  cursor: not-allowed;
}

.place-order-btn.sell-mode {
  background: var(--red);
  color: #200608;
}

.order-error {
  font-size: 12px;
  color: var(--red);
  background: var(--red-dim);
  border-radius: 6px;
  padding: 7px 9px;
}
/* A confirmation in the same slot (a payout request landed) — not a refusal, so not red. */
.order-error.notice {
  color: var(--accent);
  background: rgba(80, 210, 193, 0.1);
}

/* --- bottom panel: positions / open orders -------------------------------- */

.bottom-panel {
  grid-area: tables;
  /* Without this the grid column takes its width from the widest table — the
     11-column trade history, whose cells do not wrap — and the whole workspace
     grows past the window. The table scrolls inside its own panel instead,
     which is the right place for it: a statement legitimately has more columns
     than a narrow screen has room for. */
  min-width: 0;
  height: 220px;
  border-top: 1px solid var(--line);
}

.count {
  color: var(--muted);
  font-size: 11px;
}
/* A tab's count takes a digit's room whether or not it has one, so the
   first account snapshot ("Positions 1") does not nudge the tabs beside
   it (the boot twitch, 2026-10-20). */
.bottom-panel .tab .count {
  display: inline-block;
  min-width: 10px;
  text-align: left;
}

/* Close all (owner's call 2026-10-20): at the right end of the tab strip,
   only on the Positions tab and only with something to close. Red on
   hover — the one button on the strip that moves money. Appearing at the
   end of a left-aligned strip moves nothing beside it. */
.close-all {
  margin-left: auto;
  flex: none;
  align-self: center;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 3px 10px;
  border-radius: 5px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}
.close-all:hover {
  border-color: var(--red);
  color: var(--red);
}
.close-all:disabled {
  opacity: 0.6;
  cursor: wait;
}
.close-all[hidden] {
  display: none;
}

.bottom-tab-body {
  flex: 1;
  overflow: auto;
  min-height: 0;
}
.bottom-tab-body[hidden] {
  display: none;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th {
  position: sticky;
  top: 0;
  background: var(--panel);
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  font-size: 11px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}

.data-table td {
  padding: 7px 12px;
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.data-table td.side-buy {
  color: var(--green);
}
.data-table td.side-sell {
  color: var(--red);
}
.data-table td.pnl-pos {
  color: var(--green);
}
.data-table td.pnl-neg {
  color: var(--red);
}

/* Decision 52: the Top positions tab. */
.top-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.top-note {
  flex: 1;
}
.top-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--text);
  white-space: nowrap;
}
.top-filter input {
  accent-color: var(--accent);
}
.top-table td.rank {
  color: var(--muted);
  width: 32px;
}
.top-table .sub {
  display: block;
  color: var(--muted);
  font-size: 11px;
}
.top-table td.pnl-pos .sub,
.top-table td.pnl-neg .sub {
  color: inherit;
  opacity: 0.75;
}
.top-who {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}
.top-who:hover {
  color: var(--accent);
}
.top-who .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}
.top-who .you-tag {
  color: var(--accent);
  font-size: 11px;
  font-weight: 500;
}
.top-follow {
  color: var(--accent);
  font-size: 11px;
}
.top-table tr.top-you td {
  background: rgba(80, 210, 193, 0.06);
}

/* Money and quantity columns read as a column of figures, so right-align them
   — the eye compares magnitudes down the edge, not across a ragged one. */
.data-table th.num,
.data-table td.num {
  text-align: right;
}

/* The fill id is a reference to quote when querying a trade, not something to
   read. Present but visually quiet, and the one cell allowed to be selected
   without dragging the row's width around. */
.history-table td.trade-id,
.fills-table td.trade-id {
  color: var(--muted);
  font-size: 11px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: all;
}

/* Order status reads as a state, not a value, so it gets a pill rather than a
   colour on plain text — and the eye can scan a column of them. */
.status-pill {
  font-size: 10px;
  letter-spacing: 0.02em;
}
.status-pill::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  background: currentColor;
}
.data-table td.status-filled {
  color: var(--green);
}
.data-table td.status-partially-filled {
  color: var(--accent);
}
.data-table td.status-open,
.data-table td.status-pending {
  color: var(--text);
}
.data-table td.status-cancelled {
  color: var(--muted);
}

/* The disclosure column: narrow, and the same width whether or not the trade
   has anything to open, so the rows below it stay in line. */
.expand-col {
  width: 26px;
  padding-right: 0 !important;
}

/* One glyph that turns, rather than two swapped in JS — the rotation is what
   reads as "this opened" without the row having to move first. */
.expand-btn {
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 9px;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 3px;
  transition: transform 160ms ease, color 120ms ease, background 120ms ease;
}
.expand-btn::before {
  content: "\25B6";
}
.expand-btn:hover {
  color: var(--text);
  background: var(--panel-2);
}
.expand-btn[aria-expanded="true"] {
  color: var(--accent);
  transform: rotate(90deg);
}
.expand-btn[hidden] {
  display: none;
}

/* An open trade keeps a mark on it, so the detail below is visibly attached to
   a row rather than floating between two of them. */
.history-table tr.expanded > td {
  background: var(--panel-2);
  border-bottom-color: transparent;
}

/* The fills of one trade. A table row cannot be height-animated, but a grid
   collapsing between 0fr and 1fr can, and it needs no measured height —
   which matters because the number of fills is not known in advance. */
.trade-detail > td {
  padding: 0;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
}

.detail-wrap {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 180ms ease;
}
.trade-detail.open .detail-wrap {
  grid-template-rows: 1fr;
}
.detail-inner {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .detail-wrap,
  .expand-btn {
    transition: none;
  }
}

/* Inset and accented: this is the supporting detail for the row above, not a
   second statement competing with it. */
.fills-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  margin: 2px 12px 8px 26px;
  width: calc(100% - 38px);
  border-left: 2px solid var(--accent);
  background: var(--panel);
  border-radius: 0 4px 4px 0;
}
.fills-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
  /* The statement's own headers are sticky; these must not join them. */
  position: static;
  background: none;
}
.fills-table td {
  padding: 5px 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--text);
  border-bottom: 1px solid rgba(30, 43, 48, 0.5);
}
.fills-table tr:last-child td {
  border-bottom: 0;
}
.fills-table tbody tr:hover td {
  background: var(--panel-2);
}
.fills-table th.num,
.fills-table td.num {
  text-align: right;
}
.fills-table td.pnl-pos {
  color: var(--green);
}
.fills-table td.pnl-neg {
  color: var(--red);
}
/* Open and close read at a glance, the same way the statement's side does. */
.fills-table td.fill-open {
  color: var(--accent);
}
.fills-table td.fill-close {
  color: var(--muted);
}
.fills-table td.fill-liq {
  color: var(--red);
}

.close-btn {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 5px;
  padding: 4px 10px;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}
.close-btn:hover {
  border-color: var(--red);
  color: var(--red);
}

.empty-state {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

/* Narrow enough that a 300px column beside the chart is not worth it: the
   ticket drops back under the workspace and spans its width. */
@media (max-width: 1100px) {
  .workspace {
    overflow-y: auto;
    grid-template-columns: 1fr;
    /* max-content, not auto: with a fixed chart row and a fixed table row the
       free space is negative, and an auto row is allowed to shrink below its
       content. The workspace scrolls instead. */
    grid-template-rows: 55vh max-content 220px;
    grid-template-areas:
      "charts"
      "ticket"
      "tables";
  }
  /* No room for a rail beside a stacked chart; the leaderboard page is a tap away. */
  .rail {
    display: none;
  }
  /* Stacked, the ticket sits in an auto-height row: `flex: 1` there resolves
     against nothing and collapses the form to zero. It takes its natural
     height instead, and the workspace scrolls as a whole. */
  .order-form {
    flex: 0 0 auto;
    overflow-y: visible;
  }
  /* .panel sets min-height: 0 so panels can shrink inside the side-by-side
     layout. Stacked, the rows overflow the workspace and that permission lets
     the ticket collapse to a 4px sliver — it keeps its content height here. */
  .order-panel {
    min-height: min-content;
  }
}

@media (max-width: 700px) {
  .grid {
    grid-template-columns: 1fr;
    /* One row: the chart panel fills the charts area. The old second row
       was the order book's, long gone from the page, and it left a dark
       band under the chart on phones. */
    grid-template-rows: 1fr;
  }
}

/* TP/SL save feedback, next to the row it belongs to — a stop a trader
   believes is set but isn't is the most expensive lie this UI can tell. */
.tpsl-note {
  font-size: 11px;
  margin-left: 6px;
  white-space: nowrap;
}
.tpsl-note.note-ok { color: var(--green, #0ecb81); }
.tpsl-note.note-bad { color: var(--red, #f6465d); }

/* A market order inside the latency window: being priced, not resting. Shown
   near the order form rather than in Open Orders, which is for resting orders. */
.order-pricing {
  font-size: 11px;
  color: var(--muted, #8b949e);
  margin-top: 6px;
}
.order-pricing[hidden] { display: none; }

/* --- progress tab (§4.4, M2) --- */
.progress-wrap { display: flex; flex-direction: column; gap: 12px; padding: 10px 12px; }
.progress-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.objective { background: #10141b; border: 1px solid #1e2530; border-radius: 8px; padding: 10px 12px; }
.objective-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.objective-name { font-weight: 600; font-size: 12px; color: #c9d4e3; }
.objective-state { font-size: 11px; padding: 1px 8px; border-radius: 9px; background: #1e2530; color: #8b98ab; }
.objective-state.state-ok { background: rgba(46, 189, 133, 0.15); color: #2ebd85; }
.objective-state.state-pending { background: #1e2530; color: #8b98ab; }
.objective-headline {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  margin: 2px 0;
}
/* The rule's bound, inside the headline — quieter than the trader's own number. */
.objective-headline .of {
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
}
.objective-fill.risk { background: #f0b90b; }
.objective-detail { font-size: 11.5px; color: #8b98ab; line-height: 1.45; }
.objective-bar { height: 6px; background: #1e2530; border-radius: 3px; overflow: hidden; margin-bottom: 6px; }
.objective-fill { height: 100%; width: 0%; background: #2ebd85; border-radius: 3px; transition: width 0.4s ease; }
.claim-btn { width: 100%; margin: 4px 0 8px; padding: 8px 0; border: 0; border-radius: 6px; font-weight: 600; cursor: pointer; background: #2ebd85; color: #0b0e13; }
.claim-btn:disabled { background: #1e2530; color: #5c6a80; cursor: not-allowed; }
.progress-banner { padding: 10px 14px; border-radius: 8px; font-weight: 600; }
.progress-banner.sealed-passed { background: rgba(46, 189, 133, 0.12); color: #2ebd85; border: 1px solid rgba(46, 189, 133, 0.4); }
.progress-banner.sealed-failed { background: rgba(246, 70, 93, 0.12); color: #f6465d; border: 1px solid rgba(246, 70, 93, 0.4); }
.banner-passed { background: rgba(46, 189, 133, 0.15); color: #2ebd85; }
/* A fresh signup with no challenge yet: a welcome, not an alarm. No pulse. */
.banner-welcome { background: rgba(46, 189, 133, 0.15); color: #2ebd85; }
.progress-banner.welcome { background: rgba(46, 189, 133, 0.12); color: #2ebd85; border: 1px solid rgba(46, 189, 133, 0.4); }
#daily-pnl-table { max-width: 420px; }
#daily-pnl-table td.pos { color: #2ebd85; }
#daily-pnl-table td.neg { color: #f6465d; }
.stat span.warn { color: #f0b90b; }

/* --- phones (the owner's phone layout pass, 2026-10-16) -------------------
   Below 760px the shared top bar wraps: the brand and the account controls
   on the first row, the nav on its own row underneath. The connection text
   and the feed badge give way to their dots; the name truncates. The
   trading page's stats strip wraps too, with the account chip first — the
   trader's own numbers, not the market's, lead on a small screen — and the
   bottom panel's tab strip scrolls sideways instead of widening the page.
   Measured, not guessed: every page must keep document.scrollWidth at the
   viewport (test/ui/phone.test.mjs). */
@media (max-width: 760px) {
  .topbar {
    flex-wrap: wrap;
    gap: 8px 10px;
    padding: 8px 12px;
  }
  .topbar .nav {
    order: 10;
    flex: 1 1 100%;
    margin-left: 0;
    gap: 0;
    justify-content: space-between;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .topbar .nav::-webkit-scrollbar {
    display: none;
  }
  .topbar .nav a {
    white-space: nowrap;
    padding: 4px 2px;
    /* Six destinations once Competitions is on (§4.12): a notch smaller so
       the row still fits a 390px phone without scrolling. */
    font-size: 11.5px;
    padding: 4px 1px;
  }
  .topbar .badge {
    display: none;
  }
  .topbar .conn #conn-text {
    display: none;
  }
  .topbar .whoami {
    gap: 6px;
  }
  .topbar .whoami #whoami-email {
    max-width: 96px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .stats {
    flex-wrap: wrap;
    gap: 10px 18px;
    padding: 10px 12px;
    overflow-x: visible;
  }
  /* The picker on a phone: pinned under the strip, the width of the screen, the two money columns dropped. */
  .market-menu {
    position: fixed;
    left: 8px;
    right: 8px;
    top: 96px;
    width: auto;
  }
  .market-table th:nth-child(5),
  .market-table td:nth-child(5),
  .market-table th:nth-child(6),
  .market-table td:nth-child(6),
  .market-table .diff {
    display: none;
  }
  .market-table th,
  .market-table td {
    padding: 8px 8px;
    font-size: 12px;
  }
  .stats .account-chip {
    order: -1;
    flex: 1 1 100%;
    justify-content: space-between;
  }
  .panel-head.tabs {
    overflow-x: auto;
    scrollbar-width: none;
    flex-wrap: nowrap;
  }
  .panel-head.tabs::-webkit-scrollbar {
    display: none;
  }
  .panel-head.tabs .tab {
    flex: none;
    white-space: nowrap;
  }
}

/* The wallet picker (wallets.js): one modal for every page — each wallet the browser announced, its icon, a "detected" dot. */
.wallet-dialog { background: var(--panel, #0f1419); color: var(--text); border: 1px solid var(--line); border-radius: 16px; padding: 18px 18px 12px; width: min(420px, calc(100vw - 32px)); }
.wallet-dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.wallet-dialog .wtitle { font-weight: 700; font-size: 15px; margin-bottom: 12px; }
.wallet-dialog .wrow { display: flex; align-items: center; gap: 14px; width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; margin-bottom: 10px; color: var(--text); font: inherit; font-size: 16px; cursor: pointer; text-align: left; }
.wallet-dialog .wrow:hover { border-color: var(--accent); }
.wallet-dialog .wicon-wrap { position: relative; width: 40px; height: 40px; flex: none; }
.wallet-dialog .wicon { width: 40px; height: 40px; border-radius: 10px; display: block; }
.wallet-dialog .wicon.blank { background: var(--line); }
.wallet-dialog .wdot { position: absolute; top: -3px; right: -3px; width: 11px; height: 11px; border-radius: 50%; background: #35d0a2; border: 2px solid var(--panel, #0f1419); }
.wallet-dialog .wname { flex: 1; }
.wallet-dialog .wdetected { color: var(--muted); font-size: 11px; }
.wallet-dialog .wfoot { color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.wallet-dialog .linkish { background: none; border: 0; color: var(--accent); font: inherit; font-size: 12px; cursor: pointer; padding: 8px 4px; }
/* WalletConnect's pairing code: our own dialog, the QR on white so every phone camera reads it. */
.wallet-dialog .wc-qr { background: #fff; border-radius: 12px; padding: 14px; width: 232px; height: 232px; margin: 0 auto 12px; display: flex; align-items: center; justify-content: center; }
.wallet-dialog .wc-qr svg { width: 204px; height: 204px; display: block; }
.wallet-dialog .wc-qr:empty::after { content: "Connecting…"; color: #777; font-size: 12px; }
.wallet-dialog .wc-hint { color: var(--muted); font-size: 12px; line-height: 1.5; margin-bottom: 6px; }
.wallet-dialog .wc-hint a { color: var(--accent); }

/* Two front doors on one app (spec §4.14, decision 75). The server stamps
   `data-edition="competitions"` on the document when the request came in
   on the competitions site; from that attribute the full site's doors are
   not drawn there — before the first paint, no flash of a nav that then
   shrinks. The brand's link is `edition.js`'s. The Leaderboard door is
   this edition's own (the competitions results board, decision 76) and
   so is Rewards (the competition points book, decision 77), with the
   points chip showing that book's balance. The Trade door stays and
   `edition.js` points it at `/trade`, the trader's current stake. */
html[data-edition="competitions"] .nav a[href="/accounts"],
html[data-edition="competitions"] .nav a[href="/challenges"] {
  display: none;
}
/* The Rewards page's explainer names the challenge ladder, which this edition does not have (owner's call 2026-10-28). */
html[data-edition="competitions"] #c-footnote { display: none; }
/* A stranger's way in on the competitions edition: the lobby and a competition are readable signed out. */
.topbar .signin {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
}
.topbar .signin:hover {
  border-color: var(--accent);
}
