/* ═══════════════════════════════════════════════════════════════════════
   boards.css — UI 6.0: the desk open more than once, and the boards.

   Windows menu + right-click link menu (links.js), embedded panes
   (?embed=1), Workspace split view, Monitor, Goals, Replay. Everything
   reads the tokens in styles.css; nothing here defines a colour of its own.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Top bar: the Windows button and menu ─────────────────────────── */
.tn-win { position: relative; display: flex; align-items: center; }
.tb-win {
  position: relative; border: 1px solid var(--border-2); background: var(--surface-2);
}
.tb-win:hover { border-color: var(--faint); }
.tn-win.open > .tb-win { border-color: var(--accent); background: var(--accent-bg); color: var(--accent-d); }
.tb-win svg { width: 14px; height: 14px; }
.tb-win .badge {
  position: absolute; top: -5px; right: -5px; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 99px;
  background: var(--accent); color: var(--on-accent); font-size: 9.5px; font-weight: 700; display: grid; place-items: center;
  box-shadow: 0 0 0 2px var(--surface);
}
.tb-win .badge:empty { display: none; }
.tn-win .menu { width: 272px; max-height: calc(100vh - var(--topnav) - 20px); overflow-y: auto; }
.win-split { display: flex; flex-wrap: wrap; gap: 4px; padding: 2px 8px 8px; }
.win-split .chip { height: 24px; font-size: 11.5px; }
.win-peer { display: flex; align-items: center; gap: 8px; height: 26px; padding: 0 10px; font-size: 12px; color: var(--text-2); }
.win-peer .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--live); }
.win-peer .dot.paper { background: var(--paper); }
.win-peer .k { margin-left: auto; font-size: 10.5px; color: var(--faint); }
.win-note { padding: 4px 10px 8px; font-size: 11px; color: var(--faint); line-height: 1.45; }
a.menu-item { text-decoration: none; }

/* The "More" menu is grouped now; the sub-label says what a board is for. */
.tn-more .menu { width: 232px; }
.tn-more .menu h4 { padding: 7px 9px 3px; }
.nav-kbd { margin-left: auto; font-size: 10.5px; color: var(--faint); font-weight: 500; }
.tn-more .menu .nav-item .count + .nav-kbd { margin-left: 6px; }

/* ── Right-click on anything that navigates ───────────────────────── */
.ctx-menu {
  position: fixed; z-index: 200; min-width: 212px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r-lg);
  box-shadow: var(--shadow-md), inset 0 1px 0 var(--hi); animation: pop .14s var(--spring);
}
.ctx-title { padding: 6px 9px 4px; font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }

/* ── Embedded (a Workspace pane) ──────────────────────────────────── */
body.embed { --topnav: 0px; --gutter: 12px; }
body.embed .topnav, body.embed .nav-bd { display: none !important; }
body.embed .page { max-width: none; padding-bottom: 24px; }
body.embed .page-sub { max-width: 60ch; }

/* ── Workspace ────────────────────────────────────────────────────── */
.ws-page.active { max-width: none; padding-bottom: 12px; }
#wsLayouts > button { width: 32px; padding: 0; }
#wsLayouts svg { width: 15px; height: 15px; }
#wsPresets { max-width: 220px; }
.ws-grid {
  position: relative; display: grid; gap: 6px;
  height: calc(100vh - var(--stick) - var(--gap) - 12px); min-height: 420px;
}
.ws-grid.cols2 { grid-template-columns: 1fr 1fr; grid-template-areas: "p1 p2"; }
.ws-grid.rows2 { grid-template-rows: 1fr 1fr; grid-template-areas: "p1" "p2"; }
.ws-grid.cols3 { grid-template-columns: 1fr 1fr 1fr; grid-template-areas: "p1 p2 p3"; }
.ws-grid.main3 { grid-template-columns: 1.6fr 1fr; grid-template-rows: 1fr 1fr; grid-template-areas: "p1 p2" "p1 p3"; }
.ws-grid.grid4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; grid-template-areas: "p1 p2" "p3 p4"; }
.ws-grid.has-solo { grid-template-columns: 1fr !important; grid-template-rows: 1fr !important; grid-template-areas: none; }
.ws-grid.has-solo .ws-pane { display: none; }
.ws-grid.has-solo .ws-pane.solo { display: flex; grid-area: 1 / 1 / -1 / -1 !important; }

