/* ============================================================
   Mover bot — современная дизайн-система (dark fintech)
   ============================================================ */
:root {
  --bg: #07080c;
  --bg-2: #0b0d13;
  --panel: rgba(20, 23, 32, 0.72);
  --panel-solid: #14171f;
  --panel-2: rgba(255, 255, 255, 0.035);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #eef1f6;
  --muted: #8b93a7;
  --faint: #5d6478;

  --accent: #7c8bff;
  --accent-2: #a855f7;
  --grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
  --grad-soft: linear-gradient(135deg, rgba(99,102,241,.18), rgba(168,85,247,.18));

  --green: #34d399;
  --green-bg: rgba(52, 211, 153, .14);
  --red: #fb7185;
  --red-bg: rgba(251, 113, 133, .14);
  --blue: #60a5fa;
  --amber: #fbbf24;

  --radius: 18px;
  --radius-sm: 11px;
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, .6), 0 1px 0 rgba(255, 255, 255, .04) inset;
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .75);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.006em;
}

.bg-glow {
  position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background:
    radial-gradient(620px 420px at 12% -8%, rgba(99, 102, 241, .20), transparent 60%),
    radial-gradient(680px 480px at 100% 0%, rgba(168, 85, 247, .14), transparent 55%),
    radial-gradient(900px 600px at 50% 120%, rgba(56, 189, 248, .08), transparent 60%),
    var(--bg);
}

/* numbers */
.val, .tbl td, .stat .num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

/* ---------------- topbar ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 28px;
  padding: 14px 28px;
  background: rgba(8, 9, 13, 0.72);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); }
.brand-mark {
  width: 30px; height: 30px; display: grid; place-items: center;
  background: var(--grad); border-radius: 9px; color: #fff; font-size: 14px;
  box-shadow: 0 6px 18px -6px rgba(124, 92, 255, .8);
}
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -0.02em; }
.brand-name b { font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-tag {
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); border: 1px solid var(--line); padding: 2px 7px; border-radius: 6px;
}
.nav { display: flex; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 7px;
  color: var(--muted); text-decoration: none; padding: 8px 14px;
  border-radius: 10px; font-weight: 500; font-size: 13.5px;
  transition: background .18s, color .18s;
}
.nav a svg { opacity: .8; }
.nav a:hover { background: var(--panel-2); color: var(--text); }
.nav a.active { color: #fff; background: var(--grad-soft); box-shadow: inset 0 0 0 1px var(--line-strong); }
.nav a.active svg { opacity: 1; color: var(--accent); }

.badge {
  margin-left: auto; display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 13px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 22%, transparent); }
.badge-muted { background: var(--panel-2); color: var(--muted); }
.badge-sandbox { background: rgba(96, 165, 250, .14); color: var(--blue); }
.badge-real { background: var(--red-bg); color: var(--red); }
.badge-sandbox::before, .badge-real::before { animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

/* ---------------- layout ---------------- */
main { max-width: 1180px; margin: 0 auto; padding: 30px 28px 60px; }

