/* APEX 3.0 - professional light trading UI. Paper = emerald accent, Live = red accent, profit green, loss red. */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --ink: #1f2933;
  --ink-2: #4b5563;
  --muted: #6b7280;
  --paper: #059669;
  --paper-soft: #e7f6f0;
  --live: #dc2626;
  --live-soft: #fdecec;
  --accent: var(--paper);
  --accent-soft: var(--paper-soft);
  --profit: #0b7a40;
  --profit-mark: #12a150;
  --loss: #c62828;
  --loss-mark: #e04444;
  --warn: #b45309;
  --warn-soft: #fff4e5;
  --info: #1d4ed8;
  --s-vwap: #eb6834;
  --s-ema9: #2a78d6;
  --s-ema20: #4a3aa7;
  --grid: #eef0f3;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Roboto Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0f1216; --surface: #171b21; --surface-2: #1c2128; --line: #2a3038; --line-strong: #39414b;
  --ink: #e8ebef; --ink-2: #c3c9d1; --muted: #8f99a6; --paper: #34c38f; --paper-soft: #133528;
  --live: #f05252; --live-soft: #3a1717; --profit: #3ccf7a; --profit-mark: #2fb46a; --loss: #ff6b6b; --loss-mark: #e05555;
  --warn: #f0a33a; --warn-soft: #33260f; --info: #7aa7ff; --s-vwap: #d95926; --s-ema9: #3987e5; --s-ema20: #199e70;
  --grid: #222831; --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0f1216; --surface: #171b21; --surface-2: #1c2128; --line: #2a3038; --line-strong: #39414b;
  --ink: #e8ebef; --ink-2: #c3c9d1; --muted: #8f99a6; --paper: #34c38f; --paper-soft: #133528;
  --live: #f05252; --live-soft: #3a1717; --profit: #3ccf7a; --profit-mark: #2fb46a; --loss: #ff6b6b; --loss-mark: #e05555;
  --warn: #f0a33a; --warn-soft: #33260f; --info: #7aa7ff; --s-vwap: #d95926; --s-ema9: #3987e5; --s-ema20: #199e70;
  --grid: #222831; --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
.env-live { --accent: var(--live); --accent-soft: var(--live-soft); }
.env-paper { --accent: var(--paper); --accent-soft: var(--paper-soft); }
a { color: var(--info); }
h1, h2, h3 { margin: 0; color: var(--ink); text-wrap: balance; }
h1 { font-size: 1.45rem; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.02rem; font-weight: 650; }
h3 { font-size: .8rem; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.pos { color: var(--profit); }
.neg { color: var(--loss); }

/* ---------- app shell ---------- */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 1320px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .02em; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--ink); color: var(--surface); display: grid; place-items: center; font-size: .8rem; }
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: .72rem; letter-spacing: 0; }
.nav { display: flex; gap: 2px; margin-left: 8px; }
.nav a { text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: .92rem; padding: 8px 12px; border-radius: 9px; display: flex; align-items: center; gap: 7px; }
.nav a:hover { background: var(--surface-2); }
.nav a.on { color: var(--ink); background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--ink); }
.nav a .dot { width: 8px; height: 8px; border-radius: 50%; }
.dot.paper { background: var(--paper); } .dot.live { background: var(--live); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: .82rem; color: var(--muted); }
.clock-chip { font-variant-numeric: tabular-nums; }
main { max-width: 1320px; margin: 0 auto; padding: 16px 16px 40px; }
.bottomnav { display: none; }