.ws-pane {
  display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: inset 0 1px 0 var(--hi);
  transition: border-color var(--dur);
}
.ws-pane:focus-within, .ws-pane:hover { border-color: var(--border-2); }
.ws-pane[data-mode="paper"] { border-top: 2px solid var(--paper-bd); }
.ws-pane[data-mode="live"] { border-top: 2px solid var(--accent-bd); }
.ws-bar {
  display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 6px 0 8px; flex-shrink: 0;
  border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.ws-n {
  width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center; flex-shrink: 0;
  background: var(--surface-3); color: var(--muted); font-size: 10.5px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.ws-bar select { height: 26px; font-size: 12px; font-weight: 600; padding: 0 24px 0 8px; max-width: 150px; }
.ws-mode.seg { flex-shrink: 0; }
.ws-where { flex: 1; min-width: 0; font-size: 11.5px; color: var(--muted); }
.ws-acts { display: flex; gap: 1px; flex-shrink: 0; }
.ws-acts .icon-btn svg { width: 13px; height: 13px; }
.ws-frame { position: relative; flex: 1; min-height: 0; background: var(--bg); }
.ws-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--bg); }
.ws-grid.dragging iframe { pointer-events: none; }
.ws-grid.dragging { cursor: col-resize; user-select: none; }
.ws-grid.rows2.dragging { cursor: row-resize; }

/* The divider sits over the grid gap and drags the fr ratio. */
.ws-split { position: absolute; z-index: 5; }
.ws-split.v { top: 0; bottom: 0; left: calc(var(--at, 50%) - 5px); width: 10px; cursor: col-resize; }
.ws-split.h { left: 0; right: 0; top: calc(var(--at, 50%) - 5px); height: 10px; cursor: row-resize; }
.ws-split::after {
  content: ""; position: absolute; border-radius: 99px; background: var(--border-2);
  transition: background var(--dur), transform var(--dur-2) var(--spring);
}
.ws-split.v::after { left: 4px; top: 50%; width: 2px; height: 40px; transform: translateY(-50%); }
.ws-split.h::after { top: 4px; left: 50%; height: 2px; width: 40px; transform: translateX(-50%); }
.ws-split:hover::after, .ws-grid.dragging .ws-split::after { background: var(--accent); }
.ws-split.v:hover::after, .ws-grid.dragging .ws-split.v::after { transform: translateY(-50%) scaleY(2.2); }
.ws-split.h:hover::after, .ws-grid.dragging .ws-split.h::after { transform: translateX(-50%) scaleX(2.2); }
/* With the fr ratio set inline, the divider's --at is a share of the grid
   minus the gap; close enough at 6px that it reads as centred on it. */

/* ── Monitor ──────────────────────────────────────────────────────── */
.mon-page.active { max-width: none; }
.mon { display: flex; flex-direction: column; gap: var(--gap); }
.mon-hero {
  display: grid; grid-template-columns: minmax(0, 1.8fr) repeat(3, minmax(0, 1fr));
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: inset 0 1px 0 var(--hi); overflow: hidden;
}
.mon-cell { padding: 16px 20px 18px; border-right: 1px solid var(--border); min-width: 0; }
.mon-cell:last-child { border-right: none; }
.mon-k { display: flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.mon-v { margin-top: 6px; font-size: 38px; font-weight: 650; letter-spacing: -0.04em; line-height: 1.05; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mon-v.xl { font-size: clamp(40px, 4.6vw, 64px); }
.mon-v .tiny { font-size: 13px; font-weight: 500; color: var(--faint); letter-spacing: 0; }
.mon-v > span { padding: 0 4px; margin: 0 -4px; }
.mon-s { margin-top: 6px; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.mon-clock .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.mon-clock.ok .dot { background: var(--pos); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pos) 22%, transparent); animation: pulse 2.2s ease-in-out infinite; }
.mon-clock.warn .dot { background: var(--warn); }

.mon-grid {
  display: grid; gap: var(--gap);
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas: "path path lims" "open open sbs" "open open tape";
}
.mon-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: inset 0 1px 0 var(--hi); min-width: 0; display: flex; flex-direction: column; }
.mon-path { grid-area: path; }
.mon-grid > .mon-panel:nth-child(2) { grid-area: lims; }
.mon-open { grid-area: open; }
.mon-grid > .mon-panel:nth-child(4) { grid-area: sbs; }
.mon-tape { grid-area: tape; }
.mon-ph { display: flex; align-items: baseline; gap: 9px; padding: 11px var(--pad) 9px; font-size: 12.5px; font-weight: 650; border-bottom: 1px solid var(--border); }
.mon-ph span { font-size: 11px; font-weight: 400; color: var(--muted); }
.mon-chart { height: 260px; padding: 8px 8px 4px; }
.mon-chart .chart-box { height: 100% !important; }
.mon-empty { display: flex; flex-direction: column; gap: 4px; align-items: center; justify-content: center; text-align: center; padding: 28px 16px; color: var(--muted); font-size: 12.5px; min-height: 120px; flex: 1; }
.mon-empty span { font-size: 11.5px; color: var(--faint); }

