/* Pluto · trading-terminal theme. Dark-first, polished light theme, strict-CSP friendly (no inline styles). */

/* ---- tokens ------------------------------------------------------------------------------------------ */
:root {
  color-scheme: light dark;

  --bg-l: #f2f3f7;        --bg-d: #06080c;
  --bg-2-l: #fbfbfd;      --bg-2-d: #0a0d13;
  --surface-l: #ffffff;   --surface-d: #0e1219;
  --surface-2-l: #f5f6fa; --surface-2-d: #131823;
  --surface-3-l: #eceef4; --surface-3-d: #1a2030;
  --border-l: #e2e5ed;    --border-d: #1f2634;
  --border-strong-l: #c9cedb; --border-strong-d: #2d3648;
  --text-l: #0c111d;      --text-d: #e9edf5;
  --text-2-l: #47506a;    --text-2-d: #a6afc2;
  --muted-l: #737d95;     --muted-d: #6c7790;
  --accent-l: #5b45e6;    --accent-d: #9a8bff;
  --accent-2-l: #0b95ab;  --accent-2-d: #3ad7ea;
  --on-accent-l: #ffffff; --on-accent-d: #0b0820;
  --good-l: #0a8a4b;      --good-d: #34d77f;
  --bad-l: #d3263b;       --bad-d: #ff5f6f;
  --warn-l: #a66300;      --warn-d: #ffb547;
  --grid-l: #eceef3;      --grid-d: #161c28;
  --glass-l: rgb(251 251 253 / .78); --glass-d: rgb(8 11 16 / .72);
  --shadow-l: 0 1px 2px rgb(16 24 40 / .06), 0 8px 24px -12px rgb(16 24 40 / .12);
  --shadow-d: 0 1px 0 rgb(255 255 255 / .03) inset, 0 12px 32px -16px rgb(0 0 0 / .7);
  --s1-l: #5b45e6; --s1-d: #9a8bff;  --s2-l: #e0662f; --s2-d: #ff8a4c;
  --s3-l: #0b95ab; --s3-d: #3ad7ea;  --s4-l: #c28a00; --s4-d: #f5c542;
  --s5-l: #d0457f; --s5-d: #ff7eb3;  --s6-l: #2f8f3a; --s6-d: #71d97b;
  --s7-l: #3767d6; --s7-d: #6d9bff;  --s8-l: #8a5a2b; --s8-d: #d8a777;

  --bg: light-dark(var(--bg-l), var(--bg-d));
  --bg-2: light-dark(var(--bg-2-l), var(--bg-2-d));
  --surface: light-dark(var(--surface-l), var(--surface-d));
  --surface-2: light-dark(var(--surface-2-l), var(--surface-2-d));
  --surface-3: light-dark(var(--surface-3-l), var(--surface-3-d));
  --border: light-dark(var(--border-l), var(--border-d));
  --border-strong: light-dark(var(--border-strong-l), var(--border-strong-d));
  --text: light-dark(var(--text-l), var(--text-d));
  --text-2: light-dark(var(--text-2-l), var(--text-2-d));
  --muted: light-dark(var(--muted-l), var(--muted-d));
  --accent: light-dark(var(--accent-l), var(--accent-d));
  --accent-2: light-dark(var(--accent-2-l), var(--accent-2-d));
  --on-accent: light-dark(var(--on-accent-l), var(--on-accent-d));
  --good: light-dark(var(--good-l), var(--good-d));
  --bad: light-dark(var(--bad-l), var(--bad-d));
  --warn: light-dark(var(--warn-l), var(--warn-d));
  --grid: light-dark(var(--grid-l), var(--grid-d));
  --glass: light-dark(var(--glass-l), var(--glass-d));
  --shadow: light-dark(var(--shadow-l), var(--shadow-d));
  --s1: light-dark(var(--s1-l), var(--s1-d)); --s2: light-dark(var(--s2-l), var(--s2-d));
  --s3: light-dark(var(--s3-l), var(--s3-d)); --s4: light-dark(var(--s4-l), var(--s4-d));
  --s5: light-dark(var(--s5-l), var(--s5-d)); --s6: light-dark(var(--s6-l), var(--s6-d));
  --s7: light-dark(var(--s7-l), var(--s7-d)); --s8: light-dark(var(--s8-l), var(--s8-d));

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  --r: 14px; --r-sm: 9px;
  --side-w: 236px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  accent-color: var(--accent);
  scrollbar-color: var(--border-strong) transparent;
}
:root:has(> head > meta[name="color-scheme"][content="dark"]) { color-scheme: dark; }
:root:has(> head > meta[name="color-scheme"][content="light"]) { color-scheme: light; }
/* Browsers without light-dark(): follow the system scheme (the manual toggle then has no effect). */
@supports not (color: light-dark(#000, #fff)) {
  :root {
    --bg: var(--bg-l); --bg-2: var(--bg-2-l); --surface: var(--surface-l); --surface-2: var(--surface-2-l); --surface-3: var(--surface-3-l);
    --border: var(--border-l); --border-strong: var(--border-strong-l); --text: var(--text-l); --text-2: var(--text-2-l); --muted: var(--muted-l);
    --accent: var(--accent-l); --accent-2: var(--accent-2-l); --on-accent: var(--on-accent-l); --good: var(--good-l); --bad: var(--bad-l); --warn: var(--warn-l);
    --grid: var(--grid-l); --glass: var(--glass-l); --shadow: var(--shadow-l);
    --s1: var(--s1-l); --s2: var(--s2-l); --s3: var(--s3-l); --s4: var(--s4-l); --s5: var(--s5-l); --s6: var(--s6-l); --s7: var(--s7-l); --s8: var(--s8-l);
  }
  @media (prefers-color-scheme: dark) {
    :root {
      --bg: var(--bg-d); --bg-2: var(--bg-2-d); --surface: var(--surface-d); --surface-2: var(--surface-2-d); --surface-3: var(--surface-3-d);
      --border: var(--border-d); --border-strong: var(--border-strong-d); --text: var(--text-d); --text-2: var(--text-2-d); --muted: var(--muted-d);
      --accent: var(--accent-d); --accent-2: var(--accent-2-d); --on-accent: var(--on-accent-d); --good: var(--good-d); --bad: var(--bad-d); --warn: var(--warn-d);
      --grid: var(--grid-d); --glass: var(--glass-d); --shadow: var(--shadow-d);
      --s1: var(--s1-d); --s2: var(--s2-d); --s3: var(--s3-d); --s4: var(--s4-d); --s5: var(--s5-d); --s6: var(--s6-d); --s7: var(--s7-d); --s8: var(--s8-d);
    }
  }
}

/* ---- base ------------------------------------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-block-size: 100dvh; color: var(--text); font: 14px/1.5 var(--font);
  background:
    radial-gradient(900px 520px at 12% -8%, color-mix(in oklab, var(--accent) 13%, transparent), transparent 70%),
    radial-gradient(700px 420px at 100% 0%, color-mix(in oklab, var(--accent-2) 7%, transparent), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  overflow-x: clip;
}
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 14.5px; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, select, input { font: inherit; color: inherit; }
code { font: 12px var(--mono); background: var(--surface-2); padding: 1px 5px; border-radius: 5px; overflow-wrap: anywhere; }
kbd {
  font: 11px var(--mono); padding: 1px 5px; border-radius: 5px; border: 1px solid var(--border-strong);
  border-block-end-width: 2px; background: var(--surface-2); color: var(--text-2);
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: color-mix(in oklab, var(--accent) 35%, transparent); }
.hidden, [hidden] { display: none !important; }
.visually-hidden { position: absolute !important; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sprite { position: absolute; inline-size: 0; block-size: 0; overflow: hidden; }
.ic { inline-size: 16px; block-size: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.ic-xl { inline-size: 28px; block-size: 28px; stroke-width: 1.4; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono, .num, .stat-value, .pnl, .sym, .tick-item b { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.pos { color: var(--good); }
.neg { color: var(--bad); }
.warn-text { color: var(--warn); }
.spacer { flex: 1; }
.skip { position: absolute; inset-inline-start: 8px; inset-block-start: -40px; z-index: 50; background: var(--accent); color: var(--on-accent); padding: 6px 10px; border-radius: 8px; }
.skip:focus { inset-block-start: 8px; }

/* ---- shell ----------------------------------------------------------------------------------------------- */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-block-size: 100dvh; transition: grid-template-columns .25s var(--ease); }
:root[data-side=collapsed] { --side-w: 68px; }

