/* AlgoAdmin design system: tokens (space, radius, type, colour, charts), shell, components, then page-specific parts. */
/* Inter (variable, 100–900), latin + latin-ext + vietnamese subsets, served locally (SIL Open Font License) */
@font-face { font-family: "InterVariable"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(/static/vendor/fonts/inter-vietnamese.woff2) format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "InterVariable"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(/static/vendor/fonts/inter-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "InterVariable"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(/static/vendor/fonts/inter-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
/* ---------------------------------------------------------------- tokens */
:root {
  /* space, radius, type, motion (same in both themes) */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-xl: 16px; --r-pill: 999px;
  --fs-xs: 11px; --fs-sm: 12px; --fs-base: 14px; --fs-md: 15px; --fs-lg: 18px; --fs-xl: 22px; --fs-2xl: 28px;
  --font: "InterVariable", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(.2, .7, .3, 1);
  --gutter: 24px; --control-h: 36px; --sidebar-w: 240px;
}
:root, :root[data-theme="dark"] {
  --bg: #0b0f17; --surface: #121826; --surface-2: #182033; --surface-3: #1f2940; --border: #232d44; --border-2: #2f3b58;
  --text: #e6eaf2; --text-2: #a3adc0; --text-3: #7d889e;
  --primary: #4c8dff; --primary-2: #2f6fe8; --primary-soft: rgba(76, 141, 255, .14); --on-primary: #fff;
  --up: #22c55e; --up-soft: rgba(34, 197, 94, .13); --down: #f05252; --down-soft: rgba(240, 82, 82, .13);
  --warn: #f5a524; --warn-soft: rgba(245, 165, 36, .14); --info: #38bdf8; --info-soft: rgba(56, 189, 248, .13);
  --live: #f05252; --demo: #38bdf8;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3); --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .22);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, .5); --scrim: rgba(5, 8, 15, .62);
  --focus: 0 0 0 3px rgba(76, 141, 255, .45);
  /* charts: actual result, backtest / benchmark, balance, and a fixed set for one line per account */
  --chart-actual: #4c8dff; --chart-bench: #a78bfa; --chart-balance: #7d889e; --chart-grid: rgba(255, 255, 255, .06);
  --chart-1: #4c8dff; --chart-2: #f5a524; --chart-3: #2dd4bf; --chart-4: #a78bfa; --chart-5: #f472b6; --chart-6: #a3e635; --chart-7: #fb923c; --chart-8: #94a3b8;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4f6fa; --surface: #ffffff; --surface-2: #f7f9fc; --surface-3: #eef2f8; --border: #e3e8f0; --border-2: #d4dbe6;
  --text: #111827; --text-2: #4f596c; --text-3: #687186;
  --primary: #2f6fe8; --primary-2: #1f5ad1; --primary-soft: rgba(47, 111, 232, .1); --on-primary: #fff;
  --up: #16a34a; --up-soft: rgba(22, 163, 74, .1); --down: #dc2626; --down-soft: rgba(220, 38, 38, .09);
  --warn: #c2680a; --warn-soft: rgba(217, 119, 6, .11); --info: #0284c7; --info-soft: rgba(2, 132, 199, .09);
  --live: #dc2626; --demo: #0284c7;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05); --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 6px 18px rgba(16, 24, 40, .06);
  --shadow-lg: 0 24px 60px rgba(16, 24, 40, .18); --scrim: rgba(15, 23, 42, .38);
  --focus: 0 0 0 3px rgba(47, 111, 232, .35);
  --chart-actual: #2f6fe8; --chart-bench: #7c3aed; --chart-balance: #8a93a6; --chart-grid: rgba(15, 23, 42, .07);
  --chart-1: #2f6fe8; --chart-2: #d97706; --chart-3: #0d9488; --chart-4: #7c3aed; --chart-5: #db2777; --chart-6: #65a30d; --chart-7: #ea580c; --chart-8: #64748b;
  color-scheme: light;
}

/* ---------------------------------------------------------------- base */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: var(--fs-base)/1.5 var(--font);
  font-feature-settings: "cv11", "ss01", "ss03"; -webkit-font-smoothing: antialiased; letter-spacing: -0.005em; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h4 { font-size: var(--fs-md); font-weight: 650; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
.num, td.num, th.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.mono { font-family: var(--font-mono); font-size: 12px; }
.muted { color: var(--text-2); } .faint { color: var(--text-3); } .small { font-size: var(--fs-sm); } .xs { font-size: var(--fs-xs); }
.up { color: var(--up); } .down { color: var(--down); } .warn-t { color: var(--warn); }
.ccy { font-size: 10.5px; font-weight: 600; color: var(--text-3); margin-left: 4px; letter-spacing: .3px; }
.nowrap { white-space: nowrap; }
.wrap-any { overflow-wrap: anywhere; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: fixed; left: 12px; top: -60px; z-index: 300; padding: 8px 14px; border-radius: var(--r-md); background: var(--primary); color: var(--on-primary); font-weight: 600; }
.skip:focus { top: 12px; }
#app:focus { outline: none; box-shadow: none; }
svg[aria-hidden] { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
.kpi .l svg { width: 14px; height: 14px; color: var(--text-3); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 14px 10px; overflow-y: auto; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 14px; font-weight: 700; font-size: 16px; letter-spacing: .2px; }
.brand-mark { width: 30px; height: 30px; border-radius: var(--r-md); background: linear-gradient(135deg, var(--primary), #8b5cf6); display: grid; place-items: center; color: #fff; }
.brand small { display: block; font-size: var(--fs-xs); font-weight: 500; color: var(--text-3); letter-spacing: 0; margin-top: -2px; }
.nav-group { margin: 14px 0 4px; padding: 0 10px; font-size: var(--fs-xs); font-weight: 650; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; }
.nav a { position: relative; display: flex; align-items: center; gap: 10px; padding: 7px 10px; margin: 1px 0; border-radius: var(--r-md); color: var(--text-2); font-weight: 520; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav a.active::before { content: ""; position: absolute; left: -10px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); }
.nav a .count { margin-left: auto; font-size: var(--fs-xs); font-weight: 650; background: var(--down); color: #fff; border-radius: var(--r-pill); padding: 0 6px; min-width: 18px; text-align: center; }
.nav a .count.warn { background: var(--warn); }
.nav svg { width: 17px; height: 17px; flex: none; }
.sidebar-foot { margin-top: auto; padding: 12px 10px 4px; border-top: 1px solid var(--border); font-size: var(--fs-xs); color: var(--text-3); display: flex; flex-direction: column; gap: 6px; }
.svc { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: var(--fs-sm); }
.svc .when { margin-left: auto; color: var(--text-3); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.sdot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.sdot.ok { background: var(--up); } .sdot.warning { background: var(--warn); } .sdot.critical { background: var(--down); }
.sdot.ok.pulse { box-shadow: 0 0 0 0 var(--up-soft); animation: sdot 2.4s ease-out infinite; }
@keyframes sdot { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--up) 45%, transparent); } 70%, 100% { box-shadow: 0 0 0 6px transparent; } }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 12px var(--gutter); background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.topbar .ttl { min-width: 0; }
.topbar h1 { font-size: var(--fs-lg); margin: 0; font-weight: 680; letter-spacing: -.01em; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .sub { color: var(--text-2); font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.topbar .tb-actions { display: flex; align-items: center; gap: 4px; }
.topbar { flex-wrap: wrap; }
/* the pages of a section, as tabs under the title, sitting on the top bar's bottom border */
.subnav { flex: 1 0 100%; order: 11; display: flex; gap: 4px; margin: 2px 0 -13px; overflow-x: auto; scrollbar-width: none; }
.subnav::-webkit-scrollbar { display: none; }
.subnav a { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px 10px; border-bottom: 2px solid transparent; color: var(--text-2); font-weight: 560; white-space: nowrap; }
.subnav a:first-child { margin-left: -12px; }
.subnav a:hover { color: var(--text); text-decoration: none; }
.subnav a.on { color: var(--primary); border-bottom-color: var(--primary); font-weight: 620; }
.subnav .count { font-size: var(--fs-xs); font-weight: 650; background: var(--down); color: #fff; border-radius: var(--r-pill); padding: 0 6px; min-width: 18px; text-align: center; }
.subnav .count.warn { background: var(--warn); }
/* global status: worst of hub / reader / trade log, and the open alerts */
.status-pill { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px; border-radius: var(--r-pill); border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; }
.status-pill:hover { text-decoration: none; color: var(--text); border-color: var(--border-2); }
.status-pill.warning { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.status-pill.critical { background: var(--down-soft); border-color: transparent; color: var(--down); }
.content { padding: 20px var(--gutter) 64px; max-width: 1480px; width: 100%; margin: 0 auto; min-width: 0; }
.page-actions, .toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; min-width: 0; }
.page-actions .grow, .toolbar .grow { flex: 1; }
.page-actions > *, .toolbar > * { min-width: 0; max-width: 100%; }
.page-note { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: var(--fs-sm); }
.page-note svg { width: 15px; height: 15px; color: var(--text-3); }
p.page-note { margin-bottom: 0; align-items: flex-start; } p.page-note svg { margin-top: 2px; }
/* filter bar that stays under the top bar while scrolling (stuck: frosted like the top bar) */
.sticky-bar { position: sticky; top: calc(var(--topbar-h, 64px) - 1px); z-index: 15; margin: -10px calc(-1 * var(--gutter)) 6px; padding: 10px var(--gutter); transition: background .15s, box-shadow .15s; }
.sticky-bar.stuck { background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); box-shadow: 0 1px 0 var(--border), 0 10px 18px -16px rgba(0, 0, 0, .45); }

/* overview: what needs the owner now, worst first */
.ov-att > .ov-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); min-width: 0; }
.ov-att > .ov-row:first-child { border-top: 0; padding-top: 0; }
.ov-att > .ov-row:last-child { padding-bottom: 0; }
.ov-ic { width: 32px; height: 32px; border-radius: var(--r-md); display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--text-2); }
.ov-row.critical .ov-ic { background: var(--down-soft); color: var(--down); }
.ov-row.warning .ov-ic { background: var(--warn-soft); color: var(--warn); }
.ov-row.info .ov-ic { background: var(--info-soft); color: var(--info); }
.ov-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ov-t b { font-weight: 560; overflow-wrap: anywhere; }
@media (max-width: 520px) { .ov-att > .ov-row { flex-wrap: wrap; } .ov-row > .btn { margin-left: 44px; } }
.ov-t span { color: var(--text-2); font-size: var(--fs-sm); overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: var(--r-md); border: 1px solid var(--border-2); background: var(--surface); color: var(--text); font: inherit; font-weight: 560; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, color .12s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-2); border-color: var(--primary-2); }
.btn.danger { background: var(--down); border-color: var(--down); color: #fff; }
.btn.danger:hover { background: color-mix(in srgb, var(--down) 86%, #000); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { height: 28px; padding: 0 10px; font-size: var(--fs-sm); border-radius: 7px; }
.btn.icon { width: 34px; padding: 0; }
.btn.sm.icon { width: 28px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.burger { display: none; }
.btn.danger-outline { color: var(--down); border-color: color-mix(in srgb, var(--down) 45%, var(--border)); }
.btn.danger-outline:hover { background: var(--down-soft); }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { border: 0; background: transparent; color: var(--text-2); font: inherit; font-weight: 560; font-size: 13px; padding: 5px 12px; border-radius: 7px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.seg .dot { width: 7px; height: 7px; border-radius: 50%; }
/* the account-type switch: viewing live money is never ambiguous */
.seg.acct button.on[data-seg="live"] { background: var(--down-soft); color: var(--live); box-shadow: 0 0 0 1px color-mix(in srgb, var(--live) 40%, transparent); }
.seg.acct button.on[data-seg="demo"] { background: var(--info-soft); color: var(--demo); box-shadow: 0 0 0 1px color-mix(in srgb, var(--demo) 35%, transparent); }
/* on/off chips (several can be on, unlike .seg) */
.chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--border); background: transparent; color: var(--text-3); font: inherit; font-size: 12.5px; font-weight: 560; padding: 4px 11px 4px 9px; border-radius: var(--r-pill); cursor: pointer; display: inline-flex; align-items: center; gap: 7px; transition: background .12s, color .12s; }
.chip i { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid currentColor; }
.chip:hover { color: var(--text-2); }
.chip.on { background: var(--surface-2); border-color: var(--border-2); color: var(--text); }
.chip.on i { background: var(--sw, var(--primary)); border-color: var(--sw, var(--primary)); }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r-md); padding: 7px 10px; outline: none; max-width: 100%; min-width: 0; transition: border-color .12s, box-shadow .12s; }
select { height: var(--control-h); padding-right: 28px; text-overflow: ellipsis; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--text-3) 60%, var(--border-2)); }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: var(--focus); }
input::placeholder, textarea::placeholder { color: var(--text-3); }
input[type=checkbox] { accent-color: var(--primary); width: 15px; height: 15px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: var(--fs-sm); color: var(--text-2); font-weight: 560; min-width: 0; max-width: 100%; }
.field input, .field select, .field textarea { font-size: var(--fs-base); font-weight: 400; width: 100%; }
.field input:not([type=checkbox]):not([type=file]), .field select { height: var(--control-h); }  /* inputs and selects line up in a row */
.field input[type=checkbox] { width: 15px; }
/* usage against a cap */
.mem-cell { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.meter { width: 96px; height: 5px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 3px; background: var(--primary); }
.meter.warning i { background: var(--warn); } .meter.critical i { background: var(--down); }
.picks { display: flex; flex-wrap: wrap; gap: 6px; }
.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; min-width: 0; }
.form-row > .field { flex: 1 1 160px; }
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-size: 13px; cursor: pointer; }
.hint { font-size: var(--fs-sm); color: var(--text-2); margin-top: 6px; line-height: 1.55; }

/* ---------------------------------------------------------------- cards, kpis */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); min-height: 52px; }
.card-h h3 { margin: 0; font-size: var(--fs-base); font-weight: 660; display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-h h3 svg { width: 16px; height: 16px; color: var(--text-3); }
.card-h .sub { color: var(--text-2); font-size: var(--fs-sm); min-width: 0; }
.card-h .right { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.card-b { padding: 16px 18px; min-width: 0; }
.card-b.flush { padding: 0; }
.card-b.flush > .tbl-wrap:last-child { border-radius: 0 0 var(--r-xl) var(--r-xl); }
.sec-h { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin: 4px 0 10px; }
.sec-h h4 { margin: 0; }
.sec-h .sub { color: var(--text-3); font-size: var(--fs-sm); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-chart { grid-template-columns: minmax(0, 1fr) 300px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.kpis.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.kpi .l { font-size: var(--fs-sm); color: var(--text-2); font-weight: 560; display: flex; gap: 6px; align-items: center; }
.kpi .v { font-size: var(--fs-xl); font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.25; }
.kpi .v.sm { font-size: 17px; }
.kpi .d { font-size: var(--fs-sm); margin-top: 3px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.kpi.hero { grid-column: span 2; background: linear-gradient(135deg, var(--surface), var(--surface-2)); }
.kpis.k4 .kpi.hero { grid-column: auto; }
.kpi.hero .v { font-size: var(--fs-2xl); }
/* secondary figures: one card, dividers between */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.stat { padding: 12px 16px; border-left: 1px solid var(--border); min-width: 0; }
.stat:first-child { border-left: 0; }
.stat .l { font-size: var(--fs-sm); color: var(--text-2); font-weight: 560; }
.stat .v { font-size: 17px; font-weight: 680; font-variant-numeric: tabular-nums; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .d { font-size: var(--fs-xs); color: var(--text-3); margin-top: 1px; }
.chart { position: relative; height: 300px; }
.chart.sm { height: 220px; }
.spark { width: 110px; height: 30px; display: block; }

/* ---------------------------------------------------------------- badges */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 21px; padding: 0 8px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 650; background: var(--surface-3); color: var(--text-2); white-space: nowrap; vertical-align: 1px; }
.badge.up, .badge.ok { background: var(--up-soft); color: var(--up); }
.badge.down, .badge.critical { background: var(--down-soft); color: var(--down); }
.badge.warn, .badge.warning { background: var(--warn-soft); color: var(--warn); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.live { background: var(--live); color: #fff; letter-spacing: .04em; }
.badge.demo { background: var(--info-soft); color: var(--demo); letter-spacing: .04em; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge svg { width: 12px; height: 12px; vertical-align: 0; }
.pnl { font-weight: 650; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- tables */
.tbl-wrap { overflow: auto; -webkit-overflow-scrolling: touch; }
.tbl-wrap.tall { max-height: 620px; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.tbl th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--text-2); font-weight: 600; font-size: var(--fs-sm); text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; user-select: none; }
.tbl th.sort { cursor: pointer; }
.tbl th.sort:hover { color: var(--text); }
.tbl th .arrow { opacity: .6; margin-left: 4px; font-size: 9px; }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl td.wrap { min-width: 220px; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:focus-visible { box-shadow: none; }
.tbl tr.click:focus-visible td { background: var(--primary-soft); }
.tbl .primary-cell b { font-weight: 600; }
.tbl .primary-cell .sub { color: var(--text-3); font-size: var(--fs-sm); }
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 10px 14px; border-top: 1px solid var(--border); font-size: var(--fs-sm); color: var(--text-2); }
.pager span { margin-right: auto; }

/* ---------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; padding: 3px; width: fit-content; max-width: 100%; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: none; color: var(--text-2); font: inherit; font-size: 13px; font-weight: 560; padding: 6px 12px; border-radius: 7px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; }
.tabs button svg { width: 15px; height: 15px; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); background: var(--surface); box-shadow: var(--shadow-sm); }
.tabs button .n { font-size: var(--fs-xs); font-weight: 650; padding: 1px 6px; border-radius: var(--r-pill); background: var(--surface-3); color: var(--text-2); }
.tabs button.on .n { background: var(--primary-soft); color: var(--primary); }

/* ---------------------------------------------------------------- callouts, empty, skeleton */
.callout { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; line-height: 1.55; min-width: 0; overflow-wrap: anywhere; }
.callout > div { min-width: 0; flex: 1; }
.callout svg { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--text-3); }
.callout.info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 22%, transparent); } .callout.info > svg { color: var(--info); }
.callout.warning { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 25%, transparent); } .callout.warning > svg { color: var(--warn); }
.callout.critical { background: var(--down-soft); border-color: color-mix(in srgb, var(--down) 28%, transparent); } .callout.critical > svg { color: var(--down); }
.callout.ok { background: var(--up-soft); border-color: color-mix(in srgb, var(--up) 22%, transparent); } .callout.ok > svg { color: var(--up); }
.callout .t { font-weight: 650; margin-bottom: 1px; }
.stack > * + * { margin-top: 16px; }
.stack-sm > * + * { margin-top: 8px; }
.empty { text-align: center; padding: 36px 20px; color: var(--text-2); }
.empty.sm { padding: 22px 16px; }
.empty .ic { width: 44px; height: 44px; margin: 0 auto 12px; border-radius: var(--r-lg); background: var(--surface-3); display: grid; place-items: center; color: var(--text-3); }
.empty .ic svg { width: 21px; height: 21px; }
.empty h4 { margin: 0 0 4px; color: var(--text); font-size: var(--fs-md); }
.empty p { margin: 0 auto 14px; max-width: 440px; font-size: 13px; line-height: 1.55; }
.empty p:last-child { margin-bottom: 0; }
.empty.sm .ic { width: 36px; height: 36px; margin-bottom: 8px; }
/* a one-line "nothing wrong" banner */
.allclear { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: var(--r-xl); background: var(--up-soft); border: 1px solid color-mix(in srgb, var(--up) 22%, transparent); }
.allclear .ic { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--up); color: #fff; flex: none; }
.allclear .ic svg { width: 18px; height: 18px; }
.allclear b { display: block; }
.allclear span { color: var(--text-2); font-size: 13px; }
.skel { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: var(--r-md); }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
pre.code { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 12px; font: 12px/1.55 var(--font-mono); white-space: pre-wrap; word-break: break-word; max-height: 420px; overflow: auto; margin: 0; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; font-size: 13px; }
.kv > :nth-child(odd) { color: var(--text-2); }
.kv > :nth-child(even) { min-width: 0; overflow-wrap: anywhere; }
details > summary { cursor: pointer; color: var(--text-2); font-size: 13px; }
details > summary:hover { color: var(--text); }
.md { font-size: var(--fs-base); line-height: 1.65; overflow-wrap: anywhere; } .md table { border-collapse: collapse; display: block; overflow-x: auto; } .md td, .md th { border: 1px solid var(--border); padding: 4px 8px; }
.md pre { background: var(--surface-2); padding: 10px; border-radius: var(--r-md); overflow: auto; } .md code { font-size: 12px; }
.list-rows > * { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.list-rows > *:first-child { border-top: 0; padding-top: 0; }
.list-rows .end { margin-left: auto; }

/* ---------------------------------------------------------------- calendar heatmap */
.cal { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 20px 28px; }
.cal-month h5 { margin: 0 0 6px; font-size: var(--fs-sm); color: var(--text-2); font-weight: 600; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; max-width: 320px; }
.cal-grid .dow { font-size: 10px; color: var(--text-3); text-align: center; }
.cal-day { aspect-ratio: 1.15; min-height: 26px; border-radius: var(--r-sm); background: var(--surface-3); font-size: 10px; color: var(--text-3); display: flex; align-items: flex-start; justify-content: flex-end; padding: 3px 4px; position: relative; }
.cal-day.blank { background: transparent; }
.cal-day[data-tip]:hover::after { content: attr(data-tip); position: absolute; bottom: 110%; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 4px 8px; border-radius: var(--r-sm); font-size: var(--fs-xs); white-space: nowrap; z-index: 5; }
.legend { display: flex; gap: 6px; align-items: center; font-size: var(--fs-xs); color: var(--text-3); }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* ---------------------------------------------------------------- modal, toast */
.modal-bg { position: fixed; inset: 0; background: var(--scrim); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 100; padding: 20px; animation: fade .12s ease; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); width: min(560px, 100%); max-height: min(90vh, 900px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: rise .16s var(--ease); }
.modal.wide { width: min(880px, 100%); }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-h h3 { margin: 0; font-size: var(--fs-md); font-weight: 680; min-width: 0; overflow-wrap: anywhere; }
.modal-h .x { margin-left: auto; flex: none; }
.modal-h .m-ic { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--down-soft); color: var(--down); }
.modal-h .m-ic svg { width: 17px; height: 17px; }
.modal.danger .modal-h { border-bottom-color: color-mix(in srgb, var(--down) 30%, var(--border)); }
.modal-b { padding: 18px 20px; overflow: auto; min-height: 0; }
.modal-f { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-xl) var(--r-xl); }
.modal h4 { margin: 10px 0 6px; font-size: 13px; }
/* typed confirmation of a dangerous action */
.danger-zone, .typed-zone { border: 1px solid color-mix(in srgb, var(--down) 45%, var(--border)); background: var(--down-soft); border-radius: var(--r-lg); padding: 12px 14px; }
.typed-zone { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.typed-zone b.mono { font-size: 13px; padding: 1px 6px; border-radius: 5px; background: var(--surface); border: 1px solid var(--border-2); color: var(--text); }
.typed-zone input { height: var(--control-h); font-family: var(--font-mono); }
.typed-zone input.match { border-color: var(--up); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px) scale(.99); } to { opacity: 1; transform: none; } }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: flex-start; gap: 10px; min-width: 260px; max-width: 440px; background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r-lg); padding: 11px 10px 11px 14px; box-shadow: var(--shadow-lg); font-size: 13px; animation: rise .16s var(--ease); overflow-wrap: anywhere; }
.toast > svg { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--primary); }
.toast .msg { flex: 1; min-width: 0; padding-top: 1px; }
.toast .x { width: 24px; height: 24px; margin: -2px 0 0; color: var(--text-3); }
.toast .x svg { width: 14px; height: 14px; }
.toast.ok > svg { color: var(--up); } .toast.error > svg { color: var(--down); } .toast.warn > svg { color: var(--warn); }
.toast.error { border-color: color-mix(in srgb, var(--down) 45%, var(--border)); }