.mon-lims { padding: 6px 0; overflow-y: auto; max-height: 300px; }
.mon-acct { padding: 8px var(--pad) 10px; }
.mon-acct + .mon-acct { border-top: 1px solid var(--border); }
.mon-acct.stopped { background: var(--neg-bg); }
.mon-acct-h { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12.5px; }
.mon-acct-h .mono { margin-left: auto; font-size: 12.5px; font-weight: 600; }
.mon-lim { display: grid; grid-template-columns: 68px minmax(0, 1fr) 104px; align-items: center; gap: 8px; height: 20px; font-size: 11.5px; }
.mon-lim .k { color: var(--muted); }
.mon-lim .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); white-space: nowrap; }
.mon-lim .track { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.mon-lim .track.off { background: repeating-linear-gradient(90deg, var(--surface-3) 0 4px, transparent 4px 8px); }
.mon-lim .track i { display: block; height: 100%; border-radius: inherit; background: var(--pos); transition: width .5s var(--ease); }
.mon-lim.warn .track i { background: var(--warn); }
.mon-lim.bad .track i { background: var(--neg); }
.mon-lim.bad .v { color: var(--neg); font-weight: 600; }

.mon-pos { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; padding: 10px; }
.mon-p {
  position: relative; padding: 10px 12px 11px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface-2);
  cursor: pointer; transition: border-color var(--dur), transform var(--dur) var(--spring), background var(--dur);
}
.mon-p::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--border-2); }
.mon-p.up::before { background: var(--pos); }
.mon-p.dn::before { background: var(--neg); }
.mon-p:hover { border-color: var(--border-2); transform: translateY(-1px); background: var(--surface-hover); }
.mon-p .top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 13px; }
.mon-p .side { font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mon-p .pnl { margin-top: 4px; font-size: 22px; font-weight: 650; letter-spacing: -0.03em; }
.mon-p.up .pnl { color: var(--pos); }
.mon-p.dn .pnl { color: var(--neg); }
.mon-p .meta { margin-top: 2px; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mon-sbs { padding: 8px var(--pad) 10px; display: flex; flex-direction: column; gap: 7px; }
.mon-sb { display: grid; grid-template-columns: 70px minmax(0, 1fr) 84px; align-items: center; gap: 8px; font-size: 12px; }
.mon-sb .k { font-weight: 600; font-family: var(--mono); font-size: 11.5px; }
.mon-sb .bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.mon-sb .bar i { display: block; height: 100%; border-radius: inherit; }
.mon-sb .bar i.up { background: var(--pos); }
.mon-sb .bar i.dn { background: var(--neg); }
.mon-sb .v { text-align: right; font-size: 12px; font-weight: 600; }

.mon-ts { overflow-y: auto; max-height: 360px; }
.mon-t { display: grid; grid-template-columns: 44px 42px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 6px var(--pad); font-size: 12px; border-bottom: 1px solid var(--border); }
.mon-t:last-child { border-bottom: none; }
.mon-t .t { color: var(--muted); font-size: 11.5px; }
.mon-t .a { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); }
.mon-t .st { font-size: 11px; font-weight: 600; color: var(--text-2); }
.mon-t.ok .st { color: var(--pos); }
.mon-t.warn .st { color: var(--warn); }
.mon-t.bad .st { color: var(--neg); }
.mon-t .d { grid-column: 2 / -1; font-size: 11px; color: var(--muted); }
.mon-t.bad .d { color: var(--neg); }

/* Full screen: the board fills the display, bigger still. */
#page-monitor:fullscreen { background: var(--bg); padding: 18px 24px; overflow-y: auto; }
#page-monitor:fullscreen .page-head { position: static; margin: 0 0 var(--gap); padding: 0; }
#page-monitor:fullscreen .page-head::after { display: none; }
#page-monitor:fullscreen .mon-chart { height: 34vh; }

/* ── Goals ────────────────────────────────────────────────────────── */
.gl-top { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: var(--gap); }
.gl-top > * { margin-top: 0 !important; }
.gl-rings {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: inset 0 1px 0 var(--hi);
}
.gl-ring { position: relative; display: grid; place-items: center; padding: 16px 10px; border-right: 1px solid var(--border); min-width: 0; }
.gl-ring:last-child { border-right: none; }
.gl-ring svg { width: min(128px, 100%); aspect-ratio: 1; }
.gl-ring circle { fill: none; stroke-width: 7; }
.gl-ring .bg { stroke: var(--surface-3); }
.gl-ring .fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dasharray .7s var(--ease); }
.gl-ring.ok .fg { stroke: var(--pos); }
.gl-ring.warn .fg { stroke: var(--warn); }
.gl-ring.bad .fg { stroke: var(--neg); }
.gl-ring .in { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 20%; }
.gl-ring .in b { font-size: 17px; font-weight: 650; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gl-ring .in span { font-size: 10.5px; color: var(--muted); line-height: 1.3; margin-top: 2px; }
.gl-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.gl-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 550; }
.gl-form .hint { font-size: 10.5px; }
.gl-save { grid-column: 1 / -1; display: flex; justify-content: flex-end; }

