/* ============================================================================
   ui.css - the design system, loaded last
   One light look on every page, on the two screens this app is used on:
   a phone PWA (320 to 400 px) and a desktop browser (1200 to 1600 px).
   app.css is the structure, terminal.css the desk/rail/gate layout; every colour,
   radius, shadow and type decision is made here, from the one token block below.
   White page, near-black type and main buttons, hairlines instead of shadows, Inter,
   colour kept for meaning (dark green / dark coral money, bright candles, link-blue
   you-are-here, amber attention). See DESIGN.md.
   ========================================================================== */

/* ---------------------------------------------------------------- tokens */
/* One light theme (docs/superpowers/specs/2026-11-12-light-restyle-design.md). The only token block in the app:
   app.css and terminal.css hold none, so nothing here can be outranked by an older theme rule. */
:root {
  --paper: #ffffff;            /* the page */
  --shell: #ffffff;            /* cards and bars, set apart by hairlines rather than shadow */
  --field: #f4f4f5;            /* muted: tab tracks, hover, secondary surfaces (shadcn zinc-100) */
  --rule: #e4e4e7;             /* hairlines, input borders (shadcn border / input) */
  --rule-strong: #9297a0;      /* borders that must read */
  --ink: #09090b;              /* shadcn foreground */
  --slate: #3f3f46;
  --faint: #5f6570;
  --buy: #1b61c9;  --buy-ink: #ffffff;     /* the accent: you are here, links, selection, focus */
  --primary: #18181b; --primary-active: #09090b;   /* the main button: near-black, white text (shadcn primary) */
  --ring: #a1a1aa;             /* focus rings (shadcn ring) */
  --buy-btn: #006400; --sell-btn: #aa2d00; /* the order sides: Buy dark green, Sell dark coral, white text */
  --sell: #aa2d00; --sell-ink: #ffffff;
  --up: #006400;   --dn: #aa2d00;   --warn: #8a5a00;
  --candle-up: #16a34a; --candle-dn: #e5484d;  /* the chart's candles stay bright */
  --amber: #d97706;            /* attention marks: warning dots, range tints */
  --buy-wash: rgba(27,97,201,.08); --up-wash: rgba(0,100,0,.08);
  --dn-wash: rgba(170,45,0,.08);   --sell-wash: rgba(170,45,0,.08);
  --warn-bg: #f5e9d4;          /* warnings sit on the design's cream */
  --wash: rgba(27,97,201,.05);
  --hover: rgba(9,9,11,.04);
  --card-shadow: none;
  --float-shadow: 0 10px 30px -8px rgba(9,9,11,.18), 0 2px 6px rgba(9,9,11,.06);
  --xs-shadow: 0 1px 2px rgba(9,9,11,.05);      /* shadcn shadow-xs: buttons, inputs, cards */
  --shadow: var(--float-shadow);
  --scrim: rgba(9,9,11,.45);
  --sl: var(--dn); --tg: var(--up); --en: var(--buy);
  --r-sm: 6px; --r: 8px; --r-lg: 10px; --r-xl: 14px; --pill: 999px;   /* shadcn radius-sm/md/lg/xl */
  /* sizes: the values every screen used before (they lived in the old theme blocks) */
  --top-h: 44px; --nav-h: 52px; --gx: 14px;
  --t-11: .64rem; --t-12: .72rem; --t-14: .8rem; --t-16: .9rem; --t-18: 1rem; --t-21: 1.18rem; --t-26: 1.5rem;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  /* numbers use the same face with tabular figures, so columns line up without a terminal look */
  --mono: var(--sans);
  color-scheme: light;
}

/* ---------------------------------------------------------------- base */
html, body { background: var(--paper); }
body { color: var(--ink); font-family: var(--sans); font-size: 13px; font-variant-numeric: tabular-nums; letter-spacing: -.003em; -webkit-font-smoothing: antialiased; }
::selection { background: color-mix(in srgb, var(--buy) 28%, transparent); color: var(--ink); }
:focus-visible { outline: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 50%, transparent); border-radius: var(--r-sm); }
* { scrollbar-width: thin; scrollbar-color: var(--rule-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--rule-strong); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }
.view { background: var(--paper); }
.sub, .muted { color: var(--slate); }
.empty { color: var(--faint); font-size: 12px; line-height: 1.6; padding: 44px 24px; }
.up { color: var(--up); } .dn { color: var(--dn); }
.num, .px, .chg, .r, .v, .pnl, .qty, .ltp, .avg { font-family: var(--sans); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* ---------------------------------------------------------------- top bar */
/* the bar holds the feed status, the clock, alerts and the account. Every rule here is scoped
   "#tickbar #top-right ..." so it outranks the older 9 px / 1 px pill rules in app.css and terminal.css. */
:root { --tick-h: 40px; }
@media (max-width: 899px) { :root { --tick-h: 38px; } }
#tickbar { height: var(--tick-h); min-height: var(--tick-h); flex: 0 0 var(--tick-h); background: var(--shell); border-bottom: 1px solid var(--rule); box-shadow: none; }
#tickbar::after { display: none; }
#tickbar #top-right { display: flex; align-items: center; gap: 8px; margin-left: auto; padding: 0 10px 0 14px; }
/* the logo, left end of the bar: desktop only */
.bar-brand { display: none; }
@media (min-width: 900px) {
  #tickbar .bar-brand { display: flex; align-items: center; gap: 9px; flex: none; padding: 0 18px; }
  #tickbar .bar-brand .mk { width: 24px; height: 24px; border-radius: 6px; object-fit: cover; }
  #tickbar .bar-brand .wd { font-size: 14px; font-weight: 600; letter-spacing: -.01em; color: var(--ink); }
  /* the rail's menu now starts at the top */
  #tabs { padding-top: 8px; }
}
@media (min-width: 1000px) {
  /* the rail: icon over label, both centred, every button the same height. app.css lays the buttons out in a row
     (for the 900-999 px top tabs), so in the rail each icon sat at a different x, pushed by its label's length */
  #tabs button { flex: 0 0 auto; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
    height: 58px; margin: 2px 10px; padding: 0 2px; font-size: 10.5px; line-height: 1.1; white-space: nowrap; }
  #tabs button svg { width: 19px; height: 19px; margin: 0; }
  /* the Kite banner sits above the bar: the rail and the pane start below both */
  #tabs { top: calc(var(--tick-h) + var(--banner-h, 0px)); height: calc(100vh - var(--tick-h) - var(--banner-h, 0px)); }
  #ctx { top: calc(var(--tick-h) + var(--banner-h, 0px)); }
}
/* order: status, clock, alerts, account */
#tickbar #top-right #feed { order: 1; }
#tickbar #top-right #tkclock { order: 2; }
#tickbar #top-right #btn-notes { order: 3; }
#tickbar #top-right #btn-account { order: 4; }
#tickbar #top-right .iconbtn { width: 32px; height: 32px; padding: 0; border-radius: var(--r); color: var(--slate); }
#tickbar #top-right .iconbtn svg { width: 18px; height: 18px; }
#tickbar #top-right .iconbtn:hover { color: var(--ink); background: var(--field); }
#tickbar #top-right #tkclock { margin: 0; padding: 0 4px; border: 0; font-size: 12px; font-weight: 500; letter-spacing: 0; color: var(--slate); }

/* the feed status: a pill with room between the dot and the word */
#tickbar #top-right #feed, body[data-view] #tickbar #top-right #feed {
  display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 11px 0 10px;
  border: 1px solid var(--rule); border-radius: var(--pill); background: var(--field);
  font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; line-height: 1; color: var(--slate);
}
#tickbar #top-right #feed-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); box-shadow: none; }
body[data-view] #tickbar #top-right #feed-txt { display: inline; color: inherit; font-size: inherit; }
/* live: green, with a soft ring on the dot. Closed is not an error, so it stays grey, never red */
#tickbar #top-right #feed[data-s=live] { color: var(--up); background: var(--up-wash); border-color: color-mix(in srgb, var(--up) 30%, transparent); }
#tickbar #top-right #feed[data-s=live] #feed-dot { background: var(--up); box-shadow: 0 0 0 3px color-mix(in srgb, var(--up) 22%, transparent); }
.avatar-i { width: 26px; height: 26px; font-size: 10px; background: var(--field); color: var(--ink); border: 1px solid var(--rule-strong); }

/* ---------------------------------------------------------------- rail (desktop) and bottom bar (phone) */
:root #tabs { background: var(--shell); border-color: var(--rule); }
#tabs .rail-brand { border-bottom: 1px solid var(--rule); letter-spacing: .02em; color: var(--slate); font-weight: 600; }
#tabs button { color: var(--faint); border: 0; text-transform: none; letter-spacing: 0; font-weight: 500; transition: background .15s ease, color .15s ease; }
#tabs button.on { color: var(--ink); }
#tabs button.on svg { color: var(--buy); }
#tabs button.on::before { display: none; }
@media (min-width: 900px) {
  #tabs button { margin: 3px 8px; padding: 10px 4px; border-radius: var(--r-lg); font-size: 11px; letter-spacing: 0; }
  #tabs button:hover { background: var(--hover); color: var(--slate); }
  #tabs button.on { background: var(--buy-wash); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--buy) 22%, transparent); }
}
@media (max-width: 899px) {
  :root #tabs { background: color-mix(in srgb, var(--shell) 94%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--rule); }
  #tabs button { font-size: 10px; letter-spacing: 0; background: transparent; box-shadow: none; }
  #tabs button.on { background: transparent; }
  /* the active tab: a short bar over the icon, not a box */
  #tabs button.on::after { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 2px; border-radius: 0 0 2px 2px; background: var(--buy); }
  #tabs button { position: relative; }
}