.sidebar {
  position: sticky; inset-block-start: 0; block-size: 100dvh; display: flex; flex-direction: column; gap: 6px;
  padding: 14px 10px; background: color-mix(in oklab, var(--bg-2) 88%, transparent);
  border-inline-end: 1px solid var(--border); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
}
.side-brand { display: flex; align-items: center; gap: 6px; padding: 2px 4px 10px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 750; font-size: 17px; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.logo { inline-size: 28px; block-size: 28px; flex: none; }
.logo-planet { fill: var(--accent); }
.logo-ring { fill: none; stroke: var(--accent-2); stroke-width: 1.8; opacity: .9; }
.side-brand .brand { flex: 1; min-inline-size: 0; }
.side-nav { display: grid; gap: 2px; }
.side-nav a {
  position: relative; display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 10px;
  color: var(--text-2); font-weight: 520; white-space: nowrap; transition: background .15s, color .15s;
}
.side-nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.side-nav a[aria-current=page] {
  color: var(--text); background: color-mix(in oklab, var(--accent) 14%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--accent) 30%, transparent);
}
.side-nav a[aria-current=page]::before {
  content: ""; position: absolute; inset-inline-start: -10px; inset-block: 8px; inline-size: 3px; border-radius: 0 3px 3px 0;
  background: linear-gradient(var(--accent), var(--accent-2));
}
.side-nav a[aria-current=page] .ic { color: var(--accent); }
.side-nav .ic { inline-size: 18px; block-size: 18px; }
.side-nav .lbl { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.side-nav kbd { opacity: 0; transition: opacity .15s; }
.side-nav a:hover kbd, .side-nav a:focus-visible kbd { opacity: 1; }
.nav-badge {
  min-inline-size: 18px; padding: 0 5px; border-radius: 9px; font: 600 11px/18px var(--mono); text-align: center;
  background: color-mix(in oklab, var(--accent) 22%, transparent); color: var(--text);
}
.nav-badge.bad { background: var(--bad); color: #fff; }
.side-foot { margin-block-start: auto; display: grid; gap: 10px; padding: 10px 4px 0; border-block-start: 1px solid var(--border); }
.side-actions { display: flex; gap: 4px; }
:root[data-side=collapsed] .sidebar .lbl, :root[data-side=collapsed] .sidebar kbd { display: none; }
:root[data-side=collapsed] .side-brand { flex-direction: column; }
:root[data-side=collapsed] .side-nav a { justify-content: center; padding: 10px; }
:root[data-side=collapsed] .side-nav .nav-badge { position: absolute; inset-block-start: 2px; inset-inline-end: 2px; min-inline-size: 16px; line-height: 16px; font-size: 10px; }
:root[data-side=collapsed] .sidebar .theme-seg { flex-direction: column; }
:root[data-side=collapsed] .side-actions { flex-direction: column; align-items: center; }

.main-col { min-inline-size: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; inset-block-start: 0; z-index: 10; display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap;
  padding: 12px 24px; background: var(--glass); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-block-end: 1px solid var(--border);
}
.titles { display: flex; align-items: baseline; gap: 10px; min-inline-size: 0; flex-wrap: wrap; }
#page-title { font-size: 19px; letter-spacing: -.02em; outline: none; }
.page-sub { color: var(--muted); font-size: 12.5px; }
.ticker { display: flex; gap: 6px; flex-wrap: wrap; min-inline-size: 0; flex: 1; justify-content: flex-end; }
.tick-item { display: inline-flex; gap: 6px; align-items: baseline; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; }
.tick-item em { font-style: normal; color: var(--muted); font-weight: 600; }
.top-status { display: flex; align-items: center; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--border); background: var(--surface); white-space: nowrap; }
.pill.danger { background: var(--bad); border-color: var(--bad); color: #fff; letter-spacing: .04em; }
.pulse-dot { inline-size: 8px; block-size: 8px; border-radius: 50%; background: var(--muted); position: relative; }
.pill.worker.ok .pulse-dot { background: var(--good); }
.pill.worker.ok .pulse-dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--good); opacity: 0; animation: ping 2.4s var(--ease) infinite; }
.pill.worker.bad { color: var(--bad); border-color: color-mix(in oklab, var(--bad) 45%, transparent); }
.pill.worker.bad .pulse-dot { background: var(--bad); }
@keyframes ping { 0% { transform: scale(.6); opacity: .8; } 80%, 100% { transform: scale(1.8); opacity: 0; } }
.updated { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font: 12px var(--mono); }
.live-dot { inline-size: 6px; block-size: 6px; border-radius: 50%; background: var(--border-strong); }
.updated.fresh .live-dot { animation: flash 1.2s var(--ease); }
@keyframes flash { 0% { background: var(--accent-2); box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent-2) 35%, transparent); } 100% { background: var(--border-strong); box-shadow: 0 0 0 0 transparent; } }
.mobile-only { display: none; }

