/* ═══════════ Paper-trading wallet ═══════════ */

/* Right-edge Order rail — a slim strip pinned UNDER the header
   (top:var(--header-h), the Key Stats dock pattern), so it takes no
   layout space and the header keeps its full width. It can never
   overlap chart content: the charts reserve the strip themselves via
   the --dock-r right-margin reservation below.
   The ticket opens by default on wide screens (exchange-standard);
   the rail is the collapsed state's reopen affordance. Hidden while
   the ticket is open and on the command center (no symbol). */
.trade-rail{
  position:fixed;top:var(--header-h);bottom:0;right:0;width:var(--trade-rail-w);
  display:flex;flex-direction:column;align-items:center;gap:0.5rem;
  padding:0.875rem 0 0;
  /* Above the Key Stats sheet (z9), like the open ticket (z10): the dock
     slides in from BENEATH the trade column whether it's the rail or the
     full ticket — never sweeps over it. */
  z-index:10;
  /* Faint accent tint + a clear ink seam so the collapsed reopen strip
     reads as its own interactive "TRADE" affordance and doesn't melt into
     the cream Key Stats dock beside it. The tint (--accent-dim, 90%
     transparent) is layered over the OPAQUE page background — same rendered
     color, but the Key Stats sheet sliding beneath (z9 vs z10) can't show
     through the strip like glass. */
  background:linear-gradient(var(--accent-dim), var(--accent-dim)), var(--bg-primary);
  /* EDGE level of the ticket's border system (see .trade-drawer): --border-strong.
     The rail and the open drawer must carry the SAME seam or the panel's outer
     edge jumps strength when you collapse/expand it. */
  border:none;border-left:1px solid var(--border-strong);
  color:var(--accent);cursor:pointer;
  font-family:var(--font-sans);font-size:max(0.625rem, var(--fs-floor));font-weight:700;
  letter-spacing:normal;text-transform:none;
  transition:background var(--dur-fast),color var(--dur-fast);
}
.trade-rail span{writing-mode:vertical-rl;}
.trade-rail svg{flex-shrink:0;}
.trade-rail:hover{background:linear-gradient(var(--accent-dim), var(--accent-dim)), var(--bg-primary);}
/* Fades in each time display flips from none (i.e. when the ticket
   finishes closing) so the rail never pops. */
.trade-rail{animation:tp-rail-in .3s var(--ease-glide);}
@keyframes tp-rail-in{from{opacity:0;}to{opacity:1;}}
body.trade-open .trade-rail{display:none;}
body.no-hdr .trade-rail{display:none;}
/* The trade ticket is a per-symbol CHART-view panel; on any view without the
   chart (watchlist command center, wallet, settings, …) there is no symbol to
   trade, so suppress the reopener rail too. Mirrors syncBodyViewClasses hiding
   the open ticket via #charts visibility — keep the rail and the panel in step. */
body.no-charts .trade-rail{display:none;}
/* Research is a stockless top-level view: suppress all per-stock trade chrome
   regardless of wallet.js restoring its open state on load. */
body.view-research #trade-overlay,
body.view-research #view-toggle,
body.view-research .trade-rail,
body.view-research #hdr-trade-btn,
body.view-picks #trade-overlay,
body.view-picks #view-toggle,
body.view-picks .trade-rail,
body.view-picks #hdr-trade-btn{display:none !important;}
/* DOCKED in the Workspaces Order ticket pane (manager review 2026-10-19,
   wallet/ticket-pane.js + trade-ticket.js dockTrade): the ONE ticket moves
   into the pane and sits in flow at the pane's size, so nothing fixed covers
   the workspace. The id selectors outrank every fixed column rule (47, 79,
   44 right offsets, the phone sheet) and the chartless hide rules above. */
body #trade-overlay.is-docked:not(.hidden){display:flex !important;}
#trade-overlay.is-docked.hidden{display:none !important;}
#trade-overlay.is-docked{
  position:relative;top:auto;right:auto;bottom:auto;left:auto;
  width:100%;height:100%;min-height:0;z-index:auto;box-shadow:none;
}
#trade-overlay.is-docked .trade-drawer{width:100%;transform:none;transition:none;border-left:0;will-change:auto;}
#trade-overlay.is-docked .trade-drawer > *{animation:none;}
#trade-overlay.is-docked .trade-close{display:none;}
/* A pane is short: tighter rhythm, and the order line plus the submit stick
   to the pane's foot so the action never scrolls out of a 380px pane. The
   solid panel coloured spread only masks rows passing underneath. */
/* The pane header already names the symbol and its price. */
#trade-overlay.is-docked .trade-head{display:none;}
#trade-overlay.is-docked .trade-inst,
#trade-overlay.is-docked .trade-mode-row,
#trade-overlay.is-docked .trade-side,
#trade-overlay.is-docked .trade-type-row,
#trade-overlay.is-docked .trade-market,
#trade-overlay.is-docked .trade-pill{margin-top:0.3125rem;}
#trade-overlay.is-docked .trade-pill{height:1.875rem;}
#trade-overlay.is-docked .trade-sect-label{margin-top:0.375rem;padding-top:0.25rem;}
#trade-overlay.is-docked .trade-slider{margin-top:0.375rem;height:1rem;}
#trade-overlay.is-docked .trade-moneyline{
  position:sticky;bottom:2.625rem;z-index:2;
  margin:0.5rem 0 0;padding:0.25rem 1.125rem 0.25rem;background:var(--bg-secondary);
}
#trade-overlay.is-docked .trade-submit{
  position:sticky;bottom:0.375rem;z-index:2;height:2.25rem;margin-top:0;
  box-shadow:-1rem 0 0 var(--bg-secondary),1rem 0 0 var(--bg-secondary),0 0.375rem 0 var(--bg-secondary);
}
#trade-overlay.is-docked .trade-scroll{padding-bottom:0.375rem;}
/* The confirm step (docked only): the armed button reads inverse. */
#trade-overlay.is-docked .trade-submit.is-confirm,
#trade-overlay.is-docked .trade-modal.is-sell .trade-submit.is-confirm{background:var(--text-primary);color:var(--bg-primary);}
/* The header Trade trigger (05-chart-panels.css) mirrors the rail's
   chart-view-only visibility: no header or no charts → no per-symbol
   ticket to open. */
body.no-hdr #hdr-trade-btn,
body.no-charts #hdr-trade-btn{display:none!important;}
/* Paper Trading is a read-only bench for the bot books — the per-symbol
   trade ticket doesn't belong there. Neither does the stock-view switcher:
   Paper Trading left its option list (it's a sidebar Research item now), so
   showing it here would display a stale view name. */
