/* LevelTrack Command Center: layout + components. Colors only via var() (tokens.css). */
:root { --dash: #2C2F34; --hover: #16181B; --sim-line: #2C3E50; --sim-label: #9DB8D4; --sim-faint: #5F7890; --flat-border: #4A2B28; }
[data-theme="light"] { --dash: #D4D1CA; --hover: #F3F1EC; --sim-line: #B7C8D9; --sim-label: #3E5A77; --sim-faint: #6B8199; --flat-border: #E5B1A9; }

* { box-sizing: border-box; }
html, body { background: var(--bg-page); }
body { min-height: 100vh; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.mono { font-family: var(--font-mono); }
.sans { font-family: var(--font-sans); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.r { text-align: right; }
.c { text-align: center; }
.pos { color: var(--pos); } .neg { color: var(--neg); } .muted { color: var(--muted); } .faint { color: var(--faint); }
.dim { color: var(--dim); } .accent { color: var(--accent); } .t2 { color: var(--text-2); } .tx { color: var(--text); }
.alarm-t { color: var(--alarm-text); }
.nowrap { white-space: nowrap; }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── shell ─────────────────────────────────────────────── */
.app { max-width: 1280px; margin: 0 auto; background: var(--bg); color: var(--text); min-height: 100vh;
  font-variant-numeric: tabular-nums; }
@media (min-width: 1330px) { [data-layout="desktop"] .app { margin: 24px auto; min-height: 0; border: 1px solid var(--line); border-radius: var(--r-5); overflow: hidden; } }
.hdr { display: flex; align-items: center; gap: 32px; padding: 0 24px; height: var(--header-h); border-bottom: 1px solid var(--line); }
.wordmark { font: var(--fw-semi) var(--fs-15) var(--font-sans); white-space: nowrap; }
.tabs { display: flex; gap: 4px; font: var(--fw-medium) var(--fs-13) var(--font-sans); }
.tab { padding: 6px 12px; border-radius: var(--r-3); color: var(--muted); text-decoration: none; }
.tab:hover { color: var(--text); }
.tab.on { background: var(--surface-2); color: var(--text); }
.hdr-r { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.mini { display: flex; gap: 10px; font: var(--fw-regular) var(--fs-12) var(--font-mono); color: var(--muted); white-space: nowrap; }
.asof { font: var(--fw-medium) var(--fs-12) var(--font-mono); color: var(--muted); white-space: nowrap; }
.badge { font: var(--fw-semi) var(--fs-11) var(--font-mono); letter-spacing: var(--tracking-label); color: var(--accent);
  border: 1px solid var(--accent-border); padding: 3px 8px; border-radius: var(--r-2); white-space: nowrap; }
.badge.live { color: var(--alarm-text); background: var(--alarm-bg); border-color: var(--alarm-border); }
.iconbtn { font: var(--fw-medium) var(--fs-13) var(--font-mono); color: var(--muted); border: 1px solid var(--line);
  border-radius: var(--r-3); min-width: 28px; height: 28px; display: grid; place-items: center; background: none; cursor: pointer; padding: 0 6px; }
.iconbtn:hover { color: var(--text); border-color: var(--line-strong); }

/* ── alarm banner / notices ────────────────────────────── */
.alarm { display: flex; gap: 10px; padding: 10px 24px; background: var(--alarm-bg); border-bottom: 1px solid var(--alarm-border);
  font: var(--fw-medium) var(--fs-13)/1.4 var(--font-sans); color: var(--alarm-text); }
.alarm .ic { font-family: var(--font-mono); }
.alarm.notice { background: var(--bg); border-bottom-color: var(--accent-border); color: var(--accent); }
.pendbox { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-radius: var(--r-4);
  border: 1px solid var(--accent-border); color: var(--accent); }
.pendbox .l { font: var(--fw-medium) var(--fs-13) var(--font-sans); }
.pendbox .v { font: var(--fw-medium) 18px var(--font-mono); }
.ilock { display: flex; gap: 10px; align-items: center; padding: 10px 20px; border-bottom: 1px solid var(--line);
  font: var(--fw-medium) var(--fs-13) var(--font-sans); color: var(--accent); }
.ilock .ic { font-family: var(--font-mono); }
.ilock .by { margin-left: auto; font: var(--fw-regular) var(--fs-11) var(--font-mono); color: var(--muted); }

/* ── health strip ──────────────────────────────────────── */
.health { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.hcell { padding: 14px 20px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.hcell:last-child { border-right: 0; }
.hlabel { display: flex; align-items: center; gap: 6px; font: var(--fw-medium) var(--fs-11) var(--font-mono); letter-spacing: var(--tracking-label); color: var(--muted); }
.hval { font: var(--fw-medium) var(--fs-15) var(--font-sans); white-space: nowrap; }
.hsub { font: var(--fw-regular) var(--fs-12) var(--font-mono); color: var(--faint); white-space: nowrap; }
.hcell.bad .hlabel, .hcell.bad .hval { color: var(--neg); }

/* ── KPI cells ─────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.kpis.k6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.kpis.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* exposure & risk */
.g-exp { grid-template-columns: 110px minmax(120px,1fr) 104px 76px 76px 84px; }
.g-clu { grid-template-columns: minmax(0,1fr) 28px 84px 64px; }
.tr.g-exp, .tr.g-clu { padding: 8px 20px; }
.hbar { position: relative; flex: 1; height: 6px; border-radius: 3px; min-width: 60px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--neg) 55%, transparent), var(--surface-2) 50%, color-mix(in srgb, var(--pos) 55%, transparent)); }
.hbar > b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); border-radius: 1px; }
.kpi { background: var(--bg); padding: 16px 20px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.klabel { font: var(--fw-regular) var(--fs-12) var(--font-sans); color: var(--muted); }
.kval { font: var(--fw-medium) var(--fs-22) var(--font-mono); letter-spacing: -.02em; white-space: nowrap; }
.ksub { font: var(--fw-regular) var(--fs-11) var(--font-mono); color: var(--faint); white-space: nowrap; }
.kval.lk { color: var(--muted); }

/* ── panels, tables ────────────────────────────────────── */
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; }
.cols > .main { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.cols.w380 { grid-template-columns: minmax(0, 1fr) 380px; }
.cols.w420 { grid-template-columns: minmax(0, 1fr) 420px; }
.cols.w440 { grid-template-columns: minmax(0, 1fr) 440px; }
.bb { border-bottom: 1px solid var(--line); }
.bt { border-top: 1px solid var(--line); }
.ph { display: flex; align-items: baseline; gap: 12px; padding: 16px 20px 10px; min-width: 0; }
.ph.big { padding: 18px 20px 12px; }
.pt { font: var(--fw-semi) var(--fs-13) var(--font-sans); white-space: nowrap; }
.ph.big .pt { font-size: var(--fs-16); }
.pm { font: var(--fw-regular) var(--fs-12) var(--font-mono); color: var(--muted); }
.stamp { margin-left: auto; font: var(--fw-regular) var(--fs-11) var(--font-mono); color: var(--faint); white-space: nowrap; }
.stamp.stale { color: var(--accent); font-weight: var(--fw-medium); }
.th, .tr { display: grid; gap: 0 12px; padding: 6px 20px; align-items: center; }
.th { font: var(--fw-medium) var(--fs-10) var(--font-mono); letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--faint);
  border-top: 1px solid var(--surface-2); border-bottom: 1px solid var(--surface-2); }
.tr { padding: 9px 20px; border-bottom: 1px solid var(--line-soft); font: var(--fw-regular) var(--fs-13) var(--font-mono); }
.tr.click { cursor: pointer; } .tr.click:hover { background: var(--hover); }
.tr.sel { background: var(--surface-sel); }
.tr.alarmrow { outline: 1px solid var(--alarm-border); outline-offset: -1px; }
.sym { font: var(--fw-medium) var(--fs-13) var(--font-sans); white-space: nowrap; }
.dir { font: var(--fw-medium) var(--fs-10) var(--font-mono); }
.symc { display: flex; align-items: center; gap: 8px; min-width: 0; }
.foot { padding: 14px 20px 20px; font: var(--fw-regular) var(--fs-12) var(--font-mono); color: var(--faint); }
.note11 { font: var(--fw-regular) var(--fs-11)/1.5 var(--font-mono); color: var(--faint); }
.sect { font: var(--fw-medium) var(--fs-10) var(--font-mono); letter-spacing: .1em; color: var(--faint); text-transform: uppercase; }
.box { border: 1px solid var(--line); border-radius: var(--r-4); }

/* grids per table */
.g-pos { grid-template-columns: 96px 36px minmax(0,1.1fr) minmax(0,1.1fr) 72px 58px 76px 118px; }
.g-pend { grid-template-columns: 130px 56px minmax(0,1fr) 72px 240px; padding-top: 8px; padding-bottom: 8px; }
.th.g-pend { padding-top: 6px; padding-bottom: 6px; }
.g-trd { grid-template-columns: 92px 132px 40px minmax(0,1fr) 104px 52px 64px 76px; }
.g-bd { grid-template-columns: minmax(0,1fr) 44px 60px 70px 76px minmax(0,1.2fr) 110px; padding-left: 0; padding-right: 0; }
.g-lvl { grid-template-columns: 120px 50px repeat(3,minmax(0,1fr)) 40px 50px 56px 110px; gap: 0 10px; font-size: var(--fs-12); }
.tr.g-lvl { padding: 7px 20px; color: var(--text-2); }
.g-hist { grid-template-columns: 160px repeat(5,90px) minmax(0,1fr); font-size: var(--fs-12); }
.tr.g-hist { padding: 8px 20px; color: var(--text-2); }
.g-proc { grid-template-columns: minmax(0,1fr) 100px 100px 80px 80px; }
.g-cron { grid-template-columns: 130px repeat(5,minmax(0,1fr)) 70px; gap: 0 8px; font-size: var(--fs-12); }
.tr.g-cron { padding: 8px 20px; }
.g-alert { grid-template-columns: 120px 80px minmax(0,1fr) 140px; font-size: var(--fs-12); }
.tr.g-alert { border-bottom: 0; border-top: 1px solid var(--line-soft); }
.g-tl { display: grid; grid-template-columns: 44px 18px minmax(0,1fr); gap: 8px; padding: 9px 20px; border-top: 1px solid var(--line-soft); }

/* bars */
.bar4 { flex: 1; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.bar4 > i { display: block; height: 100%; }
.trig { position: relative; height: 6px; background: var(--surface-2); border-radius: 3px; }
.trig > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; }
.trig > b { position: absolute; right: 0; top: -3px; bottom: -3px; width: 2px; background: var(--text); }
.state { display: flex; gap: 6px; align-items: baseline; font-size: var(--fs-12); white-space: nowrap; overflow: hidden; }
.state .why { color: var(--faint); font-size: var(--fs-11); overflow: hidden; text-overflow: ellipsis; }

/* stale / loading / empty / error */
.stalebox { opacity: .5; background: repeating-linear-gradient(135deg, transparent 0 6px, var(--surface) 6px 12px); }
.skel { display: block; background: var(--surface-2); border-radius: 2px; }
.skel.soft { background: var(--hover); }
.empty { margin: 4px 20px 16px; padding: 14px; border: 1px dashed var(--dash); border-radius: var(--r-4);
  font: var(--fw-regular) var(--fs-13)/1.5 var(--font-sans); color: var(--muted); }
.errbox { margin: 14px 20px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-4); display: flex; flex-direction: column; gap: 6px; }
.errbox .t { font: var(--fw-medium) var(--fs-13) var(--font-sans); }
.errbox .d { font: var(--fw-regular) var(--fs-12) var(--font-mono); color: var(--muted); }
.btn { padding: 7px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-3); font: var(--fw-medium) var(--fs-12) var(--font-sans);
  background: none; cursor: pointer; color: var(--text); white-space: nowrap; }