.gl-month { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 18px; align-items: stretch; }
.gl-facts { display: flex; flex-direction: column; gap: 12px; }
.gl-fact { display: flex; flex-direction: column; gap: 1px; }
.gl-fact .k { font-size: 11px; color: var(--muted); }
.gl-fact b { font-size: 18px; font-weight: 650; letter-spacing: -0.02em; }
.gl-fact .s { font-size: 11px; color: var(--faint); }
.gl-chart { position: relative; height: 230px; padding-bottom: 20px; }
.gl-chart svg { position: absolute; left: 0; right: 0; top: 0; bottom: 20px; width: 100%; height: calc(100% - 20px); overflow: visible; }
.gl-chart line, .gl-chart path { vector-effect: non-scaling-stroke; fill: none; }
.gl-chart .zero { stroke: var(--border-2); stroke-width: 1; }
.gl-chart .tgt { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 2 4; }
.gl-chart .pace { stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 5 5; }
.gl-chart .proj { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 2 4; }
.gl-chart .act { stroke-width: 2.4; stroke-linejoin: round; }
.gl-chart .act.up { stroke: var(--pos); }
.gl-chart .act.dn { stroke: var(--neg); }
.gl-tag { position: absolute; right: 0; transform: translateY(-120%); font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: var(--r-xs); background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; }
.gl-tag.tgt { color: var(--muted); }
.gl-tag.proj { color: var(--accent-d); right: 120px; }
.gl-x { position: absolute; left: 0; right: 0; bottom: 0; height: 16px; }
.gl-x span { position: absolute; transform: translateX(-50%); font-size: 10.5px; color: var(--faint); white-space: nowrap; }
.gl-x span:first-child { transform: none; }
.gl-x span:last-child { transform: translateX(-100%); }
.gl-kpis { border: none; border-top: 1px solid var(--border); border-radius: 0 0 var(--r-lg) var(--r-lg); grid-template-columns: repeat(2, minmax(0, 1fr)); box-shadow: none; }
.gl-kpis .kpi:nth-child(2n) { border-right: none; }
.gl-kpis .kpi:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
.gl-disc { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--border); }
.gl-disc > div { padding: 12px var(--pad) 14px; border-right: 1px solid var(--border); min-width: 0; }
.gl-disc > div:last-child { border-right: none; }
.gl-disc h4 { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; margin-bottom: 8px; }
.gl-disc h4 .n { min-width: 20px; height: 18px; padding: 0 6px; border-radius: 99px; background: var(--surface-3); display: inline-grid; place-items: center; font-size: 10.5px; font-variant-numeric: tabular-nums; }
.gl-list { display: flex; flex-direction: column; gap: 2px; }
.gl-li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1px 8px; padding: 6px 8px; border-radius: var(--r-sm);
  font-size: 12px; cursor: pointer; transition: background var(--dur);
}
.gl-li:hover { background: var(--surface-hover); }
.gl-li .hint { grid-column: 1 / -1; font-size: 11px; }
.gl-none { font-size: 12px; color: var(--muted); padding: 6px 0; }
.gl-sum { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border-2); font-size: 12px; color: var(--text-2); }