.banners:empty { display: none; }
.banner { padding: 9px 24px; font-weight: 600; font-size: 13px; }
.banner.live { background: var(--bad); color: #fff; }
.banner.warn { background: color-mix(in oklab, var(--warn) 16%, var(--surface)); color: var(--warn); border-block-end: 1px solid color-mix(in oklab, var(--warn) 30%, transparent); }
.banner.error { background: color-mix(in oklab, var(--bad) 12%, var(--surface)); color: var(--bad); }
.banner.info { background: var(--surface-2); color: var(--text-2); }
.view .banner, #bd-banners .banner { border-radius: var(--r-sm); padding: 9px 14px; overflow-wrap: anywhere; }
#bd-banners { display: grid; gap: 8px; }
#bd-banners:empty { display: none; }

.view { display: grid; gap: 18px; padding: 22px 24px 40px; max-inline-size: 1560px; inline-size: 100%; margin-inline: auto; outline: none; view-transition-name: page; }

.view > *, .grid-2 > *, .grid-scan > *, .reports > *, [role=tabpanel] { min-inline-size: 0; }
[role=tabpanel] { display: grid; gap: 14px; }
.tabbar { display: none; }

/* ---- primitives ------------------------------------------------------------------------------------------ */
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; min-inline-size: 0;
  box-shadow: var(--shadow);
}
.panel.glow { position: relative; overflow: clip; }
.panel.glow::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: radial-gradient(600px 220px at 0% 0%, color-mix(in oklab, var(--accent) 12%, transparent), transparent 70%);
}
.panel-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-block-end: 12px; }
.panel-head h2 { display: inline-flex; align-items: center; gap: 8px; }
.panel-head h2 .ic { color: var(--accent); }
.panel-head .link { margin-inline-start: auto; font-size: 12.5px; }
.section-h { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-block-end: 10px; }
.section-h .ic { color: var(--bad); }
.sub-h { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 4px 0 8px; font-weight: 650; }
.grid-2 { display: grid; gap: 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-2.wide-left { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.grid-2.tight { gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.kvchips { display: flex; flex-wrap: wrap; gap: 4px; }
.kvchips span { font: 11.5px var(--mono); padding: 1px 6px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--border); }
.kvchips em { font-style: normal; color: var(--muted); }

.btn, .icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 9px; cursor: pointer; white-space: nowrap;
  background: var(--surface-2); border: 1px solid var(--border); padding: 7px 12px; font-weight: 560; font-size: 13px; color: var(--text);
  transition: background .15s, border-color .15s, transform .1s, box-shadow .15s;
}
.btn:hover:not(:disabled), .icon-btn:hover:not(:disabled) { border-color: var(--border-strong); background: var(--surface-3); text-decoration: none; }
.btn:active:not(:disabled), .icon-btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.small { padding: 5px 10px; font-size: 12.5px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 6px 18px -8px var(--accent); }
.btn.primary:hover:not(:disabled) { background: color-mix(in oklab, var(--accent) 88%, white); border-color: transparent; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger:hover:not(:disabled) { background: color-mix(in oklab, var(--bad) 85%, black); }
.icon-btn { padding: 7px; }
.icon-btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.icon-btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .ic { inline-size: 18px; block-size: 18px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 650;
  background: var(--surface-3); color: var(--text-2); white-space: nowrap; letter-spacing: .01em; vertical-align: 1px;
}
.badge .ic { inline-size: 12px; block-size: 12px; }
.badge.st-active { background: color-mix(in oklab, var(--good) 16%, transparent); color: var(--good); }
.badge.st-paused { background: color-mix(in oklab, var(--warn) 18%, transparent); color: var(--warn); }
.badge.st-halted, .badge.mode-live, .badge.lvl-critical, .badge.lvl-error { background: var(--bad); color: #fff; }
.badge.lvl-warn, .badge.warn { background: color-mix(in oklab, var(--warn) 18%, transparent); color: var(--warn); }
.badge.mode-paper { background: transparent; box-shadow: inset 0 0 0 1px var(--border-strong); color: var(--muted); }
.badge.mode-testnet { background: color-mix(in oklab, var(--accent-2) 16%, transparent); color: var(--accent-2); }
.badge.ai { background: color-mix(in oklab, var(--accent) 18%, transparent); color: var(--accent); }
.badge.new { background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: var(--on-accent); }
.badge.held { background: color-mix(in oklab, var(--accent-2) 16%, transparent); color: var(--accent-2); }
.badge.scan { background: color-mix(in oklab, var(--accent-2) 14%, transparent); color: var(--accent-2); }
/* outcome colours (each with its own label text, never colour-only) */
.badge.o-entered { background: color-mix(in oklab, var(--good) 18%, transparent); color: var(--good); }
.badge.o-exit { background: color-mix(in oklab, var(--accent-2) 18%, transparent); color: var(--accent-2); }
.badge.o-blocked { background: color-mix(in oklab, var(--warn) 18%, transparent); color: var(--warn); }
.badge.o-vetoed { background: color-mix(in oklab, var(--bad) 16%, transparent); color: var(--bad); }
.badge.o-holding { background: color-mix(in oklab, var(--accent) 18%, transparent); color: var(--accent); }
.badge.o-waiting { background: var(--surface-3); color: var(--text-2); }
.badge.o-scanning { background: color-mix(in oklab, var(--accent-2) 12%, transparent); color: var(--accent-2); }
.badge.act-BUY { box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--good) 50%, transparent); background: transparent; color: var(--good); }
.badge.act-SELL { box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--bad) 50%, transparent); background: transparent; color: var(--bad); }
.badge.act-HOLD { box-shadow: inset 0 0 0 1px var(--border-strong); background: transparent; color: var(--muted); }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; font-weight: 560; }
.chip small { color: var(--muted); }

