:root {
  --bg: #121412; --panel: #1a1c1a; --panel2: #222522; --line: #2f332f; --text: #e7e5de; --muted: #9a978c; --up: #3fbf94; --dn: #e0715c; --acc: #3fbf94; --warn: #d8a94a; color-scheme: dark;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --font-head: "Schibsted Grotesk", "IBM Plex Sans", sans-serif;
  --r: 4px; --r2: 6px; --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { --bg: #f7f7f5; --panel: #ffffff; --panel2: #f0f0ed; --line: #e2e2dd; --text: #2b2d2a; --muted: #6e706a; --up: #1f7a5e; --dn: #b3412f; --acc: #2f7d6d; --warn: #9a6a12; color-scheme: light; }
}
:root[data-theme="light"] { --bg: #f7f7f5; --panel: #ffffff; --panel2: #f0f0ed; --line: #e2e2dd; --text: #2b2d2a; --muted: #6e706a; --up: #1f7a5e; --dn: #b3412f; --acc: #2f7d6d; --warn: #9a6a12; color-scheme: light; }
:root[data-theme="dark"] { --bg: #121412; --panel: #1a1c1a; --panel2: #222522; --line: #2f332f; --text: #e7e5de; --muted: #9a978c; --up: #3fbf94; --dn: #e0715c; --acc: #3fbf94; --warn: #d8a94a; color-scheme: dark; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font-body); font-feature-settings: "tnum"; }
.muted { color: var(--muted); } .small { font-size: 12px; font-weight: 400; }
.up { color: var(--up); } .dn { color: var(--dn); }
h1, h2, h3, .brand { font-family: var(--font-head); letter-spacing: -0.01em; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 var(--s2); } h3 { font-size: 13px; font-weight: 600; margin: var(--s3) 0 var(--s2); }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
a, button, .btn, input, select { transition: background-color .12s, border-color .12s, color .12s; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; }
  /* colour-only feedback stays: a price tick flash moves nothing */
  .flash-up { animation: fu .8s !important; } .flash-dn { animation: fd .8s !important; } }

.top { position: sticky; top: 0; z-index: 5; display: flex; gap: 16px; align-items: center; padding: 10px 20px;
  background: var(--bg); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 16px; white-space: nowrap; } .logo { color: var(--text); flex: none; }
#search { flex: 1; max-width: 320px; background: var(--panel); border: 1px solid var(--line); color: var(--text); border-radius: var(--r2); padding: 7px 10px; }
.status { margin-left: auto; display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); } .dot.live { background: var(--up); box-shadow: 0 0 8px var(--up); }

main { max-width: 1400px; margin: 0 auto; padding: 16px 20px 40px; display: grid; gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r2); padding: 14px 16px; min-width: 0; }
.row-between { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }

.futures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.fut { cursor: pointer; } .fut:hover { border-color: var(--acc); }
.fut .px { font: 600 22px var(--mono); } .fut canvas { width: 100%; height: 48px; display: block; margin: 6px 0; }
.fut .tags { display: flex; gap: 6px; flex-wrap: wrap; font-size: 12px; }

