/* ── design tokens ─────────────────────────────────────────────────────────────────────
   One palette, light and dark. chart.js and replay.js read these same variables, so the
   charts follow the theme. Nothing is loaded from outside this server: system fonts only. */
:root {
  --bg: #f3f5fa; --bg-glow: rgba(99, 102, 241, .07);
  --side: #ffffff; --card: #ffffff; --card-2: #f7f8fc; --raised: #ffffff;
  --ink: #0e1324; --muted: #667089; --line: #e3e7f0; --line-2: #eef0f6;
  --accent: #4f46e5; --accent-2: #06b6d4; --on-accent: #ffffff;
  --up: #059669; --down: #e11d48; --warn: #c27803; --info: #4f46e5;
  --locked: rgba(5, 150, 105, .2); --risk: rgba(225, 29, 72, .18); --gap: rgba(79, 70, 229, .12);
  --shadow: 0 1px 2px rgba(14, 19, 36, .04), 0 6px 20px rgba(14, 19, 36, .06);
  --shadow-lg: 0 12px 40px rgba(14, 19, 36, .12);
  --radius: 16px; --radius-sm: 10px; --side-w: 248px;
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: "Inter", "SF Pro Text", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #080b12; --bg-glow: rgba(99, 102, 241, .12);
    --side: #0c1019; --card: #111622; --card-2: #0d121c; --raised: #161c2a;
    --ink: #e8ebf3; --muted: #8790a6; --line: #1d2433; --line-2: #171d2a;
    --accent: #7c7ff7; --accent-2: #22d3ee; --on-accent: #ffffff;
    --up: #34d399; --down: #fb7185; --warn: #fbbf24; --info: #818cf8;
    --locked: rgba(52, 211, 153, .2); --risk: rgba(251, 113, 133, .18); --gap: rgba(124, 127, 247, .16);
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 30px rgba(0, 0, 0, .28);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, .5);
  }
}

/* ── base ───────────────────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--ink); font: 14.5px/1.55 var(--sans); -webkit-font-smoothing: antialiased;
  background: radial-gradient(1200px 500px at 70% -10%, var(--bg-glow), transparent 60%), var(--bg);
  background-attachment: fixed; font-variant-numeric: tabular-nums; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font: 12.5px var(--mono); background: var(--card-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; }
h1, h2, h3, h4 { letter-spacing: -.015em; }
.icon { flex: none; vertical-align: middle; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.up { color: var(--up); } .down { color: var(--down); } .info { color: var(--info); }
[hidden] { display: none !important; } /* must beat any display rule, e.g. form.inline */
form.inline { display: inline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }

/* ── app shell: sidebar + content ───────────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px;
  padding: 20px 14px; background: var(--side); border-right: 1px solid var(--line); overflow-y: auto; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); font-weight: 750;
  font-size: 15.5px; letter-spacing: -.02em; line-height: 1.15; padding: 0 8px; }
.brand:hover { text-decoration: none; }
.brand small { display: block; font-weight: 500; font-size: 11.5px; color: var(--muted); letter-spacing: 0; }
.mark { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 40%, transparent), inset 0 1px 0 rgba(255, 255, 255, .25); }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted);
  padding: 14px 10px 6px; opacity: .8; }
.side-nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px; color: var(--muted);
  font-weight: 550; line-height: 1.2; transition: background .15s, color .15s; }
.side-nav a small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); margin-top: 2px; }
.side-nav a:hover { background: var(--card-2); color: var(--ink); text-decoration: none; }
.side-nav a.on { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--ink); }
.side-nav a.on .icon { color: var(--accent); }
.side-foot { margin-top: auto; display: grid; gap: 10px; padding: 12px 6px 0; border-top: 1px solid var(--line-2); }
.side-foot .pill { justify-content: center; }

.avatar { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none;
  font-weight: 750; font-size: 16px; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.avatar.sm { width: 26px; height: 26px; border-radius: 8px; font-size: 12px; }

.shell { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; min-height: 76px;
  padding: 14px 32px; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(170%) blur(14px); border-bottom: 1px solid var(--line-2); }
.topbar .heading { min-width: 0; }
.topbar h1 { margin: 0; font-size: 22px; line-height: 1.2; letter-spacing: -.025em; }
.topbar .heading p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.topbar .brand.compact { display: none; padding: 0; }
.who { margin-left: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.mobile-nav { display: none; }
main { width: 100%; max-width: 1360px; margin: 0 auto; padding: 28px 32px 8px; }
footer { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--muted);
  font-size: 12px; padding: 24px 16px 36px; margin-top: auto; }

.pill { display: inline-flex; align-items: center; gap: 7px; font: 650 11.5px/1 var(--sans);
  padding: 6px 11px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted);
  background: var(--card); letter-spacing: .01em; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.demo { color: var(--info); border-color: color-mix(in srgb, var(--info) 35%, transparent); background: color-mix(in srgb, var(--info) 10%, var(--card)); }
.pill.live { color: var(--down); border-color: color-mix(in srgb, var(--down) 40%, transparent); background: color-mix(in srgb, var(--down) 10%, var(--card)); }
.pill.sim { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: color-mix(in srgb, var(--warn) 10%, var(--card)); }
.pill.ai { color: var(--info); border-color: var(--info); }
.live-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 650; color: var(--up); }
.live-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--up);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--up) 60%, transparent); animation: ping 2s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ── cards ──────────────────────────────────────────────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 20px; box-shadow: var(--shadow); }
.card > h2, .card > h3 { margin: 0 0 14px; }
.card h2 { font-size: 18px; } .card h3 { font-size: 15px; font-weight: 650; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 0 0 16px; }
.card-head h2, .card-head h3 { margin: 0; display: inline-flex; align-items: center; gap: 9px; }
.card-head h3 .icon { color: var(--accent); }
.card-head > a { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.grid2 > .card { margin-bottom: 0; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 12px; }
.section-title h2 { margin: 0; font-size: 16px; }
.section-title a { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 18px; }
.toolbar .muted { display: inline-flex; align-items: center; gap: 6px; }
.lead { display: flex; align-items: center; gap: 8px; margin: 0 0 18px; font-size: 13px; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi { display: flex; gap: 14px; align-items: flex-start; padding: 18px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); min-width: 0; }
.kpi > div { min-width: 0; display: flex; flex-direction: column; }
.kpi label { font-size: 12px; font-weight: 600; color: var(--muted); }
.kpi b { font-size: 24px; font-weight: 750; letter-spacing: -.03em; line-height: 1.25; margin-top: 2px; overflow-wrap: anywhere; }
.kpi small { color: var(--muted); font-size: 12px; margin-top: 2px; }
.kpis.compact .kpi { padding: 14px 16px; } .kpis.compact .kpi b { font-size: 20px; }
.kpi-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.kpi-icon.up { color: var(--up); background: color-mix(in srgb, var(--up) 13%, transparent); }
.kpi-icon.down { color: var(--down); background: color-mix(in srgb, var(--down) 12%, transparent); }

/* ── flashes, banners, alerts ───────────────────────────────────────────────────────── */
.flash { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--radius-sm);
  margin: 0 0 18px; border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow); }