/* ---------------------------------------------------------------- right-hand pane (desktop) */
#ctx { background: var(--shell); border-left: 1px solid var(--rule); }
#ctx .ctx-quote { padding: 16px var(--gx) 14px; border-bottom: 1px solid var(--rule); }
#ctx .ctx-quote b { font-size: 12px; font-weight: 600; letter-spacing: 0; color: var(--slate); }
#ctx .ctx-quote .cp { font-size: 26px; font-weight: 600; letter-spacing: -.03em; color: var(--ink); }
#ctx .ctx-badge { font-size: 10px; font-weight: 500; letter-spacing: 0; text-transform: none; padding: 2px 9px; border-radius: var(--pill); }
#ctx .ctx-badge.on { background: var(--up-wash); color: var(--up); }
#ctx .ctx-badge.off { background: var(--dn-wash); color: var(--dn); }
#ctx .ctx-lv-r { height: 31px; padding: 0 var(--gx); border-bottom: 1px solid var(--rule); }
#ctx .ctx-lv-r .lk { font-size: 12px; letter-spacing: 0; text-transform: none; color: var(--slate); }
#ctx .ctx-lv-r .lp { font-size: 12.5px; font-weight: 600; }
#ctx .ctx-lv-r.spot { background: var(--buy-wash); }
#ctx .ctx-lv-r.spot .lk, #ctx .ctx-lv-r.spot .lp { color: var(--buy); }
#ctx .ctx-foot { border-top: 1px solid var(--rule); color: var(--faint); }
/* trades mode (Chart, Levels > Live): positions and open orders */
#ctx .ctx-sub { padding: 14px var(--gx) 6px; font-size: 12px; font-weight: 600; color: var(--ink); }
#ctx .ctx-m { padding: 2px var(--gx) 8px; font-size: 11.5px; color: var(--faint); }
#ctx .ctx-lv-r .lk { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- chips and segmented controls */
/* a segmented control: a soft track, the chosen option lifted onto it */
.seg { background: var(--field); border: 1px solid var(--rule); border-radius: var(--r); padding: 2px; gap: 2px; }
.seg button { border: 0; border-radius: var(--r-sm); background: transparent; color: var(--slate); font-size: 11px; font-weight: 500; letter-spacing: 0; padding: 5px 10px; box-shadow: none; transition: background .15s, color .15s; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--shell); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.18), inset 0 0 0 1px var(--rule-strong); }
/* the index switch (Watchlist and Levels alike): pills, the chosen one filled */
.seg.lv-idx, #watch .lv-idx, #v-levels .lv-idx { display: inline-flex; gap: 6px; background: transparent; border: 0; padding: 0; }
#watch .lv-idx { display: flex; padding: 10px var(--gx); border-bottom: 1px solid var(--rule); background: var(--paper); }
.seg.lv-idx button, #watch .lv-idx button {
  min-height: 30px; padding: 5px 14px; border: 1px solid var(--rule-strong); border-radius: var(--pill);
  background: var(--shell); color: var(--slate); font-size: 12px; font-weight: 600; letter-spacing: 0; box-shadow: none;
}
.seg.lv-idx button:hover, #watch .lv-idx button:hover { color: var(--ink); border-color: var(--slate); }
.seg.lv-idx button.on, #watch .lv-idx button.on {
  background: var(--buy); border-color: var(--buy); color: var(--buy-ink);
  box-shadow: 0 4px 12px -6px color-mix(in srgb, var(--buy) 80%, transparent);
}
/* filter chips (Analytics calls/puts, order quick picks) */
.chips button, .quick button, .st-kinds button {
  min-height: 30px; padding: 5px 14px; border: 1px solid var(--rule-strong); border-radius: var(--pill);
  background: transparent; color: var(--slate); font-size: 11.5px; font-weight: 500;
}
.chips button.on, .st-kinds button.on { background: var(--buy-wash); border-color: color-mix(in srgb, var(--buy) 45%, transparent); color: var(--buy); }
.st-kinds { display: flex; gap: 6px; padding: 12px var(--gx); }

/* ---------------------------------------------------------------- inline tabs (Orders, Analytics range, Levels) */
.tabs-inline, #lv .lv-tabs { border-bottom: 1px solid var(--rule); background: var(--paper); }
.tabs-inline button, #lv .lv-tabs button {
  padding: 10px 12px; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  background: transparent; box-shadow: none; color: var(--slate); font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none;
  transition: color .15s ease;
}
.tabs-inline button:hover, #lv .lv-tabs button:hover { color: var(--ink); }
.tabs-inline button.on, #lv .lv-tabs button.on { color: var(--ink); border-bottom-color: var(--buy); background: transparent; box-shadow: none; }

/* ---------------------------------------------------------------- buttons */
/* the design's pair: a white secondary with a hairline, and a near-black main action (one per screen).
   Buy and Sell keep their own colours so the two sides are never mixed up. Flat fills, 12px corners. */
.btn {
  height: 34px; padding: 0 14px; border-radius: var(--r-lg); border: 1px solid var(--rule);
  background: var(--shell); color: var(--ink); font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none;
  transition: background .15s, border-color .15s, color .15s, filter .15s;
}
.btn:hover { border-color: var(--rule-strong); }
.btn:active { background: var(--field); }
.btn.primary { background: var(--primary); border-color: transparent; color: #fff; box-shadow: none; }
.btn.primary:active { background: var(--primary-active); }
/* Buy dark green, Sell dark coral: the order sides have their own tokens */
.btn.buy, .btn.sell { border: 0; border-radius: var(--r-lg); color: #fff; box-shadow: none; font-weight: 500; letter-spacing: 0; }
.btn.buy { background: var(--buy-btn); }
.btn.sell { background: var(--sell-btn); }
.btn.buy:active, .btn.sell:active { filter: brightness(.9); }
/* the in-trade bar shows a live P&L: a neutral card, so a profit never sits on a red button */
.actionbar .btn.sell.intrade { background: var(--shell); border: 1px solid var(--rule-strong); border-radius: var(--r-lg); color: var(--ink); box-shadow: none; }
/* the order sheet's side switch follows the same two colours */
.side button[data-v=BUY].on { background: var(--buy-btn); border-color: var(--buy-btn); color: #fff; }
.side button[data-v=SELL].on { background: var(--sell-btn); border-color: var(--sell-btn); color: #fff; }
.btn.buy:hover, .btn.sell:hover, .btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: var(--shell); color: var(--ink); }
.btn.ghost:hover { border-color: var(--rule-strong); }
.btn.danger { background: var(--dn-wash); border-color: color-mix(in srgb, var(--dn) 40%, transparent); color: var(--dn); }
.iconbtn { border-radius: var(--r); }
.iconbtn:hover { background: var(--field); color: var(--ink); }
.actionbar { background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--rule); }
.actionbar .btn { height: auto; min-height: 44px; border-radius: var(--r-lg); font-size: 15px; letter-spacing: 0; }

/* ---------------------------------------------------------------- inputs */
input[type="search"], input[type="text"], input[type="number"], input[type="time"], textarea, select {
  background: var(--field); border: 1px solid var(--rule); border-radius: var(--r-sm); color: var(--ink); font-size: 12.5px;
}
input:focus, textarea:focus, select:focus { border-color: color-mix(in srgb, var(--buy) 60%, transparent); background: var(--shell); outline: 0; box-shadow: 0 0 0 3px var(--buy-wash); }
input::placeholder, textarea::placeholder { color: var(--faint); }
.searchbar { position: static; background: transparent; border-bottom: 1px solid var(--rule); padding: 12px var(--gx); }
.search { height: 38px; background: var(--shell); border: 1px solid var(--rule-strong); border-radius: var(--r-lg); transition: border-color .15s, box-shadow .15s; }
.search:focus-within { border-color: color-mix(in srgb, var(--buy) 60%, transparent); box-shadow: 0 0 0 3px var(--buy-wash); }
.search input, .search input:focus { border: 0; background: transparent; box-shadow: none; font-size: 12.5px; }
.stepper { background: var(--field); border: 1px solid var(--rule); border-radius: var(--r-sm); }
.stepper:focus-within { background: var(--shell); border-color: color-mix(in srgb, var(--buy) 60%, transparent); }
.stepper input, .stepper input:focus { border: 0; background: transparent; box-shadow: none; }
.lbl { color: var(--slate); }
.note { background: var(--field); border-radius: var(--r); }
.note.warn, .note[data-warn="1"] { background: var(--warn-bg); color: var(--warn); }
.status { border-radius: var(--pill); padding: 2px 8px; }

/* ---------------------------------------------------------------- labels */
/* no terminal capitals: every label reads as a sentence, in the app font */
.lbl, .field .lbl, .sheet-body h3, .view h1, .view .h1, #top-title, .lv-idx-k, .badge, .ctx-row .cv.st,
#ctx .ctx-k, #ch-depth .dp-h, #ch-gate .gt-h > span:first-child, #ch-gate .gt-row b {
  text-transform: none; letter-spacing: 0; font-family: var(--sans);
}
.lbl, .field .lbl { font-size: 12px; font-weight: 500; color: var(--slate); }
.sheet-body h3 { font-size: 13px; font-weight: 600; color: var(--ink); }
#ctx .ctx-k, #ch-depth .dp-h, #ch-gate .gt-h > span:first-child { font-size: 12px; font-weight: 600; color: var(--ink); }
#ch-gate .gt-row b { font-size: 11.5px; font-weight: 500; color: var(--slate); }
.row .kind, .row .role, #watch .row .kind, #watch .row .role { letter-spacing: .02em; }

/* ---------------------------------------------------------------- rows (watchlist, search, orders, positions) */
.row, #watch .row, #results .row, .list .row {
  position: relative; min-height: 50px; padding: 10px var(--gx); border-bottom: 1px solid var(--rule); border-radius: 0;
  background: transparent; transition: background .12s ease;
}
.row:hover, #watch .row:hover, #results .row:hover, .list .row:hover { background: var(--hover); }
.row.open, #watch .row.open { background: var(--wash); }
.row .nm-t, #watch .row .nm-t { font-size: 13px; font-weight: 600; letter-spacing: -.01em; color: var(--ink); }
.row .sub, #watch .row .sub { font-size: 10px; color: var(--faint); }
.row .r .px, #watch .row .px, #results .row .px { font-size: 14px; font-weight: 600; }
.row .r .sub, .row .chg { font-size: 10.5px; }
.row .kind, .row .role, #watch .row .kind, #watch .row .role {
  border: 0; border-radius: var(--pill); padding: 2px 7px; margin-left: 6px;
  background: var(--field); color: var(--slate); font-size: 9px; font-weight: 600; letter-spacing: .02em;
}
.row[data-role=ATM] .kind, #watch .row[data-role=ATM] .kind { background: var(--buy); color: var(--buy-ink); }
.row[data-role=ATM] { background: linear-gradient(90deg, var(--buy-wash), transparent 60%); }
/* auto strikes: a coloured edge says call, put or future */
.row.auto::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 2px; border-radius: 0 2px 2px 0; background: var(--rule-strong); }
.row[data-k=CE]::before { background: var(--buy); }
.row[data-k=PE]::before { background: var(--sell); }
.row[data-k=FUT]::before { background: var(--faint); }
.row[data-role=ATM]::before { width: 3px; }
.row-actions, #watch .row-actions { padding: 4px var(--gx) 12px; gap: 8px; background: var(--wash); border-bottom: 1px solid var(--rule); }
.row-actions .btn { height: 32px; }
.group-h, #watch .group-h {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px; background: transparent;
  padding: 18px var(--gx) 8px; border: 0; border-bottom: 1px solid var(--rule);
  font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--slate);
}
.group-h .sub, #watch .group-h .sub { font-size: 11px; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--faint); }