.pnl { white-space: nowrap; font-weight: 600; }
.pnl.flat { color: var(--text-2); }
.pnl .arr { font-size: .72em; margin-inline-end: 3px; vertical-align: .08em; }
.sym { font-weight: 650; letter-spacing: .01em; white-space: nowrap; }
.sym .quote { color: var(--muted); font-weight: 450; }
.side { font: 700 11px var(--mono); padding: 1px 6px; border-radius: 5px; }
.side.buy { color: var(--good); background: color-mix(in oklab, var(--good) 14%, transparent); }
.side.sell { color: var(--bad); background: color-mix(in oklab, var(--bad) 14%, transparent); }
.bot-link { font-weight: 620; font-family: var(--mono); font-size: 12.5px; }

select, input[type=text], input[type=search], input[type=password] {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 6px 10px; min-inline-size: 0;
}
select:hover, input:hover { border-color: var(--border-strong); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 14px; }
.field-inline { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); }
.field { display: grid; gap: 6px; margin-block-start: 10px; }
.field input { inline-size: 100%; }
.search { display: inline-flex; align-items: center; gap: 8px; padding: 0 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); flex: 1 1 240px; max-inline-size: 420px; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 22%, transparent); }
.search input { border: 0; background: transparent; padding: 8px 0; flex: 1; outline: none; }
.search.small { flex: 0 1 200px; }
.search .ic { color: var(--muted); }
.mini-select select { padding: 2px 8px; font-size: 12px; border-radius: 7px; }
.toggle { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 12.5px; user-select: none; }
.toggle input { inline-size: 15px; block-size: 15px; }

.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span { display: block; padding: 3px 10px; border-radius: 7px; font-size: 12px; color: var(--text-2); font-weight: 560; transition: background .15s, color .15s; }
.seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / .18), inset 0 0 0 1px var(--border); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }

.theme-seg { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); margin: 0; }
.theme-seg legend { font-size: 12px; color: var(--muted); padding: 0 4px; }
.theme-seg label { position: relative; flex: 1; display: grid; place-items: center; padding: 5px; border-radius: 7px; cursor: pointer; color: var(--muted); }
.theme-seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.theme-seg label:has(input:checked) { background: var(--surface); color: var(--accent); box-shadow: inset 0 0 0 1px var(--border); }
.theme-seg label:has(input:focus-visible) { outline: 2px solid var(--accent); }
.theme-seg.wide label { display: flex; gap: 6px; justify-content: center; font-size: 13px; padding: 8px; }

.tabs { display: flex; gap: 4px; border-block-end: 1px solid var(--border); }
.tabs [role=tab] {
  display: inline-flex; gap: 7px; align-items: center; background: none; border: 0; padding: 9px 14px; cursor: pointer;
  color: var(--text-2); font-weight: 600; border-block-end: 2px solid transparent; margin-block-end: -1px;
}
.tabs [role=tab][aria-selected=true] { color: var(--text); border-color: var(--accent); }
.view[data-tab=islemler] .act-only, .view[data-tab=aktivite] .tr-only { display: none; }

/* tables */
.table-wrap { overflow-x: auto; max-inline-size: 100%; overscroll-behavior-x: contain; }
.table-wrap.tall { max-block-size: 460px; overflow-y: auto; scrollbar-gutter: stable; }
.table-wrap.tall.xl { max-block-size: 70dvh; }
.scroll-y { max-block-size: 420px; overflow-y: auto; overscroll-behavior: contain; }
table { border-collapse: separate; border-spacing: 0; inline-size: 100%; font-size: 13px; }
th, td { padding: 8px 10px; border-block-end: 1px solid var(--border); text-align: start; vertical-align: middle; white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; position: sticky; inset-block-start: 0; background: var(--surface); z-index: 1; }
th.num, td.num { text-align: end; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: color-mix(in oklab, var(--accent) 5%, transparent); }
tbody tr:last-child td { border-block-end: 0; }
tr.clickable { cursor: pointer; }
td.wrap { white-space: normal; min-inline-size: 240px; }
.wrap-text { white-space: normal; max-inline-size: 280px; }
.th-btn { all: unset; cursor: pointer; }
.th-btn:focus-visible { outline: 2px solid var(--accent); }
th[aria-sort] { color: var(--text); }
th[aria-sort=ascending] .th-btn::after { content: " ▲"; font-size: 9px; }
th[aria-sort=descending] .th-btn::after { content: " ▼"; font-size: 9px; }
.row-actions { display: flex; gap: 6px; }

.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; font-size: 13px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.two-kv { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }

