/* Trade_v3 UI. Tokens first; dark is the default, light follows the OS or the toggle. */
:root {
  --bg: #0d1117; --panel: #151b24; --panel-2: #1b2330; --line: #263040; --line-soft: #1f2836;
  --text: #e6edf3; --muted: #8b98a9; --faint: #5d6a7c;
  --accent: #2dd4bf; --accent-ink: #042f2b; --accent-soft: rgba(45,212,191,.12);
  --pos: #34d399; --neg: #f87171; --warn: #fbbf24; --info: #60a5fa;
  --pos-soft: rgba(52,211,153,.14); --neg-soft: rgba(248,113,113,.14); --warn-soft: rgba(251,191,36,.14);
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 8px 24px rgba(0,0,0,.25);
  --radius: 10px; --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --sans: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f7fa; --panel: #ffffff; --panel-2: #f0f3f7; --line: #d9e0e8; --line-soft: #e7ecf1;
    --text: #17202b; --muted: #5a6778; --faint: #8a96a6;
    --accent: #0f766e; --accent-ink: #ffffff; --accent-soft: rgba(15,118,110,.1);
    --pos: #047857; --neg: #b91c1c; --warn: #a16207; --info: #1d4ed8;
    --pos-soft: rgba(4,120,87,.1); --neg-soft: rgba(185,28,28,.1); --warn-soft: rgba(161,98,7,.12);
    --shadow: 0 1px 2px rgba(20,30,50,.08), 0 6px 18px rgba(20,30,50,.06); color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f5f7fa; --panel: #ffffff; --panel-2: #f0f3f7; --line: #d9e0e8; --line-soft: #e7ecf1;
  --text: #17202b; --muted: #5a6778; --faint: #8a96a6;
  --accent: #0f766e; --accent-ink: #ffffff; --accent-soft: rgba(15,118,110,.1);
  --pos: #047857; --neg: #b91c1c; --warn: #a16207; --info: #1d4ed8;
  --pos-soft: rgba(4,120,87,.1); --neg-soft: rgba(185,28,28,.1); --warn-soft: rgba(161,98,7,.12);
  --shadow: 0 1px 2px rgba(20,30,50,.08), 0 6px 18px rgba(20,30,50,.06); color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--sans); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; background: var(--panel); padding: 6px 10px; z-index: 50; }
h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; } h2 { font-size: 15px; margin: 0 0 10px; }
.num, td.n, th.n { font-variant-numeric: tabular-nums; text-align: right; }
.mono { font-family: var(--mono); font-size: 12px; }
.pos { color: var(--pos); } .neg { color: var(--neg); } .muted { color: var(--muted); } .faint { color: var(--faint); }

/* top bar */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 20px; padding: 0 20px; height: 54px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; }
.brand small { color: var(--muted); font-weight: 450; }
.logo { width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(135deg, var(--accent), #0e7490); position: relative; }
.logo::after { content: ""; position: absolute; inset: 6px 4px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: skewY(-28deg); opacity: .9; }
.top nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.top nav a, .top nav .soon { padding: 8px 12px; border-radius: 8px; color: var(--muted); white-space: nowrap; }
.top nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.top nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.top nav .soon { opacity: .45; cursor: default; }
.top-right { display: flex; align-items: center; gap: 10px; }
.icon-btn { background: var(--panel); border: 1px solid var(--line); color: var(--text); width: 34px; height: 34px; border-radius: 8px; cursor: pointer; font-size: 16px; }
.icon-btn:hover { background: var(--panel-2); }

main { max-width: 1320px; margin: 0 auto; padding: 22px 20px 60px; outline: none; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

/* pills and badges */
.pill, .badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.badge.ok { color: var(--pos); background: var(--pos-soft); border-color: transparent; }
.badge.bad { color: var(--neg); background: var(--neg-soft); border-color: transparent; }
.badge.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.badge.info { color: var(--info); background: color-mix(in srgb, var(--info) 14%, transparent); border-color: transparent; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 14px; } .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stack { display: grid; gap: 14px; }

/* KPI strip */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.kpi .l { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.kpi .v { font-size: 22px; font-weight: 650; letter-spacing: -.01em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .s { color: var(--faint); font-size: 12px; margin-top: 2px; }

/* toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
input, select, button.btn { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
input:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=search] { min-width: 240px; }
button.btn { cursor: pointer; font-weight: 600; } button.btn:hover { background: var(--panel-2); }
button.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
button.btn.primary:hover { filter: brightness(1.08); }
label.chk { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); cursor: pointer; }

/* tables */
.tbl-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); max-height: 72vh; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
th { position: sticky; top: 0; background: var(--panel-2); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; cursor: pointer; user-select: none; z-index: 1; }
th.n, td.n { text-align: right; }
th[aria-sort="ascending"]::after { content: " ▲"; color: var(--accent); } th[aria-sort="descending"]::after { content: " ▼"; color: var(--accent); }
tbody tr:hover { background: var(--panel-2); }
tr.click { cursor: pointer; }
tr.invalid td { opacity: .62; }
td.wrap { white-space: normal; }
.table-plain th { position: static; cursor: default; }
.bar-cell { position: relative; min-width: 110px; }
.bar-cell i { position: absolute; left: 0; top: 20%; bottom: 20%; border-radius: 3px; opacity: .22; }
.bar-cell span { position: relative; }

/* charts */
.chart { width: 100%; display: block; }
.chart text { fill: var(--muted); font: 11px var(--sans); }
.chart .grid-l { stroke: var(--line-soft); } .chart .axis { stroke: var(--line); }
.chart .eq { fill: none; stroke: var(--accent); stroke-width: 1.8; }
.chart .dd-a { fill: var(--neg-soft); stroke: var(--neg); stroke-width: 1.2; }
.chart .zero { stroke: var(--faint); stroke-dasharray: 3 3; }
.tip { position: fixed; z-index: 40; pointer-events: none; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; box-shadow: var(--shadow); font-size: 12px; }
.tip b { display: block; margin-bottom: 2px; }

/* month grid */
.mgrid { display: grid; grid-template-columns: 52px repeat(12, minmax(46px, 1fr)) 84px; gap: 3px; font-size: 12px; overflow-x: auto; }
.mgrid > div { padding: 6px 4px; border-radius: 5px; text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mgrid .h { color: var(--muted); font-weight: 600; } .mgrid .y { color: var(--muted); text-align: left; font-weight: 600; }
.mgrid .e { background: var(--panel-2); color: var(--faint); }
.mgrid .t { font-weight: 650; }

/* states */
.empty, .error, .loading { padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
.error { color: var(--neg); border-color: var(--neg); background: var(--neg-soft); text-align: left; }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--panel-2), var(--line), var(--panel-2)); background-size: 200% 100%; animation: sh 1.2s infinite; }
@keyframes sh { to { background-position: -200% 0; } }
.notice { padding: 10px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); }
.notice.bad { color: var(--neg); background: var(--neg-soft); border-color: transparent; }
.notice.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-all; }
.crumbs { color: var(--muted); margin-bottom: 8px; }
details > summary { cursor: pointer; color: var(--muted); }

@media (max-width: 900px) { .g2, .g3 { grid-template-columns: 1fr; } .top { gap: 10px; padding: 0 12px; } .brand small { display: none; } }
@media (max-width: 560px) { main { padding: 16px 16px 48px; } .kpi .v { font-size: 19px; } input[type=search] { min-width: 0; width: 100%; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* mobile: let grid children shrink so nothing forces horizontal page scroll */
.stack, .grid { min-width: 0; } .stack > *, .grid > *, .card { min-width: 0; }
.card { overflow-x: auto; }
@media (max-width: 560px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .mgrid { min-width: 560px; } }

/* ---- U7 colour system: identity colours per underlying (same on every screen) ---- */
:root { --nifty: #2dd4bf; --banknifty: #a78bfa; --sensex: #fb923c; --other: #94a3b8; --warn-t: var(--warn); }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) { --nifty: #0f766e; --banknifty: #6d28d9; --sensex: #c2410c; --other: #64748b; } }
:root[data-theme="light"] { --nifty: #0f766e; --banknifty: #6d28d9; --sensex: #c2410c; --other: #64748b; }
.u-NIFTY { --u: var(--nifty); } .u-BANKNIFTY { --u: var(--banknifty); } .u-SENSEX { --u: var(--sensex); } .u-OTHER { --u: var(--other); }
.warn-t { color: var(--warn); }

/* chips */
.chips { display: inline-flex; gap: 4px; padding: 3px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.chip-btn { font: inherit; font-size: 13px; color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 7px; padding: 4px 11px; cursor: pointer; }
.toolbar > .chip-btn { border-color: var(--line); background: var(--panel); border-radius: 10px; padding: 7px 12px; }
.chip-btn:hover { color: var(--text); background: var(--panel-2); }
.chip-btn[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.chip-btn[class*="u-"][aria-pressed="true"] { color: var(--u); background: color-mix(in srgb, var(--u) 15%, transparent); }

/* strategy board */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.scard { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 16px 12px; overflow: hidden;
  cursor: pointer; transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease; }
.scard::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--u); }
.scard:hover, .scard:focus-visible { transform: translateY(-2px); border-color: color-mix(in srgb, var(--u) 55%, var(--line)); box-shadow: var(--shadow); }
.scard.none { cursor: default; opacity: .75; } .scard.none:hover { transform: none; box-shadow: none; }
.scard-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.uchip { font-size: 11px; font-weight: 700; letter-spacing: .05em; color: var(--u); background: color-mix(in srgb, var(--u) 14%, transparent); padding: 2px 8px; border-radius: 6px; }
.scard h3 { font-size: 14px; margin: 10px 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scard-net { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ybars { display: flex; gap: 6px; height: 64px; margin: 12px 0 4px; }
.yb { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; }
.yb-track { flex: 1; width: 100%; display: flex; align-items: flex-end; border-bottom: 1px solid var(--line); }
.yb i { display: block; width: 100%; border-radius: 3px 3px 0 0; }
.yb i.up { background: var(--pos); } .yb i.down { background: var(--neg); opacity: .85; }
.yb i.nodata { height: 3px; background: repeating-linear-gradient(90deg, var(--line) 0 3px, transparent 3px 6px); }
.yb span { font-size: 10px; color: var(--faint); }
.scard-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.scard-stats .l { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; }
.scard-stats .v { font-weight: 650; font-variant-numeric: tabular-nums; font-size: 13px; white-space: nowrap; }
.scard-warn { margin-top: 10px; font-size: 12px; color: var(--warn); background: var(--warn-soft); border-radius: 6px; padding: 4px 8px; }
.scard-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 11px; color: var(--faint); }
@media (prefers-reduced-motion: reduce) { .scard { transition: none; } .scard:hover { transform: none; } }

/* nav: keep it scrollable on narrow screens but never show a scrollbar under the header */
.top nav { scrollbar-width: none; -ms-overflow-style: none; overscroll-behavior-x: contain; }
.top nav::-webkit-scrollbar { display: none; height: 0; }
.top { overflow: hidden; }
.top nav .soon { display: inline-flex; align-items: center; gap: 6px; }
.soon-badge { font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  color: var(--warn); background: var(--warn-soft); border-radius: 999px; padding: 1px 7px; }
.top nav .soon { opacity: .7; }
.soon-box { padding: 48px 24px; } .soon-title { font-size: 18px; font-weight: 650; color: var(--text); margin-bottom: 4px; }

/* ---- 4.5 run page v2 ---- */
:root { --pos-rgb: 52,211,153; --neg-rgb: 248,113,113; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) { --pos-rgb: 4,120,87; --neg-rgb: 185,28,28; } }
:root[data-theme="light"] { --pos-rgb: 4,120,87; --neg-rgb: 185,28,28; }

/* verdict banner: colour = level, icon + words carry the meaning too */
.verdict { --vc: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; position: relative; overflow: hidden; }
.verdict::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--vc); }
.verdict.v-ok { --vc: var(--pos); background: linear-gradient(90deg, var(--pos-soft), var(--panel) 45%); }
.verdict.v-warn { --vc: var(--warn); background: linear-gradient(90deg, var(--warn-soft), var(--panel) 45%); }
.verdict.v-bad { --vc: var(--neg); background: linear-gradient(90deg, var(--neg-soft), var(--panel) 45%); }
.v-head { display: flex; gap: 14px; align-items: flex-start; }
.v-icon { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: 19px; font-weight: 700; color: var(--panel); background: var(--vc); }
.v-title { font-size: 19px; font-weight: 700; color: var(--vc); letter-spacing: -.01em; }
.v-next { margin-top: 2px; }
.v-checks { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 2px; }
.v-check { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); }
.v-check.ok { color: var(--pos); } .v-check.no { color: var(--neg); }
.v-check small { font-weight: 400; color: var(--faint); }
.v-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 28px; margin-top: 10px; }
.v-cols h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 6px 0 4px; }
.v-cols ul { margin: 0; padding-left: 18px; } .v-cols li { margin: 3px 0; }
.v-note { font-size: 11px; margin-top: 8px; }
@media (max-width: 760px) { .v-cols { grid-template-columns: 1fr; } }