.page-head { margin: 4px 2px 22px; animation: rise .5s cubic-bezier(.2,.7,.3,1) both; }
.page-title {
  font-size: 26px; font-weight: 800; letter-spacing: -0.03em; margin: 0;
  background: linear-gradient(120deg, #fff 30%, #b6bce0 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.page-sub { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }
.page-head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.page-quote {
  margin: 0; font-style: italic; color: var(--muted); font-size: 14px; line-height: 1.5;
  text-align: right; max-width: 360px; padding-right: 14px; border-right: 2px solid var(--accent);
}
@media (max-width: 640px) { .page-quote { display: none; } }

.panel {
  position: relative;
  background: var(--panel);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
  animation: rise .5s cubic-bezier(.2,.7,.3,1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.panel:nth-child(2) { animation-delay: .04s; }
.panel:nth-child(3) { animation-delay: .08s; }
.panel:nth-child(4) { animation-delay: .12s; }

.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.panel h2 {
  font-size: 13px; font-weight: 600; margin: 0 0 18px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .07em;
}
.panel-head h2 { margin: 0; }

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
@media (max-width: 860px) { .cols { grid-template-columns: 1fr; } }

/* ---------------- stat grids ---------------- */
.grid { display: grid; gap: 12px; }
.status-grid { grid-template-columns: repeat(3, 1fr); }
.money-grid { grid-template-columns: repeat(6, 1fr); margin-bottom: 18px; }
@media (max-width: 860px) { .status-grid, .money-grid { grid-template-columns: repeat(2, 1fr); } }

.stat {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  display: flex; flex-direction: column; gap: 5px;
  transition: border-color .18s, transform .18s;
}
.stat:hover { border-color: var(--line-strong); }
.stat .label { color: var(--faint); font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.stat .val { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; }
.stat.big {
  background: var(--grad-soft);
  border-color: var(--line-strong);
}
.stat.big .val { font-size: 24px; font-weight: 750; }
.stat.big .label { color: var(--muted); }

/* ---------------- buttons ---------------- */
.controls { display: flex; gap: 9px; flex-wrap: wrap; }
.btn {
  border: 1px solid transparent; border-radius: 11px; padding: 9px 16px;
  font-size: 13px; font-weight: 600; cursor: pointer; color: #fff;
  font-family: inherit; letter-spacing: -0.01em;
  transition: transform .12s, box-shadow .18s, opacity .18s, background .18s;
  display: inline-flex; align-items: center; gap: 7px;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn-green { background: linear-gradient(135deg, #16a34a, #22c55e); box-shadow: 0 8px 22px -10px rgba(34,197,94,.9); }
.btn-red { background: linear-gradient(135deg, #e11d48, #fb7185); box-shadow: 0 8px 22px -10px rgba(251,113,133,.8); }
.btn-blue { background: var(--grad); box-shadow: 0 8px 22px -10px rgba(124,92,255,.9); }
.btn-ghost { background: var(--panel-2); color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--line-strong); background: rgba(255,255,255,.06); }

/* ---------------- tables ---------------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { text-align: right; padding: 11px 12px; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl th {
  color: var(--faint); font-weight: 600; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .05em; border-bottom: 1px solid var(--line); padding-bottom: 9px;
}
.tbl td { border-bottom: 1px solid var(--line); }
.tbl tbody tr { transition: background .15s; }
.tbl tbody tr:hover { background: var(--panel-2); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl td:first-child { font-weight: 600; }

.pos { color: var(--green); }
.neg { color: var(--red); }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.error-row {
  margin-top: 14px; padding: 12px 14px; border-radius: 12px;
  background: var(--red-bg); color: #ffb3bd; font-size: 12.5px;
  border: 1px solid rgba(251,113,133,.25);
}

.logs {
  background: #05060a; border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; max-height: 340px; overflow: auto; font-size: 12px;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #aab6c6; margin: 0; white-space: pre-wrap; line-height: 1.7;
}
.logs::-webkit-scrollbar, .tbl-wrap::-webkit-scrollbar { width: 10px; height: 10px; }
.logs::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 3px solid #05060a; }

/* ---------------- forms / settings ---------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 620px) { .form-grid { grid-template-columns: 1fr; } }
.form-grid label { display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.form-grid input[type=number], .form-grid input[type=text], .form-grid select, .tbl input {
  background: var(--panel-solid); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 9px 12px; font-size: 14px; font-family: inherit;
  transition: border-color .15s, box-shadow .15s; outline: none;
}
.form-grid input:focus, .form-grid select:focus, .tbl input:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,139,255,.18);
}
.form-grid label.check { flex-direction: row; align-items: center; gap: 9px; color: var(--text); font-weight: 500; }
.form-grid input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }
.tbl input { width: 100%; }
.tbl td .btn-del { background: var(--red-bg); color: var(--red); padding: 6px 11px; border: 1px solid rgba(251,113,133,.3); }
.tbl td .btn-del:hover { background: rgba(251,113,133,.22); }

.btn-mini {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--muted);
  border-radius: 7px; padding: 4px 10px; font-size: 11.5px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: border-color .15s, color .15s, background .15s;
}
.btn-mini:hover { border-color: var(--line-strong); color: var(--text); }
.btn-close { color: var(--red); border-color: rgba(251,113,133,.3); background: var(--red-bg); }
.btn-close:hover { background: rgba(251,113,133,.22); }
.mode-select {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 11px; padding: 8px 12px; font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer;
}
.mode-select:hover { border-color: var(--line-strong); }

.save-bar {
  display: flex; align-items: center; gap: 16px; position: sticky; bottom: 18px;
  background: var(--panel); backdrop-filter: blur(12px); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 18px; box-shadow: var(--shadow-lg);
}
.save-bar .btn { padding: 11px 24px; }

.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(10px);
  background: var(--panel-solid); border: 1px solid var(--line-strong); color: var(--text);
  padding: 12px 20px; border-radius: 12px; font-size: 13px; font-weight: 500;
  opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; z-index: 60;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------------- docs ---------------- */
.doc h3 { font-size: 14px; font-weight: 700; margin: 18px 0 6px; color: var(--text); letter-spacing: -0.01em; }
.doc h3:first-of-type { margin-top: 6px; }
.doc p { font-size: 13.5px; line-height: 1.65; color: var(--muted); margin: 8px 0; }
.doc p b { color: var(--text); font-weight: 600; }
.doc code { background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; font-size: 12px; font-family: 'JetBrains Mono', ui-monospace, monospace; color: var(--accent); }
.doc .tbl { margin: 6px 0 4px; }
.doc .tstatus, .doc .tmode { display: inline-block; vertical-align: middle; }

/* ---------------- login ---------------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 16px;
  padding: 32px 30px; animation: rise .5s cubic-bezier(.2,.7,.3,1) both;
}
.login-brand { display: flex; align-items: center; gap: 10px; justify-content: center; }
.login-title { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; margin: 4px 0 8px; text-align: center; }
.login-field { display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.login-field input {
  background: var(--panel-solid); border: 1px solid var(--line); color: var(--text);
  border-radius: 11px; padding: 11px 13px; font-size: 15px; font-family: inherit; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.login-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,139,255,.18); }
.login-submit { width: 100%; padding: 12px; font-size: 14px; margin-top: 6px; justify-content: center; }
.login-error {
  background: var(--red-bg); color: #ffb3bd; border: 1px solid rgba(251,113,133,.25);
  border-radius: 10px; padding: 10px 12px; font-size: 13px; text-align: center;
}

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; vertical-align: middle; }
.dot.on { background: var(--green); box-shadow: 0 0 0 4px var(--green-bg); animation: pulse 2s infinite; }
.dot.off { background: var(--faint); }

/* ---------------- theme toggle ---------------- */
.theme-toggle {
  margin-left: auto; display: grid; place-items: center; width: 38px; height: 38px;
  border-radius: 11px; border: 1px solid var(--line); background: var(--panel-2);
  color: var(--muted); cursor: pointer; transition: color .18s, border-color .18s, background .18s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--line-strong); }
.theme-toggle + .badge { margin-left: 12px; }
.theme-toggle .ic-sun { display: none; }
.theme-toggle .ic-moon { display: block; }
[data-theme="light"] .theme-toggle .ic-sun { display: block; }
[data-theme="light"] .theme-toggle .ic-moon { display: none; }

/* ---------------- charts: equity ---------------- */
.chart-wrap { position: relative; height: 150px; }
.eq-chart { height: 190px; }
#equity-spark { width: 100%; height: 190px; display: block; }
.axgrid { stroke: var(--line); stroke-width: 1; }
.axline { stroke: var(--line-strong); stroke-width: 1; }
.axlab { fill: var(--faint); font-size: 10px; font-family: 'Inter', sans-serif; font-variant-numeric: tabular-nums; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; }
.spark-line { stroke-dasharray: 2200; stroke-dashoffset: 2200; animation: draw 1.1s cubic-bezier(.4,0,.2,1) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---------------- charts: donut ---------------- */
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
#alloc-donut { width: 130px; height: 130px; flex: none; }
.donut-seg { transition: stroke-dasharray .6s ease; }
.donut-center { font-size: 24px; font-weight: 800; fill: var(--text); font-family: 'Inter'; }
.donut-sub { font-size: 7.5px; fill: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.legend { display: flex; flex-direction: column; gap: 9px; font-size: 12.5px; min-width: 140px; flex: 1; }
.leg { display: flex; align-items: center; gap: 9px; color: var(--muted); }
.leg b { margin-left: auto; color: var(--text); font-variant-numeric: tabular-nums; }
.dotc { width: 11px; height: 11px; border-radius: 3px; flex: none; }

/* ---------------- ticker mini-cards ---------------- */
.live-tag {
  display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; color: var(--green);
  background: var(--green-bg); padding: 4px 10px; border-radius: 999px;
}
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); animation: pulse 1.4s infinite; }

.ticker-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(225px, 1fr)); gap: 14px; }
.tcard {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 15px; display: flex; flex-direction: column; gap: 9px;
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.tcard:hover { border-color: var(--line-strong); transform: translateY(-3px); box-shadow: var(--shadow); }
.tcard-head { display: flex; justify-content: space-between; align-items: center; }
.tcard-head b { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.tprice { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.tmode { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 6px; border-radius: 5px; margin-left: 4px; }
.tmode-classic { background: rgba(124,139,255,.16); color: var(--accent); }
.tmode-dip { background: rgba(168,85,247,.16); color: var(--accent-2); }
.tmode-band { background: rgba(52,211,153,.16); color: var(--green); }
.tmode-grid { background: rgba(96,165,250,.16); color: var(--blue); }
.tstatus { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 4px 10px; border-radius: 999px; }
.ts-green { background: var(--green-bg); color: var(--green); }
.ts-blue { background: rgba(96,165,250,.16); color: var(--blue); }
.ts-muted { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.tspark { width: 100%; height: 44px; display: block; }
.tmeta { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.rsi-row { display: flex; align-items: center; gap: 9px; }
.rsi-lbl { font-size: 9.5px; color: var(--faint); width: 22px; font-weight: 600; }
.rsi-track { flex: 1; height: 6px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.rsi-fill { height: 100%; border-radius: 6px; transition: width .7s ease; }
.rsi-num { font-size: 12px; font-weight: 600; width: 26px; text-align: right; font-variant-numeric: tabular-nums; }

/* ====================================================
   СВЕТЛАЯ ТЕМА
   ==================================================== */
[data-theme="light"] {
  --bg: #f3f5fa;
  --bg-2: #e9ecf4;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-solid: #ffffff;
  --panel-2: rgba(30, 38, 70, 0.04);
  --line: rgba(30, 38, 70, 0.10);
  --line-strong: rgba(30, 38, 70, 0.18);
  --text: #181c2a;
  --muted: #5b6477;
  --faint: #939bad;
  --green: #15a866;
  --green-bg: rgba(21, 168, 102, .12);
  --red: #e23b54;
  --red-bg: rgba(226, 59, 84, .10);
  --blue: #3b82f6;
  --shadow: 0 10px 30px -16px rgba(40, 55, 110, .28), 0 1px 0 rgba(255, 255, 255, .7) inset;
  --shadow-lg: 0 24px 60px -24px rgba(40, 55, 110, .32);
}
[data-theme="light"] body { background: var(--bg); }
[data-theme="light"] .bg-glow {
  background:
    radial-gradient(620px 420px at 12% -8%, rgba(99, 102, 241, .14), transparent 60%),
    radial-gradient(680px 480px at 100% 0%, rgba(168, 85, 247, .10), transparent 55%),
    var(--bg);
}
[data-theme="light"] .topbar { background: rgba(255, 255, 255, 0.72); }
[data-theme="light"] .page-title { background: linear-gradient(120deg, #1a1f33 20%, #5b4fe0 100%); -webkit-background-clip: text; background-clip: text; }
[data-theme="light"] .logs { background: #f7f8fc; color: #3b4356; }
[data-theme="light"] .logs::-webkit-scrollbar-thumb { border-color: #f7f8fc; }
[data-theme="light"] .brand-name b, [data-theme="light"] .nav a.active svg { filter: none; }
