/* ═══════════════════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════════════════ */
/* The sidebar is a hover rail: it rests at --rail-w showing only the
   knight, the + square, the company logos and the avatar. Hovering
   (or keyboard focus inside it) flies the full panel out OVER the
   chart — the main area keeps a fixed --rail-w offset so charts
   never reflow on hover. Mouse-leave tucks it back; there is no
   toggle button. Inner blocks keep a fixed --sidebar-w layout and
   are simply clipped by the rail, so nothing rewraps mid-flight. */
/* PERF (2026-07-09): the box is ALWAYS laid out at --sidebar-w; the
   collapsed rail is a clip-path inset from the right. Toggling animates
   clip-path (paint/composite only — NO layout), and .main's margin snaps
   (see MAIN AREA). The old width+margin transitions reflowed the whole
   app and resized the LWC charts every frame (31–33ms/frame, 57–79ms
   long tasks per toggle). The 1px seam is the ASIDE's ::after, positioned
   by `left` on the same clock — it CANNOT ride the clip edge from inside
   the clipped box without rendering blurry (see THE PANEL'S RIGHT EDGE
   below); the expanded seam shadow moved to body::before (clip-path would
   swallow an on-element box-shadow). */
/* NO first-paint animation. The whole fly-out motion (clip-path, the seam
   ::after, the body::before strip, the brand + label reveals) is armed only
   once body.sb-anim is set — app.js adds it after the first paint, so the boot
   restore of the persisted state (rail OR expanded) snaps into place instantly
   and only a real user toggle animates. The blanket transition:none here is
   inert the moment sb-anim lands (the :not() stops matching). */
/* ── ONE CLOCK FOR THE WHOLE TOGGLE (2026-07-25) ───────────────────────────
   The panel edge and everything it reveals must land on the SAME frame, in
   BOTH directions. Before this, the fly-out ran on EIGHT different clocks
   (.34s/.1s panel, .26s/.18s text, .26s/.16s wordmark, .26s/.12s max-widths,
   .3s/0 Add Stock, .3s/0 toggle icon, .18s/0 research body, .12s/0 for the
   whole tuck-in) plus two properties that were not animated at all — so the
   row names, the Add Stock label and the section labels landed anywhere from
   143ms BEFORE to 54ms AFTER the panel, and the offset moved 30-78ms run to
   run under main-thread load. Measured at 6x CPU throttle, both directions.

   EVERY property that moves on a rail toggle now uses this one token —
   including .main's push in 04-header.css and the Add Stock / account-chip /
   toggle-label rules in 03-sources.css, which load after this file. Change it
   here and the whole fly-out changes together; NEVER give one of them its own
   duration, curve or delay again.

   Compositor-only wherever the geometry allows: the section labels and the
   toggle label keep a CONSTANT max-width and reveal on opacity+transform (the
   pattern .si-info already used), so no text reveal drives layout any more.
   Three genuine geometry morphs remain and are documented at their rules: the
   knight + wordmark lockup, the Add Stock square→button, and #rs-body's
   height (all three physically move other pixels, so a transform cannot stand
   in for them). They are on this clock like everything else. */
:root{ --sb-toggle:.34s var(--ease-glide) .1s; }

/* `.sidebar *` cannot reach a pseudo-element, so the right-edge seam
   (.sidebar::after) is listed explicitly in BOTH blocks below. */
body:not(.sb-anim) .sidebar,
body:not(.sb-anim) .sidebar *,
body:not(.sb-anim) .sidebar::after,
body:not(.sb-anim)::before{ transition:none !important; }
/* Reduced motion: the entire toggle (panel + content push) snaps. */
@media (prefers-reduced-motion: reduce){
  .sidebar,
  .sidebar *,
  .sidebar::after,
  body::before,
  body.sb-anim .main{ transition:none !important; }
}
.sidebar{
  position:fixed;top:0;left:0;bottom:0;
  width:var(--sidebar-w);height:100vh;
  /* Above the stock-loading veil (z:45) — the watchlist must stay
     usable (and fly out whole) while a stock is loading. Sits ABOVE the
     GRAPHS drawer (z:55) and the view-toggle (z:50) so the drawer can
     never cover the rail and its off-screen (closing) edge stays masked
     behind the rail. Still BELOW the z:60 menus/modals/trade-overlay. */
  z-index:56;
  /* The aside is an UNCLIPPED, hit-transparent shell. The clip-path (and
     everything visual) lives on the inner .sidebar-clip: clip-path on the
     aside made it the containing block for its position:fixed descendants
     AND clipped them, which swallowed the #search-overlay modal + the
     #account-menu in the collapsed rail. pointer-events:none keeps the
     invisible strip between --rail-w and --sidebar-w click-through (the
     clip-path used to exclude it from hit-testing); interactive children
     restore pointer-events:auto below. */
  pointer-events:none;
}
.sidebar-clip{
  position:absolute;inset:0;
  pointer-events:auto;
  background:linear-gradient(180deg,var(--bg-primary) 0%,var(--bg-sink) 100%);
  display:flex;flex-direction:column;
  /* clip, not hidden: scrollIntoView/focus must never be able to
     scroll the clipped full-width content sideways inside the rail */
  overflow:clip;
  clip-path:inset(0 calc(100% - var(--rail-w)) 0 0);
  will-change:clip-path;
  transition:clip-path var(--sb-toggle);
}
:root.sb-open .sidebar .sidebar-clip{
  clip-path:inset(0 0 0 0);
  transition:clip-path var(--sb-toggle);
}
/* ── THE PANEL'S RIGHT EDGE (the vertical seam) ─────────────────────────────
   Owner call 2026-07-25: "there should be border on the right vertical line of
   the left panel, just like how the horizontal lines are with the same
   contrast." So: 1px of --border-default — THE SAME TOKEN as the panel's own
   horizontal seams (.sidebar-brand / .sidebar-nav border-bottom, .rs-header /
   .wt-header border-top) and as .chart-resizer::after. Do NOT re-express it off
   --text-primary; --border-default already inverts per theme in tokens.css.
   It was `--text-primary 5%`, roughly half this contrast, which against both
   the night-harbour and the cream surface simply did not read as a line.

   WHY IT SITS ON THE ASIDE AND NOT ON .sidebar-clip. It used to be
   .sidebar-clip::after, a 1px box slid by translateX(rail - sidebar) so it rode
   the clip edge. That renders BLURRY — and only in the collapsed rail, i.e. the
   default state. The root font is fluid (clamp(12px, 6.3px+0.54vw, 22px)), so
   --rail-w (4rem) lands on a fractional pixel (66.672px at 1920), and BOTH the
   fractional translate on .sidebar-clip's composited layer (will-change:
   clip-path) AND the clip-path's own fractional edge antialias the hairline
   across two device columns at DPR 1. Measured at 1920: ink spread over columns
   65 + 66 instead of one solid column — a soft ~2px smudge beside CRISP 1px
   horizontal seams — while on the chart page it landed right next to
   #chart-rail's inset left ring (already --border-default, already crisp,
   column 67), so the boundary read as a 3-column band. Expanded it WAS crisp,
   because there the transform is none.

   The aside is the one box on this boundary that is neither clipped nor
   transformed (it must stay unclipped — clip-path on it swallowed
   #search-overlay and #account-menu, see .sidebar above), so a pseudo-element
   positioned on it by `left` is rasterised by paint, which snaps to whole
   pixels. Measured: pure --border-default on a SINGLE column, collapsed AND
   expanded, at 1920 / 1440 / 1280, both themes. Same reason #chart-rail's inset
   ring is crisp, and the same "draw the edge outside the clipping context"
   trick .chart-resizer::after uses. It resolves to EXACTLY the column
   #chart-rail's left ring already paints, so on the chart page the two coincide
   instead of doubling — do not delete that ring to "deduplicate": the rail's
   opaque background covers this seam wherever they overlap, and the ring is
   what keeps the line unbroken there.

   `left` is a layout property, deliberately. The toggle ALREADY reflows every
   frame (.main's margin-left push, 04-header.css), so pinning the seam to that
   same moving edge costs no extra layout pass — and it is the only way to stay
   pixel-locked to a fractional edge. On --sb-toggle like everything else. */