/* stats / KPIs */
.kpi-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); }
.kpi-grid.compact { grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); }
.stat.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 12px 14px; box-shadow: var(--shadow); min-inline-size: 0; }
.stat-label { color: var(--muted); font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; }
.stat-value { font-size: 20px; font-weight: 650; margin-block: 3px 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value small { font: 500 12px var(--font); color: var(--muted); }
.stat-sub { color: var(--text-2); font-size: 12px; overflow-wrap: anywhere; }
.tick-up { color: var(--good); }
.tick-down { color: var(--bad); }
[data-tick] { transition: color .4s; }

.empty { display: grid; justify-items: center; gap: 6px; padding: 28px 16px; color: var(--muted); text-align: center; }
.empty b { color: var(--text-2); font-weight: 600; }
.empty .ic-xl { color: var(--border-strong); }
.empty.err, .empty.err .ic-xl { color: var(--bad); }
.skel-wrap { display: grid; gap: 10px; }
.skel-wrap.grid { grid-column: 1 / -1; grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); }
.skel-wrap.grid .skel { block-size: 74px; }
.skel-wrap.cards-skel { grid-column: 1 / -1; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.skel-wrap.cards-skel .skel { block-size: 300px; border-radius: var(--r); }
.skel {
  block-size: 16px; border-radius: 7px;
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%) 0 0 / 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.skel:nth-child(3n+2) { inline-size: 82%; }
.skel:nth-child(3n) { inline-size: 64%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* toast + dialogs */
.toast {
  position: fixed; inset-block-end: calc(20px + env(safe-area-inset-bottom)); inset-inline-start: 50%; translate: -50% 0; z-index: 100;
  max-inline-size: calc(100% - 32px); padding: 10px 16px; border-radius: 10px; font-weight: 560;
  background: var(--text); color: var(--bg); box-shadow: 0 10px 30px rgb(0 0 0 / .3);
  transition: opacity .35s, translate .35s var(--ease);
}
@starting-style { .toast { opacity: 0; translate: -50% 12px; } }
.toast.good { background: var(--good); color: #fff; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.out { opacity: 0; translate: -50% 8px; }
dialog {
  border: 1px solid var(--border-strong); border-radius: var(--r); padding: 0; background: var(--surface); color: var(--text);
  inline-size: min(520px, calc(100% - 24px)); max-block-size: calc(100dvh - 40px); box-shadow: 0 30px 80px -20px rgb(0 0 0 / .55);
}
dialog[open] { animation: pop .2s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
dialog::backdrop { background: rgb(4 6 10 / .55); backdrop-filter: blur(3px); }
dialog:modal { overscroll-behavior: contain; }
dialog.drawer { margin: 0 0 0 auto; block-size: 100dvh; max-block-size: 100dvh; inline-size: min(880px, 100%); border-radius: 0; border-width: 0 0 0 1px; overflow-y: auto; }
dialog.drawer[open] { animation: slide-in .25s var(--ease); }
@keyframes slide-in { from { transform: translateX(40px); opacity: 0; } }
.dlg-head { position: sticky; inset-block-start: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 14px 16px; background: var(--surface); border-block-end: 1px solid var(--border); }
.dlg-head h2 { flex: 1; min-inline-size: 0; overflow-wrap: anywhere; font-size: 15px; }
.dlg-body { padding: 16px; display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-block-start: 1px solid var(--border); }
.keys { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; align-items: center; }
.keys dd { margin: 0; color: var(--text-2); }

.sheet { margin: auto auto 0; inline-size: 100%; max-inline-size: 560px; border-radius: 18px 18px 0 0; border-block-end: 0; padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); }
.sheet[open] { animation: sheet-up .25s var(--ease); }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
.sheet-grip { inline-size: 40px; block-size: 4px; border-radius: 2px; background: var(--border-strong); margin: 4px auto 12px; }
.sheet-nav { display: grid; gap: 4px; margin-block-end: 14px; }
.sheet-nav a { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 12px; color: var(--text); font-weight: 600; background: var(--surface-2); }
.sheet-nav a[aria-current=page] { box-shadow: inset 0 0 0 1px var(--accent); color: var(--accent); }
.sheet-nav .nav-badge { margin-inline-start: auto; }
.sheet-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-block-start: 14px; }
.sheet-actions .btn { flex: 1; }

/* ---- overview ---------------------------------------------------------------------------------------------- */
.hero { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(0, 1.9fr); gap: 22px; padding: 20px; }
.hero > * { position: relative; min-inline-size: 0; }
.eyebrow { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; font-weight: 650; }
.hero-value { font: 700 clamp(30px, 4.2vw, 44px)/1.1 var(--mono); letter-spacing: -.03em; margin-block: 10px 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hero-value .unit { font: 600 14px var(--font); color: var(--muted); margin-inline-start: 8px; letter-spacing: 0; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-block-end: 16px; }
.hero-chips .chip.pos { border-color: color-mix(in oklab, var(--good) 35%, transparent); }
.hero-chips .chip.neg { border-color: color-mix(in oklab, var(--bad) 35%, transparent); }
.hero-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.hero-split .stat-value { font-size: 16px; }
.exposure-bar { block-size: 6px; border-radius: 3px; background: var(--surface-3); margin-block-start: 14px; overflow: hidden; }
.exposure-bar i { display: block; block-size: 100%; inline-size: var(--w, 0%); background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: inherit; transition: inline-size .6s var(--ease); }
.hero-chart { display: flex; flex-direction: column; gap: 8px; }
.chart-head { display: flex; justify-content: flex-end; }
.chart-box { position: relative; block-size: 300px; }
.hero .chart-box { block-size: 260px; flex: 1; }
.chart-box.short { block-size: 220px; }

.pos-list, .movers, .timeline, .share-list, .cands, .rp-items { list-style: none; margin: 0; padding: 0; }
.pos-list { display: grid; gap: 10px; }
.pos-list li { padding: 12px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border); display: grid; gap: 8px; }
.pl-top, .pl-mid { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pl-mid { justify-content: space-between; }
.movers { display: grid; gap: 6px; }
.movers li { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 6px 4px; border-block-end: 1px dashed var(--border); }
.movers li:last-child { border: 0; }
.mv-id { display: grid; min-inline-size: 0; }
.mv-id small { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mv-bar { position: relative; block-size: 8px; border-radius: 4px; background: var(--surface-3); }
.mv-bar::before { content: ""; position: absolute; inset-block: -3px; inset-inline-start: 50%; inline-size: 1px; background: var(--border-strong); }
.mv-bar i { position: absolute; inset-block: 0; inline-size: var(--w); border-radius: 4px; }
.mv-bar.up i { inset-inline-start: 50%; background: var(--good); }
.mv-bar.down i { inset-inline-end: 50%; background: var(--bad); }
.mv-val { min-inline-size: 72px; text-align: end; }
.health dd .pos, .health dd .neg { font-weight: 600; }

/* ---- bot cards ----------------------------------------------------------------------------------------------- */
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 350px), 1fr)); align-items: start; }
.halted-wrap { margin-block-start: 4px; }
.bot-card {
  container-type: inline-size; position: relative; display: grid; gap: 12px; padding: 14px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); min-inline-size: 0;
  transition: border-color .2s, transform .2s var(--ease), box-shadow .2s, opacity .3s;
}
.bot-card:hover { border-color: var(--border-strong); }
.bot-card.in-pos { border-color: color-mix(in oklab, var(--accent) 35%, var(--border)); background: linear-gradient(180deg, color-mix(in oklab, var(--accent) 6%, var(--surface)), var(--surface) 140px); }
.bot-card.st-halted { border-color: color-mix(in oklab, var(--bad) 45%, var(--border)); }
.bot-card.st-paused { opacity: .92; }
.bot-card.vt-hero, .bot-hero { view-transition-name: bot-hero; }
.bc-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "dot title where" "dot badges badges"; align-items: center; gap: 2px 10px; }
.bc-head .status-dot { grid-area: dot; align-self: start; margin-block-start: 6px; }
.bc-title { grid-area: title; display: flex; flex-direction: column; min-inline-size: 0; }
.bc-id { font: 650 14px var(--mono); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc-badges { grid-area: badges; display: flex; flex-wrap: wrap; gap: 4px; }
.where { grid-area: where; display: inline-flex; align-items: center; gap: 5px; font-size: 13px; padding: 3px 9px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); }
.where.scanning, .scanning { color: var(--accent-2); }
.where.scanning .ic { animation: spin 3s linear infinite; }
@keyframes spin { to { rotate: 360deg; } }
.status-dot { inline-size: 9px; block-size: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.status-dot.st-active { background: var(--good); box-shadow: 0 0 0 3px color-mix(in oklab, var(--good) 20%, transparent); }
.status-dot.st-paused { background: var(--warn); }
.status-dot.st-halted { background: var(--bad); box-shadow: 0 0 0 3px color-mix(in oklab, var(--bad) 25%, transparent); }
.status-dot.big { inline-size: 12px; block-size: 12px; }
.bc-halt { color: var(--bad); font-size: 12.5px; background: color-mix(in oklab, var(--bad) 10%, transparent); padding: 6px 10px; border-radius: 8px; overflow-wrap: anywhere; }

.thought { display: grid; gap: 7px; padding: 10px 12px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); }
.decision { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.decision .ago { margin-inline-start: auto; color: var(--muted); font: 11.5px var(--mono); }
.reason { font-size: 13px; color: var(--text); overflow-wrap: anywhere; }
.summary { display: flex; gap: 7px; font-size: 12.5px; color: var(--text-2); line-height: 1.45; }
.summary .ic { color: var(--accent); margin-block-start: 1px; inline-size: 15px; block-size: 15px; }
.checks { border-block-start: 1px dashed var(--border); padding-block-start: 6px; }
.checks > summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; font-size: 12px; color: var(--muted); font-weight: 600; }
.checks > summary::-webkit-details-marker { display: none; }
.checks > summary::after { content: "▸"; margin-inline-start: auto; transition: rotate .2s; }
.checks[open] > summary::after { rotate: 90deg; }
.ck-count { font-family: var(--mono); color: var(--text-2); }
.ck-count b { color: var(--text); }
.ck-bar { display: inline-flex; gap: 2px; }
.ck-bar i { inline-size: 10px; block-size: 4px; border-radius: 2px; background: color-mix(in oklab, var(--bad) 55%, var(--surface-3)); }
.ck-bar i.ok { background: var(--good); }
.checks-list { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 3px; }
.checks-list li { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; grid-template-areas: "ck label val" ". target target"; gap: 0 6px; font-size: 12.5px; padding: 3px 0; }
.ck { grid-area: ck; font-weight: 800; }
.checks-list li.ok .ck { color: var(--good); }
.checks-list li.no .ck { color: var(--bad); }
.ck-label { grid-area: label; overflow-wrap: anywhere; }
.ck-val { grid-area: val; font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: end; }
.ck-target { grid-area: target; color: var(--muted); font: 11px var(--mono); }
@container (inline-size > 420px) {
  .checks-list li { grid-template-columns: 16px minmax(0, 1fr) auto 110px; grid-template-areas: "ck label val target"; }
  .ck-target { text-align: end; }
}
.score { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; }
.score-bar { inline-size: 46px; block-size: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; display: inline-block; }
.score-bar i { display: block; block-size: 100%; inline-size: var(--w, 0%); border-radius: inherit; background: var(--muted); }
.score.hi i, .c-score.hi i { background: var(--good); }
.score.mid i, .c-score.mid i { background: var(--warn); }
.score.lo i, .c-score.lo i { background: var(--bad); }
.score b, .c-score b { font-family: var(--mono); }