body:has(#aitrader-view:not(.hidden)) .trade-rail,
body:has(#aitrader-view:not(.hidden)) .trade-overlay,
body:has(#aitrader-view:not(.hidden)) #hdr-trade-btn,
body:has(#aitrader-view:not(.hidden)) #view-toggle{display:none!important;}

.trade-btn{
  display:inline-flex;align-items:center;gap:0.3125rem;
  height:1.625rem;min-height:var(--ctl-floor);padding:0 0.75rem;
  border:1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius:var(--radius-sm);
  background:var(--accent-dim);
  color:var(--accent);
  font-family:var(--font-sans);font-size:max(0.6875rem, var(--fs-floor));font-weight:700;letter-spacing:normal;
  text-transform:none;cursor:pointer;white-space:nowrap;

  transition:background var(--dur-fast),color var(--dur-fast),border-color var(--dur-fast);
}
.trade-btn:hover{background:var(--accent);color:var(--on-accent);border-color:var(--accent);}
.trade-btn svg{width:0.6875rem;height:0.6875rem;flex-shrink:0;}

/* ── Trade panel: fixed dock under the header ─────────────────
   Pinned below the header like the Key Stats dock (top:var(--header-h)),
   so opening it takes NO layout space — the header never narrows and its
   buttons never move. The column's WIDTH is still never animated (the
   per-frame chart redraw storm of a width tween is what made docking
   feel janky): the DRAWER inside slides with a composited transform,
   and the charts ease their right margin (--dock-r below) on the same
   .22s glide, so the price scale rides the drawer's edge in lockstep.
   Open: drop .hidden → width snaps, margin eases, drawer glides in.
   Close: .closing keeps the column full-width (out of the .hidden
   collapse) while the drawer slides out; wallet.js swaps it for
   .hidden on transitionend. */
:root{--trade-w:clamp(14.5rem, 19vw, 18.25rem);--tp-r:0.5rem;}
.trade-overlay{
  position:fixed;top:var(--header-h);bottom:0;right:0;
  width:var(--trade-w);
  overflow:hidden;display:flex;
  z-index:10;
  container-type:inline-size;container-name:trade;
}
/* Narrow panel: the day-change badge would clip under the close
   button — drop it; the main header still shows the change. */
@container trade (max-width: 16.75rem){ .trade-head .trade-chg{display:none;} }
.trade-overlay.hidden{width:0;}

/* ── Right-edge reservation (--dock-r) ────────────────────────
   The rail and the ticket are fixed overlays, so the charts free their
   own right edge — the price scale must never sit under either sheet.
   One var, one consumer: .charts{margin-right:var(--dock-r)} in
   05-chart-panels.css, transitioned by 09-graphs-drawer.css on the same
   .22s glide as the drawer slide. The Key Stats dock stacks its own
   width on top of these values (13-widgets.css). */
body{--dock-r:var(--trade-rail-w);}
body.trade-open{--dock-r:var(--trade-w);}
/* Zen hides the rail and the ticket outright (08-chart-chrome.css). */
body.chart-zen{--dock-r:0;}

/* Phone-width viewports: the open ticket becomes a fixed sheet over the
   content with a dimmed backdrop. Tablets (721–1100px) keep the in-flow
   push layout instead — a fixed sheet there buried the chart's price
   scale, and a price chart without its scale is useless while trading.
   The pushed chart is narrower but complete.
   NOTE: this block must come AFTER the base .trade-overlay rules —
   equal specificity means source order decides, and the sheet needs
   its z-index to beat the floating view dropdown (z-50). */
@media (max-width:720px){
  .trade-overlay{
    z-index:60;
    box-shadow:var(--shadow-sheet);
  }
  /* Dim everything behind the sheet (one-sided spread shadow — no
     extra backdrop element needed, .closing keeps the slide clean). */
  .trade-overlay:not(.hidden):not(.closing){
    box-shadow:var(--shadow-sheet), -100vw 0 0 100vw var(--scrim-sheet);
  }
  /* The sheet overlays instead of pushing — keep the charts full width
     (the rail is display:none while the ticket is open). */
  body.trade-open{--dock-r:0;}
}

.trade-drawer{
  flex-shrink:0;width:var(--trade-w);height:100%;
  display:flex;flex-direction:column;overflow:hidden;
  background:var(--bg-secondary);
  /* ── THE TICKET'S BORDER SYSTEM (2026-07-25) ───────────────────────────
     Every structural border in this panel comes from ONE 3-step ramp of
     tokens.css neutrals, all 1px, all perceptually matched across themes
     (contrast ratio vs the panel surface, dark / light):

       EDGE      --border-strong    1.69 / 1.80   the panel's outer seam ONLY
       RULE      --border-default   1.35 / 1.38   boundaries BETWEEN sections,
                                                  and the outline of any card
                                                  or segmented control track
       HAIRLINE  --border-subtle    1.11 / 1.15   repeated rows INSIDE a section

     The seam used to be color-mix(--text-primary 28%), which measured
     2.27 dark vs 1.73 light — the same line read a full step harder in dark
     than in light, which is exactly the "borders feel inconsistent" complaint.
     --border-strong is a real token, is the top of the ramp, and matches
     across themes to within 6%.
     Deliberate NON-neutral exceptions (semantic color, not delineation):
     .trade-moneyline (champagne, the ticket's one brand accent),
     .trade-recent-side (buy/sell green/red), the slider dots + range track
     (affordance color matched to the track), and every focus ring (accent).
     Nothing else may introduce a border color.
     Where a real `border` would change layout, the same 1px line is drawn as
     an inset box-shadow — identical rendering, zero layout cost. */
  border-left:1px solid var(--border-strong);
  will-change:transform;
  /* .22s matches the .charts margin-right transition (09-graphs-drawer.css)
     and the Key Stats dock's ride on this edge (13-widgets.css) — all three
     must share one duration + curve or the price scale/dock teleport. */
  transition:transform .22s var(--ease-glide);
}
.trade-overlay.hidden .trade-drawer,
.trade-overlay.closing .trade-drawer{transform:translateX(100%);}

/* Components build in as the drawer lands: each section fades + rises
   on a small cascade (head → mode → side → tabs → body → footer).
   Gated by .hidden/.closing so the build plays once per open and the
   slide-out moves the drawer as one piece. `both` keeps sections
   invisible until their delay elapses. */
.trade-overlay.hidden .trade-drawer > *,
.trade-overlay.closing .trade-drawer > *{animation:none;}
.trade-overlay:not(.hidden):not(.closing) .trade-drawer > *{
  animation:tp-rise .36s var(--ease-glide) both;
}
.trade-overlay:not(.hidden):not(.closing) .trade-drawer > :nth-child(1){animation-delay:.10s;}
.trade-overlay:not(.hidden):not(.closing) .trade-drawer > :nth-child(2){animation-delay:.16s;}
.trade-overlay:not(.hidden):not(.closing) .trade-drawer > :nth-child(3){animation-delay:.22s;}
.trade-overlay:not(.hidden):not(.closing) .trade-drawer > :nth-child(4){animation-delay:.28s;}
.trade-overlay:not(.hidden):not(.closing) .trade-drawer > :nth-child(5){animation-delay:.34s;}
.trade-overlay:not(.hidden):not(.closing) .trade-drawer > :nth-child(n+6){animation-delay:.40s;}
@keyframes tp-rise{
  from{opacity:0;transform:translateY(0.5rem);}
  to{opacity:1;transform:none;}
}

/* Data sections whose fetch resolved while the entrance cascade was still
   playing are held back by trade-ticket.js (reveal gate) and flushed as one
   batch when the cascade ends — this gives that late batch its own short
   build-in instead of a hard pop. */
.trade-drawer .trade-reveal-late{
  animation:tp-rise .24s var(--ease-glide) both;
}

/* ── Identity header: symbol + FULL price + change, quote sub-line ── */
.trade-head{
  flex-shrink:0;padding:0 0 0.5rem;
  background:var(--bg-secondary);
  border-bottom:1px solid var(--border-default);
}
.trade-head-main{
  display:flex;align-items:center;height:2.75rem;padding:0 0 0 1rem;gap:0.5rem;
  /* RULE level. Runs the full width of the identity row so the line under the
     close button continues under the price and symbol instead of stopping at
     the button's cell. border-box keeps the row at 2.75rem. */
  border-bottom:1px solid var(--border-default);
}
.trade-sym{
  font-family:var(--font-display);font-size:0.8125rem;font-weight:700;
  color:var(--text-primary);text-transform:uppercase;letter-spacing:.10em;
  flex-shrink:0;
}
/* What is being traded (Stock, ETF, Option, Future, Crypto, TSX...), one
   quiet word beside the symbol (2026-10-19). Fill only, no rule or stripe.
   The symbol and chip share a one line box that wraps: when the panel is
   too narrow for symbol + chip + full price, the chip drops to the hidden
   second line, so the price never clips and the chip never shows half. */
.trade-id{
  display:flex;flex-wrap:wrap;align-items:center;column-gap:0.5rem;
  min-width:0;flex:0 1 auto;height:1.25rem;overflow:hidden;
}
/* Each line is exactly the box height, so a wrapped chip starts below it. */
.trade-id > .trade-sym{line-height:1.25rem;}
.trade-asset{
  font-family:var(--font-display);font-size:0.625rem;font-weight:600;line-height:1rem;
  letter-spacing:.06em;color:var(--text-muted);white-space:nowrap;flex-shrink:0;
  padding:0 0.3125rem;border-radius:2px;
  background:color-mix(in srgb, var(--text-primary) 6%, transparent);
}
.trade-asset:empty{display:none;}
.trade-head-px{
  display:flex;align-items:baseline;gap:0.4375rem;
  margin-left:auto;flex-shrink:0;min-width:0;overflow:hidden;
}
.trade-price{
  font-family:var(--font-mono);font-size:1rem;font-weight:700;
  color:var(--text-primary);flex-shrink:0;letter-spacing:-.02em;
}
.trade-chg{
  font-family:var(--font-mono);font-size:max(0.625rem, var(--fs-floor));flex-shrink:0;
  padding:2px 0.4375rem;border-radius:var(--radius-sm);color:var(--text-muted);
}
.trade-chg.up{color:var(--green);background:var(--green-dim);}
.trade-chg.down{color:var(--red);background:var(--red-dim);}
.trade-close{
  flex-shrink:0;background:transparent;border:none;
  border-left:1px solid var(--border-default);
  /* No border-bottom of its own: .trade-head-main now draws one full-bleed
     rule under the whole identity row, which terminates this left border.
     height:100% fills the row's CONTENT box (2.75rem minus that 1px), so the
     button sits flush on the rule instead of overhanging and hiding it. */
  color:var(--text-muted);cursor:pointer;
  padding:0 0.8125rem;height:100%;line-height:0;align-self:flex-start;
  transition:color var(--dur-fast),background var(--dur-fast);
}
.trade-close:hover{color:var(--text-primary);background:color-mix(in srgb, var(--text-primary) 3%, transparent);}
/* Bid / Ask / Spread collapsed into one quiet mono sub-line. */
.trade-quote-sub{
  display:flex;align-items:center;gap:0.5rem;
  padding:0 1rem;margin-top:0.1875rem;
  font-family:var(--font-mono);font-size:max(0.625rem, var(--fs-floor));
  color:var(--text-muted);letter-spacing:-.01em;
}
.trade-quote-sub b{color:var(--text-secondary);font-weight:600;}
.trade-quote-sub[hidden]{display:none;}
.qs-sep{width:1px;height:0.625rem;background:var(--border-default);}

/* ── Instrument switcher: Stocks | Options | Futures ─────── */
.trade-inst{
  display:flex;gap:2px;flex-shrink:0;
  margin:0.625rem 1rem 0;padding:2px;
  border-radius:var(--tp-r);background:var(--bg-primary);
  /* RULE level — a segmented track is a card, same weight as .trade-contract.
     Was --border-subtle, which vanished against the panel in dark (1.11). */
  border:1px solid var(--border-default);
}
.trade-inst-btn{
  flex:1;height:1.75rem;border:none;border-radius:calc(var(--tp-r) - 2px);
  background:transparent;
  font-family:var(--font-sans);font-size:max(0.6875rem, var(--fs-floor));font-weight:700;
  letter-spacing:.02em;color:var(--text-muted);cursor:pointer;
  transition:background var(--dur-fast),color var(--dur-fast);
}
.trade-inst-btn.active{background:var(--accent-dim);color:var(--accent);}
.trade-inst-btn:hover:not(.active){color:var(--text-secondary);}
.trade-inst-btn:focus-visible{
  outline:none;box-shadow:inset 0 0 0 1px var(--accent-glow);
}

/* ── Section micro-labels (ORDER / AMOUNT / ACTIVITY) ────── */
/* Each label opens a section, so it CARRIES the section's RULE: a full-bleed
   1px --border-default across the top. Replaces the 2px --border-strong left
   tick these used to wear (removed 2026-07-25 at the owner's request) — the
   tick was the only 2px border and the only --border-strong border in the
   ticket, i.e. a fourth weight nothing else shared, and it pushed the labels
   0.5rem + 2px in from the gutter every control below them uses.
   HEIGHT-NEUTRAL BY CONSTRUCTION: the 1rem top margin is split into
   (0.625rem - 1px) margin + 1px border + 0.375rem padding, so each label
   occupies exactly the same vertical space as before — the rule lands in the
   gap that was already there instead of adding one. Do not "simplify" the
   calc() away without re-measuring. */
.trade-sect-label{
  display:flex;align-items:baseline;justify-content:space-between;
  margin:calc(0.625rem - 1px) 0 0;padding:0.375rem 1rem 0;
  font-family:var(--font-sans);font-size:max(0.5625rem, var(--fs-floor));font-weight:700;
  color:var(--text-muted);text-transform:none;letter-spacing:normal;
  border-top:1px solid var(--border-default);line-height:1.2;
}
/* AMOUNT + "Available $100,000.00" share one row while they fit; on a
   narrow ticket (the 14.5rem floor at a 1024px window) the balance wraps
   to its own line, right aligned, instead of running into the label. */
.trade-sect-amount{flex-wrap:wrap;column-gap:0.75rem;row-gap:0.25rem;}
.trade-avail-inline{
  display:flex;align-items:baseline;gap:0.375rem;letter-spacing:.02em;
  margin-left:auto;min-width:0;white-space:nowrap;
}
.trade-avail-inline .trade-avail-lbl{
  font-size:max(0.5625rem, var(--fs-floor));color:var(--text-xmuted);text-transform:none;letter-spacing:normal;
}
.trade-avail-inline .trade-avail-val{
  font-family:var(--font-mono);font-size:max(0.6875rem, var(--fs-floor));font-weight:600;
  color:var(--text-secondary);text-transform:none;letter-spacing:-.01em;
}

/* ── Selected-contract card (options / futures) ─────────── */
.trade-contract{
  margin:0.75rem 1rem 0;padding:0.6875rem 0.75rem;
  background:var(--bg-tertiary);border-radius:var(--tp-r);
  box-shadow:inset 0 0 0 1px var(--border-default);
}
.trade-contract[hidden]{display:none;}
.trade-contract-name{
  font-family:var(--font-mono);font-size:0.8125rem;font-weight:700;
  color:var(--text-primary);letter-spacing:-.01em;margin-bottom:0.5rem;
}
.trade-contract-grid{
  display:grid;grid-template-columns:1fr 1fr;gap:0.4375rem 0.75rem;
}
.trade-contract-cell{display:flex;flex-direction:column;gap:0.0625rem;min-width:0;}
.trade-contract-cell:first-child:nth-last-child(3),
.trade-contract-cell:nth-child(3){grid-column:1 / -1;}
.trade-contract-k{
  font-family:var(--font-sans);font-size:max(0.5625rem, var(--fs-floor));color:var(--text-muted);
  text-transform:none;letter-spacing:normal;
}
.trade-contract-v{
  font-family:var(--font-mono);font-size:max(0.6875rem, var(--fs-floor));font-weight:600;
  color:var(--text-secondary);
}
.trade-contract-back{
  display:inline-flex;align-items:center;gap:0.25rem;margin-top:0.5625rem;
  padding:0.25rem 0.5rem 0.25rem 0.4375rem;border:none;cursor:pointer;
  border-radius:var(--radius-sm);background:transparent;
  box-shadow:inset 0 0 0 1px var(--border-default);
  color:var(--text-secondary);font-family:var(--font-sans);
  font-size:max(0.625rem, var(--fs-floor));font-weight:700;transition:box-shadow .15s,color .15s;
}
.trade-contract-back:hover{color:var(--text-primary);box-shadow:inset 0 0 0 1px var(--text-muted);}
.trade-contract-back:focus-visible{outline:none;box-shadow:inset 0 0 0 1px var(--accent);}
.trade-contract-back svg{opacity:.7;}

/* ── Market status — slim inline notice under ORDER ─────── */
.trade-market{
  display:flex;align-items:center;gap:0.4375rem;
  margin:0.5625rem 1rem 0;padding:0.3125rem 0.5625rem;
  border-radius:var(--radius-sm);background:var(--bg-tertiary);
  /* RULE level, as an inset ring — same card treatment as .trade-contract.
     The status tint lives in the FILL (is-open / is-extended / is-closed
     below); the outline stays neutral so every card in the ticket is
     delineated the same way whatever the session is. */
  box-shadow:inset 0 0 0 1px var(--border-default);
  font-family:var(--font-sans);font-size:max(0.625rem, var(--fs-floor));line-height:1.35;
  color:var(--text-secondary);
}
.trade-market-ico{width:0.75rem;height:0.75rem;flex:none;}
.trade-market[hidden],.trade-pill[hidden]{display:none;}
.trade-market.is-open{background:color-mix(in srgb, var(--accent) 7%, transparent);}
.trade-market.is-open .trade-market-ico{color:var(--green);}
.trade-market.is-extended{background:color-mix(in srgb, var(--amber) 7%, transparent);}
.trade-market.is-extended .trade-market-ico{color:var(--amber);}
.trade-market.is-closed{background:color-mix(in srgb, var(--red) 7%, transparent);}
.trade-market.is-closed .trade-market-ico{color:var(--red);}

/* ── Paper / Live — segmented track ─────────────────────── */
.trade-mode-row{
  display:flex;gap:2px;flex-shrink:0;
  margin:0.5rem 1rem 0;padding:2px;
  border-radius:var(--tp-r);background:var(--bg-primary);
  border:1px solid var(--border-default);   /* RULE level (segmented track) */
}
.trade-mode-btn{
  flex:1;height:1.3125rem;min-height:var(--ctl-floor);border:none;border-radius:calc(var(--tp-r) - 2px);
  background:transparent;
  font-family:var(--font-sans);font-size:max(0.625rem, var(--fs-floor));font-weight:600;
  letter-spacing:.02em;color:var(--text-muted);
  cursor:pointer;
  transition:background var(--dur-fast),color var(--dur-fast);
}
.trade-mode-btn.active{background:var(--accent-dim);color:var(--accent);}
.trade-mode-btn:disabled{opacity:0.32;cursor:not-allowed;}
.trade-mode-btn:hover:not(:disabled):not(.active){color:var(--text-secondary);}
/* Live reads as a WARNING, not just "the other tab". Same segmented control,
   garnet instead of champagne, so the armed book is legible from the tint
   alone before you read a word of it. */
#trade-mode-live.active{background:var(--red-dim);color:var(--red);}

/* ── Armed book band ────────────────────────────────────────
   Which account the next order hits, in words, directly under the toggle.
   Misreading it costs real money, so the two states share no styling: paper is
   a quiet neutral strip, live is garnet with a filled dot. Painted only by
   js/wallet/ibkr-mode.js from the server's answer (data-book). */
.trade-book{
  display:flex;align-items:center;justify-content:center;gap:0.375rem;
  flex-shrink:0;margin:0.375rem 1rem 0;padding:0.25rem 0.5rem;
  border-radius:calc(var(--tp-r) - 2px);
  font-family:var(--font-mono);font-size:max(0.5rem, var(--fs-floor));font-weight:600;
  letter-spacing:normal;text-transform:none;
  transition:background var(--dur-fast),color var(--dur-fast);
}
.trade-book-dot{
  width:0.3125rem;height:0.3125rem;border-radius:50%;
  flex-shrink:0;background:currentColor;
}
/* Paper states itself plainly but quietly — one step up from --text-xmuted so
   it is actually readable at 0.5rem, still visibly the calm half of the pair. */
.trade-book[hidden]{display:none;}
.trade-book[data-book="paper"]{background:var(--bg-primary);color:var(--text-muted);}
.trade-book[data-book="paper"] .trade-book-dot{opacity:.6;}
.trade-book[data-book="live"]{
  background:var(--red-dim);color:var(--red);
  /* Inset ring, not a border: 1px rounded borders bowtie in headless shots. */
  box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--red) 34%, transparent);
}

/* Live book: the red LIVE pill in the head and the red footer carry the
   state. No coloured edge rail (owner, 2026-10-02: no accent lines). */
.trade-modal.is-live .trade-foot{color:var(--red);}
.trade-foot[hidden]{display:none;}

/* ── Buy / Sell — segmented toggle (KuCoin) ─────────────── */
.trade-side{
  display:flex;flex-shrink:0;
  margin:0.625rem 1rem 0;padding:0.1875rem;
  border-radius:var(--tp-r);background:var(--bg-primary);
  border:1px solid var(--border-default);   /* RULE level (segmented track) */
}
.trade-side-btn{
  flex:1;height:1.9375rem;border:none;border-radius:calc(var(--tp-r) - 2px);
  background:transparent;color:var(--text-muted);
  cursor:pointer;font-family:var(--font-sans);
  font-size:0.8125rem;font-weight:700;letter-spacing:.01em;
  transition:background var(--dur-fast),color var(--dur-fast);
}
.trade-side-btn[data-side="buy"].active{
  background:var(--green);color:var(--on-accent);
}
.trade-side-btn[data-side="sell"].active{
  background:var(--red);color:var(--on-accent-bright);
}
.trade-side-btn:not(.active):hover{color:var(--text-primary);}

/* ── Order type: segmented control ──────────────────────────
   Same shape as Buy / Sell above but neutral: the active type is a filled
   segment with bright ink, never an underline (owner, 2026-10-02). */
.trade-type-row{
  display:flex;flex-shrink:0;gap:0.125rem;
  margin:0.625rem 1rem 0;padding:0.1875rem;
  border-radius:var(--tp-r);background:var(--bg-primary);
  border:1px solid var(--border-default);   /* RULE level (segmented track) */
}
.trade-type-btn{
  flex:1;min-height:var(--ctl-floor-sub);height:1.625rem;
  padding:0 0.5rem;border:none;border-radius:calc(var(--tp-r) - 2px);
  background:transparent;cursor:pointer;
  font-family:var(--font-sans);font-size:0.75rem;font-weight:600;
  letter-spacing:.01em;color:var(--text-muted);
  transition:background var(--dur-fast),color var(--dur-fast);
}
.trade-type-btn.active{background:var(--bg-elevated);color:var(--text-primary);font-weight:700;}
.trade-type-btn:not(.active):hover{color:var(--text-secondary);}

/* ── Scrollable body ────────────────────────────────────── */
.trade-scroll{
  flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;
  padding-bottom:0.625rem;
  scrollbar-width:thin;scrollbar-color:var(--border-strong) transparent;
}
.trade-scroll::-webkit-scrollbar{width:0.25rem;}
.trade-scroll::-webkit-scrollbar-thumb{background:var(--border-strong);border-radius:2px;}

/* Available balance */
.trade-avail{
  display:flex;align-items:baseline;gap:0.5rem;
  padding:0.75rem 1.25rem 0.125rem;
}
.trade-avail-lbl{
  font-family:var(--font-sans);font-size:max(0.6875rem, var(--fs-floor));
  color:var(--text-muted);
}
.trade-avail-val{
  font-family:var(--font-mono);font-size:max(0.6875rem, var(--fs-floor));
  color:var(--text-primary);font-weight:600;letter-spacing:-.01em;
}

/* ── Inputs: label inside left, unit right ──────────────── */
.trade-pill{
  display:flex;align-items:center;gap:0.5rem;
  height:2.375rem;margin:0.625rem 1rem 0;padding:0 0.75rem;
  background:var(--bg-tertiary);
  border-radius:var(--tp-r);
  /* Resting ring is RULE level, so an input reads as an input instead of a
     bare fill (on cream the tinted fill alone was almost invisible).
     Ring is an inset box-shadow, NOT a border: a 1px rounded border with a
     color transition mis-rasterizes as a bowtie artifact in software
     renderers (headless Chrome), and a shadow ring doesn't shift layout
     either — which is also why adding it here costs zero height. */
  box-shadow:inset 0 0 0 1px var(--border-default);
  transition:box-shadow var(--dur-fast),background var(--dur-fast);
}
.trade-pill:focus-within{
  box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent);background:var(--bg-elevated);
}
.trade-pill-lbl{
  flex:none;font-family:var(--font-sans);font-size:max(0.6875rem, var(--fs-floor));
  color:var(--text-muted);
}
/* The input's line box is 17px while the pill around it is 2.375rem, so the
   thing you click to type a quantity was the smallest part of the control.
   align-self:stretch hands the input the pill's full height: it is transparent
   and borderless and a single-line input centres its own text, so this moves
   the TARGET without moving a rendered pixel at any width — the reference
   included. */
.trade-pill input{
  flex:1;min-width:0;align-self:stretch;background:transparent;border:none;outline:none;
  padding:0;text-align:right;
  color:var(--text-primary);font-family:var(--font-mono);
  font-size:0.875rem;font-weight:600;letter-spacing:-.01em;
}
.trade-pill input::placeholder{color:var(--text-xmuted);font-weight:400;}
.trade-pill-unit{
  flex:none;font-family:var(--font-mono);font-size:max(0.625rem, var(--fs-floor));font-weight:600;
  color:var(--text-muted);letter-spacing:.06em;
}

/* ── % of balance slider with tick dots ─────────────────── */
.trade-slider{
  position:relative;height:1.25rem;
  margin:0.8125rem 1.5rem 0;
  display:flex;align-items:center;
}
.trade-slider-dots{
  position:absolute;left:0;right:0;top:50%;transform:translateY(-50%);
  display:flex;justify-content:space-between;pointer-events:none;
}
.trade-slider-dots i{
  width:0.375rem;height:0.375rem;border-radius:50%;
  background:var(--bg-elevated);border:1px solid var(--border-strong);
  transition:background var(--dur-fast),border-color var(--dur-fast);
}
.trade-slider-dots i.on{background:var(--accent);border-color:var(--accent);}
.trade-modal.is-sell .trade-slider-dots i.on{background:var(--red);border-color:var(--red);}
#trade-pct{
  -webkit-appearance:none;appearance:none;
  position:relative;z-index:1;
  width:100%;height:1.25rem;min-height:var(--ctl-floor);margin:0;
  background:transparent;cursor:pointer;
}
#trade-pct::-webkit-slider-runnable-track{
  height:2px;border-radius:1px;
  background:linear-gradient(to right,
    var(--accent) 0%,var(--accent) var(--pct,0%),
    var(--border-strong) var(--pct,0%));
}
#trade-pct::-webkit-slider-thumb{
  -webkit-appearance:none;appearance:none;
  width:0.75rem;height:0.75rem;border-radius:50%;
  margin-top:calc((2px - 0.75rem) / 2);
  background:var(--bg-secondary);border:2px solid var(--accent);
  transition:box-shadow var(--dur-fast);
}
#trade-pct::-webkit-slider-thumb:hover{box-shadow:0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent);}
#trade-pct::-moz-range-track{height:2px;border-radius:1px;background:var(--border-strong);}
#trade-pct::-moz-range-progress{height:2px;border-radius:1px;background:var(--accent);}
#trade-pct::-moz-range-thumb{
  width:0.625rem;height:0.625rem;border-radius:50%;
  background:var(--bg-secondary);border:2px solid var(--accent);
}
.trade-modal.is-sell #trade-pct::-webkit-slider-runnable-track{
  background:linear-gradient(to right,
    var(--red) 0%,var(--red) var(--pct,0%),
    var(--border-strong) var(--pct,0%));
}
.trade-modal.is-sell #trade-pct::-webkit-slider-thumb{border-color:var(--red);}
.trade-modal.is-sell #trade-pct::-webkit-slider-thumb:hover{box-shadow:0 0 0 3px color-mix(in srgb, var(--red) 10%, transparent);}
.trade-modal.is-sell #trade-pct::-moz-range-progress{background:var(--red);}
.trade-modal.is-sell #trade-pct::-moz-range-thumb{border-color:var(--red);}