.btn:hover:not(:disabled) { background: var(--surface); }
.btn.sm { padding: 5px 10px; }
.btn.alarm-b { border-color: var(--alarm-border); color: var(--alarm-text); padding: 4px 8px; font-family: var(--font-mono); font-weight: 400; }
.btn.danger { background: var(--neg); color: var(--bg); border-color: var(--neg); font-weight: var(--fw-semi); }
.btn:disabled { background: var(--surface-2); color: var(--dim); border-color: var(--surface-2); cursor: not-allowed; }
.okbox, .badbox { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-radius: var(--r-4); }
.okbox { border: 1px solid var(--ok-border); background: var(--ok-bg); color: var(--pos); }
.badbox { border: 1px solid var(--alarm-border); background: var(--alarm-bg); color: var(--alarm-text); }
.okbox .l, .badbox .l { font: var(--fw-medium) var(--fs-13) var(--font-sans); }
.okbox .v, .badbox .v { font: var(--fw-medium) 18px var(--font-mono); }

/* chips, segmented, selects */
.chip { padding: 5px 10px; border-radius: var(--r-3); font: var(--fw-medium) var(--fs-12) var(--font-sans); color: var(--muted);
  border: 1px solid var(--line); background: none; cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--surface-2); color: var(--text); }
.chip.mono { font: var(--fw-regular) var(--fs-12) var(--font-mono); }
.seg { display: flex; border: 1px solid var(--line); border-radius: var(--r-3); overflow: hidden; font: var(--fw-medium) var(--fs-12) var(--font-sans); }
.seg button { padding: 6px 12px; color: var(--muted); background: none; border: 0; border-left: 1px solid var(--line); cursor: pointer; }
.seg button:first-child { border-left: 0; }
.seg button.on { background: var(--surface-2); color: var(--text); }
.dd { position: relative; display: inline-flex; }
.dd select { appearance: none; -webkit-appearance: none; padding: 6px 24px 6px 10px; border: 1px solid var(--line); border-radius: var(--r-3);
  background: none; font: var(--fw-regular) var(--fs-12) var(--font-sans); color: var(--text); cursor: pointer; }