.pos-block { display: grid; gap: 8px; }
.pos-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pos-pair { font-size: 14px; }
.pos-pnl { font-size: 15px; }
.pos-pnl small { font-size: 12px; margin-inline-start: 4px; }
.pos-pnl.big { font-size: 22px; }
.pos-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); }
.pos-meta b { color: var(--text-2); font: 600 12px var(--mono); }
.pos-big { display: grid; gap: 14px; }

/* gauge: stop ← entry → target */
.gauge { display: grid; gap: 6px; padding-block: 4px 0; }
.g-track { position: relative; block-size: 8px; border-radius: 4px; background: var(--surface-3); }
.gauge.big .g-track { block-size: 12px; border-radius: 6px; }
.g-loss, .g-gain, .g-fill { position: absolute; inset-block: 0; border-radius: inherit; }
.g-loss { inset-inline-start: 0; inline-size: var(--w); background: color-mix(in oklab, var(--bad) 22%, transparent); }
.g-gain { inset-inline-start: var(--x); inline-size: var(--w); background: color-mix(in oklab, var(--good) 20%, transparent); }
.g-fill { inset-inline-start: var(--x); inline-size: var(--w); }
.g-fill.up { background: var(--good); }
.g-fill.down { background: var(--bad); }
.g-entry { position: absolute; inset-block: -4px; inset-inline-start: var(--x); inline-size: 2px; translate: -1px 0; background: var(--text-2); border-radius: 1px; }
.g-stop { position: absolute; inset-block: -4px; inset-inline-start: var(--x); inline-size: 2px; translate: -1px 0; background: var(--bad); border-radius: 1px; }
.g-cur {
  position: absolute; inset-block-start: 50%; inset-inline-start: var(--x); inline-size: 14px; block-size: 14px; translate: -50% -50%;
  border-radius: 50%; background: var(--surface); border: 3px solid var(--good); box-shadow: 0 0 0 4px color-mix(in oklab, var(--good) 22%, transparent);
  transition: inset-inline-start .6s var(--ease);
}
.g-cur.down { border-color: var(--bad); box-shadow: 0 0 0 4px color-mix(in oklab, var(--bad) 22%, transparent); }
.gauge.big .g-cur { inline-size: 18px; block-size: 18px; }
.g-labels { display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; font-size: 11px; color: var(--muted); }
.g-labels b { font: 600 11px var(--mono); color: var(--text-2); }
.g-labels em { font-style: normal; font-family: var(--mono); }
.g-l em { color: var(--bad); }
.g-r { text-align: end; }
.g-r em { color: var(--good); }
.g-m { text-align: center; }