/* ── Money Line, above the submit ──────────────────────────
   A strip separated by a plain hairline: quiet label left, large mono
   figure right. */
.trade-moneyline{
  display:flex;align-items:baseline;justify-content:space-between;gap:0.75rem;
  margin:1rem 1rem 0;padding:0.6875rem 0.125rem 0;
  border-top:1px solid var(--border-subtle);
}
.trade-money-lbl{
  font-family:var(--font-sans);font-size:max(0.6875rem, var(--fs-floor));font-weight:600;
  color:var(--text-secondary);letter-spacing:.01em;
}
.trade-money-val{
  font-family:var(--font-mono);font-size:1.125rem;font-weight:700;
  color:var(--champagne);letter-spacing:-.02em;
  font-variant-numeric:tabular-nums;
}

/* Error */
.trade-err{
  margin:0.625rem 1rem 0;padding:0.5rem 0.75rem;
  background:var(--red-dim);border-radius:var(--tp-r);
  /* RULE level inset ring — same card delineation as .trade-market and
     .trade-contract. The red lives in the fill and the text. */
  box-shadow:inset 0 0 0 1px var(--border-default);
  font-family:var(--font-sans);font-size:max(0.6875rem, var(--fs-floor));color:var(--red);
}

/* A resting order's answer (QA 2026-11-13): it is waiting, and when it
   can fill. Quiet, the same card as the session notice. */
.trade-note{
  margin:0.625rem 1rem 0;padding:0.5rem 0.75rem;
  background:var(--bg-tertiary);border-radius:var(--tp-r);
  box-shadow:inset 0 0 0 1px var(--border-default);
  font-family:var(--font-sans);font-size:max(0.6875rem, var(--fs-floor));line-height:1.4;color:var(--text-secondary);
}
.trade-note[hidden]{display:none;}

/* Open position in this symbol — 2×2 stat grid, same quiet material
   as the bid/ask card. Hidden when flat (id=trade-pos[hidden]). */
/* RULE level: "Your position" is a section of its own (it has no
   .trade-sect-label to carry the rule for it). */
.trade-pos{padding:0 1.25rem 0.125rem;border-top:1px solid var(--border-default);margin-top:0.875rem;}
.trade-pos-grid{
  display:grid;grid-template-columns:1fr 1fr;
  gap:0.5rem 0.75rem;padding-bottom:0.25rem;
}
.trade-pos-cell{display:flex;flex-direction:column;gap:0.125rem;}
.trade-pos-lbl{
  font-family:var(--font-sans);font-size:max(0.5625rem, var(--fs-floor));
  color:var(--text-muted);
}
.trade-pos-val{
  font-family:var(--font-mono);font-size:0.75rem;font-weight:600;
  color:var(--text-secondary);font-variant-numeric:tabular-nums;
}
.trade-pos-val.up{color:var(--green);}
.trade-pos-val.down{color:var(--red);}

/* Recent fills (inside scroll).
   HAIRLINE level: working orders and recent fills are two sub-lists INSIDE
   the ACTIVITY section, whose rule is carried by the section label above
   them — so the divider between them stays a step quieter. */
.trade-recent{padding:0 1.25rem 0.875rem;border-top:1px solid var(--border-subtle);margin-top:0.875rem;}
.trade-recent-title{
  padding-top:0.75rem;margin-bottom:0.375rem;
  font-family:var(--font-sans);font-size:max(0.625rem, var(--fs-floor));font-weight:600;
  color:var(--text-muted);letter-spacing:.02em;
}
.trade-recent-row{
  display:flex;align-items:center;gap:0.5rem;padding:0.4375rem 0;
  font-family:var(--font-mono);font-size:0.75rem;
  border-bottom:1px solid var(--border-subtle);
}
.trade-recent-row:last-child{border-bottom:none;}
.trade-recent-side{
  flex:none;align-self:center;padding:2px 0.375rem;
  /* The ONE font-size in the product deliberately left off the --fs-floor
     sweep (01-base.css). 0.4375rem is 6.2px at a 1440 root but only 9.6px at
     the 3072 reference, so a max(..., var(--fs-floor)) here would fire at the
     27" reference too and move it. The right fix is to raise the rem itself —
     a type decision, not a floor. Smallest type in the product until then. */
  font-size:0.4375rem;font-weight:800;letter-spacing:normal;text-transform:none;
  border-radius:2px;background:color-mix(in srgb, currentColor 14%, transparent);
}
.trade-recent-row.is-deriv .trade-recent-side{align-self:flex-start;margin-top:0.125rem;}
.trade-recent-side.buy{color:var(--green);}
.trade-recent-side.sell{color:var(--red);}
/* One line per fill; a derivative adds a smaller name line above the figure. */
.trade-recent-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:0.0625rem;}
.trade-recent-name{
  font-family:var(--font-sans);font-size:max(0.625rem, var(--fs-floor));color:var(--text-secondary);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%;
}
.trade-recent-qty{color:var(--text-primary);white-space:nowrap;}
.trade-recent-at{color:var(--text-muted);}
.trade-recent-time{flex:none;align-self:center;color:var(--text-muted);font-size:max(0.625rem, var(--fs-floor));}
/* Activity label only when something sits under it: no fills and no working
   orders means no section at all (no empty-state sentence, Ali 2026-10-05). */
#trade-activity-label:not(:has(~ #trade-orders:not([hidden]))):not(:has(~ #trade-recent:not([hidden]))){display:none;}

/* Working orders (resting limit/stop tickets, cancellable) */
.trade-order-row{
  display:flex;align-items:center;justify-content:space-between;gap:0.5rem;
  padding:0.4375rem 0;
  font-family:var(--font-mono);font-size:max(0.6875rem, var(--fs-floor));color:var(--text-secondary);
  border-top:1px solid var(--border-subtle);
}
.trade-order-row:first-child{border-top:none;}
/* T9 fix c (2026-10-24): a two line blotter row. Line one is the symbol and
   side ("NVDA Buy"), line two the size, short type and price
   ("1 Lmt US$100.00"), so every part reads whole in the narrowest ticket
   (1280: 192px) and nothing takes an ellipsis. Cancel sits at the end of
   line one: shown on hover or focus, and always in the flow where there is
   no hover (touch). */
.trade-order-row{position:relative;align-items:flex-start;}
.trade-order-txt{min-width:0;flex:1 1 auto;font-family:var(--font-sans);
  display:flex;flex-direction:column;gap:0.0625rem;}
.trade-order-l1,.trade-order-l2{display:flex;flex-wrap:wrap;column-gap:0.375em;min-width:0;}
.trade-order-sym{flex:none;color:var(--text-primary);font-weight:600;}
.trade-order-side{flex:none;}
.trade-order-size{flex:none;color:var(--text-muted);}
.trade-order-px{flex:none;font-family:var(--font-mono);font-variant-numeric:tabular-nums;color:var(--text-primary);}
@media (hover:hover){
  .trade-order-cancel{opacity:0;}
  .trade-order-row:hover .trade-order-cancel,.trade-order-row:focus-within .trade-order-cancel{opacity:1;}
  .trade-order-row:hover .trade-order-cancel:hover{background:var(--red-dim);}
}
.trade-order-cancel{
  flex:none;width:1.25rem;height:1.25rem;min-width:var(--ctl-floor);min-height:var(--ctl-floor);border:none;border-radius:var(--tp-r);
  background:transparent;color:var(--text-muted);cursor:pointer;
  font-size:max(0.6875rem, var(--fs-floor));line-height:1;
  transition:color var(--dur-fast),background var(--dur-fast);
}
.trade-order-cancel:hover{color:var(--red);background:var(--red-dim);}
/* T9 feel: a cancel strikes its row at once; the server answer removes it
   (or un-strikes it with an error). No undo: a cancel is final. */
.trade-order-row.is-cancelling .trade-order-txt{text-decoration:line-through;color:var(--text-muted);}
.trade-order-row.is-cancelling .trade-order-cancel{opacity:0;pointer-events:none;}

/* ── Submit CTA + mode label (inline, directly under Money Line) ─ */
.trade-submit{
  width:calc(100% - 2rem);height:2.5rem;margin:0.625rem 1rem 0;
  border:none;border-radius:var(--tp-r);cursor:pointer;
  font-family:var(--font-sans);font-size:0.8125rem;font-weight:700;
  letter-spacing:.01em;color:var(--on-accent);
  background:var(--green);
  transition:filter var(--dur-fast),transform var(--dur-fast),opacity var(--dur-fast);
}
.trade-modal.is-sell .trade-submit{background:var(--red);}
/* Disabled = a quiet reason state, not a dead grey slab: muted ink on the
   panel material, the reason text still legible. */
.trade-submit:disabled{
  background:var(--bg-tertiary);color:var(--text-muted);
  box-shadow:inset 0 0 0 1px var(--border-default);
  cursor:not-allowed;opacity:1;
}
.trade-modal.is-sell .trade-submit:disabled{background:var(--bg-tertiary);}
/* A reason that needs two lines ("Short entries need a market order" in the
   docked column) grows the button instead of touching its edges. */
.trade-submit:disabled{height:auto;min-height:2.5rem;padding:0.375rem 0.75rem;line-height:1.25;}
#trade-overlay.is-docked .trade-submit:disabled{height:auto;min-height:2.25rem;}
.trade-submit:hover:not(:disabled){filter:brightness(1.07);}
.trade-submit:active:not(:disabled){transform:scale(0.99);}
.trade-submit:focus-visible{outline:none;box-shadow:inset 0 0 0 1px var(--accent);}
.trade-foot{
  margin:0.4375rem 1rem 0;
  font-family:var(--font-mono);font-size:max(0.5rem, var(--fs-floor));
  color:var(--text-xmuted);letter-spacing:normal;
  text-align:center;text-transform:none;
}

/* Extra-compact rhythm for very short windows so the whole ticket
   (head → CTA) still fits. */
@media (max-height:680px){
  .trade-head{height:40px;}
  .trade-mode-row{margin-top:8px;}
  .trade-side{margin-top:8px;}
  .trade-side-btn{height:27px;}
  .trade-type-row{margin-top:8px;}
  .trade-market{margin-top:8px;}
  .trade-avail{padding-top:10px;}
  .trade-pill{height:34px;margin-top:8px;}
  .trade-slider{margin-top:10px;}
  .trade-recent{margin-top:10px;}
  .trade-submit{height:34px;}
}

/* ============================================================================
   Wallet / Portfolio view (full-canvas account page) — "Cavalry Capital"
   Minimal-expensive redesign. All color via tokens.css (auto dark/light).
   Reused primitives kept: .pf-cards/.pf-card/.pf-table/.pf-section-title/
   .pf-up/.pf-down/.pf-side/.pf-buy/.pf-sell/.pf-hold/.pf-deposit — the AI-Trader
   and IBKR views lean on them, so they stay styled here.
   ============================================================================ */
#wallet-view{overflow:hidden;}
#ibkr-view{overflow:hidden;}
.pf-scroll{width:100%;height:100%;overflow-y:auto;}
/* No background wash. The two radial gradients that used to bleed down from the
   top corners (champagne right, accent left) read as a stray tint against the
   flat page, so the surface is plain now. Shared by the Wallet, Settings,
   Paper Trading and IBKR account pages. */