.dd::after { content: "▾"; position: absolute; right: 9px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 11px; pointer-events: none; }
.dd .k { position: absolute; left: -9999px; }
.dd select option { background: var(--bg); }
.srcchip { font: var(--fw-regular) var(--fs-11) var(--font-mono); padding: 3px 7px; border-radius: var(--r-2); border: 1px solid var(--line-strong); color: var(--text); }
.srcchip.off { color: var(--dim); border-color: var(--line); text-decoration: line-through; }
.tag { font: var(--fw-medium) var(--fs-10) var(--font-mono); letter-spacing: .06em; border: 1px solid var(--dash); padding: 1px 5px; border-radius: var(--r-2); }
.live-tag { font: var(--fw-semi) var(--fs-11) var(--font-mono); letter-spacing: .1em; color: var(--bg); background: var(--text); padding: 3px 8px; border-radius: var(--r-2); }
.info { margin: 8px 20px 20px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-4);
  font: var(--fw-regular) var(--fs-12)/1.5 var(--font-sans); color: var(--muted); display: flex; gap: 10px; }
.info a { color: var(--accent); }

/* drawer (Trades) */
.drawer { background: var(--drawer); display: flex; flex-direction: column; min-width: 0; }
.dr-h { padding: 18px 22px 14px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.dr-s { padding: 14px 22px; border-bottom: 1px solid var(--surface-2); display: flex; flex-direction: column; gap: 6px; }
.kv { display: flex; justify-content: space-between; gap: 12px; font: var(--fw-regular) var(--fs-13) var(--font-mono); }
.kv > span:first-child { font-family: var(--font-sans); color: var(--muted); }
.kv > span:last-child { text-align: right; }
.x { background: none; border: 0; color: var(--faint); cursor: pointer; font: var(--fw-regular) var(--fs-12) var(--font-mono); padding: 0; }

/* Performance / sim */
.sim { margin: 20px; border: 1px dashed var(--sim-border); border-radius: 8px;
  background: repeating-linear-gradient(135deg, var(--sim-bg-a) 0 10px, var(--sim-bg-b) 10px 20px); }
.sim .h { padding: 14px 18px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.sim .lbl { font: var(--fw-semi) var(--fs-11) var(--font-mono); letter-spacing: .1em; color: var(--sim-label); border: 1px solid var(--sim-border); padding: 3px 8px; border-radius: var(--r-2); }
.sim .t { font: var(--fw-semi) 14px var(--font-sans); color: var(--sim-text); }
.sim .m { font: var(--fw-regular) var(--fs-12) var(--font-mono); color: var(--sim-muted); }
svg text { font-family: var(--font-mono); }
.hist { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; align-items: end; height: 150px; }
.hist > div { display: flex; flex-direction: column; align-items: center; gap: 4px; justify-content: flex-end; height: 100%; }
.hist .n { font: var(--fw-medium) var(--fs-12) var(--font-mono); color: var(--text-2); }
.hist .b { width: 100%; border-radius: 2px 2px 0 0; min-height: 1px; }
.histx { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; font: var(--fw-regular) var(--fs-10) var(--font-mono); color: var(--faint); text-align: center; border-top: 1px solid var(--line-strong); padding-top: 6px; }
.dbar { position: relative; height: 8px; }
.dbar > b { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--line-strong); }
.dbar > i { position: absolute; top: 0; bottom: 0; background: var(--dim); border-radius: 1px; }

/* funnel */
.fun { display: grid; grid-template-columns: 260px 70px minmax(0,1fr) 90px; gap: 14px; align-items: center; height: 26px; }
.fun .l { font: var(--fw-regular) var(--fs-13) var(--font-sans); color: var(--text-2); }
.fun .n { font: var(--fw-medium) 14px var(--font-mono); text-align: right; }
.fun .t { height: 12px; background: var(--surface); border-radius: 2px; }
.fun .t > i { display: block; height: 100%; border-radius: 2px; }
.fun .d { font: var(--fw-regular) var(--fs-11) var(--font-mono); color: var(--faint); }

/* controls */
.ctl { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-4); }
.ctl.danger { border-color: var(--flat-border); }
.switch { margin-left: auto; cursor: pointer; width: 40px; height: 22px; border-radius: 11px; position: relative; background: var(--surface-2);
  border: 1px solid var(--line-strong); padding: 0; flex-shrink: 0; }