/* ---------------------------------------------------------------- cards */
/* the headline number of a page (Positions, Analytics) */
.pnl-head { background: var(--shell); border-bottom: 1px solid var(--rule); }
.pnl-head .k { font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--slate); }
.pnl-head .v { font-size: 26px; font-weight: 600; letter-spacing: -.03em; }
.pnl-head .s { color: var(--slate); font-size: 11.5px; }

/* sections of a page: a card on the desktop canvas, a band on a phone (no card inside a card) */
.lv-sec, .st-sec { background: var(--shell); border: 1px solid var(--rule); border-radius: var(--r-lg); box-shadow: var(--card-shadow); padding: 14px 16px 16px; margin: 0 0 14px; }
.lv-h, .lv-sec .lv-h, .st-hd {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  font-size: 13px; font-weight: 600; letter-spacing: -.005em; text-transform: none; color: var(--ink);
  padding-bottom: 10px; margin-bottom: 8px; border-bottom: 1px solid var(--rule);
}
.st-hd h3 { font-size: 13px; font-weight: 600; letter-spacing: -.005em; text-transform: none; color: var(--ink); margin: 0; }
.st-hd span, .lv-h .sub { font-size: 11px; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--faint); }

/* tiles: one number with its meaning */
.pm-tile { background: var(--shell); border: 1px solid var(--rule); border-radius: var(--r); box-shadow: var(--card-shadow); padding: 10px 12px; }
.lv-sec .pm-tile { background: var(--field); box-shadow: none; }
.pm-tile .pm-k, .pm-k, .pm-sub-h { font-size: 11px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--slate); }
.pm-tile b { font-size: 20px; font-weight: 600; letter-spacing: -.025em; }
.pm-tile small { font-size: 10.5px; color: var(--slate); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pm-tile[data-tone=up] { border-color: color-mix(in srgb, var(--up) 30%, var(--rule)); }
.pm-tile[data-tone=down] { border-color: color-mix(in srgb, var(--dn) 30%, var(--rule)); }
.pm-tile[data-tone=warn] { border-color: color-mix(in srgb, var(--warn) 30%, var(--rule)); }
.nt-tiles .pm-tile b { font-size: 15px; line-height: 1.3; }
.nt-tiles .pm-tile.wide { grid-column: 1 / -1; }
.pm-open { background: var(--field); border-radius: var(--r); }
.pm-plan { border: 1px solid var(--rule); border-radius: var(--r); background: transparent; }
.pm-plan-r { border-bottom: 1px solid var(--rule); }
.su-card { border: 1px solid var(--rule); border-radius: var(--r); background: var(--field); }
.lv-verdict { background: var(--field); border: 1px solid var(--rule); border-radius: var(--r); }
.lv-plan { background: var(--field); border-radius: var(--r); }
.nse-ev { border-radius: var(--pill); padding: 1px 7px; background: var(--field); }
.nse-ev.top { background: var(--buy-wash); color: var(--buy); }

/* ---------------------------------------------------------------- tables */
.lvt-r { padding: 9px 0; font-size: 12.5px; border-bottom: 1px solid var(--rule); font-family: var(--sans); }
.lvt-r:last-child { border-bottom: 0; }
.lvt-h, .st-h { font-family: var(--sans); font-size: 11px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--faint); border-bottom: 1px solid var(--rule); padding-bottom: 7px; }
.lvt-r[data-c=ltp] { background: var(--buy-wash); color: var(--buy); border-radius: var(--r-sm); }
.st-r { border-bottom: 1px solid var(--rule); }
/* names are words: sans; only the numbers are monospace */
.lvt-r > span:first-child, .st-t .st-r > span:first-child, .su-row > span:first-child, .lv-row > span:first-child { font-family: var(--sans); }
th { font-size: 11px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--faint); border-bottom: 1px solid var(--rule); }
td { border-bottom: 1px solid var(--rule); }

/* ---------------------------------------------------------------- Levels */
/* Options, near the money: four real columns, a header that wraps instead of overlapping */
.oin .oin-r { grid-template-columns: minmax(64px, 1fr) 76px 72px minmax(0, 1fr); column-gap: 8px; }
.oin .lvt-h > span { white-space: normal; line-height: 1.25; }
.oin .oin-r span:nth-child(2) { text-align: right; }
.oin .oin-r span:nth-child(4) { white-space: normal; line-height: 1.3; font-family: var(--sans); }
.lv-sector { border-bottom: 1px solid var(--rule); }
.lv-sector-rows { background: var(--field); border-radius: var(--r-sm); }

/* ---------------------------------------------------------------- Analytics */
#st-range { top: 0; }
.st-note, .st-foot { color: var(--faint); font-size: 11px; line-height: 1.55; }

/* ---------------------------------------------------------------- chart */
#ch-head { background: var(--shell); border-bottom: 1px solid var(--rule); }
#ch-tools { background: var(--paper); border-bottom: 1px solid var(--rule); }
.su-btn { height: 32px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--field); color: var(--slate); font-size: 11.5px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.su-btn:hover { color: var(--ink); border-color: var(--rule-strong); }
.su-btn.on { color: var(--ink); background: var(--shell); border-color: var(--rule-strong); }
#ch-legend { background: var(--paper); border-bottom: 1px solid var(--rule); color: var(--faint); }
#chart { background: var(--paper); }
#ch-desk { background: var(--shell); border-bottom: 1px solid var(--rule); }
#ch-desk .dk { border-right: 0; position: relative; }
#ch-desk .dk + .dk::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 1px; background: var(--rule); }
#ch-desk .dk-h { font-size: 11px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--ink); }
#ch-desk .dk-h span:last-child { font-weight: 400; color: var(--faint); }
#ch-desk .dk-r { font-size: 11.5px; }
#ch-desk .dk-r .k { color: var(--faint); }
#ch-desk .dk-r .v { color: var(--ink); font-weight: 600; }
/* a row with no distance lets its value use that column too */
#ch-desk .dk-r .d:empty { display: none; }
#ch-desk .dk-r:has(.d:empty) .v { grid-column: 2 / -1; }
#ch-flow .fl-k { font-size: 10px; font-weight: 600; letter-spacing: 0; text-transform: none; }
#ch-flow { font-family: var(--sans); background: color-mix(in srgb, var(--shell) 92%, transparent); border: 1px solid var(--rule-strong); border-radius: var(--pill); padding: 4px 10px; backdrop-filter: blur(8px); box-shadow: var(--float-shadow); color: var(--slate); }
#ch-flow button { border: 1px solid var(--rule); border-radius: var(--pill); color: var(--faint); background: transparent; }
#ch-depth, #ch-gate, #ch-setups, #ch-res { background: var(--shell); border: 1px solid var(--rule-strong); border-radius: var(--r-lg); box-shadow: var(--float-shadow); overflow: hidden; }
#ch-zoom button, #ch-zoom > * { border-radius: var(--r-sm); }