.pf-wrap{
  max-width:84rem;margin:0 auto;padding:2.4rem 2.8rem 5rem;
}
/* View-entry content hold (portfolio.js wcHoldContent): the wallet has no
   hidden root, so without this its STALE previous content flashes for the
   veil's 160ms grace window on every entry — the "flicker before the loading
   screen". visibility (not display) keeps layout/scroll geometry stable. */
.pf-wrap.wc-hold > *{visibility:hidden;}
.pf-loading,.pf-empty{padding:2rem 0;color:var(--text-muted);font-size:0.9rem;font-family:var(--font-sans);}
.pf-empty{padding:1.4rem 0;color:var(--text-muted);}

/* eyebrow / hairline rule */
.pf-eyebrow{text-transform:none;letter-spacing:normal;font-size:max(.68rem, var(--fs-floor));color:var(--text-muted);font-weight:600;}
.pf-rule{height:1px;background:var(--champagne-ring);border:0;margin:2.8rem 0;}
.pf-rule.soft{background:var(--border-subtle);}

/* top bar */
.pf-header{display:flex;align-items:center;gap:1.1rem;margin-bottom:3rem;}
.pf-head-left{display:flex;align-items:center;gap:1rem;}
.pf-crest{
  width:42px;height:42px;flex:none;border:1px solid var(--champagne-ring);border-radius:50%;
  display:flex;align-items:center;justify-content:center;color:var(--champagne);
  font-family:var(--font-display);font-size:1.1rem;font-weight:600;background:transparent;cursor:pointer;
  padding:0;transition:background .15s;
}
.pf-crest:hover{background:var(--champagne-dim);}
.pf-crest svg{display:block;}
.pf-brand{line-height:1.2;}
.pf-brand .n{font-family:var(--font-display);font-size:1.5rem;font-weight:600;color:var(--text-primary);letter-spacing:-.01em;}
.pf-brand .s{font-family:var(--font-mono);font-size:max(.6rem, var(--fs-floor));letter-spacing:normal;text-transform:none;color:var(--champagne);}
.pf-header h2{margin:0;font-family:var(--font-display);font-size:1.5rem;font-weight:600;color:var(--text-primary);}
.pf-actions{display:flex;align-items:center;gap:1.4rem;margin-left:auto;}
/* Paper / IBKR section toggle (the two switchable wallet sections) */
.pf-modetog{display:inline-flex;border:1px solid var(--border-default);border-radius:3px;overflow:hidden;}
.pf-modetog button{background:transparent;border:0;color:var(--text-muted);font-family:var(--font-mono);font-size:max(.68rem, var(--fs-floor));letter-spacing:normal;text-transform:none;padding:.42rem .85rem;cursor:pointer;transition:background .12s,color .12s;}
.pf-modetog button.on{background:var(--champagne-dim);color:var(--champagne);}
.pf-modetog button:hover:not(.on){color:var(--text-secondary);}

/* ══════════════════════════════════════════════════════════════════════════
   MPConfirm (.wcx-*) — the in product confirmation
   ══════════════════════════════════════════════════════════════════════════
   Built by mpConfirm() in js/wallet/portfolio.js; replaces window.confirm()
   on every destructive wallet/IBKR action (IBKR disconnect from BOTH the
   wallet section and /watchlist/ibkr, wallet reset, margin on/off).

   NOT a new shell invented from scratch. The house already has a centred
   modal in .alert-dialog/.alert-card (13-widgets.css, the chart's price alert
   form) and this matches its conventions exactly — fixed full-viewport scrim,
   --bg-elevated card, `inset ring + --shadow-modal` chrome, right-aligned
   button pair. It is a separate class set rather than a reuse because
   .alert-* is a FORM bound to chart/alerts.js markup, not a confirm shell;
   generalising it would mean editing the chart's alert flow to serve the
   wallet, which is a worse coupling than sharing the conventions.

   The card's middle is the trust ledger's dt/dd rhythm (.ibx-led-row below),
   deliberately: the connect surface earns trust by answering questions in
   that shape, so the dialog that UNDOES the connection answers its questions
   the same way instead of shouting one sentence at the user.

   position:fixed against the viewport is load bearing — it is what lets this
   same dialog serve the ~13rem compact trade dock, where a modal laid out
   inside the column would have nowhere to go.
   1px lines are INSET rings, never borders (they bowtie in headless shots). */
.wcx-scrim{
  position:fixed;inset:0;z-index:10002;   /* above .alert-dialog's 10001 */
  display:grid;place-items:center;padding:1.25rem;
  background:var(--scrim-sheet);
  animation:wc-fade 150ms var(--ease-out);
}
.wcx-card{
  width:min(27rem,100%);max-height:calc(100vh - 3rem);overflow-y:auto;
  padding:clamp(1.15rem,2vw,1.5rem);
  background:var(--bg-elevated);border-radius:var(--radius-lg);
  box-shadow:inset 0 0 0 1px var(--border-default),var(--shadow-modal);
  animation:wcx-in 200ms var(--ease-out);
}
/* One family (--font-sans) and two sizes across the card (UX pass
   2026-10-05): the title at 14px, every other line at 12px, scaling up
   with the root on large screens (1rem = 14px at 1440). */
/* Caps micro-label, same rank as .ibx-warn-k and the ledger's dt. */
.wcx-kicker{
  display:block;font-size:max(12px, .8571rem);font-weight:600;text-transform:none;
  letter-spacing:normal;color:var(--text-muted);margin-bottom:.4rem;
}
.wcx-title{
  font-family:var(--font-sans);font-size:max(14px, 1rem);font-weight:600;
  line-height:1.4;letter-spacing:0;color:var(--text-primary);
  margin:0;text-wrap:balance;
}
.wcx-body{
  font-size:max(12px, .8571rem);line-height:1.6;color:var(--text-secondary);
  margin:.5rem 0 0;
}
/* The ledger, matching .ibx-ledger row for row. */
.wcx-ledger{
  margin:1rem 0 0;padding:.9rem 0 0;display:flex;flex-direction:column;
  box-shadow:inset 0 1px 0 var(--border-subtle);
}
.wcx-row{padding:.55rem 0;}
.wcx-row + .wcx-row{box-shadow:inset 0 1px 0 var(--border-subtle);}
.wcx-row dt{
  font-size:max(12px, .8571rem);font-weight:600;text-transform:none;
  letter-spacing:normal;color:var(--text-secondary);margin-bottom:.2rem;
}
.wcx-row dd{margin:0;font-size:max(12px, .8571rem);line-height:1.55;color:var(--text-muted);}
/* Right-aligned pair, house convention (.alert-btns). Cancel sits LEFT of the
   confirm and takes focus on open: the emphasised button is the one we do not
   want mis-clicked, so the safe path is the one already under the focus ring. */
.wcx-act{display:flex;justify-content:flex-end;flex-wrap:wrap;gap:.5rem;margin-top:1.35rem;}
.wcx-btn{
  flex:0 1 auto;display:inline-flex;align-items:center;justify-content:center;
  padding:.55rem 1.05rem;border:0;border-radius:var(--radius);
  background:var(--accent);color:var(--on-accent);
  font-family:var(--font-sans);font-weight:600;font-size:max(12px, .8571rem);line-height:1.2;
  cursor:pointer;transition:filter .12s,transform .1s,background .12s,color .12s;
}
.wcx-btn:hover{filter:brightness(1.08);}
.wcx-btn:active{transform:translateY(1px);}
.wcx-btn:focus-visible{outline:none;box-shadow:inset 0 0 0 1px var(--accent);}
/* Destructive. --red is the P&L/danger token and this is a real loss of state,
   so it is the honest choice; white ink holds contrast on it in both themes. */
.wcx-btn.danger{background:var(--red);color:var(--on-accent-bright);}
.wcx-btn.danger:focus-visible{box-shadow:inset 0 0 0 1px var(--red);}
.wcx-btn.ghost{
  background:transparent;color:var(--text-secondary);
  box-shadow:inset 0 0 0 1px var(--border-default);
}
.wcx-btn.ghost:hover{color:var(--text-primary);background:var(--bg-hover);filter:none;}
@keyframes wcx-in{from{opacity:0;transform:translateY(10px) scale(.985);}}
@media (max-width:30rem){
  /* Stacked and full width, safe action on TOP so the thumb rests on it. */
  .wcx-act{flex-direction:column-reverse;}
  .wcx-btn{width:100%;}
}
@media (prefers-reduced-motion:reduce){
  .wcx-scrim,.wcx-card{animation:none;}
  .wcx-btn{transition:none;}
}

/* ══════════════════════════════════════════════════════════════════════════
   IBKR CONNECT SURFACE (.ibx-*)
   Shared by the wallet's IBKR section AND /watchlist/ibkr — both templates
   load this file, and the markup comes from ONE builder (window.IbkrConnect
   in js/wallet/portfolio.js), so the two cannot drift apart.

   What this deliberately is NOT: the small centred card it replaces
   (.pf-connect / .ibkr-account-wrap), which was a decorative crest over a big
   noun over a tiny caption over a pill button, floating in an ocean of empty
   canvas. Real brokerage-link UIs are dense and in context (TradingView's IBKR
   connect lives inside the trading panel; Betterment's inside Settings), and
   at the connect moment they remove decoration and add specificity: the money
   claims are spelled out and checkable, the wait is a step tracker rather than
   an ornament, and no pixel is spent on a glyph that means nothing.

   Chrome comes from the shared .cc-section card, so light and dark both fall
   out of tokens.css. 1px lines are INSET rings, never real borders (they
   bowtie in headless screenshots). No colour is spent on an idle state.
   ══════════════════════════════════════════════════════════════════════════ */
.ibx-grid{
  display:grid;grid-template-columns:minmax(0,1.55fr) minmax(0,1fr);
  gap:clamp(0.75rem,1.1vw,1.125rem);align-items:start;
  margin-top:clamp(0.75rem,1.1vw,1.125rem);
}
/* Card chrome, spelled out. The .cc-section shell only self-decorates inside
   .cc-layout (07-command-center.css), and this surface is not that grid, so it
   carries the same surface + inset ring + radius explicitly rather than
   inheriting a whole grid system it does not use. Values are copied from
   .cc-layout .cc-section on purpose: these must stay the same card. */
.ibx,.ibx-side{
  background:var(--bg-tertiary);
  box-shadow:inset 0 0 0 1px var(--border-default);
  border-radius:var(--radius-lg);
  gap:0;
}
.ibx{padding:clamp(1.15rem,1.8vw,1.65rem);}
.ibx-side{padding:0;}
/* The side panel wears the in-card header shelf the dense panels use. */
.ibx-side .cc-section-head{
  flex:none;padding:0.6875rem 1.25rem 0.5625rem;
  border-bottom:1px solid var(--border-subtle);
}
.ibx-side .ibx-ledger{padding:0.35rem 1.25rem 0.85rem;}
/* The panel head is a sentence, not a masthead: it names both parties and the
   verb ("Cavalry places your orders through your own Interactive Brokers
   account"), which is what real link screens use in place of a bare noun. */
.ibx-head{max-width:44rem;}
.ibx-title{
  font-family:var(--font-display);font-size:clamp(1.05rem,1.35vw,1.3rem);
  font-weight:600;line-height:1.3;letter-spacing:-.011em;
  color:var(--text-primary);margin:0 0 .5rem;
  text-wrap:balance;   /* never strand "account." on its own line */
}
.ibx-lede{font-size:.8125rem;line-height:1.6;color:var(--text-secondary);margin:0;}

/* ── Step tracker: the spine of the whole surface ──────────────────────────
   NN/g's rule for waits past ~10s is a step indicator, not a looping spinner,
   and status text that actually changes. The gateway boot budget is 20s, so
   this is that case. There is deliberately NO progress bar: the server reports
   no progress, and drawing one would claim knowledge we do not have. */
.ibx-steps{
  list-style:none;margin:1.25rem 0 0;padding:1.1rem 0 0;
  box-shadow:inset 0 1px 0 var(--border-subtle);
  display:flex;flex-direction:column;gap:.1rem;
}
.ibx-step{position:relative;display:grid;grid-template-columns:auto minmax(0,1fr);gap:.7rem;padding:.5rem 0;align-items:start;}
/* The rail between the numbers, so three rows read as one sequence rather than
   three unrelated lines. Anchored to the ROW (whose height varies with the live
   detail text), never to the fixed-height dot. */
.ibx-step:not(:last-child)::before{
  content:'';position:absolute;left:.675rem;margin-left:-.5px;
  top:1.95rem;bottom:-.5rem;width:1px;background:var(--border-default);
}
.ibx-dot{
  position:relative;flex:none;width:1.35rem;height:1.35rem;border-radius:50%;
  display:grid;place-items:center;
  font-family:var(--font-mono);font-size:max(.6875rem, var(--fs-floor));font-weight:700;line-height:1;
  color:var(--text-muted);background:var(--bg-tertiary);
  box-shadow:inset 0 0 0 1px var(--border-default);
  font-variant-numeric:tabular-nums;
}
.ibx-step-txt{display:flex;flex-direction:column;gap:.2rem;min-width:0;padding-top:.1rem;}
.ibx-step-label{
  font-size:.8125rem;font-weight:600;line-height:1.35;color:var(--text-muted);
}
.ibx-step-detail{font-size:.75rem;line-height:1.5;color:var(--text-muted);}
/* The elapsed clock is honest and unglamorous: mono, tabular, quiet. */
.ibx-elapsed{
  font-family:var(--font-mono);font-variant-numeric:tabular-nums;
  font-size:max(.6875rem, var(--fs-floor));color:var(--text-xmuted);margin-left:.3rem;
}
/* Ramp: todo is silent, next is legible, live is champagne (the app's
   in-progress money colour), done is green, fail is red. */
.ibx-step[data-st="next"] .ibx-step-label{color:var(--text-secondary);}
.ibx-step[data-st="next"] .ibx-dot{color:var(--text-secondary);}
.ibx-step[data-st="live"] .ibx-step-label{color:var(--text-primary);}
.ibx-step[data-st="live"] .ibx-step-detail{color:var(--text-secondary);}
.ibx-step[data-st="live"] .ibx-dot{
  color:var(--champagne);background:var(--champagne-dim);
  box-shadow:inset 0 0 0 1px var(--champagne-ring);
}
/* Motion means RUNNING and only running; every terminal state is static, so a
   separate spinner is never needed anywhere on this surface. */
.ibx-step[data-st="live"] .ibx-dot::before{
  content:'';position:absolute;inset:-.28rem;border-radius:50%;
  box-shadow:0 0 0 0 var(--champagne-ring);
  animation:ibxPulse 1.9s ease-out infinite;
}
@keyframes ibxPulse{
  0%{box-shadow:0 0 0 0 var(--champagne-ring);}
  70%{box-shadow:0 0 0 .45rem transparent;}
  100%{box-shadow:0 0 0 0 transparent;}
}
.ibx-step[data-st="done"] .ibx-step-label{color:var(--text-secondary);}
.ibx-step[data-st="done"] .ibx-dot{
  color:var(--green);background:var(--green-dim);
  box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--green) 34%,transparent);
}
.ibx-step[data-st="fail"] .ibx-step-label{color:var(--text-primary);}
.ibx-step[data-st="fail"] .ibx-step-detail{color:var(--red);}
.ibx-step[data-st="fail"] .ibx-dot{
  color:var(--red);background:var(--red-dim);
  box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--red) 38%,transparent);
}