/* ---------- cards & grids ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 16px; align-items: start; }

/* ---------- dashboard header ---------- */
.dash-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 18px 20px; border-top: 4px solid var(--accent); }
.dash-head .titles { flex: 1; min-width: 220px; }
.dash-head p { margin: 2px 0 0; color: var(--muted); }
.env-badge { display: inline-flex; align-items: center; gap: 6px; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); padding: 3px 9px; border-radius: 99px; margin-bottom: 6px; }
.toggle-wrap { display: flex; align-items: center; gap: 12px; }
.toggle-wrap .lbl { text-align: right; }
.toggle-wrap .lbl b { display: block; font-size: .95rem; }
.switch { position: relative; width: 58px; height: 32px; border-radius: 99px; border: 0; background: var(--line-strong); cursor: pointer; transition: background .2s; flex: none; }
.switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(26px); }
.switch:disabled { opacity: .5; cursor: not-allowed; }
.switch:focus-visible, .btn:focus-visible, .chip-btn:focus-visible, .nav a:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.live-warning { display: flex; gap: 10px; align-items: flex-start; background: var(--live-soft); color: var(--loss); border: 1px solid color-mix(in srgb, var(--live) 35%, transparent); border-radius: 12px; padding: 10px 14px; font-weight: 600; font-size: .9rem; }
.banner { border-radius: 12px; padding: 10px 14px; font-size: .9rem; border: 1px solid var(--line); background: var(--surface); }
.banner.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); color: var(--warn); }
.banner.bad { background: var(--live-soft); border-color: color-mix(in srgb, var(--live) 30%, transparent); color: var(--loss); }
.banner.info { background: var(--surface-2); color: var(--ink-2); }