.flash.ok { border-color: color-mix(in srgb, var(--up) 40%, transparent); background: color-mix(in srgb, var(--up) 8%, var(--card)); }
.flash.ok .icon { color: var(--up); }
.flash.err { border-color: color-mix(in srgb, var(--down) 45%, transparent); color: var(--down); background: color-mix(in srgb, var(--down) 7%, var(--card)); }
.banner { padding: 14px 18px; border-radius: var(--radius-sm); margin-bottom: 18px; border: 1px solid; }
.banner.warn { border-color: color-mix(in srgb, var(--warn) 50%, transparent); background: color-mix(in srgb, var(--warn) 9%, var(--card)); }
.banner.bad { border-color: color-mix(in srgb, var(--down) 50%, transparent); background: color-mix(in srgb, var(--down) 8%, var(--card)); }
.banner.info { border-color: color-mix(in srgb, var(--info) 45%, transparent); background: color-mix(in srgb, var(--info) 7%, var(--card)); }
.alerts { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between;
  border: 1px solid color-mix(in srgb, var(--down) 50%, transparent); border-radius: var(--radius-sm);
  padding: 12px 14px; margin: 0 0 14px; background: color-mix(in srgb, var(--down) 8%, var(--card)); }
.alerts ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.alerts time { font: 12px var(--mono); color: var(--muted); margin-right: 6px; }
.alerts form { flex: none; }

/* ── buttons ────────────────────────────────────────────────────────────────────────── */
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 650 13.5px/1 var(--sans); height: 40px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--raised); color: var(--ink); cursor: pointer;
  text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s, transform .05s; }
button:hover, .button:hover { border-color: color-mix(in srgb, var(--ink) 22%, var(--line)); text-decoration: none; background: var(--card-2); }
button:active, .button:active { transform: translateY(1px); }
button.primary, .button.primary { border-color: transparent; color: var(--on-accent);
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, var(--accent-2)));
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 30%, transparent), inset 0 1px 0 rgba(255, 255, 255, .18); }
button.primary:hover, .button.primary:hover { filter: brightness(1.08); }
button.ghost, .button.ghost { background: transparent; }
button.danger { color: var(--down); border-color: color-mix(in srgb, var(--down) 40%, transparent); background: transparent; }
button.danger:hover { background: color-mix(in srgb, var(--down) 8%, transparent); }
button.stop-btn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent);
  background: color-mix(in srgb, var(--warn) 8%, transparent); }
button.small, .button.small { height: 32px; padding: 0 12px; font-size: 12.5px; }
button.block, .button.block { width: 100%; }
button.link { background: none; border: 0; color: var(--muted); height: auto; padding: 0; font-weight: 500; box-shadow: none; }
button.link:hover { color: var(--ink); background: none; }

/* ── forms ──────────────────────────────────────────────────────────────────────────── */
.form { display: grid; gap: 18px; max-width: 560px; }
.form label { display: grid; gap: 7px; font-weight: 600; font-size: 13.5px; }
.form small { color: var(--muted); font-weight: 400; font-size: 12.5px; line-height: 1.5; }
.form small.warn { color: var(--warn); }
.form.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: none; gap: 18px 24px; }
.form.two-col > button, .form.two-col > small { grid-column: 1 / -1; justify-self: start; }
input[type=text], input[type=password], input[type=number], select { font: 500 14px var(--sans);
  height: 42px; padding: 0 13px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--card-2); color: var(--ink); width: 100%; transition: border-color .15s, box-shadow .15s, background .15s; }