.sidebar::after{
  content:"";position:absolute;top:0;bottom:0;width:1px;
  left:var(--rail-w);
  background:var(--border-default);
  /* Inherited from the aside, restated: this strip crosses the click-through
     gap between --rail-w and --sidebar-w and must never take a hit. */
  pointer-events:none;
  transition:left var(--sb-toggle);
}
:root.sb-open .sidebar::after{
  left:var(--sidebar-w);
  transition:left var(--sb-toggle);
}
/* Docked/push seam shadow: a subtle depth line, not a big fly-out shadow
   (the content sits flush beside the panel). Cast by a separate fixed
   strip because the sidebar's clip-path clips its own box-shadow. Slides
   + fades in lockstep with the panel edge. The heavy drop shadow returns
   in the ≤900px overlay fallback (see MAIN AREA media block). Hidden in
   zen mode (which display:nones the sidebar itself). */
body::before{
  content:"";position:fixed;top:0;left:0;bottom:0;width:var(--sidebar-w);
  pointer-events:none;z-index:56;
  /* Seam shadow REMOVED (2026-07-10): with the #chart-rail drawing
     column docked flush against the sidebar, the cast shadow painted
     over the tools and read as a smudge. The strip is kept (the ≤900px
     overlay fallback re-adds its own heavy shadow). */
  box-shadow:none;
  opacity:0;
  transform:translateX(calc(var(--rail-w) - var(--sidebar-w)));
  transition:transform var(--sb-toggle), opacity var(--sb-toggle);
}
:root.sb-open body:not(.chart-zen)::before{
  opacity:1;transform:none;
  transition:transform var(--sb-toggle), opacity var(--sb-toggle);
}
/* Content that only exists in the expanded panel. THE reference reveal: pure
   opacity + transform, no layout, on the one clock — every other text reveal
   in the panel now copies it. (Row text, account text/caret.) It used to fade
   out over .12s on tuck-in, i.e. the names were gone ~230ms before the panel
   had finished tucking; now the text and the panel edge leave together. */
.sidebar .si-info,
.sidebar .account-meta,
.sidebar .account-caret{
  opacity:0;transform:translateX(-0.375rem);
  transition:opacity var(--sb-toggle), transform var(--sb-toggle);
}
:root.sb-open .sidebar .si-info,
:root.sb-open .sidebar .account-meta,
:root.sb-open .sidebar .account-caret{
  opacity:1;transform:translateX(0);
  transition:opacity var(--sb-toggle), transform var(--sb-toggle);
}

/* Sidebar brand — knight + "Cavalry" lockup. Hover the knight to
   play; mouse-out finishes the current loop then parks on frame 0.
   Click anywhere on the brand (logo or text) to return to the
   welcome hero — acts as the "Home" affordance. */
/* Brand — TRULY dynamic scaling. Every dimension interpolates
   linearly between a laptop size at viewport 1366 and a monitor
   size at viewport 1920. Below 1366 it clamps to the laptop floor;
   above 1920 it clamps to the monitor cap.

   Anchor points (and what calc(K*vw - C) resolves to at each):
             LAPTOP 1366   MONITOR 1920
     video:    38px          140px
     text:     12px           30px
     row:      56px          170px
     gap:       0.5rem           1.125rem

   The calc()s solve the linear formula between those two points.
   Because vw resolves continuously, the brand grows smoothly as
   the window resizes — no stepped breakpoints. */
/* The lockup is sized as fractions of the sidebar width (not rem) so
   the knight + wordmark hold the exact same proportions on every
   screen — the ratios are taken from the laptop reference render. */
/* Rail state: a smaller knight, no wordmark. The header keeps its
   expanded height (calc of --sidebar-w) in both states so nothing
   below it shifts vertically during the fly-out. justify-content
   centers the lockup at EVERY width — rail knight dead-center,
   expanded knight+wordmark dead-center — instead of relying on the
   lockup happening to fill the row at laptop sizes. Padding/height
   transitions carry the same delays as the sidebar width so the
   whole fly-out moves as one piece. */
.sidebar-brand{
  padding:0 0.3125rem;
  border-bottom:1px solid var(--border-default);   /* sidebar seams all use --border-default */
  display:flex;
  align-items:center;
  justify-content:center;
  height:calc(var(--sidebar-w) * 0.327);
  min-height:calc(var(--sidebar-w) * 0.327);
  flex-shrink:0;
  cursor:pointer;
  overflow:hidden;
  transition:background .15s var(--ease-out),
             padding var(--sb-toggle);
}
:root.sb-open .sidebar .sidebar-brand{
  padding:0 calc(var(--sidebar-w) * 0.064);
  transition:background .15s var(--ease-out),
             padding var(--sb-toggle);
}
.sidebar-brand:hover{
  background:color-mix(in srgb, var(--text-primary) 2.5%, transparent);
}
.sidebar-brand .brand-lockup{
  display:flex;
  flex-direction:row;
  align-items:center;
  /* The brand row is now always laid out at --sidebar-w (the rail is a
     clip), so rail-centering comes from this transform: half the clip's
     travel keeps the knight dead-center in the visible strip, exactly as
     it was when the row itself narrowed. Same timings as the clip. */
  transform:translateX(calc((var(--rail-w) - var(--sidebar-w)) / 2));
  transition:transform var(--sb-toggle);
}
:root.sb-open .sidebar .brand-lockup{
  transform:none;
  transition:transform var(--sb-toggle);
}
/* The knight comes in two skins — the webm for dark, a still PNG for light
   (see .brand-img below). They share ONE sizing rule on purpose: matching
   boxes by construction beats two rule sets that drift. Both source files are
   3:2 (knight1.webm 1176x784, light_knight.png 384x256), so height + width:auto
   resolves to the same width for either, and object-fit:contain (the video's
   own default, an override only for the img) keeps that true if a width is
   ever imposed. Do NOT give one of them its own geometry. */
.sidebar-brand video,
.sidebar-brand .brand-img{
  height:2.75rem;
  width:auto;
  /* Both assets ARE 3:2, so this is a no-op once they are decoded — it exists
     for the window BEFORE that. A <video> with no metadata yet (preload="none"
     is the norm here) has no natural ratio, so width:auto fell back to the CSS
     default video size of 300px and the box rendered 300x40 until the webm's
     header arrived, shoving the wordmark out of the rail. Declaring the ratio
     makes the box correct from the first paint, in either theme, loaded or not. */
  aspect-ratio:3 / 2;
  display:block;
  object-fit:contain;
  flex-shrink:0;
  /* GEOMETRY MORPH 1 of 3 (see the ONE CLOCK note at the top). `height` is a
     layout property and stays one: the knight's box width is what re-centres
     the whole lockup, so a transform:scale() would leave the wordmark's
     start-point where the big knight had it and the reveal would drift. The
     ratio is viewport-dependent too (--sidebar-w is a clamp), so no single
     scale factor exists. It is on --sb-toggle, so it lands with the panel.
     transform stays on its own short curve — that is the HOVER pop, not part
     of the toggle, and must not inherit the toggle's 100ms delay. */
  transition:transform .22s var(--ease-out),
             height var(--sb-toggle);
}
:root.sb-open .sidebar .sidebar-brand video,
:root.sb-open .sidebar .sidebar-brand .brand-img{
  height:calc(var(--sidebar-w) * 0.264);
  transition:transform .22s var(--ease-out),
             height var(--sb-toggle);
}
.sidebar-brand:hover video,
.sidebar-brand:hover .brand-img{
  transform:scale(1.05);
}
/* Theme swap. DARK = video, LIGHT = still PNG; exactly one is in the flex row
   at a time, and because the switch is a CSS attribute selector, theme.js
   flipping data-theme on <html> repaints it live with no reload and no JS.
   display:none also keeps the hidden one out of layout, so the lockup's
   centering maths is identical in both themes. */