/* ── Actions. Primary is a real rectangular button labelled with the literal
   action, and the alternate path is a labelled ghost beside it, never a
   co-equal pill pair. ── */
.ibx-act{display:flex;flex-wrap:wrap;gap:.6rem;margin-top:1.25rem;}
.ibx-btn{
  flex:1 1 15rem;display:inline-flex;align-items:center;justify-content:center;
  padding:.7rem 1.25rem;border:0;border-radius:var(--radius);
  background:var(--accent);color:var(--on-accent);text-decoration:none;
  font-family:var(--font-display);font-weight:700;font-size:.8125rem;
  cursor:pointer;transition:filter .12s,transform .1s;
}
.ibx-btn:hover:not(:disabled){filter:brightness(1.08);}
.ibx-btn:active:not(:disabled){transform:translateY(1px);}
.ibx-btn:focus-visible{outline:none;box-shadow:inset 0 0 0 1px var(--accent);}
/* An inert button is a STATUS, not a broken call to action: it drops off the
   accent entirely rather than sitting there as a faded green bar. The live step
   dot is what carries motion while this reads. */
.ibx-btn:disabled{
  cursor:default;background:var(--bg-elevated);color:var(--text-muted);
  box-shadow:inset 0 0 0 1px var(--border-default);
}
.ibx-btn.ghost{
  flex:0 1 auto;background:transparent;color:var(--text-secondary);
  font-family:var(--font-sans);font-weight:600;
  box-shadow:inset 0 0 0 1px var(--border-default);
}
.ibx-btn.ghost:hover{color:var(--text-primary);background:var(--bg-hover);}
.ibx-foot{font-size:.75rem;line-height:1.55;color:var(--text-muted);margin:.7rem 0 0;}
/* The single-session fact sits apart from the instructions: it is a warning
   about the user's OTHER sessions, not a step. */
.ibx-fineprint{
  font-size:max(.6875rem, var(--fs-floor));line-height:1.55;color:var(--text-xmuted);
  margin:1rem 0 0;padding-top:.8rem;box-shadow:inset 0 1px 0 var(--border-subtle);
}
/* Certificate step. Rendered ONLY after we measure that this browser distrusts
   the gateway origin, so it never fires in production. Amber, because it is a
   real instruction the user must follow, not a failure. */
.ibx-warn{
  margin-top:1.1rem;padding:.8rem .9rem;border-radius:var(--radius);
  /* Mixed off --amber rather than --warn-surface: the flat warn surface is
     tuned for toasts and lands far heavier than this in dark, where it reads
     as an error. This is an instruction, so it stays a tint in both themes. */
  background:color-mix(in srgb,var(--amber) 11%,var(--bg-elevated));
  box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--amber) 28%,transparent);
}
.ibx-warn-k{
  display:block;font-size:max(.625rem, var(--fs-floor));font-weight:700;text-transform:none;
  letter-spacing:normal;color:var(--amber);margin-bottom:.3rem;
}
.ibx-warn p{margin:0;font-size:.75rem;line-height:1.55;color:var(--text-secondary);}
.ibx-warn b{color:var(--text-primary);font-weight:700;}

/* ── Trust ledger. Four checkable claims about THIS system in a definition
   list, because each one is a term and its real answer. This is what replaces
   a security slogan. ── */
.ibx-ledger{margin:0;padding:0;display:flex;flex-direction:column;}
.ibx-led-row{padding:.7rem 0;}
.ibx-led-row + .ibx-led-row{box-shadow:inset 0 1px 0 var(--border-subtle);}
.ibx-led-row dt{
  font-size:max(.6875rem, var(--fs-floor));font-weight:700;text-transform:none;
  letter-spacing:normal;color:var(--text-secondary);margin-bottom:.25rem;
}
.ibx-led-row dd{margin:0;font-size:.75rem;line-height:1.55;color:var(--text-muted);}

/* Entrance: joins the wallet's existing cascade rather than inventing one, and
   is applied by the JS to the FIRST paint only (.ibx-in) — the panel rebuilds
   on every step transition, and re-running the rise each time would read as the
   page reloading under the user mid flow. */
.ibx-in .ibx{animation:wc-rise 540ms var(--ease-out) 140ms backwards;}
.ibx-in .ibx-side{animation:wc-rise 540ms var(--ease-out) 210ms backwards;}

/* ══════════════════════════════════════════════════════════════════════════
   THE SEAL (.ibx-seal-*) — the success confirmation
   ══════════════════════════════════════════════════════════════════════════
   Replaces the step tracker at data-phase="connected" (sealHtml() in
   js/wallet/portfolio.js). The stepper spent the whole flow as three numbered
   rows; success collapses them into ONE mark, because the flow resolving is
   the thing being expressed.

   THE MOTION, in order and why it is that order:
     0ms   plate fades up from 0.82 scale — the mark arrives, it was not
           already sitting there
     80ms  ring sweeps closed from 12 o'clock over 500ms — the WAIT completing
     400ms check strokes through it over 300ms — the VERDICT, landing while
           the ring is still finishing so the two read as one gesture rather
           than two animations queued back to back
     540ms the whole mark takes a single 4% settle — a signet pressed
     620ms one accent bloom lifts off and dissipates, and the two text lines
           rise in behind it
     ~900ms settled. This is SEAL_MS in the JS; the two must stay in step or
           the handoff cuts its own animation off.

   Everything is CSS on two dash lengths — no JS drives a frame. The dash
   values are the exact path geometry from sealHtml() and are commented at
   each site; changing a path without changing its dasharray makes the stroke
   draw from the wrong offset (usually: a check that starts half drawn).

   Colour is --accent throughout, never --green: tokens.css reserves
   --green/--red for real market P&L and sends decorative greens to --accent.
   They resolve to the same hex in both themes, so this is a semantics-only
   distinction that costs nothing on screen. Both themes fall out of the
   tokens; nothing here is a literal.
   1px lines stay INSET rings (they bowtie in headless screenshots). */
/* At 'connected' the wide shell drops its side card (paint() stops emitting it)
   and the grid collapses to the one remaining column, so the seal is centred in
   the full width instead of stranded in a 1.55fr column beside a gap. */
.ibx-grid-solo{grid-template-columns:minmax(0,1fr);}
.ibx-seal{
  display:flex;flex-direction:column;align-items:center;text-align:center;
  padding:clamp(1.5rem,3.4vw,2.9rem) 0 clamp(1.1rem,2.2vw,1.9rem);
}
/* The entrance lives on the PLATE and the settle on the SVG inside it. Both on
   one element would mean two animations writing `transform`, where the later
   one wins for the whole duration and eats the entrance. */
.ibx-seal-mark{
  position:relative;flex:none;width:4.5rem;height:4.5rem;
  display:grid;place-items:center;
  animation:ibxSealIn 300ms var(--ease-out) both;
}
.ibx-seal-svg{
  width:100%;height:100%;overflow:visible;transform-origin:50% 50%;
  /* No fill mode on purpose: the keyframe ends where it started, and a
     `forwards` fill would pin a transform on this node for good. */
  animation:ibxSealSettle 420ms var(--ease-out) 540ms;
}
.ibx-seal-track{stroke:var(--border-default);stroke-width:2.5;}
/* dasharray 126 == 2πr at r=20 (125.66), rounded up so the gap fully closes. */
.ibx-seal-ring{
  stroke:var(--accent);stroke-width:2.5;stroke-linecap:round;
  stroke-dasharray:126;stroke-dashoffset:126;
  transform:rotate(-90deg);transform-origin:50% 50%;   /* start at 12 o'clock */
  animation:ibxSealRing 500ms cubic-bezier(.3,.82,.28,1) 80ms forwards;
}
/* dasharray 26 == the check's own length (8.6 + 16.8 ≈ 25.5), rounded up. */
.ibx-seal-tick{
  stroke:var(--accent);stroke-width:3;stroke-linecap:round;stroke-linejoin:round;
  stroke-dasharray:26;stroke-dashoffset:26;
  animation:ibxSealTick 300ms cubic-bezier(.25,.7,.3,1) 400ms forwards;
}
/* Spread-based, matching the live step dot's ibxPulse, so the one celebratory
   flourish on this surface speaks the same language as its working state. */
.ibx-seal-bloom{
  position:absolute;inset:0;border-radius:50%;pointer-events:none;
  box-shadow:0 0 0 0 var(--accent-glow);
  animation:ibxSealBloom 720ms var(--ease-out) 620ms both;
}
.ibx-seal-title{
  font-family:var(--font-display);font-size:clamp(1rem,1.25vw,1.2rem);
  font-weight:600;letter-spacing:-.011em;line-height:1.3;
  color:var(--text-primary);margin:1.15rem 0 0;
  animation:wc-rise 420ms var(--ease-out) 640ms backwards;
}
.ibx-seal-sub{
  font-size:.8125rem;line-height:1.6;color:var(--text-secondary);
  margin:.35rem 0 0;max-width:26rem;text-wrap:balance;
  animation:wc-rise 420ms var(--ease-out) 700ms backwards;
}
/* ── The loading row. Shipped [hidden]; the JS reveals it ONLY if the real
   account payload is still in flight once the check has settled, so a fast
   connect never shows a spinner at all.
   The bar is INDETERMINATE by design and that is not a dodge: this surface
   already refuses to draw a progress bar because the server reports no
   progress, and inventing a percentage here would be the same lie. A
   travelling hairline says "running", which is all we know. ── */
.ibx-seal-load{
  display:flex;flex-direction:column;align-items:center;gap:.6rem;
  width:100%;max-width:17rem;margin-top:1.35rem;padding-top:1.05rem;
  box-shadow:inset 0 1px 0 var(--border-subtle);
  animation:wc-fade 280ms var(--ease-out) backwards;
}
/* `display:flex` above beats the [hidden] UA rule, so it has to be restated. */
.ibx-seal-load[hidden]{display:none;}
.ibx-seal-track-line{
  position:relative;width:100%;height:2px;border-radius:1px;
  overflow:hidden;background:var(--border-default);
}
.ibx-seal-track-line > i{
  position:absolute;top:0;bottom:0;left:0;width:40%;border-radius:1px;
  background:var(--accent);
  animation:ibxSealScan 1.15s var(--ease-in-out) infinite;
}
.ibx-seal-load-txt{
  font-size:max(.6875rem, var(--fs-floor));font-weight:700;text-transform:none;
  letter-spacing:normal;color:var(--text-muted);
}
@keyframes ibxSealIn{from{opacity:0;transform:scale(.82);}}
@keyframes ibxSealRing{to{stroke-dashoffset:0;}}
@keyframes ibxSealTick{to{stroke-dashoffset:0;}}
@keyframes ibxSealSettle{50%{transform:scale(1.04);}}
@keyframes ibxSealBloom{
  0%{box-shadow:0 0 0 0 var(--accent-glow);opacity:1;}
  100%{box-shadow:0 0 0 .95rem transparent;opacity:0;}
}
@keyframes ibxSealScan{
  0%{transform:translateX(-100%);}
  100%{transform:translateX(250%);}
}

@media (max-width:60rem){
  .ibx-grid{grid-template-columns:minmax(0,1fr);}
}
@media (max-width:34rem){
  .ibx-act{flex-direction:column;}
  .ibx-btn{flex:1 1 auto;width:100%;}
}
@media (prefers-reduced-motion:reduce){
  .ibx-step[data-st="live"] .ibx-dot::before{animation:none;}
  .ibx-btn{transition:none;}
  .ibx-in .ibx,.ibx-in .ibx-side{animation:none;}
  /* The seal renders in its FINAL state: ring closed, check drawn, nothing
     draws, nothing blooms. The confirmation is still made — it is just stated
     rather than performed. SEAL_MS_REDUCED in the JS shortens the handoff to
     match, so this does not sit on a still frame for 900ms. */
  .ibx-seal-mark,.ibx-seal-svg,.ibx-seal-title,.ibx-seal-sub,.ibx-seal-load{animation:none;}
  .ibx-seal-ring,.ibx-seal-tick{animation:none;stroke-dashoffset:0;}
  .ibx-seal-bloom{display:none;}
  /* An indeterminate bar that cannot travel is worse than no bar: held still it
     reads as a full progress bar, i.e. finished. The label carries the state on
     its own here. */
  .ibx-seal-track-line{display:none;}
}

/* ══════════════════════════════════════════════════════════════════════════
   COMPACT SHELL (.ibx-compact) — the SAME connect surface in the trade dock
   ══════════════════════════════════════════════════════════════════════════
   Added 2026-07-25 with the inline connect flow: clicking Live in the trade
   panel mounts window.IbkrConnect here (js/wallet/ibkr-mode.js) instead of
   navigating to /watchlist/ibkr. The markup, the copy and the state machine are
   the SAME builder — only the shell differs, and this file is where "different
   shell" is spelled out.

   WHAT THIS IS NOT: the page surface scaled down. --trade-w is
   clamp(14.5rem,19vw,18.25rem), so the readable column here is ~11–15rem. The
   page's clamp(1.05rem,1.35vw,1.3rem) display title, its 1.65rem card padding,
   its 15rem-basis side-by-side buttons and its second column would each break
   on their own at that width. So this shell:
     · drops the card chrome entirely — the surface is already inside the
       ticket's own card, and a card in a card reads as a bug;
     · re-sets the type ramp for a narrow measure rather than shrinking it
       proportionally (a 1.3rem display line over ~13rem is four words a line);
     · stacks every action FULL WIDTH, primary first — the dock has no room for
       a primary/ghost pair on one line and never will;
     · moves the four trust-ledger rows into a disclosure (the wide shell's
       aside), so the claims stay reachable instead of page-only.

   Every override is scoped under .ibx-compact, so its specificity beats the
   shared base rules regardless of source order and the page/wallet surface
   cannot be reached from here. No new colour: all of it is tokens.css via the
   base .ibx-* rules. 1px lines stay INSET rings (they bowtie in headless
   screenshots). Motion matches the dock's .22s var(--ease-glide), not the
   wallet canvas's 540ms rise. */
.ibx-compact{margin:0;}
/* Card chrome off: no surface, no ring, no radius, no padding. The ticket's
   .trade-scroll already supplies the padding and the panel supplies the card. */
.ibx-compact .ibx{
  background:transparent;box-shadow:none;border-radius:0;padding:0;
  display:block;
}
.ibx-compact .ibx-head{max-width:none;}
/* Sentence, not masthead — at this measure the display face at page size wraps
   to four words a line, so it steps down to the ticket's own label scale. */
.ibx-compact .ibx-title{
  font-size:0.8125rem;line-height:1.4;letter-spacing:-.004em;
  margin:0 0 .35rem;
}
.ibx-compact .ibx-lede{font-size:max(0.6875rem, var(--fs-floor));line-height:1.5;}
.ibx-compact .ibx-steps{margin:.8rem 0 0;padding:.75rem 0 0;gap:0;}
.ibx-compact .ibx-step{gap:.5rem;padding:.4rem 0;}
/* Smaller dot buys ~0.3rem of text column, and the connector rail must follow
   it: left is half the dot, top clears it. */