input:hover, select:hover { border-color: color-mix(in srgb, var(--ink) 20%, var(--line)); }
input:focus, select:focus { outline: none; border-color: var(--accent); background: var(--card);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; flex: none; }
.check { display: flex !important; align-items: center; gap: 12px; cursor: pointer; }
/* Checkboxes in Settings read as switches. */
.switch input[type=checkbox] { appearance: none; -webkit-appearance: none; width: 40px; height: 23px; border-radius: 99px;
  background: var(--line); position: relative; cursor: pointer; transition: background .2s; }
.switch input[type=checkbox]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s; }
.switch input[type=checkbox]:checked { background: var(--accent); }
.switch input[type=checkbox]:checked::after { transform: translateX(17px); }

/* Settings: sections in two columns, the save bar always in reach. */
.settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.settings .col { display: grid; gap: 20px; align-content: start; min-width: 0; }
.settings .card { margin: 0; }
.settings .form { max-width: none; }
.settings h3 { display: flex; align-items: center; gap: 10px; }
.sec-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent); }
.section-note { margin: -4px 0 18px; color: var(--muted); font-size: 13px; }
.savebar { position: sticky; bottom: 16px; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-top: 20px; padding: 12px 14px 12px 18px; border: 1px solid var(--line);
  border-radius: var(--radius); background: color-mix(in srgb, var(--card) 90%, transparent); backdrop-filter: blur(10px);
  box-shadow: var(--shadow-lg); }

/* ── tables ─────────────────────────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
th, td { text-align: left; padding: 12px 12px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
th { color: var(--muted); font-weight: 650; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  background: var(--card-2); border-bottom: 1px solid var(--line); }
thead th:first-child { border-top-left-radius: 10px; } thead th:last-child { border-top-right-radius: 10px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: color-mix(in srgb, var(--accent) 5%, transparent); }
th.num, td.num { text-align: right; }
td.why { white-space: normal; min-width: 260px; }
.scroll { overflow-x: auto; }
table.results td:first-child { font-weight: 600; white-space: nowrap; }
table.results td { white-space: normal; }
table.results td.num { white-space: nowrap; font-weight: 650; }
table.results tbody tr:hover td { background: none; }
table.score { max-width: 620px; margin-bottom: 8px; }
.score-head { font-size: 17px; margin: 0 0 10px; }
.row-link { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-size: 13px; }

/* ── dashboard: one card per bot ────────────────────────────────────────────────────── */
.accounts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 24px; }
.accounts.single { grid-template-columns: minmax(0, 2.4fr) minmax(0, 1fr); }
.bot-card { position: relative; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; background: var(--card); box-shadow: var(--shadow); overflow: hidden; }
.bot-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--muted); opacity: .5; }
.bot-card[data-state="TRAILING"]::before { background: var(--up); opacity: 1; }
.bot-card[data-state="ARMED"]::before, .bot-card[data-state="ENTRY_PENDING"]::before,
.bot-card[data-state="MODIFY_PENDING"]::before { background: linear-gradient(90deg, var(--accent), var(--accent-2)); opacity: 1; }
.bot-card[data-state="HALTED"]::before { background: var(--down); opacity: 1; }
.bot-card[data-state="SUSPENDED"]::before, .bot-card[data-state="OUTCOME_UNKNOWN"]::before,
.bot-card[data-state="RECONCILING"]::before { background: var(--warn); opacity: 1; }
.bot-card > header { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.who-am-i { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.bot-card .name { font-weight: 750; color: var(--ink); font-size: 17px; letter-spacing: -.02em; }
.bot-card header .state { margin-left: auto; }
.bot-body { display: grid; grid-template-columns: minmax(150px, 220px) minmax(0, 1fr); gap: 16px; align-items: stretch; }
.quote { display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 16px; border-radius: var(--radius-sm);
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 10%, var(--card-2)), var(--card-2));
  border: 1px solid var(--line-2); }