.bc-foot { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 10px; align-items: end; border-block-start: 1px solid var(--border); padding-block-start: 10px; }
.bc-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 10px; }
.bc-stats > span { display: grid; min-inline-size: 0; }
.bc-stats em { font-style: normal; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 650; }
.bc-stats b, .bc-stats .pnl { font: 600 13px var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
canvas.spark { display: block; inline-size: 100%; block-size: 44px; }
canvas.spark.tiny { inline-size: 84px; block-size: 24px; }
@container (inline-size < 330px) {
  .bc-foot { grid-template-columns: minmax(0, 1fr); }
  .bc-head { grid-template-areas: "dot title title" "dot where where" "dot badges badges"; }
  .where { justify-self: start; }
}
.ai-verdict { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; padding: 9px 11px; border-radius: 10px; font-size: 12.5px; border: 1px solid var(--border); border-inline-start: 3px solid var(--good); background: var(--surface-2); }
.ai-verdict.veto { border-inline-start-color: var(--bad); }
.ai-verdict + .ai-verdict { margin-block-start: 8px; }
.av-head { display: inline-flex; gap: 6px; align-items: center; }
.av-head .ic { color: var(--accent); }
.av-when { color: var(--muted); font: 11px var(--mono); }
.av-text { grid-column: 1 / -1; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.bot-card .av-text { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; line-clamp: 3; overflow: clip; }
.cand-mini { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; font-size: 12px; }
.cand-chip { padding: 2px 7px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); font: 600 11.5px var(--mono); }
.cand-chip b { color: var(--accent-2); }

/* ---- bot detail ------------------------------------------------------------------------------------------------- */
.bot-hero { padding: 16px 18px; display: grid; gap: 8px; }
.bot-hero > * { position: relative; }
.back { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--text-2); inline-size: fit-content; }
.bh-row { display: flex; align-items: center; gap: 12px 18px; flex-wrap: wrap; }
.bh-title { display: grid; gap: 4px; min-inline-size: 0; flex: 1 1 260px; }
.bh-id { font: 700 22px var(--mono); letter-spacing: -.02em; overflow-wrap: anywhere; }
.bh-badges { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.bh-eq { display: grid; justify-items: end; gap: 1px; }
.bh-eq b { font: 700 22px var(--mono); }
.bh-desc { font-size: 13px; max-inline-size: 90ch; }
.controls { display: flex; gap: 8px; flex-wrap: wrap; }
.grid-detail { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); align-items: start; }
.grid-detail .col { display: grid; gap: 18px; min-inline-size: 0; }
details.more { margin-block-start: 10px; }
details.more > summary { cursor: pointer; color: var(--muted); font-size: 12.5px; font-weight: 600; margin-block-end: 8px; }

/* ---- timeline -------------------------------------------------------------------------------------------------- */
.timeline { display: grid; }
.act { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; padding: 9px 0; border-block-end: 1px solid var(--border); position: relative; }
.act:last-child { border: 0; }
.act-ic { inline-size: 28px; block-size: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.act.buy .act-ic { color: var(--good); background: color-mix(in oklab, var(--good) 12%, transparent); }
.act.win .act-ic { color: var(--good); background: color-mix(in oklab, var(--good) 12%, transparent); }
.act.loss .act-ic, .act.veto .act-ic, .act.lvl-error .act-ic, .act.lvl-critical .act-ic { color: var(--bad); background: color-mix(in oklab, var(--bad) 12%, transparent); }
.act.lvl-warn .act-ic { color: var(--warn); background: color-mix(in oklab, var(--warn) 14%, transparent); }
.act-main { min-inline-size: 0; display: grid; gap: 2px; }
.act-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.act-body { font-size: 12.5px; color: var(--text-2); overflow-wrap: anywhere; }
.act time { color: var(--muted); font: 11.5px var(--mono); white-space: nowrap; }

/* ---- scanner ------------------------------------------------------------------------------------------------------ */
.grid-scan { display: grid; gap: 18px; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }
.cand-card { padding: 12px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border); display: grid; gap: 8px; }
.cand-card + .cand-card { margin-block-start: 12px; }
.cand-card header { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: center; }
.cand-state { font-size: 13px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.cands { display: grid; gap: 4px; }
.cands li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto auto; grid-template-areas: "rank sym act score" ". sum sum sum"; align-items: center; gap: 2px 10px; padding: 7px 4px; border-block-start: 1px dashed var(--border); }
.rank { grid-area: rank; font: 700 12px var(--mono); color: var(--muted); }
.c-sym { grid-area: sym; }
.cands .badge { grid-area: act; }
.c-score { grid-area: score; display: inline-flex; gap: 6px; align-items: center; font-size: 12px; }
.c-score .score-bar { inline-size: 64px; }
.c-sum { grid-area: sum; font-size: 12px; color: var(--text-2); }

/* ---- analysis ------------------------------------------------------------------------------------------------------ */
.split { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
.share-list { display: grid; gap: 12px; }
.sh-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.sh-bar { block-size: 7px; border-radius: 4px; background: var(--surface-3); margin-block: 6px 4px; overflow: hidden; }
.sh-bar i { display: block; block-size: 100%; inline-size: var(--w); border-radius: inherit; background: var(--good); }
.sh-bar.down i { background: var(--bad); }
.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; margin-block-end: 12px; }
.mini-stats > span { display: grid; padding: 8px 10px; border-radius: 9px; background: var(--surface-2); }
.mini-stats em { font-style: normal; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 650; }
.mini-stats b { font: 650 15px var(--mono); }
.ai-pair { margin-block-end: 14px; }
.bot-picks { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-block-start: 10px; font-size: 12px; }
.bot-picks label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; font-family: var(--mono); }
.swatch { inline-size: 10px; block-size: 10px; border-radius: 3px; display: inline-block; flex: none; }