.ibx-compact .ibx-dot{width:1.15rem;height:1.15rem;font-size:max(0.625rem, var(--fs-floor));}
.ibx-compact .ibx-step:not(:last-child)::before{left:.575rem;top:1.55rem;bottom:-.4rem;}
.ibx-compact .ibx-step-label{font-size:0.75rem;line-height:1.3;}
.ibx-compact .ibx-step-detail{font-size:max(0.6875rem, var(--fs-floor));line-height:1.45;}
.ibx-compact .ibx-elapsed{font-size:max(0.625rem, var(--fs-floor));margin-left:.25rem;}
/* Actions: one per row, full width, primary first. Labels here run to 32
   characters ("Bring the sign in window forward"), which cannot fit one line at
   any honest size in ~13rem — so the button wraps and centres instead of
   clipping, and nothing relies on a nowrap that would overflow the dock. */
.ibx-compact .ibx-act{flex-direction:column;flex-wrap:nowrap;gap:.4rem;margin-top:.9rem;}
.ibx-compact .ibx-btn{
  flex:0 0 auto;width:100%;padding:.55rem .7rem;
  font-size:0.75rem;line-height:1.3;text-align:center;
}
.ibx-compact .ibx-foot{font-size:max(0.6875rem, var(--fs-floor));line-height:1.45;margin-top:.5rem;}
.ibx-compact .ibx-fineprint{font-size:max(0.625rem, var(--fs-floor));line-height:1.45;margin-top:.75rem;padding-top:.6rem;}
.ibx-compact .ibx-warn{margin-top:.8rem;padding:.6rem .65rem;}
.ibx-compact .ibx-warn p{font-size:max(0.6875rem, var(--fs-floor));line-height:1.45;}
/* Trust ledger as a disclosure — the wide shell's aside, folded. Closed by
   default because the dock is a working surface, not a landing page; the rows
   themselves are byte-identical to the page's. */
.ibx-compact .ibx-cl{margin-top:.8rem;padding-top:.7rem;box-shadow:inset 0 1px 0 var(--border-subtle);}
.ibx-compact .ibx-cl > summary{
  display:flex;align-items:center;gap:.35rem;cursor:pointer;list-style:none;
  font-family:var(--font-sans);font-size:max(0.625rem, var(--fs-floor));font-weight:700;
  text-transform:none;letter-spacing:normal;
  color:var(--text-secondary);
}
.ibx-compact .ibx-cl > summary::-webkit-details-marker{display:none;}
/* Own chevron: a rotating glyph reads as a disclosure at 10px where the UA
   triangle does not, and it inherits currentColor in both themes. */
.ibx-compact .ibx-cl > summary::before{
  content:'';flex:none;width:0;height:0;
  border-left:.28rem solid currentColor;
  border-top:.22rem solid transparent;border-bottom:.22rem solid transparent;
  transition:transform var(--dur-fast) var(--ease-glide);
}
.ibx-compact .ibx-cl[open] > summary::before{transform:rotate(90deg) translateX(.03rem);}
.ibx-compact .ibx-cl > summary:hover{color:var(--text-primary);}
.ibx-compact .ibx-cl > summary:focus-visible{outline:none;box-shadow:inset 0 0 0 1px var(--accent);border-radius:2px;}
.ibx-compact .ibx-ledger{margin-top:.15rem;}
.ibx-compact .ibx-led-row{padding:.5rem 0;}
.ibx-compact .ibx-led-row dt{font-size:max(0.625rem, var(--fs-floor));margin-bottom:.15rem;}
.ibx-compact .ibx-led-row dd{font-size:max(0.6875rem, var(--fs-floor));line-height:1.45;}
/* Entrance rides the dock's glide, not the wallet canvas's 540ms rise, and
   still only on the first paint (.ibx-in) — a repaint per step must not replay
   it. Specificity (0,3,0) beats the shared `.ibx-in .ibx` either way. */
.ibx-compact.ibx-in .ibx{animation:tp-rise .22s var(--ease-glide) both;}
/* Seal in the dock. Same mark, same motion, same copy — only the scale changes,
   because the celebration is the one moment that must feel identical wherever
   the user linked their account. The ~13rem column takes the mark down a size
   and drops the sub line's max-width (the column IS the measure here). */
.ibx-compact .ibx-seal{padding:1.2rem 0 .35rem;}
.ibx-compact .ibx-seal-mark{width:3.25rem;height:3.25rem;}
.ibx-compact .ibx-seal-title{font-size:.875rem;margin-top:.85rem;}
.ibx-compact .ibx-seal-sub{font-size:max(.6875rem, var(--fs-floor));line-height:1.5;max-width:none;}
.ibx-compact .ibx-seal-load{max-width:none;margin-top:1rem;padding-top:.8rem;gap:.5rem;}
.ibx-compact .ibx-seal-load-txt{font-size:max(.5625rem, var(--fs-floor));}
@media (prefers-reduced-motion:reduce){
  .ibx-compact.ibx-in .ibx{animation:none;}
  .ibx-compact .ibx-cl > summary::before{transition:none;}
}

/* ── The takeover itself ──────────────────────────────────────────────────
   #trade-connect is the mount point, parked between the Paper|Live toggle and
   the order form (templates/app.html). ibkr-mode.js flags .trade-modal with
   data-tc="1" while the flow runs, and these two rules are the whole layout
   consequence:
     · the instrument tabs go (Stocks|Options|Futures pick what to trade, and
       there is nothing to trade until the account is linked), along with any
       selected contract card;
     · every LATER sibling of #trade-connect goes — that is exactly the order
       form, the money line, submit, the footer, the open position and the
       activity lists, in one selector that cannot fall out of date as the
       ticket grows rows.
   What survives is the identity head, the Order label and the Paper|Live
   toggle: the user must be able to see which mode they picked and get back to
   Paper without closing the panel.
   Nothing here animates WIDTH — the dock's width is never animated (see the
   .trade-overlay header); this is a display swap inside a fixed column. */
.trade-modal[data-tc="1"] .trade-inst,
.trade-modal[data-tc="1"] .trade-scroll > .trade-contract,
.trade-modal[data-tc="1"] #trade-connect ~ *{display:none;}
/* .trade-scroll has no horizontal padding of its own — every row inside it
   carries the ticket's 1rem gutters (.trade-pill, .trade-mode-row, …), so this
   one does too rather than inventing a second measure. The top seam is a RULE
   line (this is a boundary between sections) drawn as an inset ring. */
.trade-connect{
  margin:.7rem 1rem 0;padding-top:.75rem;
  box-shadow:inset 0 1px 0 var(--border-default);
  /* min-width:0 + a hard clip: nothing in a third-party-driven flow may ever
     push the fixed-width dock into a horizontal scroll. */
  min-width:0;overflow-wrap:break-word;
}
.trade-connect[hidden]{display:none;}

/* ── No floating decoration on the IBKR connect panel ──────────────────────
   A rose-petal field (a port of home's login backdrop) drifted over this panel
   for one day. Owner, 2026-07-26: "I don't want them anymore, the floating
   leaves ... neither the tree leaf nor the flower, none." Removed from BOTH
   IBKR surfaces on the same call — this panel and the standalone
   /watchlist/ibkr page, which had carried an autumn leaf field before that.
   Gone with it: `#wallet-view > .petal-field{display:none}` +
   `#wallet-view.wc-petals > .petal-field{display:block;--petal-z:55}`, the
   {% include "_petal_field.html" %} in app.html, portfolio.js's wcPetalField
   toggle, and static/css/petal-field.css. .wc-petals is not set by anything
   any more; do not re-introduce a decoration class here without a fresh ask.
   The rose PNGs stay at static/rose/ — home's login page still uses its synced
   copies and dashboard/ is the sync SSOT (scripts/sync_shared_assets.py). */

/* ── Grid backdrop must cover the WHOLE scrollable page ────────────────────
   Bug (owner, 2026-07-25): "the square bg ... just the first half". The 60px
   grid is painted by .cc-canvas (07-command-center.css), which asks for
   min-height:100%. That percentage resolves against #pf-wrap, whose own height
   is AUTO — a percentage min-height against an auto-height parent behaves as
   auto, so the canvas ended up exactly as tall as its content (measured: 530px
   of grid inside a 945px .pf-scroll) and the grid stopped mid page.
   Fix the CHAIN rather than hard-coding a viewport height: .pf-scroll already
   has a definite height:100%, so giving .pf-wrap min-height:100% resolves, and
   making it a flex column lets the canvas take the remaining space. flex-grow
   with `0 auto` shrink/basis means SHORT content fills the viewport with no
   seam and LONG content still grows past it, so both ends of the range work.
   /watchlist/ibkr was audited for the same failure on 2026-07-26 and fixed at
   its own chain (css/pages/ibkr.css, "PAGE FRAME + SCROLL CHAIN"). Its shape
   turned out to be different: .ibkr-page's height was already definite there,
   via body's flex stretch, so the percentage resolved — what was broken was
   that the page could not scroll at all. Read that block rather than assuming
   the two fixes are the same edit. */
#wallet-view .pf-wrap{ min-height:100%; display:flex; flex-direction:column; }
#wallet-view .pf-wrap > *{ flex:1 0 auto; }

/* Paper Trading: one bordered block per strategy book */
.pf-book{
  margin-top:1.5rem;padding:1.25rem;
  border:1px solid var(--border-default);border-radius:0.5rem;
  background:var(--bg-secondary);
}
.pf-book-head{display:flex;align-items:center;gap:0.75rem;margin-bottom:1rem;}
.pf-book-head h3{margin:0;font-size:1.0625rem;font-weight:700;color:var(--text-primary);}
.pf-track{
  margin:-0.25rem 0 0.75rem;
  font-family:var(--font-mono);font-size:max(0.6875rem, var(--fs-floor));font-weight:600;
  color:var(--text-secondary);font-variant-numeric:tabular-nums;
}
/* Top-band Account dropdown — reuses the stock-view switcher's menu
   treatment. The band's entrance animation creates a stacking context,
   so when the menu is open the WHOLE band must be lifted above the deck
   sections below (and the .cc-light wash) or the menu paints underneath
   them and reads as glassy/unreadable. */
.cc-account-toggle{justify-self:end;}
.cc-account-toggle .view-menu{z-index:60;}
.cc-band:has(.view-toggle.open){z-index:55;}
.pf-reset{
  background:transparent;border:0;color:var(--text-muted);cursor:pointer;text-decoration:none;
  font-family:var(--font-sans);font-size:.82rem;font-weight:500;transition:color .15s;padding:.2rem 0;
}
.pf-reset:hover{color:var(--red);}
a.pf-reset:hover{color:var(--champagne);}
.pf-deposit{
  padding:.55rem 1.35rem;border-radius:2px;background:transparent;
  border:1px solid var(--champagne-ring);color:var(--champagne);cursor:pointer;
  font-family:var(--font-sans);font-size:.8rem;font-weight:600;letter-spacing:.03em;transition:background .15s;
}
.pf-deposit:hover{background:var(--champagne-dim);}

.pf-equity{font-family:var(--font-mono);font-weight:500;font-size:clamp(2.6rem,5.2vw,4rem);line-height:.9;letter-spacing:-.04em;color:var(--text-primary);font-variant-numeric:tabular-nums;}
.pf-equity .cur{color:var(--text-muted);font-weight:400;font-size:.56em;vertical-align:top;margin-right:.12rem;}
.pf-equity .c{color:var(--text-muted);font-size:.5em;}
.pf-change{display:flex;align-items:baseline;flex-wrap:wrap;gap:1.3rem;margin-top:1.5rem;font-family:var(--font-mono);font-size:.95rem;}
.pf-change .d{font-size:.8rem;color:var(--text-muted);}

.pf-hrtop{display:flex;align-items:baseline;justify-content:space-between;margin-bottom:.5rem;gap:1rem;}
.pf-hrtop .l{font-family:var(--font-mono);font-size:.76rem;color:var(--text-muted);}
.pf-hrtop .l b{color:var(--text-primary);font-weight:500;}
.pf-rng{display:flex;gap:1.1rem;}
/* 13px tall at a 1440 root: a bare text button with no padding is exactly the
   line box, and this row is the only way to change the curve's range. Floored
   sub-reference — at 3072 the same line box is ~20px, so a plain min-height
   would move the reference. Centred so the label does not shift inside the
   taller box. */
.pf-rng button{min-height:var(--ctl-floor-sub);min-width:var(--ctl-floor-sub);background:transparent;border:0;color:var(--text-xmuted);font-family:var(--font-mono);font-size:max(.7rem, var(--fs-floor));letter-spacing:.05em;cursor:pointer;padding:0;}
/* Layout mode below the reference only — see the note on .si-rm in
   03-sources.css. */
@media (max-width:2907.98px){
  .pf-rng button{display:inline-flex;align-items:center;justify-content:center;}
}
.pf-rng button.on{color:var(--champagne);}
.pf-rng button:hover{color:var(--text-secondary);}
/* Ranges longer than the account's history are disabled, not silently no-op. */
.pf-rng button:disabled{opacity:.35;cursor:default;pointer-events:none;}
.pf-curve{position:relative;flex:1;min-height:12rem;}
.pf-curve svg{width:100%;height:100%;display:block;overflow:visible;}
.pf-curve .ax{position:absolute;font-family:var(--font-mono);font-size:max(.64rem, var(--fs-floor));color:var(--text-xmuted);pointer-events:none;}
.pf-curve .pf-nocurve{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;color:var(--text-xmuted);font-family:var(--font-mono);font-size:.74rem;letter-spacing:.04em;}
.pf-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(11.25rem,1fr));gap:0.75rem;margin-bottom:1.625rem;}
.pf-card{
  background:var(--bg-secondary);border:1px solid var(--border-subtle);padding:0.875rem 1rem;
}
.pf-card-click{cursor:pointer;transition:border-color .15s;}
.pf-card-click:hover{border-color:var(--text-muted);}
.pf-card-label{
  font-size:max(0.6875rem, var(--fs-floor));font-weight:700;color:var(--text-muted);
  text-transform:none;letter-spacing:normal;margin-bottom:0.4375rem;
}
.pf-card-value{font-family:var(--font-mono);font-size:1.25rem;font-weight:600;color:var(--text-primary);}
.pf-sub{font-size:0.8125rem;font-weight:600;margin-left:0.25rem;}
.pf-up{color:var(--green);}
.pf-down{color:var(--red);}
/* A ratio the sample cannot support is shown, not hidden — but demoted, so it
   never reads as a finding. Deliberately colour-INDEPENDENT (muted + italic),
   because the sub-line carries the n and the interval in words and this has to
   survive greyscale and colour-vision deficiency. */
.pf-unreliable{color:var(--text-muted);opacity:.72;font-style:italic;}
.pf-short-chip{
  display:inline-block;margin-left:0.375rem;padding:0.0625rem 0.375rem;
  font-size:max(0.625rem, var(--fs-floor));font-weight:700;letter-spacing:normal;text-transform:none;
  color:var(--red);border:1px solid var(--red);border-radius:var(--radius-sm);
  vertical-align:middle;
}
.pf-short-chip[hidden]{display:none;}

/* figures row */
.pf-figs{display:grid;grid-template-columns:repeat(auto-fit,minmax(9rem,1fr));}
.pf-fig{padding:0 2rem;border-left:1px solid var(--border-subtle);}
.pf-fig:first-child{padding-left:0;border-left:0;}
.pf-fig .k{margin-bottom:.8rem;}
.pf-fig .v{font-family:var(--font-mono);font-size:1.55rem;font-weight:500;color:var(--text-primary);letter-spacing:-.01em;}
.pf-fig .sub{font-family:var(--font-mono);font-size:.72rem;color:var(--text-muted);margin-top:.55rem;}