.sidebar-brand .brand-img{ display:none; }
:root[data-theme="light"] .sidebar-brand video{ display:none; }
:root[data-theme="light"] .sidebar-brand .brand-img{ display:block; }
/* Wordmark slides out from behind the knight on expand; collapsed it
   takes no width at all so the knight sits dead-center in the rail. */
.sidebar-brand .sb-text{
  font-family:var(--font-display);
  font-size:calc(var(--sidebar-w) * 0.064);
  font-weight:700;
  letter-spacing:0.10em;
  color:var(--text-primary);
  text-transform:uppercase;
  line-height:1;
  white-space:nowrap;
  overflow:hidden;
  max-width:0;
  margin-left:0;
  opacity:0;
  transform:translateX(-0.5rem);
  /* GEOMETRY MORPH 2 of 3. Unlike the section labels below, the wordmark's
     max-width CANNOT be frozen: .brand-lockup is centred, so the wordmark's
     width is what slides the knight from the rail's centre line out to the
     lockup's. Kept as layout, moved onto --sb-toggle — it used to run four
     properties on three clocks (opacity .26s/.16s, max-width .26s/.12s,
     and .12s/.22s with no delay on the way back). */
  transition:opacity var(--sb-toggle), transform var(--sb-toggle),
             max-width var(--sb-toggle), margin-left var(--sb-toggle);
}
:root.sb-open .sidebar .sb-text{
  /* 5rem ≈ the wordmark's real width — animating to a far larger
     max-width makes the reveal finish halfway through the duration
     and read as a snap */
  max-width:5rem;
  margin-left:calc(var(--sidebar-w) * -0.0455);
  opacity:1;
  transform:translateX(0);
  transition:opacity var(--sb-toggle), transform var(--sb-toggle),
             max-width var(--sb-toggle), margin-left var(--sb-toggle);
}

/* Hidden in the rail (the spec there is logo → + → tickers → avatar);
   unfolds with the panel. Fixed --sidebar-w so the tab doesn't rewrap. */
/* Watchlist header row — ALWAYS visible (icon shows in the collapsed rail like
   the Research item + stock logos; the label reveals when the rail expands). */
.sidebar-nav{
  display:flex;flex-direction:column;gap:0;
  width:var(--sidebar-w);
  /* Header↔list seam. A 5% hairline vanished when BOTH sides were washed —
     the always-on section wash (ink 6%) above meeting a selected first row
     (accent 9%) below read as one merged blob. --border-default is the same
     seam weight the drawer/dock edges use, visible through both washes. */
  border-bottom:1px solid var(--border-default);
  flex-shrink:0;
  overflow:hidden;
}
/* SECTION HEADER row: [label][chevron]. Shared by BOTH sidebar sections —
   Watchlist (#wl-header, pinned above the scroll well) and Research
   (#rs-header, inside it). The label expands to fill; the chevron is a
   fixed-width toggle that rotates when the section is collapsed. The row
   carries its own side padding (it used to live on .sidebar-nav) so the
   Research header, which sits OUTSIDE .sidebar-nav, lines up with it. */
.wl-header{
  display:flex;align-items:center;gap:0;
  width:var(--sidebar-w);padding:0 0.75rem;box-sizing:border-box;
  position:relative;cursor:pointer;
  transition:background .14s ease;
}
/* The active section is marked by brightening its label to full ivory (see
   .wl-label.active below) — no accent underline. The muted inactive headers
   make the bright one read as 'current' by prominence, not colour. */
.wl-label{
  flex:1;height:2.5rem;padding:0 0.25rem;
  border:none;border-bottom:2px solid transparent;
  border-radius:var(--radius-sm);background:transparent;
  color:var(--text-secondary);
  font-family:var(--font-sans);font-size:max(0.625rem, var(--fs-floor));font-weight:700;
  letter-spacing:0.10em;text-transform:uppercase;
  cursor:pointer;
  text-align:left;display:flex;align-items:center;gap:0.5rem;
  transition:color .14s ease,border-color .14s ease,background .14s ease;
}
/* Active/selected section = bright ivory label + the SAME wash as hover, kept on
   so the current section reads as selected even when not hovered. The wash is
   applied to the whole header row below (matching .wl-header:hover exactly), not
   here, so a click looks identical to a hover. */
.wl-label.active{
  color:var(--text-primary);
}
.wl-label svg{flex:0 0 auto;}
/* Each section after the first draws its own separating line from the body above.
   The line is a flush border-top (no margin gap): a margin above it can't be
   covered by the row's hover wash, so it read as a divider floating a few px
   down with an uncovered strip on hover. Flush = the hover fills the whole row. */
.rs-header,.wt-header,.hp-header{
  border-top:1px solid var(--border-default);   /* sidebar seams all use --border-default */
}
/* Wallet is a LEAF section: no components, so no chevron. Its label still fills
   the row, so the hover wash and the rail-centred icon behave like any other
   section header. */
/* Wallet is also the LAST section, so it closes the stack with a matching bottom
   seam. Without it the section list just stopped in mid air above the empty run
   down to the account chip, which read as unfinished rather than as the end of
   the list. Flush like the top seams, and for the same reason: a margin gap
   would leave a strip the row's hover wash can't cover. */
/* Wallet's closing seam was REMOVED on 2026-08-02 when Help moved below it.
   Wallet is no longer the last section, so this border-bottom stacked against
   .hp-header's border-top and the pair rendered as one 2px line, visibly
   heavier than every other seam in the rail. Exactly the trap the note at the
   top of this file describes. The closing seam now lives on #hp-body. */
/* Help moved BELOW Wallet (owner, 2026-08-02), so it is the last section now and
   it closes the stack. The seam sits on the BODY rather than the header because
   the body is what the items live in: putting it on the header would draw the
   closing line above the three help items instead of under them, and it would
   vanish the moment the section was collapsed. */
#hp-body{
  border-bottom:1px solid var(--border-default);
}
/* The header↔items seam, matching the one Research draws over its first item. */
.hp-header{
  border-bottom:1px solid var(--border-default);
}
/* Research's HEADER↔LIST seam — the exact counterpart of the line the Watchlist
   header draws over its first row (owner, 2026-07-28: "the same border between
   research and supply chain").

   SAME MECHANISM, not merely the same look. Watchlist draws that seam as
   `border-bottom:1px solid var(--border-default)` on `.sidebar-nav` — the box
   that WRAPS its header row — and not as a border-top on `.stock-item` (the
   rows carry their own bottom borders; the first row's top edge is bare).
   Research has no wrapper element, so the identical declaration goes on the
   header row itself: same property, same token, same 1px, same full
   --sidebar-w with no horizontal inset. Restyle either seam and the other has
   the same knob in the same place.
   Flush, like every seam in this file: the header's hover wash paints under its
   own border box, so hovering fills the row right down to the line with no
   uncovered strip. It costs the 1px the line occupies, exactly as the Watchlist
   one does — the items' own boxes are untouched. */
.rs-header{
  border-bottom:1px solid var(--border-default);
  /* NO transition on this border, deliberately, and .wl-header's own
     `transition:background .14s ease` is therefore left to apply untouched.
     A `border-bottom-color var(--sb-toggle)` was tried here so the line would
     fade out on the same clock the list folds on. It also caught the THEME
     FLIP, which is a colour change like any other: measured 300ms after
     MP.setTheme('dark') the Watchlist seam had already snapped to #263140
     while this one was still mid interpolation at rgb(53,63,74), i.e. one 1px
     line in the sidebar visibly arriving late in a palette everything else
     changed instantly. The seam this copies has no transition; neither does
     this one. */
}
/* ...but only while there is a list under it. Collapsed — either half of that
   state: the pre-paint `:root.rs-shut` stamp or app.js's `.collapsed`, which are
   kept in step (see .sb-body.collapsed above) — and in the 64px rail, where
   #rs-body is hidden outright (see the rail rule below), the next thing under
   this header is `.wt-header`'s OWN border-top. Two 1px seams stacked read as a
   single 2px line: a divider dividing nothing, and heavier than every other
   seam in the sidebar.
   COLOUR, not width: the 1px box stays, so the header never moves by a pixel
   between the two states and its hover wash still fills the row edge to edge.
   Same idiom as `.stock-item.si-closed` in 03-sources.css. */