/* ---------------------------------------------------------------- sheets, modals, alerts */
.sheet { background: var(--scrim); }
.sheet-body { background: var(--shell); border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: var(--float-shadow); }
.sheet-head h2 { font-size: 16px; font-weight: 500; letter-spacing: -.01em; }
.modal-box { background: var(--shell); border: 1px solid var(--rule); border-radius: var(--r-lg); box-shadow: var(--float-shadow); }
#toast { border-radius: var(--r-lg); box-shadow: var(--float-shadow); }
.nc, #notes-panel { background: var(--shell); border: 1px solid var(--rule-strong); border-radius: var(--r-lg); box-shadow: var(--float-shadow); }
.toggle { border-color: var(--rule); }

/* ---------------------------------------------------------------- Results */
#res { padding-bottom: 24px; }
/* phone: one column, NIFTY first, then the list, then what is coming up */
@media (max-width: 1099px) {
  #res { display: flex; flex-direction: column; }
  #res .rs-side { display: contents; }
  #res .rs-nifty { order: 1; } #res .rs-list { order: 2; } #res .rs-up { order: 3; }
}
#res .rs-f { display: flex; flex-wrap: wrap; margin: 12px 0 4px; }
.rs-status { font-size: 11px; color: var(--faint); margin: 6px 0 12px; }
.rs-sum { display: flex; align-items: baseline; gap: 8px; margin: 2px 0 8px; }
.rs-sum b { font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.rs-sum span { font-size: 11.5px; color: var(--slate); }
.rs-n { grid-template-columns: minmax(0, 1fr) 76px 60px 52px; column-gap: 8px; }
.rs-n span:nth-child(n+2) { text-align: right; }
.rs-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rs-chips small { color: var(--faint); margin-left: 3px; }
.rs-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 12px 0; border-bottom: 1px solid var(--rule); transition: background .12s ease;
}
.rs-row:hover { background: var(--hover); }
.rs-row.open { border-bottom-color: transparent; }
.rs-l { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.rs-sym { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.rs-l .sub { font-size: 11px; color: var(--faint); }
.rs-b { padding: 1px 7px; border-radius: var(--pill); background: var(--field); color: var(--slate); font-size: 9.5px; font-weight: 600; }
.rs-b.n50 { background: var(--buy-wash); color: var(--buy); }
.rs-m, .rs-r { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.rs-m b, .rs-r b { font-size: 13.5px; font-weight: 600; }
.rs-m small { font-size: 11px; font-weight: 500; }
.rs-v { font-style: normal; padding: 2px 8px; border-radius: var(--pill); background: var(--field); color: var(--slate); font-size: 10.5px; font-weight: 600; white-space: nowrap; }
.rs-v[data-t=up] { background: var(--up-wash); color: var(--up); }
.rs-v[data-t=dn] { background: var(--dn-wash); color: var(--dn); }
.rs-v[data-t=warn] { background: var(--warn-bg); color: var(--warn); }
.rs-more { padding: 2px 0 16px; border-bottom: 1px solid var(--rule); }
.rs-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rs-grid > div { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: var(--r); background: var(--field); }
.rs-grid span { font-size: 10.5px; color: var(--slate); }
.rs-grid b { font-size: 13px; font-weight: 600; }
.rs-why { margin: 12px 0 0; padding-left: 18px; color: var(--slate); font-size: 12px; line-height: 1.6; }
.rs-acts { display: flex; gap: 8px; margin-top: 12px; }
.rs-acts .btn { display: inline-flex; align-items: center; text-decoration: none; }
.rs-note { margin: 10px 0 0; font-size: 11px; color: var(--faint); line-height: 1.5; }

/* ============================================================================
   desktop
   ========================================================================== */
@media (min-width: 900px) {
  .sheet-body { border-radius: 0; border-left: 1px solid var(--rule); }
  /* each view scrolls inside itself below the top bar: room at the top, sticky bars stick at 0 */
  #v-pos, #v-orders, #v-stats { padding-top: 16px; }
  #v-results { padding: 4px 18px 0; }
  #v-levels .lv-idx { padding-top: 14px; }
  /* the headline number is a card too */
  #v-pos .pnl-head, #v-stats .pnl-head { border: 1px solid var(--rule); border-radius: var(--r-lg); box-shadow: var(--card-shadow); margin: 0 0 4px; }
  #st-range { margin-bottom: 14px; }
  #v-stats .st-kinds { padding-left: 0; padding-right: 0; }
  /* Analytics: two columns of cards */
  #st-body { columns: 2; column-gap: 14px; column-rule: 0; }
  #st-body > .st-sec { break-inside: avoid; display: inline-block; width: 100%; }
  #st-body > .st-sec:last-of-type { border-top: 1px solid var(--rule); }
  /* lists sit on a card */
  #v-orders .list, #v-pos .list { background: var(--shell); border: 1px solid var(--rule); border-radius: var(--r-lg); box-shadow: var(--card-shadow); overflow: hidden; }
  #v-orders .list:empty, #v-pos .list:empty { display: none; }
  #v-orders .list .row:last-child, #v-pos .list .row:last-child { border-bottom: 0; }
}
@media (min-width: 1100px) {
  /* Results: the list on the left, the NIFTY card and the calendar beside it */
  #res { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); column-gap: 14px; align-items: start; }
  #res > .rs-f, #res > .rs-status { grid-column: 1 / -1; }
  #res > .rs-list { grid-column: 1; grid-row: 3; }
  #res > .rs-side { grid-column: 2; grid-row: 3; position: sticky; top: 12px; }
  /* Levels, by how many sections the tab has (levels.js sets data-n). Newspaper columns over the whole page left one
     column empty whenever a tab had one long section (Pre-market, Stocks) or two of very different heights (Setups). */
  #v-levels #lv { column-count: auto; columns: auto; }
  #v-levels .lv-sec { break-inside: avoid; }
  #v-levels .nt-tiles { grid-template-columns: 1fr 1fr; }
  /* three or more: balanced columns */
  #v-levels .lv-body { column-count: 2; column-gap: 14px; }
  #v-levels .lv-body > .lv-foot { column-span: all; }
  /* two: side by side, the first (the bigger one in every tab that has two) wider */
  #v-levels .lv-body[data-n="2"] { columns: auto; column-count: auto; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); column-gap: 14px; align-items: start; }
  #v-levels .lv-body[data-n="2"] > .lv-foot { grid-column: 1 / -1; }
  /* one: full width, split inside where the content is long */
  #v-levels .lv-body[data-n="1"], #v-levels .lv-body[data-n="0"] { columns: auto; column-count: auto; }
  .pm-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 32px; align-items: start; }
  .pm-col > .pm-h:first-child { margin-top: 2px; }
  #v-levels .lv-body[data-n="1"] .lv-sectors { column-count: 2; column-gap: 36px; }
  #v-levels .lv-body[data-n="1"] .lv-sector, #v-levels .lv-body[data-n="1"] .lv-sector-rows { break-inside: avoid; }
}

/* ============================================================================
   phone
   ========================================================================== */
@media (max-width: 899px) {
  :root { --gx: 14px; }
  /* sections are bands split by a hairline; the tiles inside them stay rounded */
  .lv-sec, .st-sec { background: transparent; border: 0; border-radius: 0; box-shadow: none; border-bottom: 1px solid var(--rule); margin: 0; padding: 16px 0; }
  #lv .lv-sec:last-of-type { border-bottom: 0; }
  .st-sec { padding: 16px var(--gx); }
  .lv-sec .pm-tile { background: var(--shell); box-shadow: var(--card-shadow); }
  #v-levels .lv-idx { padding-top: 10px; }
  #v-pos, #v-orders { padding-top: 8px; }
  #v-results { padding: 0 var(--gx); }
  .rs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rs-n { grid-template-columns: minmax(0, 1fr) 70px 54px 46px; }
  .pnl-head { border-top: 1px solid var(--rule); }

  /* chart tools: timeframes on one line, the four tools on the next, at every phone width;
     desk.js measures the real height for the chart */
  #ch-tools { flex-wrap: wrap; overflow: visible; row-gap: 6px; }
  #ch-tools > * { flex: 0 0 auto; }
  #ch-tools .su-btn { width: 40px; padding: 0; justify-content: center; }

  /* desk strip: a swipeable row of cards; the edge fades so the next card reads as a peek, not a cut */
  #ch-desk { -webkit-mask-image: linear-gradient(90deg, #000 86%, transparent); mask-image: linear-gradient(90deg, #000 86%, transparent); }
  /* label, price, distance; the price is never cut */
  #ch-desk .dk-2 { grid-template-columns: 1fr 1fr; column-gap: 10px; }
  #ch-desk .dk-r { grid-template-columns: 28px minmax(0, 1fr) auto; column-gap: 4px; font-size: 9.5px; }
  #ch-desk .dk-r .k { min-width: 0; }
  #ch-desk .dk-r .d { display: block; min-width: 0; }
  #ch-desk .dk-r .d:empty { display: none; }
  #ch-desk .dk-r .v { overflow: visible; }

  .pm-open { grid-template-columns: 1fr 1fr; gap: 4px 12px; padding: 12px; }
  .pm-gift b, .pm-imp b { font-size: 19px; }
  .pm-tiles:not(.nt-tiles) .pm-tile b { font-size: 18px; }
  .nt-tiles .pm-tile { padding: 8px 10px; }
  .nt-tiles .pm-tile b { font-size: 13px; line-height: 1.35; }
  .st-t .lvt-r { grid-template-columns: minmax(0, 1fr) 40px 38px 50px 44px; column-gap: 6px; font-size: 11px; }
  .st-t .lvt-h { font-size: 8.5px; }
  .su-row { grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; }
  .su-row > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .su-row > span:nth-child(2) { font-size: 10.5px; color: var(--slate); }
  .lv-sector > span:nth-child(3) { white-space: nowrap; font-size: 10.5px; }
  .st-t .st-r > span:first-child { line-height: 1.3; }
  #lv .lv-tabs button { padding: 10px 10px; font-size: 11.5px; }
}
@media (max-width: 380px) {
  #tabs button { font-size: 8px; letter-spacing: 0; }
  .oin .oin-r { grid-template-columns: minmax(56px, 1fr) 64px 60px minmax(0, .9fr); column-gap: 6px; }
  .lv-sector > span:nth-child(2) { display: none; }
  .lv-sector { grid-template-columns: minmax(0, 1fr) 84px 50px; gap: 4px; }
  .pm-gift b, .pm-imp b { font-size: 17px; }
  .pm-tiles:not(.nt-tiles) .pm-tile b { font-size: 16px; }
  #lv .lv-tabs button { padding: 10px 8px; font-size: 11px; }
  .seg.lv-idx button, #watch .lv-idx button { padding: 5px 11px; }
}

/* ---------------------------------------------------------------- phone chart: the chart gets the height */
#ch-desk-btn { display: none; }
#ch-bracket .bk-manage, #or-bracket .bk-manage { display: none; }   /* Manage opens Orders: never shown on Orders itself */
@media (max-width: 899px) {
  /* one tool row: the timeframes scroll in what is left beside the tools, instead of a row each */
  #ch-tools { flex-wrap: nowrap; overflow: visible; gap: 4px; padding: 4px 6px 4px var(--gx); }
  #ch-tools #ch-iv { flex: 1 1 auto; width: auto; min-width: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
  #ch-iv::-webkit-scrollbar { display: none; }
  #ch-iv button { flex: none; min-width: 0; padding: 0 9px; font-size: 11.5px; }
  #ch-tools > button { flex: none; }
  #ch-tools .su-btn, #ch-tools .iconbtn.sm { width: 34px; height: 32px; min-height: 32px; padding: 0; justify-content: center; }

  /* the strip above the chart (levels, positioning, session, signal) only when the Levels button is on */
  #ch-desk-btn { display: inline-flex; }
  body:not(.desk-on) #ch-desk { display: none; }

  /* the flow read: its own line under the chart, never over the candles */
  #ch-flow { position: static; inset: auto; margin: 0; width: auto; border: 0; border-top: 1px solid var(--rule); border-radius: 0;
    padding: 5px var(--gx); background: var(--paper); backdrop-filter: none; box-shadow: none; white-space: nowrap; overflow: hidden; font-size: 11px; }
  #ch-flow:empty { display: none; }

  /* a running bracket: status, P&L and the rail only; Exit now is in the bar below, the rest in Orders */
  #ch-bracket .bk-hint, #ch-bracket .bk-last, #ch-bracket .bk-tgt, #ch-bracket .bk-acts { display: none; }
  #ch-bracket { padding-top: 8px; padding-bottom: 4px; }
  #ch-bracket .bk-manage { display: inline; margin-left: auto; font-size: var(--t-12); }

  /* zoom: pinch does it on a phone, so - and + go; Latest moves bottom-left above the time axis, off the newest candles */
  #ch-zoom { right: auto; left: 8px; top: calc(var(--ch-h, 60svh) - 64px); background: color-mix(in srgb, var(--paper) 85%, transparent); }
  #ch-zoom button[data-z=in], #ch-zoom button[data-z=out] { display: none; }
  #ch-zoom button[data-z=reset] { height: 28px; padding: 0 10px; }

  /* the chart takes what is left, measured in desk.js (--ch-h): the room between its top and the Buy/Sell bar */
  #v-chart #chart, #v-chart.has-bk #chart { height: var(--ch-h, 60svh); min-height: 240px; }
}

/* desktop chart: the bracket card is shown whole, never scrolled inside itself (it was capped at 45% and its top,
   the status, P&L and contract, scrolled out of sight). Compacted to fit: the hint beside the last log line, and
   "At target" beside the buttons; the chart takes what is left. */
@media (min-width: 900px) {
  #ch-bracket { max-height: none; overflow: visible; display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 16px; align-items: center; padding-top: 8px; padding-bottom: 10px; }
  #ch-bracket > * { grid-column: 1 / -1; }
  #ch-bracket > .bk-hint { grid-column: 1; margin-top: 2px; }
  #ch-bracket > .bk-last { grid-column: 2; margin-top: 2px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #ch-bracket > .bk-tgt { grid-column: 1; margin-top: 8px; }
  #ch-bracket > .bk-tgt .btn { margin-left: 8px; }
  #ch-bracket > .bk-acts { grid-column: 2; margin-top: 8px; }
  #ch-bracket .bk-acts .btn { min-height: 36px; }
  #ch-bracket .bk-sym { margin: 2px 0 0; }
}

/* ---------------------------------------------------------------- order form: what, entry, exit, the decision */
/* Read top to bottom the way the trade is decided: the contract and side, how it gets in, how it gets out, then one
   card with what it can lose and make. Background readings fold away; only warnings open on their own. */
:is(#sheet, #adopt) .sheet-head { margin-bottom: 14px; }
:is(#sheet, #adopt, #addmore) .sheet-head h2 { font-size: 20px; font-weight: 500; letter-spacing: -.015em; line-height: 1.2; }
:is(#sheet, #adopt) .sheet-head .sub { margin-top: 2px; font-size: 12px; color: var(--faint); }
:is(#sheet, #adopt) .side { margin-bottom: 4px; }

:is(#sheet, #adopt) .o-sec { padding: 16px 0 4px; }
:is(#sheet, #adopt) .o-sec + .o-sec { border-top: 1px solid var(--rule); }
:is(#sheet, #adopt, #addmore) .o-h { margin: 0 0 10px; font-size: 14px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--ink); }
:is(#sheet, #adopt) .field { margin-bottom: 12px; }
:is(#sheet, #adopt) .lbl { font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--slate); }
:is(#sheet, #adopt) .lbl i { color: var(--faint); }

/* quick picks: one row that scrolls, under the stop and target they fill */
:is(#sheet, #adopt) .quick { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: -2px calc(-1 * var(--gx)) 10px; padding: 0 var(--gx); }
:is(#sheet, #adopt) .quick::-webkit-scrollbar { display: none; }
:is(#sheet, #adopt) .quick button { flex: none; }

/* the decision card */
:is(#sheet, #adopt) .o-sum { background: var(--field); border: 1px solid var(--rule); border-radius: var(--r); padding: 14px 14px 12px; margin: 6px 0 12px; }
:is(#sheet, #adopt) .o-sum:not(:has(> :not([hidden]))) { display: none; }
:is(#sheet, #adopt) .o-sum .risk { display: block; padding: 0; margin: 0; background: none; border: 0; }
:is(#sheet, #adopt) .rk-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 8px; }
:is(#sheet, #adopt) .rk-k { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--slate); }
:is(#sheet, #adopt) .rk-k b { font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
:is(#sheet, #adopt) .rk-r { align-items: flex-end; text-align: right; }
:is(#sheet, #adopt) .risk .rr { align-self: center; padding: 3px 9px; border-radius: var(--pill); background: var(--shell); border: 1px solid var(--rule);
  font-size: 13px; font-weight: 600; color: var(--ink); }
:is(#sheet, #adopt) .risk .rr:empty { visibility: hidden; }
:is(#sheet, #adopt) .risk[data-good="1"] .rr { color: var(--up); border-color: color-mix(in srgb, var(--up) 40%, transparent); }
:is(#sheet, #adopt) .risk[data-bad="1"] .rr { color: var(--dn); border-color: color-mix(in srgb, var(--dn) 40%, transparent); }
:is(#sheet, #adopt) .rk-bar { display: flex; gap: 3px; height: 6px; margin: 12px 0 8px; }
:is(#sheet, #adopt) .rk-bar i { display: block; border-radius: 3px; min-width: 6px; }
:is(#sheet, #adopt) .rk-loss { background: var(--dn); }
:is(#sheet, #adopt) .rk-gain { background: var(--up); }
:is(#sheet, #adopt) .risk .net { margin-top: 6px; font-size: 12px; color: var(--slate); line-height: 1.4; }
:is(#sheet, #adopt) .o-sum .o-cost { display: flex; border: 0; border-top: 1px solid var(--rule); border-radius: 0; background: none; margin: 12px 0 0; padding: 10px 0 0; }
:is(#sheet, #adopt) .o-sum .risk[hidden] + .o-cost { border-top: 0; margin-top: 0; padding-top: 0; }
:is(#sheet, #adopt) .o-sum .o-cost[data-bad="1"] { border-top-color: var(--dn); }

/* the checks, and the two option folds below them, share one look */
:is(#sheet, #adopt) .o-checks, :is(#sheet, #adopt) .trail { border: 1px solid var(--rule); border-radius: var(--r); margin: 0 0 10px; background: none; }
:is(#sheet, #adopt) .o-checks summary, :is(#sheet, #adopt) .trail summary { list-style: none; cursor: pointer; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px;
  font-size: 14px; font-weight: 500; color: var(--ink); position: relative; padding-right: 36px; }
:is(#sheet, #adopt) .o-checks summary::-webkit-details-marker { display: none; }
:is(#sheet, #adopt) .o-checks summary::after, :is(#sheet, #adopt) .trail summary::after { content: ""; position: absolute; right: 16px; top: 18px; width: 7px; height: 7px;
  border-right: 1.5px solid var(--faint); border-bottom: 1.5px solid var(--faint); transform: rotate(45deg); transition: transform .15s; }
:is(#sheet, #adopt) .o-checks[open] > summary::after, :is(#sheet, #adopt) .trail[open] > summary::after, :is(#sheet, #adopt) .o-adv[open] > summary::after { transform: rotate(225deg); top: 21px; }
:is(#sheet, #adopt) .o-checks summary { color: var(--slate); font-size: 13px; }
:is(#sheet, #adopt) .o-checks.has-warn { border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
:is(#sheet, #adopt) .o-checks.has-warn summary { color: var(--warn); font-weight: 600; }
:is(#sheet, #adopt) .o-checks > div { margin: 0 12px 10px; }
:is(#sheet, #adopt) .o-checks > div:first-of-type { margin-top: 2px; }
:is(#sheet, #adopt) .trail summary .sub { font-size: 12px; font-weight: 400; color: var(--slate); }
:is(#sheet, #adopt) .opts { margin: 0 0 4px; }
:is(#sheet, #adopt) .opts .toggle { border-top: 0; padding: 12px 0; }

/* the foot: mode, the one action, and the day's count underneath */
:is(#sheet, #adopt) .sheet-foot .today { text-align: center; color: var(--faint); margin: 8px 0 0; font-size: 12px; }
:is(#sheet, #adopt) .sheet-foot .today:empty { display: none; }
@media (prefers-reduced-motion: reduce) { :is(#sheet, #adopt) .o-checks summary::after, :is(#sheet, #adopt) .trail summary::after { transition: none; } }

/* the trade read: each block titled, one reading per line, label left and value right */
:is(#sheet, #adopt) .o-checks .note { padding: 10px 12px; }
:is(#sheet, #adopt) .rd-h { font-size: 12px; font-weight: 600; color: var(--ink); margin: 0 0 6px; }
:is(#sheet, #adopt) .note[data-warn="1"] .rd-h, :is(#sheet, #adopt) .note.warn .rd-h { color: var(--warn); }
:is(#sheet, #adopt) .rd-l { display: flex; flex-direction: column; }
:is(#sheet, #adopt) .rd-r { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; align-items: baseline; padding: 5px 0;
  border-top: 1px solid color-mix(in srgb, var(--rule) 70%, transparent); font-size: 13px; }
:is(#sheet, #adopt) .rd-r:first-child { border-top: 0; padding-top: 0; }
:is(#sheet, #adopt) .rd-k { color: var(--slate); }
:is(#sheet, #adopt) .rd-v { color: var(--ink); font-weight: 600; text-align: right; white-space: nowrap; }
:is(#sheet, #adopt) .rd-n { grid-column: 1 / -1; font-size: 11.5px; color: var(--faint); margin-top: 1px; }
:is(#sheet, #adopt) .rd-r.warn .rd-v, :is(#sheet, #adopt) .rd-r.warn .rd-n { color: var(--warn); }
:is(#sheet, #adopt) .rd-line { font-size: 13px; line-height: 1.45; padding: 5px 0; border-top: 1px solid color-mix(in srgb, var(--warn) 25%, transparent); }
:is(#sheet, #adopt) .rd-line:first-of-type { border-top: 0; padding-top: 0; }
:is(#sheet, #adopt) .o-checks .o-sstop { margin-top: 8px; }

/* the exit plan: the settings that shape it, then the trail tuning folded under Advanced */
:is(#sheet, #adopt) .trail > .toggle { margin: 0 14px; padding: 4px 0 12px; border: 0; }
:is(#sheet, #adopt) .trail .toggle small { line-height: 1.4; }
:is(#sheet, #adopt) .o-unit { display: flex; align-items: center; gap: 8px; }
:is(#sheet, #adopt) .o-unit input { width: 72px; flex: none; text-align: center; }
:is(#sheet, #adopt) .o-unit i { font-style: normal; font-size: 12px; color: var(--slate); }
:is(#sheet, #adopt) .o-adv { margin: 2px 14px 12px; border-top: 1px solid var(--rule); }
:is(#sheet, #adopt) .o-adv > summary { list-style: none; cursor: pointer; padding: 12px 0 8px; font-size: 13px; font-weight: 500; color: var(--slate); }
:is(#sheet, #adopt) .o-adv > summary::-webkit-details-marker { display: none; }
:is(#sheet, #adopt) .o-adv > summary { position: relative; padding-right: 24px; }
:is(#sheet, #adopt) .o-adv > summary::after { right: 4px; top: 16px; }
:is(#sheet, #adopt) .o-adv[open] > summary { border-bottom: 0; margin-bottom: 0; }
:is(#sheet, #adopt) .trail > .grid2 { align-items: end; margin: 0 14px; }
:is(#sheet, #adopt) .o-adv-note { margin: 0 0 10px; font-size: 12px; line-height: 1.45; color: var(--faint); }
:is(#sheet, #adopt) .o-adv .chips { margin-bottom: 12px; }

/* nested folds: each arrow follows its own fold, and the inner fold's title has no rule under it */
:is(#sheet, #adopt) .trail[open] .o-adv:not([open]) > summary::after { transform: rotate(45deg); top: 16px; }
:is(#sheet, #adopt) .o-adv > summary, :is(#sheet, #adopt) .trail[open] .o-adv > summary { border-bottom: 0; margin-bottom: 0; }
:is(#sheet, #adopt) .o-adv[open] > summary::after { top: 19px; }
/* the trade read sits flat inside its fold; only a warning keeps its tint */
:is(#sheet, #adopt) .o-checks .note:not([data-warn="1"]):not(.warn) { background: none; border: 0; padding: 2px 2px 4px; }
@media (max-width: 380px) {
  /* narrow phones: the two exit settings one per line, so neither label wraps */
  :is(#sheet, #adopt) .trail > .grid2 { grid-template-columns: 1fr; gap: 0; }
  :is(#sheet, #adopt) .o-unit i { white-space: nowrap; }
}
:is(#sheet, #adopt) .o-armwhen { margin: 0 0 10px; }
:is(#sheet, #adopt) .o-armwhen button { white-space: nowrap; }
:is(#sheet, #adopt) #o-opennote { margin: 0 0 12px; }

/* make bracket: a short note under the title, and the exit plan line */
#adopt .adopt-note { margin: -4px 0 4px; font-size: 12.5px; line-height: 1.45; color: var(--slate); }
#adopt > .sheet-body > .toggle { border: 0; padding: 4px 0 8px; }
/* the make-bracket button on an open position */
#pos-list .mk-bracket { margin-top: 8px; min-height: 32px; padding: 0 14px; font-size: 13px; }

/* a buy-more order waiting on the live bracket */
.bk-add { font-size: var(--t-12); color: var(--warn); margin-top: 6px; }
.bk-add .link { margin-left: 6px; font-size: inherit; }



/* ============================================================================
   shadcn/ui components, in plain CSS (the app has no React). Each block follows the shadcn component it names:
   the same sizes, corners, borders, shadow-xs and grey focus ring. Loaded last, so these are the final word.
   ========================================================================== */
/* Button: default (near-black), outline (white, hairline), Buy / Sell keep their colours; h-9, rounded-md */
.btn {
  height: 36px; min-height: 36px; padding: 0 16px; gap: 8px; border-radius: var(--r); border: 1px solid var(--rule);
  background: var(--shell); color: var(--ink); font-size: 13px; font-weight: 500; letter-spacing: 0; box-shadow: var(--xs-shadow);
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, opacity .15s;
}
.btn:hover { background: var(--field); border-color: var(--rule); }
.btn:active { background: var(--field); }
.btn:focus-visible { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 50%, transparent); }
.btn.sm { height: 32px; min-height: 32px; padding: 0 12px; font-size: 12.5px; }
.btn.block { height: auto; min-height: 44px; font-size: 14px; }
.btn.primary { background: var(--primary); border-color: transparent; color: #fff; box-shadow: var(--xs-shadow); }
.btn.primary:hover { background: color-mix(in srgb, var(--primary) 90%, #fff); filter: none; }
.btn.primary:active { background: var(--primary-active); }
.btn.ghost { background: var(--shell); color: var(--ink); }
.btn.ghost:hover { background: var(--field); border-color: var(--rule); }
.btn.buy, .btn.sell { border: 0; border-radius: var(--r); color: #fff; box-shadow: var(--xs-shadow); }
.btn.buy { background: var(--buy-btn); }
.btn.sell { background: var(--sell-btn); }
.btn.buy:hover, .btn.sell:hover { filter: brightness(1.1); }
.btn.danger { background: var(--shell); border-color: color-mix(in srgb, var(--dn) 35%, var(--rule)); color: var(--dn); }
.btn.danger:hover { background: var(--dn-wash); }
.actionbar .btn { border-radius: var(--r); }
.actionbar .btn.sell.intrade { border-radius: var(--r); }
/* icon button: shadcn Button variant ghost, size icon */
.iconbtn { border-radius: var(--r); transition: background .15s, color .15s; }
.iconbtn:hover { background: var(--field); color: var(--ink); }

/* Input: h-9, rounded-md, hairline, shadow-xs; focus = grey border + soft ring */
input[type="search"], input[type="text"], input[type="number"], input[type="time"], input[type="password"], input[type="email"], textarea, select {
  background: var(--shell); border: 1px solid var(--rule); border-radius: var(--r); color: var(--ink); font-size: 13px; box-shadow: var(--xs-shadow);
  transition: border-color .15s, box-shadow .15s;
}
input:not([type=checkbox]):not([type=radio]):focus, textarea:focus, select:focus {
  border-color: var(--ring); background: var(--shell); outline: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 45%, transparent);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
.stepper { background: var(--shell); border: 1px solid var(--rule); border-radius: var(--r); box-shadow: var(--xs-shadow); }
.stepper:focus-within { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 45%, transparent); }
.stepper input, .stepper input:focus { border: 0; background: transparent; box-shadow: none !important; }
.search { height: 36px; background: var(--shell); border: 1px solid var(--rule); border-radius: var(--r); box-shadow: var(--xs-shadow); }
.search:focus-within { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 45%, transparent); }
.search input, .search input:focus { border: 0; background: transparent; box-shadow: none !important; }

/* Switch: 32 x 18 track, 14 px thumb; on = near-black */
input[type=checkbox] { width: 32px; min-width: 32px; height: 18px; border-radius: var(--pill); background: var(--rule); box-shadow: inset 0 0 0 1px rgba(9,9,11,.06); transition: background .15s; }
input[type=checkbox]::after { top: 2px; left: 2px; width: 14px; height: 14px; box-shadow: 0 1px 2px rgba(9,9,11,.2); }
input[type=checkbox]:checked { background: var(--primary); }
input[type=checkbox]:checked::after { transform: translateX(14px); }
input[type=checkbox]:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 50%, transparent); }
input[type=checkbox]:disabled { opacity: .5; cursor: not-allowed; }

/* Tabs: a muted track, the chosen trigger lifted onto it (segmented controls and the index switch) */
.seg, .seg.lv-idx, #watch .lv-idx .seg, #v-levels .lv-idx .seg { display: inline-flex; background: var(--field); border: 0; border-radius: var(--r); padding: 3px; gap: 2px; }
.seg button, .seg.lv-idx button, #watch .lv-idx button {
  min-height: 28px; padding: 4px 12px; border: 1px solid transparent; border-radius: var(--r-sm); background: transparent; box-shadow: none;
  color: var(--slate); font-size: 12.5px; font-weight: 500; letter-spacing: 0; transition: background .15s, color .15s, box-shadow .15s;
}
.seg button:hover, .seg.lv-idx button:hover, #watch .lv-idx button:hover { color: var(--ink); border-color: transparent; }
.seg button.on, .seg.lv-idx button.on, #watch .lv-idx button.on { background: var(--shell); color: var(--ink); border-color: transparent; box-shadow: 0 1px 3px rgba(9,9,11,.1), 0 1px 2px rgba(9,9,11,.06); }
/* the index switch (Watchlist, Levels): shadcn ToggleGroup, variant outline; the chosen index filled */
.seg.lv-idx, #watch .lv-idx { display: flex; gap: 6px; background: transparent; padding: 0; border-radius: 0; }
#watch .lv-idx { padding: 10px var(--gx); background: var(--paper); border-bottom: 1px solid var(--rule); }
.seg.lv-idx button, #watch .lv-idx button { flex: 0 0 auto; min-height: 30px; padding: 4px 12px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--shell); box-shadow: var(--xs-shadow); color: var(--ink); }
.seg.lv-idx button:hover, #watch .lv-idx button:hover { background: var(--field); border-color: var(--rule); }
.seg.lv-idx button.on, #watch .lv-idx button.on { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: var(--xs-shadow); }
/* the order sheet's Buy / Sell switch keeps its two colours */
.side button[data-v=BUY].on { background: var(--buy-btn); border-color: var(--buy-btn); color: #fff; }
.side button[data-v=SELL].on { background: var(--sell-btn); border-color: var(--sell-btn); color: #fff; }
/* page tabs (Orders, Analytics range, Levels): shadcn Tabs, variant line */
.tabs-inline button, #lv .lv-tabs button { font-size: 13px; font-weight: 500; color: var(--slate); padding: 10px 12px; }
.tabs-inline button.on, #lv .lv-tabs button.on { color: var(--ink); border-bottom-color: var(--ink); }

/* Toggle chips (filters, scans, quick picks): shadcn Toggle, variant outline */
.chips button, .quick button, .st-kinds button {
  min-height: 30px; padding: 4px 12px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--shell); box-shadow: var(--xs-shadow);
  color: var(--ink); font-size: 12.5px; font-weight: 500; transition: background .15s, border-color .15s, color .15s;
}
.chips button:hover, .quick button:hover, .st-kinds button:hover { background: var(--field); }
.chips button.on, .st-kinds button.on, .quick button.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.chips button.on b, .quick button.on b { color: #fff; }

/* Badge: rounded-md, text-xs, medium */
.status, .row .kind, .row .role, #watch .row .kind, #watch .row .role, .rs-b, .rs-v, .nse-ev, #ctx .ctx-badge {
  border-radius: var(--r-sm); font-weight: 500; letter-spacing: 0;
}
.row .kind, .row .role, #watch .row .kind, #watch .row .role { font-size: 10px; padding: 1px 6px; border: 1px solid var(--rule); background: var(--shell); color: var(--slate); }
.row[data-role=ATM] .kind, #watch .row[data-role=ATM] .kind { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Card: rounded-xl, hairline, shadow-xs */
.lv-sec, .st-sec { border-radius: var(--r-xl); box-shadow: var(--xs-shadow); border-color: var(--rule); }
.pm-tile { border-radius: var(--r); box-shadow: var(--xs-shadow); }
.lv-sec .pm-tile { box-shadow: none; }
.note { border: 1px solid var(--rule); border-radius: var(--r); background: var(--field); }
.note.warn, .note[data-warn="1"] { border-color: color-mix(in srgb, var(--warn) 25%, var(--rule)); }
#ch-depth, #ch-gate, #ch-setups, #ch-res, .nc, #notes-panel { border: 1px solid var(--rule); border-radius: var(--r-lg); box-shadow: var(--float-shadow); }
.su-btn { height: 32px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--shell); color: var(--ink); box-shadow: var(--xs-shadow); font-size: 12.5px; }
.su-btn:hover { background: var(--field); border-color: var(--rule); }
.su-btn.on { background: var(--field); border-color: var(--rule-strong); }

/* Sheet / Dialog: an overlay, a white panel with a hairline, semibold title */
.sheet-body { border: 1px solid var(--rule); border-bottom: 0; border-radius: var(--r-xl) var(--r-xl) 0 0; box-shadow: 0 -8px 30px -12px rgba(9,9,11,.25); }
.sheet-head h2 { font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.modal-box { border: 1px solid var(--rule); border-radius: var(--r-xl); box-shadow: var(--float-shadow); }
/* Toast: shadcn Sonner */
#toast { background: var(--shell); color: var(--ink); border: 1px solid var(--rule); border-radius: var(--r); box-shadow: var(--float-shadow); font-size: 13px; }

/* the screener's pickers use the same ring as every other control */
.dd:focus-visible, .dd.open { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 45%, transparent); }
.dd-ck { stroke: var(--ink); }

/* ---------------------------------------------------------------- spacing pass (17 Nov 2026) */
/* the index switch reads as words, not terminal capitals */
.seg.lv-idx button, #watch .lv-idx button, #lv .lv-idx button, #lv > .lv-idx button { font-size: 12.5px; letter-spacing: 0; padding: 4px 12px; min-height: 30px; }
/* Checklist: "Shown, not required" is a heading like the others */
.ck-ctx { text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 600; color: var(--slate); }

@media (min-width: 900px) {
  /* Levels: the tabs line up with the cards below them, and the cards get room under the tabs */
  #lv .lv-tabs { margin: 0 0 16px; padding-top: 0; }
  #lv .lv-tabs button:first-child { padding-left: 2px; }
  #v-levels .lv-idx { margin-bottom: 6px; }
  /* Checklist: the call and put columns align with the card's own text */
  .ck-cols { gap: 40px; }
  .ck-col { padding: 10px 0; }
  /* Day pulse: the regime block is not indented inside its card */
  .dp-reg { padding: 4px 0 14px; }
  /* Options, near the money: the strike, price and OI take the room; the read follows them */
  .oin .oin-r { grid-template-columns: minmax(0, 1fr) 110px 120px minmax(0, 1.4fr); column-gap: 16px; }

  /* Orders and Positions: a list as wide as the eye reads, not 1,500 px from name to amount */
  #v-orders { max-width: 1100px; }
  #or-list { margin-top: 12px; }
  #pos-total .chg-t, #pos-total .chg-foot { max-width: 520px; }

  /* Watchlist: one hairline under the controls, not a short one under the search box */
  #v-watch .searchbar { border-bottom: 0; padding-bottom: 6px; }

  /* Chart: the interval track hugs its buttons; the tools sit at the right */
  #ch-iv.seg { flex: 0 0 auto; margin-right: auto; }

  /* Stocks: the same page margins as the other pages */
  #sk { padding: 16px 18px 28px; max-width: 1100px; }
  #sk .scr-sec, #sk .scr-count, #sk .scr-more { padding-left: 0; padding-right: 0; }
  #sk .scr-note { max-width: 820px; }
  #sk .scr-t th:first-child, #sk .scr-t td:first-child { padding-left: 0; }

  /* Results: a date stays on one line */
  .pm-date { white-space: nowrap; min-width: 64px; }

  /* sheets (order, account, chart options): shadcn Sheet, side right - full height, docked to the edge */
  .sheet { justify-content: flex-end; align-items: stretch; }
  .sheet-body { width: 460px; max-width: 460px; height: 100%; max-height: none; margin: 0 0 0 auto; border: 0; border-left: 1px solid var(--rule);
    border-radius: 0; box-shadow: -16px 0 40px -20px rgba(9,9,11,.3); padding: 16px 24px 0; }
}
/* the scan name box is as tall as its Save button */
.scr-save input { height: 32px; min-height: 32px; padding: 0 10px; }
/* the screener value box matches its pickers (36 px), not the 44 px phone field */
.scr-c input[type=number] { height: 36px; min-height: 36px; padding: 0 10px; }

/* ---------------------------------------------------------------- the Account page (opened from the avatar) */
.acct-page { max-width: 560px; padding: 20px var(--gx) 40px; }
.acct-h { font-size: 20px; font-weight: 600; letter-spacing: -.015em; margin: 0 0 14px; color: var(--ink); }
.acct-page h3 { font-size: 13px; font-weight: 600; color: var(--ink); margin: 22px 0 8px; padding-top: 18px; border-top: 1px solid var(--rule); text-transform: none; letter-spacing: 0; }
.acct-page .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.acct-page .field input { height: 36px; min-height: 36px; }
.acct-page #a-save { width: auto; min-height: 36px; height: 36px; }
@media (min-width: 900px) {
  .acct-page { margin: 20px 18px; padding: 24px; border: 1px solid var(--rule); border-radius: var(--r-xl); box-shadow: var(--xs-shadow); background: var(--shell); }
}
/* the avatar is the Account page's way in: ringed while it is open */
body[data-view="acct"] #tickbar #top-right #btn-account .avatar-i { border-color: var(--ink); box-shadow: 0 0 0 2px color-mix(in srgb, var(--ring) 55%, transparent); }
/* a link styled as a button is not underlined */
a.btn, a.btn:hover { text-decoration: none; }
@media (min-width: 900px) {
  /* Stocks uses the whole width: the filters, the note and the results table run edge to edge */
  #sk { max-width: none; }
  #sk .scr-c, #sk .scr-act, #sk .scr-note { max-width: none; }
  #sk .scr-c { grid-template-columns: minmax(0, 2fr) 130px minmax(0, 2fr) minmax(90px, 1fr) 32px; }
}
/* a switch that is off still reads as a switch: zinc-300 track, not the hairline grey */
input[type=checkbox]:not(:checked) { background: #d4d4d8; }
/* the Alerts panel drops down under the top bar (--top-h is 0 on a desktop), clear of the bell that opened it */
#notes-panel { top: calc(var(--tick-h) + var(--banner-h, 0px) + 6px); }

/* ---------------------------------------------------------------- phone pass */
@media (max-width: 899px) {
  /* sections are bands on a phone, not cards: no shadow or rounded corners peeking out at one edge */
  .lv-sec, .st-sec { box-shadow: none; border-radius: 0; }
  .dp-reg { padding-left: 0; padding-right: 0; }
}
/* the checklist columns line up with their card at every width */
.ck-col { padding-left: 0; padding-right: 0; }
@media (max-width: 899px) {
  /* the intervals scroll inside their own space (a fade says there is more), never under the tool buttons */
  #ch-iv.seg { flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 16px), transparent 100%); mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 16px), transparent 100%); }
  #ch-iv.seg::-webkit-scrollbar { display: none; }
  #ch-iv.seg button { flex: 0 0 auto; }
  #ch-tools > button, #ch-tools > .su-btn { flex: 0 0 auto; }
}
@media (max-width: 899px) {
  /* the four quick stops fit a 360-400 px phone without a sideways scroll */
  #o-quick { gap: 6px; } #o-quick button { padding: 4px 9px; }
}
/* the screener: which scan the results are for */
.scr-count .scr-name { font-weight: 600; color: var(--ink); }
.scr-chips button.on .x { color: rgba(255,255,255,.75); }
/* a dry-run-only server: no Real order button, and the main button never reads "Place real order" */
body.dry-only #o-mode [data-v=real] { display: none; }
body.dry-only #o-mode [data-v=dry] { flex: 1; }

/* ---------------------------------------------------------------- dark theme (18 Nov 2026) */
/* The same design on shadcn's dark zinc: near-black page, cards a step lighter, hairlines instead of shadows,
   light text, and the money colours lifted so they keep AA contrast on the dark surfaces. Chosen on the Account page
   (Light, Dark or System); the head script sets data-theme before the first paint. */
html[data-theme="dark"] {
  --paper: #09090b; --shell: #111114; --field: #1f1f23; --rule: #27272a; --rule-strong: #52525b;
  --ink: #fafafa; --slate: #b4b4bb; --faint: #9a9aa3;
  --buy: #6ea8ff; --buy-ink: #09090b;
  --primary: #e4e4e7; --primary-active: #fafafa; --ring: #52525b;
  --buy-btn: #15803d; --sell-btn: #c2410c;
  --sell: #ff8270; --sell-ink: #09090b;
  --up: #4ade80; --dn: #ff8270; --warn: #f5b950; --warn-bg: #2a2110;
  --amber: #f59e0b;
  --buy-wash: rgba(110,168,255,.14); --up-wash: rgba(74,222,128,.12);
  --dn-wash: rgba(255,130,112,.13);  --sell-wash: rgba(255,130,112,.13);
  --wash: rgba(110,168,255,.08);
  --hover: rgba(255,255,255,.05);
  --float-shadow: 0 10px 30px -8px rgba(0,0,0,.7), 0 2px 6px rgba(0,0,0,.4);
  --xs-shadow: 0 1px 2px rgba(0,0,0,.4);
  --scrim: rgba(0,0,0,.6);
  color-scheme: dark;
}
/* the main button and the "on" chips sit on the light --primary: dark text */
html[data-theme="dark"] :is(.btn.primary, .seg.lv-idx button.on, #watch .lv-idx button.on, .chips button.on, .st-kinds button.on, .quick button.on, .row[data-role=ATM] .kind),
html[data-theme="dark"] :is(.chips button.on, .quick button.on) b { color: var(--paper); }
html[data-theme="dark"] .btn.primary:hover { background: var(--primary-active); }
html[data-theme="dark"] .scr-chips button.on .x { color: color-mix(in srgb, var(--paper) 75%, transparent); }
/* things on the blue accent: dark text (white on the lighter blue would not read) */
html[data-theme="dark"] :is(.su-btn.has b, #ch-chain .oc-spot span, .avatar-i) { color: var(--buy-ink); }
/* a switch that is off: a visible track */
html[data-theme="dark"] input[type=checkbox]:not(:checked) { background: var(--rule-strong); }

/* armed entries: Edit and Cancel side by side; the edit form opens under the card */
#or-armed .arm-acts { display: flex; gap: 8px; flex: none; }
#or-armed .arm-edit { padding: 10px var(--gx) 12px; background: var(--warn-bg); border-bottom: 1px solid var(--rule); }
#or-armed .arm-edit .grid2 { gap: 10px 12px; }
#or-armed .arm-edit select { width: 100%; height: 36px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--shell); color: var(--ink); padding: 0 8px; }
#or-armed .arm-edit .arm-acts { justify-content: flex-end; margin-top: 10px; }