/* section head */
.pf-sh{display:flex;align-items:baseline;gap:1.1rem;margin-bottom:1.8rem;}
.pf-sh h3{margin:0;font-family:var(--font-display);font-weight:600;font-size:1.5rem;color:var(--text-primary);letter-spacing:-.01em;}
.pf-sh .c{font-family:var(--font-mono);font-size:.74rem;color:var(--text-muted);}

/* positions + shared tables */
.pf-table{width:100%;border-collapse:collapse;font-size:.88rem;}
.pf-table th{
  font-family:var(--font-mono);font-size:max(.62rem, var(--fs-floor));text-transform:none;letter-spacing:normal;
  color:var(--text-xmuted);font-weight:500;padding:0 .55rem 1rem;text-align:left;border:0;
}
.pf-table th.num{text-align:right;}
.pf-table th:first-child{padding-left:0;}
.pf-table th:last-child{padding-right:0;}
.pf-table td{padding:1.05rem .55rem;border-bottom:1px solid var(--border-subtle);color:var(--text-secondary);font-family:var(--font-sans);}
.pf-table tbody tr:hover td{background:var(--bg-row-hover);}
.pf-table td:first-child{padding-left:0;}
.pf-table td:last-child{padding-right:0;}
.pf-table .num{text-align:right;font-family:var(--font-mono);color:var(--text-primary);font-variant-numeric:tabular-nums;white-space:nowrap;}
.pf-table .pf-sym{font-family:var(--font-mono);font-weight:600;color:var(--text-primary);}
.pf-up{color:var(--green);}
.pf-down{color:var(--red);}
.pf-side{display:inline-block;padding:2px .45rem;font-size:max(.58rem, var(--fs-floor));font-weight:700;font-family:var(--font-mono);letter-spacing:.05em;border-radius:2px;}
.pf-buy{background:var(--green-dim);color:var(--green);}
.pf-sell{background:var(--red-dim);color:var(--red);}
.pf-hold{background:color-mix(in srgb,var(--amber) 12%,transparent);color:var(--amber);}
.pf-foot{font-family:var(--font-mono);font-size:max(.66rem, var(--fs-floor));letter-spacing:normal;text-transform:none;color:var(--text-xmuted);text-align:center;margin-top:3.2rem;}

/* interactive equity chart (lightweight-charts) — scrub updates the header readout, no floating panel */
.pf-curve{height:18rem;min-height:18rem;}
.pf-benchleg{display:flex;gap:1.3rem;font-family:var(--font-mono);font-size:max(.68rem, var(--fs-floor));color:var(--text-muted);}
.pf-benchleg .i{display:flex;align-items:center;gap:.4rem;}
.pf-benchleg .i i{width:15px;height:2px;display:inline-block;}

/* performance grid: day P/L bars + monthly returns */
.pf-bars{width:100%;height:13rem;position:relative;padding-left:2.9rem;}
.pf-bars svg{width:100%;height:100%;overflow:visible;}
.pf-bars .ax{position:absolute;left:0;width:2.5rem;text-align:right;font-family:var(--font-mono);font-size:max(.6rem, var(--fs-floor));color:var(--text-xmuted);pointer-events:none;}
.pf-bars .pf-bars-note{position:absolute;inset:0 0 0 2.9rem;display:flex;align-items:center;justify-content:center;text-align:center;padding:0 1rem;color:var(--text-xmuted);font-family:var(--font-mono);font-size:.74rem;letter-spacing:.04em;pointer-events:none;}
.pf-bars rect{transition:opacity .1s;}
.pf-bars rect:hover{opacity:.6;}
.pf-months{display:flex;flex-direction:column;gap:5px;}
.pf-months .row{display:flex;align-items:center;gap:.7rem;}
.pf-months .yl{font-family:var(--font-mono);font-size:max(.64rem, var(--fs-floor));color:var(--text-xmuted);width:30px;}
.pf-months .cells{display:grid;grid-template-columns:repeat(12,1fr);gap:4px;flex:1;}
.pf-months{gap:5px;}
.pf-months .row{gap:.7rem;}
.pf-months .yl{width:30px;font-size:max(.64rem, var(--fs-floor));}
.pf-months .cells{gap:4px;}
.pf-months .pf-months-note{min-height:11rem;display:flex;align-items:center;justify-content:center;text-align:center;padding:0 1rem;color:var(--text-xmuted);font-family:var(--font-mono);font-size:.74rem;letter-spacing:.04em;}
.pf-months .c{height:32px;border-radius:2px;display:flex;align-items:center;justify-content:center;font-family:var(--font-mono);font-size:max(.66rem, var(--fs-floor));color:var(--text-primary);cursor:default;}
.pf-mhead{display:grid;grid-template-columns:30px repeat(12,1fr);gap:4px;margin-bottom:.4rem;}
.pf-mhead span{font-size:max(.58rem, var(--fs-floor));}
/* ── hover interactivity: in-place readouts (no floating panels) ── */
/* Each chart's own header/center label updates as you scrub. */
.pf-eyebrow.reading, .pf-hrtop .l.reading{
  text-transform:none;letter-spacing:0;color:var(--text-secondary);font-family:var(--font-mono);
  transition:color .12s ease;
}
.pf-eyebrow.reading .up, .pf-hrtop .l.reading .up{color:var(--green);}
.pf-eyebrow.reading .down, .pf-hrtop .l.reading .down{color:var(--red);}
.pf-eyebrow.reading .k, .pf-hrtop .l.reading .k{color:var(--text-muted);}
.pf-eyebrow.reading .dot{display:inline-block;width:8px;height:8px;border-radius:50%;margin-right:.4rem;vertical-align:middle;}
/* daily P/L bars: dim the field, highlight the hovered bar */
/* dim the field only while actually over a bar (JS toggles .dim/.hot) */
.pf-bars svg rect{transition:opacity .12s ease;cursor:pointer;}
.pf-bars svg.dim rect{opacity:.28;}
.pf-bars svg.dim rect.hot{opacity:1;}
/* monthly cells: lift + ring on the hovered cell only */
.pf-months .c{transition:transform .12s ease, box-shadow .12s ease;cursor:default;}
.pf-months .c:hover{transform:scale(1.14);box-shadow:0 0 0 1px var(--champagne-ring);position:relative;z-index:2;}
.pf-mhead span{font-family:var(--font-mono);font-size:max(.56rem, var(--fs-floor));color:var(--text-xmuted);text-align:center;}
/* legacy card primitives (AI-Trader + IBKR reuse) — restyled to match */
.pf-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(11rem,1fr));gap:0;margin-bottom:2rem;}
.pf-card{padding:0 2rem;border-left:1px solid var(--border-subtle);}
.pf-card:first-child{padding-left:0;border-left:0;}
.pf-card-label{font-size:max(.68rem, var(--fs-floor));font-weight:600;color:var(--text-muted);text-transform:none;letter-spacing:normal;margin-bottom:.7rem;}
.pf-card-value{font-family:var(--font-mono);font-size:1.5rem;font-weight:500;color:var(--text-primary);}
.pf-sub{font-size:.82rem;font-weight:500;margin-left:.35rem;font-family:var(--font-mono);}
.pf-section{margin-bottom:2.4rem;}
.pf-section-title{
  display:block;font-family:var(--font-display);font-size:1.2rem;font-weight:600;color:var(--text-primary);
  letter-spacing:-.01em;margin-bottom:1.2rem;
}

/* Add-money popover — a small panel anchored under the Deposit button (JS
   sets absolute page coords at open). No overlay, no scrim: the page behind
   stays fully live; dismissal is outside-press / Esc / the X. Chrome matches
   the wallet cards: elevated surface, inset ring, --radius-lg, a lift shadow,
   and a short pop-in. */
.dep-pop{
  position:absolute;z-index:200;display:none;
  width:min(19.5rem,calc(100vw - 1rem));
  background:var(--bg-elevated);border-radius:var(--radius-lg);
  padding:1.1rem 1.2rem 1rem;
  box-shadow:inset 0 0 0 1px var(--border-default), var(--shadow-lift);
}
.dep-pop.open{display:block;animation:dep-pop-in 180ms var(--ease-out) backwards;}
@keyframes dep-pop-in{from{opacity:0;transform:translateY(-0.375rem) scale(0.98);}}
.dep-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:0.85rem;}
/* Title reads like a section head: mono eyebrow, uppercase, tracked. */
.dep-title{
  font-family:var(--font-mono);font-size:max(0.6875rem, var(--fs-floor));font-weight:700;
  letter-spacing:normal;text-transform:none;color:var(--text-secondary);
}
.dep-x{background:none;border:none;color:var(--text-muted);font-size:1.3rem;line-height:1;cursor:pointer;padding:0 .25rem;transition:color .15s;}
.dep-x:hover{color:var(--text-primary);}
/* Everything inside speaks the page's control language: mono uppercase
   tracked labels (the .pf-modetog / .cc-btab family), square 2-3px radii,
   inset rings, champagne accents. No rounded-pill chips, no generic grays. */
.dep-room{font-size:.78rem;color:var(--text-secondary);margin-bottom:.85rem;line-height:1.5;}
.dep-room b{color:var(--text-primary);font-family:var(--font-mono);font-weight:600;letter-spacing:var(--tr-mono);font-variant-numeric:tabular-nums;}
.dep-field{
  display:flex;align-items:center;gap:.5rem;background:var(--bg-secondary);border-radius:3px;
  box-shadow:0 0 0 1px var(--border-default) inset;padding:.6rem .85rem;margin-bottom:.6rem;transition:box-shadow .15s;
}
.dep-field:focus-within{box-shadow:0 0 0 1px var(--champagne) inset;}
.dep-cur{color:var(--text-muted);font-family:var(--font-mono);font-size:1rem;}
.dep-field input{
  flex:1;background:none;border:none;outline:none;color:var(--text-primary);
  font-family:var(--font-mono);font-size:1.125rem;font-weight:600;width:100%;
  letter-spacing:var(--tr-mono);font-variant-numeric:tabular-nums;
}
.dep-chips{display:flex;gap:.5rem;margin-bottom:.95rem;}
.dep-chip{
  flex:1;padding:.5rem 0;border-radius:3px;cursor:pointer;border:none;
  box-shadow:0 0 0 1px var(--border-default) inset;background:transparent;
  color:var(--text-muted);font-family:var(--font-mono);font-size:max(.6563rem, var(--fs-floor));
  font-weight:600;letter-spacing:normal;text-transform:none;
  transition:background .12s,color .12s,box-shadow .12s;
}
.dep-chip:hover{color:var(--text-secondary);box-shadow:0 0 0 1px var(--border-strong) inset;}
.dep-chip:active{background:var(--champagne-dim);color:var(--champagne);box-shadow:0 0 0 1px var(--champagne-ring) inset;}
.dep-note{font-size:max(.7rem, var(--fs-floor));color:var(--text-muted);line-height:1.55;margin-bottom:1rem;}
.dep-foot{display:flex;gap:.75rem;justify-content:flex-end;align-items:center;}
/* Cancel is a quiet text action; Add money is the same champagne primary as
   the page's Deposit button, so the pair reads confirm-vs-dismiss at a glance. */
.dep-btn{
  padding:.5rem .6rem;border-radius:3px;cursor:pointer;border:none;
  background:transparent;box-shadow:none;color:var(--text-muted);
  font-family:var(--font-mono);font-size:max(.6875rem, var(--fs-floor));font-weight:600;
  letter-spacing:normal;text-transform:none;transition:color .12s;
}
.dep-btn:hover{color:var(--text-primary);}
.dep-btn.dep-go{
  padding:.55rem 1.35rem;border-radius:2px;
  box-shadow:0 0 0 1px var(--champagne-ring) inset;color:var(--champagne);
  font-family:var(--font-sans);font-size:.8rem;font-weight:600;
  letter-spacing:.03em;text-transform:none;transition:background .15s,color .15s;
}
.dep-btn.dep-go:hover{background:var(--champagne-dim);}
.dep-btn:disabled{opacity:.45;cursor:not-allowed;}

@media (max-width:56rem){
  .pf-wrap{padding:1.8rem 1.4rem 4rem;}
  /* narrow topbar: let actions wrap under the wordmark, shrink the brand */
  .pf-header{flex-wrap:wrap;gap:.6rem 1rem;}
  .pf-brand .n{font-size:1.2rem;}
  .pf-crest{width:34px;height:34px;font-size:1rem;}
  .pf-actions{margin-left:0;}
}

/* AI Trader view extras */
.ai-tag{
  font-family:var(--font-mono);font-size:max(0.6875rem, var(--fs-floor));letter-spacing:normal;
  text-transform:none;color:var(--text-muted);
  padding:0.1875rem 0.5625rem;border:1px solid var(--border-default);border-radius:62.4375rem;
}
.ai-disclaimer{
  margin:-0.5rem 0 1.125rem;font-size:0.75rem;color:var(--text-muted);font-style:italic;
}
.ai-rat{color:var(--text-muted);font-size:0.75rem;font-style:italic;max-width:26.25rem;}

/* The Algorithms view (bot books) moved to 103-algorithms.css (.alg-*) in
   the 2026-11-12 restyle; its old paper-* / ptf-* rules were removed here.
   Kept for that view: .paper-xtra (the model calls Show all rows). */
.paper-xtra.hidden{display:none;}

/* ═══════════════════════════════════════════════════════════════════════════
   WALLET · command-center body (wc-*)
   The account page (/watchlist/wallet) adopts the watchlist command center's
   language: a status band, a card panel grid, cc-style rows, staggered
   entrances, a knight loading veil and a silent 30s refresh. Everything the
   Paper Trading view (renderPaper → .pf-*) uses is left untouched; the wallet
   body gets its OWN wc-* markup so the two decouple.

   Reuse over duplication: nearly every command-center rule is class-rooted
   (never scoped under #command-center), so the wallet reuses them directly —
   the cc-band-phase, cc-clock, cc-session and cc-gauge families (band internals),
   .cc-layout (the responsive panel grid + flat-card chrome + board-row cap),
   .cc-section/.cc-section-head/.cc-section-title (headers),
   .cc-board/.cc-row/.cc-row-logo/.cc-row-id/.cc-row-delta/.cc-row-pct (the
   positions board), .cc-board-tabs/.cc-btab (sort tabs), .cc-tm-body /
   .cc-sector-body / .brd-card (the three new-panel hosts, filled by a later
   agent), and the card hover-lift group. The rules below are only the wallet's
   OWN pieces: a wider canvas, a band whose columns differ, a hero card, the
   positions column template, and the entrance gating.
   ─────────────────────────────────────────────────────────────────────────── */

/* The wallet body renders inside the SHARED command-center canvas — the div is
   emitted as class="cc-canvas wc-canvas", so .cc-canvas (07-command-center.css)
   supplies the 48px line-grid texture, the clamp() page padding, and the 110rem
   centered content width via `.cc-canvas > *`. The wallet's own .pf-wrap must
   therefore impose NO competing max-width or padding (the canvas owns both).
   Scoped to #wallet-view so #ai-wrap's .pf-wrap (Settings / Paper Trading / IBKR)
   keeps the shared 84rem shell untouched. */
#wallet-view .pf-wrap{max-width:none;padding:0;}
/* .wc-canvas rides on top of .cc-canvas; it is only the hook for the entrance
   gating (.wc-anim) and the wallet-specific pieces below. */
.wc-canvas{min-width:0;}

/* ── 2 · Generic panel body — one body class for every wallet panel
   (Total equity, Performance curve, Account figs, Daily P/L, Monthly returns,
   Recent activity; Allocation is a .cc-sector-body donut host like Sectors).
   Card chrome lives on the parent .cc-section, same as the reused
   command-center panels (07's flat-cards block). ── */