.quote label { font-size: 11px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.quote > b { font-size: 30px; font-weight: 750; letter-spacing: -.03em; line-height: 1.1; }
.quote details.market { margin: 4px 0 0; }
.numbers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.numbers .n { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 12px 14px;
  border-radius: var(--radius-sm); background: var(--card-2); border: 1px solid var(--line-2); }
.numbers .n label { color: var(--muted); font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.numbers .n b { font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
/* Protected-if-the-stop-fires-now is the headline; floating P&L stays secondary because it is
   the number that makes people close good trades early. */
.numbers .n.headline { border-color: color-mix(in srgb, var(--up) 35%, transparent); background: color-mix(in srgb, var(--up) 8%, var(--card)); }
.numbers .n.headline { grid-row: span 2; justify-content: center; }
.numbers .n.headline b { color: var(--up); font-size: 22px; }
.why { display: flex; gap: 8px; align-items: flex-start; margin: 14px 0 0; padding: 10px 12px; font-size: 13px;
  border-radius: var(--radius-sm); background: var(--card-2); border: 1px solid var(--line-2); color: var(--muted); }
.why::before { content: "i"; flex: none; width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center;
  font: 700 11px/1 var(--sans); color: var(--accent); border: 1.5px solid currentColor; margin-top: 1px; }
.bot-card .controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 16px; padding-top: 16px;
  border-top: 1px solid var(--line-2); justify-content: flex-start; }
.bot-card .controls form { display: inline-flex; margin: 0; }
.spacer { flex: 1; }
.add-card { align-items: center; justify-content: center; text-align: center; gap: 6px; min-height: 200px; color: var(--ink);
  border-style: dashed; border-width: 1.5px; background: transparent; box-shadow: none; transition: border-color .15s, background .15s; }
.add-card::before { display: none; }
.add-card:hover { text-decoration: none; border-color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, transparent); }
.add-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent); margin-bottom: 6px; }
.tag { font: 650 10.5px/1.7 var(--sans); padding: 0 7px; border-radius: 6px; border: 1px solid var(--line);
  color: var(--muted); background: var(--card-2); text-transform: uppercase; letter-spacing: .04em; }

/* State carries the colour, so it is read before the text. */
.state { display: inline-flex; align-items: center; gap: 8px; font: 700 11px/1 var(--sans); letter-spacing: .06em;
  text-transform: uppercase; padding: 7px 11px; border-radius: 99px; background: var(--card-2); border: 1px solid var(--line); white-space: nowrap; }
.state .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.state.big { font-size: 13px; padding: 10px 14px; }
.state.big .dot { width: 10px; height: 10px; }
body[data-state="TRAILING"] .state .dot, .bot-card[data-state="TRAILING"] .dot { background: var(--up);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--up) 22%, transparent); }
body[data-state="ARMED"] .state .dot, body[data-state="MODIFY_PENDING"] .state .dot, body[data-state="ENTRY_PENDING"] .state .dot,
.bot-card[data-state="ARMED"] .dot, .bot-card[data-state="MODIFY_PENDING"] .dot, .bot-card[data-state="ENTRY_PENDING"] .dot {
  background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
body[data-state="HALTED"] .state .dot, .bot-card[data-state="HALTED"] .dot { background: var(--down); }
body[data-state="SUSPENDED"] .state .dot, body[data-state="OUTCOME_UNKNOWN"] .state .dot, body[data-state="RECONCILING"] .state .dot,
.bot-card[data-state="SUSPENDED"] .dot, .bot-card[data-state="OUTCOME_UNKNOWN"] .dot, .bot-card[data-state="RECONCILING"] .dot { background: var(--warn); }
.live.pending .state .dot { animation: pulse 1s infinite; background: var(--accent); }
@keyframes pulse { 50% { opacity: .3; } }

/* ── live view: chart and position on the left, control on the right ────────────────── */
.live-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; margin-bottom: 20px; }
.live-main, .live-side { display: grid; gap: 20px; min-width: 0; }
.live-main > .card, .live-side > .card { margin: 0; }
.quote-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.sym { font-weight: 700; font-size: 13px; color: var(--muted); letter-spacing: .02em; }
.sym small { font-weight: 500; font-size: 13px; }
.pricebox { display: flex; align-items: baseline; gap: 14px; margin-top: 2px; }
.price { font: 750 clamp(36px, 5vw, 50px)/1.05 var(--sans); letter-spacing: -.035em; }
.move { font-size: 15px; font-weight: 650; color: var(--muted); }
.lastknown .price, .lastknown .stats b, .lastknown .track { opacity: .5; }
.market-row details.market { margin: 0; }
.chart { position: relative; padding: 12px; border-radius: var(--radius-sm); background: var(--card-2); border: 1px solid var(--line-2); }
.chart canvas { display: block; width: 100%; height: 360px; }
.tfs, .speeds { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); }
.tfs { margin-bottom: 10px; }
.tfs button, .speeds button { height: 28px; padding: 0 11px; font: 650 12px var(--sans); border-radius: 7px;
  border: 0; background: none; color: var(--muted); box-shadow: none; }
.tfs button:hover, .speeds button:hover { color: var(--ink); background: var(--card-2); }
.tfs button.on, .speeds button.on { color: var(--on-accent); background: var(--accent); }
.position-card .meta { font-size: 12px; color: var(--muted); }

.track { position: relative; height: 70px; margin: 18px 10px 40px; }
.track::before { content: ""; position: absolute; left: 0; right: 0; top: 34px; height: 2px; background: var(--line); border-radius: 2px; }
.track .band, .track .gap { position: absolute; top: 28px; height: 14px; border-radius: 5px; transition: all .4s ease; }
.track .band.locked { background: var(--locked); } .track .band.risk { background: var(--risk); }
.track .gap { top: 44px; height: 4px; background: var(--gap); }
.track .m { position: absolute; top: 22px; width: 2px; height: 26px; transform: translateX(-1px); transition: left .4s ease; }
.track .m span { position: absolute; white-space: nowrap; font: 650 11.5px var(--sans); transform: translateX(-50%); }
.m-entry { background: var(--muted); } .m-entry span { top: -20px; color: var(--muted); }
.m-sl { background: var(--down); width: 3px; } .m-sl span { top: 30px; color: var(--down); }
.m-extremum { background: var(--up); } .m-extremum span { top: -20px; color: var(--up); }
.m-tp { background: var(--up); width: 3px; } .m-tp span { top: 30px; color: var(--up); }
/* The price that moves the stop next: a tall gold line with its value, as on the chart; earlier
   positions stay behind it as faded ticks. Its label sits below the SL's. */