:root.rs-shut .rs-header,
.rs-header:has(+ .sb-body.collapsed),
:root:not(.sb-open) .sidebar .rs-header{
  border-bottom-color:transparent;
}
/* THE WATCHLIST HALF OF THE SAME TRAP (owner, 2026-08-03: "there is a thick
   line between watchlist and research"). Collapsing the Watchlist folds
   #wl-body to nothing, which brings `.sidebar-nav`'s bottom border and
   `.rs-header`'s top border onto THE SAME PIXEL ROW: measured, both landed at
   y=99 and painted as a single 2px line, twice every other seam in the file.
   Every separator in the sidebar is otherwise exactly 1.00 css px (verified by
   sampling the rendered pixels, not by reading the stylesheet).
   The watchlist header's own seam is the one that goes, not Research's: with
   the list folded away there is no list for it to be the top of, while
   `.rs-header`'s border is still doing real work dividing two sections.
   Colour, not width, so the header never moves by a pixel — the same idiom the
   two rules below use.
   Root class only, with no `:has(+ ...)` twin: `.sidebar-nav` is not a sibling
   of `#wl-body` (`#rescore-bar` and `.wl-scroll` sit between them), so the
   sibling form those rules use cannot be written here. app.js's section
   controller sets `.collapsed` and `wl-shut` together, so the single form is
   complete. */
:root.wl-shut .sidebar-nav{
  border-bottom-color:transparent;
}
/* HELP IS NOT THE SAME CASE AS RESEARCH, and copying its treatment was the bug
   (owner, 2026-08-03: "put one of those lines under the help when it's
   collapsed"). Research suppresses its header seam while collapsed because the
   next thing under it is `.wt-header`'s OWN border-top, and two 1px seams stack
   into one 2px line. Help is the LAST section: the only thing under a collapsed
   Help is `#hp-body`, which carries the stack's closing seam — and while
   collapsed that box is `opacity:0`, so its border is not painted at all.
   Suppressing the header's border on top of that left the section with NO
   closing line: the help row just ran into the account chip.
   So the two collapsed selectors are gone and the header's own border is the
   closing seam whenever the section is folded. Nothing can double against it:
   the box that would have doubled is the invisible one.
   The RAIL variant stays. There, `#hp-body` is not collapsed — the three help
   items are still laid out as an icon column — so it paints the closing line
   itself, exactly as it does when the section is open. */
:root:not(.sb-open) .sidebar .hp-header{
  border-bottom-color:transparent;
}
/* SECTION BODY — the components of a section (Watchlist: rows + Add Stock;
   Research: the eva surfaces). Collapsing a section hides its whole body, so
   Add Stock folds away WITH the list it belongs to. */
.sb-body{
  display:flex;flex-direction:column;width:var(--sidebar-w);
  /* HEIGHT 0<->AUTO, NOT MAX-HEIGHT 0<->NONE. This used to be
     `max-height:0` against an implicit `max-height:none`, and that pair is NOT
     interpolable: every section snapped its full height open (and shut) on the
     first frame after the click, so the rows and the Add Stock pair simply
     appeared. Measured before the change, the chevron path produced ONE
     distinct height across 20 sampled frames — a discrete jump, on both legs,
     for all three sections.
     `height:0 <-> auto` IS interpolable with `interpolate-size:allow-keywords`
     (Chrome 129+), which is the mechanism #rs-body already declared for its
     rail path; it just was not the property the chevron was animating. Where
     the keyword interpolation is unsupported the declaration is dropped and
     this degrades to exactly the old discrete jump, never worse.
     `overflow:hidden` is load-bearing for it — the growing box must clip its
     own content rather than reflow it — and it lives HERE, on both states, so
     no discrete overflow flip is committed in the same style change (that
     cancels the size interpolation outright; verified when only the expand leg
     silently snapped while the collapse leg eased). */
  interpolate-size:allow-keywords;
  height:auto;
  overflow:hidden;
  transition:height var(--sb-toggle), opacity .18s ease;
}
/* The root variants are the PRE-PAINT half of the same state: the inline head
   script in app.html stamps them from localStorage before <body> exists, so a
   section the user left collapsed is already collapsed on the first frame
   instead of painting open and folding shut once deferred app.js catches up.
   app.js's section controller keeps .collapsed and the root class in step, and
   they are equally specific (0,2,0), so neither can shadow the other. */
.sb-body.collapsed,
:root.wl-shut #wl-body,
:root.hp-shut #hp-body,
:root.rs-shut #rs-body{
  flex:0 0 auto;height:0;opacity:0;pointer-events:none;
}
/* Collapsed rail shows ONLY the icon; the text reveals when the rail opens
   (same pattern as the Add Stock label + stock names).
   NO max-width ANIMATION (2026-07-25). The box is a CONSTANT 7rem in both
   states and the reveal is opacity + transform only — the .si-info pattern
   above. Animating max-width made this a layout reveal running on its own
   .26s/.12s (out) and .22s/0 (back) clock, and layout animations land on
   whichever frame the main thread manages to produce: measured, these labels
   finished up to 33ms before the panel on the way out and 134-212ms before it
   on the way back, with a 78ms run-to-run swing.
   Freezing the width is safe because NOTHING is positioned off it: the rail's
   icon column is centred by explicit transforms (see the collapsed-rail
   centering block below), .wl-label is flex:1 and .research-nav-btn is a fixed
   --sidebar-w row, so the (invisible, opacity:0) text changes no geometry. It
   is only ever painted past --rail-w, where .sidebar-clip's clip-path hides
   it. Do NOT reintroduce max-width here. */
/* .sb-count rides this group: in the rail the header is a centred icon and a
   count pill beside it would read as a badge on that icon. Opacity only, like
   its neighbours — it is painted past --rail-w where .sidebar-clip's clip-path
   hides it, so it changes no geometry either. */
.wl-label-text,.research-nav-label,.help-nav-label,.sb-count{
  max-width:7rem;opacity:0;overflow:hidden;white-space:nowrap;
  transform:translateX(-0.375rem);
  transition:opacity var(--sb-toggle), transform var(--sb-toggle);
}
:root.sb-open .sidebar .wl-label-text,
:root.sb-open .sidebar .research-nav-label,
:root.sb-open .sidebar .help-nav-label,
:root.sb-open .sidebar .sb-count{
  opacity:1;transform:translateX(0);
  transition:opacity var(--sb-toggle), transform var(--sb-toggle);
}
/* Low-light hover wash. On a SECTION HEADER it belongs to the whole row — the
   label is inset by the row's padding and stops before the chevron, so washing
   the label alone lit only part of the section (same reason the accent line
   moved to the row). The row is always laid out at --sidebar-w and merely
   clipped, so the wash fills the collapsed rail edge to edge too.
   The Research items already span the full width, so they wash themselves. */
/* The wash fires on EVERY section header, open or not — the open section is the
   one you hover most, and having it alone go dead reads as broken. Its accent
   line and accent label stay on top; only the row's background changes. */
/* The selected section keeps that same hover wash (`:has` an active label), so a
   CLICK looks exactly like a HOVER — no separate/louder selected style. `:has`
   here is a cold nav-state selector (3 headers, changes only on navigation), not
   a hot per-frame path, so the perf reason the app avoids `:has` doesn't apply. */
/* SECTION HEADERS ONLY. The Research ITEMS used to ride this same rule, so they
   washed with a different grey (text-primary 6%) on a different clock than the
   watchlist ROWS sitting right beside them — two lists in one sidebar behaving
   like two products. They conform to `.stock-item` now; their hover/active pair
   lives with the rest of `.research-nav-btn` further down this file. */