/* equity zoom */
.zoombar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 8px; }
.chart .zoom-sel { fill: var(--accent-soft); stroke: var(--accent); stroke-dasharray: 3 2; }

/* daily P&L calendar */
.cal { display: grid; gap: 6px; overflow-x: auto; }
.cal-y { max-width: none; }
.chart .cal-pos { fill: var(--pos); } .chart .cal-neg { fill: var(--neg); } .chart .cal-flat { fill: var(--line); }
.chart .cal-yl { font-weight: 700; fill: var(--muted); }
.cal rect:hover { stroke: var(--text); stroke-width: 1.2; }

/* month grid cells are buttons now */
.mgrid .mcell { font: inherit; font-size: 12px; border: 0; padding: 6px 4px; border-radius: 5px; cursor: pointer; font-variant-numeric: tabular-nums; }
.mgrid .mcell.t { background: transparent; font-weight: 650; }
.mgrid .mcell:hover { outline: 2px solid var(--accent); outline-offset: -1px; }

/* trades card */
.card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 13px; }
.filter-chip button { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 13px; width: 22px; height: 22px; border-radius: 50%; }
.filter-chip button:hover { background: var(--accent-soft); }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 10px; }
.pager:empty { display: none; }
button.btn[disabled] { opacity: .45; cursor: default; }
#trades { scroll-margin-top: 70px; }

/* ---- 4.6 Backtest page ---- */
.bt-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 900px) { .bt-grid { grid-template-columns: 1fr; } }
.bt-form { display: grid; gap: 18px; }
.bt-field { display: grid; gap: 8px; }
.bt-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
select.wide { width: 100%; padding: 9px 10px; }
.bt-info { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.uchip-sm { font-size: 11px; font-weight: 700; color: var(--u); background: color-mix(in srgb, var(--u) 14%, transparent); padding: 2px 8px; border-radius: 6px; }
.bt-custom { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bt-custom[hidden] { display: none; }
.bt-resolved { font-size: 13px; } .bt-note { font-size: 12px; line-height: 1.45; }
.bt-chk { color: var(--text); }
.bt-adv summary { font-size: 13px; } .bt-adv[open] { display: grid; gap: 6px; }
.bt-run { justify-self: start; padding: 10px 22px; font-size: 15px; }
.bt-run[disabled] { opacity: .6; cursor: progress; }
.bt-job h2 { margin-bottom: 10px; }
.bt-jobhead { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.bt-result { display: flex; gap: 18px; font-size: 18px; font-weight: 650; margin: 10px 0 14px; font-variant-numeric: tabular-nums; }
.notice.ok-n { color: var(--pos); background: var(--pos-soft); border-color: transparent; }
.progress { height: 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--info))); transition: width .4s ease; }
.progress.indet i { animation: indet 1.3s ease-in-out infinite; }
@keyframes indet { 0% { margin-left: -30%; } 100% { margin-left: 100%; } }
.bt-progress-text { margin-top: 8px; font-size: 13px; }
.cov-num { font-size: 14px; margin-bottom: 10px; } .cov-num b { font-size: 20px; }
.cov-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; gap: 2px; background: var(--panel-2); }
.cov-bar i, .cov-legend i { display: block; }
.seg-ok { background: var(--pos); } .seg-miss { background: var(--warn); } .seg-na { background: var(--line); }
.cov-legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 8px 0; font-size: 12px; color: var(--muted); }
.cov-legend span { display: inline-flex; align-items: center; gap: 6px; } .cov-legend i { width: 10px; height: 10px; border-radius: 3px; }
.jobs { list-style: none; margin: 0; padding: 0; display: grid; }
.jobs li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.jobs li:last-child { border-bottom: 0; }
.jobs-main { flex: 1; min-width: 0; } .jobs-main > div:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.jobs-side { text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .progress i { transition: none; } .progress.indet i { animation: none; } }
.chips { flex-wrap: wrap; } .chip-btn { white-space: nowrap; }