.track .m-trigger { top: 8px; height: 50px; width: 3px; transform: translateX(-1.5px); background: var(--warn);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 22%, transparent); }
.m-trigger span { top: 60px; color: var(--warn); font-weight: 750; font-size: 12.5px; }
.trail-tick { position: absolute; top: 26px; width: 2px; height: 18px; transform: translateX(-1px); border-radius: 1px;
  background: var(--warn); opacity: .35; transition: left .4s ease; }
.m-price { background: var(--ink); width: 14px !important; height: 14px !important; border-radius: 50%; top: 28px !important;
  transform: translate(-7px, 0) !important; box-shadow: 0 0 0 4px var(--card), 0 0 0 6px color-mix(in srgb, var(--accent) 40%, transparent); }

.stats { display: grid; grid-template-columns: 1.6fr repeat(4, minmax(0, 1fr)); gap: 10px; }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 13px 14px; border-radius: var(--radius-sm);
  background: var(--card-2); border: 1px solid var(--line-2); min-width: 0; }
.stat label { font-size: 11px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat b { font-size: 18px; font-weight: 700; }
.stat.headline { border-color: color-mix(in srgb, var(--accent) 30%, transparent); background: color-mix(in srgb, var(--accent) 7%, var(--card)); }
.stat.headline b { font-size: 26px; letter-spacing: -.02em; }
.stat small { color: var(--muted); font-size: 12px; }
.flat { display: flex; gap: 16px; align-items: flex-start; padding: 6px 2px 4px; }
.flat-icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; flex: none; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent); }
.flat .big { font-size: 17px; font-weight: 700; margin: 2px 0 4px; }
.flat .muted { margin: 0; }

.control-card .status-block { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.controls { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center; }
.controls form { margin: 0; }
.controls.stack { display: grid; gap: 10px; justify-content: stretch; }
.controls.stack form, .controls.stack button { width: 100%; }
.controls.stack button { height: 46px; font-size: 14.5px; white-space: normal; line-height: 1.25; text-align: center; }
form.start { display: inline-flex; gap: 8px; align-items: stretch; }
.side-link { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 12px; border-radius: var(--radius-sm);
  color: var(--ink); background: var(--card-2); border: 1px solid var(--line-2); font-size: 13px; font-weight: 600; }
.side-link span { flex: 1; } .side-link .icon { color: var(--muted); }
.side-link:hover { text-decoration: none; border-color: var(--accent); }
.safety { display: flex; gap: 8px; align-items: flex-start; margin: 14px 0 0; font-size: 12px; color: var(--muted); }
.safety .icon { color: var(--up); margin-top: 1px; }

details.market { font-size: 12.5px; margin: 0 0 12px; }
details.market summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted); padding: 5px 11px; border-radius: 99px; background: var(--card); border: 1px solid var(--line); }
details.market summary::-webkit-details-marker { display: none; }
details.market summary b { font-weight: 700; color: var(--ink); }
details.market[data-dir="UP"] summary { border-color: color-mix(in srgb, var(--up) 35%, transparent); }
details.market[data-dir="UP"] summary b { color: var(--up); }
details.market[data-dir="DOWN"] summary { border-color: color-mix(in srgb, var(--down) 35%, transparent); }
details.market[data-dir="DOWN"] summary b { color: var(--down); }
details.market p { margin: 6px 0 0; }