/* ---------------------------------------------------------------- win rate, performance over time */
.kpi.wr { display: flex; align-items: center; gap: 16px; }
.kpi.wr .ring { flex: 0 0 auto; width: 64px; height: 64px; transform: rotate(-90deg); }
.kpi.wr .ring circle { fill: none; stroke-width: 7; }
.kpi.wr .ring .track { stroke: var(--down-soft); }
.kpi.wr .ring .fill { stroke-linecap: round; transition: stroke-dasharray .4s ease; }
.kpi.wr .wr-main { min-width: 0; }
.kpi.wr .v { font-size: var(--fs-2xl); }
.wr-cell { display: inline-flex; align-items: center; gap: 8px; }
.wr-cell b { min-width: 40px; text-align: right; font-size: var(--fs-base); }
.wr-bar { width: 56px; height: 6px; border-radius: 3px; background: var(--down-soft); overflow: hidden; }
.wr-bar i { display: block; height: 100%; background: var(--up); border-radius: 3px; }
.perf { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.perf .m-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.perf .m-l { font-size: var(--fs-sm); color: var(--text-2); font-weight: 560; }
.perf .m-v { font-size: var(--fs-xl); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.perf .m-d { font-size: var(--fs-sm); color: var(--text-2); margin: 2px 0 8px; font-variant-numeric: tabular-nums; }
.perf .chart { height: 190px; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1200px) { .kpis.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .g-main, .g3, .g-chart { grid-template-columns: minmax(0, 1fr); } .perf { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) {
  :root { --gutter: 16px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 272px; transform: translateX(-100%); transition: transform .2s var(--ease); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .nav-scrim { position: fixed; inset: 0; z-index: 25; background: var(--scrim); }
  .btn.burger { display: inline-flex; }
  .sticky-bar.stuck > .faint, .sticky-bar.stuck > .grow { display: none; }  /* keep only the controls on a phone */
  .content { padding: 16px var(--gutter) 48px; }
  .topbar { padding: 10px var(--gutter); gap: 6px; }
  .subnav { margin-bottom: -11px; }
  .subnav a { padding: 6px 10px 9px; }
  .subnav a:first-child { margin-left: -10px; }
  .g2 { grid-template-columns: minmax(0, 1fr); }
  .topbar .hide-sm, .topbar .sub { display: none; }
  .status-pill .lbl { display: none; }
  .status-pill { padding: 0 9px; }
  .kpis, .kpis.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi.hero { grid-column: span 2; }
  .kpis.k4 .kpi.hero { grid-column: span 2; }
  .kpi .v { font-size: 19px; }
  .kpi.hero .v, .kpi.wr .v { font-size: 26px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(odd) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--border); }
  .page-actions, .toolbar { gap: 6px; }
  .card-h { padding: 12px 14px; }
  .card-b { padding: 14px; }
  /* tables scroll sideways instead of breaking words; the first column stays in view */
  .tbl-wrap .tbl th, .tbl-wrap .tbl td { white-space: nowrap; padding: 9px 12px; }
  .tbl-wrap .tbl td.wrap { white-space: normal; min-width: 240px; }
  .tbl-wrap .tbl th:first-child, .tbl-wrap .tbl td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: 1px 0 0 var(--border); }
  .tbl-wrap .tbl th:first-child { z-index: 2; background: var(--surface-2); }
  .modal-bg { padding: 0; place-items: end stretch; }
  .modal, .modal.wide { width: 100%; max-height: 92vh; border-radius: var(--r-xl) var(--r-xl) 0 0; }
  .modal-f { border-radius: 0; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .toasts { left: 16px; right: 16px; bottom: 16px; }
  .toast { min-width: 0; max-width: none; }
}
@media (max-width: 520px) {
  .topbar { flex-wrap: wrap; row-gap: 8px; }
  #segctl:not(:empty) { order: 10; flex: 1 0 100%; }
  #segctl .seg { display: flex; width: 100%; }
  #segctl .seg button { flex: 1; justify-content: center; }
  .hide-xs { display: none; }
  .seg button { padding: 5px 10px; }
  .kpi.hero .v, .kpi.wr .v { font-size: 24px; }
  .kpi.wr .ring { width: 54px; height: 54px; }
}

/* strategy control cards */
.sc .sc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.sc .sc-mode { font-size: 22px; font-weight: 700; letter-spacing: -.3px; }
.sc .sc-mode.ok { color: var(--up); } .sc .sc-mode.warning { color: var(--warn); } .sc .sc-mode.critical { color: var(--down); }
.sc .sc-nums { display: flex; gap: 22px; }
.sc .sc-nums > div { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-variant-numeric: tabular-nums; }
.sc .sc-nums .l { font-size: 11px; color: var(--text-3); font-weight: 550; text-transform: uppercase; letter-spacing: .4px; }
.sc .sc-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.sc .sc-actions .btn.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.sc .sc-sec > summary { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; cursor: pointer; padding: 4px 0; }
.sc .sc-sec > summary svg { width: 15px; height: 15px; color: var(--text-3); }
.sc .sc-res { padding: 6px 0; border-top: 1px solid var(--border); }
.sc .sc-res:first-child { border-top: 0; }
/* where the last change stands (live: the EA's confirmation; release: the agent's restart + input check) */
.sc-track { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-2); font-size: 13px; }
.sc-track + .sc-track { margin-top: 6px; }
.sc-track .xs { color: var(--text-2); margin-top: 1px; overflow-wrap: anywhere; }
.sc-track-ic { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; flex: none; margin-top: 1px; }
.sc-track-ic svg { width: 13px; height: 13px; }
.sc-track.ok { border-color: color-mix(in srgb, var(--up) 35%, var(--border)); background: var(--up-soft); } .sc-track.ok .sc-track-ic { background: var(--up); color: #fff; }
.sc-track.bad { border-color: color-mix(in srgb, var(--down) 40%, var(--border)); background: var(--down-soft); } .sc-track.bad .sc-track-ic { background: var(--down); color: #fff; }
.sc-track.warn { border-color: color-mix(in srgb, var(--warn) 40%, var(--border)); background: var(--warn-soft); } .sc-track.warn .sc-track-ic { background: var(--warn); color: #fff; }
.sc-track.wait { border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); background: var(--primary-soft); }
.spin { display: inline-block; width: 13px; height: 13px; border-radius: 50%; border: 2px solid color-mix(in srgb, currentColor 25%, transparent); border-top-color: var(--primary); animation: spin .8s linear infinite; vertical-align: -2px; flex: none; }
.ic-l { transform: rotate(90deg); } .ic-r { transform: rotate(-90deg); }
/* limits watching a terminal (Control → Limits), and a limit that stopped it */
.sc-limit { display: flex; align-items: center; gap: 12px; padding: 9px 14px; border: 1px dashed var(--border-2); border-radius: var(--r-md); color: var(--text); font-size: 13px; }
.sc-limit:hover { text-decoration: none; border-color: var(--primary); }
.sc-limit > svg:first-child { width: 17px; height: 17px; color: var(--text-3); flex: none; }
.sc-limit > div { flex: 1; min-width: 0; }
.sc-limit.near { border-color: color-mix(in srgb, var(--warn) 50%, var(--border)); } .sc-limit.near > svg:first-child { color: var(--warn); }
.sc-limit.bad { border: 1px solid color-mix(in srgb, var(--down) 35%, transparent); background: var(--down-soft); } .sc-limit.bad > svg:first-child { color: var(--down); }
.sc-open { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 1px solid var(--border); border-radius: var(--r-md); color: var(--text); background: var(--surface-2); transition: border-color .12s, background .12s; }
.sc-open:hover { text-decoration: none; border-color: var(--primary); background: var(--primary-soft); }
.sc-open > svg:first-child { width: 18px; height: 18px; color: var(--primary); flex: none; }
.sc-open > div { flex: 1; min-width: 0; }
.sc-open > svg:last-child { width: 16px; height: 16px; color: var(--text-3); }
/* parameters page: groups on the left, every input of the EA as a settings form on the right */
.pe { display: flex; flex-direction: column; gap: 14px; padding-bottom: 72px; }
.pe-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pe-head .btn svg { width: 15px; height: 15px; }
.pe-sum-row { display: flex; align-items: center; gap: 14px 28px; flex-wrap: wrap; }
.pe-id { flex: 1 1 220px; min-width: 0; }
.pe-tn { display: flex; align-items: center; gap: 8px; font-size: var(--fs-lg); font-weight: 700; flex-wrap: wrap; }
.pe-id .xs { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pe-sum [data-live="track"]:not(:empty) { margin-top: 12px; }
.pe-body { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 20px; align-items: start; }
.pe-nav { position: sticky; top: calc(var(--topbar-h, 64px) + 12px); max-height: calc(100vh - var(--topbar-h, 64px) - 24px); overflow-y: auto; display: flex; flex-direction: column; gap: 1px; padding-right: 4px; scrollbar-width: thin; }
.pe-nav a { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 10px; border-radius: var(--r-sm); color: var(--text-2); font-size: 13px; line-height: 1.3; }
.pe-nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.pe-nav a > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pe-nav a.off { color: var(--text-3); }
.pe-nn { color: var(--text-3); font-variant-numeric: tabular-nums; margin-right: 6px; font-size: 12px; }
.pe-c { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; flex: none; }
.dotc { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }
.pe-main { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.pe-tools { position: sticky; top: calc(var(--topbar-h, 64px) - 1px); z-index: 12; display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; padding: 10px 0; background: var(--bg); }
.pe-search { flex: 1 1 240px; display: flex; align-items: center; gap: 8px; height: var(--control-h); padding: 0 10px; border: 1px solid var(--border-2); border-radius: var(--r-md); background: var(--surface); min-width: 0; }
.pe-search:focus-within { border-color: var(--primary); box-shadow: var(--focus); }
.pe-search svg { width: 15px; height: 15px; color: var(--text-3); flex: none; }
.pe-search input { border: 0; box-shadow: none !important; padding: 0; background: transparent; flex: 1; min-width: 0; height: 100%; }
.pe-search kbd { font: 11px var(--font-mono); color: var(--text-3); border: 1px solid var(--border-2); border-radius: 4px; padding: 0 5px; }
.pe-legend { display: flex; align-items: center; gap: 6px 8px; flex-wrap: wrap; margin-top: -6px; }
.pe-legend .pk + .pk, .pe-legend .pk:not(:first-child) { margin-left: 10px; }
.pk { display: inline-flex; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 650; letter-spacing: .2px; padding: 1px 6px 1px 4px; border-radius: var(--r-pill); vertical-align: 1px; white-space: nowrap; }
.pk svg { width: 11px; height: 11px; }
.pk.live { color: var(--up); background: var(--up-soft); }
.pk.rel { color: var(--warn); background: var(--warn-soft); }
.pk.lock { color: var(--text-3); background: var(--surface-3); }
.pe-sections { display: flex; flex-direction: column; gap: 14px; }
.pe-sec { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); scroll-margin-top: calc(var(--topbar-h, 64px) + 64px); }
.pe-sec > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.pe-sec > header > div { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pe-sec h4 { margin: 0; font-size: 14px; font-weight: 650; }
.pe-num { font: 600 11px var(--font-mono); color: var(--text-3); background: var(--surface-3); border-radius: 5px; padding: 2px 6px; flex: none; }
.pe-sec.off > header h4 { color: var(--text-2); }
.pe-sec[data-sec="★"] > header h4 { color: var(--warn); }
.pe-empty { padding: 14px 16px; margin: 0; }
.pe-off { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px; font-size: 12.5px; color: var(--text-3); border-top: 1px dashed var(--border); }
.pe-off svg { width: 14px; height: 14px; }
.pe-rows > .pr:first-child { border-top: 0; }
.pr { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 11px 16px 11px 10px; border-top: 1px solid var(--border); border-left: 3px solid transparent; }
.pr.ed { border-left-color: var(--primary); background: color-mix(in srgb, var(--primary-soft) 55%, transparent); }
.pr.over:not(.ed) { border-left-color: color-mix(in srgb, var(--up) 70%, transparent); }
.pr.unused .pr-name, .pr.unused .pr-c { opacity: .5; }
.pr-pin { border: 0; background: none; padding: 0; cursor: pointer; color: var(--text-3); font-size: 15px; line-height: 1; opacity: .45; align-self: start; margin-top: 2px; }
.pr:hover .pr-pin, .pr-pin:focus-visible, .pr-pin.on { opacity: 1; }
.pr-pin.on, .pr-pin:hover { color: var(--warn); }
.pr-l { min-width: 0; }
.pr-name { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pr-id { font-size: 11.5px; color: var(--text-3); margin-top: 1px; overflow-wrap: anywhere; }
.pr-help { font-size: 12px; color: var(--text-2); margin-top: 3px; }
.pr-note:not(:empty) { display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 5px; }
.pn { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--text-3); }
.pn svg { width: 12px; height: 12px; }
.pn.ed { color: var(--primary); font-weight: 560; }
.pn.ok { color: var(--up); font-weight: 600; } .pn.bad { color: var(--down); font-weight: 600; } .pn.warn { color: var(--warn); font-weight: 600; } .pn.wait { color: var(--primary); }
.pn.off { font-style: italic; }
.pe .link, .pe-off .link { border: 0; background: none; padding: 0; font: inherit; color: var(--primary); cursor: pointer; font-weight: 600; }
.pe .link:hover { text-decoration: underline; }
.pr-c { display: flex; justify-content: flex-end; min-width: 0; }
.pr-c select { width: 210px; height: 34px; }
.pr-c .pr-in { width: 120px; height: 34px; text-align: right; font-variant-numeric: tabular-nums; }
.pr-c .pr-in.txt { width: 210px; text-align: left; }
.pr-ro { font-size: 13px; color: var(--text-2); padding: 0 4px; }
/* switch */
.sw { position: relative; display: inline-block; width: 38px; height: 22px; flex: none; cursor: pointer; }
.sw input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.sw span { position: absolute; inset: 0; border-radius: 999px; background: var(--border-2); transition: background .15s; pointer-events: none; }
.sw span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .15s var(--ease); }
.sw input:checked + span { background: var(--primary); }
.sw input:checked + span::after { transform: translateX(16px); }
.sw input:focus-visible + span { box-shadow: var(--focus); }
.sw input:disabled + span { opacity: .5; }
/* unsaved changes: a bar at the bottom of the window */
.pe-save { position: fixed; left: var(--sidebar-w); right: 0; bottom: 0; z-index: 40; padding: 12px var(--gutter); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--border); box-shadow: 0 -8px 24px rgba(0, 0, 0, .18); animation: rise .15s var(--ease); }
.pe-save-in { max-width: 1480px; margin: 0 auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pe-save-in [data-live="dirty"] { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.pe-save-in .grow { flex: 1; }
.pe-rv { display: flex; flex-direction: column; gap: 8px; }
.pe-rv-h { display: flex; align-items: center; gap: 8px; }
.pe-diff td { vertical-align: top; }
@media (max-width: 860px) { .pe-save { left: 0; } }
@media (max-width: 900px) {
  .pe-body { grid-template-columns: minmax(0, 1fr); }
  .pe-nav { position: static; max-height: none; flex-direction: row; overflow-x: auto; gap: 4px; padding: 0 0 4px; }
  .pe-nav a { flex: none; border: 1px solid var(--border); border-radius: var(--r-pill); padding: 4px 10px; }
  .pe-nav a .pe-c { display: none; }
}
@media (max-width: 640px) {
  .pr { grid-template-columns: 22px minmax(0, 1fr); padding-right: 12px; }
  .pr-c { grid-column: 2; justify-content: flex-start; }
  .pr-c select, .pr-c .pr-in.txt { width: 100%; }
  .pe-legend { display: none; }
  .pe-sum-row .sc-nums { order: 3; }
}
/* ---------------------------------------------------------------- telegram */
/* status bar: does the bot deliver */
.tg-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 24px; padding: 14px 18px; }
.tg-id { display: flex; align-items: center; gap: 12px; min-width: 220px; flex: 1 1 260px; }
.tg-logo { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #2aabee, #229ed9); color: #fff; flex: none; }
.tg-logo svg { width: 19px; height: 19px; margin-left: -2px; }
.tg-state { display: flex; align-items: center; gap: 8px; font-weight: 680; font-size: var(--fs-md); }
.tg-state.warning { color: var(--warn); } .tg-state.critical { color: var(--down); }
.tg-who { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-who svg { width: 12px; height: 12px; }
.tg-figs { display: flex; gap: 26px; flex-wrap: wrap; }
.tg-fig { display: flex; flex-direction: column; min-width: 64px; }
.tg-fig > span { font-size: var(--fs-xs); color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.tg-fig b { font-size: var(--fs-lg); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.35; }
.tg-fig b .faint { font-size: var(--fs-sm); font-weight: 600; }
.tg-fig > i { font-style: normal; font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; }
.tg-acts { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.tg-acts select { height: 34px; }
.tabs button .n.bad { background: var(--down-soft); color: var(--down); }
/* topics */
.tg-topics select { height: 30px; font-size: 13px; }
.tg-topics td:first-child { min-width: 210px; }
select.tg-muted { border-color: color-mix(in srgb, var(--warn) 55%, var(--border-2)); color: var(--warn); }
.tg-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.tg-chips-btn { cursor: pointer; border-radius: var(--r-md); padding: 3px; margin: -3px; }
.tg-chips-btn:hover { background: var(--surface-3); }
.tg-rowacts .btn + .btn { margin-left: 4px; }
/* per-topic settings */
.tg-stlist { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.tg-st { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 14px; align-items: start; padding: 11px 14px; border-top: 1px solid var(--border); }
.tg-st:first-child { border-top: 0; }
.tg-st.off { background: var(--surface-2); }
.tg-st.off .tg-st-main > :not(.tg-st-h), .tg-st.off select { opacity: .5; }
.tg-st-h { display: flex; align-items: center; gap: 8px; }
.tg-st .tg-opts { margin-top: 6px; }
.tg-st .tg-opts input:not([type=checkbox]) { height: 28px; padding: 3px 7px; }
.tg-st select { height: 30px; font-size: 13px; }
.tg-ex { margin-top: 6px; } .tg-ex summary { font-size: var(--fs-sm); } .tg-ex .tg-bubble { margin-top: 6px; }
.tg-switch { position: relative; display: inline-block; width: 36px; height: 20px; margin-top: 1px; cursor: pointer; }
.tg-switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.tg-switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border-2); transition: background .15s; pointer-events: none; }
.tg-switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-3); transition: transform .15s, background .15s; }
.tg-switch input:checked + span { background: var(--primary); border-color: var(--primary); }
.tg-switch input:checked + span::after { transform: translateX(16px); background: #fff; }
.tg-switch input:focus-visible + span { box-shadow: var(--focus); }
@media (max-width: 520px) { .tg-st { grid-template-columns: auto minmax(0, 1fr); } .tg-st select { grid-column: 2; justify-self: start; } }
/* rules */
.tg-profiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tg-prof { border: 1px solid var(--border); border-radius: var(--r-lg); padding: 12px 14px; background: var(--surface); box-shadow: var(--shadow); }
.tg-prof-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.tg-prof-h b { font-size: var(--fs-md); }
.tg-add { display: flex; flex-wrap: wrap; gap: 10px 20px; padding: 12px 18px; border-top: 1px solid var(--border); }
.tg-add .form-row { gap: 8px; align-items: center; }
.tg-add input, .tg-add select { height: 30px; }
.tg-quiet { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.tg-quiet input[type=time] { height: 32px; }
.tg-quiet input[size] { height: 32px; width: 54px; }
.tg-stages td { vertical-align: top; }
.tg-opts { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.tg-opts label { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.tg-opts input, .tg-opts select, .tg-stages select { height: 30px; }
/* messages: Telegram-like bubbles */
.tg-log { display: flex; flex-direction: column; max-height: 720px; overflow: auto; }
.tg-msgrow { padding: 12px 18px; border-top: 1px solid var(--border); }
.tg-msgrow:first-child { border-top: 0; }
.tg-msgrow.bad { background: color-mix(in srgb, var(--down-soft) 55%, transparent); }
.tg-msgmeta { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; }
.tg-msgmeta .end { margin-left: auto; }
.tg-bubble { display: inline-block; max-width: 100%; padding: 8px 12px; border-radius: 4px 14px 14px 14px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.tg-bubble code, .tg-bubble pre { font-family: var(--font-mono); font-size: 12px; }
.tg-bubble pre { margin: 4px 0 0; white-space: pre-wrap; }
.tg-fail { display: flex; align-items: center; gap: 8px; margin-top: 8px; color: var(--down); font-size: 12.5px; }
.tg-fail svg { width: 15px; height: 15px; flex: none; }
.tg-fail span { flex: 1; min-width: 0; }
.tg-chat { display: flex; flex-direction: column; gap: 14px; padding: 4px 0; }
.tg-bubble-h { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 5px; }
.tg-cmds > * { padding: 9px 0; }
/* bot & access */
.tg-steps { display: flex; flex-direction: column; gap: 12px; }
.tg-step { display: flex; gap: 12px; align-items: flex-start; }
.tg-n { flex: 0 0 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--surface-3); color: var(--text-2); }
.tg-step.ok .tg-n { background: var(--up-soft); color: var(--up); }
.tg-n svg { width: 14px; height: 14px; }
.tg-step pre.code { font-size: 11px; }
.tg-users { display: flex; flex-wrap: wrap; gap: 8px; }
.tg-user { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 4px 0 10px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; }
.tg-user svg { width: 14px; height: 14px; color: var(--text-3); }
.tg-topics-wrap { overflow-x: auto; }
@media (max-width: 720px) {  /* one card per topic */
  .tg-topics thead { display: none; }
  .tg-topics, .tg-topics tbody, .tg-topics tr, .tg-topics td { display: block; width: 100%; }
  .tg-topics tr { padding: 14px; border-top: 1px solid var(--border); }
  .tg-topics tr:first-child { border-top: 0; }
  .tg-topics td { border: 0 !important; padding: 5px 0; min-width: 0 !important; }
  .tg-topics tbody tr:hover td { background: transparent; }
  .tg-topics td[data-l]::before { content: attr(data-l); display: block; margin-bottom: 3px; font-size: var(--fs-xs); font-weight: 650; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
  .tg-topics td.num { text-align: left; }
  .tg-topics td[data-l="Notifications"] select { width: 100%; }
  .tg-rowacts { display: flex !important; gap: 8px; padding-top: 10px !important; }
  .tg-rowacts .btn { flex: 1; }
}
@media (max-width: 520px) {
  .tabs button svg { display: none; }
  .tabs button { padding: 10px 11px; }
  .tg-figs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .tg-fig > i { display: none; }
  .tg-fig > span { font-size: 10px; letter-spacing: .02em; }
}
@media (max-width: 860px) {
  .tg-profiles { grid-template-columns: minmax(0, 1fr); }
  .tg-acts { margin-left: 0; width: 100%; }
  .tg-acts select { flex: 1; }
  .tg-figs { gap: 18px; width: 100%; justify-content: space-between; }
  .tg-msgrow { padding: 12px 14px; }
}

/* ---------------------------------------------------------------- MT5 screen viewer */
.screen-bg { position: fixed; inset: 0; z-index: 120; background: rgba(5, 8, 15, .72); backdrop-filter: blur(3px); display: flex; padding: 18px; animation: fade .12s ease; }
.screen { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; box-shadow: 0 24px 70px rgba(0, 0, 0, .5); }
.screen-h { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.screen-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; }
.screen-ic svg { width: 17px; height: 17px; }
.screen-title { line-height: 1.25; min-width: 0; }
.screen-title .xs { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.screen-state { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.screen-state svg { width: 13px; height: 13px; }
.screen-state.on { background: var(--up-soft); color: var(--up); }
.screen-state.on.soon { background: var(--warn-soft); color: var(--warn); }
.screen-state.off { background: var(--surface-3); color: var(--text-3); }
.dot-pulse { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 0 currentColor; animation: dotpulse 1.6s ease-out infinite; flex: none; }
@keyframes dotpulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 55%, transparent); } 100% { box-shadow: 0 0 0 7px transparent; } }
.screen-warn { display: flex; align-items: center; gap: 8px; padding: 7px 14px; font-size: 12.5px; background: var(--down-soft); color: var(--down); border-bottom: 1px solid var(--border); }
.screen-warn svg { width: 15px; height: 15px; flex: none; }
.screen-warn b { color: var(--down); }
.screen-b { position: relative; flex: 1; min-height: 0; background: #000; }
.screen-b iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.screen-msg { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 24px; background: var(--surface-2); color: var(--text); }
.screen-msg .btn { margin-top: 6px; }
.screen-big { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.screen-big svg { width: 24px; height: 24px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--border-2); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.screen-open-list .small { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 4px; }
@media (max-width: 720px) {
  .screen-bg { padding: 0; }
  .screen { border-radius: 0; border: 0; }
  .screen-state { order: 5; width: 100%; justify-content: center; }
}

/* ---------------------------------------------------------------- account nickname */
.btn.icon.xs-btn { width: 22px; height: 22px; padding: 0; vertical-align: -5px; color: var(--text-3); opacity: .7; }
.btn.icon.xs-btn svg { width: 13px; height: 13px; }
tr:hover .btn.icon.xs-btn, .btn.icon.xs-btn:focus-visible { opacity: 1; color: var(--text-2); }
.nick-preview { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.nick-topic { font-weight: 600; margin-top: 2px; word-break: break-word; }
.nick-line { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; }
.nick-line b { overflow-wrap: anywhere; }
.nick-line .btn.icon.xs-btn { flex: none; vertical-align: 0; }

/* EA log: terminal status cards and the readable timeline */
.term-status { display: inline-flex; align-items: center; gap: 6px; margin-left: 4px; font-size: var(--fs-sm); font-weight: 560; color: var(--text-2); }
.term-figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; }
.term-figs > div { display: flex; flex-direction: column; min-width: 0; }
.term-figs span { font-size: var(--fs-xs); font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.term-figs b { font-size: 17px; font-weight: 680; font-variant-numeric: tabular-nums; white-space: nowrap; }
.term-figs small { font-size: var(--fs-xs); color: var(--text-3); }
.term-figs small.warn-t { color: var(--warn); } .term-figs small.down { color: var(--down); }
.term-state { display: flex; flex-wrap: wrap; gap: 4px; }
.card-details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 12px 16px; }
.card-details[open] > summary { margin-bottom: 10px; }
.tl-day { padding: 9px 16px 7px; background: var(--surface-2); border-top: 1px solid var(--border); font-size: var(--fs-xs); font-weight: 650; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.tl-day:first-child { border-top: 0; }
.tl-row { border-top: 1px solid var(--border); }
.tl-day + .tl-row { border-top: 0; }
.tl-row > summary { list-style: none; display: grid; grid-template-columns: 92px 22px minmax(0, 1fr) auto auto; grid-template-areas: "time ic main pnl term";
  gap: 2px 10px; align-items: start; padding: 9px 16px; color: var(--text); }
.tl-row > summary::-webkit-details-marker { display: none; }
.tl-row > summary:hover, .tl-row[open] > summary { background: var(--surface-2); color: var(--text); }
.tl-time { grid-area: time; padding-top: 2px; font: 12px var(--font-mono); color: var(--text-3); white-space: nowrap; }
.tl-ic { grid-area: ic; width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.tl-ic svg { width: 13px; height: 13px; }
.tl-main { grid-area: main; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.tl-title { font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.tl-detail { font-size: var(--fs-sm); color: var(--text-2); overflow-wrap: anywhere; }
.tl-pnl { grid-area: pnl; align-self: center; white-space: nowrap; }
.tl-term { grid-area: term; align-self: center; }
.tl-row.s-ok .tl-ic { background: var(--up-soft); color: var(--up); }
.tl-row.s-info .tl-ic { background: var(--info-soft); color: var(--info); }
.tl-row.s-warning .tl-ic { background: var(--warn-soft); color: var(--warn); }
.tl-row.s-warning .tl-title { color: var(--warn); }
.tl-row.s-critical .tl-ic { background: var(--down-soft); color: var(--down); }
.tl-row.s-critical .tl-title { color: var(--down); }
.tl-row.c-heartbeat.s-ok .tl-ic { background: var(--surface-3); color: var(--text-3); }
.tl-row.c-heartbeat.s-ok .tl-title { font-weight: 560; color: var(--text-2); }
.tl-row.c-heartbeat.s-ok .tl-detail { color: var(--text-3); }
.tl-raw { padding: 2px 16px 12px 140px; background: var(--surface-2); }
.tl-raw pre.code { margin-top: 6px; max-height: 260px; background: var(--surface); }
@media (max-width: 640px) {
  .term-figs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tl-row > summary { grid-template-columns: 22px minmax(0, 1fr) auto; grid-template-areas: "ic time term" "ic main pnl"; padding: 9px 12px; }
  .tl-pnl { align-self: start; }
  .tl-raw { padding: 2px 12px 12px; }
}

/* ---------------------------------------------------------------- logins: who am I, sign-in screen, invite page */
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form [hidden] { display: none; }
.svcs { display: flex; flex-direction: column; gap: 6px; }
.svc-note { margin-top: 2px; }
.who { display: flex; align-items: center; gap: 4px; margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--border); }
.svcs:empty + .who, .sidebar-foot > .who:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.who-main { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; padding: 5px 6px; border-radius: var(--r-md); color: var(--text); }
.who-main:hover { background: var(--surface-2); text-decoration: none; }
.who-t { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.who-t b { font-size: var(--fs-sm); font-weight: 620; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-t span { font-size: var(--fs-xs); color: var(--text-3); display: inline-flex; align-items: center; gap: 3px; }
.who-t svg { width: 11px; height: 11px; color: var(--up); }
.avatar { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
  color: var(--primary); background: var(--primary-soft); border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent); }
.avatar.lg { width: 46px; height: 46px; font-size: 16px; }
body.investor #hubstatus { display: none; }

body.signed-out .sidebar, body.signed-out .topbar { display: none; }
body.signed-out .shell, body.signed-out .main { display: block; }
body.signed-out .content { padding: 0; max-width: none; margin: 0; }
.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px;
  background: radial-gradient(1200px 600px at 50% -10%, var(--primary-soft), transparent 70%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow);
  padding: 32px 28px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.auth-card.wide { max-width: 480px; text-align: left; align-items: stretch; }
.auth-card h2 { margin: 0; font-size: var(--fs-xl); font-weight: 700; letter-spacing: -0.015em; }
.auth-card p { margin: 0; line-height: 1.6; }
.auth-card .btn.lg { height: 42px; padding: 0 20px; font-size: var(--fs-md); border-radius: var(--r-lg); }
.auth-card .center { text-align: center; }
.brand-mark.lg { width: 52px; height: 52px; border-radius: 14px; margin-bottom: 4px; box-shadow: 0 8px 24px color-mix(in srgb, var(--primary) 35%, transparent); }
.brand-mark.lg svg, .brand-mark svg { width: 60%; height: 60%; }
.auth-brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.auth-brand .brand-mark { width: 26px; height: 26px; }
.auth-user { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; }
.auth-user svg { width: 16px; height: 16px; color: var(--text-3); flex: none; }
.auth-step { border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px 14px 12px; background: var(--surface-2); display: flex; flex-direction: column; gap: 10px; }
.auth-step[hidden] { display: none; }
.auth-step h3 { margin: 0; font-size: var(--fs-md); display: flex; align-items: center; gap: 8px; }
.auth-step h3 svg { width: 17px; height: 17px; color: var(--primary); }
.auth-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 8px 0; }
.auth-state > svg { width: 44px; height: 44px; padding: 10px; border-radius: 50%; color: var(--warn); background: var(--warn-soft); }
.auth-state.ok > svg { color: var(--up); background: var(--up-soft); }
.pw-rules { list-style: none; margin: -2px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-sm); color: var(--text-3); }
.pw-rules li { display: flex; align-items: center; gap: 7px; transition: color .15s; }
.pw-rules svg { width: 14px; height: 14px; padding: 1px; border-radius: 50%; border: 1px solid var(--border-2); color: transparent; transition: all .15s; }
.pw-rules li.ok { color: var(--text-2); }
.pw-rules li.ok svg { background: var(--up); border-color: var(--up); color: #fff; }
.opt-totp { align-items: flex-start; padding: 10px 12px; border: 1px dashed var(--border-2); border-radius: var(--r-lg); line-height: 1.45; }
.opt-totp input { margin-top: 3px; }
.totp-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--text-2); line-height: 1.55; }
.totp-steps b { color: var(--text); font-weight: 600; }
.totp-steps .btn { vertical-align: middle; margin: 0 2px; }
.totp-key { display: flex; align-items: center; gap: 6px; margin-top: 6px; padding: 8px 10px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border); }
.totp-key code { flex: 1; font-size: 14px; letter-spacing: .08em; color: var(--text); word-break: break-all; user-select: all; }
.only-touch { display: none; }
@media (hover: none) and (pointer: coarse) { .only-touch { display: inline; } .only-desk { display: none; } }

/* people (admin) */
.person { display: flex; align-items: center; gap: 10px; }
.acct-chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.acct-chip { display: inline-flex; align-items: center; gap: 5px; height: 21px; padding: 0 8px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 600;
  background: var(--surface-3); color: var(--text-2); font-variant-numeric: tabular-nums; }
.acct-chip i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }
.acct-chip i.k-live { background: var(--live); } .acct-chip i.k-demo { background: var(--demo); }
.role-seg { align-self: flex-start; }
.role-seg svg { width: 14px; height: 14px; }
.acct-field[hidden] { display: none; }
.acct-q { margin-bottom: 6px; }
.acct-list { max-height: 260px; overflow: auto; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-2); }
.acct-pick { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; font-weight: 400; color: var(--text); }
.acct-pick + .acct-pick { border-top: 1px solid var(--border); }
.acct-pick[hidden] { display: none; }
.acct-pick:hover { background: var(--surface-3); }
.acct-pick:has(input:checked) { background: var(--primary-soft); }
.acct-pick input { width: 15px; height: 15px; flex: none; }
.ap-main { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.35; }
.ap-main b { font-weight: 600; }
.person-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.person-actions .grow { flex: 1; }
.link-box { display: flex; gap: 8px; }
.link-box input { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 12.5px; height: 36px; }
.link-msg summary { cursor: pointer; color: var(--text-2); font-size: 13px; font-weight: 560; padding: 4px 0; }
.link-msg pre.code { margin: 6px 0 8px; }
@media (max-width: 520px) { .link-box { flex-direction: column; } }

/* my login */
.me-head { display: flex; align-items: center; gap: 12px; }
.me-head b { font-size: var(--fs-md); }
.me-accts { margin-top: 16px; display: flex; flex-direction: column; gap: 6px; }
.me-acct { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-2); }
.me-acct > svg { width: 16px; height: 16px; color: var(--text-3); flex: none; }
.me-acct > span:not(.badge) { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.35; }
.totp-on { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.55; }
.totp-on > svg { width: 22px; height: 22px; color: var(--up); flex: none; }
.profile { align-items: start; }
.totp-qr { display: block; margin: 8px 0; border-radius: 6px; background: #fff; padding: 4px; image-rendering: pixelated; }

/* ---- 2026-11-01: monthly returns, statements, share page, print ---- */
.tbl.months td, .tbl.months th { padding: 6px 8px; font-variant-numeric: tabular-nums; }
.tbl.months td.num { font-size: var(--fs-sm); }
.tbl.kvt th { text-align: left; font-weight: 500; color: var(--text-2); }
.tbl.kvt tr.total th, .tbl.kvt tr.total td { border-top: 1px solid var(--border-2); }
.share { max-width: 1080px; margin: 0 auto; padding: 24px 16px 48px; }
.share-h { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.share-h h1 { font-size: var(--fs-xl); margin: 0; }
.list-rows > div.muted { opacity: .72; }
@media print {
  .sidebar, .topbar, .noprint, .page-actions, .toasts, .skip, .nav-scrim { display: none !important; }
  body, .main, .content { background: #fff !important; color: #111 !important; }
  .shell { display: block; }
  .main { margin: 0 !important; }
  .content { padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; background: #fff !important; break-inside: avoid; }
  .statement { break-after: page; }
  .tbl-wrap { overflow: visible !important; max-height: none !important; }
  .pager { display: none !important; }
  .up { color: #15803d !important; } .down { color: #b91c1c !important; }
}