/* ---- 4.7 trade drawer ---- */
body.no-scroll { overflow: hidden; }
.drawer-backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(5, 10, 18, .45); display: flex; justify-content: flex-end; }
.drawer { width: min(760px, 100%); height: 100%; overflow-y: auto; background: var(--bg); border-left: 1px solid var(--line); box-shadow: -12px 0 40px rgba(0,0,0,.3); outline: none; animation: slide .18s ease; }
@keyframes fade { from { opacity: 0; } } @keyframes slide { from { transform: translateX(30px); } }
.dr-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.dr-head h2 { margin: 0; font-size: 16px; } .dr-kicker { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.dr-nav { display: flex; gap: 6px; } .icon-btn[disabled] { opacity: .35; cursor: default; }
.dr-body { padding: 16px 18px 40px; display: grid; gap: 14px; }
.dr-net { font-size: 28px; font-weight: 700; letter-spacing: -.02em; display: flex; align-items: baseline; gap: 12px; font-variant-numeric: tabular-nums; }
.dr-legsum { font-size: 14px; font-weight: 600; color: var(--muted); }
.dr-chart-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; } .dr-chart-head .chip-btn { margin-left: auto; border: 1px solid var(--line); }
.dr-fill { display: grid; gap: 4px; font-size: 13px; padding: 10px 12px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); }
.dr-facts { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.dr-legs { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; } .dr-legs td, .dr-legs th { padding: 7px 10px; font-size: 13px; }
.dr-tabs { align-self: start; }
.pchart { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 4px 0; }
.chart .c-up { fill: var(--pos); stroke: var(--pos); } .chart .c-dn { fill: var(--neg); stroke: var(--neg); }
.chart .px-line { fill: none; stroke: var(--accent); stroke-width: 1.4; } .chart .hl-band { fill: var(--accent-soft); stroke: none; }
.chart .trade-band { fill: var(--accent-soft); } .chart .day-sep { stroke: var(--line); stroke-dasharray: 2 3; }
.chart .hline { stroke: var(--warn); stroke-dasharray: 5 4; stroke-width: 1.2; } .chart .hline-t { fill: var(--warn); font-size: 10px; font-weight: 600; }
.chart .vline { stroke: var(--info); stroke-dasharray: 2 3; }
.chart .mk { stroke: var(--bg); stroke-width: 1.2; } .chart .mk-entry { fill: var(--info); } .chart .mk-exit { fill: var(--warn); }
.chart .mk-dot { stroke: none; } .chart .mk-t { font-size: 11px; font-weight: 700; }
.chart text.mk-entry { fill: var(--info); } .chart text.mk-exit { fill: var(--warn); }
#trades tbody tr { cursor: pointer; }
@media (max-width: 560px) { .dr-body { padding: 12px 12px 32px; } .dr-net { font-size: 22px; } }
@media (prefers-reduced-motion: reduce) { .drawer, .drawer-backdrop { animation: none; } }
.chart .day-t { font-size: 10px; font-weight: 700; fill: var(--muted); }
.dr-legs-wrap { overflow-x: auto; border-radius: 8px; } .drawer { overflow-x: hidden; }

/* ---- 4.8 strategies + compare ---- */
:root { --s1: #5aa9e6; --s2: #f0b54a; --s3: #3ec1a0; --s4: #e58fc6; --s5: #b9a3ff; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) { --s1: #0072b2; --s2: #c27c00; --s3: #009e73; --s4: #b8538f; --s5: #6a4fc4; } }
:root[data-theme="light"] { --s1: #0072b2; --s2: #c27c00; --s3: #009e73; --s4: #b8538f; --s5: #6a4fc4; }
.head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
a.btn { display: inline-flex; align-items: center; text-decoration: none; font-weight: 600; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; }
a.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.sec-title { font-size: 15px; margin: 4px 0 10px; }
.rules { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.rule-sec h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); margin-bottom: 6px; }
.rule-sec ul { margin: 0; padding-left: 18px; } .rule-sec li { margin: 4px 0; line-height: 1.45; }
.ref-card .ref-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ref-item { background: var(--panel-2); border-radius: 8px; padding: 10px 12px; } .ref-item .l { font-size: 12px; color: var(--muted); } .ref-item .v { font-size: 22px; font-weight: 700; }
pre.raw { white-space: pre-wrap; word-break: break-word; font: 12px/1.5 var(--mono); background: var(--panel-2); padding: 12px; border-radius: 8px; max-height: 420px; overflow: auto; margin: 10px 0 0; }
.cmp-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; align-items: stretch; }
.cmp-chip { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--c); }
.cmp-chip > i { display: none; } .cmp-chip a { font-weight: 650; } .cmp-chip .faint { font-size: 12px; }
.cmp-table th[scope="row"] { color: var(--muted); font-weight: 600; text-transform: none; letter-spacing: 0; font-size: 13px; background: transparent; position: static; }
.cmp-table thead th { position: static; }
.cmp-table td.heat.pos { background: var(--pos-soft); } .cmp-table td.heat.neg { background: var(--neg-soft); }
.best { color: var(--warn); }
.cmp-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.cmp-legend span { display: inline-flex; align-items: center; gap: 6px; } .cmp-legend i { width: 18px; height: 3px; border-radius: 2px; display: inline-block; }
.sub-h { font-size: 13px; margin: 14px 0 6px; color: var(--muted); }
.corr td, .corr th { padding: 6px 10px; font-size: 13px; }
.diff-block { margin-top: 10px; } .diff-block > summary { font-weight: 650; color: var(--text); padding: 6px 0; }
@media (max-width: 560px) { .ref-card .ref-grid { grid-template-columns: 1fr; } .rules { grid-template-columns: 1fr; } }