.wc-card{
  /* Chrome-less: the card shell is the parent .cc-section now (07's flat-cards
     block — title renders in-card), so this is just the body's inner layout.
     Side padding matches the in-card header's 1.25rem inset. */
  padding:1.1rem 1.25rem 1.25rem;display:flex;flex-direction:column;gap:1rem;
}
/* Panel cards fill the height the grid row hands them (matches the reused
   .cc-board / .cc-tm-body / .brd-card fill rule). */
.cc-layout .wc-card{flex:1 1 auto;min-height:0;}
/* Merged Total equity + Account card (pairs with the Allocation donut panel):
   the equity headline sits on top, the balances/risk figs grid anchors to the
   bottom under a hairline. Fixed 4 columns (7 cells → a 4 + 3 grid) so the
   rows read as a deliberate table, not an auto-fit rag; each wrapped row's
   first cell drops the column separator. */
.wc-eqacct-card{justify-content:space-between;gap:1.6rem;}
.wc-eq-head{display:flex;flex-direction:column;gap:1.1rem;}
.wc-eqacct-card .pf-figs{
  grid-template-columns:repeat(4, minmax(0,1fr));
  row-gap:1.5rem;
  border-top:1px solid var(--border-subtle);padding-top:1.4rem;
}
.wc-eqacct-card .pf-fig{padding:0 1.4rem;}
.wc-eqacct-card .pf-fig:nth-child(4n+1){border-left:0;padding-left:0;}
/* Values a step under the headline so the card keeps ONE focal point. */
.wc-eqacct-card .pf-fig .v{font-size:1.3rem;}
/* ── Entrance: Total equity + Performance loading transitions. The headline
   counts up (JS, countUpEquity) while the change line and each stat cell fade
   in as a cascade, and the Performance header row fades ahead of the curve's
   rAF wipe (wcRevealCurve). Opacity-only (transform belongs to the hover lift),
   `backwards` fill, gated by .wc-anim so the silent 30s refresh never replays. */
.wc-anim .wc-eq-head .pf-change{animation:wc-fade 420ms var(--ease-out) 380ms backwards;}
.wc-anim .wc-eqacct-card .pf-fig{animation:wc-fade 400ms var(--ease-out) backwards;}
.wc-anim .wc-eqacct-card .pf-fig:nth-child(1){animation-delay:430ms;}
.wc-anim .wc-eqacct-card .pf-fig:nth-child(2){animation-delay:490ms;}
.wc-anim .wc-eqacct-card .pf-fig:nth-child(3){animation-delay:550ms;}
.wc-anim .wc-eqacct-card .pf-fig:nth-child(4){animation-delay:610ms;}
.wc-anim .wc-eqacct-card .pf-fig:nth-child(5){animation-delay:670ms;}
.wc-anim .wc-eqacct-card .pf-fig:nth-child(6){animation-delay:730ms;}
.wc-anim .wc-eqacct-card .pf-fig:nth-child(7){animation-delay:790ms;}
.wc-anim .wc-eqacct-card .pf-fig:nth-child(8){animation-delay:850ms;}
.wc-anim .wc-curve-card .pf-hrtop{animation:wc-fade 420ms var(--ease-out) 320ms backwards;}
@keyframes wc-fade{from{opacity:0;}}
@media (max-width:640px){
  .wc-eqacct-card .pf-figs{grid-template-columns:repeat(2, minmax(0,1fr));}
  .wc-eqacct-card .pf-fig{border-left:0;padding-left:0;}
}
/* Equity-curve card: the lightweight-charts host fills the space under the
   header/range row (reuses .pf-hrtop / .pf-rng / .pf-curve wholesale). */
.wc-curve-card{gap:0.75rem;}
.wc-curve-card .pf-curve{flex:1;}
/* Performance cards (Daily P/L / Monthly): give the SVG bodies a comfortable
   floor so they read as full cards, not shallow strips. */
.wc-perf-card{justify-content:center;min-height:15rem;}

/* Same-specificity override of 07's .cc-layout row budget (this file loads later). */
.wc-layout{--cc-board-rows:8;}
/* Wallet section heads come in two natural heights: plain title (~1.2rem) vs
   title + tab buttons (~1.8rem). Rows pair them freely, so a uniform floor
   keeps every card in a row STARTING at the same y (the fill/cap contract
   above makes them END together). */
#wallet-view .cc-section-head{min-height:1.8rem;}
/* A small SHORT tag beside the ticker when the position is short. */
.wc-short-chip{
  display:inline-block;margin-left:0.375rem;padding:0.0625rem 0.3125rem;
  font-family:var(--font-mono);font-size:max(0.5rem, var(--fs-floor));font-weight:700;letter-spacing:0.06em;
  color:var(--red);background:var(--red-dim);border-radius:0.125rem;vertical-align:middle;
}
/* An OPT tag so an options row reads as its underlying's contract. */
.wc-opt-chip{
  display:inline-block;margin-left:0.375rem;padding:0.0625rem 0.3125rem;
  font-family:var(--font-mono);font-size:max(0.5rem, var(--fs-floor));font-weight:700;letter-spacing:0.06em;
  color:var(--amber);background:color-mix(in srgb, var(--amber) 12%, transparent);
  border-radius:0.125rem;vertical-align:middle;
}

/* ── The three holdings panels are painted by a later agent; give their hosts
   real card height so the placeholders read as intentional cards, not gaps. ── */
#wallet-view .cc-tm-body,
#wallet-view .cc-sector-body,
#wallet-view .brd-card{min-height:14rem;}

/* ── 4 · Entrance — gated by .wc-anim on the canvas (present on the entrance
   paint, absent on the silent 30s refresh). Cards rise via a FROM-keyframe with
   backwards fill (never a forwards fill — that would pin transform and block the
   hover lift, the same lesson as .cc-band / .cc-row). ── */
.wc-anim .wc-rise{animation:wc-rise 560ms var(--ease-out) calc(120ms + var(--wi, 0) * 70ms) backwards;}
@keyframes wc-rise{from{opacity:0;transform:translateY(8px);}}

/* Analytics-panel entrances. JS sets the one-shot class + --pf-hold (the
   section rise's remaining time) at paint, so each entrance plays AFTER its
   panel is visible and never replays on the silent refresh (the class is
   dropped on every later repaint). Daily P/L bars grow off the zero baseline
   left→right; monthly cells pop in reading order. */
#pf-daypnl.wc-bars-in rect{
  transform-box:fill-box;
  animation:wc-bar-grow 340ms var(--ease-out) calc(var(--pf-hold, 0ms) + var(--i, 0) * 16ms) backwards;
}
#pf-daypnl.wc-bars-in rect.up{transform-origin:50% 100%;}
#pf-daypnl.wc-bars-in rect.dn{transform-origin:50% 0%;}
#pf-daypnl.wc-bars-in line{animation:wc-fade-in 300ms var(--ease-out) var(--pf-hold, 0ms) backwards;}
@keyframes wc-bar-grow{from{transform:scaleY(0);}}
@keyframes wc-fade-in{from{opacity:0;}}
#pf-months.wc-cells-in .c{
  animation:wc-cell-pop 300ms var(--ease-out) calc(var(--pf-hold, 0ms) + var(--i, 0) * 22ms) backwards;
}
@keyframes wc-cell-pop{from{opacity:0;transform:scale(0.86);}}
/* Board rows reuse .cc-row's own from-keyframe stagger (--i) on the animated
   paint; the silent refresh re-renders WITHOUT .wc-anim, so suppress it there. */
.wc-canvas:not(.wc-anim) .cc-row{animation:none;}

/* (Hover lift comes from the shared .cc-layout .cc-section group in
   07-command-center.css — the section shell is the card now, wallet included.) */

/* ── Crypto / FX ticket (2026-10-05): paper only, market only. The JS sets
   [hidden] on the instrument switch, the order type row and the Paper|Live
   track; their own display:flex would otherwise win over the attribute. ── */
.trade-inst[hidden],
.trade-type-row[hidden],
.trade-mode-row[hidden]{display:none;}
/* A five figure coin price plus a fractional size can outgrow the fill row:
   clip with an ellipsis (full text on hover) instead of running into the
   time column. */
.trade-recent-qty{overflow:hidden;text-overflow:ellipsis;}

/* CAD listing (2026-10-15; C$ with the US$ in the hover since 2026-10-19). */
#trade-money-lbl{min-width:0;}
#trade-money-val{flex:0 0 auto;white-space:nowrap;}

/* ── Ticket 5 (2026-10-20): the listing line, the "did you mean" hint, the
   auto conversion row and the broker confirm box. Built by trade-ticket.js
   (t5Dom) into the ticket markup. tokens.css colours; fills, not rules;
   inset rings instead of 1px borders. */
.trade-listing{
  display:flex;align-items:center;min-height:1.375rem;padding:0.1875rem 1rem 0;
  font-family:var(--font-sans);font-size:max(0.6875rem, var(--fs-floor));color:var(--text-secondary);
}
.trade-listing[hidden],.trade-hint[hidden],.trade-fxline[hidden],.trade-confirmbox[hidden]{display:none;}
.trade-listing-txt{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.trade-listing-tail{flex:none;white-space:pre;}
.trade-hint{
  display:block;width:calc(100% - 2rem);margin:0.3125rem 1rem 0;padding:0.3125rem 0.5rem;
  text-align:left;cursor:pointer;
  font-family:var(--font-sans);font-size:max(0.6875rem, var(--fs-floor));font-weight:600;
  color:var(--text-primary);background:color-mix(in srgb, var(--champagne) 14%, transparent);
  border:0;border-radius:calc(var(--tp-r) - 2px);
  transition:background var(--dur-fast);
}
.trade-hint:hover,.trade-hint:focus-visible{
  background:color-mix(in srgb, var(--champagne) 24%, transparent);outline:none;
}
.trade-fxline{
  display:flex;align-items:baseline;justify-content:space-between;gap:0.75rem;
  margin:0.75rem 1rem 0;padding:0 0.125rem;cursor:help;
  font-family:var(--font-sans);font-size:max(0.6875rem, var(--fs-floor));color:var(--text-secondary);
}
.trade-fxline-val{font-family:var(--font-mono);font-weight:600;color:var(--text-primary);font-variant-numeric:tabular-nums;}
.trade-fxline + .trade-moneyline{margin-top:0.5rem;}
.trade-confirmbox{
  margin:0.625rem 1rem 0;padding:0.5rem 0.75rem 0.625rem;
  background:var(--bg-primary);border-radius:var(--tp-r);
  box-shadow:inset 0 0 0 1px var(--border-default);
  font-family:var(--font-sans);font-size:max(0.6875rem, var(--fs-floor));color:var(--text-primary);
}
.trade-confirm-title{font-weight:700;color:var(--text-secondary);margin-bottom:0.25rem;}
.trade-confirm-msgs{margin:0;padding:0 0 0 1rem;line-height:1.45;}
.trade-confirm-msgs li{margin:0.125rem 0;}
.trade-confirm-btns{display:flex;gap:0.5rem;margin-top:0.5rem;}
.trade-confirm-btn{
  flex:1 1 0;height:1.875rem;border:0;cursor:pointer;
  border-radius:calc(var(--tp-r) - 2px);
  font-family:var(--font-sans);font-size:max(0.6875rem, var(--fs-floor));font-weight:600;
  color:var(--text-primary);background:var(--bg-tertiary);
}
.trade-confirm-btn:hover{background:var(--bg-hover);}
.trade-confirm-btn.is-go{background:var(--champagne);color:var(--bg-primary);}
.trade-confirm-btn.is-go:hover{filter:brightness(1.06);}
.trade-confirm-btn:disabled{opacity:.55;cursor:default;}

/* ── The Workspaces TKT pane (.tkp-*, 2026-10-19) ─────────────────────────
   static/js/wallet/ticket-pane.js (window.MPTicketPane): this file's ticket
   docks inline in .tkp-dock (#trade-overlay.is-docked above); these rules
   lay out the pane around it: the dock, the idle state (Trade here) and the
   slim rules line with its (i) hover. Kept with the ticket it frames rather
   than in a numbered file of its own, so the appended cascade order of the
   later surfaces is unchanged. tokens.css colours only; no borders. */
.tkp{display:flex;flex-direction:column;height:100%;min-height:0;background:var(--bg-secondary);}
.tkp-dock{flex:1 1 auto;min-height:0;display:flex;}
.tkp-dock[hidden],.tkp-idle[hidden],.tkp-foot[hidden],.tkp-here[hidden]{display:none;}
.tkp-idle{flex:1 1 auto;min-height:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;color:var(--text-muted);font-size:12px;}
.tkp .tkp-here{min-width:88px;justify-content:center;}
.tkp-foot{flex:none;display:flex;align-items:center;gap:6px;min-height:22px;padding:3px 8px;box-sizing:border-box;font-size:11px;line-height:14px;color:var(--text-muted);background:var(--bg-primary);}
/* Ticket 2 final: the rules line wraps to at most two lines, never cut mid word. */
.tkp-rules{flex:1 1 auto;min-width:0;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;overflow-wrap:anywhere;}
.tkp-i{flex:none;display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;border-radius:50%;background:var(--bg-tertiary);color:var(--text-secondary);font-size:10px;font-weight:600;font-style:italic;cursor:help;}
.tkp-i:hover,.tkp-i:focus-visible{background:var(--bg-hover);color:var(--text-primary);outline:none;}

/* ── _T5I_ The Workspaces IBKR account pane (.ibp-*, BROK, 2026-10-21) ────
   static/js/wallet/ibkr-pane.js (window.MPIbkrPane): the shared table
   layout's pane shell (.mpt.mpt-pane, 66-table.css) holds the link's status
   chip, one key / value list and, when not linked, this file's own connect
   surface (.ibx-compact above) mounted in .ibp-connect. Kept beside the
   surface it frames, like .tkp-, so the appended cascade order of the later
   surfaces is unchanged. tokens.css colours only; no borders, no stripes. */
.ibp .ibp-bar{gap:6px;}
.ibp-chip{flex:none;display:inline-flex;align-items:center;gap:6px;height:20px;padding:0 8px;border-radius:10px;background:var(--bg-tertiary);color:var(--text-secondary);font-size:11px;line-height:1;white-space:nowrap;}
.ibp-dot{flex:none;width:6px;height:6px;border-radius:50%;background:var(--text-muted);}
.ibp-chip[data-tone="on"] .ibp-dot{background:var(--green);}
.ibp-chip[data-tone="wait"] .ibp-dot{background:var(--amber);}
.ibp-kind{flex:none;color:var(--text-muted);font-size:11px;white-space:nowrap;}
.ibp-kind:empty{display:none;}
.ibp-body{display:flex;min-height:0;}
.ibp-scroll{flex:1 1 auto;min-height:0;overflow:auto;padding:6px 8px 10px;box-sizing:border-box;}
.ibp-list{margin:0;display:grid;grid-template-columns:minmax(84px,max-content) minmax(0,1fr);column-gap:12px;}
.ibp-row{display:contents;}
.ibp-row dt,.ibp-row dd{margin:0;padding:3px 0;font-size:12px;line-height:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.ibp-row dt{color:var(--text-muted);}
.ibp-row dd{color:var(--text-primary);font-variant-numeric:tabular-nums;}
.ibp-row dd.ibp-na{color:var(--text-muted);}
.ibp-connect{margin-top:8px;}
.ibp-connect .ibx-compact,.ibp-connect .ibx{background:transparent;}