.wl-header:hover,
.wl-header:has(.wl-label.active){
  background:color-mix(in srgb, var(--text-primary) 6%, transparent);
}
.wl-header:hover .wl-label:not(.active){
  color:var(--text-primary);
}
.wl-chevron{
  flex:0 0 auto;width:1.75rem;height:2.5rem;padding:0;
  display:flex;align-items:center;justify-content:center;
  border:none;background:transparent;cursor:pointer;
  color:var(--text-muted);
  opacity:1;
  transition:color .14s ease, opacity var(--sb-toggle);
}
.wl-chevron svg{transition:transform .2s var(--ease-out);}
.wl-chevron[aria-expanded="false"] svg{transform:rotate(-90deg);}
.wl-chevron:hover{color:var(--text-primary);}
/* The chevron only acts when the rail is open — hide it in the collapsed rail.
   The opacity flip carries --sb-toggle above; before that it had no transition
   at all and popped on the first frame after the click, i.e. ~370ms before the
   panel finished, at a moment that moved 30-40ms run to run. */
:root:not(.sb-open) .sidebar .wl-chevron{opacity:0;pointer-events:none;}

/* ── Collapsed-rail icon centering ──────────────────────────────────────────
   The rail is --rail-w (64px) but every icon row is laid out at --sidebar-w
   with a left padding meant for the EXPANDED panel, so its icon landed left of
   the rail's centre line (the toggle arrow, at 20px against a 32px centre, is
   where this was most obvious). The stock logos and the Add Stock + square were
   already centred by their own geometry; these three rows were not.

   Centre = --rail-w / 2. Travel = centre - (row's left padding) - (icon / 2).
   Done with a transform (composite-only) rather than by animating padding, so
   the rail toggle stays layout-free — see the PERF note at the top.

   KEYED ON :root:not(.sb-open), NOT on .sidebar:not(.expanded) (2026-07-28).
   `.expanded` only lands when deferred app.js runs; `sb-open` is stamped on
   <html> before first paint by the inline script in app.html's head. While the
   rail was the first-visit default the difference was invisible, because the
   two agreed on the very first frame for almost everyone. Now that OPEN is the
   default, every rule still reading `.expanded` would paint its rail variant
   first and snap once app.js caught up — the exact flash the pre-paint stamp
   exists to prevent. Anything that must look right before app.js runs belongs
   on the root class. */
:root:not(.sb-open) .sidebar .wl-label svg{
  /* padding: .75rem (header) + .25rem (label) = 1rem; icon 15px = .9375rem */
  transform:translateX(calc(var(--rail-w) / 2 - 1rem - 0.46875rem));
}
:root:not(.sb-open) .sidebar .research-nav-btn svg,
:root:not(.sb-open) .sidebar .help-nav-btn svg{
  /* padding .75rem; icon 15px */
  transform:translateX(calc(var(--rail-w) / 2 - 0.75rem - 0.46875rem));
}
:root:not(.sb-open) .sidebar .sidebar-toggle .st-icon{
  /* padding .75rem; icon 16px = 1rem */
  transform:translateX(calc(var(--rail-w) / 2 - 0.75rem - 0.5rem));
}
.wl-label svg,.research-nav-btn svg,.help-nav-btn svg{
  transition:transform var(--sb-toggle);
}
:root.sb-open .sidebar .wl-label svg,
:root.sb-open .sidebar .research-nav-btn svg,
:root.sb-open .sidebar .help-nav-btn svg{
  transform:none;
  transition:transform var(--sb-toggle);
}

/* The scroll well holding BOTH sections. flex:1 so the account chip stays
   pinned at the bottom. Its scrollbar is the app-wide slim one (see the shared
   rule in 03-sources.css — same bar as the GRAPHS drawer). */
.wl-scroll{
  flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;
  display:flex;flex-direction:column;width:var(--sidebar-w);
}
/* ── WHY THE WELL NEEDS THIS TO SCROLL AT ALL ───────────────────────────────
   The well is a COLUMN FLEX container, so its children are flex items and
   default to `flex-shrink:1`. A flex item is normally saved from being crushed
   by its automatic minimum size (`min-height:auto` → min-content) — but that
   protection is switched OFF for any item whose overflow is not `visible`.

   #rs-body carries `overflow:hidden` (it is load-bearing for the height:0↔auto
   collapse interpolation — see the GEOMETRY MORPH note below), so its automatic
   minimum size resolves to ZERO. On a short viewport the flex algorithm
   therefore handed the entire overflow to the Research body instead of letting
   the well overflow: measured at 1100x600 with every section expanded, #rs-body
   was squeezed from its natural 122px down to 7px and its own overflow:hidden
   clipped all four Research items (Supply chain, Screener, Top Picks, Paper
   Trading) out of existence. Because the content had been absorbed rather than
   overflowed, .wl-scroll's scrollHeight equalled its clientHeight — so
   `overflow-y:auto` produced no scrollbar and there was literally nothing to
   scroll to. That is the "expand every section on a small screen and it won't
   let me scroll down" bug.

   The well is the ONLY box here allowed to absorb a height shortfall, and it
   absorbs it by SCROLLING. So nothing inside it may shrink: pin every direct
   child at its natural height and let the overflow reach the scroller. Stated
   on the child (not as `min-height:0` juggling) because the sections must keep
   their exact resting geometry — this changes nothing whenever the content
   already fits, which is every viewport tall enough to hold it.

   Collapsing still works: `.sb-body.collapsed` / `#rs-body` drive `max-height`
   and `height`, not flex-shrink, and they are more specific than this rule. */
.wl-scroll > *{flex-shrink:0;}
/* Research ITEMS — components INSIDE the section, not peers of its header.
   The header is the section label (uppercase, letterspaced, muted); the items
   are list rows under it (title case, normal weight, indented past a guide
   line). Given the same treatment they read as three sibling sections, which
   is exactly what this hierarchy exists to prevent. */
/* GEOMETRY MORPH 3 of 3 (see the ONE CLOCK note at the top). This one is real
   vertical motion — folding Research away lifts the Wallet header ~112px — so
   it cannot be a transform, and unlike the labels its box CANNOT stay put.
   It used to be `max-height:0` against an implicit `max-height:none`, and
   0↔none is NOT interpolable: the whole section (and the Wallet row under it)
   jumped its full height on the FIRST frame after the click. Measured, that
   landed ~360-410ms before the panel edge finished, on a frame whose timing
   moved 30-40ms run to run — the single most visible desync of the toggle.
   `height:0 ↔ auto` IS interpolable with `interpolate-size:allow-keywords`
   (Chrome 129+). Where that is unsupported the declaration is dropped and the
   pair degrades to exactly the old discrete jump — never worse.
   overflow lives HERE, not in the collapsed rule: a discrete overflow/flex
   flip committed in the same style change cancels the size interpolation
   (verified — the expand leg silently snapped while the collapse leg eased).
   The transition list restates `max-height` for the CHEVRON path, which this
   id-specificity rule would otherwise shadow off .sb-body. */
/* The interpolation itself now lives on `.sb-body` so all three sections fold
   on one mechanism and one clock. NOTHING height-related may be restated here:
   `#rs-body` is (1,0,0) and `.sb-body.collapsed` is (0,2,0), so a `height:auto`
   on this rule would WIN over the collapsed state and the chevron would stop
   working. That is exactly why the declarations moved up rather than being
   duplicated. */
#rs-body{
  position:relative;
}
/* In the COLLAPSED RAIL the labels and the indent are gone, so the header icon
   and its two item icons become three identical glyphs in a column — they read
   as three sections rather than a section and its options. So the rail shows
   section HEADERS only: Research folds down to its own icon (clicking it still
   opens the whole tool landing), and the items appear when the panel opens. The
   watchlist rows stay because a company logo never reads as a section header.
   Root class, not `.sidebar:not(.expanded)`, so the pre-paint stamp decides this
   on frame one — see the centering block above for the full reasoning. */