/* ---- ideas from the v2 UI: live ticker, toasts, dashboard hero, skipped-days panel ---- */
.ticker { display: flex; align-items: center; gap: 16px; padding: 5px 20px; background: #0a0f17; color: #d6dee8; font-size: 12.5px; border-bottom: 1px solid #1d2633; overflow-x: auto; scrollbar-width: none; white-space: nowrap; }
.ticker::-webkit-scrollbar { display: none; }
.tk-status { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.tk-status i { width: 8px; height: 8px; border-radius: 50%; background: #64748b; }
.tk-status.on { color: #34d399; } .tk-status.on i { background: #34d399; box-shadow: 0 0 0 3px rgba(52,211,153,.2); animation: pulse 2s infinite; }
.tk-status.off { color: #fbbf24; } .tk-status.off i { background: #fbbf24; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(52,211,153,0); } }
.tk-items { display: flex; gap: 22px; } .tk-item b { color: #8b98a9; font-weight: 600; margin-right: 2px; } .tk-item.muted { color: #8b98a9; }
.tk-chg { margin-left: 6px; padding: 1px 6px; border-radius: 5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tk-chg.up { color: #34d399; background: rgba(52,211,153,.12); } .tk-chg.dn { color: #f87171; background: rgba(248,113,113,.12); }
.tk-time { margin-left: auto; color: #5d6a7c; font-variant-numeric: tabular-nums; }
.tk-connect-btn { display: inline-flex; align-items: center; gap: 5px; background: #131c2a; color: #38bdf8; border: 1px solid #1e293b; border-radius: 6px; padding: 2px 10px; font-size: 11px; font-weight: 700; cursor: pointer; transition: all .15s ease; line-height: 1.4; user-select: none; }
.tk-connect-btn:hover { background: #0284c7; color: #fff; border-color: #38bdf8; box-shadow: 0 0 10px rgba(56,189,248,.3); }
.tk-connect-btn:active { transform: scale(0.97); }
.tk-connect-btn:disabled, .tk-connect-btn.disabled { opacity: 0.6; cursor: not-allowed; background: #111827; color: #64748b; border-color: #1f2937; transform: none; }
.tk-connect-btn.on-offline { background: #27210e; color: #f59e0b; border-color: #78350f; animation: pulse-border 2s infinite; }
.tk-connect-btn.on-offline:hover { background: #d97706; color: #fff; border-color: #f59e0b; }
.tk-connect-btn.success { background: #064e3b; color: #34d399; border-color: #059669; }
@keyframes pulse-border { 50% { border-color: rgba(245,158,11,0.3); } }
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: grid; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 13.5px; animation: tin .2s ease; transition: opacity .3s, transform .3s; }
.toast.out { opacity: 0; transform: translateY(6px); }
.t-icon { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #fff; background: var(--info); }
.t-ok .t-icon { background: var(--pos); } .t-bad .t-icon { background: var(--neg); } .t-warn .t-icon { background: var(--warn); }
.t-x { margin-left: auto; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }
.nav-count { font-style: normal; font-size: 11px; font-weight: 700; margin-left: 4px; padding: 0 6px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.hero { position: relative; overflow: hidden; border-radius: 14px; padding: 22px 22px 18px; margin-bottom: 16px; color: #e6edf3;
  background: radial-gradient(120% 140% at 100% 0%, rgba(45,212,191,.22), transparent 55%), linear-gradient(135deg, #0b1220 0%, #10213a 60%, #0d2a2b 100%); border: 1px solid #1f2b3d; }
.hero h1 { color: #fff; font-size: 24px; } .hero p { color: #9fb0c3; margin: 4px 0 0; max-width: 720px; }
.hero-kicker { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #5eead4; margin-bottom: 4px; }
.hero-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px; align-items: flex-end; }
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hero a.btn.ghost { background: rgba(255,255,255,.06); color: #e6edf3; border-color: rgba(255,255,255,.18); }
.hero-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-top: 18px; }
.hero-tile { background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.09); border-radius: 10px; padding: 10px 12px; }
.hero-tile .hv { font-size: 26px; font-weight: 750; color: #fff; font-variant-numeric: tabular-nums; } .hero-tile .hv.pos { color: #34d399; } .hero-tile .hv.neg { color: #f87171; }
.hero-tile .hl { font-size: 12px; font-weight: 700; color: #cbd5e1; text-transform: uppercase; letter-spacing: .04em; } .hero-tile .hs { font-size: 11.5px; color: #8b98a9; margin-top: 2px; }
.skip-list { display: grid; gap: 8px; }
.skip-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 13px; }
.skip-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.skip-bar { height: 10px; background: var(--panel-2); border-radius: 999px; overflow: hidden; } .skip-bar i { display: block; height: 100%; border-radius: 999px; }
.skip-bar i.rule, .skip-legend i.rule { background: var(--info); } .skip-bar i.data, .skip-legend i.data { background: var(--warn); } .skip-bar i.quar, .skip-legend i.quar { background: var(--neg); }
.skip-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: 12px; color: var(--muted); } .skip-legend span { display: inline-flex; align-items: center; gap: 6px; } .skip-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
@media (prefers-reduced-motion: reduce) { .tk-status.on i, .toast { animation: none; } }

/* ---- 4.9 Market Data ---- */
.cov-cal { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.cov-mname { font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.cov-dow, .cov-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cov-dow span { font-size: 10px; color: var(--faint); text-align: center; }
.cc { font: inherit; font-size: 11px; aspect-ratio: 1; border: 0; border-radius: 5px; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.cc.pad { background: transparent; } .cc.none { background: var(--panel-2); color: var(--faint); cursor: default; }
.cc.st-ok { background: color-mix(in srgb, var(--pos) 70%, transparent); color: #fff; cursor: pointer; }
.cc.st-missing { background: var(--warn); color: #111; cursor: pointer; } .cc.st-na { background: var(--line); color: var(--muted); cursor: pointer; }
.cc.sel { outline: 2px solid var(--accent); outline-offset: 1px; }
.cov-legend i.cal-empty { background: var(--panel-2); border: 1px solid var(--line); }

/* ---- Phase B: duplicate / archive / folders / tags ---- */
.modal-back { align-items: center; justify-content: center; padding: 16px; }
.modal { width: min(460px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; box-shadow: var(--shadow); display: grid; gap: 12px; }
.modal h2 { margin: 0; font-size: 17px; }
.modal-field { display: grid; gap: 4px; font-size: 13px; } .modal-field > span { font-weight: 650; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.modal-field input { width: 100%; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
button.btn.danger { color: var(--neg); border-color: color-mix(in srgb, var(--neg) 45%, var(--line)); }
.lbls { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.lbl-folder, .lbl-tag { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.lbl-tag { color: var(--info); background: color-mix(in srgb, var(--info) 10%, transparent); border-color: transparent; }
.lbl-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 12px; align-items: end; }
@media (max-width: 700px) { .lbl-grid { grid-template-columns: 1fr; } }

/* ---- Phase C: strategy builder ---- */
.bld-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); gap: 16px; align-items: start; }
.bld-main { display: grid; gap: 14px; }
.bld-side { position: sticky; top: 70px; display: grid; gap: 12px; max-height: calc(100vh - 90px); overflow: auto; }
.bld-sec h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); }
.bld-help { margin: -4px 0 10px; font-size: 12.5px; }
.bld-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; }
.bld-field { display: grid; gap: 5px; align-content: start; font-size: 13px; } .bld-field > span { font-size: 12px; font-weight: 650; color: var(--muted); }
.bld-field input[type=text], .bld-field input[type=number], .bld-field input[type=time], .bld-field select { width: 100%; }
.bld-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--line-soft); border-radius: 8px; margin-bottom: 8px; background: var(--panel-2); }
.bld-key { width: 90px; font-family: var(--mono); }
.bld-param { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); } .bld-param input, .bld-param select { width: 86px; }
.bld-cond .bld-n { width: 38px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.bld-operand { display: inline-flex; gap: 6px; } .bld-operand select { max-width: 240px; } .bld-num { width: 90px; }
.bld-inline { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; } .bld-inline input { width: 90px; }
.leg-card { border-left: 4px solid var(--pos); }
.bld-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.bld-actions .btn[disabled] { opacity: .5; cursor: not-allowed; }
.bld-words h3 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); margin: 8px 0 2px; }
.bld-words ul { margin: 0; padding-left: 18px; font-size: 13px; } .bld-words li { margin: 2px 0; }
.bld-note { font-size: 12px; }
@media (max-width: 960px) { .bld-layout { grid-template-columns: 1fr; } .bld-side { position: static; max-height: none; } }

/* ---- Phase C v2: selling engines in the builder ---- */
.bld-engine .chips { flex-wrap: wrap; }
.bld-sub { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 12px 0 6px; }
.leg-row.sell { border-left: 4px solid var(--neg); } .leg-row.buy { border-left: 4px solid var(--pos); }
.leg-row .chips { padding: 2px; }

/* ---- Phase D: Live Paper and forward gate ---- */
.live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.live-card { cursor: default; } .live-card:hover { transform: none; }
.live-state { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0; }
.live-conds { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; } .live-conds .l { width: 100%; font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; }
.live-pos { font-size: 12.5px; background: var(--panel-2); border-radius: 8px; padding: 8px 10px; }
.fwd-card { border-left: 4px solid var(--info); border-radius: 0 12px 12px 0; }
.fwd-checks { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 4px; font-size: 13px; }
.fwd-checks li.ok b { color: var(--pos); } .fwd-checks li.no b { color: var(--neg); }

/* ---- My Strategies workspace (v2-style) ---- */
.ms-subnav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; padding: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.ms-tab { padding: 7px 14px; border-radius: 8px; color: var(--muted); font-weight: 600; }
.ms-tab:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.ms-tab.on { background: var(--accent); color: var(--accent-ink); }
.ms-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 860px) { .ms-layout { grid-template-columns: 1fr; } }
.ms-tree { position: sticky; top: 70px; padding: 12px 10px; display: grid; gap: 2px; max-height: calc(100vh - 90px); overflow: auto; }
.ms-tree-head { display: flex; justify-content: space-between; align-items: center; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 2px 6px 8px; }
button.linkish { border: 0; background: none; color: var(--accent); cursor: pointer; font: inherit; font-weight: 600; padding: 0; }
button.linkish.danger-t { color: var(--neg); }
.ms-node-row { display: flex; align-items: center; gap: 2px; }
.ms-node { flex: 1; display: flex; justify-content: space-between; align-items: center; gap: 8px; border: 0; background: none; color: var(--text); font: inherit; text-align: left; padding: 7px 8px; border-radius: 8px; cursor: pointer; min-width: 0; }
.ms-node span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-node em { font-style: normal; font-size: 11px; font-weight: 700; color: var(--muted); background: var(--panel-2); border-radius: 999px; padding: 1px 7px; }
.ms-node:hover { background: var(--panel-2); }
.ms-node.on { background: var(--accent-soft); color: var(--accent); font-weight: 650; } .ms-node.on em { background: var(--accent); color: var(--accent-ink); }
.ms-more { opacity: 0; } .ms-node-row:hover .ms-more, .ms-node-row:focus-within .ms-more, .ms-more[aria-expanded="true"] { opacity: 1; }
@media (hover: none) { .ms-more { opacity: .7; } }
.ms-tree-tip { font-size: 11.5px; margin: 10px 4px 0; line-height: 1.4; }
.ctx-menu { position: fixed; z-index: 80; min-width: 230px; max-width: calc(100vw - 16px); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 5px; display: flex; flex-direction: column; }
.ctx-head { font-size: 12px; font-weight: 600; padding: 6px 10px 4px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }
.ctx-item { border: 0; background: none; color: var(--text); font: inherit; text-align: left; padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.ctx-item:hover:not([disabled]), .ctx-item:focus-visible { background: var(--panel-2); outline: none; }
.ctx-item[disabled] { opacity: .45; cursor: default; }
.bulk-modal { width: min(680px, calc(100vw - 24px)); }
.bulk-list { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; max-height: 46vh; overflow: auto; border-top: 1px solid var(--line); padding-top: 8px; }
.bulk-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 6px 4px; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.bulk-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bulk-state { text-align: right; max-width: 52vw; }
.bulk-why { font-size: 12px; white-space: normal; display: inline-block; }
.bulk-prog { display: inline-flex; align-items: center; gap: 8px; } .bulk-prog .progress { width: 110px; display: inline-block; margin: 0; }
@media (max-width: 560px) { .bulk-row { grid-template-columns: auto 1fr; } .bulk-state { grid-column: 1 / -1; text-align: left; max-width: none; } }
.icon-btn.sm { width: 26px; height: 26px; font-size: 12px; }
.ms-folder-title { font-weight: 700; color: var(--muted); margin: 0 0 10px; font-size: 13px; }
.ms-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.ms-card { position: relative; display: grid; gap: 6px; padding: 14px 14px 10px; border-top: 3px solid var(--u); }
.ms-card-top { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.ms-card h3 { margin: 4px 0 0; font-size: 15px; } .ms-card h3 a { color: var(--text); } .ms-id { margin-top: -4px; }
.ms-sub { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); margin-top: 2px; }
.ms-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.ms-chip { font-size: 11.5px; padding: 2px 8px; border-radius: 6px; background: var(--pos-soft); color: var(--pos); border: 1px solid color-mix(in srgb, var(--pos) 25%, transparent); }
.ms-chip.more { background: var(--panel-2); color: var(--muted); border-color: var(--line); }
.ms-legs { display: flex; flex-wrap: wrap; gap: 4px; }
.ms-leg { font-size: 12px; font-weight: 650; padding: 3px 9px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel-2); }
.ms-leg.buy { border-left: 3px solid var(--pos); } .ms-leg.sell { border-left: 3px solid var(--neg); }
.ms-timing { font-size: 12px; }
.ms-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding: 8px 0 2px; border-top: 1px solid var(--line-soft); }
.ms-stats .l { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); } .ms-stats .v { font-weight: 700; font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ms-norun { font-size: 12px; padding: 6px 10px; }
.ms-runline { font-size: 11.5px; }
.ms-acts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 4px; }
.ms-acts .btn { padding: 8px 6px; font-size: 13px; text-align: center; justify-content: center; }
.btn.act-bt { background: color-mix(in srgb, var(--pos) 85%, black); color: #fff; border-color: transparent; }
.btn.act-fw { background: var(--info); color: #fff; border-color: transparent; } .btn.act-fw.on { background: color-mix(in srgb, var(--info) 70%, black); }
.btn.act-live { background: var(--warn-soft); color: var(--warn); }
.ms-acts .btn[disabled] { opacity: .55; cursor: not-allowed; }
.ms-icons { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; padding-top: 6px; border-top: 1px solid var(--line-soft); }
.bt-modal { width: min(620px, 100%); max-height: 92vh; overflow: auto; }
.bt-modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.bt-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.bt-presets .chip-btn { border: 1px solid var(--line); border-radius: 8px; padding: 9px 8px; background: var(--panel-2); }
.bt-datarow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; }
.bt-data { min-height: 26px; }

/* ---- Execution (v2-style) ---- */
.ex-top { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.ex-top-btn { display: grid; gap: 2px; text-align: left; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; font: inherit; }
.ex-top-btn small { color: var(--muted); } .ex-top-btn.on { background: var(--info); color: #fff; border-color: transparent; } .ex-top-btn.on small { color: rgba(255,255,255,.85); }
.ex-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.ex-tab { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font: inherit; font-weight: 650; cursor: pointer; }
.ex-tab em { font-style: normal; font-size: 12px; min-width: 22px; text-align: center; padding: 1px 7px; border-radius: 999px; background: var(--panel-2); color: var(--text); }
.ex-tab.on.t-ok { background: var(--pos); color: #fff; border-color: transparent; } .ex-tab.on.t-warn { background: var(--warn); color: #111; border-color: transparent; }
.ex-tab.on.t-info { background: var(--info); color: #fff; border-color: transparent; } .ex-tab.on em { background: rgba(255,255,255,.3); color: inherit; }
.ex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.ex-card { border-top: 3px solid var(--u); display: grid; gap: 8px; } .ex-card.running { border-top-color: var(--pos); }
.ex-card-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; } .ex-card h3 { margin: 0; font-size: 15px; }
.ex-count { text-align: center; padding: 6px 10px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); line-height: 1.1; }
.ex-count b { font-size: 18px; display: block; } .ex-count small { font-size: 10.5px; } .ex-count.all { background: var(--pos-soft); color: var(--pos); }
.ex-candle { font-size: 12px; }
.cond-list { display: grid; gap: 5px; }
.cond-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 7px 9px; border-radius: 8px; border: 1px solid var(--line-soft); }
.cond-row.met { background: var(--pos-soft); border-color: transparent; } .cond-row.no { background: var(--neg-soft); border-color: transparent; }
.cond-ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #fff; background: var(--muted); }
.cond-row.met .cond-ic { background: var(--pos); } .cond-row.no .cond-ic { background: var(--neg); }
.cond-main { font-size: 13px; min-width: 0; } .cond-vals { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.need { font-size: 11.5px; font-weight: 700; color: var(--neg); background: var(--panel); border-radius: 6px; padding: 2px 7px; white-space: nowrap; }
.ex-pnl { text-align: right; font-size: 20px; font-weight: 750; font-variant-numeric: tabular-nums; } .ex-pnl small { display: block; font-size: 10.5px; font-weight: 500; color: var(--muted); }
.ex-pos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; background: var(--panel-2); border-radius: 8px; padding: 10px; }
.ex-pos .l { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); } .ex-pos .v { font-weight: 650; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .ex-top { grid-template-columns: 1fr; } .ex-grid { grid-template-columns: 1fr; } }

.bulk-sum { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.bulk-item { padding: 8px 4px; border-bottom: 1px dashed var(--line); }
.bulk-row2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bulk-name2 { flex: 1; min-width: 160px; }
.bulk-reasons { margin: 4px 0 0 28px; padding: 0; font-size: 12.5px; color: var(--muted); }
.bulk-reasons li { margin: 1px 0; }
/* papers */
.pp-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 12px; }
.pp-tab { border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; padding: 6px 12px; border-radius: 999px; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; }
.pp-tab em { font-style: normal; font-size: 12px; color: var(--muted); background: var(--panel-2); border-radius: 999px; padding: 0 7px; }
.pp-tab.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.pp-head { margin-bottom: 12px; } .pp-head-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; margin-bottom: 8px; } .pp-head-top h2 { margin: 0; }
.pp-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.pp-chip { border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: inherit; font-size: 12px; padding: 1px 8px; border-radius: 999px; cursor: pointer; }
.pp-chip:hover { border-color: var(--accent); }
.ms-papers { margin: 2px 0 4px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bulk-opt { display: flex; align-items: flex-start; gap: 6px; margin: 10px 0 0; font-size: 13.5px; cursor: pointer; }
.fwd-checks li.warn { color: var(--warn-t, var(--text)); }
/* trade details */
.td { display: grid; gap: 14px; } .td-sec h4 { margin: 0 0 6px; font-size: 14px; } .td-sec .faint { margin: 0 0 8px; }
.td-chosen { font-weight: 700; color: var(--accent); }
.td-time { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 8px; }
.ex-detail { margin: 8px 0 0; } .ex-detail > summary { cursor: pointer; color: var(--accent); font-size: 13px; }
.ex-detail[open] > summary { margin-bottom: 8px; }


/* ---- Header option A: dark trading terminal (user choice 2026-11-19). The bar is dark in BOTH themes; page content
   still follows light/dark. Accent line teal; Execution (live money) amber; research and data/live split by a divider. */
.top { --hd-bg: #0b1220; --hd-bg-2: #111a2b; --hd-line: #22304a; --hd-text: #e6edf3; --hd-muted: #9fb0c6; --hd-accent: #2dd4bf; --hd-accent-ink: #042f2b; --hd-amber: #fbbf24;
  background: var(--hd-bg); backdrop-filter: none; border-bottom: 2px solid var(--hd-accent); height: 60px; color: var(--hd-text); gap: 18px; }
.top .brand { display: flex; align-items: center; gap: 10px; color: var(--hd-text); text-decoration: none; flex-shrink: 0; }
.top .brand:hover { text-decoration: none; }
.top .logo { width: 66px; height: 44px; border-radius: 8px; background: #fff; display: inline-flex; align-items: center; justify-content: center; position: static; }   /* white tile: the artwork's navy would vanish on the dark bar */
.top .logo img { display: block; width: 60px; height: auto; }
.top .logo::after { content: none; }
.wordmark { display: flex; flex-direction: column; line-height: 1.1; }
.wm-name { font-size: 17px; font-weight: 700; letter-spacing: -.01em; color: #fff; }
.wm-name b { color: var(--hd-accent); font-weight: 700; }
.wm-tag { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: #7c8aa0; font-weight: 500; }
.top nav { align-items: center; gap: 2px; }
.top nav a { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 7px; color: var(--hd-muted); font-weight: 500; font-size: 15.5px; }
.top nav a:hover { background: var(--hd-bg-2); color: #fff; }
.top nav a.on { background: rgba(45,212,191,.14); color: var(--hd-accent); font-weight: 600; box-shadow: inset 0 -2px 0 var(--hd-accent); }
.top nav a.nav-exec { color: var(--hd-amber); }
.top nav a.nav-exec.on { background: rgba(251,191,36,.14); color: var(--hd-amber); box-shadow: inset 0 -2px 0 var(--hd-amber); }
.top nav .ni { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.top nav a[data-nav="new"] .ni { fill: currentColor; stroke: none; }
.top nav a.nav-exec .ni { fill: currentColor; stroke: none; }
.nav-sep { width: 1px; height: 20px; background: var(--hd-line); margin: 0 6px; flex-shrink: 0; }
.top .nav-count { background: rgba(45,212,191,.18); color: var(--hd-accent); }
.top .pill { background: var(--hd-bg-2); color: var(--hd-muted); border-color: var(--hd-line); }
.top .icon-btn { background: var(--hd-bg-2); border-color: var(--hd-line); color: var(--hd-text); }
.top .icon-btn:hover { background: #18243a; }
.top :focus-visible { outline-color: var(--hd-accent); }
@media (max-width: 1240px) { .wm-tag { display: none; } .top nav a { padding: 7px 9px; font-size: 15px; } .top .pill { display: none; } }
@media (max-width: 1000px) { .top { height: 54px; gap: 10px; } .top .logo { width: 54px; height: 36px; } .top .logo img { width: 50px; } .top nav .ni { display: none; } .nav-sep { margin: 0 2px; }
  .top nav a { padding: 6px 8px; font-size: 14.5px; } .top .pill { display: none; } }

/* Waiting for entry trigger (v2-style rows): rank + name | conditions with progress | state and Remove */
.wt-list { display: grid; gap: 12px; }
.wt-row { border-left: 4px solid var(--u); display: grid; grid-template-columns: minmax(200px, 1fr) minmax(280px, 2fr) auto; gap: 16px; align-items: start; }
.wt-rank { display: inline-block; font-size: 12px; font-weight: 700; color: var(--accent, #3b4bd6); background: var(--accent-soft, #e8ebff); border-radius: 8px; padding: 3px 9px; margin-bottom: 6px; }
.wt-id h3 { margin: 0 0 4px; font-size: 15px; } .wt-candle { margin-top: 6px; font-size: 12px; }
.wt-prog { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.wt-pct { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--warn); } .wt-pct.all { color: var(--pos); }
.wt-bar { height: 8px; border-radius: 6px; background: var(--line-soft); overflow: hidden; margin-bottom: 10px; } .wt-bar i { display: block; height: 100%; background: var(--accent, #3b4bd6); border-radius: 6px; }
.wt-act { display: grid; gap: 8px; justify-items: end; align-content: start; }
.wt-state { font-size: 12px; font-weight: 800; letter-spacing: .03em; color: var(--warn); background: var(--warn-soft); border-radius: 999px; padding: 5px 12px; white-space: nowrap; }
@media (max-width: 900px) { .wt-row { grid-template-columns: 1fr; } .wt-act { justify-items: start; grid-auto-flow: column; justify-content: start; } }

/* ---- 2026-11-20: the live ticker stays on top with the nav; compact Execution header; compact waiting rows ---- */
.ticker { position: sticky; top: 0; z-index: 21; height: 30px; box-sizing: border-box; }   /* "Live - market open" line never scrolls away */
.top { top: 30px; }                                                                        /* the nav sticks right under it */
.bld-side, .ms-tree { top: 100px; max-height: calc(100vh - 120px); }                       /* side panels clear both bars */
.ex-top { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.ex-top-btn { display: inline-flex; align-items: baseline; gap: 8px; padding: 5px 12px; border-radius: 9px; }
.ex-top-btn small { font-size: 11.5px; }
.ex-tabs { margin-bottom: 8px; } .ex-tab { padding: 6px 12px; border-radius: 9px; }
.pp-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 22px; padding: 8px 14px; margin-bottom: 8px; }
.pp-head-top { margin: 0; gap: 10px; } .pp-head-top h2 { font-size: 15px; }
.pp-head .kpis { display: flex; flex-wrap: wrap; gap: 4px 22px; margin-left: auto; }
.pp-head .kpi { display: flex; align-items: baseline; gap: 7px; padding: 0; border: 0; background: none; }
.pp-head .kpi .l { font-size: 11px; } .pp-head .kpi .v { font-size: 16px; margin: 0; } .pp-head .kpi .s { margin: 0; font-size: 11px; }
.wt-list { gap: 8px; }
.wt-row { grid-template-columns: 250px minmax(0, 1fr) 118px; gap: 14px; padding: 10px 14px; }
.wt-rank { font-size: 11px; padding: 1px 8px; margin-bottom: 4px; } .wt-id h3 { font-size: 14px; margin: 0 0 2px; }
.wt-candle { font-size: 11px; margin-top: 4px; line-height: 1.3; }
.wt-prog { margin-bottom: 4px; font-size: 13px; } .wt-bar { height: 6px; margin-bottom: 6px; }
.wt-conds .cond-list { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 4px; }
.wt-conds .cond-row { grid-template-columns: 18px minmax(0, 1fr) auto; gap: 6px; padding: 4px 8px; }
.wt-conds .cond-ic { width: 18px; height: 18px; font-size: 10px; }
.wt-conds .cond-main { font-size: 12px; line-height: 1.25; } .wt-conds .cond-vals { font-size: 11px; margin-top: 0; }
.wt-conds .need { font-size: 11px; padding: 1px 6px; }
.wt-state { font-size: 10.5px; padding: 3px 9px; } .wt-act { gap: 6px; } .wt-act .btn { padding: 4px 12px; }
@media (max-width: 900px) { .wt-row { grid-template-columns: 1fr; } .pp-head .kpis { margin-left: 0; } }

/* selling position cards: rule chips, stats grid, review */
.chips { display: flex; flex-wrap: wrap; gap: 5px; } .chip { font-size: 11.5px; padding: 2px 9px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line-soft); }
.rv-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px 14px; } .rv-stats .l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; } .rv-stats .v { font-weight: 650; font-variant-numeric: tabular-nums; }
.rv { display: grid; gap: 4px; } .rv-list { margin: 2px 0 6px; padding-left: 18px; font-size: 12.5px; line-height: 1.45; } .rv-ideas li { color: var(--warn); }

/* login, account chip, users page */
body.signed-out header nav, body.signed-out #ticker, body.signed-out #health, body.signed-out #account { display: none; }
.login { max-width: 380px; margin: 60px auto; display: grid; gap: 12px; padding: 24px; } .login h1 { margin: 0; } .login-logo { justify-self: center; width: 200px; height: auto; background: #fff; border-radius: 12px; }.login label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.acct { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; } .acct select { max-width: 120px; padding: 3px 6px; font-size: 12.5px; } .acct .acct-name { white-space: nowrap; } .top-right { flex-shrink: 0; } .top .pill { padding: 1px 7px; font-size: 11.5px; }
.u-form { display: grid; gap: 10px; } .u-form label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); } .u-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pick { max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px; display: grid; gap: 2px; margin-top: 6px; } .pick label { display: flex; gap: 8px; font-size: 12.5px; color: var(--text); }

/* market conditions (i) popup and card: tools/market_conditions.py -> GET /conditions; display only */
.cond-i { background: none; border: 0; color: var(--faint); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 3px; vertical-align: middle; } .cond-i:hover, .cond-i:focus-visible { color: var(--accent); }
.modal.cond-modal { width: min(720px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; display: block; }
.cond-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; } .cond-head h2 { margin: 0; font-size: 17px; }
.cond-top { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; } .cond-note { font-size: 12px; margin: 6px 0; line-height: 1.45; }
.cond-block { margin-top: 12px; } .cond-bh { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 13px; }
.cond-grid { display: grid; gap: 4px; } .cond-lbl { text-align: center; font-size: 11px; color: var(--muted); }
.cond-gh { text-align: center; font-size: 11px; font-weight: 700; padding-bottom: 2px; border-bottom: 2px solid var(--faint); color: var(--muted); } .cond-gh.neg { border-color: var(--neg); color: var(--neg); } .cond-gh.pos { border-color: var(--pos); color: var(--pos); }
.cond-cell { text-align: center; border-radius: 8px; padding: 6px 2px; display: grid; gap: 1px; } .cond-cell b { font-size: 13px; color: var(--text); } .cond-cell small { font-size: 10.5px; color: var(--muted); }
.cond-cell.thin { border: 1px dashed var(--faint); opacity: .78; } .cond-cell.empty { background: var(--panel-2); color: var(--faint); font-size: 11px; padding: 10px 2px; }
.cond-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; } .cond-chip { padding: 3px 9px; border-radius: 999px; font-size: 12px; background: var(--panel-2); color: var(--muted); }
.cond-chip.good { background: var(--pos-soft); color: var(--pos); font-weight: 600; } .cond-chip.bad { background: var(--neg-soft); color: var(--neg); font-weight: 600; }
.cond-none { margin-top: 6px; padding: 6px 10px; border-radius: 8px; background: var(--panel-2); color: var(--muted); font-size: 12px; }

/* ranking scorecard on My Strategies cards: reference/buying_scorecard.json via GET /my-strategies; display only */
.ms-card.ranked { --gc: var(--faint); --gs: var(--panel-2); }
.ms-card.g-core { --gc: var(--pos); --gs: var(--pos-soft); } .ms-card.g-backup { --gc: var(--info); --gs: color-mix(in srgb, var(--info) 14%, transparent); }
.ms-card.g-watch { --gc: var(--warn); --gs: var(--warn-soft); } .ms-card.g-drop { --gc: var(--neg); --gs: var(--neg-soft); }
.ms-rankbar { display: flex; align-items: center; gap: 8px; margin: -2px 0 2px; padding: 5px 8px; border-radius: 8px; background: var(--gs); border-left: 3px solid var(--gc); }
.ms-rankno { font-size: 17px; font-weight: 800; color: var(--gc); font-variant-numeric: tabular-nums; }
.ms-group { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--gc); }
.ms-rank-of { margin-left: auto; font-size: 11.5px; }
.ms-rank { display: grid; gap: 4px; padding-top: 6px; border-top: 1px solid var(--line-soft); }
.ms-rank-per { font-size: 10.5px; text-transform: none; letter-spacing: 0; font-weight: 400; }
.ms-stats-rank { border-top: 0; padding-top: 2px; row-gap: 8px; }
.ms-years { display: flex; flex-wrap: wrap; gap: 4px; }
.ms-yr { font-size: 11.5px; padding: 2px 7px; border-radius: 999px; background: var(--panel-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ms-yr b { font-weight: 600; color: var(--muted); } .ms-yr.pos { color: var(--pos); } .ms-yr.neg { color: var(--neg); background: var(--neg-soft); }
.ms-strength { margin: 2px 0 0; font-size: 12px; line-height: 1.45; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ms-card.ms-dropped > :not(.ms-rankbar):not(.ms-acts) { opacity: .6; }
@media (max-width: 480px) { .ms-stats-rank { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ranking review everywhere (ui/js/scorecard.js, GET /scorecard): chip, readable panel, dashboard card states */
.rank-chip { --gc: var(--faint); --gs: var(--panel-2); display: inline-flex; align-items: center; gap: 3px; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; color: var(--gc); background: var(--gs); white-space: nowrap; }
.rank-chip b { font-weight: 800; }
.rank-chip.g-core, .rk.g-core { --gc: var(--pos); --gs: var(--pos-soft); } .rank-chip.g-backup, .rk.g-backup { --gc: var(--info); --gs: color-mix(in srgb, var(--info) 14%, transparent); }
.rank-chip.g-watch, .rk.g-watch { --gc: var(--warn); --gs: var(--warn-soft); } .rank-chip.g-drop, .rk.g-drop { --gc: var(--neg); --gs: var(--neg-soft); }
.rank-chip.changed { outline: 1px dashed var(--warn); }
.scard.ranked { box-shadow: inset 0 3px 0 0 color-mix(in srgb, var(--gc, var(--line)) 70%, transparent); }
.scard.g-core { --gc: var(--pos); } .scard.g-backup { --gc: var(--info); } .scard.g-watch { --gc: var(--warn); } .scard.g-drop { --gc: var(--neg); }
.scard.scard-dropped > :not(.scard-top) { opacity: .6; }
.rk { --gc: var(--faint); --gs: var(--panel-2); display: grid; gap: 10px; }
.rk-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--gs); border-left: 4px solid var(--gc); }
.rk-no { font-size: 28px; font-weight: 800; color: var(--gc); line-height: 1; font-variant-numeric: tabular-nums; }
.rk-group { font-weight: 700; color: var(--gc); } .rk-group .faint { font-weight: 400; } .rk-gdesc { font-size: 12.5px; }
.rk-sum { margin: 0; font-size: 14px; line-height: 1.55; }
.rk-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; }
.rk-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.rk-l { font-size: 13px; } .rk-l small { display: block; font-size: 11px; color: var(--faint); }
.rk-v { font-weight: 700; font-size: 15px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rk-sub { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); }
.rk-bars { display: grid; gap: 5px; }
.rk-bar { display: grid; grid-template-columns: 96px 1fr 92px; align-items: center; gap: 8px; font-size: 13px; }
.rk-track { height: 10px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.rk-track i { display: block; height: 100%; border-radius: 999px; } .rk-track i.up { background: var(--pos); } .rk-track i.down { background: var(--neg); }
.rk-bv { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.rk-stress { margin: 0; font-size: 13px; color: var(--muted); }
.rk-note { margin: 0; padding: 10px 12px; border-left: 3px solid var(--gc); background: var(--panel-2); border-radius: 0 8px 8px 0; font-size: 13.5px; line-height: 1.5; display: grid; gap: 4px; }
.rk-changed { margin: 0; }
.cond-title { margin: 18px 0 4px; font-size: 15px; }
@media (max-width: 520px) { .rk-grid { grid-template-columns: 1fr; } .rk-bar { grid-template-columns: 78px 1fr 80px; } }
tr.row-total td { border-top: 2px solid var(--line); background: var(--panel-2); }

/* renamed strategies: long names wrap, the earlier name is a small tag; the Execution search box */
.ms-card h3, .ex-card h3, .wt-id h3, .scard h3, .page-head h1, .bulk-name, .bulk-name2 { overflow-wrap: anywhere; }
.scard h3 { white-space: normal; }
.wt-id { min-width: 0; }
.lbl-old { display: inline-block; align-self: flex-start; max-width: 100%; margin: 2px 0; padding: 1px 7px; border: 1px dashed var(--line); border-radius: 6px; font-size: 11px; font-weight: 500; color: var(--muted); overflow-wrap: anywhere; }
.ex-search { flex: 1; max-width: 420px; }

/* ---- 2026-11-28: the tabs stay in the top row. Spacing tightens as the window narrows so every tab and the version fit;
   only below 1000px, where one row cannot hold them, the tabs take a second row directly under the name (still at the top). */
.top nav a[hidden] { display: none; }                              /* a tab the person may not open stays hidden (the tab style would show it) */
.top .pill { display: inline-flex; flex-shrink: 0; white-space: nowrap; }
.top .top-right { flex-shrink: 0; }
@media (max-width: 1600px) {
  .wm-tag { display: none; }
  .top { gap: 12px; padding: 0 14px; }
  .top nav a { padding: 7px 8px; gap: 5px; font-size: 14.5px; }
}
@media (max-width: 1400px) { .top nav .ni { display: none; } .top .nav-sep { display: none; } }
@media (max-width: 1180px) {
  .top { gap: 8px; padding: 0 10px; }
  .top nav a { padding: 6px 5px; font-size: 13.5px; }
  .top .top-right { gap: 6px; }
  .top .acct { gap: 6px; }
  .top .acct-name { display: none; }                               /* the name stays in the tenant box */
  .top .acct select { max-width: 104px; }
}
@media (max-width: 1000px) {
  .top { flex-wrap: wrap; height: auto; row-gap: 0; padding-top: 6px; overflow: visible; }
  .top .brand { order: 1; }
  .top .top-right { order: 2; margin-left: auto; }
  .top nav { order: 3; flex: 1 0 100%; flex-wrap: wrap; justify-content: space-between; overflow: visible; margin-top: 5px; padding: 3px 0 5px; border-top: 1px solid var(--hd-line); }
  .top .acct-name { display: inline; }
  .bld-side, .ms-tree { top: 140px; max-height: calc(100vh - 160px); }
}
@media (max-width: 640px) {
  .top { position: static; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "brand version theme" "account account account" "nav nav nav"; align-items: center; gap: 7px; padding: 8px 8px 0; }
  .top .brand { grid-area: brand; min-width: 0; }
  .top .top-right { display: contents; }
  .top #health { grid-area: version; }
  .top #theme { grid-area: theme; }
  .top .acct { grid-area: account; display: flex; justify-content: flex-end; gap: 10px; min-width: 0; }
  .top .acct[hidden] { display: none; }
  .top .acct select { flex: 1 1 120px; max-width: none; min-width: 0; min-height: 34px; }
  .top nav { grid-area: nav; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0; margin: 0; padding: 4px 0 5px; }
  .top nav a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; min-height: 46px; padding: 3px 0; font-size: clamp(9px, 2.7vw, 11px); line-height: 1.2; }
  .top nav a[hidden] { display: none; }
  .top nav .ni { display: block; width: 19px; height: 19px; }
  .top nav .nav-count { position: absolute; top: 0; right: 1px; margin: 0; font-size: 8.5px; line-height: 13px; padding: 0 3px; }
  .top nav .nav-count[hidden] { display: none; }
  .bld-side, .ms-tree { position: static; max-height: none; }
}

/* ---- 2026-11-28: the open page's tab looks like a tab: it sits on the header's bottom edge, joins the page below, coloured top edge */
.top { border-bottom: 0; box-shadow: inset 0 -2px 0 var(--hd-accent); }   /* the line is drawn under the tabs, so the open tab covers its piece */
.top .nav-sep { display: none; }                                           /* it separated the Data tab, which is hidden */
.top nav { align-self: stretch; align-items: flex-end; padding-bottom: 0; }
.top nav a { min-height: 44px; border-top: 3px solid transparent; border-radius: 10px 10px 0 0; }
.top nav a.on, .top nav a.nav-exec.on { background: var(--bg); color: var(--text); font-weight: 700; border-top-color: var(--hd-accent); box-shadow: none; }
.top nav a.nav-exec.on { border-top-color: var(--hd-amber); }
.top nav a.nav-exec.on .ni { color: #d97706; }
.top nav a.on:hover { background: var(--bg); color: var(--text); }
.top nav a.on .nav-count { background: var(--accent-soft); color: var(--accent); }
@media (min-width: 1001px) { .top nav { margin-left: 28px; } }                          /* breathing room between the logo and the first tab */
@media (min-width: 1001px) and (max-width: 1260px) { .top nav { margin-left: 12px; } }      /* less on narrow laptops, so every tab still fits */

/* ---- 2026-11-28: tab names a little bigger and bolder (sizes step down with the width so every tab still fits) */
.top nav a { font-size: 16.5px; font-weight: 600; }
@media (max-width: 1600px) { .top nav a { font-size: 15.5px; } }
@media (max-width: 1340px) { .top nav a { font-size: 15px; padding-left: 6px; padding-right: 6px; } }
@media (max-width: 1180px) { .top nav a { font-size: 14.5px; padding-left: 4px; padding-right: 4px; } }
@media (max-width: 1080px) { .top nav a { font-size: 14px; padding-left: 3px; padding-right: 3px; } .top nav { gap: 0; } }
@media (max-width: 1000px) { .top nav a { font-size: 15px; padding-left: 8px; padding-right: 8px; } }
@media (max-width: 640px) { .top nav a { font-size: clamp(9.5px, 2.75vw, 12px); padding-left: 0; padding-right: 0; letter-spacing: -0.2px; } }
@media (max-width: 340px) { .top nav a { font-size: 9px; letter-spacing: -.4px; } }

/* ---- 2026-11-30: Execution day board, rank + (i) next to every strategy, margin pills */
.ex-title { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.ex-tags { display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; }
.ex-tags .rank-chip { font-size: 11px; padding: 1px 8px; }
.rank-chip.sell-rank { --gc: var(--accent); --gs: var(--accent-soft); }
.rank-chip.unranked { font-weight: 500; }
.ex-tags .cond-i { font-size: 17px; }
.ex-margin { display: inline-flex; align-items: baseline; gap: 6px; margin-top: 6px; padding: 3px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel-2); font-weight: 700; font-variant-numeric: tabular-nums; font-size: 13.5px; }
.ex-margin em { font-style: normal; font-weight: 600; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.ex-margin.na { font-weight: 500; color: var(--muted); }
.db { padding: 0; overflow: hidden; margin-bottom: 12px; }
.db-hero { display: grid; grid-template-columns: minmax(240px, 1.5fr) repeat(4, minmax(150px, 1fr)); gap: 1px; background: var(--line); }
.db-hero > * { background: var(--panel); padding: 14px 16px; min-width: 0; }
.db-main { box-shadow: inset 4px 0 0 var(--line); }
.db-main.up { box-shadow: inset 4px 0 0 var(--pos); background: linear-gradient(90deg, var(--pos-soft), var(--panel) 85%); }
.db-main.down { box-shadow: inset 4px 0 0 var(--neg); background: linear-gradient(90deg, var(--neg-soft), var(--panel) 85%); }
.db-l { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.db-big { font-size: 34px; line-height: 1.15; font-weight: 800; font-variant-numeric: tabular-nums; margin: 4px 0 2px; }
.db-main.up .db-big { color: var(--pos); } .db-main.down .db-big { color: var(--neg); }
.db-v { font-size: 21px; font-weight: 750; font-variant-numeric: tabular-nums; margin: 6px 0 2px; overflow-wrap: anywhere; }
.db-s { font-size: 12px; color: var(--muted); line-height: 1.4; }
.db-blotter { border-top: 1px solid var(--line); border-radius: 0; margin: 0; max-width: 100%; overflow-x: auto; }
.db-blotter table { width: 100%; }
.db-blotter td { font-variant-numeric: tabular-nums; vertical-align: middle; }
.db-name { font-weight: 650; }
.db-legs { white-space: pre; }
.db-side { display: inline-block; padding: 1px 8px; border-radius: 5px; font-size: 11px; font-weight: 800; letter-spacing: .04em; }
.db-side.sell { background: var(--neg-soft); color: var(--neg); } .db-side.buy { background: var(--pos-soft); color: var(--pos); }
.db-foot { margin: 0; padding: 8px 16px 10px; font-size: 11.5px; }
@media (max-width: 1200px) { .db-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); } .db-main { grid-column: 1 / -1; } }
@media (max-width: 640px) { .db-blotter .db-x { display: none; } .db-blotter th, .db-blotter td { padding: 8px 10px; font-size: 12.5px; } .db-blotter td.n { white-space: nowrap; } }   /* phones: name, P&L and margin only */
@media (max-width: 520px) { .db-hero { grid-template-columns: 1fr 1fr; } .db-big { font-size: 28px; } .db-v { font-size: 17px; } .db-hero > * { padding: 11px 12px; } }

/* ---- 2026-11-30: option buying and option selling kept clearly apart (blue = buying, orange = selling) */
.db-side.buy { background: color-mix(in srgb, var(--info) 15%, transparent); color: var(--info); }
.db-side.sell { background: var(--warn-soft); color: var(--warn); }
.db { min-width: 0; max-width: 100%; }
.db-sides { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border-top: 1px solid var(--line); }
.db-side-panel { background: var(--panel); min-width: 0; box-shadow: inset 0 3px 0 var(--info); }
.db-side-panel.sell { box-shadow: inset 0 3px 0 var(--warn); }
.db-side-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px 2px; }
.db-side-head .db-side { font-size: 12px; padding: 3px 10px; }
.db-side-total { font-size: 22px; font-variant-numeric: tabular-nums; }
.db-side-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.db-side-stats > * { padding: 8px 16px 12px; min-width: 0; }
.db-side-stats .db-v { font-size: 17px; }
.db-blotter tr.db-group td { background: var(--panel-2); border-top: 2px solid var(--line); }
.db-blotter tr.db-group.buy td:first-child { box-shadow: inset 4px 0 0 var(--info); } .db-blotter tr.db-group.sell td:first-child { box-shadow: inset 4px 0 0 var(--warn); }
.db-count { font-size: 12px; color: var(--muted); margin-left: 6px; }
.ex-side { margin-top: 12px; }
.ex-side-head { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; padding-bottom: 6px; border-bottom: 2px solid var(--info); font-size: 14px; }
.ex-side-head.sell { border-bottom-color: var(--warn); }
.ex-side-head .db-side { font-size: 12.5px; padding: 3px 10px; }
.ex-side-head em { font-style: normal; font-size: 12px; color: var(--muted); background: var(--panel-2); border-radius: 999px; padding: 1px 9px; }
.ex-side-empty { padding: 14px; }
@media (max-width: 900px) { .db-sides { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 520px) { .db-side-stats > * { padding: 8px 10px 10px; } .db-side-stats .db-v { font-size: 14.5px; } .db-side-stats .db-l { font-size: 10px; letter-spacing: .03em; } .db-side-stats .db-s { font-size: 11px; } .db-side-total { font-size: 19px; } }
/* ---- 2026-12-06: UI audit fixes ---- */
html { scroll-padding-top: 96px; }          /* ticker 30px + nav 54px + air: a focused control never lands under the sticky bars */
.pm-actions { display: inline-flex; gap: 8px; margin-left: auto; flex: none; white-space: nowrap; }   /* Manage papers: Edit + Delete stay together */
.bulk-row2 > .faint { min-width: 0; }
/* Ticker on narrower screens: it must stay ONE 30px line (the nav is pinned at top: 30px under it), so it drops the least
   needed parts instead of wrapping: first the clock and the point change, then the change and the status words (the dot
   and its tooltip stay). */
@media (max-width: 1280px) { .tk-time, .tk-abs { display: none; } .ticker { gap: 12px; } .tk-items { gap: 14px; } }
@media (max-width: 900px) { .tk-chg { display: none; } .tk-status { font-size: 0; gap: 0; } .ticker { padding: 5px 12px; } }