.switch.on { background: var(--accent); }
.switch > i { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text); transition: left .15s; }
.switch.on > i { left: 20px; }
.inp { flex: 1; min-width: 0; padding: 7px 10px; background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--r-3);
  font: var(--fw-regular) var(--fs-13) var(--font-mono); color: var(--text); outline: none; }
.inp.sel { font-size: var(--fs-12); color: var(--text-2); appearance: none; }
.err-inline { font: var(--fw-regular) var(--fs-12) var(--font-sans); color: var(--alarm-text); }
.logchip { font: var(--fw-regular) var(--fs-12) var(--font-mono); color: var(--text-2); border: 1px solid var(--line); border-radius: var(--r-3); padding: 4px 8px; white-space: nowrap; }

/* modal + toast */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { width: min(440px, 100%); background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--r-4); padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.modal h3 { margin: 0; font: var(--fw-semi) 15px var(--font-sans); }
.modal p { margin: 0; font: var(--fw-regular) var(--fs-13)/1.5 var(--font-sans); color: var(--text-2); }
.modal .row { display: flex; gap: 8px; justify-content: flex-end; }
#toast-root { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: calc(100vw - 32px); }
.toast { background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-4); padding: 10px 14px; font: var(--fw-regular) var(--fs-12) var(--font-mono); max-width: 420px; }
.toast.bad { border-color: var(--alarm-border); color: var(--alarm-text); background: var(--alarm-bg); }

.tabbar { display: none; }

/* tablet widths on the desktop layout: timeline drops below; SL/TP + TIME EXIT move into tap-to-expand */
@media (max-width: 1023px) {
  [data-layout="desktop"] .cols, [data-layout="desktop"] .cols.w380, [data-layout="desktop"] .cols.w420, [data-layout="desktop"] .cols.w440 { grid-template-columns: minmax(0, 1fr); }
  [data-layout="desktop"] .cols > .main { border-right: 0; border-bottom: 1px solid var(--line); }
  [data-layout="desktop"] .g-pos { grid-template-columns: 96px 36px minmax(0,1fr) 72px 58px 118px; }
  [data-layout="desktop"] .g-pos .c-sltp, [data-layout="desktop"] .g-pos .c-tx { display: none; }
  [data-layout="desktop"] .tr.g-pos.open .c-sltp, [data-layout="desktop"] .tr.g-pos.open .c-tx { display: flex; grid-column: 1 / -1; }
  [data-layout="desktop"] .health, [data-layout="desktop"] .kpis { grid-template-columns: repeat(3, minmax(0,1fr)); }
  [data-layout="desktop"] .kpis.k4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  [data-layout="desktop"] .g-exp { grid-template-columns: 96px minmax(80px,1fr) 96px 72px 72px; }
  [data-layout="desktop"] .g-exp > :nth-child(6) { display: none; }
  [data-layout="desktop"] .kpis.k6 { grid-template-columns: repeat(3, minmax(0,1fr)); }
  [data-layout="desktop"] .hdr { gap: 16px; padding: 0 16px; }
  [data-layout="desktop"] .mini { display: none; }
}