/* ── Replay ───────────────────────────────────────────────────────── */
#rxDay { height: var(--ctl-h); font-size: 12px; padding: 0 8px; }
.rx-transport { display: flex; align-items: center; gap: 10px; padding: 9px var(--pad); border-radius: var(--r-lg) var(--r-lg) 0 0; }
.rx-play { min-width: 82px; }
.rx-time { font-size: 20px; font-weight: 650; letter-spacing: -0.02em; min-width: 62px; }
#rxScrub { flex: 1; min-width: 120px; accent-color: var(--accent); height: 22px; }
.rx-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack > .rx-kpis { margin-top: calc(var(--gap) * -1); }
.rx-main { overflow: hidden; }
.rx-chart { position: relative; height: 210px; margin: 30px var(--pad) 26px; cursor: ew-resize; touch-action: none; user-select: none; }
.rx-chart svg { width: 100%; height: 100%; overflow: visible; }
.rx-chart path, .rx-chart line { vector-effect: non-scaling-stroke; }
.rx-chart .hr { stroke: var(--border); stroke-width: 1; }
.rx-chart .mk { stroke: var(--border-2); stroke-width: 1; stroke-dasharray: 3 3; }
.rx-chart .zero { stroke: var(--faint); stroke-width: 1; }
.rx-chart .band { fill: color-mix(in srgb, var(--accent) 16%, transparent); stroke: none; }
.rx-chart .line { fill: none; stroke-width: 2.2; stroke-linejoin: round; }
.rx-chart .line.up { stroke: var(--pos); }
.rx-chart .line.dn { stroke: var(--neg); }
.rx-chart .future { fill: var(--surface); opacity: .72; }
.rx-cursor { position: absolute; top: -4px; bottom: -4px; width: 0; border-left: 1.5px solid var(--accent); pointer-events: none; }
.rx-cursor span {
  position: absolute; top: -18px; left: 0; transform: translateX(-50%); padding: 1px 6px; border-radius: var(--r-xs);
  background: var(--accent); color: var(--on-accent); font-size: 10.5px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.rx-cursor.at-end span { transform: translateX(-100%); }
.rx-cursor.at-start span { transform: none; }
.rx-hours { position: absolute; left: 0; right: 0; bottom: -20px; height: 14px; }
.rx-hours span { position: absolute; transform: translateX(-50%); font-size: 10.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.rx-legend { position: absolute; top: 0; left: 0; display: flex; gap: 12px; font-size: 10.5px; color: var(--muted); pointer-events: none; }
.rx-legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.rx-legend i.l { background: var(--pos); }
.rx-legend i.b { height: 8px; background: color-mix(in srgb, var(--accent) 30%, transparent); }
.rx-cols { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); border-top: 1px solid var(--border); }
.rx-cols > div { min-width: 0; }
.rx-cols > div:first-child { border-right: 1px solid var(--border); }
.rx-h { display: flex; align-items: baseline; gap: 8px; padding: 10px var(--pad) 8px; font-size: 12px; font-weight: 600; }
.rx-lanes { max-height: 420px; overflow-y: auto; padding: 0 0 8px; }
.rx-lane {
  display: grid; grid-template-columns: 96px minmax(0, 1fr) 80px; align-items: center; gap: 10px; height: 24px; padding: 0 var(--pad);
  font-size: 11.5px; cursor: pointer; transition: opacity var(--dur), background var(--dur);
}
.rx-lane:hover { background: var(--surface-hover); }
.rx-lane .sym { font-weight: 600; }
.rx-lane .v { text-align: right; font-size: 11.5px; }
.rx-lane .track { position: relative; height: 10px; }
.rx-lane .track::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--border); }
.rx-lane .track i { position: absolute; top: 1px; bottom: 1px; min-width: 3px; border-radius: 3px; background: var(--faint); }
.rx-lane .track i.up { background: var(--pos); }
.rx-lane .track i.dn { background: var(--neg); }
.rx-lane .track i.open { background: repeating-linear-gradient(90deg, var(--accent) 0 5px, color-mix(in srgb, var(--accent) 40%, transparent) 5px 8px); }
.rx-lane.future { opacity: .28; }
.rx-lane.live { background: var(--accent-bg); }
.rx-lane.live .sym { color: var(--accent-d); }
.rx-log { max-height: 420px; overflow-y: auto; padding: 0 0 8px; }
.rx-ev { display: grid; grid-template-columns: 42px 38px auto minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 4px var(--pad); font-size: 12px; }
.rx-ev .t { color: var(--muted); font-size: 11.5px; }
.rx-ev .k { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); }
.rx-ev.in .k { color: var(--accent-d); }
.rx-ev .hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rx-ev.latest { background: var(--accent-bg); animation: rise .2s var(--ease); }
.rx-none { padding: 12px var(--pad); font-size: 12px; color: var(--muted); }