/* ---- reports ------------------------------------------------------------------------------------------------------- */
.reports { display: grid; gap: 18px; grid-template-columns: minmax(240px, 340px) minmax(0, 1fr); align-items: start; }
.report-list { position: sticky; inset-block-start: 80px; }
.rp-items { display: grid; gap: 4px; max-block-size: 70dvh; overflow-y: auto; overscroll-behavior: contain; }
.rp-items button { all: unset; box-sizing: border-box; display: grid; gap: 2px; inline-size: 100%; padding: 10px 12px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; }
.rp-items button:hover { background: var(--surface-2); }
.rp-items button[aria-pressed=true] { background: color-mix(in oklab, var(--accent) 12%, var(--surface)); border-color: color-mix(in oklab, var(--accent) 35%, transparent); }
.rp-items button:focus-visible { outline: 2px solid var(--accent); }
.rp-items span { font-size: 12px; color: var(--muted); }
.rp-items em { font-style: normal; font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
pre.report { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; font: 13px/1.65 var(--mono); background: var(--surface-2); padding: 16px; border-radius: 10px; }

/* ---- control ------------------------------------------------------------------------------------------------------- */
.control-card { display: grid; gap: 12px; align-content: start; }
.danger-zone { border-color: color-mix(in oklab, var(--bad) 35%, var(--border)); }
.danger-zone .panel-head h2 .ic { color: var(--bad); }
.danger-zone .btn { justify-self: start; }
.kill-switch { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font-weight: 600; }
.kill-switch:focus-visible { outline: 2px solid var(--accent); }
.ks-track { inline-size: 46px; block-size: 26px; border-radius: 13px; background: var(--surface-3); position: relative; transition: background .2s; flex: none; box-shadow: inset 0 0 0 1px var(--border-strong); }
.ks-thumb { position: absolute; inset-block-start: 3px; inset-inline-start: 3px; inline-size: 20px; block-size: 20px; border-radius: 50%; background: var(--text-2); transition: translate .25s var(--ease), background .2s; }
.kill-switch.on { border-color: var(--bad); color: var(--bad); }
.kill-switch.on .ks-track { background: var(--bad); }
.kill-switch.on .ks-thumb { translate: 20px 0; background: #fff; }

/* ---- login ----------------------------------------------------------------------------------------------------------- */
.login-page { min-block-size: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-card { inline-size: 100%; max-inline-size: 360px; display: grid; gap: 14px; padding: 28px; }
.login-card .brand { font-size: 22px; justify-content: center; margin-block-end: 6px; }
.login-card .logo { inline-size: 36px; block-size: 36px; }
.login-card label { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.login-card input { inline-size: 100%; padding: 10px 12px; }
.login-card .btn { padding: 10px; }
.login-error { color: var(--bad); font-size: 13px; }
.login-note { text-align: center; color: var(--muted); font-size: 12px; }

/* ---- view transitions (only the page area moves; respects reduced motion) ------------------------------------------- */
::view-transition-old(root), ::view-transition-new(root) { animation: none; }
::view-transition-group(page) { animation-duration: .28s; animation-timing-function: var(--ease); }
::view-transition-old(page) { animation: .18s var(--ease) both vt-out; }
::view-transition-new(page) { animation: .28s var(--ease) both vt-in; }
html:active-view-transition-type(forward)::view-transition-new(page) { animation-name: vt-in-right; }
html:active-view-transition-type(backward)::view-transition-new(page) { animation-name: vt-in-left; }
::view-transition-group(bot-hero) { animation-duration: .32s; animation-timing-function: var(--ease); z-index: 2; }
::view-transition-old(bot-hero), ::view-transition-new(bot-hero) { block-size: 100%; overflow: clip; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; translate: 0 8px; } }
@keyframes vt-in-right { from { opacity: 0; translate: 24px 0; } }
@keyframes vt-in-left { from { opacity: 0; translate: -24px 0; } }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ---- responsive --------------------------------------------------------------------------------------------------------- */
@media (max-width: 1180px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .grid-detail, .grid-scan, .split { grid-template-columns: minmax(0, 1fr); }
  .grid-2.wide-left { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .reports { grid-template-columns: minmax(0, 1fr); }
  .report-list { position: static; }
  .rp-items { max-block-size: 260px; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .mobile-only { display: inline-flex; }
  .topbar { padding: 10px 16px; gap: 8px 12px; }
  #page-title { font-size: 17px; }
  .ticker { order: 3; flex-basis: 100%; justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
  .top-status { margin-inline-start: auto; }
  .updated #updated { display: none; }
  .banner { padding-inline: 16px; }
  .view { padding: 16px 16px calc(88px + env(safe-area-inset-bottom)); gap: 14px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset-inline: 0; inset-block-end: 0; z-index: 20;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--glass); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border-block-start: 1px solid var(--border);
  }
  .tabbar a, .tabbar button {
    all: unset; box-sizing: border-box; position: relative; display: grid; justify-items: center; gap: 3px; padding: 6px 2px; border-radius: 10px;
    font-size: 10.5px; font-weight: 600; color: var(--muted); cursor: pointer; text-align: center;
  }
  .tabbar .ic { inline-size: 21px; block-size: 21px; }
  .tabbar a[aria-current=page], .tabbar button.active { color: var(--accent); background: color-mix(in oklab, var(--accent) 12%, transparent); }
  .tabbar a:focus-visible, .tabbar button:focus-visible { outline: 2px solid var(--accent); }
  .tabbar .nav-badge { position: absolute; inset-block-start: 0; inset-inline-start: 56%; min-inline-size: 16px; line-height: 16px; font-size: 10px; }
  .toast { inset-block-end: calc(84px + env(safe-area-inset-bottom)); }
}
@media (max-width: 640px) {
  .topbar { position: relative; }
  #worker-text { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); }
  .pill.worker { padding: 7px; }
  .page-sub { display: none; }
  .titles { flex: 1 1 100px; flex-wrap: nowrap; }
  #page-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pill.danger { padding-inline: 8px; font-size: 11px; }
  .panel { padding: 13px; }
  .hero { padding: 15px; gap: 14px; }
  .hero .chart-box { block-size: 210px; }
  .chart-box { block-size: 240px; }
  .stat-value { font-size: 17px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat.kpi { padding: 10px 11px; }
  .toolbar { padding: 10px; gap: 8px 10px; }
  .search { flex-basis: 100%; max-inline-size: none; }
  .toolbar .spacer { display: none; }
  .bh-eq { justify-items: start; }
  .tabs [role=tab] { padding: 9px 10px; }
  .act { grid-template-columns: 28px minmax(0, 1fr); }
  .act time { grid-column: 2; }
  dialog.drawer { inline-size: 100%; border-width: 0; }
}