/* ══ PHONE LAYOUT ═══════════════════════════════════════ */
[data-layout="phone"] .app { max-width: none; padding-bottom: calc(64px + env(safe-area-inset-bottom)); overflow-x: hidden; }
[data-layout="phone"] .hdr { height: auto; padding: calc(8px + env(safe-area-inset-top)) 14px 8px; gap: 8px; }
[data-layout="phone"] .hdr .wordmark { font-size: 14px; }
[data-layout="phone"] .hdr .tabs, [data-layout="phone"] .hdr .mini { display: none; }
[data-layout="phone"] .hdr-r { gap: 8px; }
[data-layout="phone"] .badge { font-size: 9px; padding: 2px 5px; }
/* LIVE: subtle armed mark in the header (the full ARMED banner + STOP ALL are on System) */
.armed-ind { font: var(--fw-semi) var(--fs-11) var(--font-mono); letter-spacing: var(--tracking-label); color: var(--neg); white-space: nowrap; }
[data-layout="phone"] .armed-ind { font-size: 9px; }
[data-layout="phone"] .asof { font: var(--fw-regular) var(--fs-10) var(--font-mono); }
[data-layout="phone"] .iconbtn { min-width: 24px; height: 24px; font-size: 11px; }
[data-layout="phone"] .alarm { padding: 8px 14px; font-size: var(--fs-12); }
[data-layout="phone"] .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: var(--bg); border-top: 1px solid var(--line); padding: 8px 0 calc(10px + env(safe-area-inset-bottom));
  font: var(--fw-medium) var(--fs-10) var(--font-sans); text-align: center; }