/* ── Retire TradingView ───────────────────────────────────────────── */
.tvr-alert {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px; padding: 12px 14px;
  background: var(--pos-bg); border: 1px solid var(--pos-bd); border-radius: var(--r-lg);
}
.tvr-alert > div { flex: 1; min-width: 0; }
.tvr-alert b { font-weight: 650; }
.tvr-alert .hint { margin-top: 2px; }
.tvr-alert-i {
  flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--pos); color: var(--ink-text); font-weight: 700; font-size: 13px;
}
.tvr-board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
.tvr-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.tvr-col-h { padding: 2px 2px 6px; border-bottom: 2px solid var(--border-2); }
.tvr-col.ok .tvr-col-h { border-bottom-color: var(--pos); }
.tvr-col.warn .tvr-col-h { border-bottom-color: var(--warn); }
.tvr-col-h h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; font-weight: 650; }
.tvr-col-h .sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.tvr-n { font-size: 11px; font-weight: 600; color: var(--text-2); background: var(--surface-3); border-radius: 999px; padding: 1px 7px; font-variant-numeric: tabular-nums; }
.tvr-empty { font-size: 12px; color: var(--faint); padding: 10px 2px; }
.tvr-card {
  display: flex; flex-direction: column; gap: 8px; padding: 12px; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: inset 0 1px 0 var(--hi);
}
.tvr-card.ready { border-color: var(--pos-bd); }
.tvr-card.retired { opacity: .85; }
.tvr-id { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.tvr-id .strat { font-weight: 650; font-size: 14px; }
.tvr-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.tvr-head { margin: 0; font-size: 12.5px; font-weight: 550; line-height: 1.4; }
.tvr-act { margin: 0; font-size: 11.5px; color: var(--text-2); line-height: 1.45; }
.tvr-prog { height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.tvr-prog i { display: block; height: 100%; background: var(--pos); border-radius: 2px; transition: width .5s var(--ease); }
.tvr-card.testing .tvr-prog i { background: var(--warn); }
.tvr-checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.tvr-checks li { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 6px; align-items: baseline; font-size: 11.5px; }
.tvr-checks .m { font-weight: 700; text-align: center; }
.tvr-checks li.ok .m { color: var(--pos); }
.tvr-checks li.bad .m { color: var(--neg); }
.tvr-checks li.warn .m { color: var(--warn); }
.tvr-checks .l { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tvr-checks .v { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; color: var(--text); }
.tvr-checks li.bad .v { color: var(--neg); }
.tvr-checks li.warn .v { color: var(--warn); }
.tvr-checks .n { color: var(--faint); font-weight: 400; }
.tvr-foot { display: flex; gap: 6px; justify-content: flex-end; }
.tvr-crit { margin-top: 14px; }

/* ── Strategy Journey ─────────────────────────────────────────────── */
/* The stage strip: the four-step path, Parked off to the side. Each step
   is a filter button; the check lists reuse the Retire board's. */
.jr-runner { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.jr-runner b { font-weight: 600; color: var(--text); }
.jr-live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.jr-strip { display: flex; align-items: stretch; gap: var(--gap); }
.jr-path { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; }
.jr-side { flex: none; display: flex; padding-left: var(--gap); border-left: 1px dashed var(--border-2); }
.jr-arrow { flex: none; color: var(--faint); font-size: 14px; }
.jr-step {
  flex: 1; min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 10px; align-items: center;
  padding: 10px 12px; text-align: left; cursor: pointer; font: inherit; color: inherit;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: inset 0 1px 0 var(--hi);
  transition: border-color var(--dur), background var(--dur);
}
.jr-side .jr-step { width: 210px; }
.jr-step:hover { border-color: var(--border-2); background: var(--surface-2); }
.jr-step.active { border-color: var(--accent-bd); background: var(--accent-bg); }
.jr-step-n { grid-row: 1 / 3; font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1; min-width: 1.2em; }
.jr-step-l { font-size: 12.5px; font-weight: 600; }
.jr-step-s { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jr-step.live .jr-step-n { color: var(--pos); }
.jr-step.parked .jr-step-n { color: var(--warn); }
.jr-filter { margin-top: -4px; }
.jr-list { display: flex; flex-direction: column; gap: var(--gap); }
.jr-card {
  display: flex; flex-direction: column; gap: 10px; padding: 12px var(--pad); min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: inset 0 1px 0 var(--hi);
}
.jr-card.live { border-color: var(--pos-bd); }
.jr-card.parked { opacity: .9; }
.jr-card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.jr-id { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; min-width: 0; }
.jr-id .strat { font-weight: 650; font-size: 14px; }
.jr-stage { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.jr-reason { margin: 0; font-size: 12.5px; color: var(--text-2); line-height: 1.45; }
.jr-scores { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; align-items: start; }
.jr-score {
  display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 10px 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r);
}
.jr-score.muted { opacity: .85; }
.jr-score > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.jr-score h4 { margin: 0; font-size: 13px; font-weight: 650; }
.jr-pills { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }

/* ── The three books (pages/scorecards.js, Edge) ──────────────────────
   One accent per book from the --bk-* tokens: a 2px rule along the top
   of a card, a dot and an eyebrow label. Verdicts stay in the pills. */
.bk-bt { --bk: var(--bk-bt); }
.bk-fw { --bk: var(--bk-fw); }
.bk-live { --bk: var(--bk-live); }
.bk-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--bk, var(--faint)); flex: none; }
.bk-eyebrow { display: flex; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: color-mix(in srgb, var(--bk, var(--muted)) 80%, var(--text)); margin-bottom: 2px; }
.jr-score[class*="bk-"], .bk-card { border-top: 2px solid var(--bk); }
.jr-score[class*="bk-"] { background: linear-gradient(180deg, color-mix(in srgb, var(--bk) 7%, var(--surface-2)), var(--surface-2) 64px); }
.bk-card .card-head h3 { font-size: 13px; }
.jr-ms.bk-wide { grid-template-columns: repeat(6, minmax(0, 1fr)); margin-bottom: 12px; }
.bk-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-bottom: 8px; }
.bk-sub-h { border-top: 1px solid var(--border); }
.bk-sub-h + .tbl-scroll { border-top: 1px solid var(--border); }
/* A book switch (.seg of .bk-* buttons): the active one carries its accent. */
.seg > button[class*="bk-"] .bk-dot { width: 6px; height: 6px; opacity: .55; transition: opacity var(--dur); }
.seg > button[class*="bk-"].active .bk-dot { opacity: 1; box-shadow: 0 0 0 3px color-mix(in srgb, var(--bk) 22%, transparent); }
/* Strategy settings → Go-live scorecard: the three cards, then the switch. */
#scThree .jr-scores { margin-bottom: 6px; }
.sc-three-note { margin: 0 0 var(--gap); }
.sc-bookbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 var(--gap); }
.sc-bookbar .hint { flex: 1; min-width: 0; }
.sc-combined { font-size: 11.5px; color: var(--muted); }
.sc-combined.active { color: var(--accent-d); }
.jr-score .hint { margin: 0; }
.jr-ms { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.jr-m { min-width: 0; }
.jr-m .k { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jr-m .v { font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; }
.jr-m .v.pos { color: var(--pos); } .jr-m .v.neg { color: var(--neg); }
.jr-m .s { font-size: 10.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.jr-sub { font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.jr-prog { display: flex; flex-direction: column; gap: 3px; }
.jr-prog-l { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--text-2); }
.jr-prog-l b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.jr-prog .tvr-prog i { background: var(--warn); }
.jr-prog.done .tvr-prog i { background: var(--pos); }
.jr-info li { opacity: .7; }
.jr-info .v { font-weight: 500; color: var(--text-2); }
.jr-split { width: 100%; border-collapse: collapse; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.jr-split th { font-size: 10.5px; font-weight: 600; color: var(--muted); text-align: left; padding: 0 0 3px; }
.jr-split td { padding: 3px 0; border-top: 1px solid var(--border); color: var(--text-2); }
.jr-split .num { text-align: right; font-weight: 600; color: var(--text); }
.jr-split td.pos { color: var(--pos); } .jr-split td.neg { color: var(--neg); }
.jr-more summary { font-size: 11.5px; }
.jr-more .tbl-scroll { margin-top: 6px; border: 1px solid var(--border); border-radius: var(--r-sm); }
.jr-more td.pos { color: var(--pos); } .jr-more td.neg { color: var(--neg); }
.jr-card-f { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding-top: 8px; border-top: 1px solid var(--border); }
.jr-acc { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.jr-dot { color: var(--faint); }
.jr-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.jr-rules > summary { list-style: none; cursor: pointer; }
.jr-rules > summary::-webkit-details-marker { display: none; }
.jr-rules .jr-close, .jr-rules[open] .jr-open { display: none; }
.jr-rules[open] .jr-close { display: inline; }
.jr-rules[open] > summary { border-bottom: 1px solid var(--border); }
.jr-form { display: flex; flex-direction: column; gap: 12px; padding-top: 12px; }
.jr-group .hint { margin: -6px 0 0; }
.jr-wide { flex-basis: 100%; }
.jr-wide input[type="text"] { max-width: 360px; }
.sp-plan .jr-check { align-self: flex-end; height: var(--ctl-h); }
.jr-form-f { display: flex; justify-content: flex-end; gap: 8px; }
.banner.ok { border-color: var(--pos-bd); background: var(--pos-bg); } .banner.ok::before { background: var(--pos); }

/* ── Responsive ───────────────────────────────────────────────────── */
/* The Windows button took ~36px from the right cluster; the Zerodha pill
   gives it back so the session state never clips. */
@media (max-width: 1640px) { .tb-kite .lbl { max-width: 104px; } .tb-state { white-space: nowrap; } .tb-session { flex-shrink: 0; } }
@media (max-width: 1320px) {
  .tvr-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mon-hero { grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); }
  .mon-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "path path" "lims sbs" "open open" "tape tape"; }
  .gl-top { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1000px) {
  .tn-win { display: none; }
  .ws-grid, .ws-grid.cols2, .ws-grid.rows2, .ws-grid.cols3, .ws-grid.main3, .ws-grid.grid4 {
    height: auto; grid-template-columns: minmax(0, 1fr) !important; grid-template-rows: none !important; grid-template-areas: none;
  }
  .ws-pane { grid-area: auto !important; height: 78vh; }
  .ws-split { display: none; }
  .mon-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mon-cell:nth-child(2) { border-right: none; }
  .mon-cell:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .gl-month { grid-template-columns: minmax(0, 1fr); }
  .gl-disc { grid-template-columns: minmax(0, 1fr); }
  .gl-disc > div { border-right: none; border-bottom: 1px solid var(--border); }
  .rx-cols { grid-template-columns: minmax(0, 1fr); }
  .rx-cols > div:first-child { border-right: none; border-bottom: 1px solid var(--border); }
  .rx-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .jr-scores { grid-template-columns: minmax(0, 1fr); }
  .jr-ms.bk-wide { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bk-cols { grid-template-columns: minmax(0, 1fr); }
  .jr-strip { flex-direction: column; }
  .jr-side { padding-left: 0; border-left: none; }
  .jr-side .jr-step { width: auto; flex: 1; }
}
@media (max-width: 640px) {
  .jr-path { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .jr-arrow, .jr-step-s { display: none; }
  .jr-step { padding: 8px 10px; }
  .jr-ms { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .jr-card-f { flex-direction: column; align-items: stretch; }
  .jr-actions { justify-content: flex-start; }
  .tvr-board { grid-template-columns: minmax(0, 1fr); }
  .tvr-alert { flex-wrap: wrap; }
  .mon-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "path" "lims" "open" "sbs" "tape"; }
  .mon-v { font-size: 28px; }
  .mon-lim { grid-template-columns: 58px minmax(0, 1fr) 92px; }
  .gl-rings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gl-ring:nth-child(2) { border-right: none; }
  .gl-ring:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .gl-form { grid-template-columns: minmax(0, 1fr); }
  .gl-kpis { grid-template-columns: minmax(0, 1fr); }
  .gl-kpis .kpi { border-right: none; border-bottom: 1px solid var(--border); }
  .gl-tag.proj { right: 0; transform: translateY(60%); }
  .rx-transport { flex-wrap: wrap; }
  #rxScrub { flex-basis: 100%; order: 5; }
  .rx-lane { grid-template-columns: 70px minmax(0, 1fr) 64px; }
  .rx-ev { grid-template-columns: 40px 34px auto minmax(0, 1fr); }
  .rx-ev > :last-child { grid-column: 1 / -1; justify-self: end; }
}
.pro-three-note { margin: 0; }

/* Strategy page → Backtest tab (pages/strategyBacktest.js) */
.bt-card .card-head .btn { flex: none; }
.bt-money { margin-top: 12px; }
.bt-money .f input[type="number"] { width: 118px; }
.bt-money .f input[type="time"] { width: 104px; }
.bt-explain { margin: 12px 0; }
.bt-progress { display: flex; flex-direction: column; gap: 8px; }
.bt-bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bt-bar > i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width var(--dur-2) ease; }
.bt-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: var(--gap); }
.bt-cols > .card { min-width: 0; }
.bt-trades { max-height: 520px; overflow: auto; }
.bt-trades thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.kpi-grid.bt-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 720px) { .kpi-grid.bt-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) {
  .bt-money { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bt-money .f input[type="number"], .bt-money .f input[type="time"] { width: 100%; }
}

/* Backtest account (#231): capital switch + a thin balance line. */
.bta { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.bta-full { margin-top: 0; padding-top: 0; border-top: none; }
.bta-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.bta-curve { display: block; width: 100%; height: 44px; margin: 8px 0 2px; }