:root:not(.sb-open) .sidebar #rs-body{
  height:0;opacity:0;pointer-events:none;
}
/* ── RESEARCH LIST CAP: SEVEN ROWS, THEN IT SCROLLS ─────────────────────────
   The section carries seventeen items at Warden and kept growing with every
   new research surface, which pushed Wallet and Help off the bottom of the
   well and made the sidebar one long scroll. It now shows --rs-max-items rows
   and scrolls to the rest.

   THE CAP IS ON THIS WRAPPER, NOT ON #rs-body — see the matching note in
   app.html. #rs-body owns the collapse interpolation and its `overflow:hidden`
   is load-bearing for it (GEOMETRY MORPH 3 above): an overflow flip committed
   in the same style change cancels the size animation, and a `max-height` here
   would also fight `.sb-body.collapsed`'s `max-height:0` on specificity
   (`#rs-body` is 1,0,0 and would WIN, breaking the chevron collapse). Keeping
   the two boxes separate means the collapse keeps its exact resting geometry
   and this rule never participates in it.

   The count is a custom property so raising it later is a one-number edit; the
   2.5rem factor is `.research-nav-btn`'s own height, restated below. Change
   both together if that row height ever moves. */
.rs-scroll{
  --rs-max-items:7;
  display:flex;flex-direction:column;
  width:var(--sidebar-w);
  flex:0 0 auto;
  max-height:calc(var(--rs-max-items) * 2.5rem);
  overflow-y:auto;overflow-x:hidden;
  /* NOT overscroll-behavior:contain (reverted, QA 2026-09, sidebar link
     collision defect). Containing the scroll here reads smoother, but with a
     seventeen-item list it also means a wheel gesture that bottoms out this
     7-row window goes nowhere: Wallet, Help and the account footer sit BELOW
     this box inside .wl-scroll, and containment blocks exactly the chaining
     that would carry the same gesture on into that outer scroller. Measured:
     with a 7-stock watchlist + the full research list, Economic clock /
     Scanner / Refinery outages / Wallet / Help were unreachable by scrolling
     the research pane to its end — the outer well never moved, so those rows
     stayed clipped by .wl-scroll while elementFromPoint on their old layout
     position hit the account chip or a stock row painted there instead.
     Leaving overscroll-behavior at its default (auto) lets the leftover wheel
     delta chain to .wl-scroll once this list is exhausted, so one continuous
     scroll reaches every row. The mild lurch this reintroduces is preferable
     to controls that cannot be reached at all. */
  /* The scrollbar is NOT declared here. .rs-scroll joins the shared slim-bar
     group in 03-sources.css beside .stock-list, because these two lists are
     stacked in one column and a bespoke bar on one of them reads as a bug —
     the same reasoning `.research-nav-btn` follows in conforming to
     `.stock-item`. Its transparent-border override is in that group too. */
}
/* ── "THERE IS MORE BELOW": EDGE FADE + HEADER COUNT ────────────────────────
   Both sidebar lists cap at seven rows and scroll inside themselves (the
   watchlist at 28rem in 03-sources.css, Research just above). Capped lists
   ending on a clean edge read as lists that END — the owner's report was that
   neither section showed there was more, nor that it scrolled at all. Two
   signals, both driven by js/lib/sidebar-scroll.js measuring the real DOM:

     .sb-scrollable   the list actually overflows
     .sb-more-above   there is content past the top edge
     .sb-more-below   there is content past the bottom edge

   A MASK, not a gradient overlay. The sidebar is a gradient (--bg-primary to
   --bg-sink, see the scrollbar note in 03-sources.css), so an overlay painted
   in one flat colour would band against it and would need re-stating for the
   other theme. Masking to transparent reveals whatever the sidebar is actually
   painting at that pixel, in both themes, for free.

   Only ever applied while .sb-scrollable is on, so a list that fits carries no
   mask at all: no fade, no compositing layer, and the last row keeps a hard
   edge instead of a permanent soft one that would imply more content. */