[data-layout="phone"] .tabbar a { color: var(--muted); text-decoration: none; padding: 4px 0; }
[data-layout="phone"] .tabbar a.on { color: var(--accent); }
/* phone command */
.p-health { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.p-health > div { padding: 6px 10px; border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.p-health > div:last-child { border-right: 0; }
.p-health .l { font: var(--fw-medium) 9px var(--font-mono); letter-spacing: .06em; color: var(--muted); }
.p-health .v { font: var(--fw-medium) var(--fs-12) var(--font-mono); white-space: nowrap; overflow: hidden; }
.p-acct { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); padding: 8px 14px; gap: 8px; border-bottom: 1px solid var(--line); }
.p-acct > div { display: flex; flex-direction: column; min-width: 0; }
.p-acct .l { font: var(--fw-regular) var(--fs-10) var(--font-sans); color: var(--muted); }
.p-acct .v { font: var(--fw-medium) 14px var(--font-mono); white-space: nowrap; }
.p-ph { display: flex; align-items: baseline; gap: 8px; padding: 10px 14px 4px; min-width: 0; }
.p-ph .t { font: var(--fw-semi) var(--fs-12) var(--font-sans); white-space: nowrap; }
.p-ph .m { font: var(--fw-regular) var(--fs-10) var(--font-mono); color: var(--muted); white-space: nowrap; }
.p-ph .r { margin-left: auto; font: var(--fw-regular) var(--fs-10) var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-row { display: grid; gap: 8px; align-items: center; padding: 0 14px; border-top: 1px solid var(--line-soft); }
.p-pos { grid-template-columns: minmax(0,1fr) 64px 56px; height: var(--row-h-phone); font: var(--fw-regular) var(--fs-12) var(--font-mono); }
.p-exp { grid-template-columns: repeat(2, minmax(0,1fr)); row-gap: 10px; }
.p-exp .s { font: var(--fw-regular) 9px var(--font-mono); color: var(--faint); white-space: normal; line-height: 1.35; }
.p-head { grid-template-columns: 92px minmax(0,1fr) 92px; height: var(--row-h-phone); font: var(--fw-regular) var(--fs-12) var(--font-mono); }
.p-head .r, .p-clu .r { text-align: right; font-size: 11px; white-space: nowrap; }
.p-clu { grid-template-columns: minmax(0,1fr) 76px 58px; height: 30px; font: var(--fw-regular) var(--fs-12) var(--font-sans); }
.p-tl { grid-template-columns: 38px 12px minmax(0,1fr); min-height: 30px; font: var(--fw-regular) var(--fs-12) var(--font-sans); }
.p-note { padding: 6px 14px 10px; font: var(--fw-regular) 10px var(--font-mono); color: var(--faint); border-top: 1px solid var(--line-soft); }
.p-pend { grid-template-columns: 104px minmax(0,1fr) 40px 64px; height: 28px; }
.p-row .s { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; overflow: hidden; }
.p-row .s .n { font: var(--fw-medium) 13px var(--font-sans); }
.p-pend .s .n { font-size: 12px; }
.p-row .s .d { font-size: 10px; font-family: var(--font-mono); }
.p-pend .s .d { font: var(--fw-medium) 9px var(--font-mono); }
.p-row .trig { height: 4px; border-radius: 2px; }
.p-row .trig > i { border-radius: 2px; }
.p-link { display: block; padding: 7px 14px; font: var(--fw-medium) var(--fs-11) var(--font-sans); color: var(--accent); border-top: 1px solid var(--line-soft); text-decoration: none; }
/* phone: other views go single column */
[data-layout="phone"] .cols, [data-layout="phone"] .cols.w380, [data-layout="phone"] .cols.w420, [data-layout="phone"] .cols.w440 { grid-template-columns: minmax(0, 1fr); }
[data-layout="phone"] .cols > .main { border-right: 0; border-bottom: 1px solid var(--line); }
[data-layout="phone"] .kpis, [data-layout="phone"] .kpis.k6 { grid-template-columns: repeat(2, minmax(0,1fr)); }
[data-layout="phone"] .kpi { padding: 10px 14px; }
[data-layout="phone"] .kval { font-size: 17px; }
[data-layout="phone"] .ph { padding: 12px 14px 8px; flex-wrap: wrap; row-gap: 4px; }
[data-layout="phone"] .ph.big .pt { font-size: 14px; }
[data-layout="phone"] .th, [data-layout="phone"] .tr { padding-left: 14px; padding-right: 14px; }
[data-layout="phone"] .foot, [data-layout="phone"] .empty, [data-layout="phone"] .info, [data-layout="phone"] .errbox { margin-left: 14px; margin-right: 14px; }
[data-layout="phone"] .foot { padding-left: 0; padding-right: 0; }
[data-layout="phone"] .fun { grid-template-columns: minmax(0,1fr) 44px 70px; gap: 8px; height: auto; min-height: 26px; }
[data-layout="phone"] .fun .d { display: none; }
[data-layout="phone"] .fun .l { font-size: 12px; }
[data-layout="phone"] .sim { margin: 14px; }
[data-layout="phone"] #toast-root { bottom: calc(76px + env(safe-area-inset-bottom)); }
/* phone lists (trades / levels / processes / cron / alerts) */
.pl { padding: 8px 14px; border-top: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 3px; font: var(--fw-regular) var(--fs-12) var(--font-mono); }
.pl.click { cursor: pointer; }
.pl .a { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.pl .a .rt { margin-left: auto; white-space: nowrap; }
.pl .b { display: flex; gap: 8px; color: var(--muted); font-size: 11px; flex-wrap: wrap; }
.sheet { position: fixed; inset: 0; z-index: 45; background: var(--drawer); overflow-y: auto; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.sheet .dr-h, .sheet .dr-s { padding-left: 14px; padding-right: 14px; }
.hscroll { overflow-x: auto; }

/* ── Command v2 (2026-10-01) ───────────────────────────── */
.sm { font-size: var(--fs-12); }
.c2-status { display: flex; align-items: center; gap: 22px; padding: 0 24px; min-height: 36px; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 85%, var(--bg-page)); font: var(--fw-regular) var(--fs-12) var(--font-mono); flex-wrap: wrap; }
.c2-status > span { display: flex; gap: 6px; white-space: nowrap; }
.kpis.c2-kpis { grid-template-columns: 1fr 1fr 1fr 1.7fr 1fr; }
.c2-kpis .kpi { padding: 14px 20px; gap: 3px; }
.c2-rng { gap: 6px !important; }
.c2-lr { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.c2-rv { font: var(--fw-medium) 18px var(--font-mono); letter-spacing: -.02em; white-space: nowrap; }
.c2-rv .ksub { letter-spacing: 0; }
.c2-range { position: relative; height: 8px; border-radius: 2px; overflow: hidden; display: flex; }
.c2-range.thin { height: 6px; }
.c2-range .n { background: color-mix(in srgb, var(--neg) 35%, var(--bg)); }
.c2-range .p { flex: 1; background: color-mix(in srgb, var(--pos) 30%, var(--bg)); }
.c2-range.lk .n, .c2-range.lk .p { background: var(--dash); }
.c2-range.lk .p { background: color-mix(in srgb, var(--dash) 70%, var(--muted)); }
.c2-range .z { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--bg); }
.c2-range .m { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--text); }
.c2-cols { display: grid; grid-template-columns: minmax(0, 1fr) 360px; }
.c2-main { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.c2-side { display: flex; flex-direction: column; min-width: 0; }
.c2-gap { padding-top: 18px; }
.c2-sort { margin-left: 4px; background: none; border: 1px solid var(--line); border-radius: var(--r-3); color: var(--muted);
  font: var(--fw-regular) var(--fs-11) var(--font-mono); padding: 1px 4px; cursor: pointer; }
.c2-sort option { background: var(--bg); color: var(--text); }
.g-c2pos { grid-template-columns: 132px minmax(0,1fr) 76px 60px 92px 72px 46px 30px 56px; }
.tr.g-c2pos { padding: 8px 20px; }
.c2-symc { display: flex; align-items: baseline; gap: 7px; white-space: nowrap; min-width: 0; }
.c2-slc { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.c2-lbl { display: flex; justify-content: space-between; font-size: 10px; color: var(--faint); white-space: nowrap; gap: 6px; }
.c2-sl { position: relative; height: 8px; display: block; }
.c2-sl.thin { height: 6px; }
.c2-sl.nc { height: auto; font: var(--fw-regular) 10px var(--font-mono); color: var(--alarm-text); }
.c2-sl i { position: absolute; display: block; }
.c2-sl .trk { left: 0; right: 0; top: 3px; height: 2px; background: var(--dash); }
.c2-sl.thin .trk, .c2-sl.thin .seg { top: 2px; }
.c2-sl .sl { left: 0; top: 0; width: 2px; height: 100%; background: color-mix(in srgb, var(--neg) 55%, var(--bg)); }
.c2-sl .tp { right: 0; top: 0; width: 2px; height: 100%; background: color-mix(in srgb, var(--pos) 50%, var(--bg)); }
.c2-sl .seg { top: 3px; height: 2px; background: currentColor; }
.c2-sl .ent { top: 0; width: 1px; height: 100%; background: var(--muted); }
.c2-sl .now { top: 0; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: currentColor; }
.c2-sl.thin .now { top: -1px; }
.c2-chk { display: flex; gap: 2px; justify-content: center; white-space: nowrap; }
.c2-chk .btn.alarm-b { padding: 0 5px; }
.c2-legend { padding: 8px 20px 4px; font: var(--fw-regular) var(--fs-11) var(--font-mono); color: var(--faint); }
.g-c2pend { grid-template-columns: 132px 40px minmax(0,1fr) 72px 92px; }
.tr.g-c2pend { padding: 7px 20px; border-bottom: 0; border-top: 1px solid var(--line-soft); }
.g-c2grp { grid-template-columns: 132px minmax(0,1fr) auto; align-items: baseline; }
.tr.g-c2grp { padding: 7px 20px; border-bottom: 0; border-top: 1px solid var(--line-soft); font-size: var(--fs-12); }
.c2-gsyms { display: flex; flex-wrap: wrap; gap: 0 18px; }
.c2-glab { font: var(--fw-medium) var(--fs-12) var(--font-sans); color: var(--muted); white-space: nowrap; }
.c2-clu { display: flex; flex-direction: column; gap: 8px; padding: 0 20px 14px; }
.c2-clu > .stalebox { display: flex; flex-direction: column; gap: 8px; }
.c2-cr { display: grid; grid-template-columns: 96px minmax(0,1fr) 72px 54px; gap: 10px; align-items: center; font: var(--fw-regular) var(--fs-12) var(--font-mono); }
.c2-cr.tot { font-weight: var(--fw-medium); border-top: 1px solid var(--surface-2); padding-top: 8px; }
.c2-cb { height: 6px; background: var(--surface-2); border-radius: 2px; }
.c2-cb i { display: block; height: 100%; border-radius: 2px; background: color-mix(in srgb, var(--neg) 45%, var(--bg)); }
.c2-cb i.top { background: color-mix(in srgb, var(--neg) 75%, var(--bg)); }
.c2-chips { display: flex; gap: 6px; padding: 0 20px 10px; flex-wrap: wrap; }
.c2-chip { cursor: pointer; padding: 3px 9px; border-radius: var(--r-3); border: 1px solid var(--line); background: none;
  font: var(--fw-medium) var(--fs-11) var(--font-sans); color: var(--muted); }
.c2-chip.on { background: var(--surface-2); color: var(--text); }
.c2-feed { display: grid; grid-template-columns: 40px 14px minmax(0,1fr); gap: 8px; align-items: baseline; padding: 6px 20px; border-top: 1px solid var(--line-soft); font-size: 11px; }
.c2-feed .ic { font-size: 12px; font-weight: 500; }
.c2-feed.dim { opacity: .6; }
.c2-ft { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.c2-ft .ti { font: var(--fw-medium) var(--fs-12) var(--font-sans); }
.c2-ft .de { font-size: 11px; }
.c2-more { display: flex; gap: 14px; padding: 8px 20px 14px; border-top: 1px solid var(--line-soft); }
.c2-link { background: none; border: 0; padding: 0; cursor: pointer; font: var(--fw-medium) var(--fs-12) var(--font-sans); color: var(--accent); }
.c2-link.muted { color: var(--muted); }
.c2-link:hover { color: var(--text); }
.c2-strat { margin-top: auto; padding: 12px 20px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.c2-sr { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.c2-v1 { padding: 8px 20px 14px; font: var(--fw-regular) var(--fs-11) var(--font-sans); }
.c2-v1 a { color: var(--faint); }
.v1-note { padding: 8px 20px; border-bottom: 1px solid var(--line); font: var(--fw-regular) var(--fs-12) var(--font-sans); color: var(--muted); }
@media (max-width: 1100px) {
  [data-layout="desktop"] .kpis.c2-kpis { grid-template-columns: repeat(3, minmax(0,1fr)); }
  [data-layout="desktop"] .c2-cols { grid-template-columns: minmax(0, 1fr); }
  [data-layout="desktop"] .c2-main { border-right: 0; border-bottom: 1px solid var(--line); }
  [data-layout="desktop"] .g-c2pos { grid-template-columns: 112px minmax(0,1fr) 72px 56px 72px 30px 56px; }
  [data-layout="desktop"] .g-c2pos > :nth-child(5), [data-layout="desktop"] .g-c2pos > :nth-child(7) { display: none; }
}
/* phone */
.c2-pstatus { display: flex; justify-content: space-between; gap: 8px; padding: 7px 14px; border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 85%, var(--bg-page)); font: var(--fw-regular) var(--fs-11) var(--font-mono); }
.c2-pstatus > span { display: flex; gap: 4px; white-space: nowrap; }
.c2-ptop { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--line); }
.c2-pk { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 8px; }
.c2-pk > div { display: flex; flex-direction: column; min-width: 0; }
.c2-pk .l { font: var(--fw-regular) 10px var(--font-sans); color: var(--muted); }
.c2-pk .v { font: var(--fw-medium) 15px var(--font-mono); white-space: nowrap; }
.c2-pk .v.big { font-size: 17px; }
.c2-pk .s { font: var(--fw-regular) 10px var(--font-mono); color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c2-prl { display: flex; justify-content: space-between; font: var(--fw-regular) 10px var(--font-mono); color: var(--muted); margin-bottom: -6px; }
.c2-ph { display: flex; align-items: baseline; gap: 8px; padding: 10px 14px 4px; }
.c2-ph .t { font: var(--fw-semi) var(--fs-13) var(--font-sans); white-space: nowrap; }
.c2-ph .m { font: var(--fw-regular) 10px var(--font-mono); color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c2-ph .m.pos { color: var(--pos); } .c2-ph .m.alarm-t { color: var(--alarm-text); }
.c2-ph .r { margin-left: auto; font: var(--fw-regular) 10px var(--font-mono); white-space: nowrap; }
.c2-ph .c2-link.r { font: var(--fw-medium) 11px var(--font-sans); }
.c2-pp { display: flex; flex-direction: column; gap: 5px; padding: 8px 14px; border-top: 1px solid var(--line-soft); }
.c2-ppt { display: flex; align-items: baseline; gap: 6px; font: var(--fw-regular) var(--fs-12) var(--font-mono); white-space: nowrap; }
.c2-ppt .dir, .c2-ppt .faint, .c2-ppt .accent, .c2-ppt .alarm-t { font-size: 10px; }
.c2-ppt .rr { width: 52px; text-align: right; }
.c2-pclu { padding: 4px 14px 12px; display: flex; flex-direction: column; gap: 8px; }
.c2-pclu .stack { display: flex; height: 8px; border-radius: 2px; overflow: hidden; gap: 1px; }
.c2-pclu .stack i { display: block; }
.c2-pclu.lk .stack i, .c2-pclu.lk .leg i { filter: grayscale(1); }
.c2-pclu .leg { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 12px; }
.c2-pclu .leg > span { display: flex; align-items: center; gap: 6px; font: var(--fw-regular) 11px var(--font-mono); color: var(--text-2); white-space: nowrap; min-width: 0; }
.c2-pclu .leg i { width: 7px; height: 7px; border-radius: 1px; flex: none; }
.c2-pq { display: grid; grid-template-columns: 96px minmax(0,1fr) 40px; gap: 10px; align-items: center; padding: 0 14px; height: 30px; border-top: 1px solid var(--line-soft);
  font: var(--fw-regular) 11px var(--font-mono); }
.c2-pq .sym { font-size: 12px; } .c2-pq .dir { font-size: 9px; }
.c2-pg { padding: 7px 14px; border-top: 1px solid var(--line-soft); font: var(--fw-regular) 10px/1.6 var(--font-mono); color: var(--faint); }
.c2-pf { display: grid; grid-template-columns: 36px 12px minmax(0,1fr) auto; gap: 6px; align-items: center; padding: 0 14px; min-height: 28px; border-top: 1px solid var(--line-soft);
  font: var(--fw-regular) 10px var(--font-mono); }
.c2-pf .ti { font: var(--fw-medium) var(--fs-12) var(--font-sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
[data-layout="phone"] .c2-v1 { padding: 10px 14px; }

/* LIVE / PROD instance banners */
.alarm.notarmed { background: color-mix(in srgb, var(--accent) 14%, var(--bg)); border-bottom-color: var(--accent-border); color: var(--accent); }
.alarm.notarmed .why { display: block; font: var(--fw-regular) var(--fs-12) var(--font-mono); color: var(--muted); margin-top: 2px; }
.alarm.armed { background: var(--alarm-bg); border-bottom-color: var(--alarm-border); color: var(--alarm-text);
  padding-top: 3px; padding-bottom: 3px; font-size: var(--fs-12); }
.alarm.armed .stopbtn { height: 24px; padding: 0 10px; font-size: 11px; }
[data-layout="phone"] .alarm.armed { padding: 3px 14px; }
[data-layout="phone"] .alarm.armed .stopbtn { height: 26px; }
/* Command: interlock toggle + Disarm side by side */
.c2-ctl { display: flex; align-items: center; gap: 10px; padding: 6px 24px; border-bottom: 1px solid var(--line);
  font: var(--fw-regular) var(--fs-12) var(--font-sans); flex-wrap: wrap; }
.c2-ctl .lbl { font-weight: var(--fw-medium); color: var(--text); }
.c2-ctl .switch { margin-left: 0; }
.c2-ctl .sep { width: 1px; height: 18px; background: var(--line); margin: 0 6px; }
.c2-ctl .st { white-space: nowrap; }
.c2-ctl .c2-disarm { position: relative; }
.c2-ctl .c2-disarm::after { content: ""; position: absolute; left: -4px; right: -4px; top: 50%; height: 40px; transform: translateY(-50%); }
.c2-ctl.ph { padding: 6px 14px; gap: 8px; }
.c2-nobroker { padding: 18px 20px; border-bottom: 1px solid var(--line); font: var(--fw-regular) var(--fs-13)/1.5 var(--font-sans); color: var(--muted); }
.c2-nobroker b { color: var(--text); }
.c2-nobroker.ph { padding: 12px 14px; font-size: var(--fs-12); }

/* LIVE kill switch + manual close */
.alarm.notarmed, .alarm.armed, .alarm.killed { align-items: center; }
.alarm.killed { background: var(--alarm-bg); border-bottom-color: var(--alarm-border); color: var(--alarm-text); }
.alarm.killed .why { display: block; font: var(--fw-regular) var(--fs-12) var(--font-mono); color: var(--muted); margin-top: 2px; }
/* Compact but still the loudest control on the page: solid red. The visible box is
   small; an invisible ::after extends the TAP target to >= 44px tall (48px on phone),
   so it stays easy to hit without dominating the banner. */
.stopbtn { position: relative; margin-left: auto; flex: none; height: 30px; padding: 0 12px; border-radius: var(--r-3);
  cursor: pointer; background: var(--neg); color: #fff; border: 1px solid color-mix(in srgb, var(--neg) 60%, #000);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--neg) 30%, transparent);
  font: var(--fw-semi) 12px var(--font-sans); letter-spacing: .08em; white-space: nowrap; }
.stopbtn::after { content: ""; position: absolute; left: -6px; right: -6px; top: 50%; height: 44px; transform: translateY(-50%); }
.stopbtn:hover { filter: brightness(1.1); }
.stopbtn:active { transform: translateY(1px); }
[data-layout="phone"] .stopbtn { height: 32px; padding: 0 11px; }
[data-layout="phone"] .stopbtn::after { height: 48px; left: -8px; right: -8px; }
.c2-close { padding: 3px 8px; font-size: 11px; }
.c2-ppt .c2-close { margin-left: 6px; }