.kv { display: grid; grid-template-columns: auto 1fr; margin: 0; font-size: 13px; }
.kv dt, .kv dd { padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.kv dt { color: var(--muted); padding-right: 14px; }
.kv dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.kv dt:last-of-type, .kv dd:last-of-type { border-bottom: 0; }

.feed { list-style: none; margin: 0; padding: 0; max-height: 380px; overflow: auto; font-size: 13.5px; }
.feed li { display: flex; gap: 12px; align-items: baseline; padding: 9px 4px 9px 18px; border-bottom: 1px solid var(--line-2); position: relative; }
.feed li::before { content: ""; position: absolute; left: 3px; top: 15px; width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.feed li.sev-info::before { background: var(--accent); }
.feed li.sev-warn::before { background: var(--warn); }
.feed li.sev-critical::before { background: var(--down); }
.feed li:last-child { border-bottom: 0; }
.feed time { color: var(--muted); font: 11.5px var(--mono); flex: none; }
.feed .sev-warn { color: var(--warn); } .feed .sev-critical { color: var(--down); font-weight: 600; }
.feed .fresh { animation: fade 1.5s ease; }
@keyframes fade { from { background: var(--gap); } }

/* ── setup ──────────────────────────────────────────────────────────────────────────── */
.steps { list-style: none; padding: 0; display: grid; gap: 8px; font-size: 13.5px; }
.steps li { display: flex; gap: 8px; }
.steps li::before { content: "✓"; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; flex: none;
  font-size: 11px; font-weight: 800; color: var(--up); background: color-mix(in srgb, var(--up) 14%, transparent); }
.steps li.cur::before { content: "…"; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }

/* ── login ──────────────────────────────────────────────────────────────────────────── */
.auth-page main { max-width: none; padding: 16px; }
.login { max-width: 420px; margin: 12vh auto 0; }
.login .brand.big { font-size: 18px; margin: 0 0 22px; padding: 0; }
.login .brand.big .mark { width: 42px; height: 42px; border-radius: 12px; }
.login .card { padding: 28px; box-shadow: var(--shadow-lg); }
.login h2 { margin: 0 0 4px; font-size: 20px; }
.login .card > p { margin: 0 0 20px; }

/* ── AI card, trade replay ──────────────────────────────────────────────────────────── */
.ai-card .ai-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.ai-card .ai-action { font-weight: 700; text-transform: uppercase; }
.ai-card .ai-action.buy { color: var(--up); } .ai-card .ai-action.sell { color: var(--down); }
blockquote { margin: 10px 0; padding: 12px 16px; border-left: 3px solid var(--accent); background: var(--card-2); border-radius: 0 10px 10px 0; }
.verdict { font-size: 12px; font-weight: 600; }
.verdict.entered { color: var(--up); } .verdict.error, .verdict.rejected { color: var(--down); }
pre.scroll { font: 12px/1.5 var(--mono); background: var(--card-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.replay canvas { display: block; width: 100%; height: 360px; border-radius: var(--radius-sm); background: var(--card-2); border: 1px solid var(--line-2); }
.replay-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.replay-controls input[type=range] { flex: 1; min-width: 160px; accent-color: var(--accent); }
.replay-controls #replay-play { min-width: 100px; }
#replay-clock { font: 12px var(--mono); }
.replay-caption { min-height: 3em; margin: 12px 0 4px; font-weight: 600; }
.replay-caption.breakeven, .replay-caption.exit-up { color: var(--up); }
.replay-caption.refused, .replay-caption.exit-down { color: var(--down); }
.replay-key { font-size: 12px; }
.key { display: inline-block; width: 14px; height: 0; vertical-align: middle; border-top: 2px solid; }
.k-price { border-color: var(--ink); } .k-other { border-color: var(--line); }
.k-sl { border-color: var(--down); } .k-entry { border-color: var(--muted); border-top-style: dashed; }
.k-tp { border-color: var(--up); } .k-order { border-color: var(--warn); border-top-style: dotted; }

/* ── history: the trading record ────────────────────────────────────────────────────── */
.chips { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 4px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.chips a { padding: 7px 14px; border-radius: 8px; color: var(--muted); font-size: 13px; font-weight: 650; }
.chips a:hover { color: var(--ink); text-decoration: none; background: var(--card-2); }
.chips a.on { color: var(--on-accent); background: var(--accent); box-shadow: 0 3px 10px color-mix(in srgb, var(--accent) 30%, transparent); }
.periods { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.period { margin-bottom: 0; display: flex; flex-direction: column; }
.period header { display: flex; align-items: center; gap: 10px; }
.period header .kpi-icon { width: 32px; height: 32px; border-radius: 9px; }
.period header h3 { margin: 0; font-size: 13.5px; font-weight: 650; }
.period header small { margin-left: auto; font-size: 11.5px; }
.period .net { font-size: 30px; font-weight: 750; letter-spacing: -.035em; line-height: 1.15; margin-top: 16px; }
.period .net-label { margin: 2px 0 14px; font-size: 12px; }
.period .wl { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; }
.period p { margin: 4px 0 0; }
.period p.small { margin-bottom: 14px; }
.winbar { height: 6px; border-radius: 99px; margin-top: 12px; overflow: hidden; background: color-mix(in srgb, var(--down) 28%, transparent); }
.winbar span { display: block; height: 100%; background: linear-gradient(90deg, var(--up), color-mix(in srgb, var(--up) 70%, var(--accent-2))); border-radius: 99px; }
.period dl.money { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: auto 0 0; padding-top: 12px;
  border-top: 1px solid var(--line-2); font-size: 13px; }
.period dl.money dt { color: var(--muted); }
.period dl.money dd { margin: 0; text-align: right; font-weight: 650; }
.periods + p { margin: 10px 0 20px; }
.curve-total { font-size: 20px; font-weight: 750; letter-spacing: -.02em; }
.curve { display: block; width: 100%; height: 220px; overflow: visible; }
.curve .zero { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 5; opacity: .5; vector-effect: non-scaling-stroke; }
.curve .line { fill: none; stroke: var(--up); stroke-width: 2.5; stroke-linejoin: round; }
.curve .c-top { stop-color: var(--up); stop-opacity: .28; } .curve .c-bottom { stop-color: var(--up); stop-opacity: 0; }
.curve.neg .line { stroke: var(--down); } .curve.neg .c-top, .curve.neg .c-bottom { stop-color: var(--down); }
table.daily td, table.trades td { vertical-align: middle; }
table.daily .bar-col { width: 22%; min-width: 90px; }
.daybar { display: block; height: 8px; border-radius: 99px; background: var(--muted); min-width: 3px; }
.daybar.up { background: var(--up); } .daybar.down { background: var(--down); }
.badge { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 99px; }
.badge.buy, .badge.won { color: var(--up); background: color-mix(in srgb, var(--up) 13%, transparent); }
.badge.sell, .badge.lost { color: var(--down); background: color-mix(in srgb, var(--down) 12%, transparent); }
.pager { display: flex; gap: 16px; margin: 14px 0 0; }
details.advanced > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
details.advanced > summary::-webkit-details-marker { display: none; }
details.advanced > summary h3 { display: inline; margin: 0; font-size: 14px; color: var(--muted); }
details.advanced > summary::before { content: "▸"; color: var(--muted); }
details.advanced[open] > summary::before { content: "▾"; }
details.advanced h4 { margin: 24px 0 10px; font-size: 14px; }

/* ── live page: results, account, activity ──────────────────────────────────────────── */
.results-activity { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; margin-bottom: 20px; align-items: start; }
.results-activity > .card { margin: 0; }
.res-tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.res-tile { grid-column: span 2; }
.res-tile:nth-child(n+4) { grid-column: span 3; }
@media (max-width: 680px) { .res-tiles { grid-template-columns: 1fr; } .res-tile, .res-tile:nth-child(n+4) { grid-column: auto; } }
.res-tile { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--card-2); border: 1px solid var(--line-2); min-width: 0; }
.res-tile label { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 11px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.res-tile > b { font-size: 22px; font-weight: 750; letter-spacing: -.02em; line-height: 1.2; }
.res-tile small { font-size: 12px; line-height: 1.45; }
.chip { font: 700 10px/1 var(--sans); letter-spacing: .04em; text-transform: uppercase; padding: 4px 7px; border-radius: 99px;
  color: var(--muted); background: var(--line-2); white-space: nowrap; }
.chip.ok { color: var(--up); background: color-mix(in srgb, var(--up) 14%, transparent); }
.chip.bad { color: var(--down); background: color-mix(in srgb, var(--down) 13%, transparent); }
.split { display: flex; gap: 3px; height: 6px; border-radius: 99px; overflow: hidden; }
.split span { border-radius: 99px; min-width: 3px; }
.split .up { background: var(--up); } .split .down { background: var(--down); }
.gauge { position: relative; height: 8px; border-radius: 99px; background: var(--line); }
.gauge .fill { position: absolute; inset: 0 auto 0 0; border-radius: 99px; }
.gauge .fill.up { background: var(--up); } .gauge .fill.down { background: var(--down); }
.gauge .tick { position: absolute; top: -3px; width: 2px; height: 14px; border-radius: 2px; transform: translateX(-1px); }
.gauge .tick.target { background: var(--ink); }
.gauge .tick.be { background: var(--warn); }
.exits { margin-top: 16px; padding: 14px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); }
.exits > label { display: block; font-size: 11px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 10px; }
.exit-bar { display: flex; gap: 3px; height: 10px; border-radius: 99px; overflow: hidden; }
.exit-bar span { min-width: 4px; }
.legend { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.9; }
.legend span { white-space: nowrap; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.x-tp { background: var(--up); } .x-tw { background: color-mix(in srgb, var(--up) 45%, var(--accent-2)); }
.x-tl { background: var(--down); } .x-time { background: var(--warn); } .x-cmd { background: var(--accent); } .x-other { background: var(--muted); }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 28px 12px; text-align: center;
  border: 1.5px dashed var(--line); border-radius: var(--radius-sm); }
.target-note { display: flex; gap: 6px; align-items: flex-start; margin: 14px 0 0; }
.target-note .icon { margin-top: 2px; }

.acct { display: grid; gap: 14px; }
.acct-hero { padding: 16px; border-radius: var(--radius-sm); border: 1px solid var(--line-2);
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 12%, var(--card-2)), var(--card-2)); }
.acct-hero label, .acct-pair label { display: block; font-size: 11px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.acct-hero b { display: block; font-size: 26px; font-weight: 750; letter-spacing: -.03em; line-height: 1.25; margin-top: 2px; }
.acct-hero b small { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.delta { display: inline-block; margin-top: 4px; font-size: 12px; font-weight: 650; padding: 3px 8px; border-radius: 99px;
  background: var(--line-2); color: var(--muted); }
.delta.up { color: var(--up); background: color-mix(in srgb, var(--up) 13%, transparent); }
.delta.down { color: var(--down); background: color-mix(in srgb, var(--down) 12%, transparent); }
.acct-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.acct-pair > div { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--card-2); border: 1px solid var(--line-2); }
.acct-pair b { font-size: 15px; font-weight: 700; }
.meter-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; margin-bottom: 6px; }
.meter-head span { color: var(--muted); font-weight: 600; } .meter-head b { font-weight: 650; }
.meter-bar { height: 7px; border-radius: 99px; background: var(--line); overflow: hidden; }
.meter-bar span { display: block; height: 100%; border-radius: 99px; min-width: 3px; transition: width .4s ease; }
.meter-bar .up { background: var(--up); } .meter-bar .warn { background: var(--warn); } .meter-bar .down { background: var(--down); }
.acct .kv { padding-top: 4px; border-top: 1px solid var(--line-2); }
.status { display: inline-flex; align-items: center; gap: 6px; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.status.ok::before { background: var(--up); box-shadow: 0 0 0 3px color-mix(in srgb, var(--up) 22%, transparent); }
.status.wait::before { background: var(--warn); } .status.bad::before { background: var(--down); }

.small-chips { margin-bottom: 12px; }
.small-chips a { padding: 5px 11px; font-size: 12px; }
.timeline { list-style: none; margin: 0; padding: 0; max-height: 520px; overflow: auto; }
.ev { display: flex; gap: 12px; position: relative; padding: 0 2px 14px; }
.ev:not(:last-child)::after { content: ""; position: absolute; left: 16px; top: 34px; bottom: 2px; width: 1.5px; background: var(--line-2); }
.ev-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none;
  color: var(--muted); background: var(--card-2); border: 1px solid var(--line-2); }
.tone-up .ev-icon { color: var(--up); background: color-mix(in srgb, var(--up) 12%, transparent); border-color: transparent; }
.tone-down .ev-icon { color: var(--down); background: color-mix(in srgb, var(--down) 12%, transparent); border-color: transparent; }
.tone-warn .ev-icon { color: var(--warn); background: color-mix(in srgb, var(--warn) 13%, transparent); border-color: transparent; }
.tone-accent .ev-icon { color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, transparent); border-color: transparent; }
.ev-body { min-width: 0; padding-top: 4px; }
.ev-body p { margin: 0; font-size: 13px; line-height: 1.45; }
.tone-down .ev-body p { color: var(--down); }
.ev-body time { display: block; margin-top: 2px; font: 11px var(--mono); color: var(--muted); }
.ev.fresh .ev-body { animation: fade 1.5s ease; border-radius: 6px; }

/* ── account tabs and the account's History tab ─────────────────────────────────────── */
.tabs { display: flex; gap: 4px; margin: -8px 0 22px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 11px 16px; color: var(--muted); font-weight: 650;
  font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }
.tabs a.on .icon { color: var(--accent); }
.period-switch { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.period-switch a { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line); color: var(--ink); box-shadow: var(--shadow);
  transition: border-color .15s, background .15s, transform .1s; }
.period-switch a:hover { text-decoration: none; border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.period-switch a span { font-size: 12px; font-weight: 650; color: var(--muted); }
.period-switch a b { font-size: 19px; font-weight: 750; letter-spacing: -.02em; }
.period-switch a small { font-size: 11.5px; color: var(--muted); }
.period-switch a.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--card));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent), var(--shadow); }
.period-switch a.on span { color: var(--accent); }
.period-hero { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 18px 28px; align-items: center; }
.period-hero .curve, .period-hero > p { grid-column: 1 / -1; }
.period-hero > p { margin: -8px 0 0; }
.period-hero .curve { height: 160px; }
.hero-main label { font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.hero-net { font-size: 44px; font-weight: 800; letter-spacing: -.04em; line-height: 1.1; margin: 6px 0 4px; }
.hero-main p { margin: 0; font-size: 13px; }
.hero-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.hero-stats > div { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--card-2); border: 1px solid var(--line-2); min-width: 0; }
.hero-stats label { display: block; font-size: 11px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.hero-stats b { font-size: 18px; font-weight: 750; }
.hero-stats .winbar { margin-top: 6px; }

/* ── smaller screens ────────────────────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  .live-grid { grid-template-columns: 1fr; }
  .results-activity { grid-template-columns: 1fr; }
  .live-side { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat.headline { grid-column: span 3; }
  .accounts, .accounts.single { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .period-hero { grid-template-columns: 1fr; }
  .period-switch { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar { display: none; }
  .topbar { padding: 12px 18px; min-height: 64px; }
  .topbar .brand.compact { display: inline-flex; }
  .mobile-nav { display: flex; gap: 6px; overflow-x: auto; padding: 10px 18px; border-bottom: 1px solid var(--line-2);
    background: var(--bg); scrollbar-width: none; }
  .mobile-nav a { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 99px; white-space: nowrap;
    color: var(--muted); font-weight: 600; font-size: 13px; border: 1px solid var(--line); background: var(--card); }
  .mobile-nav a.on { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
  .mobile-nav a:hover { text-decoration: none; }
  main { padding: 20px 18px 8px; }
  .kpis, .periods { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .topbar h1 { font-size: 18px; }
  .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar .heading p { display: none; }
  .grid2, .live-side { grid-template-columns: 1fr; }
  .bot-body { grid-template-columns: 1fr; }
  .numbers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat.headline { grid-column: 1 / -1; }
  .form.two-col { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .kpi b { font-size: 20px; }
  .spacer { display: none; }
}
@media (max-width: 460px) { .kpis, .periods { grid-template-columns: 1fr; } }

.k-target { border-color: var(--warn); border-top-style: dashed; }