.stock-list.sb-scrollable,
.rs-scroll.sb-scrollable{
  --sb-fade:1.25rem;
  --sb-fade-top:0px;
  --sb-fade-bot:0px;
  -webkit-mask-image:linear-gradient(to bottom,
      transparent 0, #000 var(--sb-fade-top),
      #000 calc(100% - var(--sb-fade-bot)), transparent 100%);
  mask-image:linear-gradient(to bottom,
      transparent 0, #000 var(--sb-fade-top),
      #000 calc(100% - var(--sb-fade-bot)), transparent 100%);
}
/* Not transitioned on purpose. Each of these flips exactly once, at the moment
   the list leaves an end, and it flips WHILE the user is already scrolling —
   an eased fade there is motion nobody sees, on the one code path in the
   sidebar that runs on every wheel tick. */
.stock-list.sb-more-above,.rs-scroll.sb-more-above{--sb-fade-top:var(--sb-fade);}
.stock-list.sb-more-below,.rs-scroll.sb-more-below{--sb-fade-bot:var(--sb-fade);}

/* Section header count — how many rows EXIST, which a seven-row window cannot
   otherwise tell you. Sized and coloured as a stat rather than a label: it sits
   in the same row as an uppercase letterspaced section header and must not
   compete with it. Empty until the helper writes a number (the watchlist starts
   empty and renders async), so it never paints a stray pill on first frame. */
.sb-count{
  flex:0 0 auto;
  margin-left:auto;margin-right:0.375rem;
  padding:0 0.375rem;
  min-width:1.25rem;height:1.25rem;line-height:1.25rem;
  border-radius:99px;
  /* A color-mix off --text-primary, NOT --bg-hover: the sidebar is a gradient,
     so a flat surface token lands at a different contrast at the top of the
     well than at the bottom and disappeared entirely against the lighter end.
     Mixing from the text colour tracks both themes on its own. */
  background:color-mix(in srgb, var(--text-primary) 8%, transparent);
  color:var(--text-muted);
  font-family:var(--font-sans);font-size:0.6875rem;font-weight:700;
  letter-spacing:0.02em;text-align:center;
  white-space:nowrap;
}
.sb-count-empty{display:none;}

/* The scrollbar gutter eats 8px out of the content box, and .research-nav-btn
   is pinned at a FIXED var(--sidebar-w) (deliberately — see the .wl-label-text
   block above, the rail's geometry depends on it). Left alone, every row would
   overhang the gutter, get clipped by overflow-x, and its hover wash would stop
   8px short of the right edge — a hovered row with an unpainted strip down its
   side. Inside the scroller the rows track the content box instead. This is
   scoped to .rs-scroll so the rail rows keep the fixed width they rely on. */
.rs-scroll .research-nav-btn{width:100%;}
/* NO GUIDE LINE HERE (removed 2026-07-28). #rs-body used to draw a 1px vertical
   rule down its left edge tying the items to their header. The Watchlist
   section has no equivalent, and the owner's read of the two side by side was
   that Research looked like a different kind of thing — so it went, for parity.
   The 2rem indent below stays: that is what says "these belong to the header",
   and it is layout, so it survives on its own. Do not reintroduce a rule, a
   bracket or a bar in this gutter without checking with the owner first. */
.research-nav-btn,.help-nav-btn{
  display:flex;align-items:center;gap:0.5rem;justify-content:flex-start;
  /* 2.5rem, matching .wl-label (the section headers) and the sidebar toggle —
     it was 2.25rem, so its hover wash painted a 36px band wedged between 40px
     ones and read as a mis-sized rectangle. */
  flex:0 0 auto;width:var(--sidebar-w);height:2.5rem;
  padding:0 0.75rem;box-sizing:border-box;
  border:none;border-radius:0;
  background:transparent;color:var(--text-secondary);
  font-family:var(--font-sans);font-size:0.75rem;font-weight:600;
  letter-spacing:0.01em;text-transform:none;cursor:pointer;
  /* .12s var(--ease-out) is `.stock-item`'s clock, copied deliberately: the two
     lists are stacked in one column, so a different duration or curve on the
     same gesture reads as a bug. `padding` keeps --sb-toggle because it is the
     rail morph, not a hover. */
  transition:color .12s var(--ease-out),background .12s var(--ease-out),padding var(--sb-toggle);
}
/* Indent, marking these as the header's options — expanded only, so the rail
   keeps its centred icon column (see the collapsed-rail centering block above).
   This is the ONLY thing expressing the parent/child relation now that the
   guide line is gone, so it is load-bearing. */
:root.sb-open .sidebar .research-nav-btn,
:root.sb-open .sidebar .help-nav-btn{
  padding-left:2rem;
  transition:color .12s var(--ease-out),background .12s var(--ease-out),padding var(--sb-toggle);
}
.research-nav-btn svg,.help-nav-btn svg{flex:0 0 auto;}
/* ── Research item hover + selected: A CARBON COPY OF .stock-item ────────────
   Same grey source (--bg-hover, not a color-mix of the text colour), same lack
   of a `:not(.active)` guard, same source order — hover first, active second,
   equal specificity — so the selected item wins over its own hover exactly the
   way a selected watchlist row does. Conform to 03-sources.css's `.stock-item`
   / `.stock-item.active` pair; that block is the reference, this one follows.

   REMOVED 2026-07-28, all three at the owner's request: the `inset 2px 0 0
   var(--accent)` left bar ("the vertical green line"), the accent gradient that
   faded out to the right, and `color:var(--accent)` on the label. What is left
   is a flat single-opacity wash at one accent strength edge to edge — the same
   reasoning `.stock-item` documents for dropping its own bar and gradient: a
   fill that changes weight across the row reads as two states at once.
   The label goes to full ivory instead of accent, matching `.wl-label.active`
   (its section header) — prominence marks the current item, not hue. Nothing
   here touches layout: the bar was an inset shadow and the wash is a
   background, so selecting an item has never moved the label by a pixel, and
   the padding above is unchanged so it still cannot. */
.research-nav-btn:hover,.help-nav-btn:hover{background:var(--bg-hover);color:var(--text-primary);}
.research-nav-btn.active{
  color:var(--text-primary);
  background:color-mix(in srgb, var(--accent) 9%, transparent);
}
.stg-select,.stg-pick{
  width:100%;padding:0.4375rem 0.625rem;border:1px solid var(--border-default);
  border-radius:var(--radius-sm);background:var(--bg-tertiary);color:var(--text-primary);
  font-size:0.8125rem;font-family:var(--font-sans);font-weight:500;cursor:pointer;
  appearance:none;-webkit-appearance:none;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='none' stroke='%236b7c93' stroke-width='1.6'><polyline points='4,6 8,10 12,6'/></svg>");
  background-repeat:no-repeat;background-position:right 10px center;padding-right:1.875rem;
  transition:border-color .15s;
}
.stg-select:hover,.stg-pick:hover{border-color:var(--text-muted);}
.stg-select:focus,.stg-pick:focus{outline:none;border-color:var(--accent);}



/* ── Arrival from home (?enter=1): the sidebar glides in from the left as the
   opening beat of the entrance; the command-center cascade follows ~280ms
   later (command-center.js). Classes are stripped ~1s in, restoring stock
   styles (the transient transform is gone before any fixed-position child
   could care). */
html.arrive-enter .sidebar{ transform:translateX(-105%); }
html.arrive-enter.arrive-go .sidebar{
  transform:none;
  transition:transform 550ms cubic-bezier(0.22, 1, 0.36, 1);
}
/* NOTHING may pop in before the sidebar leads: the whole main column waits,
   then fades in while the sidebar is finishing (the cascade fires ~280ms in,
   so panels rise as the column appears — no flicker-before-sidebar). */
html.arrive-enter .main{ opacity:0; }
html.arrive-enter.arrive-go .main{
  opacity:1;
  /* !important: 04-header's `body.sb-anim .main{transition:margin-left}`
     loads later in the cascade and would otherwise clobber this fade —
     the content would pop in before the sidebar (QA finding #1) */
  transition:opacity 420ms ease 240ms !important;
}
/* The closed graphs drawer pokes ~55px into the viewport under the sidebar;
   with the sidebar off-screen it would show down the left edge of every
   transition frame (QA finding #3). */
html.arrive-enter #gtb-modal,
html.leave-home #gtb-modal{ visibility:hidden !important; }
/* Same family of bug as the graphs drawer above, owner report 2026-07-26:
   "when I go from a stock chart to homepage, I see the trade panel stays
   instead of fading away in the transition." Both the ticket drawer and its
   rail tab are position:fixed (they dock under the header), so they are NOT
   children of .main and the .main opacity fade below never touches them —
   they sat on top of an otherwise empty transition frame.

   visibility, NOT opacity, and deliberately no transition: the owner asked for
   it to "go away immediately to not ruin the smoothness", and a second fade
   running alongside the sidebar glide is exactly the competing motion that
   read as jank. Nothing here animates .trade-overlay's WIDTH, which remains
   forbidden (see 12-trade-wallet.css).

   leave-home ONLY, not arrive-enter: on arrival the dock is governed by its own
   reveal gate, which already solved a flicker by controlling when it unhides.
   Adding a second authority over that would risk reintroducing it. */
html.leave-home #trade-overlay,
html.leave-home .trade-rail{ visibility:hidden !important; }
/* While chrome is absent (arrival start / brand exit), the body is home's
   flat ground: NO square grid (T9 round 6, owner 2026-10-24: the hand off
   showed the old graph paper grid, which neither side uses any more). */
/* Smooth bg-color handoff: arrival opens on HOME's exact dark (#110f0d) and
   eases to the active theme's surface — light themes a smooth rise to cream
   instead of a flash. The brand exit eases back down to home's dark before
   the navigation fires.

   #110f0d IS DELIBERATELY HARDCODED: it is home's --bg-primary (home.css
   palette:tokens), the other half of the seam. Since T9 palette p3
   (2026-10-24) home's ground is the same stone as this app's --bg-primary,
   but home does not import tokens.css, so the pair is named on both sides
   and pinned by tests/core/test_arrival_theme_css.py. Change it only
   together with home's ground. (History: #09090b until T9 round 5, then
   #0e0b0b until palette p3.) */
html.arrive-enter body{ background-color:#110f0d; }
html.arrive-enter.arrive-go body{
  background-color:var(--bg-primary);
  transition:background-color 700ms ease;
}
html.leave-home body{
  background-color:#110f0d;
  transition:background-color 500ms ease;
}
/* LIGHT THEME (owner 2026-10-21: "the page suddenly turns black for a sec
   and then back to the theme"). The dark frame above assumed home is always
   dark; home has had a light theme (the default) since 2026-09-29, shared
   with this app through the mp-theme cookie, so in light the arrival opened
   on black between home's parchment and the app's cream. In light the seam
   is home's LIGHT ground instead: #f7f3ed is home's light --bg-primary
   (home/static/css/home.css palette:tokens; #f4f0e6 until T9 palette p3),
   with no grid (T9 round 6). Hardcoded for the same reason as #110f0d:
   the handoff names home's colour, not a dashboard token. data-theme is
   stamped before first paint by theme.js (blocking, in <head>), so the very
   first arrival frame already matches. Dark is unchanged. */
html[data-theme="light"].arrive-enter body,
html[data-theme="light"].leave-home body{ background-color:#f7f3ed; }
html[data-theme="light"].arrive-enter.arrive-go body{ background-color:var(--bg-primary); }
/* ── Brand exit → home (?return=1): the mirror of the arrival. Sidebar
   glides back out left, the main column fades, the bare ground remains;
   app.js navigates at ~430ms into the (usually prerendered) home, whose
   tree rolls in from the left on the other side. */
html.leave-home .sidebar{
  transform:translateX(-105%);
  transition:transform 450ms cubic-bezier(0.45, 0, 0.15, 1);
}
html.leave-home .main{
  opacity:0;
  transition:opacity 320ms ease !important;   /* see the arrive-go note */
}
/* The standalone billing pages (manage, payment) have no sidebar and no
   .main — just a .um-page column — but they link to the same destination
   ({HOME_URL}/plans, via js/lib/plans-link.js) and so play the same send-off.
   Fading the column is the whole exit there; the grid + dark body above still
   apply, so the last frame matches the app's. */
html.leave-home .um-page{
  opacity:0;
  transition:opacity 320ms ease !important;
}

/* ── MIRRORED VARIANT: the dashboard ⇄ plans axis ────────────────────────
   Owner call 2026-07-25: on this axis the dashboard leaves toward the RIGHT
   and the plans page enters from the LEFT, with the return leg the exact
   time-reverse. Home's ENTER (?enter=1) and the brand exit to home
   (?return=1) keep their original direction, so the flip lives in a MODIFIER
   class layered on top of the shared rules instead of inside them:

     • html.leave-home.leave-plans   — goPlans() (app.js) and lib/plans-link.js
       add BOTH classes, so everything shared above (dark body, 60px grid,
       hidden graphs drawer) is reused untouched and only direction changes.
     • html.arrive-enter.arrive-plans — app.html stamps the second class for
       ?enter=plans only.

   NEVER fold these into the one-class rules. html.arrive-enter is shared with
   home's ENTER; editing it in place silently flips a transition the owner
   asked to keep.

   WHAT MOVES, AND WHY NOT JUST THE SIDEBAR. The original leg reads as
   "leftward" because the sidebar slips out of the left edge, a cheap ~105% of
   its own width. Mirrored, that same trick would need the sidebar to cross the
   whole viewport to reach the right edge, dragging the rail over the chart for
   450ms. So the mirrored leg moves the WHOLE app: sidebar, main column, and
   the billing pages' .um-page all translate right by the SAME --nav-shift on
   the same curve, in lockstep — a rigid camera — and dissolve on the way
   instead of travelling far enough to clear frame. The dissolve is what the
   original leg already did to .main; extending it to the sidebar is what buys
   the short travel.

   --nav-shift is a hair over one --sidebar-w (clamp(11.25rem, 14.5vw,
   13.75rem)) and capped, so the amount of motion matches the original leg's
   sidebar slide rather than becoming a whoosh on a 27".

   PERF: .main is already promoted for the opacity fade on both legs, so a
   transform costs no extra layer; and it already carries
   container-type:inline-size, i.e. it is ALREADY the containing block for its
   position:fixed descendants, so the transform changes nothing there either. */
html.leave-home.leave-plans,
html.arrive-enter.arrive-plans{ --nav-shift:clamp(11.25rem, 16vw, 17rem); }

/* Send-off: dashboard → {HOME_URL}/plans?from=watchlist (app.js goPlans and
   lib/plans-link.js both navigate at 430ms, into home's html.plans-arrive). */
html.leave-home.leave-plans .sidebar{
  transform:translateX(var(--nav-shift));
  opacity:0;
  transition:transform 450ms cubic-bezier(0.45, 0, 0.15, 1),
             opacity 320ms ease;
}
html.leave-home.leave-plans .main,
html.leave-home.leave-plans .um-page{
  transform:translateX(var(--nav-shift));
  opacity:0;
  transition:transform 450ms cubic-bezier(0.45, 0, 0.15, 1),
             opacity 320ms ease !important;   /* see the arrive-go note */
}

/* Arrival: home's plans sheet → /watchlist?enter=plans. The time-reverse — the
   app starts one --nav-shift to the RIGHT, faded, and slides left into place.
   Durations and curves are the ?enter=1 arrival's, so both entrances feel like
   the same app arriving, just from opposite sides. */
html.arrive-enter.arrive-plans .sidebar{
  transform:translateX(var(--nav-shift));
  opacity:0;
}
html.arrive-enter.arrive-plans.arrive-go .sidebar{
  transform:none;
  opacity:1;
  transition:transform 550ms cubic-bezier(0.22, 1, 0.36, 1),
             opacity 380ms ease;
}
/* .main inherits `opacity:0` from html.arrive-enter above — content still
   waits for the chrome to lead by 240ms, it just arrives from the other side
   while it does. */
html.arrive-enter.arrive-plans .main{ transform:translateX(var(--nav-shift)); }
html.arrive-enter.arrive-plans.arrive-go .main{
  transform:none;
  opacity:1;
  /* !important for two reasons: 04-header's body.sb-anim .main{transition:
     margin-left} loads later in the cascade, AND the one-class arrive-go rule
     above is itself !important. */
  transition:transform 550ms cubic-bezier(0.22, 1, 0.36, 1),
             opacity 420ms ease 240ms !important;
}
/* The standalone billing pages arrive too. Since 2026-07-25 the plans sheet
   returns you to the page you LEFT (home.js ?back=), so /watchlist/manage and
   /watchlist/payment are arrival targets, not just departure points — they
   already had the leave-plans half above. No sidebar to lead here, so the
   column carries the whole move and needs its own opacity:0 (the shared
   `html.arrive-enter .main` rule can't reach it); no lead-in delay either,
   because there is nothing for it to wait behind. lib/plans-link.js plays it,
   manage.html / payment.html stamp it pre-paint. */
html.arrive-enter .um-page{ opacity:0; }
html.arrive-enter.arrive-go .um-page{
  opacity:1;
  transition:opacity 420ms ease;
}
html.arrive-enter.arrive-plans .um-page{ transform:translateX(var(--nav-shift)); }
html.arrive-enter.arrive-plans.arrive-go .um-page{
  transform:none;
  opacity:1;
  transition:transform 550ms cubic-bezier(0.22, 1, 0.36, 1),
             opacity 420ms ease;
}

@media (prefers-reduced-motion: reduce){
  html.arrive-enter .sidebar{ transform:none; }
  html.arrive-enter .main,
  html.arrive-enter .um-page{ opacity:1; }
  html.arrive-enter.arrive-go .sidebar,
  html.arrive-enter.arrive-go .main,
  html.arrive-enter.arrive-go .um-page{ transition-duration:0.01ms !important; }
  html.leave-home .sidebar, html.leave-home .main,
  html.leave-home .um-page{ transition-duration:0.01ms !important; }
  html.arrive-enter.arrive-go body, html.leave-home body{ transition-duration:0.01ms; }
  /* Same treatment for the mirrored variant — land settled, no roll. */
  html.arrive-enter.arrive-plans .sidebar,
  html.arrive-enter.arrive-plans .main,
  html.arrive-enter.arrive-plans .um-page{ transform:none; opacity:1; }
  html.arrive-enter.arrive-plans.arrive-go .sidebar,
  html.arrive-enter.arrive-plans.arrive-go .main,
  html.arrive-enter.arrive-plans.arrive-go .um-page{ transition-duration:0.01ms !important; }
  html.leave-home.leave-plans .sidebar,
  html.leave-home.leave-plans .main,
  html.leave-home.leave-plans .um-page{ transition-duration:0.01ms !important; }
}
/* Mobile: the sidebar is an overlay drawer — gliding it in "as the opening
   beat" parks it over 40% of the screen (QA finding #6). No arrival
   choreography below the drawer breakpoint. */
@media (max-width:900px){
  html.arrive-enter .sidebar,
  html.arrive-enter.arrive-go .sidebar{ transform:none; transition:none; }
  html.arrive-enter .main,
  html.arrive-enter .um-page{ opacity:1; }
  html.arrive-enter.arrive-go .main,
  html.arrive-enter.arrive-go .um-page{ transition:none !important; }
  /* Mirrored variant too: without this the app would land parked one
     --nav-shift to the right with nothing to slide it back. */
  html.arrive-enter.arrive-plans .sidebar,
  html.arrive-enter.arrive-plans.arrive-go .sidebar{
    transform:none; opacity:1; transition:none;
  }
  html.arrive-enter.arrive-plans .main,
  html.arrive-enter.arrive-plans.arrive-go .main,
  html.arrive-enter.arrive-plans .um-page,
  html.arrive-enter.arrive-plans.arrive-go .um-page{
    transform:none; opacity:1; transition:none !important;
  }
}