/* Crypto Bot dashboard. Colors are role tokens; dark mode is its own stepped set. */
:root {
  color-scheme: light;
  --page: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f3f4f6;
  --surface-3: #e9ebef;
  --ink: #0e1116;
  --ink-2: #4a5160;
  --muted: #7c8392;
  --line: #e6e8ec;
  --grid: #eceef1;
  --axis: #c9cdd4;
  --ring: rgba(14, 17, 22, 0.08);
  --shadow-sm: 0 1px 2px rgba(14, 17, 22, 0.05);
  --shadow: 0 1px 2px rgba(14, 17, 22, 0.04), 0 8px 24px -12px rgba(14, 17, 22, 0.12);
  --accent: #2a78d6;
  --accent-2: #1f63b6;
  --accent-ink: #ffffff;
  --accent-wash: rgba(42, 120, 214, 0.09);
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #6250d6;
  --series-8: #e34948;
  --pos: #2a78d6;
  --neg: #e34948;
  --up: #0a7a33;
  --down: #c62f2f;
  --good: #0ca30c;
  --critical: #d03b3b;
  --warning: #b77800;
  --good-wash: rgba(12, 163, 12, 0.10);
  --critical-wash: rgba(208, 59, 59, 0.09);
  --warning-wash: rgba(250, 178, 25, 0.16);
  --sidebar: #0f1623;
  --sidebar-ink: #c9d1de;
  --sidebar-muted: #7d889b;
  --sidebar-active: rgba(255, 255, 255, 0.08);
  --radius: 16px;
  --radius-sm: 10px;
  --font: "Vazirmatn", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0b0d11;
    --surface: #14171d;
    --surface-2: #1b1f27;
    --surface-3: #232833;
    --ink: #eef0f3;
    --ink-2: #b6bcc8;
    --muted: #868d9b;
    --line: #262b35;
    --grid: #222730;
    --axis: #3a404c;
    --ring: rgba(255, 255, 255, 0.07);
    --shadow-sm: none;
    --shadow: none;
    --accent: #3987e5;
    --accent-2: #5598e7;
    --accent-wash: rgba(57, 135, 229, 0.14);
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #008300;
    --series-7: #9085e9;
    --series-8: #e66767;
    --pos: #3987e5;
    --neg: #e66767;
    --up: #36c46b;
    --down: #ff7b72;
    --warning: #fab219;
    --good-wash: rgba(12, 163, 12, 0.16);
    --critical-wash: rgba(208, 59, 59, 0.18);
    --warning-wash: rgba(250, 178, 25, 0.14);
    --sidebar: #0e1117;
    --sidebar-active: rgba(255, 255, 255, 0.06);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0b0d11;
  --surface: #14171d;
  --surface-2: #1b1f27;
  --surface-3: #232833;
  --ink: #eef0f3;
  --ink-2: #b6bcc8;
  --muted: #868d9b;
  --line: #262b35;
  --grid: #222730;
  --axis: #3a404c;
  --ring: rgba(255, 255, 255, 0.07);
  --shadow-sm: none;
  --shadow: none;
  --accent: #3987e5;
  --accent-2: #5598e7;
  --accent-wash: rgba(57, 135, 229, 0.14);
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-7: #9085e9;
  --series-8: #e66767;
  --pos: #3987e5;
  --neg: #e66767;
  --up: #36c46b;
  --down: #ff7b72;
  --warning: #fab219;
  --good-wash: rgba(12, 163, 12, 0.16);
  --critical-wash: rgba(208, 59, 59, 0.18);
  --warning-wash: rgba(250, 178, 25, 0.14);
  --sidebar: #0e1117;
  --sidebar-active: rgba(255, 255, 255, 0.06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font: 15px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.up { color: var(--up); }
.down { color: var(--down); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- layout ------------------------------------------------------------- */
.app { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--sidebar); color: var(--sidebar-ink);
  display: flex; flex-direction: column; padding: 18px 14px; gap: 6px; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; padding: 4px 8px 14px; letter-spacing: -0.01em; }
.sidebar .brand { color: #fff; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none; position: relative;
  background: linear-gradient(135deg, #3d8bea, #1d58a6); box-shadow: inset 0 0 0 1px rgba(255,255,255,.15);
}
.brand-mark::after {
  content: ""; position: absolute; left: 7px; right: 7px; top: 9px; bottom: 8px;
  background: linear-gradient(#fff, #fff) left bottom / 2px 100% no-repeat, linear-gradient(#fff, #fff) left bottom / 100% 2px no-repeat;
  clip-path: polygon(0 100%, 0 0, 4px 0, 4px 55%, 35% 30%, 60% 58%, 100% 10%, 100% 100%);
}
.nav-label { font-size: 11px; font-weight: 600; letter-spacing: .04em; color: var(--sidebar-muted); padding: 14px 10px 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 10px; border: 0;
  background: none; color: var(--sidebar-ink); cursor: pointer; text-align: start; font-weight: 500; font-size: 14px;
}
.nav-item:hover { background: var(--sidebar-active); color: #fff; text-decoration: none; }
.nav-item[aria-current="page"] { background: rgba(57, 135, 229, 0.18); color: #fff; }
.nav-item[aria-current="page"] svg.i { color: #7fb2f0; }
.nav-item .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sidebar-muted); flex: none; }
.dot.live { background: #2fd17a; box-shadow: 0 0 0 3px rgba(47, 209, 122, .15); }
.dot.off { background: transparent; border: 1.5px solid var(--sidebar-muted); }
.sidebar-foot { margin-top: auto; display: grid; gap: 10px; padding-top: 14px; }
.bot-status { border-radius: 12px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06); padding: 12px; font-size: 13px; display: grid; gap: 6px; }
.bot-status .row { display: flex; justify-content: space-between; gap: 8px; color: var(--sidebar-muted); }
.bot-status .row b { color: var(--sidebar-ink); font-weight: 500; }
.pulse { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; color: #fff; }
.pulse i { width: 8px; height: 8px; border-radius: 50%; background: #2fd17a; box-shadow: 0 0 0 0 rgba(47,209,122,.6); animation: pulse 2s infinite; }
.pulse.bad i { background: #ff6b5f; animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(47,209,122,.55); } 70% { box-shadow: 0 0 0 8px rgba(47,209,122,0); } 100% { box-shadow: 0 0 0 0 rgba(47,209,122,0); } }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: linear-gradient(135deg, #3d8bea, #6250d6); flex: none; text-transform: uppercase; }
.user-chip .who { flex: 1; min-width: 0; line-height: 1.3; }
.user-chip .who b { display: block; color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.user-chip .who span { font-size: 12px; color: var(--sidebar-muted); }
.side-btn { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; border: 0; background: none; color: var(--sidebar-muted); cursor: pointer; }
.side-btn:hover { background: var(--sidebar-active); color: #fff; }

.content { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 14px 28px;
  background: color-mix(in srgb, var(--page) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--ring);
}
.topbar h1 { font-size: 20px; margin: 0; font-weight: 750; letter-spacing: -0.01em; }
.topbar .sub { font-size: 13px; color: var(--muted); }
.topbar .spacer { flex: 1; }
.icon-btn.menu-btn { display: none; }
.icon-btn {
  width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; color: var(--ink-2); box-shadow: var(--shadow-sm);
}
.icon-btn:hover { color: var(--ink); background: var(--surface-2); }
.updated { font-size: 12px; color: var(--muted); white-space: nowrap; }
main { padding: 24px 28px 56px; max-width: 1320px; width: 100%; }
.view { display: grid; gap: 20px; }
.loading { opacity: .6; transition: opacity .2s; }
.scrim { display: none; }

@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 0 0 auto; width: 280px; transform: translateX(105%); transition: transform .22s ease; box-shadow: -12px 0 40px rgba(0,0,0,.3); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
  .icon-btn.menu-btn { display: inline-grid; }
  .topbar { padding: 12px 16px; }
  .topbar .sub, .updated { display: none; }
  main { padding: 16px 16px 48px; }
}

/* ---- cards & stats ------------------------------------------------------ */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card.flush .card-head { padding: 18px 20px 0; }
.card-title { font-size: 15px; font-weight: 700; margin: 0; display: flex; align-items: center; gap: 8px; }
.card-sub { font-size: 13px; color: var(--muted); }
.grid { display: grid; gap: 20px; }
.grid.cols-2 { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.grid.cols-2b { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .grid.cols-2, .grid.cols-2b { grid-template-columns: minmax(0, 1fr); } }

.stats { display: grid; gap: 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .stats { gap: 10px; } }
.stat { padding: 18px 20px; display: grid; gap: 4px; align-content: start; }
.stat .k { font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.stat .v { font-size: 26px; font-weight: 750; letter-spacing: -0.015em; line-height: 1.25; }
.stat .h { font-size: 12.5px; color: var(--muted); }
.stat.hero { background: linear-gradient(140deg, #1b4f96, #2a78d6 60%, #3d8bea); color: #fff; border: 0; position: relative; overflow: hidden; }
.stat.hero::after { content: ""; position: absolute; width: 220px; height: 220px; border-radius: 50%; left: -60px; bottom: -110px; background: rgba(255,255,255,.08); }
.stat.hero .k, .stat.hero .h { color: rgba(255,255,255,.82); }
.stat.hero .v { font-size: 30px; }
.delta { display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px; border-radius: 99px; font-size: 12.5px; font-weight: 600; }
.delta.up { background: var(--good-wash); }
.delta.down { background: var(--critical-wash); }
.stat.hero .delta { background: rgba(255,255,255,.16); color: #fff; }
.stat.hero .up, .stat.hero .down { color: #fff; }
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
@media (max-width: 520px) { .stat { padding: 14px; } .stat .v { font-size: 20px; } .stat.hero .v { font-size: 22px; } }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge svg.i { width: 13px; height: 13px; }
.badge.live { background: var(--good-wash); color: var(--ink); }
.badge.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--good); }
.badge.paper { background: var(--accent-wash); color: var(--ink); }
.badge.good { background: var(--good-wash); color: var(--ink); }
.badge.good svg.i { color: var(--good); }
.badge.critical { background: var(--critical-wash); color: var(--ink); }
.badge.critical svg.i { color: var(--critical); }
.badge.warn { background: var(--warning-wash); color: var(--ink); }
.chip { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); font-size: 12px; font-weight: 600; direction: ltr; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.kv { display: grid; gap: 10px; }
.kv > div { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; }
.kv > div > span:first-child { color: var(--ink-2); }

/* segmented control */
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-2); gap: 2px; }
.seg button { border: 0; background: none; padding: 4px 11px; border-radius: 8px; cursor: pointer; font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ---- charts ------------------------------------------------------------- */
.chart { position: relative; direction: ltr; touch-action: pan-y; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .zero { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .crosshair { stroke: var(--axis); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .end-label { font-size: 12px; font-weight: 600; fill: var(--ink-2); font-family: var(--font); }
.tooltip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 160px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .16); padding: 9px 11px; font-size: 12px; direction: rtl; opacity: 0; transition: opacity .1s;
}
.tooltip.on { opacity: 1; }
.tooltip .t-date { color: var(--muted); margin-bottom: 4px; direction: ltr; text-align: right; }
.tooltip .t-row { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.tooltip .t-key { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.tooltip .t-key i { width: 12px; height: 2px; border-radius: 1px; display: inline-block; }
.tooltip .t-val { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; direction: ltr; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 2px; border-radius: 1px; display: inline-block; }
.legend i.dash { background: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 7px) !important; height: 2px; }
.empty { padding: 34px 16px; text-align: center; color: var(--muted); font-size: 14px; display: grid; gap: 8px; justify-items: center; }
.empty svg.i { width: 28px; height: 28px; color: var(--axis); }
.spark svg { width: 100%; height: 40px; display: block; }
details.table-view { margin-top: 12px; font-size: 13px; }
details.table-view summary { cursor: pointer; color: var(--ink-2); }

.alloc { display: flex; height: 12px; border-radius: 6px; overflow: hidden; gap: 2px; }
.alloc span { display: block; min-width: 3px; }
.alloc-legend { display: grid; gap: 8px; margin-top: 14px; font-size: 13px; }
.alloc-legend div { display: flex; justify-content: space-between; gap: 8px; }
.alloc-legend b { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.alloc-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.rank { display: grid; gap: 7px; }
.rank-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) 72px; align-items: center; gap: 12px; font-size: 13px; }
.rank-sym { display: flex; align-items: center; gap: 6px; font-weight: 600; direction: ltr; justify-content: flex-end; }
.rank-track { position: relative; height: 20px; direction: ltr; background: var(--surface-2); border-radius: 5px; }
.rank-track .mid { position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--axis); }
.rank-track .bar { position: absolute; top: 4px; height: 12px; border-radius: 3px; }
.rank-val { text-align: left; }
.sel-tag { font-size: 10px; padding: 0 6px; border-radius: 99px; background: var(--good-wash); color: var(--ink); font-weight: 600; }

/* ---- tables ------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-align: start; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); }
td { padding: 12px 14px; border-bottom: 1px solid var(--grid); white-space: nowrap; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: left; font-variant-numeric: tabular-nums; direction: ltr; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
.cell-main { display: flex; align-items: center; gap: 10px; }
.cell-main b { font-weight: 650; display: block; }
.cell-main small { color: var(--muted); font-size: 12px; display: block; }
.coin { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 10.5px; font-weight: 800; color: #fff; flex: none; letter-spacing: -.02em; }
@media (max-width: 720px) {
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { padding: 12px 16px; border-bottom: 1px solid var(--grid); }
  table.stack tr:last-child { border-bottom: 0; }
  table.stack td { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 0; padding: 4px 0; white-space: normal; }
  table.stack td::before { content: attr(data-label); color: var(--muted); font-size: 12px; }
  table.stack td.first::before { content: none; }
  table.stack td.first { padding-bottom: 8px; }
}

/* ---- activity ----------------------------------------------------------- */
.feed { display: grid; }
.ev { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--grid); }
.ev:last-child { border-bottom: 0; }
.ev-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; }
.ev-ic.buy { background: var(--good-wash); color: var(--up); }
.ev-ic.sell { background: var(--accent-wash); color: var(--accent); }
.ev-t { font-size: 14px; }
.ev-t b { font-weight: 650; }
.ev-s { font-size: 12.5px; color: var(--muted); }
.ev-v { text-align: left; font-size: 13.5px; }

/* ---- forms, buttons, modal ---------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font-weight: 600; font-size: 14px; box-shadow: var(--shadow-sm); white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--down); }
.btn.danger:hover { background: var(--critical-wash); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.field { display: grid; gap: 6px; }
.field label, .field .lbl { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--muted); }
input[type=text], input[type=password], input[type=number], select {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); outline: none;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.form { display: grid; gap: 14px; }
.form-row { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }
.radio-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.radio-cards label { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 13px; color: var(--ink-2); font-weight: 400; }
.radio-cards label b { display: block; color: var(--ink); font-size: 14px; }
.radio-cards input { margin-top: 4px; accent-color: var(--accent); }
.radio-cards label:has(input:checked) { border-color: var(--accent); background: var(--accent-wash); }
.checks { display: grid; gap: 6px; max-height: 180px; overflow: auto; padding: 8px; border: 1px solid var(--line); border-radius: 10px; }
.checks label { display: flex; gap: 8px; align-items: center; font-weight: 400; font-size: 14px; color: var(--ink); }
.checks input { accent-color: var(--accent); }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: 10px; font-size: 13px; background: var(--warning-wash); color: var(--ink); }
.notice.info { background: var(--accent-wash); }
.notice svg.i { margin-top: 2px; color: var(--warning); }
.notice.info svg.i { color: var(--accent); }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--surface-3); cursor: pointer; transition: background .15s; }
.switch span::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; top: 3px; right: 3px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + span { background: var(--good); }
.switch input:checked + span::after { transform: translateX(-16px); }

dialog.modal { border: 0; padding: 0; border-radius: 18px; width: min(560px, calc(100vw - 24px)); background: var(--surface); color: var(--ink); box-shadow: 0 24px 80px rgba(0,0,0,.35); }
dialog.modal::backdrop { background: rgba(10, 14, 20, .55); backdrop-filter: blur(2px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 20px; max-height: calc(100vh - 200px); overflow: auto; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-start; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); }
.form-error { color: var(--down); font-size: 13.5px; margin: 0; }

.toasts { position: fixed; bottom: 20px; left: 20px; display: grid; gap: 8px; z-index: 100; }
.toast { background: var(--ink); color: var(--surface); padding: 10px 14px; border-radius: 10px; font-size: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.25); display: flex; gap: 8px; align-items: center; animation: toast-in .2s ease; }
.toast.err { background: var(--critical); color: #fff; }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } }

/* ---- log ---------------------------------------------------------------- */
.log { font: 12px/1.7 var(--mono); direction: ltr; text-align: left; background: var(--surface-2); border-radius: 10px; padding: 12px 14px; max-height: 620px; overflow: auto; white-space: pre; }
.log .lv { display: inline-block; min-width: 62px; font-weight: 700; }
.log .lv-WARNING { color: var(--warning); }
.log .lv-ERROR, .log .lv-CRITICAL { color: var(--down); }
.log .lv-INFO { color: var(--muted); }
.log .trade-buy { color: var(--up); font-weight: 600; }
.log .trade-sell { color: var(--accent); font-weight: 600; }
.foot { color: var(--muted); font-size: 12px; text-align: center; }

/* ---- login -------------------------------------------------------------- */
.login-page { min-height: 100vh; background: radial-gradient(1200px 600px at 80% -10%, rgba(42,120,214,.18), transparent), var(--page); }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; display: grid; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 30px; box-shadow: var(--shadow); }
.login-card .brand { padding: 0 0 8px; color: var(--ink); }
.login-card h1 { font-size: 22px; margin: 6px 0 0; }
.login-sub { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.login-card label { font-size: 13px; color: var(--ink-2); font-weight: 600; margin-top: 4px; }
.login-card input { padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--page); outline: none; }
.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.login-card button { margin-top: 10px; padding: 12px; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 700; cursor: pointer; font-size: 15px; }
.login-card button:hover { background: var(--accent-2); }
.login-note { font-size: 12px; color: var(--muted); margin: 6px 0 0; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