/* ---------- account summary ---------- */
.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; padding: 0; overflow: hidden; }
.summary .tile { padding: 14px 16px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.summary .tile:nth-child(4n) { border-right: 0; }
.summary .tile:nth-last-child(-n+4) { border-bottom: 0; }
.tile .k { font-size: .75rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.tile .v { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .s { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile.hero .v { font-size: 1.7rem; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 650; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.status-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status-pill.ok { color: var(--profit); background: color-mix(in srgb, var(--profit) 8%, var(--surface)); border-color: color-mix(in srgb, var(--profit) 25%, transparent); }
.status-pill.bad { color: var(--loss); background: color-mix(in srgb, var(--loss) 8%, var(--surface)); border-color: color-mix(in srgb, var(--loss) 25%, transparent); }
.status-pill.warn { color: var(--warn); background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.status-pill.off { color: var(--muted); }

/* ---------- P&L cards ---------- */
.pnl-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.pnl { padding: 14px; }
.pnl .period { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.pnl .period b { font-size: .85rem; }
.pnl .net { font-size: 1.35rem; font-weight: 750; font-variant-numeric: tabular-nums; margin: 6px 0 8px; }
.pnl dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0; font-size: .82rem; }
.pnl dt { color: var(--muted); }
.pnl dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.pnl .since { margin-top: 8px; font-size: .72rem; color: var(--muted); }

/* ---------- segmented controls / chips ---------- */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 2px; gap: 2px; }
.seg button { border: 0; background: none; color: var(--ink-2); font: 600 .82rem var(--font); padding: 5px 11px; border-radius: 8px; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.chip-btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: 600 .8rem var(--font); padding: 5px 11px; border-radius: 99px; cursor: pointer; }
.chip-btn.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }

/* ---------- market monitor ---------- */
.quote-row { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }
.quote-row .px { font-size: 1.6rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: .78rem; color: var(--ink-2); }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }
.chart { position: relative; width: 100%; height: 340px; }
.chart svg { display: block; width: 100%; height: 100%; }
.chart-empty { display: flex; align-items: center; gap: 12px; padding: 18px; border: 1px dashed var(--line-strong); border-radius: 12px; color: var(--muted); font-size: .9rem; background: var(--surface-2); }
.tip { position: absolute; pointer-events: none; z-index: 5; background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); box-shadow: var(--shadow); border-radius: 10px; padding: 7px 10px; font-size: .78rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.trend-chip { font-size: .78rem; font-weight: 650; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); }

/* ---------- AI decision ---------- */
.decision .act { display: inline-flex; align-items: center; gap: 8px; font-size: 1.25rem; font-weight: 800; letter-spacing: .02em; padding: 6px 14px; border-radius: 12px; }
.act.WAIT { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.act.BUY-CALL, .act.BUY { background: color-mix(in srgb, var(--profit) 12%, var(--surface)); color: var(--profit); }
.act.BUY-PUT, .act.SELL-SHORT { background: color-mix(in srgb, var(--loss) 10%, var(--surface)); color: var(--loss); }
.act.HOLD { background: var(--warn-soft); color: var(--warn); }
.act.SELL { background: color-mix(in srgb, var(--info) 12%, var(--surface)); color: var(--info); }
.decision .reason { margin: 10px 0 12px; font-size: .95rem; }
.kv { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr); gap: 6px 14px; font-size: .86rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.sym-switch { margin-bottom: 10px; }

/* ---------- tables ---------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.toolbar input, .toolbar select, .form input, .form select, .modal input { font: 14px var(--font); color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 9px; padding: 7px 10px; min-width: 0; }
.toolbar input[type=search] { flex: 1; min-width: 160px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: .84rem; }
th, td { padding: 9px 11px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-2); position: sticky; top: 0; z-index: 1; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr { cursor: default; }
tbody tr.click { cursor: pointer; }
tbody tr:hover td { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
.side { display: inline-block; min-width: 44px; text-align: center; font-weight: 800; font-size: .74rem; letter-spacing: .05em; padding: 3px 8px; border-radius: 7px; }
.side.BUY { background: color-mix(in srgb, var(--profit) 13%, var(--surface)); color: var(--profit); }
.side.SELL { background: color-mix(in srgb, var(--loss) 11%, var(--surface)); color: var(--loss); }
.tag { display: inline-block; font-size: .7rem; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.tag.zd { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); background: var(--warn-soft); }
.empty { padding: 28px 12px; text-align: center; color: var(--muted); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -4px 0 14px; overflow-x: auto; }
.tabs button { border: 0; background: none; font: 650 .9rem var(--font); color: var(--muted); padding: 10px 12px; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }

/* ---------- buttons ---------- */
.btn { font: 650 .88rem var(--font); border-radius: 10px; padding: 8px 14px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { background: var(--live); border-color: var(--live); color: #fff; }
.btn.ghost-danger { color: var(--loss); border-color: color-mix(in srgb, var(--loss) 40%, transparent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.controls { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- performance ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.stat .k { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.stat .v { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.mini-chart { position: relative; height: 220px; }

/* ---------- home ---------- */
.acct-card { border-top: 4px solid var(--accent); display: flex; flex-direction: column; gap: 12px; }
.acct-card .big { font-size: 1.9rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.row-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.row-stats div { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.row-stats .k { font-size: .7rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.row-stats .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.schedule { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.schedule div { border-left: 3px solid var(--line-strong); padding: 2px 10px; }
.schedule b { display: block; font-size: 1.05rem; font-variant-numeric: tabular-nums; }

/* ---------- forms (More) ---------- */
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px 14px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; color: var(--ink-2); font-weight: 600; }
.form label span { font-weight: 400; color: var(--muted); font-size: .74rem; }
.form .check { flex-direction: row; align-items: center; gap: 8px; }
details.section { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
details.section > summary { cursor: pointer; padding: 14px 16px; font-weight: 650; list-style: none; display: flex; justify-content: space-between; }
details.section > summary::after { content: "+"; color: var(--muted); font-weight: 400; }
details.section[open] > summary::after { content: "−"; }
details.section > .in { padding: 0 16px 16px; }
.checks { list-style: none; padding: 0; margin: 6px 0 0; font-size: .86rem; display: grid; gap: 4px; }
.checks li::before { content: "✕"; color: var(--loss); font-weight: 800; margin-right: 8px; }
.checks li.ok::before { content: "✓"; color: var(--profit); }

/* ---------- modal + toast ---------- */
.modal { position: fixed; inset: 0; background: rgba(15, 18, 22, .55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal[hidden] { display: none; }
.modal-card { background: var(--surface); color: var(--ink); border-radius: 16px; max-width: 560px; width: 100%; max-height: 90vh; overflow: auto; padding: 20px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal-card.danger { border-top: 6px solid var(--live); }
.modal-card h2 { font-size: 1.2rem; margin-bottom: 10px; }
.modal-card .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.warn-text { white-space: pre-line; font-size: .95rem; background: var(--live-soft); color: var(--loss); border-radius: 12px; padding: 12px 14px; font-weight: 600; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px; background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 12px; z-index: 60; font-size: .9rem; max-width: 92vw; box-shadow: var(--shadow); }

/* ---------- login ---------- */
body.login { min-height: 100vh; display: grid; place-items: center; }
body.login form { width: min(360px, 92vw); display: flex; flex-direction: column; gap: 12px; }
body.login input { font: 15px var(--font); padding: 11px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--ink); }
body.login .err { color: var(--loss); min-height: 1.2em; margin: 0; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .pnl-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  body { font-size: 14px; }
  .nav, .top-right .hide-sm { display: none; }
  main { padding: 12px 12px calc(84px + env(safe-area-inset-bottom, 0px)); }
  .bottomnav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); }
  .bottomnav a { text-decoration: none; color: var(--muted); font-size: .68rem; font-weight: 650; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0; }
  .bottomnav a svg { width: 22px; height: 22px; }
  .bottomnav a.on { color: var(--ink); }
  .bottomnav a.on.paper { color: var(--paper); } .bottomnav a.on.live { color: var(--live); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary .tile:nth-child(4n) { border-right: 1px solid var(--line); }
  .summary .tile:nth-child(2n) { border-right: 0; }
  .summary .tile:nth-last-child(-n+4) { border-bottom: 1px solid var(--line); }
  .summary .tile:nth-last-child(-n+2) { border-bottom: 0; }
  .pnl-cards { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .pnl-cards .pnl:first-child { grid-column: 1 / -1; }
  .chart { height: 240px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .schedule { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-head { padding: 14px; }
  .toggle-wrap { width: 100%; justify-content: space-between; }
  .toggle-wrap .lbl { text-align: left; }
}
@media (prefers-reduced-motion: reduce) { .switch, .switch::after { transition: none; } }

/* ---------- v4 Fast Scalp monitors ---------- */
.sig-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--surface-2); min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.sig-card.BUY-CALL { border-color: color-mix(in srgb, var(--profit) 45%, var(--line)); }
.sig-card.BUY-PUT { border-color: color-mix(in srgb, var(--loss) 45%, var(--line)); }
.sig-top { display: flex; align-items: center; gap: 10px; }
.sig-top .sym { font-size: 1.15rem; }
.sig-top .px { font-weight: 700; font-size: 1.1rem; }
.sig-top .act { margin-left: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mchip { font-size: .74rem; font-weight: 650; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); white-space: nowrap; }
.mchip.ok { color: var(--profit); border-color: color-mix(in srgb, var(--profit) 30%, transparent); }
.mchip.bad { color: var(--loss); border-color: color-mix(in srgb, var(--loss) 30%, transparent); }
.mchip.warn { color: var(--warn); background: var(--warn-soft); }
.mchip.off { color: var(--muted); }
.score { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; }
.score-n { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.score-n small { font-size: .75rem; color: var(--muted); font-weight: 600; }
.meter { position: relative; height: 10px; border-radius: 99px; background: var(--grid); overflow: visible; }
.meter i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--ink-2); }
.meter em { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--accent); }
.comps { display: grid; gap: 4px; }
.comp { display: grid; grid-template-columns: 96px 1fr 44px; gap: 8px; align-items: center; font-size: .78rem; color: var(--ink-2); }
.comp b { text-align: right; font-weight: 650; }
.cbar { height: 6px; border-radius: 99px; background: var(--grid); overflow: hidden; }
.cbar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.kv.tight { margin: 0; row-gap: 2px; font-size: .86rem; }
.why { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: .84rem; }
.why ul { margin: 4px 0 0; padding-left: 18px; }
.why li { margin: 2px 0; overflow-wrap: anywhere; }
.why.go { border-color: color-mix(in srgb, var(--profit) 35%, var(--line)); }
.sig-foot { line-height: 1.4; }
.pipe { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.pipe li { display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding: 6px 0; position: relative; }
.pipe li:not(:last-child)::after { content: ""; position: absolute; left: 12px; top: 30px; bottom: -4px; width: 2px; background: var(--line); }
.pipe .dotx { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 800;
  border: 2px solid var(--line-strong); background: var(--surface); color: var(--muted); z-index: 1; }
.pipe li.done .dotx { background: var(--profit-mark); border-color: var(--profit-mark); color: #fff; }
.pipe li.active .dotx { border-color: var(--accent); color: var(--accent); }
.pipe li.failed .dotx { background: var(--loss-mark); border-color: var(--loss-mark); color: #fff; }
.pipe li.pending b { color: var(--muted); font-weight: 600; }
.exec-alert { margin-bottom: 10px; font-size: .9rem; }
.stats.perf3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 700px) {
  .stats.perf3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .comp { grid-template-columns: 84px 1fr 40px; }
  #modeSeg button { padding: 5px 8px; }
}