.breadth { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: var(--panel2); }
#b-up, #p-up { background: var(--up); } #b-dn, #p-dn { background: var(--dn); }
.sectors { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.sec { border-radius: var(--r2); padding: 8px 10px; cursor: pointer; border: 1px solid transparent; }
.sec.on { border-color: var(--acc); } .sec b { display: block; font-size: 12px; } .sec span { font: 600 14px var(--mono); }
.sec small { display: block; color: var(--text); opacity: .7; font-size: 11px; }

.filters { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { background: var(--panel); color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; cursor: pointer; font: inherit; font-size: 12px; }
.chips button.on { color: var(--text); border-color: var(--acc); background: color-mix(in srgb, var(--acc) 15%, var(--panel)); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1350px) { .grid2 { grid-template-columns: 1fr; } }
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; padding: 4px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td.num { font-family: var(--mono); text-align: right; } th.num { text-align: right; }
tr.click { cursor: pointer; } tr.click:hover { background: var(--panel2); }
.sym { font-weight: 600; } .sec-tag { color: var(--muted); font-size: 11px; display: block; }
.tag { display: inline-block; font: 600 11px var(--mono); padding: 2px 6px; border-radius: 4px; margin-right: 3px; }
.tag.b-up { background: color-mix(in srgb, var(--up) 18%, transparent); color: var(--up); }
.tag.b-dn { background: color-mix(in srgb, var(--dn) 18%, transparent); color: var(--dn); }
.tag.n { background: var(--panel2); color: var(--muted); }
.bar { width: 60px; height: 6px; background: color-mix(in srgb, var(--dn) 50%, var(--panel2)); border-radius: 3px; display: inline-block; vertical-align: middle; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--up); }

.feed { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; max-height: 320px; overflow-y: auto; }
.ev { background: var(--panel2); border-radius: var(--r2); padding: 8px 10px; cursor: pointer; font-size: 12px; }
.ev:hover { outline: 1px solid var(--acc); }
.disclaimer { color: var(--muted); font-size: 11px; text-align: center; }

dialog { width: min(1100px, 96vw); background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: var(--r2); padding: 12px; }
dialog::backdrop { background: rgba(0,0,0,.6); }
.dlg-head { display: flex; align-items: center; gap: 12px; justify-content: space-between; margin-bottom: 8px; flex-wrap: wrap; }
.x { background: none; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; }
#chart { height: 480px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 8px; }

@media (max-width: 900px) {
  .futures, .grid2 { grid-template-columns: 1fr; }
  .top { padding: 10px 16px; flex-wrap: wrap; } #search { order: 3; max-width: none; flex-basis: 100%; }
  main { padding: 12px 16px 32px; } #chart { height: 360px; }
}

/* ---- multi-page ---- */
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: var(--r2); white-space: nowrap; font-size: 13px; font-weight: 500; }
.nav a:hover { color: var(--text); background: var(--panel); }
.nav a.on { color: var(--text); background: color-mix(in srgb, var(--acc) 18%, var(--panel)); }
.page { display: none; gap: 16px; } .page.on { display: grid; animation: page-in .16s cubic-bezier(.16, 1, .3, 1); }
@keyframes page-in { from { opacity: 0; } }
.cards7 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r2); padding: 10px 12px; }
.kpi b { font-size: 12px; color: var(--muted); font-weight: 500; display: block; }
.kpi span { font: 600 18px var(--mono); display: block; }
.bars { display: grid; gap: 4px; max-height: 260px; overflow-y: auto; }
.brow { display: grid; grid-template-columns: 150px 1fr 60px; gap: 8px; align-items: center; font-size: 12px; }
.brow .track { position: relative; height: 10px; background: var(--panel2); border-radius: 3px; }
.brow .track i { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.brow .track::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--muted); }
.scan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.scan { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r2); padding: 12px; cursor: pointer; display: grid; gap: 6px; }
.scan:hover, .scan.on { border-color: var(--acc); }
.scan .cnt { font: 600 20px var(--mono); } .scan .cat { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--acc); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat { background: var(--panel2); border-radius: var(--r2); padding: 8px 10px; }
.stat b { display: block; font-size: 11px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .03em; }
.stat span { font: 600 16px var(--mono); }
.o-pick { display: flex; gap: 8px; }
select, .inp { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: var(--r2); padding: 6px 8px; font: inherit; }
.inp.sm { width: 64px; }
.oi-chart { width: 100%; height: 260px; display: block; }
.chain td, .chain th { text-align: right; font-family: var(--mono); font-size: 12px; }
.chain th { font-family: inherit; }
.chain td.k { text-align: center; font-weight: 600; background: var(--panel2); }
.chain tr.atm td { background: color-mix(in srgb, var(--acc) 14%, transparent); }
.chain td.itm { background: color-mix(in srgb, var(--warn) 8%, transparent); }
/* chain: scrolls inside its card so the column headers stay pinned; spot marker row; totals footer */
.o-chain-wrap { max-height: min(72vh, 760px); overflow: auto; }
.chain thead th { position: sticky; z-index: 2; background: var(--panel); }
.chain thead tr:first-child th { top: 0; } .chain thead tr:nth-child(2) th { top: 34px; box-shadow: inset 0 -1px 0 var(--line); }
.chain tr.spot-row td { padding: 0 !important; height: 16px; line-height: 14px; text-align: center; border: 0; background: linear-gradient(var(--acc), var(--acc)) 0 50% / 100% 2px no-repeat; }
.chain tr.spot-row span { font: 600 11px var(--mono); color: #fff; background: var(--acc); padding: 1px 8px; border-radius: 999px; }
.chain tfoot td { position: sticky; bottom: 0; background: var(--panel2); font-weight: 600; box-shadow: inset 0 1px 0 var(--line); }
#page-options.chain-first .o-chain-card { order: -1; } #page-options.chain-first > .row-between, #page-options.chain-first > #o-stats { order: -2; }
.chain td.pick { cursor: pointer; } .chain td.pick:hover { outline: 1px solid var(--acc); }
.grid-st { display: grid; grid-template-columns: 420px 1fr; gap: 16px; }
/* legs as a compact table: header row + one row per leg (side, type, strike, expiry, lots, price, remove) */
.leg { display: grid; grid-template-columns: 40px 50px minmax(78px, 1fr) 70px 44px 58px 18px; gap: 4px; align-items: center; margin-bottom: 4px; font-size: 12px; }
.leg > select, .leg > input, .leg > button:not(.x), .leg .st-qty input { height: 30px; box-sizing: border-box; margin: 0; padding: 2px 4px; font-size: 12px; }
.leg > select { -webkit-appearance: none; appearance: none; padding: 2px 14px 2px 5px; background-repeat: no-repeat; background-position: right 4px center; background-size: 8px 5px; /* small chevron: the native arrow ate ~20 px of each narrow column */ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%23888'/%3E%3C/svg%3E"); }
.leg > button:not(.x) { padding: 0 4px; justify-content: center; white-space: nowrap; font-weight: 600; }
.leg > button.up { background: color-mix(in srgb, var(--up) 14%, transparent); }
.leg > button.dn { background: color-mix(in srgb, var(--dn) 14%, transparent); }
.leg .x { justify-self: center; padding: 0; min-width: 0; }
.leg .inp.sm { width: 100%; }  /* lots and price fill their columns (.inp.sm is fixed-width elsewhere) */
.leg-head { margin-bottom: 2px; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.leg-head span { padding-left: 4px; }
.leg select, .leg input { width: 100%; }
.btn { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: var(--r2); padding: 6px 12px; cursor: pointer; font: inherit; font-size: 12px; }
.btn:hover { border-color: var(--acc); }
.payoff { width: 100%; height: 340px; display: block; margin-top: 10px; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.form label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
@media (max-width: 1100px) { .nav { order: 4; flex-basis: 100%; } .top { flex-wrap: wrap; } }
@media (max-width: 900px) { .grid-st, .form { grid-template-columns: 1fr; } .brow { grid-template-columns: 110px 1fr 54px; } }
[hidden] { display: none !important; }

/* ---- dashboard, screeners, stock pages ---- */
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.mini-list { display: grid; gap: 2px; }
.mini { display: flex; justify-content: space-between; gap: 10px; padding: 6px 4px; border-bottom: 1px solid var(--line); font-size: 13px; align-items: center; cursor: pointer; }
.mini:last-child { border-bottom: 0; }
a { color: var(--acc); text-decoration: none; } a.sym { color: var(--text); } a.sym:hover { color: var(--acc); }
.badge { background: var(--dn); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 6px; margin-left: 2px; }
.stock-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.stock-tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r2); padding: 8px 10px; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; color: var(--text); }
.stock-tile:hover { border-color: var(--acc); } .stock-tile small { grid-column: 1 / -1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.sp-h { margin: 0; font-size: 22px; } .sp-price { margin: 10px 0 4px; } .sp-price .px { font: 600 28px var(--mono); }
.pivots { display: flex; flex-wrap: wrap; gap: 8px 14px; font: 13px var(--mono); }
.o-pick.wrap { flex-wrap: wrap; }
a.btn { display: inline-block; color: var(--text); }
.hm-group { margin-bottom: 12px; } .hm { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 4px; }
.hm-cell { flex-basis: 70px; min-height: 44px; border-radius: 4px; padding: 4px 6px; color: var(--text); font-size: 11px; font-weight: 600; display: flex; flex-direction: column; justify-content: center; overflow: hidden; }
.hm-cell small { font-weight: 400; font-family: var(--mono); }
.hm-cell:hover { outline: 2px solid var(--acc); }
@media (max-width: 1100px) { .grid3 { grid-template-columns: 1fr; } }
.top { flex-wrap: wrap; row-gap: 6px; }
.nav { order: 4; flex-basis: 100%; flex-wrap: wrap; }

/* ---- order flow ---- */
.grid-of { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.of-list { max-height: 900px; overflow-y: auto; }
tr.sel td { background: color-mix(in srgb, var(--acc) 14%, transparent); }
.grid-fp { display: grid; grid-template-columns: 280px 1fr; gap: 16px; }
.fp-wrap { overflow-x: auto; max-width: 100%; }
@media (max-width: 1000px) { .grid-of, .grid-fp { grid-template-columns: 1fr; } }
.grid-of { grid-template-columns: 300px minmax(0, 1fr); }
.grid-fp { grid-template-columns: 280px minmax(0, 1fr); }
.grid-fp > div { min-width: 0; }
@media (max-width: 1000px) { .grid-of, .grid-fp { grid-template-columns: minmax(0, 1fr); } }

.tag.warn, .warn { color: var(--warn); }

/* ---- auth ---- */
#acct { display: flex; gap: 8px; align-items: center; }
dialog.auth { width: min(380px, 92vw); }
#auth-form { display: grid; gap: 10px; }
#auth-form label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.btn.primary { background: var(--acc); color: #fff; border-color: var(--acc); }

/* ---- smart money market map: dark by default; .smmap-light swaps the --mp-* colours below ---- */
.smmap { --mp-bg: #05080c; --mp-head: #0a1017; --mp-line: #1a2433; --mp-text: #e6edf3; --mp-strong: #fff; --mp-muted: #7d8a9c; --mp-soft: #c4ceda;
  background: var(--mp-bg); border: 1px solid var(--mp-line); border-radius: var(--r2); padding: 14px; color: var(--mp-text); overflow-x: auto; }
.smmap-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; border-bottom: 1px solid var(--mp-line); padding: 8px 12px; margin-bottom: 8px; }  /* a divider, not a card inside the map card */
.smmap-kicker { font: 600 11px "JetBrains Mono", monospace; color: #22c55e; letter-spacing: .12em; }
/* compact one-line title; the full sentence stays in its tooltip */
.smmap-head h2 { margin: 2px 0; font-size: 16px; color: var(--mp-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.smmap-sub { font: 12px "JetBrains Mono", monospace; color: var(--mp-muted); } .smmap-sub b { color: var(--mp-text); }
.smmap-live { font-size: 12px; color: var(--mp-muted); max-width: 240px; text-align: right; }
.smmap-svg { width: 100%; min-width: 980px; height: auto; display: block; }
.smmap-svg [data-sym] { cursor: pointer; }
.smmap-svg.focus .smmap-path:not(.on) { opacity: .06; }
.smmap-svg .smmap-path.on polyline, .smmap-svg .smmap-path.on path { stroke-opacity: 1; stroke-width: 2.4; }
.smmap-svg .smmap-hit.on > rect:first-of-type { stroke-width: 2; stroke-opacity: 1; }
.smmap-foot { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.smmap-foot span { border: 1px solid var(--mp-line); border-radius: var(--r2); padding: 8px 10px; font-size: 11px; color: var(--mp-soft); }
.smmap-foot span::before { content: "■ "; color: #22c55e; }
@media (max-width: 900px) { .smmap-foot { grid-template-columns: 1fr 1fr; } .smmap-head { flex-direction: column; align-items: stretch; } }

/* ---- strategy lab ---- */
.verdict { border-radius: var(--r2); padding: 10px 12px; margin: 8px 0 12px; font-size: 13px; }
.verdict.ok { background: color-mix(in srgb, var(--up) 12%, transparent); border: 1px solid color-mix(in srgb, var(--up) 40%, transparent); }
.verdict.warn { background: color-mix(in srgb, var(--warn) 12%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); }
tr.hl td { background: color-mix(in srgb, var(--acc) 12%, transparent); font-weight: 600; }
#lab-form label { display: flex; align-items: center; gap: 6px; }

.kpi .tag { display: inline-block; font: 600 11px var(--mono); }

/* order ticket, positions, shortcuts */
.btn.buy { background: var(--up); color: #fff; border-color: var(--up); } .btn.sell { background: var(--dn); color: #fff; border-color: var(--dn); }
dialog.ticket { width: min(560px, 96vw); }
.ticket.sell-mode { border-color: var(--dn); } .ticket.buy-mode { border-color: var(--up); }
.tk-side button[data-side="B"].on { border-color: var(--up); background: color-mix(in srgb, var(--up) 20%, var(--panel)); }
.tk-side button[data-side="S"].on { border-color: var(--dn); background: color-mix(in srgb, var(--dn) 20%, var(--panel)); }
.tk-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 12px 0; }
.tk-grid label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.tk-grid select, .tk-grid .inp { width: 100%; box-sizing: border-box; }
.tk-row { display: flex; gap: 6px; } .tk-row .inp { flex: 1; min-width: 0; }
.tk-sum { background: var(--panel2); border-radius: var(--r2); padding: 8px 10px; margin-bottom: 8px; line-height: 1.7; }
.tk-sum b { color: var(--text); }
.tk-confirm { border: 1px solid var(--warn); border-radius: var(--r2); padding: 8px 10px; margin-bottom: 8px; }
.keys td { border: 0; padding: 5px 8px; } kbd { font: 12px var(--mono); background: var(--panel2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; }
.flash-up { animation: fu .8s; } .flash-dn { animation: fd .8s; }
@keyframes fu { from { background: color-mix(in srgb, var(--up) 35%, transparent); } }
@keyframes fd { from { background: color-mix(in srgb, var(--dn) 35%, transparent); } }
@media (max-width: 520px) { .tk-grid { grid-template-columns: 1fr; } }
.mini-trade { display: none; margin-left: 4px; } td.pick:hover .mini-trade { display: inline-flex; gap: 2px; }
.mini-trade button { font: 600 11px var(--mono); padding: 1px 5px; border-radius: 4px; border: 0; cursor: pointer; color: #fff; }
.mini-trade button[data-side="B"] { background: var(--up); } .mini-trade button[data-side="S"] { background: var(--dn); }
.tag.muted { color: var(--muted); border-color: var(--line); }

/* full screen: native Fullscreen API where available, a fixed overlay otherwise (e.g. iPhone Safari) */
.fs-wrap { display: flex; flex-direction: column; }
.fs-btn { align-self: flex-end; margin-bottom: 6px; }
.fs-wrap:fullscreen, .fs-wrap:-webkit-full-screen { background: #05080c; overflow: auto; padding: 8px; }
.fs-wrap:fullscreen .smmap, .fs-wrap.fs-fake .smmap { border: 0; min-height: calc(100vh - 16px); }
.fs-fake { position: fixed !important; inset: 0; z-index: 1000; background: #05080c; overflow: auto; padding: 8px; }
dialog:fullscreen, dialog.fs-fake { width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh; margin: 0; border-radius: 0; box-sizing: border-box; display: flex; flex-direction: column; }
dialog:fullscreen #chart, dialog.fs-fake #chart { flex: 1; height: auto !important; }

/* SMC map toolbar, fit-to-screen, fresh-break glow, tile actions */
.smmap-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.smmap-bar .grow { flex: 1; } .fs-btn { align-self: auto; margin: 0; }
.smmap-legend { font-size: 12px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r2); padding: 8px 12px; margin-bottom: 6px; line-height: 1.6; }
.fs-wrap:fullscreen .smmap-svg, .fs-wrap.fs-fake .smmap-svg { max-height: calc(100vh - 130px); }  /* full screen: whole map in one view */
/* a new break glows three times from when it was first seen, then holds a solid outline while it stays fresh */
.smmap-svg .fresh > rect:first-of-type { stroke-opacity: 1; }
.smmap-svg .fresh > rect:first-of-type, .smmap-svg .fresh-tag { animation: smglow 1.6s ease-in-out 3; animation-delay: calc(var(--seen, 0) * -1s); }
@keyframes smglow { 50% { stroke-opacity: .15; filter: drop-shadow(0 0 0 transparent); } 0%, 100% { stroke-opacity: 1; filter: drop-shadow(0 0 4px currentColor); } }
.smmap-svg .acts { opacity: 0; transition: opacity .12s; } .smmap-svg .smmap-hit:hover .acts { opacity: 1; }
.smmap-svg .acts [data-act] { cursor: pointer; } .smmap-svg .acts [data-act]:hover rect { stroke: #fff; }
.smmap-svg [data-mapsec] { cursor: pointer; } .smmap-svg [data-mapsec]:hover { text-decoration: underline; }
.smmap-loading { padding: 40px; text-align: center; color: var(--mp-muted, #7d8a9c); min-height: 320px; display: grid; place-items: center;
  background: linear-gradient(90deg, transparent 0, color-mix(in srgb, currentColor 8%, transparent) 50%, transparent 100%) 0 0 / 200% 100% no-repeat; animation: mp-shimmer 1.4s linear infinite; border-radius: var(--r2); }
@keyframes mp-shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }
@media (prefers-reduced-motion: reduce) { .smmap-loading { animation: none; } }
.smmap-empty { padding: 40px; text-align: center; color: var(--mp-muted, #7d8a9c); }
.fs-wrap:fullscreen .smmap-head h2, .fs-wrap.fs-fake .smmap-head h2, .fs-wrap:fullscreen .smmap-kicker, .fs-wrap.fs-fake .smmap-kicker { display: none; }
.fs-wrap:fullscreen .smmap-head, .fs-wrap.fs-fake .smmap-head { padding: 6px 12px; margin-bottom: 4px; }
.fs-wrap:fullscreen .smmap-svg, .fs-wrap.fs-fake .smmap-svg { max-height: calc(100vh - 110px); }

/* ===================== redesign: sidebar layout ===================== */
:root { --side: 216px; --radius: 12px; --shadow: 0 1px 2px rgba(0,0,0,.25), 0 8px 24px rgba(0,0,0,.18); }
body { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); grid-template-rows: auto 1fr; min-height: 100vh; }
.side { grid-row: 1 / span 2; position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 14px 10px; z-index: 6; }
.side .brand { padding: 2px 8px 14px; font-size: 15px; }
.side .nav { display: flex; flex-direction: column; gap: 1px; flex-wrap: nowrap; }
.side .nav .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: 12px 10px 4px; }
.side .nav a { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: var(--r2); color: var(--muted); text-decoration: none; font-size: 13px; white-space: nowrap; }
.side .nav a i { font-style: normal; width: 16px; text-align: center; opacity: .8; }
.side .nav a:hover { color: var(--text); background: var(--panel2); }
.side .nav a.on { color: var(--text); background: color-mix(in srgb, var(--acc) 16%, var(--panel)); box-shadow: inset 2px 0 0 var(--acc); }
.side-foot { margin-top: auto; padding: 14px 8px 4px; font-size: 11px; color: var(--muted); line-height: 1.5; }
.side-foot a { color: var(--acc); }
.top { grid-column: 2; padding: 10px 20px; gap: 12px; }
main { grid-column: 2; max-width: 1500px; width: 100%; }
#search { max-width: 460px; }
.btn.icon { display: none; padding: 6px 10px; }
.pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
body.ws-on .pill { color: var(--up); border-color: color-mix(in srgb, var(--up) 50%, var(--line)); }
.card { box-shadow: var(--shadow); border-radius: var(--radius); }
.kpi { box-shadow: var(--shadow); }
.kpi span { font: 600 18px var(--mono); display: block; margin-top: 2px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.svgbox { width: 100%; min-height: 260px; }
.svgbox svg { width: 100%; height: auto; display: block; }
table.sortable th { cursor: pointer; user-select: none; } table.sortable th:hover { color: var(--text); }
.tag.ban { color: #fff; background: var(--dn); border-color: var(--dn); }
@media (max-width: 1000px) {
  body { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; width: 240px; box-shadow: var(--shadow); }
  body.side-open .side { transform: none; }
  .top, main { grid-column: 1; }
  .btn.icon { display: inline-block; }
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  #updated { display: none; }
}
/* command palette */
#pal { width: min(560px, 94vw); padding: 0; }
#pal input { width: 100%; box-sizing: border-box; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); font: 15px var(--font-body); padding: 14px 16px; outline: none; }
#pal ul { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow-y: auto; }
#pal li { padding: 8px 10px; border-radius: 6px; cursor: pointer; display: flex; justify-content: space-between; }
#pal li.on, #pal li:hover { background: color-mix(in srgb, var(--acc) 16%, var(--panel)); }
#pal li small { color: var(--muted); }
.side .nav { order: 0; flex-basis: auto; overflow: visible; }

.mono { font-family: var(--mono); }
.btn.big { font-size: 15px; padding: 12px 22px; flex: 1; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
#rp-chain td.pick { cursor: pointer; } #rp-chain td.pick:hover { outline: 1px solid var(--acc); }
.learn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.learn-grid .card h3 { margin-top: 0; } .learn-grid .card p { margin: 6px 0; color: var(--muted); line-height: 1.55; } .learn-grid .card b { color: var(--text); }
/* Events: calendar + agenda (events.js) */
.ev-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.ev-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin: 8px 0; }
.ev-wd { font-size: 11px; color: var(--muted); text-align: center; padding: 4px 0; text-transform: uppercase; letter-spacing: .04em; }
.ev-cell { min-height: 74px; border: 1px solid var(--line); border-radius: var(--r2); background: var(--panel); padding: 6px; display: flex; flex-direction: column; gap: 3px; text-align: left; color: var(--text); font: inherit; cursor: pointer; min-width: 0; }
.ev-cell:hover { border-color: var(--acc); }
.ev-cell.empty { border: 0; background: none; cursor: default; }
.ev-cell.off { background: var(--panel2); }
.ev-cell.past { opacity: .55; }
.ev-cell.today { border: 2px solid var(--acc); }
.ev-cell.sel { box-shadow: 0 0 0 2px color-mix(in srgb, var(--acc) 35%, transparent); }
.ev-cell .n { font: 600 12px var(--mono); }
.ev-cell .dots { display: flex; gap: 3px; min-height: 7px; }
.ev-cell .t { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); margin-right: 4px; }
.ev-cell .ev-dot { margin-right: 0; }
.ev-dot.expiry, .ev-item.expiry .ev-date { background: var(--c-amber); }
.ev-dot.holiday, .ev-item.holiday .ev-date { background: var(--c-blue); }
.ev-dot.ban, .ev-item.ban .ev-date { background: var(--dn); }
.ev-dot.mine, .ev-item.mine .ev-date { background: var(--acc); }
.ev-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.ev-form #ev-title { flex: 1; min-width: 200px; }
.ev-agenda h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 12px 0 6px; }
.ev-agenda h3:first-child { margin-top: 4px; }
.ev-item { display: flex; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ev-date { flex: none; width: 46px; height: 46px; border-radius: var(--r2); color: #fff; display: grid; place-content: center; text-align: center; line-height: 1.05; }
.ev-date b { font: 700 17px var(--mono); }
.ev-date small { font-size: 11px; text-transform: uppercase; }
.ev-body { flex: 1; min-width: 0; }
.ev-tag { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 1px 6px; border-radius: 4px; border: 1px solid currentColor; }
.ev-tag.expiry { color: var(--c-amber); } .ev-tag.holiday { color: var(--c-blue); } .ev-tag.ban { color: var(--dn); } .ev-tag.mine { color: var(--acc); }
@media (max-width: 900px) { .ev-grid { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .ev-cell { min-height: 46px; padding: 4px; } .ev-cell .t { display: none; } }

.calc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; }
.brief { line-height: 1.7; } .brief li { margin: 2px 0; }
.quad { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } .quad > div { background: var(--panel2); border-radius: var(--r2); padding: 8px 10px; font-size: 12px; }
.quad h3 { margin: 0 0 6px; font-size: 12px; }
.gloss { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px 18px; font-size: 13px; } .gloss b { display: block; }
.lesson h3 { margin-top: 16px; } .lesson p, .lesson li { line-height: 1.65; } .lesson .callout { border-left: 3px solid var(--acc); background: var(--panel2); padding: 8px 12px; border-radius: 6px; margin: 10px 0; }
.lesson .callout.warn { border-color: var(--warn); } .lesson .formula { font-family: var(--mono); background: var(--panel2); padding: 8px 12px; border-radius: 6px; white-space: pre-wrap; }
.lesson table { margin: 8px 0; } .quiz .q { margin: 12px 0; } .quiz button { margin: 3px 4px 3px 0; } .quiz .ok { border-color: var(--up); } .quiz .bad { border-color: var(--dn); }
body.layout-edit #page-home > section { outline: 1px dashed var(--acc); position: relative; }
.lay-ctl { position: absolute; top: 6px; right: 8px; z-index: 3; display: flex; gap: 4px; }

/* ---- loading states ---- */
#topbar-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; overflow: hidden; pointer-events: none; }
#topbar-progress i { display: block; height: 100%; width: 30%; background: var(--acc); transform: translateX(-110%); opacity: 0; }
body.busy #topbar-progress i { opacity: 1; animation: tbp 1.1s ease-in-out infinite; }
@keyframes tbp { 0% { transform: translateX(-110%); } 100% { transform: translateX(380%); } }
.top { position: sticky; }
.loader { display: flex; gap: 14px; align-items: center; border-color: color-mix(in srgb, var(--acc) 45%, var(--line)); }
.loader[hidden] { display: none; }
.loader .spin { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--acc); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.loader > div:last-child { flex: 1; min-width: 0; }
.pl-bar { height: 4px; background: var(--panel2); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.pl-bar i { display: block; height: 100%; width: 35%; background: linear-gradient(90deg, transparent, var(--acc), transparent); animation: tbp 1.4s ease-in-out infinite; }
/* skeleton placeholders inside a page that is still loading */
.page.loading-show .cards7:empty, .page.loading-show table:empty, .page.loading-show .svgbox:empty, .page.loading-show .mini-list:empty,
.page.loading-show .scan-grid:empty, .page.loading-show .stock-grid:empty, .page.loading-show .learn-grid:empty, .page.loading-show .bars:empty, .page.loading-show .brief:empty {
  display: block; min-height: 90px; border-radius: var(--r2);
  background: linear-gradient(90deg, var(--panel2) 25%, color-mix(in srgb, var(--panel2) 60%, var(--line)) 50%, var(--panel2) 75%); background-size: 300% 100%; animation: shimmer 1.3s ease-in-out infinite; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.btn.icon-always { padding: 6px 10px; font-size: 15px; line-height: 1; }
/* ---- phone layout ---- */
@media (max-width: 700px) {
  main { padding: 10px 10px 40px; gap: 12px; }
  .page table { display: block; overflow-x: auto; max-width: 100%; }
  .o-pick, .row-between .o-pick, .chips { flex-wrap: wrap; }
  .row-between { align-items: flex-start; }
  .top { padding: 8px 10px; gap: 8px; }
  #search { min-width: 0; flex: 1 1 140px; font-size: 13px; }
  .status #updated { display: none; }
  .cards7 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi span { font-size: 15px; }
  .card { padding: 12px; }
  .grid2, .grid3, .calc-grid, .learn-grid { grid-template-columns: minmax(0, 1fr); }
  .tk-grid { grid-template-columns: 1fr 1fr; }
  dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: var(--r2) 14px 0 0; max-height: 92vh; overflow-y: auto; }
  #chart { height: 60vh !important; }
  .btn.big { padding: 14px; }
  h2 { font-size: 14px; }
  .smmap-bar .grow { display: none; }
}
.smmap-head > div { min-width: 0; } .smmap-head h2 { overflow-wrap: anywhere; }
@media (max-width: 700px) {
  /* phones: fit the whole map to the screen instead of a 980px-wide strip that scrolls sideways; tap a tile to open its chart */
  .smmap { padding: 8px; overflow-x: clip; } .smmap-svg { min-width: 0; }
  .smmap-head { max-width: none; } .smmap-bar { gap: 6px; } .smmap-bar label { flex-basis: 100%; }
  .smmap-bar .chips button { padding: 6px 10px; min-height: 32px; } .smmap-bar select { max-width: 100%; }
}
.fs-wrap { min-width: 0; max-width: 100%; } .fs-wrap > .smmap { min-width: 0; max-width: 100%; overflow-x: auto; }

/* research backtester */
.rb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 12px; }
.rb-grid label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.rb-grid .inp { width: 100%; box-sizing: border-box; }
.rb-actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }
.rb-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin: 12px 0; }
.rb-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; }
.rb-legend i { display: inline-block; width: 14px; height: 3px; vertical-align: middle; margin-right: 5px; }

/* positioning desk */
.dk-replay { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 10px; }
.dk-row { display: grid; gap: 12px; margin-bottom: 12px; }
.dk-row.c1 { grid-template-columns: 1fr; } .dk-row.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dk-row.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dk-pane { min-height: 260px; display: flex; flex-direction: column; }
/* a full-width pane keeps a dashboard-height chart (it was ~900px tall at desktop width, one chart per screen) */
.dk-row.c1 .dk-body svg, .dk-row.c1 .dk-body canvas { max-height: 340px; margin-inline: auto; display: block; }
.dk-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.dk-head select { flex: 1; min-width: 0; font-weight: 600; }
.dk-head .btn { padding: 2px 8px; }
.dk-body { flex: 1; min-width: 0; overflow-x: auto; }
.dk-kv { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; margin-bottom: 6px; }
.dk-kv b { display: block; font: 600 15px var(--mono); }
.dk-cap { font-size: 11px; color: var(--muted); margin-top: 4px; }
.dk-rowbar { display: flex; justify-content: flex-end; gap: 6px; margin: -6px 0 4px; }
.dk-heat td { text-align: right; font: 11px var(--mono); padding: 2px 6px; }
@media (max-width: 700px) { .dk-row.c2, .dk-row.c3 { grid-template-columns: 1fr; } }

/* OI flow 3D */
.o3-wrap { position: relative; padding: 0; overflow: hidden; }
#o3-canvas { height: 62vh; min-height: 380px; background: var(--panel2); border-radius: inherit; }
#o3-canvas canvas { display: block; }
.o3-legend { position: absolute; left: 12px; top: 10px; display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: #e5e7eb; pointer-events: none; }
.o3-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.o3-tip { position: absolute; pointer-events: none; background: rgba(15,23,42,.92); color: #f1f5f9; border: 1px solid #334155; border-radius: var(--r2); padding: 6px 9px; font-size: 12px; white-space: nowrap; }
.o3-status { position: absolute; right: 12px; bottom: 8px; color: #cbd5e1; }
.o3-arrow { font: 600 13px var(--mono); }
@media (max-width: 700px) { #o3-canvas { height: 55vh; } .o3-legend { font-size: 11px; gap: 6px; } }

.o3-ticker { height: 30px; overflow: hidden; white-space: nowrap; border-bottom: 1px solid #1e293b; background: rgba(15,23,42,.7); position: relative; z-index: 1; margin-top: 30px; }
.o3-ticker-in { display: inline-block; padding-left: 100%; animation: o3scroll 40s linear infinite; font: 600 12px var(--mono); line-height: 30px; }
.o3-ticker-in span { margin: 0 6px; } .o3-ticker-in i { color: #475569; font-style: normal; margin: 0 6px; }
@keyframes o3scroll { from { transform: translateX(0); } to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) { .o3-ticker-in { animation: none; padding-left: 8px; } }
#o3-canvas { height: 70vh; }
.o3-legend { color: var(--text, #e5e7eb); }

.o3-legend { left: 0; right: 0; top: 0; padding: 8px 12px; background: #0f172a; color: #e5e7eb; font-size: 13px; z-index: 2; }
.o3-key-note { color: #94a3b8; font-size: 12px; }
.o3-summary { position: absolute; right: 12px; top: 44px; max-width: 360px; background: rgba(15,23,42,.88); border: 1px solid #334155; border-radius: var(--r2); padding: 8px 12px; color: #e2e8f0; font-size: 12.5px; z-index: 2; }
.o3-summary ul { margin: 4px 0 0; padding: 0; list-style: none; } .o3-summary li { margin: 3px 0; line-height: 1.35; }
.o3-sum-h { font-weight: 700; color: #facc15; font-size: 12px; }
.o3-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.o3-wrap:fullscreen { background: #0b0f17; padding: 0; border-radius: 0; }
.o3-wrap:fullscreen #o3-canvas { height: 100vh; border-radius: 0; }
@media (max-width: 700px) { .o3-summary { position: static; max-width: none; margin: 0; border-radius: 0; } }

.o3-wrap { display: flex; flex-direction: column; background: #0b0f17; }
.o3-wrap .o3-legend { position: static; order: 1; }
.o3-wrap .o3-summary { position: static; order: 2; max-width: none; margin: 0; border: 0; border-top: 1px solid #1e293b; border-radius: 0; background: #0f172a; }
.o3-summary ul { display: flex; flex-wrap: wrap; gap: 4px 22px; }
.o3-wrap #o3-canvas { order: 3; flex: 1; height: 60vh; border-radius: 0 0 12px 12px; }
.o3-wrap:fullscreen #o3-canvas { height: auto; }

.o3-wrap.o3-max { position: fixed; inset: 0; z-index: 1000; border-radius: 0; margin: 0; }
.o3-wrap.o3-max #o3-canvas { height: auto; flex: 1; border-radius: 0; }
.o3-wrap.o3-max::before { content: "Esc to exit"; position: absolute; right: 14px; top: 10px; color: #64748b; font-size: 11px; z-index: 3; }
body.o3-max-on { overflow: hidden; }

.o3-dot-move { background: #e2e8f0; }
/* OI flow: light chart */
.o3-wrap.o3-light { background: #ffffff; border: 1px solid #e2e8f0; }
.o3-wrap.o3-light #o3-canvas { background: #f8fafc; }
.o3-wrap.o3-light .o3-legend, .o3-wrap.o3-light .o3-summary { background: #f1f5f9; color: #0f172a; border-color: #e2e8f0; }
.o3-wrap.o3-light .o3-key-note { color: #475569; }
.o3-wrap.o3-light .o3-sum-h { color: #b45309; }
.o3-wrap.o3-light .o3-dot-move { background: #334155; }
.o3-wrap.o3-light .o3-status { color: #475569; }
.o3-wrap.o3-light::before { color: #94a3b8; }

/* SMC Map: light theme (remaps the fixed SVG colours map.js uses) */
.smmap-light .smmap { --mp-bg: #ffffff; --mp-head: #f8fafc; --mp-line: #e2e8f0; --mp-text: #0f172a; --mp-strong: #0f172a; --mp-muted: #475569; --mp-soft: #334155; }
.smmap-light .smmap-svg [fill="#0d141d"], .smmap-light .smmap-svg [fill="#0b1118"], .smmap-light .smmap-svg [fill="#0e1620"] { fill: #ffffff; }
.smmap-light .smmap-svg [fill="#070b10"] { fill: #f1f5f9; }
.smmap-light .smmap-svg [fill="#e6edf3"], .smmap-light .smmap-svg [fill="#fff"], .smmap-light .smmap-svg [fill="#ffffff"] { fill: #0f172a; }
.smmap-light .smmap-svg [fill="#b8c4d3"] { fill: #334155; }
.smmap-light .smmap-svg [fill="#7d8a9c"] { fill: #64748b; }
.smmap-light .smmap-svg [stroke="#1e2a3a"] { stroke: #e2e8f0; }
.smmap-light .smmap-svg [stroke="#ffffff"] { stroke: #0f172a; }
.smmap-light .smmap-svg [stroke="#7d8a9c"] { stroke: #94a3b8; }
.smmap-light .smmap-svg [fill="#22c55e"] { fill: #16a34a; } .smmap-light .smmap-svg [stroke="#22c55e"] { stroke: #16a34a; }
.smmap-light .smmap-svg [fill="#f43f5e"] { fill: #e11d48; } .smmap-light .smmap-svg [stroke="#f43f5e"] { stroke: #e11d48; }
.smmap-light .smmap-svg [fill="#60a5fa"] { fill: #2563eb; }
.smmap-light.fs-wrap:fullscreen, .smmap-light.fs-on { background: #ffffff; }

/* brokers */
.bk-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 12px; }
.bk-card { cursor: pointer; border: 2px solid transparent; }
.bk-card.on { border-color: var(--accent, #3b82f6); }
.bk-card h3 { margin: 0 0 6px; display: flex; justify-content: space-between; align-items: center; }
.bk-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }

/* "Full view" link on charts and the full-view tab */
.fv-btn { position: absolute; top: 6px; right: 8px; z-index: 5; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; color: var(--muted, #94a3b8); text-decoration: none; opacity: .55; transition: opacity .15s, background .15s, color .15s; }
.fv-btn:hover, .fv-btn:focus-visible { opacity: 1; color: var(--acc, #3b82f6); background: var(--panel2, #1e293b); }
body.fullview-ready #side, body.fullview-ready .topbar, body.fullview-ready header, body.fullview-ready main, body.fullview #page-loader, body.fullview #topbar-progress { display: none !important; }
body.fullview { overflow: hidden; }
#fv-root { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--bg, #0b0f17); z-index: 2000; }
.fv-bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--line, #1e293b); }
#fv-slot { flex: 1; overflow: auto; padding: 12px; }
#fv-slot > .fv-target { width: 100%; max-width: none; min-height: calc(100vh - 80px); margin: 0; }
.fv-anchor { position: relative; height: 0; z-index: 6; }
.fv-anchor .fv-btn { top: 6px; right: 8px; }
#fv-slot .fv-anchor { display: none; }
.fv-anchor.fv-float { position: absolute; width: 0; height: 0; grid-column: auto; }
.fv-anchor.fv-float .fv-btn { white-space: nowrap; }
#fv-slot .fv-target svg { width: 100%; height: auto; max-height: calc(100vh - 140px); }
#fv-slot .fv-target .smmap-svg { max-height: none; }
#fv-slot .o3-wrap #o3-canvas, #fv-slot.o3 #o3-canvas { height: calc(100vh - 220px); }
#fv-slot .tv-lightweight-charts { height: calc(100vh - 140px) !important; }

.mk-host .smmap-svg [data-mk] { cursor: pointer; }

/* phone: the top bar was squeezing the search box and cutting off the username; search gets its own row */
@media (max-width: 600px) {
  .top { flex-wrap: wrap; row-gap: 6px; }
  .top #search { order: 5; flex: 1 0 100%; max-width: none; }
  .top #updated { display: none; }
  .top #acct { margin-left: auto; }
  #acct-name, #acct .muted { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* Options Desk Pro */
.dp-opts { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.dp-opts label { display: flex; gap: 6px; align-items: center; }
.dp-head { margin-left: auto; }
.dp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; margin-bottom: 14px; }
.dp-tbl { width: 100%; }
.dp-tbl td { padding: 5px 8px; border-bottom: 1px solid var(--line); }
.dp-tbl tr:nth-child(even) td { background: var(--panel2); }
.dp-ladder { position: relative; height: 340px; margin: 10px 0 10px 8px; border-left: 2px solid var(--line); }
.dp-ladder > div { position: absolute; left: 0; right: 0; transform: translateY(50%); display: flex; justify-content: space-between; border-top: 1px dashed var(--line); padding: 0 8px; font-size: 12px; }
.dp-ladder .dp-spot { border-top: 2px solid var(--c-amber); color: var(--c-amber); font-weight: 600; }
@media (max-width: 640px) { .dp-grid { grid-template-columns: 1fr; } .dp-head { margin-left: 0; } }

/* "What this screen shows" (insights.js) */
.insight { border-left: 3px solid var(--acc); }
.ins-list { margin: 4px 0 6px; padding-left: 18px; display: grid; gap: 4px; font-size: 13px; }
.ins-list span { color: var(--muted); }
.fv-btn.fv-row { position: static; flex: none; align-self: center; opacity: .7; }

/* ---- Option Ideas and Stock Trade Planner (tradeideas.js) ---- */
.ti-read { display: grid; gap: 10px; }
.ti-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ti-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-weight: 600; font-size: 12px; background: var(--chip, rgba(127,127,127,.12)); white-space: nowrap; }
.ti-badge.up { color: var(--up); background: color-mix(in srgb, var(--up) 14%, transparent); }
.ti-badge.dn { color: var(--dn); background: color-mix(in srgb, var(--dn) 14%, transparent); }
.ti-why { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 13px; }
.ti-why li.muted { color: var(--muted); }
.ti-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; margin: 14px 0; }
.ti-card { display: grid; gap: 10px; align-content: start; }
.ti-card h3 { margin: 0; font-size: 16px; }
.ti-fit { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.ti-fit span { display: block; height: 100%; background: var(--acc); border-radius: 3px; }
.ti-legs td { padding: 3px 6px; }
.ti-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px 12px; }
.ti-stats > div { display: grid; gap: 1px; }
.ti-stats b { font-size: 11px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.ti-stats span { font-weight: 600; font-variant-numeric: tabular-nums; }
.ti-plan { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; font-size: 13px; }
.ti-plan > div { display: grid; gap: 2px; padding: 8px 10px; border-radius: var(--r2); background: color-mix(in srgb, var(--line) 45%, transparent); }
.pl-top { align-items: start; }
.pl-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.pl-form label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.pl-form .inp { width: 100%; box-sizing: border-box; }
.pl-btns { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }
.pl-save { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.pl-save .inp { flex: 1; min-width: 160px; }
#pl-side { margin-left: 6px; }
@media (max-width: 640px) { .ti-grid { grid-template-columns: 1fr; } .pl-form { grid-template-columns: 1fr 1fr; } .ti-plan { grid-template-columns: 1fr; } }
.ti-card .svgbox { min-height: 0; height: auto; aspect-ratio: auto; }

/* ---- Strategy Builder payoff (payoff.js) ---- */
.po-wrap { position: relative; }
.po-wrap .payoff { height: 420px; cursor: crosshair; }
.po-tip { position: absolute; pointer-events: none; background: var(--card, #fff); border: 1px solid var(--line); border-radius: var(--r2); padding: 6px 10px; font-size: 12px; line-height: 1.5; box-shadow: 0 4px 14px rgba(0,0,0,.12); white-space: nowrap; }
.po-greeks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; font-size: 12px; }
.po-greeks > span:not(.grow) { padding: 5px 10px; border-radius: 6px; background: color-mix(in srgb, var(--line) 55%, transparent); }
.po-greeks b { font-weight: 500; color: var(--muted); margin-right: 4px; }
.po-greeks i { font-style: normal; font-weight: 600; }
.po-sliders { display: grid; gap: 10px; margin-top: 14px; }
.po-sliders label { display: grid; grid-template-columns: 90px 1fr 54px; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.po-sliders input[type=range] { width: 100%; accent-color: var(--acc); }
.po-sliders output { font-weight: 600; color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }
.po-sliders .btn { justify-self: end; }

/* data picks */
.pk-list { display: grid; gap: 6px; }
.pk-list.pk-row { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.pk { display: grid; grid-template-columns: auto auto 1fr auto; gap: 10px; align-items: center; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--r2); color: inherit; text-decoration: none; }
.pk:hover { border-color: var(--acc); }
.pk i { font-style: normal; font-weight: 700; font-variant-numeric: tabular-nums; }
.pk .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* optimizer: payoff + deploy (optdeploy.js) */
.op-tbl tbody tr { cursor: pointer; }
.op-tbl tbody tr:hover, .op-tbl tbody tr.sel { background: color-mix(in srgb, var(--acc) 10%, transparent); }
.od-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.btn.od-live { background: var(--dn); color: #fff; border-color: var(--dn); }
.od-warn { border: 1px solid var(--dn); border-radius: var(--r2); padding: 12px 14px; margin: 8px 0; background: color-mix(in srgb, var(--dn) 7%, transparent); }
.od-warn ul, .od-res { margin: 6px 0; padding-left: 18px; }

.oi-tip { position: fixed; z-index: 50; pointer-events: none; background: var(--card, #fff); border: 1px solid var(--line); border-radius: var(--r2); padding: 6px 10px; font-size: 12px; line-height: 1.5; box-shadow: 0 4px 14px rgba(0,0,0,.12); white-space: nowrap; }

/* ---- broker credentials (brokercreds.js) ---- */
.bc-eyebrow { letter-spacing: .12em; font-size: 11px; display: block; margin-bottom: 8px; }
.bc-hero h2 { font-size: 30px; margin: 2px 0 4px; }
.bc-state { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.bc-logo { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: var(--r2); color: #fff; font-weight: 700; font-size: 12px; flex: none; }
.bc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.bc-tile { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r2); background: transparent; color: inherit; text-align: left; cursor: pointer; font: inherit; }
.bc-tile span { display: grid; min-width: 0; }
.bc-tile b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-tile small { font-size: 11px; }
.bc-tile:hover { border-color: var(--muted); }
.bc-tile.on { border-color: var(--up); box-shadow: 0 0 0 1px var(--up) inset; }
.bc-hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.bc-title { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; }
.bc-help { max-width: 640px; }
.bc-warn { color: var(--c-amber, #b7791f); }
.bc-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
.bc-fields label { display: grid; gap: 5px; font-size: 12px; font-weight: 600; }
.bc-fields .inp { width: 100%; box-sizing: border-box; font-family: ui-monospace, monospace; }
.bc-show { grid-column: 1 / -1; display: flex !important; align-items: center; gap: 6px; font-weight: 400 !important; color: var(--muted); }
.bc-redirect { grid-column: 1 / -1; display: grid; gap: 6px; padding: 12px; border: 1px dashed var(--line); border-radius: var(--r2); }
.bc-copy { display: flex; gap: 8px; align-items: center; }
.bc-copy code { flex: 1; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r2); color: var(--up); overflow-x: auto; white-space: nowrap; }
.bc-actions { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
#bc-msg { grid-column: 1 / -1; }
@media (max-width: 720px) { .bc-fields { grid-template-columns: 1fr; } .bc-hero h2 { font-size: 24px; } }

/* broker settings shell */
.bs-shell { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 28px; align-items: start; }
.bs-nav { position: sticky; top: 90px; display: grid; gap: 2px; }
.bs-nav .bs-grp { font-size: 11px; letter-spacing: .14em; color: var(--muted); margin: 14px 0 4px 10px; }
.bs-nav .bs-grp:first-child { margin-top: 0; }
.bs-nav a { padding: 8px 10px; border-radius: var(--r2); color: inherit; text-decoration: none; border-left: 2px solid transparent; }
.bs-nav a:hover { background: color-mix(in srgb, var(--line) 50%, transparent); }
.bs-nav a.on { font-weight: 600; border-left-color: var(--text); background: color-mix(in srgb, var(--line) 60%, transparent); border-radius: 0 8px 8px 0; }
.bs-main { display: grid; gap: 16px; min-width: 0; }
.bs-card { border-radius: var(--r2); padding: 22px 24px; }
.bc-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.bs-foot { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; font-size: 13px; }
.bs-foot.warn { color: var(--c-amber, #b7791f); }
.bs-foot a { margin-left: 6px; color: var(--up); }
.bs-kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; font-size: 13px; }
.bs-kv span { color: var(--muted); }
@media (max-width: 1100px) { .bc-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) { .bs-shell { grid-template-columns: 1fr; } .bs-nav { position: static; display: flex; flex-wrap: wrap; } .bs-nav .bs-grp { display: none; } .bc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* top-bar broker badge */
.bk-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 12px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.bk-pill .bk-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c-grey, #9aa1ad); margin: 0; }
.bk-pill.on { color: var(--text); border-color: color-mix(in srgb, var(--up) 45%, var(--line)); }
.bk-pill.on .bk-dot { background: var(--up); }
.bk-pill.bad { color: var(--dn); }
.bk-pill.bad .bk-dot { background: var(--dn); }
.bk-pill:hover { border-color: var(--muted); }
@media (max-width: 720px) { .bk-pill { display: none; } }

/* top-bar broker switcher */
.bk-sw { position: relative; }
.bk-pill { cursor: pointer; background: transparent; font: inherit; font-size: 12px; }
.bk-caret { font-size: 11px; opacity: .7; }
.bk-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 240px; padding: 6px; background: var(--card, #fff); border: 1px solid var(--line); border-radius: var(--r2); box-shadow: 0 10px 30px rgba(0,0,0,.14); display: grid; gap: 2px; }
.bk-menu-h { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 6px 10px 4px; }
.bk-mi { display: grid; grid-template-columns: 10px 1fr auto auto; align-items: center; gap: 8px; padding: 8px 10px; border: 0; border-radius: var(--r2); background: transparent; color: inherit; font: inherit; font-size: 13px; text-align: left; cursor: pointer; text-decoration: none; }
.bk-mi:hover, .bk-mi:focus-visible { background: color-mix(in srgb, var(--line) 60%, transparent); }
.bk-mi.on { font-weight: 600; }
.bk-mi small { color: var(--muted); font-size: 11px; }
.bk-mi i { font-style: normal; color: var(--up); }
.bk-mi .bk-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c-grey, #9aa1ad); margin: 0; }
.bk-mi .bk-dot.g { background: var(--up); } .bk-mi .bk-dot.r { background: var(--dn); }
.bk-manage { display: block; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; margin-top: 4px; color: var(--acc); }
@media (max-width: 720px) { .bk-sw { display: none; } }

/* focus: the palette input draws its own bottom-edge ring (outline would clip in the dialog); table rows that open
   something get an inset ring */
#pal input:focus-visible { box-shadow: inset 0 -2px 0 var(--acc); }
.op-tbl tbody tr:focus-visible { outline: 2px solid var(--acc); outline-offset: -2px; }

/* touch screens: small icon buttons (remove ✕, move ↑↓, table actions) get a finger-sized hit area */
.x { min-width: 32px; min-height: 32px; display: inline-grid; place-items: center; border-radius: 6px; }
.x:hover { color: var(--dn); background: color-mix(in srgb, var(--dn) 10%, transparent); }
@media (pointer: coarse) {
  .x, .btn.small, .acts .btn, .bk-mi { min-height: 44px; min-width: 44px; }
  button, a, [role=button], select, input { touch-action: manipulation; }
}

/* stat tiles: the label stays on one line (full text on hover) and a note under a value is small body text, so the
   number alone carries the large type */
.stat b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat span small { display: block; margin-top: 3px; font: 500 11px/1.35 var(--font-body); letter-spacing: 0; }
#o-stats .stat span { white-space: nowrap; font-size: clamp(13px, 1.05vw, 16px); }
#o-stats .stat span small { white-space: normal; }

/* "What this screen shows" on phones: headlines only until expanded, so the page's own tool is near the top */
.insight .ins-more { display: none; }
@media (max-width: 640px) {
  .insight .ins-more { display: inline-flex; margin-top: 6px; }
  .insight:not(.open) .ins-list li > span, .insight:not(.open) .ins-foot { display: none; }
  .insight:not(.open) .ins-list { gap: 2px; }
}

/* Optimizer form: a gap between each label and its control; on phones each label sits above its control, full
   width, and the button spans the row */
#op-form > label { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 640px) {
  #op-form > label { display: grid; gap: 4px; width: 100%; }
  #op-form > label select, #op-form > label input { width: 100%; box-sizing: border-box; margin: 0; }
  #op-form > .btn { width: 100%; justify-content: center; }
}

/* Home: "Customise layout" stays in the Daily brief header row on phones instead of wrapping into the card body */
#h-brief-card > .row-between { flex-wrap: nowrap; align-items: center; gap: 8px; }
#h-brief-card > .row-between h2 { min-width: 0; }
#h-brief-card #h-layout { flex: none; }
@media (max-width: 640px) { #h-brief-card > .row-between h2 .asof, #h-brief-card > .row-between h2 #h-brief-t { display: none; } }

/* Option Chain on phones: say that puts are to the right, and keep the strike column pinned while scrolling sideways */
.chain-hint { display: none; margin: 0 0 6px; }
@media (max-width: 640px) {
  .chain-hint { display: block; }
  .chain td.k, .chain th:nth-child(6) { position: sticky; left: 0; z-index: 1; box-shadow: 1px 0 0 var(--line), -1px 0 0 var(--line); }
  .chain thead th:nth-child(6) { z-index: 3; }
}

/* headings wrap evenly instead of leaving one word alone on the last line */
h1, h2, h3, .bc-hero h2 { text-wrap: balance; }
#op-pop { width: 70px; }
@media (max-width: 640px) { #op-form > label #op-pop { width: 100%; } }

/* Chain Analytics (chainpro.js) */
.cp-tbl td, .cp-tbl th { white-space: nowrap; }
.cp-tbl tr.cp-stale td { opacity: .55; }
.cp-read .ti-why { font-size: 14px; }


/* Build-up live: dark panel like OI flow live, four quadrants of bars */
.bu-wrap { background: #0f172a; color: #e5e7eb; border-color: #1e293b; }
.bu-head { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: 12px; color: #cbd5e1; margin-bottom: 10px; }
.bu-head i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.bu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 900px) { .bu-grid { grid-template-columns: 1fr; } }
.bu-chart { position: relative; height: 620px; }
.bu-chart canvas { display: block; width: 100%; height: 100%; }
.bu-tip { position: absolute; pointer-events: none; z-index: 5; }
.bu-q { background: #111c33; border: 1px solid #1e293b; border-radius: var(--r2); padding: 10px 12px; border-top: 3px solid var(--bu); }
.bu-q h3 { margin: 0 0 8px; font-size: 14px; color: #f1f5f9; display: flex; justify-content: space-between; }
.bu-q h3 span { color: #94a3b8; font-weight: 400; font-size: 12px; }
.bu-row { display: grid; grid-template-columns: 92px 1fr 150px; gap: 8px; align-items: center; font-size: 12px; padding: 3px 0; }
.bu-row a { color: #f1f5f9; font-weight: 600; text-decoration: none; }
.bu-bar { height: 14px; border-radius: 3px; background: var(--bu); min-width: 2px; position: relative; }
.bu-bar b { position: absolute; left: calc(100% + 6px); top: -1px; font-weight: 500; color: #e5e7eb; white-space: nowrap; }
.bu-num { text-align: right; color: #cbd5e1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bu-spark { vertical-align: middle; margin-left: 6px; }
.bu-empty { color: #94a3b8; font-size: 12px; padding: 8px 0; }

/* per-leg lots: "×" then a box wide enough for 4 digits, without the number spinner eating the space */
.leg .st-qty { display: flex; align-items: center; gap: 2px; }
.leg .st-qty input { min-width: 0; padding: 4px; text-align: right; -moz-appearance: textfield; }
.leg .st-qty input::-webkit-outer-spin-button, .leg .st-qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* narrow desktops: the stream pill repeats #updated ("Market closed · updated …"), drop it so the top bar stays one row */
@media (max-width: 1280px) { .top #stream { display: none; } }
#page-smc .smmap-bar { gap: 6px; } #mp-sector, #mp-sort { max-width: 110px; }  /* keeps the SMC toolbar on one row at ~1100px windows */

/* Pulse: live values glide, tab switch acknowledges */
#p-up, #p-dn { transition: width .4s cubic-bezier(.25, 1, .5, 1); } .brow .track i { transition: left .4s cubic-bezier(.25, 1, .5, 1), width .4s cubic-bezier(.25, 1, .5, 1), background-color .4s; }
.tab-in { animation: page-in .16s cubic-bezier(.16, 1, .3, 1); }
/* Pulse layout */
.kpi small span { display: inline; font: inherit; margin: 0; } /* % inside the change line was inheriting block display and breaking onto its own row */
#p-cards { grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); }
#p-cards .kpi small { white-space: nowrap; }
#page-pulse .grid2 { align-items: start; }
#p-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; mask-image: linear-gradient(90deg, #000 92%, transparent); }
#p-tabs button { flex: none; }
#p-cards .kpi b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Futures layout: whole table fits in its card, header stays while scrolling */
#page-futures .tbl-wrap { max-height: calc(100vh - 210px); overflow: auto; margin-top: 10px; }
#fu-tbl thead th { position: sticky; top: 0; z-index: 1; background: var(--panel); }
#fu-tbl td, #fu-tbl th { padding-left: 4px; padding-right: 4px; }
#fu-tbl td:first-child, #fu-tbl th:first-child { position: sticky; left: 0; background: var(--panel); }
#fu-tbl thead th:first-child { z-index: 2; }
#fu-filter { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; min-width: 0; }
#fu-filter button { flex: none; }
/* Option chain layout: stats in one row, chain fits more columns */
#o-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } @media (max-width: 700px) { #o-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.chain td { padding: 5px 4px; }
/* Option chain full screen: chain fills the screen */
#o-chain-card:fullscreen, #o-chain-card.fs-fake { background: var(--panel); overflow: hidden; display: flex; flex-direction: column; padding: 12px 16px; border-radius: 0; }
#o-chain-card:fullscreen .o-chain-wrap, #o-chain-card.fs-fake .o-chain-wrap { flex: 1; max-height: none; }
/* Chain analytics layout: 8 stats as two even rows */
#cp-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; } @media (max-width: 700px) { #cp-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } }
/* Option chain colour: side bands, OI ceiling/floor called out, stronger OI bars */
.chain { --heat: min(100%, calc(45% * var(--hk, 1))); }
.chain th.side-h { text-align: center; letter-spacing: .12em; font-weight: 700; }
.chain th.side-h.dn { background: color-mix(in srgb, var(--dn) 10%, var(--panel)); box-shadow: inset 0 -2px 0 var(--dn); }
.chain th.side-h.up { background: color-mix(in srgb, var(--up) 10%, var(--panel)); box-shadow: inset 0 -2px 0 var(--up); }
.chain td.oipeak { font-weight: 700; --heat: min(100%, calc(75% * var(--hk, 1))); }
.chain td.oipeak.ce { box-shadow: inset 3px 0 0 var(--dn); }
.chain td.oipeak.pe { box-shadow: inset -3px 0 0 var(--up); }
/* Option chain heat: OI added (green) / cut (red), volume (amber); depth = size vs the busiest strike */
.chain td.heat.add { background: color-mix(in srgb, var(--up) min(100%, calc(var(--a) * 60% * var(--hk, 1))), transparent); }
.chain td.heat.cut { background: color-mix(in srgb, var(--dn) min(100%, calc(var(--a) * 60% * var(--hk, 1))), transparent); }
.chain td.heat.vol { background: color-mix(in srgb, var(--warn) min(100%, calc(var(--a) * 34% * var(--hk, 1))), transparent); }
.chain tr.atm td.k { background: var(--acc) !important; color: #fff; } /* beats the inline OI-lean tint */
.chain td.heat.add, .chain td.heat.cut { font-weight: 600; }
/* Chain analytics "Every strike": scrolls inside its card, header and strike column stay put */
#cp-tbl { border-collapse: separate; border-spacing: 0; }
#page-chainpro #cp-tbl { margin: 0; } #cp-tbl td, #cp-tbl th { padding-left: 5px; padding-right: 5px; }
#page-chainpro .tbl-wrap:has(#cp-tbl) { max-height: calc(100vh - 200px); overflow: auto; margin-top: 8px; }
#cp-tbl thead th { position: sticky; top: 0; z-index: 1; background: var(--panel); }
#cp-tbl td:first-child, #cp-tbl th:first-child { position: sticky; left: 0; background: var(--panel); }
#cp-tbl thead th:first-child { z-index: 2; }
/* Strategy page layout: legs stay compact, saved table shows P&L without side-scroll */
.leg { grid-template-columns: 36px 48px minmax(64px, 170px) 70px 38px 58px 16px; justify-content: start; } /* fits the narrow builder column so the ✕ stays inside the card */
/* Strategy: builder and payoff side by side on laptop widths too (stack only on narrow screens) */
@media (min-width: 960px) { #page-strategy .grid-st { grid-template-columns: minmax(390px, 1fr) minmax(0, 1.15fr); align-items: start; } }
/* Strategy payoff: compact stat strip so the chart sits near the top beside the builder */
#page-strategy .po-wrap .payoff { height: 360px; }
/* Strategy: the builder is shorter than the payoff column, so it follows you down while you read the chart, greeks and sliders */
@media (min-width: 960px) { #page-strategy .grid-st > .card:first-child { position: sticky; top: 84px; } }
/* Ready-made picker: grouped by market view, each card shows its expiry payoff shape */
.presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.pre-grp:nth-child(3) { grid-column: 1 / -1; }
.pre-grp { display: grid; gap: 5px; }
.pre-lbl { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.pre-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); gap: 6px; }
.pre-card { display: grid; gap: 4px; justify-items: start; padding: 7px 8px 6px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r2, 8px); cursor: pointer; font: inherit; color: var(--text); text-align: left; transition: border-color .15s, background-color .15s; }
.pre-card b { font-size: 12px; font-weight: 500; line-height: 1.2; }
.pre-card:hover { border-color: color-mix(in srgb, var(--acc) 55%, var(--line)); }
.pre-card.on { border-color: var(--acc); background: color-mix(in srgb, var(--acc) 9%, var(--panel)); }
.pre-card:focus-visible { outline: 2px solid var(--acc); outline-offset: 1px; }
.pre-g { width: 100%; height: 30px; display: block; }
.pre-g .pg-up { fill: color-mix(in srgb, var(--up) calc(26% * var(--hk, 1)), transparent); }
.pre-g .pg-dn { fill: color-mix(in srgb, var(--dn) calc(22% * var(--hk, 1)), transparent); }
.pre-g .pg-z { stroke: var(--line); stroke-width: 1; }
.pre-g .pg-l { fill: none; stroke: var(--text); stroke-width: 1.5; stroke-linejoin: round; }
/* Saved strategies: one card per strategy, P&L first, open ones before closed */
.sv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 10px; margin-top: 10px; }
.sv-card { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-left: 3px solid var(--line); border-radius: var(--r2, 8px); background: var(--panel); }
.sv-card.pos { border-left-color: var(--up); } .sv-card.neg { border-left-color: var(--dn); }
.sv-card.closed { opacity: .72; }
.sv-card header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.sv-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; } .sv-name b { font-size: 14px; line-height: 1.25; }
.sv-pnl { text-align: right; display: grid; } .sv-pnl b { font: 600 17px var(--mono); } .sv-pnl small { font-size: 11px; white-space: nowrap; }
.sv-legs { list-style: none; margin: 2px 0 0; padding: 6px 0 0; border-top: 1px solid var(--line); display: grid; gap: 4px; font-size: 12px; }
.sv-legs li { display: grid; grid-template-columns: auto minmax(0, 1fr) 72px auto 64px; align-items: center; gap: 6px; }
.sv-card.closed .sv-legs li { grid-template-columns: minmax(0, 1fr) auto auto 64px; }
.sv-legs input { width: 72px; } .sv-legs .num { text-align: right; font-family: var(--mono); }
.sv-card footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 4px; }
.sv-act { display: flex; gap: 4px; }
.sv-leg { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Strategy payoff: compact stat strip so the chart sits near the top beside the builder */
#page-strategy .po-sum { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
#page-strategy .po-sum .stat { padding: 5px 8px; }
#page-strategy .po-sum .stat b { font-size: 11px; }
#page-strategy .po-sum .stat span { font-size: 13px; display: block; }
/* OI analysis layout: 8 stats as two even rows; the build-up quadrant really is 2 x 2 and gets the wider column */
#page-oi #oi-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } @media (max-width: 700px) { #page-oi #oi-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
#page-oi .grid2:has(#oi-quad) { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; }
#oi-quad { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 900px) { #page-oi .grid2:has(#oi-quad) { grid-template-columns: 1fr; } }
/* Quiet OI build-up page */
.sth-ctl { display: grid; gap: 8px; }
.sth-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } .sth-line > .muted { min-width: 52px; }
.sth-tg.on { border-color: var(--acc); background: color-mix(in srgb, var(--acc) 12%, var(--panel)); }
.sth-adv summary { cursor: pointer; color: var(--acc); font-size: 13px; }
.sth-presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.sth-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 16px; }
.sth-grid label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); } .sth-grid output { float: right; font: 600 12px var(--mono); color: var(--text); }
.sth-grid input[type=range] { width: 100%; accent-color: var(--acc); }
.sth-bias { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sth-chip { font: inherit; font-size: 12px; padding: 4px 9px; border-radius: 6px; cursor: pointer; background: var(--panel); border: 1px solid var(--line); color: var(--text); }
.sth-chip span { color: var(--muted); }
.sth-chip.bull { border-color: color-mix(in srgb, var(--up) 45%, var(--line)); } .sth-chip.bull b + * { color: var(--up); }
.sth-chip.bear { border-color: color-mix(in srgb, var(--dn) 45%, var(--line)); }
.sth-chip.bull { color: var(--up); } .sth-chip.bear { color: var(--dn); } .sth-chip b { color: var(--text); }
.sth-chip.on { background: color-mix(in srgb, var(--acc) 12%, var(--panel)); border-color: var(--acc); }
.grid-sth { display: grid; grid-template-columns: minmax(0, 2fr) minmax(220px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .grid-sth { grid-template-columns: 1fr; } }
.sth-plot svg { width: 100%; height: auto; display: block; font-family: var(--mono); }
.sth-corr { fill: color-mix(in srgb, var(--up) calc(10% * var(--hk, 1)), transparent); }
.sth-corr-t { font-size: 10px; fill: var(--up); } .sth-ax { font-size: 10px; fill: var(--muted); }
.sth-grid-l { stroke: var(--line); stroke-width: 1; } .sth-min { stroke: var(--warn); stroke-dasharray: 4 3; }
.sth-dot { cursor: pointer; fill-opacity: .55; stroke-width: 1.2; } .sth-dot.ce { fill: var(--dn); stroke: var(--dn); } .sth-dot.pe { fill: var(--up); stroke: var(--up); }
.sth-dot.quiet { stroke-dasharray: 2 2; stroke-width: 2; fill-opacity: .25; } .sth-dot.dim { opacity: .15; }
.sth-leg { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; } .sth-leg i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }
.sth-leg i.ce { background: var(--dn); } .sth-leg i.pe { background: var(--up); } .sth-leg i.q { border: 2px dashed var(--muted); width: 7px; height: 7px; }
.sth-top { display: grid; gap: 4px; max-height: 330px; overflow-y: auto; }
.sth-trow { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; font: inherit; font-size: 12px; text-align: left; padding: 6px 8px; border-radius: 6px; border: 1px solid transparent; background: var(--panel2); color: var(--text); cursor: pointer; }
.sth-trow.on { border-color: var(--acc); } .sth-trow .num { font-family: var(--mono); }
.sth-tbl td { vertical-align: top; }
.sth-tier { font: 700 10px var(--mono); padding: 2px 6px; border-radius: 4px; letter-spacing: .04em; text-transform: uppercase; }
.sth-tier.elite { background: color-mix(in srgb, var(--acc) 22%, transparent); color: var(--acc); }
.sth-tier.strong { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.sth-tier.watch { background: var(--panel2); color: var(--muted); }
.sth-pager { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 8px; }
.sth-help summary { cursor: pointer; } .sth-help p { font-size: 13px; max-width: 80ch; } .warn-t { color: var(--warn); }
#page-stealth #sth-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); } @media (max-width: 800px) { #page-stealth #sth-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.sth-tbl td, .sth-tbl th { padding-left: 5px; padding-right: 5px; }
.sth-tbl td:first-child, .sth-tbl th:first-child { position: sticky; left: 0; background: var(--panel); }
