/* Shared local navigation only. Financial page styles and global menus keep ownership. */
.mdw-ready { --mdw-rail:232px; --mdw-top:64px; }
.mdw-ready .mdw-frame { display:grid; grid-template-columns:var(--mdw-rail) minmax(0,1fr); align-items:start; min-width:0; }
.mdw-ready .mdw-main { width:100%; min-width:0; margin-left:0; }
.mdw-ready .mdw-sidebar { position:sticky; top:var(--mdw-top); grid-column:1; grid-row:1; display:flex; flex-direction:column; width:100%; min-width:0; height:calc(100dvh - var(--mdw-top)); max-height:calc(100dvh - var(--mdw-top)); padding:0; margin:0; border:0; border-right:1px solid #1b3042; background:#071522; color:#dce7f2; z-index:70; font:400 13px/1.45 'IBM Plex Sans',system-ui,sans-serif; box-sizing:border-box; }
.mdw-ready .mdw-main { grid-column:2; grid-row:1; }
.mdw-sidebar *, .mdw-toolbar * { box-sizing:border-box; }
.mdw-head { display:flex; align-items:center; gap:8px; min-height:80px; padding:16px 14px; flex-shrink:0; }
.mdw-identity { flex:1; min-width:0; }
.mdw-kicker { display:block; color:#88a1b9; font:500 10px/1.4 system-ui,sans-serif; letter-spacing:.12em; margin-bottom:4px; }
.mdw-title { display:block; font:500 15px/1.4 system-ui,sans-serif; color:#eef4fa; }
.mdw-ready .mdw-button { display:inline-flex; align-items:center; justify-content:center; gap:8px; flex-shrink:0; width:36px; height:36px; margin:0; padding:8px; border:1px solid #294154; border-radius:7px; background:transparent; color:#9fb4c8; cursor:pointer; box-shadow:none; font:500 13px/1.3 system-ui,sans-serif; }
.mdw-sidebar svg, .mdw-toolbar svg { width:17px; height:17px; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; flex:none; }
.mdw-ready .mdw-button:hover { background:#102538; color:#f1f6fb; border-color:#3e5d76; }
.mdw-ready .mdw-close { display:none; }
.mdw-filter { display:flex; align-items:center; gap:8px; min-height:38px; margin:0 12px 16px; padding:0 10px; border:1px solid #23394b; border-radius:6px; color:#89a2ba; background:#0b1b2b; }
.mdw-ready #mdw-sidebar .mdw-filter-input { width:100%; min-width:0; height:36px; padding:0; margin:0; border:0; background:transparent; color:#e7eff7; font:400 12px/1.4 system-ui,sans-serif; box-shadow:none; outline:none; }
.mdw-filter:focus-within { outline:2px solid #47adff; outline-offset:2px; }
.mdw-ready .mdw-filter-input:focus-visible { outline:none; box-shadow:none; }
.mdw-filter-input::placeholder { color:#8da4ba; opacity:1; }
.mdw-scroll { min-height:0; flex:1; overflow-y:auto; overscroll-behavior:contain; scrollbar-width:thin; scrollbar-color:#334c61 transparent; padding:0 10px 18px; }
.mdw-group { margin:0 0 16px; padding:0; border:0; background:none; border-radius:0; }
.mdw-group-label { display:flex; align-items:center; justify-content:space-between; gap:8px; min-height:32px; padding:4px 10px 8px; color:#90a8be; font:500 10px/1.4 system-ui,sans-serif; letter-spacing:.09em; text-transform:uppercase; cursor:pointer; list-style:none; }
.mdw-group-label::-webkit-details-marker { display:none; }
.mdw-group-label svg { width:12px; height:12px; transition:transform .15s; }
.mdw-group[open] > .mdw-group-label svg { transform:rotate(90deg); }
.mdw-group-items { display:grid; gap:3px; }
.mdw-ready .mdw-item { display:flex; align-items:center; gap:10px; width:100%; min-width:0; min-height:40px; margin:0; padding:9px 10px; border:1px solid transparent; border-radius:6px; background:transparent; box-shadow:none; text-align:left; text-decoration:none; color:#afc1d3; font:400 13px/1.45 'IBM Plex Sans',system-ui,sans-serif; cursor:pointer; }
.mdw-ready .mdw-item:hover { background:#0e2234; color:#f1f6fb; }
.mdw-ready .mdw-item[aria-current=page] { color:#edf6ff; background:#102d45; border-color:#24516f; font-weight:500; }
.mdw-item[aria-current=page] > svg { color:#4eb5ff; }
.mdw-item-label { flex:1; min-width:0; overflow-wrap:break-word; }
.mdw-gate { display:flex; color:#849db5; }
.mdw-gate svg { width:12px; height:12px; }
.mdw-foot { display:flex; align-items:center; gap:8px; flex:none; margin:0 14px; padding:16px 0; border-top:1px solid #1b3042; color:#8ca3b9; font-size:11px; }
.mdw-foot-dot { width:5px; height:5px; border-radius:50%; background:#4484a8; flex:none; }
.mdw-empty { color:#a6bbce; padding:8px 10px; font-size:13px; }
.mdw-ready .mdw-toolbar { display:flex; align-items:center; gap:12px; flex-wrap:wrap; min-height:56px; padding:8px 16px; border-bottom:1px solid #1b3042; background:#08131e; color:#d9e6f2; margin:0; }
.mdw-ready .mdw-toolbar { position:sticky; top:var(--mdw-top); z-index:50; }
.mdw-ready .mdw-opener { display:none; }
.mdw-context { font:500 13px/1.4 system-ui,sans-serif; }
.mdw-current { display:flex; align-items:center; gap:10px; order:1; color:#93abc1; font:400 12px/1.4 system-ui,sans-serif; }
.mdw-current svg { width:12px; height:12px; }
.mdw-toolbar > .topbar-spacer, .mdw-toolbar > .mdw-quick-search { order:2; }
.mdw-toolbar > .market-pill, .mdw-toolbar > .spot-ticker { order:3; }
.mdw-ready .mdw-quick-search { display:flex; align-items:center; gap:6px; margin:0 0 0 auto; width:min(360px,100%); }
.mdw-ready .mdw-quick-search input { width:100%; min-width:0; height:36px; padding:0 10px; border:1px solid #294154; border-radius:6px; background:#0c1d2b; color:#e1ebf4; font-size:12px; }
.mdw-ready .mdw-quick-search button { min-height:36px; padding:6px 12px; border:1px solid #294154; border-radius:6px; background:#122c40; color:#d9eafb; font:500 12px/1.4 system-ui,sans-serif; cursor:pointer; }
.mdw-ready [hidden] { display:none !important; }
.mdw-sr { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
.mdw-ready .mdw-sidebar :is(a,button,summary):focus-visible, .mdw-ready .mdw-toolbar :is(a,button,input):focus-visible { outline:2px solid #47adff; outline-offset:2px; }
/* Original server navigation remains the fallback until enhancement succeeds. */
body.mdw-ready[data-md-sidebar=charting] .suite-sidebar,
body.mdw-ready[data-md-sidebar=charting] #primary-subnav,
body.mdw-ready[data-md-sidebar=charting] #local-nav-toggle,
body.mdw-ready[data-md-sidebar=fo] .md-sidebar,
body.mdw-ready[data-md-sidebar=fo] .md-local-nav > .nav,
body.mdw-ready[data-md-sidebar=fo] .nav-toggle-input,
body.mdw-ready[data-md-sidebar=fo] .nav-toggle-btn,
body.mdw-ready[data-md-sidebar=commentary] > .suite-sidebar,
body.mdw-ready[data-md-sidebar=commentary] > .suite-backdrop,
body.mdw-ready[data-md-sidebar=commentary] .workspace-shell > .local-nav,
body.mdw-ready[data-md-sidebar=crypto] #v2-sidebar,
body.mdw-ready[data-md-sidebar=crypto] #v2-drawer-button,
body.mdw-ready[data-md-sidebar=portfolio] .sp-analysis-nav,
body.mdw-ready .mdw-source { display:none; }
body.mdw-ready[data-md-sidebar=commentary] { display:block; }
body.mdw-ready[data-md-sidebar=commentary] > .mdw-sidebar { position:fixed; top:var(--mdw-top); left:0; width:var(--mdw-rail); }
body.mdw-ready[data-md-sidebar=commentary] .workspace-shell { width:calc(100% - var(--mdw-rail)); margin-left:var(--mdw-rail); }
body.mdw-ready[data-md-sidebar=charting] .masthead { position:sticky; top:var(--mdw-top); }
body.mdw-ready[data-md-sidebar=fo] .brand { padding:0; gap:8px; }
body.mdw-ready[data-md-sidebar=fo] .brand-mark { display:none; }
body.mdw-ready[data-md-sidebar=fo] .brand-word { font:500 13px/1.4 system-ui,sans-serif; }
body.mdw-ready[data-md-sidebar=charting] .topbar-right { order:3; }
body.mdw-ready[data-md-sidebar=screener] :is(#sp-sc-builder-title,#formula-saved,#formula-help,#screen-results) { scroll-margin-top:calc(var(--mdw-top) + 76px); }
.mdw-ready .mdw-mini { --mdw-rail:64px; }
body.mdw-ready.mdw-mini { --mdw-rail:64px; }
.mdw-mini .mdw-identity, .mdw-mini .mdw-filter, .mdw-mini .mdw-group-label, .mdw-mini .mdw-item-label, .mdw-mini .mdw-gate, .mdw-mini .mdw-foot-label { display:none; }
.mdw-mini .mdw-head { justify-content:center; padding:12px 0; min-height:64px; }
.mdw-mini .mdw-scroll { padding:0 9px 16px; }
.mdw-mini .mdw-group { margin-bottom:12px; padding-top:10px; border-top:1px solid #1b3042; }
.mdw-mini .mdw-group > .mdw-group-items { display:grid; }
.mdw-mini .mdw-item { justify-content:center; padding:10px 0; }
.mdw-mini .mdw-foot { justify-content:center; margin:0 12px; }
.mdw-scrim { position:fixed; inset:var(--mdw-top) 0 0; z-index:1090; border:0; background:rgba(0,7,14,.68); padding:0; margin:0; }
@media(max-width:1199px) {
  .mdw-ready .mdw-frame { display:block; }
  .mdw-ready .mdw-main { width:100%; margin-left:0; }
  .mdw-ready .mdw-sidebar, body.mdw-ready[data-md-sidebar=commentary] > .mdw-sidebar { display:none; position:fixed; top:var(--mdw-top); left:0; width:min(320px,calc(100vw - 40px)); height:calc(100dvh - var(--mdw-top)); max-height:calc(100dvh - var(--mdw-top)); z-index:1100; box-shadow:16px 0 40px #0005; }
  .mdw-ready .mdw-sidebar.mdw-open, body.mdw-ready[data-md-sidebar=commentary] > .mdw-sidebar.mdw-open { display:flex; animation:mdw-enter .16s ease-out; }
  .mdw-ready .mdw-close { display:inline-flex; width:44px; height:44px; }
  .mdw-ready .mdw-collapse { display:none; }
  .mdw-ready .mdw-opener { display:inline-flex; width:auto; height:44px; padding:0 10px; }
  .mdw-head { min-height:80px; padding:12px 14px; }
  .mdw-ready .mdw-item { min-height:46px; padding-top:11px; padding-bottom:11px; font-size:14px; }
  .mdw-group-label { min-height:44px; padding-top:8px; padding-bottom:8px; font-size:11px; }
  .mdw-filter { min-height:44px; }
  .mdw-ready #mdw-sidebar .mdw-filter-input { height:42px; font-size:16px; }
  body.mdw-ready[data-md-sidebar=commentary] .workspace-shell { width:100%; margin-left:0; }
  .mdw-ready .mdw-toolbar { min-height:60px; padding:8px 12px; gap:10px; }
  .mdw-ready .mdw-quick-search input, .mdw-ready .mdw-quick-search button { min-height:44px; }
}
@media(max-width:600px) {
  .mdw-current { display:none; }
  .mdw-ready .mdw-quick-search { flex-basis:100%; width:100%; margin:0; }
  .mdw-ready .mdw-quick-search input { font-size:16px; }
  .mdw-ready .mdw-toolbar .spot-ticker { margin-left:auto; }
  .mdw-ready .mdw-toolbar .market-pill { margin-left:auto; }
  .mdw-ready .mdw-toolbar .market-pill a { min-height:36px; display:flex; align-items:center; }
}
@keyframes mdw-enter { from { transform:translateX(-12px); opacity:.7; } to { transform:translateX(0); opacity:1; } }
@media(prefers-reduced-motion:reduce) { .mdw-sidebar.mdw-open { animation:none !important; } .mdw-group-label svg { transition:none; } }
/* The F&O hero used viewport breakpoints despite losing space to a rail.
   Fit its existing controls to the actual content width, without clipping. */
body.mdw-ready[data-md-sidebar=fo] .strategy-lab-hero { container:mdw-fo-hero / inline-size; }
@container mdw-fo-hero (min-width:1101px) and (max-width:1350px) {
  .strategy-lab-hero .hero-layout { grid-template-columns:minmax(0,.85fr) minmax(0,1.15fr); gap:20px; }
  .strategy-lab-hero .hero-title { font-size:clamp(3rem,4cqw,4.5rem); }
  .strategy-lab-hero .hero-copy { padding-left:8px; }
  .strategy-lab-hero .lab-console { grid-template-columns:minmax(0,1fr); gap:8px; }
  .strategy-lab-hero .lab-console .payoff-facts { display:none; }
  .strategy-lab-hero .lab-strategy-label { display:none; }
  .strategy-lab-hero .payoff-controls { flex-wrap:wrap; }
}
@container mdw-fo-hero (max-width:1100px) {
  .strategy-lab-hero .hero-layout { grid-template-columns:minmax(0,1fr); }
  .strategy-lab-hero .hero-copy { padding-left:0; }
}
@media(min-width:1200px) and (max-width:1439px) {
  body.mdw-ready[data-md-sidebar=fo] .mdw-frame:not(.mdw-mini) .workspace-board { grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
  body.mdw-ready[data-md-sidebar=fo] .mdw-frame:not(.mdw-mini) .pulse-card { grid-column:1 / -1; }
}
@media(min-width:1261px) and (max-width:1340px) {
  body.mdw-ready[data-md-sidebar=charting] .mdw-frame:not(.mdw-mini) .workspace-grid { grid-template-columns:minmax(0,1fr); }
}
/* Keep the existing Portfolio hero proportionate to its available column. */
body.mdw-ready[data-md-sidebar=portfolio] .pa-hero { container:mdw-portfolio-hero / inline-size; }
body.mdw-ready[data-md-sidebar=portfolio] .pa-hero h1 { font-size:clamp(42px,5.4cqw,76px); }
body.mdw-ready[data-md-sidebar=portfolio] :is(#analysis-summary,#risk,#tail-risk,#distribution,#analysis-factors,#correlation,#performance) { scroll-margin-top:calc(var(--mdw-top) + 76px); }
/* Phones: section toolbars scroll with the page instead of stacking under the pinned
   global header; together they covered up to a third of the screen (F&O chain, Commentary).
   position:relative keeps their dropdown stacking context. Wider layouts are unchanged. */
@media(max-width:768px) {
  .mdw-ready .mdw-toolbar,
  body.mdw-ready[data-md-sidebar=charting] .masthead { position:relative; top:auto; }
}
