:root {
  --bg: #edf4ff;
  --body-bg:
    linear-gradient(135deg, rgba(47, 111, 255, 0.13), transparent 28%, rgba(48, 150, 255, 0.10) 62%, rgba(99, 102, 241, 0.10)),
    linear-gradient(180deg, #f6f8ff 0%, #edf3ff 46%, #e2eaff 100%);
  --ink: #101727;
  --muted: #687795;
  --faint: #8d9ac0;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-strong: #ffffff;
  --panel-soft: rgba(244, 247, 255, 0.84);
  --panel-deep: rgba(232, 238, 255, 0.94);
  --topbar-bg: rgba(248, 250, 255, 0.80);
  --input-bg: rgba(255, 255, 255, 0.92);
  --table-head: rgba(231, 237, 255, 0.95);
  --chip-bg: rgba(255, 255, 255, 0.76);
  --line: rgba(24, 46, 84, 0.18);
  --line-strong: rgba(30, 64, 122, 0.28);
  --accent: #1d4ed8;
  --accent-strong: #4f8cff;
  --cyan: #0ea5ff;
  --cyan-soft: rgba(4, 137, 255, 0.12);
  --amber: #e7a72f;
  --red: #e64761;
  --profit: #60a5fa;
  --profit-strong: #2563eb;
  --blue: #087bdc;
  --warning-bg: rgba(231, 167, 47, 0.14);
  --warning-ink: #8a5e09;
  --error-bg: rgba(230, 71, 97, 0.12);
  --error-ink: #b72b45;
  --note-bg: rgba(47, 111, 255, 0.13);
  --code-bg: rgba(16, 31, 68, 0.07);
  --shadow: 0 24px 80px rgba(12, 31, 70, 0.16);
  --shadow-hover: 0 32px 96px rgba(12, 31, 70, 0.24);
  --focus-ring: 0 0 0 3px rgba(47, 111, 255, 0.20), 0 0 0 1px rgba(4, 137, 255, 0.28);
  --edge: linear-gradient(90deg, #1d4ed8, var(--cyan), #6366f1);
  --button: linear-gradient(135deg, #1d4ed8, #0ea5ff);
  --button-hover: linear-gradient(135deg, #4f8cff, #38bdf8);
}

:root[data-theme="dark"] {
  --bg: #050b18;
  --body-bg:
    linear-gradient(135deg, rgba(27, 114, 255, 0.16), transparent 32%, rgba(101, 214, 255, 0.10) 72%, rgba(30, 65, 109, 0.18)),
    linear-gradient(180deg, #050b18 0%, #061126 44%, #08172d 100%);
  --ink: #f6faff;
  --muted: #91a7c8;
  --faint: #5f759a;
  --panel: rgba(7, 19, 38, 0.90);
  --panel-strong: #071326;
  --panel-soft: rgba(10, 23, 48, 0.90);
  --panel-deep: rgba(6, 17, 37, 0.96);
  --topbar-bg: rgba(7, 19, 38, 0.94);
  --input-bg: rgba(5, 13, 30, 0.95);
  --table-head: rgba(8, 22, 45, 0.98);
  --chip-bg: rgba(8, 22, 45, 0.88);
  --line: rgba(110, 200, 255, 0.17);
  --line-strong: rgba(110, 200, 255, 0.34);
  --accent: #1b72ff;
  --accent-strong: #65d6ff;
  --cyan: #65d6ff;
  --cyan-soft: rgba(54, 200, 255, 0.12);
  --amber: #ffd36d;
  --red: #ff4d6d;
  --profit: #72ddff;
  --profit-strong: #65d6ff;
  --blue: #65d6ff;
  --warning-bg: rgba(255, 211, 109, 0.12);
  --warning-ink: #ffe1a1;
  --error-bg: rgba(255, 77, 109, 0.12);
  --error-ink: #ffa0b2;
  --note-bg: rgba(47, 111, 255, 0.12);
  --code-bg: rgba(54, 200, 255, 0.08);
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.52), 0 0 0 1px rgba(110, 200, 255, 0.08);
  --shadow-hover: 0 36px 118px rgba(0, 0, 0, 0.64), 0 0 50px rgba(27, 114, 255, 0.12);
  --focus-ring: 0 0 0 3px rgba(27, 114, 255, 0.26), 0 0 0 1px rgba(101, 214, 255, 0.36);
  --edge: linear-gradient(90deg, #1b72ff, #65d6ff, #214f81);
  --button: linear-gradient(135deg, #1b72ff, #0ea5ff);
  --button-hover: linear-gradient(135deg, #4fa0ff, #65d6ff);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  position: relative;
  isolation: isolate;
  color: var(--ink);
  background: var(--body-bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

body::before {
  background:
    linear-gradient(115deg, transparent 0 47%, rgba(27, 114, 255, 0.13) 47.1% 47.3%, transparent 47.4%),
    repeating-linear-gradient(90deg, rgba(110, 200, 255, 0.08) 0 1px, transparent 1px 80px),
    repeating-linear-gradient(0deg, rgba(101, 214, 255, 0.06) 0 1px, transparent 1px 90px);
  opacity: 0.82;
  mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.34) 60%, transparent 100%);
}

body::after {
  background:
    linear-gradient(180deg, transparent 0%, rgba(47, 111, 255, 0.06) 54%, transparent 55%),
    linear-gradient(90deg, transparent, rgba(54, 200, 255, 0.10), transparent);
  opacity: 0.82;
}

body > main,
.topbar,
.login-theme {
  position: relative;
  z-index: 1;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

body,
.topbar,
.bot-card,
.admin-create,
.admin-table-wrap,
.login-panel,
.exchange-panel,
.report-grid div,
.head-metrics div,
.quick-stats div,
.budget-strip div,
.compact-list > div,
.user-profit span,
.user-bot-card,
.user-bot-stats span,
input,
select,
button,
.user-pill,
.nav-link,
.mode-chip,
.status,
.mini-badge,
.bot-badge,
.toast {
  transition:
    background-color 0.24s ease,
    color 0.24s ease,
    border-color 0.24s ease,
    box-shadow 0.24s ease,
    transform 0.18s ease,
    opacity 0.18s ease;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 70px;
  padding: 12px clamp(16px, 3vw, 38px);
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(47, 111, 255, 0.08), transparent 26%, rgba(54, 200, 255, 0.07)),
    var(--topbar-bg);
  backdrop-filter: blur(22px) saturate(1.15);
  box-shadow: 0 12px 44px rgba(0, 0, 0, 0.15);
}

.brand,
.brand-row {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  font-weight: 950;
  letter-spacing: 0;
}

.brand {
  font-size: 15px;
  text-transform: uppercase;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid rgba(88, 142, 255, 0.42);
  border-radius: 8px;
  color: #f7fbff;
  background: var(--edge);
  box-shadow: 0 12px 34px rgba(47, 111, 255, 0.26), inset 0 0 18px rgba(255, 255, 255, 0.28);
  font-size: 13px;
  font-weight: 1000;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.theme-switch span,
.eyebrow,
.section-title span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.theme-select,
.user-pill,
.nav-link,
.mode-chip,
.status,
.mini-badge,
.bot-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--chip-bg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  font-size: 12px;
  font-weight: 850;
}

.theme-select {
  width: auto;
  appearance: none;
  padding-right: 28px;
}

.nav-link:hover,
.user-pill:hover,
.theme-select:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.nav-link.danger {
  color: var(--red);
  border-color: rgba(255, 77, 109, 0.26);
}

.login-theme {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 20;
}

.shell {
  width: min(100% - 32px, 1540px);
  margin: 0 auto;
  padding: 34px 0 56px;
}

.trading-layout {
  display: grid;
  grid-template-columns: minmax(520px, 1.12fr) minmax(360px, 0.88fr) 344px;
  gap: 10px;
  align-items: stretch;
}

.market-panel,
.bot-workspace,
.strategy-sidebar {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(27, 114, 255, 0.06), transparent 44%, rgba(101, 214, 255, 0.045)),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.12);
}

.market-panel {
  overflow: hidden;
}

.market-toolbar,
.active-bots-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.market-toolbar {
  justify-content: flex-start;
}

.timeframe-tabs,
.pair-tabs,
.strategy-mode-switch,
.strategy-tabs,
.strip-tabs,
.strip-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.timeframe-tabs button,
.pair-tabs button,
.strategy-mode-switch button,
.strategy-tabs button,
.strip-tabs button {
  min-height: 30px;
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
  font-size: 12px;
}

.timeframe-tabs button.is-active,
.pair-tabs button.is-active,
.strategy-mode-switch button.is-active,
.strategy-tabs button.is-active,
.strip-tabs button.is-active {
  color: var(--ink);
  border-color: var(--line);
  background: rgba(101, 214, 255, 0.12);
}

.chart-tool {
  min-height: 30px;
  padding: 7px 12px;
  border-left: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
}

.price-chart-panel {
  display: grid;
  grid-template-rows: auto minmax(360px, 54vh);
  min-height: 520px;
  background: rgba(255, 255, 255, 0.02);
}

.price-chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 0;
}

.price-chart-head b {
  display: block;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.1;
}

.price-chart-head span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.price-chart-head strong {
  white-space: nowrap;
  font-size: 13px;
}

.price-chart {
  position: relative;
  min-width: 0;
  overflow: hidden;
}

.chart-loading {
  display: grid;
  height: 100%;
  place-items: center;
  color: var(--muted);
  font-weight: 900;
}

.candles-svg {
  width: 100%;
  height: 100%;
}

.price-grid {
  stroke: rgba(110, 200, 255, 0.14);
  stroke-width: 1;
}

.axis-label,
.last-price-label {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.last-price-label {
  fill: #fff;
}

.candle-wick {
  stroke-width: 1.2;
}

.candle-wick.up,
.candle-body.up {
  stroke: #23c9bd;
  fill: #23c9bd;
}

.candle-wick.down,
.candle-body.down {
  stroke: #ff5b68;
  fill: #ff5b68;
}

.volume-bar.up {
  fill: rgba(35, 201, 189, 0.30);
}

.volume-bar.down {
  fill: rgba(255, 91, 104, 0.30);
}

.last-price-line {
  stroke: rgba(255, 91, 104, 0.72);
  stroke-dasharray: 4 4;
  stroke-width: 1;
}

.chart-footer {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 8px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.active-bots-strip {
  justify-content: space-between;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.bot-workspace {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 10px;
}

.empty-bot-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 116px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  color: var(--muted);
  background: var(--panel-deep);
  text-align: left;
}

.workspace-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--cyan);
  background: var(--chip-bg);
  font-size: 24px;
  font-weight: 950;
}

.empty-bot-state b,
.empty-bot-state span {
  display: block;
}

.empty-bot-state b {
  color: var(--ink);
  font-size: 15px;
}

.empty-bot-state span {
  margin-top: 5px;
  max-width: 330px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.strategy-sidebar {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px;
}

.strategy-tabs-card,
.pair-search {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-deep);
}

.strategy-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 6px;
}

.strategy-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 8px;
}

.strategy-tabs button {
  align-items: flex-start;
  justify-content: center;
  flex-direction: column;
  min-height: 50px;
  text-align: left;
}

.strategy-tabs button small {
  margin-top: 4px;
  color: var(--faint);
  font-size: 10px;
}

.strategy-tabs button.is-soon:not(.is-active) {
  opacity: 0.76;
}

.balance-panel {
  display: grid;
  grid-column: 1 / -1;
  gap: 8px;
  width: 100%;
}

.balance-panel div,
.balance-row {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(110, 200, 255, 0.14);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(8, 22, 45, 0.72);
}

.balance-panel div {
  display: grid;
  gap: 4px;
}

.balance-panel small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
}

.balance-panel strong {
  color: var(--cyan);
  font-size: 15px;
}

.balance-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  box-shadow: none;
  text-align: left;
}

.balance-row:hover,
.balance-row.is-active {
  border-color: rgba(101, 214, 255, 0.38);
  background: rgba(27, 114, 255, 0.15);
}

.balance-row span {
  display: grid;
  gap: 3px;
}

.balance-row b {
  color: var(--ink);
}

.balance-row em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
}

.pair-search {
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: center;
  padding: 9px 12px;
}

.pair-search input {
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.pair-search span {
  color: var(--muted);
  font-weight: 950;
}

.strategy-sidebar-head,
.pair-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 74px 82px;
  gap: 8px;
  align-items: center;
}

.strategy-sidebar-head {
  padding: 6px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.pair-list {
  display: grid;
  gap: 4px;
}

.pair-row {
  min-height: 46px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
  text-align: left;
}

.pair-row.is-active,
.pair-row:hover {
  border-color: var(--line);
  background: rgba(27, 114, 255, 0.08);
}

.pair-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 14px;
  font-weight: 900;
}

.pair-name b {
  display: grid;
  width: 30px;
  height: 20px;
  place-items: center;
  color: var(--cyan);
  font-size: 9px;
  letter-spacing: 0;
}

.mini-badge.short {
  color: #ff899d;
  border-color: rgba(255, 91, 104, 0.28);
  background: rgba(255, 91, 104, 0.10);
}

.mini-badge.long {
  color: #74e5d8;
  border-color: rgba(35, 201, 189, 0.28);
  background: rgba(35, 201, 189, 0.10);
}

@media (min-width: 1040px) {
  .topbar ~ .shell {
    width: min(calc(100% - 328px), 1320px);
    margin-left: 296px;
    margin-right: 32px;
    padding-top: 42px;
  }

  .topbar {
    position: fixed;
    inset: 32px auto 32px 32px;
    width: 232px;
    min-height: auto;
    padding: 24px 20px;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    border: 1px solid var(--line);
    border-radius: 12px;
    background:
      linear-gradient(145deg, rgba(27, 114, 255, 0.09), transparent 40%, rgba(101, 214, 255, 0.06)),
      var(--topbar-bg);
  }

  .brand {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 28px;
  }

  .brand span:last-child {
    display: block;
    color: var(--ink);
    font-size: 22px;
    line-height: 1.05;
  }

  .topbar-actions {
    width: 100%;
    flex: 1;
    align-items: stretch;
    justify-content: flex-start;
    flex-direction: column;
  }

  .topbar-actions .danger {
    margin-top: auto;
  }

  .theme-switch {
    display: grid;
    gap: 8px;
  }

  .nav-link,
  .user-pill,
  .theme-select {
    width: 100%;
    justify-content: flex-start;
    border-radius: 8px;
  }

  .user-pill {
    color: var(--cyan);
    border-color: rgba(101, 214, 255, 0.26);
    background: rgba(8, 47, 70, 0.36);
  }
}

.page-head {
  display: grid;
  grid-template-columns: minmax(300px, 0.72fr) minmax(0, 1.28fr);
  gap: 20px;
  align-items: end;
  margin-bottom: 24px;
}

.page-head h1,
.login-copy h1 {
  margin: 0;
  color: var(--ink);
  letter-spacing: 0;
  line-height: 0.96;
}

.page-head h1 {
  margin-top: 8px;
  font-size: clamp(42px, 5vw, 76px);
  font-weight: 1000;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
}

.head-metrics,
.quick-stats,
.report-grid,
.budget-strip,
.user-profit,
.user-bot-stats {
  display: grid;
  gap: 10px;
}

.head-metrics {
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
}

.quick-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.report-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.budget-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.head-metrics div,
.quick-stats div,
.report-grid div,
.budget-strip div,
.user-profit span,
.user-bot-stats span {
  min-width: 0;
  position: relative;
  overflow: hidden;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent),
    var(--panel-soft);
}

.head-metrics div::before,
.quick-stats div::before,
.report-grid div::before,
.budget-strip div::before,
.user-profit span::before,
.user-bot-stats span::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(88, 142, 255, 0.60), transparent);
  opacity: 0.8;
}

.head-metrics span,
.quick-stats span {
  display: block;
  overflow-wrap: anywhere;
  color: var(--accent-strong);
  font-size: 21px;
  font-weight: 1000;
  line-height: 1.1;
}

.head-metrics small,
.quick-stats small,
.report-grid small,
.budget-strip small,
.user-profit small,
.user-bot-stats small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.report-grid strong,
.budget-strip strong,
.user-profit strong,
.user-bot-stats b {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
}

.bot-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
}

.bot-workspace .bot-grid {
  display: block;
}

.bot-workspace .bot-card {
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 14px;
  box-shadow: none;
}

.bot-workspace .bot-card:hover {
  transform: none;
}

.bot-workspace .quick-stats,
.bot-workspace .strategy-visual,
.bot-workspace .budget-strip,
.bot-workspace .orders-table,
.bot-workspace .settings-form,
.bot-workspace .exchange-panel,
.bot-workspace .credentials,
.bot-workspace .bot-actions {
  grid-column: 1;
}

.bot-card,
.admin-create,
.admin-table-wrap,
.login-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(47, 111, 255, 0.07), transparent 36%, rgba(54, 200, 255, 0.055)),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.12);
}

.bot-card::before,
.admin-create::before,
.admin-table-wrap::before,
.login-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--edge);
  opacity: 0.9;
}

.bot-card {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  gap: 18px;
  padding: 22px;
}

.bot-card:hover,
.admin-create:hover,
.admin-table-wrap:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.bot-card-head {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.symbol-title {
  color: var(--ink);
  font-size: clamp(25px, 2.4vw, 36px);
  font-weight: 1000;
  line-height: 1;
}

.quick-stats,
.strategy-visual,
.budget-strip,
.orders-table {
  grid-column: 1;
}

.settings-form,
.exchange-panel,
.credentials,
.bot-actions {
  grid-column: 2;
}

.bot-card > .inline-error,
.bot-card > .warning-strip {
  grid-column: 1 / -1;
}

.symbol-title::after {
  content: "";
  display: block;
  width: 84px;
  height: 3px;
  margin-top: 9px;
  border-radius: 999px;
  background: var(--edge);
  box-shadow: 0 0 22px rgba(47, 111, 255, 0.30);
}

.subline {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.status-stack {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.status.good,
.bot-badge.on {
  color: #f7fbff;
  border-color: rgba(47, 111, 255, 0.72);
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  box-shadow: 0 0 22px rgba(47, 111, 255, 0.24);
}

.status.bad {
  color: #fff;
  border-color: rgba(255, 77, 109, 0.7);
  background: linear-gradient(135deg, #ff4d6d, #b72b45);
  box-shadow: 0 0 22px rgba(255, 77, 109, 0.2);
}

.status.warm {
  color: #181103;
  border-color: rgba(255, 211, 109, 0.7);
  background: linear-gradient(135deg, #ffd36d, #e7a72f);
  box-shadow: 0 0 22px rgba(255, 211, 109, 0.18);
}

.status.muted,
.status:not(.good):not(.bad):not(.warm) {
  color: var(--muted);
}

.mode-chip {
  color: var(--cyan);
  border-color: rgba(54, 200, 255, 0.28);
  background: var(--cyan-soft);
}

.strategy-visual {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(27, 114, 255, 0.08), transparent 42%, rgba(101, 214, 255, 0.07)),
    var(--panel-deep);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.strategy-visual-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.strategy-visual-head b {
  display: block;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.1;
  text-transform: uppercase;
}

.strategy-visual-head span:not(.mini-badge) {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.strategy-chart {
  position: relative;
  min-height: 210px;
  overflow: hidden;
  border: 1px solid rgba(110, 200, 255, 0.14);
  border-radius: 10px;
  background:
    repeating-linear-gradient(90deg, rgba(110, 200, 255, 0.12) 0 1px, transparent 1px 92px),
    repeating-linear-gradient(0deg, rgba(110, 200, 255, 0.10) 0 1px, transparent 1px 42px),
    linear-gradient(180deg, rgba(6, 17, 37, 0.58), rgba(5, 13, 30, 0.94));
}

.strategy-chart svg {
  position: absolute;
  inset: 12px;
  width: calc(100% - 24px);
  height: calc(100% - 24px);
  overflow: visible;
}

.chart-fill {
  fill: rgba(27, 114, 255, 0.14);
}

.chart-line {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 10px rgba(101, 214, 255, 0.50));
}

.buy-markers circle {
  fill: var(--accent);
  stroke: rgba(246, 250, 255, 0.86);
  stroke-width: 2;
}

.tp-markers circle {
  fill: var(--cyan);
  stroke: rgba(246, 250, 255, 0.86);
  stroke-width: 2;
}

.strategy-note {
  padding: 10px 12px;
  border: 1px solid rgba(110, 200, 255, 0.18);
  border-radius: 8px;
  color: #bfd5f4;
  background: rgba(11, 36, 75, 0.54);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.45;
}

.pnl-positive {
  color: var(--profit) !important;
}

.pnl-negative {
  color: var(--red) !important;
}

.pnl-neutral {
  color: var(--accent-strong) !important;
}

.exchange-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(54, 200, 255, 0.045), transparent 46%, rgba(47, 111, 255, 0.06)),
    var(--panel-deep);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 950;
  text-transform: uppercase;
}

.compact-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.compact-list > div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.compact-list b {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  text-transform: uppercase;
}

.muted-text {
  color: var(--muted);
}

.warning-strip,
.inline-error,
.form-error,
.form-note {
  padding: 11px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 850;
}

.warning-strip {
  border: 1px solid rgba(255, 211, 109, 0.28);
  color: var(--warning-ink);
  background: var(--warning-bg);
}

.inline-error,
.form-error {
  border: 1px solid rgba(255, 77, 109, 0.26);
  color: var(--error-ink);
  background: var(--error-bg);
}

.form-note {
  border: 1px solid rgba(47, 111, 255, 0.28);
  color: var(--profit-strong);
  background: var(--note-bg);
}

.split-form,
.credentials {
  display: grid;
  gap: 12px;
}

.split-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.credentials {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-deep);
}

label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  color: var(--ink);
  background: var(--input-bg);
}

input:hover,
select:hover {
  border-color: var(--line-strong);
}

input:focus,
select:focus {
  border-color: rgba(47, 111, 255, 0.58);
  box-shadow: var(--focus-ring);
}

select {
  cursor: pointer;
}

.toggle-line {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 42px;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  cursor: pointer;
  user-select: none;
}

.toggle-line input[type="checkbox"] {
  appearance: none;
  position: relative;
  flex: 0 0 auto;
  width: 48px;
  height: 26px;
  min-height: auto;
  margin: 0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(86, 107, 145, 0.28);
  box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  transition:
    background-color 0.22s ease,
    border-color 0.22s ease,
    box-shadow 0.22s ease;
}

.toggle-line input[type="checkbox"]::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #f7fbff;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.26);
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.toggle-line input[type="checkbox"]:checked {
  border-color: rgba(101, 214, 255, 0.62);
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  box-shadow: 0 0 22px rgba(27, 114, 255, 0.22);
}

.toggle-line input[type="checkbox"]:checked::before {
  transform: translateX(22px);
}

.toggle-line input[type="checkbox"]:focus-visible {
  box-shadow: var(--focus-ring);
}

.toggle-line span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
  text-transform: none;
}

.form-actions,
.bot-actions,
.row-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.form-actions.wide,
.section-title,
.credentials .section-title {
  grid-column: 1 / -1;
}

button {
  min-height: 40px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 950;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

.primary-button,
.start-button {
  color: #f7fbff;
  background: var(--button);
  box-shadow: 0 14px 36px rgba(47, 111, 255, 0.24);
}

.primary-button:hover,
.start-button:hover {
  background: var(--button-hover);
}

.secondary-button {
  color: var(--ink);
  border-color: var(--line);
  background: var(--chip-bg);
}

.secondary-button:hover {
  border-color: rgba(54, 200, 255, 0.34);
  box-shadow: 0 12px 28px rgba(54, 200, 255, 0.08);
}

.danger-outline-button {
  color: var(--red);
  border-color: rgba(255, 77, 109, 0.32);
  background: linear-gradient(135deg, rgba(255, 77, 109, 0.08), rgba(255, 77, 109, 0.02));
}

.danger-outline-button:hover {
  border-color: rgba(255, 77, 109, 0.55);
  box-shadow: 0 14px 34px rgba(255, 77, 109, 0.12);
}

.stop-button {
  color: #fff;
  background: linear-gradient(135deg, var(--red), #9f1f38);
  box-shadow: 0 14px 34px rgba(255, 77, 109, 0.18);
}

.settings-form {
  position: relative;
}

.settings-form.is-dirty {
  border-color: rgba(255, 211, 109, 0.28);
}

.settings-form.is-dirty::after {
  content: "";
  position: absolute;
  right: 0;
  top: -10px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--amber);
  box-shadow: 0 0 22px rgba(255, 211, 109, 0.65);
}

.orders-table,
.users-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 8px;
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  color: var(--muted);
  background: var(--table-head);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

tr:hover td {
  background: rgba(47, 111, 255, 0.045);
}

.empty-cell {
  color: var(--muted);
  text-align: center;
}

.mini-badge,
.bot-badge {
  margin: 0 5px 5px 0;
  min-height: 28px;
  padding: 5px 9px;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) 430px;
  width: min(1050px, 100%);
  min-height: 590px;
}

.login-copy {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
  padding: clamp(30px, 5vw, 62px);
  overflow: hidden;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(47, 111, 255, 0.16), transparent 42%, rgba(54, 200, 255, 0.14)),
    repeating-linear-gradient(90deg, rgba(88, 142, 255, 0.11) 0 1px, transparent 1px 54px),
    repeating-linear-gradient(0deg, rgba(54, 200, 255, 0.08) 0 1px, transparent 1px 34px),
    var(--panel-deep);
}

.login-copy::after {
  content: "";
  position: absolute;
  left: clamp(30px, 5vw, 62px);
  right: clamp(30px, 5vw, 62px);
  bottom: 56px;
  height: 2px;
  background: var(--edge);
  box-shadow: 0 0 24px rgba(47, 111, 255, 0.28);
}

.login-copy h1 {
  max-width: 520px;
  font-size: clamp(46px, 7vw, 86px);
  font-weight: 1000;
}

.login-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  font-weight: 850;
}

.login-market-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.login-market-strip span {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.login-form {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: clamp(24px, 4vw, 46px);
  background: var(--panel-strong);
}

.admin-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.admin-create,
.admin-table-wrap {
  padding: 18px;
}

.admin-create {
  display: grid;
  gap: 14px;
}

.admin-create h2 {
  margin: 0;
  font-size: 20px;
}

.admin-table-wrap {
  overflow-x: auto;
}

.users-table {
  min-width: 1120px;
}

.users-table code {
  display: inline-block;
  max-width: 220px;
  overflow-wrap: anywhere;
  padding: 5px 7px;
  border-radius: 6px;
  background: var(--code-bg);
  color: var(--muted);
}

.user-profit {
  min-width: 250px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.user-bot-list {
  display: grid;
  min-width: min(760px, 72vw);
  gap: 10px;
}

.user-bot-card {
  display: grid;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.user-bot-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.user-bot-title strong {
  color: var(--ink);
  font-size: 15px;
}

.user-bot-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  max-width: min(440px, calc(100% - 36px));
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  font-weight: 900;
}

.toast.success {
  color: #f7fbff;
  border-color: rgba(47, 111, 255, 0.55);
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
}

.toast.error {
  color: #fff;
  border-color: rgba(255, 77, 109, 0.45);
  background: linear-gradient(135deg, var(--red), #9f1f38);
}

@media (max-width: 1580px) {
  .trading-layout {
    grid-template-columns: minmax(0, 1fr) 344px;
  }

  .market-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1180px) {
  .trading-layout {
    grid-template-columns: 1fr;
  }

  .market-panel,
  .bot-workspace,
  .strategy-sidebar {
    grid-column: 1;
  }

  .price-chart-panel {
    grid-template-rows: auto 420px;
    min-height: 500px;
  }

  .page-head,
  .bot-grid,
  .bot-card,
  .admin-layout,
  .login-panel {
    grid-template-columns: 1fr;
  }

  .quick-stats,
  .strategy-visual,
  .budget-strip,
  .orders-table,
  .settings-form,
  .exchange-panel,
  .credentials,
  .bot-actions {
    grid-column: 1;
  }

  .login-panel {
    min-height: auto;
  }
}

@media (max-width: 820px) {
  .topbar,
  .page-head,
  .bot-card-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .head-metrics,
  .quick-stats,
  .report-grid,
  .budget-strip,
  .split-form,
  .credentials,
  .compact-list,
  .user-profit,
  .user-bot-stats {
    grid-template-columns: 1fr;
  }

  .shell {
    width: min(100% - 20px, 1540px);
    padding-top: 22px;
  }

  .market-toolbar,
  .active-bots-strip,
  .price-chart-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .chart-tool {
    width: 100%;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .price-chart-panel {
    grid-template-rows: auto 340px;
    min-height: 430px;
  }

  .strategy-sidebar-head,
  .pair-row {
    grid-template-columns: minmax(0, 1fr) 68px 76px;
  }

  .strategy-tabs {
    grid-template-columns: 1fr;
  }

  .login-shell {
    padding: 12px;
  }

  .login-copy,
  .login-form,
  .bot-card,
  .admin-create,
  .admin-table-wrap {
    padding: 16px;
  }

  .login-copy::after {
    left: 16px;
    right: 16px;
    bottom: 28px;
  }

  .user-bot-list {
    min-width: 0;
  }

  th,
  td {
    padding: 9px;
  }
}

body[data-page="dashboard"] .shell {
  width: min(100% - 20px, 1840px);
  padding-top: 18px;
}

body[data-page="dashboard"] .page-head {
  grid-template-columns: minmax(220px, 0.42fr) minmax(0, 1fr);
  gap: 14px;
  align-items: end;
  margin-bottom: 12px;
}

body[data-page="dashboard"] .page-head h1 {
  font-size: clamp(30px, 3.4vw, 56px);
}

body[data-page="dashboard"] .head-metrics {
  grid-template-columns: repeat(5, minmax(112px, 1fr));
}

body[data-page="dashboard"] .trading-layout {
  display: grid;
  grid-template-columns: minmax(680px, 1.45fr) minmax(380px, 0.86fr) 330px;
  gap: 10px;
  align-items: stretch;
  min-height: calc(100vh - 150px);
}

body[data-page="dashboard"] .market-panel,
body[data-page="dashboard"] .bot-workspace,
body[data-page="dashboard"] .strategy-sidebar {
  border-radius: 8px;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

body[data-page="dashboard"] .market-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(560px, 1fr) auto;
  min-height: 720px;
}

.layout-resizer {
  display: none;
}

.chart-terminal-toolbar {
  position: relative;
  min-height: 48px;
  overflow: visible;
}

.chart-tool-button,
.chart-toolset button,
.grid-control-bar button {
  min-height: 32px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--chip-bg);
  box-shadow: none;
  font-size: 12px;
}

.chart-tool-button:hover,
.chart-toolset button:hover,
.grid-control-bar button:hover,
.chart-toolset button.is-active,
.grid-control-bar button.is-active {
  color: var(--ink);
  border-color: rgba(101, 214, 255, 0.38);
  background: rgba(27, 114, 255, 0.16);
}

.chart-toolset {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}

.chart-menu,
.indicator-menu {
  position: absolute;
  z-index: 35;
  top: 54px;
  max-height: min(620px, calc(100vh - 180px));
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(5, 13, 30, 0.98);
  box-shadow: 0 28px 88px rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(20px);
}

.chart-menu[hidden],
.indicator-menu[hidden] {
  display: none !important;
}

.indicator-menu {
  left: 124px;
  width: min(560px, calc(100% - 150px));
}

.timeframe-menu {
  left: 10px;
  width: min(240px, calc(100% - 20px));
}

.tool-menu {
  left: 248px;
  width: min(430px, calc(100% - 258px));
}

.chart-menu .timeframe-tabs,
.chart-menu .chart-toolset {
  display: grid;
  align-items: stretch;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 0;
  border: 0;
}

.chart-menu .chart-toolset {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.chart-menu .timeframe-tabs button,
.chart-menu .chart-toolset button {
  width: 100%;
  justify-content: flex-start;
  min-height: 38px;
  text-align: left;
}

.indicator-search {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--input-bg);
}

.indicator-search input {
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.indicator-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  max-height: 480px;
  overflow: auto;
  padding-right: 4px;
}

.indicator-list button {
  justify-content: flex-start;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid rgba(110, 200, 255, 0.14);
  color: var(--muted);
  background: rgba(8, 22, 45, 0.78);
  box-shadow: none;
  font-size: 12px;
  text-align: left;
}

.indicator-list button span {
  width: 9px;
  height: 9px;
  margin-right: 8px;
  border-radius: 999px;
  background: var(--indicator-color);
  box-shadow: 0 0 14px var(--indicator-color);
}

.indicator-list button.is-active {
  color: var(--ink);
  border-color: rgba(101, 214, 255, 0.42);
  background: rgba(27, 114, 255, 0.18);
}

.grid-control-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  min-height: 44px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(6, 17, 37, 0.72);
}

body[data-page="dashboard"] .price-chart-panel {
  display: grid;
  grid-template-rows: auto minmax(520px, 1fr);
  min-height: 0;
  background:
    radial-gradient(circle at 76% 12%, rgba(27, 114, 255, 0.12), transparent 30%),
    rgba(5, 13, 30, 0.96);
}

body[data-page="dashboard"] .price-chart {
  min-height: 560px;
}

.terminal-chart-stage {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 560px;
  overflow: hidden;
  cursor: crosshair;
  background: #071326;
}

#priceCanvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 560px;
  touch-action: none;
}

.chart-status {
  position: absolute;
  left: 14px;
  bottom: 14px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(5, 13, 30, 0.84);
  font-size: 12px;
  font-weight: 900;
}

.chart-help {
  position: absolute;
  right: 14px;
  bottom: 14px;
  max-width: 430px;
  padding: 8px 10px;
  border: 1px solid rgba(110, 200, 255, 0.12);
  border-radius: 8px;
  color: rgba(174, 198, 230, 0.82);
  background: rgba(5, 13, 30, 0.54);
  font-size: 11px;
  font-weight: 850;
}

body[data-page="dashboard"] .active-bots-strip button.is-active {
  color: var(--ink);
  border-color: rgba(101, 214, 255, 0.42);
  background: rgba(27, 114, 255, 0.18);
}

body[data-page="dashboard"] .bot-workspace {
  overflow: auto;
  min-height: 720px;
  max-height: calc(100vh - 150px);
  border-left: 0;
  border-right: 0;
}

.compact-bot-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.compact-budget-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.bot-actions-compact {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-deep);
}

.collapsible-panel {
  grid-column: 1 / -1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-deep);
}

.collapsible-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  padding: 11px 13px;
  cursor: pointer;
  color: var(--ink);
  font-size: 13px;
  font-weight: 950;
  list-style: none;
  text-transform: uppercase;
}

.collapsible-panel summary::-webkit-details-marker {
  display: none;
}

.collapsible-panel summary::after {
  content: "+";
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--cyan);
  background: var(--chip-bg);
}

.collapsible-panel[open] summary::after {
  content: "-";
}

.collapsible-panel summary b {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  text-transform: none;
}

.collapsible-panel .settings-form,
.collapsible-panel .exchange-panel,
.collapsible-panel .credentials,
.collapsible-panel .orders-table {
  margin: 0 12px 12px;
}

.strategy-visual {
  display: none !important;
}

body[data-page="dashboard"] .strategy-sidebar {
  overflow: auto;
  min-height: 720px;
  max-height: calc(100vh - 150px);
}

@media (min-width: 1501px) {
  body[data-page="dashboard"] .market-panel,
  body[data-page="dashboard"] .bot-workspace,
  body[data-page="dashboard"] .strategy-sidebar {
    grid-column: auto;
  }
}

@media (min-width: 1040px) {
  body[data-page="dashboard"] .topbar ~ .shell {
    width: min(calc(100% - 300px), 1840px);
    margin-left: 276px;
    margin-right: 20px;
    padding-top: 22px;
  }
}

@media (max-width: 1500px) {
  body[data-page="dashboard"] .trading-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .layout-resizer {
    display: none;
  }

  body[data-page="dashboard"] .market-panel,
  body[data-page="dashboard"] .bot-workspace,
  body[data-page="dashboard"] .strategy-sidebar {
    grid-column: 1;
    max-height: none;
  }
}

@media (max-width: 920px) {
  body[data-page="dashboard"] .page-head,
  body[data-page="dashboard"] .head-metrics,
  .compact-budget-strip,
  .indicator-list {
    grid-template-columns: 1fr;
  }

  .indicator-menu {
    left: 10px;
    right: 10px;
    width: auto;
  }

  .chart-menu,
  .tool-menu,
  .timeframe-menu {
    left: 10px;
    right: 10px;
    width: auto;
  }

  .chart-menu .chart-toolset {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-toolset,
  .grid-control-bar {
    width: 100%;
  }

  body[data-page="dashboard"] .price-chart,
  .terminal-chart-stage,
  #priceCanvas {
    min-height: 420px;
  }
}

@media (min-width: 1181px) and (max-width: 1500px) {
  body[data-page="dashboard"] .trading-layout {
    grid-template-columns: minmax(620px, 1fr) minmax(360px, 420px);
    align-items: start;
  }

  body[data-page="dashboard"] .market-panel,
  body[data-page="dashboard"] .bot-workspace {
    grid-column: auto;
    min-height: calc(100vh - 150px);
  }

  body[data-page="dashboard"] .strategy-sidebar {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
    min-height: auto;
    max-height: none;
  }

  body[data-page="dashboard"] .strategy-tabs-card,
  body[data-page="dashboard"] .pair-search {
    align-self: start;
  }

  body[data-page="dashboard"] .strategy-sidebar-head {
    align-self: end;
  }

  body[data-page="dashboard"] .pair-list {
    grid-column: 2;
    grid-row: 2 / span 3;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 821px) and (max-width: 1180px) {
  body[data-page="dashboard"] .shell {
    width: min(100% - 24px, 1040px);
  }

  body[data-page="dashboard"] .trading-layout {
    grid-template-columns: 1fr;
  }

  body[data-page="dashboard"] .page-head {
    grid-template-columns: 1fr;
  }

  body[data-page="dashboard"] .head-metrics,
  body[data-page="dashboard"] .quick-stats,
  body[data-page="dashboard"] .compact-budget-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-page="dashboard"] .market-panel {
    min-height: 640px;
  }

  body[data-page="dashboard"] .price-chart,
  body[data-page="dashboard"] .terminal-chart-stage,
  body[data-page="dashboard"] #priceCanvas {
    min-height: 520px;
  }
}

@media (max-width: 760px) {
  body {
    overflow-x: hidden;
  }

  body::before {
    opacity: 0.55;
  }

  .topbar {
    align-items: stretch;
    gap: 10px;
    min-height: auto;
    padding: 10px;
  }

  .brand {
    width: 100%;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 0;
    font-size: 13px;
  }

  .brand span:last-child {
    font-size: 15px;
    line-height: 1;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 8px;
  }

  .topbar-actions {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: flex-start;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 7px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .topbar-actions::-webkit-scrollbar,
  .market-toolbar::-webkit-scrollbar,
  .grid-control-bar::-webkit-scrollbar,
  .active-bots-strip::-webkit-scrollbar {
    display: none;
  }

  .theme-switch {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 7px;
  }

  .theme-switch span {
    display: none;
  }

  .nav-link,
  .user-pill,
  .theme-select {
    width: auto;
    flex: 0 0 auto;
    justify-content: center;
    min-height: 34px;
    padding: 7px 10px;
    border-radius: 999px;
  }

  .theme-select {
    max-width: 112px;
  }

  .shell,
  body[data-page="dashboard"] .shell {
    width: 100%;
    padding: 12px 8px 34px;
  }

  body[data-page="dashboard"] .page-head {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 2px 0 10px;
    padding: 0 2px;
  }

  body[data-page="dashboard"] .page-head h1 {
    margin-top: 6px;
    font-size: clamp(31px, 10vw, 42px);
    line-height: 0.98;
  }

  body[data-page="dashboard"] .head-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .head-metrics div,
  .quick-stats div,
  .budget-strip div,
  .report-grid div,
  .compact-list > div {
    padding: 10px;
  }

  .head-metrics span,
  .quick-stats span {
    font-size: 18px;
  }

  body[data-page="dashboard"] .trading-layout {
    grid-template-columns: 1fr;
    gap: 8px;
    min-height: 0;
  }

  body[data-page="dashboard"] .market-panel,
  body[data-page="dashboard"] .bot-workspace,
  body[data-page="dashboard"] .strategy-sidebar {
    min-height: 0;
    max-height: none;
    border-radius: 8px;
  }

  .market-toolbar,
  .grid-control-bar,
  .active-bots-strip {
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    gap: 7px;
    padding: 7px 8px;
  }

  .market-toolbar > *,
  .grid-control-bar > *,
  .active-bots-strip > * {
    flex: 0 0 auto;
  }

  .pair-tabs,
  .strip-tabs,
  .strip-actions {
    flex-wrap: nowrap;
  }

  .chart-tool {
    width: auto;
    min-height: 32px;
    border-top: 0;
    border-left: 1px solid var(--line);
    padding: 7px 10px;
  }

  .chart-tool-button,
  .chart-toolset button,
  .grid-control-bar button,
  .pair-tabs button,
  .strip-tabs button,
  .strip-actions button {
    min-height: 34px;
    white-space: nowrap;
  }

  .chart-menu,
  .indicator-menu,
  .tool-menu,
  .timeframe-menu {
    position: absolute;
    left: 8px;
    right: 8px;
    top: 50px;
    width: auto;
    max-height: min(560px, calc(100svh - 120px));
    border-radius: 10px;
  }

  .chart-menu .timeframe-tabs,
  .chart-menu .chart-toolset,
  .indicator-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-page="dashboard"] .market-panel {
    grid-template-rows: auto auto minmax(440px, 58svh) auto;
  }

  body[data-page="dashboard"] .price-chart-panel {
    grid-template-rows: auto minmax(440px, 58svh);
  }

  body[data-page="dashboard"] .price-chart,
  body[data-page="dashboard"] .terminal-chart-stage,
  body[data-page="dashboard"] #priceCanvas {
    min-height: 440px;
  }

  .price-chart-head {
    flex-direction: column;
    gap: 7px;
    padding: 10px 10px 0;
  }

  .price-chart-head b {
    font-size: 15px;
  }

  .price-chart-head span,
  .price-chart-head strong {
    font-size: 11px;
  }

  .chart-help {
    display: none;
  }

  .chart-status {
    left: 10px;
    bottom: 10px;
    max-width: calc(100% - 20px);
  }

  body[data-page="dashboard"] .bot-workspace {
    padding: 8px;
  }

  .empty-bot-state {
    min-height: 84px;
    padding: 10px;
    justify-content: flex-start;
  }

  .compact-bot-card,
  .bot-workspace .bot-card {
    gap: 10px;
    padding: 10px;
  }

  .bot-card-head {
    gap: 9px;
  }

  .symbol-title {
    font-size: clamp(24px, 9vw, 34px);
  }

  .status-stack {
    justify-content: flex-start;
  }

  body[data-page="dashboard"] .quick-stats,
  body[data-page="dashboard"] .compact-budget-strip,
  .report-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .budget-strip strong,
  .report-grid strong {
    font-size: 12px;
  }

  .bot-actions,
  .bot-actions-compact,
  .form-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .bot-actions button,
  .form-actions button {
    width: 100%;
    min-height: 42px;
  }

  .danger-outline-button[data-action="clear-history"],
  .form-actions.wide button[type="submit"],
  .form-actions.wide button[type="button"] {
    grid-column: span 2;
  }

  .split-form,
  .credentials,
  .compact-list,
  .user-profit,
  .user-bot-stats {
    grid-template-columns: 1fr;
  }

  label span {
    font-size: 11px;
  }

  input,
  select {
    min-height: 44px;
    font-size: 16px;
  }

  .toggle-line {
    min-height: 48px;
    align-items: center;
  }

  .collapsible-panel summary {
    min-height: 48px;
    padding: 10px 11px;
  }

  .collapsible-panel summary b {
    max-width: 42%;
    text-align: right;
  }

  .collapsible-panel .settings-form,
  .collapsible-panel .exchange-panel,
  .collapsible-panel .credentials,
  .collapsible-panel .orders-table {
    margin: 0 8px 8px;
  }

  .collapsible-panel .orders-table {
    min-width: 560px;
  }

  details.collapsible-panel:has(.orders-table) {
    overflow-x: auto;
  }

  body[data-page="dashboard"] .strategy-sidebar {
    padding: 8px;
  }

  .strategy-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 7px;
  }

  .strategy-tabs button {
    min-height: 48px;
    padding: 8px 9px;
  }

  .strategy-sidebar-head,
  .pair-row {
    grid-template-columns: minmax(0, 1fr) 66px 76px;
  }

  .pair-row {
    min-height: 48px;
  }

  .toast {
    left: 10px;
    right: 10px;
    bottom: 10px;
    max-width: none;
  }
}

@media (max-width: 430px) {
  body[data-page="dashboard"] .head-metrics,
  body[data-page="dashboard"] .quick-stats,
  body[data-page="dashboard"] .compact-budget-strip,
  .report-grid {
    grid-template-columns: 1fr 1fr;
  }

  .head-metrics small,
  .quick-stats small,
  .report-grid small,
  .budget-strip small {
    font-size: 9px;
  }

  .strategy-sidebar-head {
    display: none;
  }

  .pair-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .pair-row > span:last-child {
    grid-column: 2;
  }

  .mini-badge {
    min-height: 24px;
    padding: 4px 7px;
    font-size: 10px;
  }
}

/* BingX-style terminal redesign */
:root {
  --bg: #f4f6fb;
  --body-bg: #f4f6fb;
  --ink: #101828;
  --muted: #667085;
  --faint: #98a2b3;
  --panel: #ffffff;
  --panel-strong: #ffffff;
  --panel-soft: #f8fafc;
  --panel-deep: #eef3f8;
  --topbar-bg: rgba(255, 255, 255, 0.96);
  --input-bg: #ffffff;
  --table-head: #f2f6fb;
  --chip-bg: #f6f9fd;
  --line: #dce5f0;
  --line-strong: #c8d6e6;
  --accent: #1677ff;
  --accent-strong: #0f62d7;
  --cyan: #149dff;
  --cyan-soft: rgba(22, 119, 255, 0.09);
  --amber: #f5a524;
  --red: #f04438;
  --profit: #00a870;
  --profit-strong: #00a870;
  --blue: #1677ff;
  --warning-bg: rgba(245, 165, 36, 0.12);
  --warning-ink: #9a6700;
  --error-bg: rgba(240, 68, 56, 0.11);
  --error-ink: #c42318;
  --note-bg: rgba(22, 119, 255, 0.10);
  --code-bg: rgba(16, 24, 40, 0.05);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 10px 30px rgba(16, 24, 40, 0.06);
  --shadow-hover: 0 2px 4px rgba(16, 24, 40, 0.08), 0 16px 38px rgba(16, 24, 40, 0.10);
  --focus-ring: 0 0 0 3px rgba(22, 119, 255, 0.18);
  --edge: linear-gradient(90deg, #1677ff, #149dff);
  --button: #1677ff;
  --button-hover: #0f62d7;
  --surface-trading: #ffffff;
  --surface-chart: #f7faff;
  --surface-elevated: #ffffff;
  --control-bg: #f5f8fc;
  --control-hover: #eef5ff;
  --control-active: #e8f2ff;
  --buy: #00a870;
  --sell: #f04438;
}

:root[data-theme="dark"] {
  --bg: #050b14;
  --body-bg: #050b14;
  --ink: #eef4ff;
  --muted: #8fa3bd;
  --faint: #5f738d;
  --panel: #0b1424;
  --panel-strong: #101b2e;
  --panel-soft: #0f1a2d;
  --panel-deep: #07111f;
  --topbar-bg: rgba(7, 13, 24, 0.96);
  --input-bg: #07111f;
  --table-head: #0f1a2d;
  --chip-bg: #101b2e;
  --line: #1e2d44;
  --line-strong: #2f4564;
  --accent: #1677ff;
  --accent-strong: #3690ff;
  --cyan: #42b8ff;
  --cyan-soft: rgba(22, 119, 255, 0.14);
  --amber: #f5b84b;
  --red: #f6465d;
  --profit: #00c087;
  --profit-strong: #00c087;
  --blue: #42b8ff;
  --warning-bg: rgba(245, 184, 75, 0.12);
  --warning-ink: #ffd37a;
  --error-bg: rgba(246, 70, 93, 0.12);
  --error-ink: #ff8b9b;
  --note-bg: rgba(22, 119, 255, 0.13);
  --code-bg: rgba(66, 184, 255, 0.08);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03), 0 20px 70px rgba(0, 0, 0, 0.36);
  --shadow-hover: 0 1px 0 rgba(255, 255, 255, 0.05), 0 26px 86px rgba(0, 0, 0, 0.44);
  --focus-ring: 0 0 0 3px rgba(22, 119, 255, 0.26);
  --edge: linear-gradient(90deg, #1677ff, #42b8ff);
  --button: #1677ff;
  --button-hover: #3690ff;
  --surface-trading: #07111f;
  --surface-chart: #050b14;
  --surface-elevated: #101b2e;
  --control-bg: #101b2e;
  --control-hover: #14243a;
  --control-active: #102e55;
  --buy: #00c087;
  --sell: #f6465d;
}

body {
  background: var(--body-bg);
  text-rendering: geometricPrecision;
}

body::before,
body::after {
  display: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 58px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--topbar-bg);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(18px);
}

.brand {
  gap: 10px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #ffffff;
  background: #1677ff;
  box-shadow: none;
}

.topbar-actions {
  gap: 8px;
}

.user-pill,
.nav-link,
.theme-select {
  min-height: 34px;
  border-radius: 6px;
  border-color: var(--line);
  background: var(--control-bg);
  color: var(--ink);
  box-shadow: none;
}

.theme-switch {
  gap: 7px;
  padding: 0;
  border: 0;
  background: transparent;
}

.theme-switch span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.nav-link:hover,
.theme-select:hover {
  border-color: var(--accent);
  background: var(--control-hover);
  color: var(--accent);
}

.shell,
body[data-page="dashboard"] .shell {
  width: min(100% - 20px, 1860px);
  padding-top: 14px;
}

body[data-page="dashboard"] .page-head {
  align-items: stretch;
  gap: 10px;
  margin-bottom: 10px;
}

.eyebrow {
  margin-bottom: 7px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

body[data-page="dashboard"] .page-head h1 {
  margin: 0;
  font-size: clamp(22px, 1.8vw, 30px);
  line-height: 1.05;
  letter-spacing: 0;
}

body[data-page="dashboard"] .head-metrics {
  gap: 8px;
}

.head-metrics div,
.quick-stats div,
.report-grid div,
.budget-strip div,
.user-profit > div,
.user-bot-stats span {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-strong);
  box-shadow: none;
}

.head-metrics div::before,
.quick-stats div::before,
.report-grid div::before,
.budget-strip div::before {
  display: none;
}

.head-metrics span,
.quick-stats span {
  color: var(--accent);
}

.trading-layout,
body[data-page="dashboard"] .trading-layout {
  grid-template-columns: minmax(760px, 1.56fr) minmax(380px, 0.78fr) 328px;
  gap: 8px;
  min-height: calc(100vh - 132px);
}

.market-panel,
.bot-workspace,
.strategy-sidebar,
body[data-page="dashboard"] .market-panel,
body[data-page="dashboard"] .bot-workspace,
body[data-page="dashboard"] .strategy-sidebar,
.bot-card,
.compact-bot-card,
.collapsible-panel,
.strategy-tabs-card,
.pair-search,
.empty-bot-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: none;
  backdrop-filter: none;
}

.market-panel:hover,
.bot-workspace:hover,
.strategy-sidebar:hover,
.bot-card:hover,
.compact-bot-card:hover {
  box-shadow: none;
  transform: none;
}

body[data-page="dashboard"] .market-panel {
  grid-template-rows: auto auto minmax(560px, 1fr) auto;
  min-height: 708px;
}

.market-toolbar,
.active-bots-strip,
.chart-terminal-toolbar,
.grid-control-bar {
  min-height: 46px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.chart-tool {
  border-left-color: var(--line);
  color: var(--ink);
  font-weight: 800;
}

button,
.chart-tool-button,
.chart-toolset button,
.grid-control-bar button,
.timeframe-tabs button,
.pair-tabs button,
.strategy-mode-switch button,
.strategy-tabs button,
.strip-tabs button,
.secondary-button,
.primary-button,
.start-button,
.stop-button,
.danger-outline-button {
  min-height: 36px;
  border-radius: 6px;
  font-weight: 800;
  letter-spacing: 0;
  box-shadow: none;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.12s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

.primary-button,
.start-button {
  border-color: var(--button);
  color: #ffffff;
  background: var(--button);
}

.primary-button:hover,
.start-button:hover {
  border-color: var(--button-hover);
  background: var(--button-hover);
}

.secondary-button,
.chart-tool-button,
.chart-toolset button,
.grid-control-bar button,
.timeframe-tabs button,
.pair-tabs button,
.strategy-mode-switch button,
.strategy-tabs button,
.strip-tabs button {
  border-color: var(--line);
  color: var(--muted);
  background: var(--control-bg);
}

.secondary-button:hover,
.chart-tool-button:hover,
.chart-toolset button:hover,
.grid-control-bar button:hover,
.timeframe-tabs button:hover,
.pair-tabs button:hover,
.strategy-mode-switch button:hover,
.strategy-tabs button:hover,
.strip-tabs button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--control-hover);
}

.timeframe-tabs button.is-active,
.pair-tabs button.is-active,
.strategy-mode-switch button.is-active,
.strategy-tabs button.is-active,
.strip-tabs button.is-active,
.chart-toolset button.is-active,
.grid-control-bar button.is-active,
body[data-page="dashboard"] .active-bots-strip button.is-active {
  border-color: rgba(22, 119, 255, 0.42);
  color: var(--accent);
  background: var(--control-active);
}

.danger-outline-button,
.stop-button {
  border-color: rgba(240, 68, 56, 0.42);
  color: var(--sell);
  background: rgba(240, 68, 56, 0.08);
}

.danger-outline-button:hover,
.stop-button:hover {
  border-color: var(--sell);
  color: #ffffff;
  background: var(--sell);
}

.price-chart-panel,
body[data-page="dashboard"] .price-chart-panel {
  background: var(--surface-chart);
}

.price-chart-head {
  min-height: 70px;
  padding: 14px 16px 8px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-chart);
}

.price-chart-head b {
  font-size: 17px;
  color: var(--ink);
}

.price-chart-head span,
.price-chart-head strong {
  color: var(--muted);
  font-weight: 800;
}

.terminal-chart-stage,
body[data-page="dashboard"] .terminal-chart-stage {
  background: var(--surface-chart);
}

.chart-menu,
.indicator-menu {
  border-radius: 8px;
  border-color: var(--line-strong);
  background: var(--surface-elevated);
  box-shadow: var(--shadow-hover);
}

.indicator-search,
.pair-search,
input,
select,
textarea {
  border-color: var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: var(--input-bg);
  box-shadow: none;
}

input:hover,
select:hover,
textarea:hover,
.indicator-search:hover,
.pair-search:hover {
  border-color: var(--line-strong);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

label span,
.head-metrics small,
.quick-stats small,
.report-grid small,
.budget-strip small {
  color: var(--muted);
  font-weight: 800;
  letter-spacing: 0;
}

.bot-workspace {
  padding: 8px;
  background: var(--body-bg);
}

.empty-bot-state {
  min-height: 78px;
  padding: 14px;
  background: var(--panel);
}

.compact-bot-card {
  gap: 10px;
  padding: 12px;
}

.bot-card::before,
.compact-bot-card::before {
  display: none;
}

.bot-card-head {
  min-height: 52px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.symbol-title {
  font-size: clamp(28px, 2.5vw, 42px);
  letter-spacing: 0;
}

.status,
.mode-chip,
.mini-badge,
.bot-badge {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--control-bg);
  box-shadow: none;
}

.status.good,
.bot-badge.on {
  border-color: rgba(0, 192, 135, 0.35);
  color: var(--buy);
  background: rgba(0, 192, 135, 0.10);
}

.status.bad,
.pnl-negative {
  color: var(--sell);
}

.pnl-positive {
  color: var(--buy);
}

.status.warm {
  border-color: rgba(245, 184, 75, 0.34);
  color: var(--warning-ink);
  background: var(--warning-bg);
}

.quick-stats,
body[data-page="dashboard"] .quick-stats,
.compact-budget-strip,
body[data-page="dashboard"] .compact-budget-strip {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.quick-stats div,
.budget-strip div,
.report-grid div {
  min-height: 70px;
  padding: 13px;
}

.budget-strip strong,
.report-grid strong {
  color: var(--ink);
  font-weight: 800;
}

.collapsible-panel {
  overflow: hidden;
}

.collapsible-panel summary {
  min-height: 48px;
  padding: 12px 14px;
  background: var(--panel-soft);
}

.collapsible-panel[open] summary {
  border-bottom: 1px solid var(--line);
}

.collapsible-panel summary::after {
  color: var(--accent);
}

.collapsible-panel .settings-form,
.collapsible-panel .exchange-panel,
.collapsible-panel .credentials,
.collapsible-panel .orders-table {
  margin: 10px;
}

.toggle-line {
  border-radius: 6px;
  background: var(--panel-soft);
}

.toggle-line input[type="checkbox"] {
  width: 42px;
  height: 22px;
  border-color: var(--line-strong);
  background: #9aa7b8;
  box-shadow: none;
}

.toggle-line input[type="checkbox"]::before {
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  box-shadow: none;
}

.toggle-line input[type="checkbox"]:checked {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: none;
}

.toggle-line input[type="checkbox"]:checked::before {
  transform: translateX(20px);
}

.strategy-sidebar {
  padding: 8px;
  background: var(--panel);
}

.strategy-tabs-card {
  padding: 10px;
}

.strategy-tabs {
  gap: 7px;
  padding: 8px 0 0;
}

.strategy-tabs button {
  min-height: 48px;
  justify-content: flex-start;
  text-align: left;
}

.strategy-tabs button.is-active {
  color: var(--accent);
}

.strategy-tabs button small {
  color: var(--muted);
}

.pair-search {
  margin-top: 8px;
}

.strategy-sidebar-head {
  color: var(--muted);
  background: transparent;
}

.pair-row {
  min-height: 54px;
  border-radius: 6px;
  border-color: transparent;
  background: transparent;
}

.pair-row:hover {
  border-color: var(--line);
  background: var(--control-hover);
}

.pair-row.is-active {
  border-color: rgba(22, 119, 255, 0.42);
  background: var(--control-active);
}

.orders-table {
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.orders-table th {
  background: var(--table-head);
}

.orders-table th,
.orders-table td {
  border-bottom-color: var(--line);
}

.inline-error,
.warning-strip {
  border-radius: 6px;
  border: 1px solid rgba(245, 184, 75, 0.32);
  background: var(--warning-bg);
  color: var(--warning-ink);
}

.toast {
  border-radius: 8px;
  border-color: var(--line);
  background: var(--surface-elevated);
  color: var(--ink);
  box-shadow: var(--shadow-hover);
}

body[data-page="login"] .login-card,
.admin-panel,
.user-editor,
.user-profit,
.user-bot-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: none;
}

@media (max-width: 1500px) {
  .trading-layout,
  body[data-page="dashboard"] .trading-layout {
    grid-template-columns: minmax(620px, 1fr) minmax(360px, 420px);
  }

  .strategy-sidebar {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 8px;
  }
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    gap: 10px;
  }

  .topbar-actions {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  body[data-page="dashboard"] .page-head {
    grid-template-columns: 1fr;
  }

  .trading-layout,
  body[data-page="dashboard"] .trading-layout,
  .strategy-sidebar {
    grid-template-columns: 1fr;
  }

  body[data-page="dashboard"] .market-panel {
    min-height: auto;
    grid-template-rows: auto auto minmax(440px, 58svh) auto;
  }

  body[data-page="dashboard"] .price-chart,
  body[data-page="dashboard"] .terminal-chart-stage,
  body[data-page="dashboard"] #priceCanvas {
    min-height: 440px;
  }

  .quick-stats,
  body[data-page="dashboard"] .quick-stats,
  .compact-budget-strip,
  body[data-page="dashboard"] .compact-budget-strip,
  .report-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .shell,
  body[data-page="dashboard"] .shell {
    width: min(100% - 12px, 100%);
    padding-top: 8px;
  }

  .market-toolbar,
  .grid-control-bar,
  .active-bots-strip {
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .quick-stats,
  body[data-page="dashboard"] .quick-stats,
  .compact-budget-strip,
  body[data-page="dashboard"] .compact-budget-strip,
  .report-grid,
  .head-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bot-actions,
  .bot-actions-compact,
  .form-actions {
    grid-template-columns: 1fr;
  }

  .danger-outline-button[data-action="clear-history"],
  .form-actions.wide button[type="submit"],
  .form-actions.wide button[type="button"] {
    grid-column: auto;
  }

  .symbol-title {
    font-size: 28px;
  }
}

/* Final dashboard layout lock: keeps the terminal pinned to the top on every viewport. */
body[data-page="dashboard"] {
  min-height: 100svh;
  overflow-x: hidden;
}

body[data-page="dashboard"] .topbar {
  position: sticky;
  inset: auto;
  top: 0;
  left: auto;
  right: auto;
  bottom: auto;
  width: 100%;
  min-height: 58px;
  padding: 10px 18px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  border-width: 0 0 1px;
  border-radius: 0;
}

body[data-page="dashboard"] .topbar .brand {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 0;
}

body[data-page="dashboard"] .topbar .brand span:last-child {
  font-size: 15px;
  line-height: 1;
}

body[data-page="dashboard"] .topbar .topbar-actions {
  width: auto;
  flex: 0 1 auto;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
}

body[data-page="dashboard"] .topbar .topbar-actions .danger {
  margin-top: 0;
}

body[data-page="dashboard"] .topbar ~ .shell,
body[data-page="dashboard"] .shell {
  width: min(100% - 24px, 1860px);
  margin: 0 auto;
  padding: 12px 0 32px;
}

body[data-page="dashboard"] .page-head {
  margin: 0 0 10px;
  align-items: end;
}

body[data-page="dashboard"] .trading-layout {
  min-height: 0;
  align-items: start;
}

body[data-page="dashboard"] .market-panel,
body[data-page="dashboard"] .bot-workspace,
body[data-page="dashboard"] .strategy-sidebar {
  min-height: min(708px, calc(100svh - 132px));
  max-height: calc(100svh - 132px);
}

body[data-page="dashboard"] .market-panel {
  grid-template-rows: auto auto minmax(420px, 1fr) auto;
}

body[data-page="dashboard"] .price-chart,
body[data-page="dashboard"] .terminal-chart-stage,
body[data-page="dashboard"] #priceCanvas {
  min-height: 420px;
}

@media (min-width: 1501px) {
  body[data-page="dashboard"] .trading-layout {
    grid-template-columns: minmax(720px, 1.56fr) minmax(360px, 0.78fr) 328px;
  }
}

@media (max-width: 1500px) {
  body[data-page="dashboard"] .market-panel,
  body[data-page="dashboard"] .bot-workspace,
  body[data-page="dashboard"] .strategy-sidebar {
    max-height: none;
  }
}

@media (max-width: 900px) {
  body[data-page="dashboard"] .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 10px;
  }

  body[data-page="dashboard"] .topbar .topbar-actions {
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
  }

  body[data-page="dashboard"] .shell {
    width: min(100% - 12px, 100%);
    padding-top: 8px;
  }
}

/* Admin console polish */
.admin-table-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.admin-table-head h2 {
  margin: 0;
  font-size: 18px;
}

.admin-table-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.admin-search {
  display: grid;
  gap: 6px;
  width: min(340px, 100%);
}

.admin-search span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.admin-search input {
  min-height: 42px;
}

.users-table {
  min-width: 980px;
}

.users-table td {
  vertical-align: middle;
}

.users-table .admin-access-pill {
  max-width: none;
  white-space: nowrap;
}

.admin-user-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  min-width: 260px;
}

.admin-user-summary span {
  display: grid;
  gap: 3px;
  min-height: 58px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-strong);
}

.admin-user-summary small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
}

.admin-user-summary b {
  font-size: 13px;
  line-height: 1.15;
}

.users-table .row-actions {
  min-width: 350px;
}

.user-details-row td {
  padding: 0;
  background: var(--panel-deep);
}

.user-details-panel {
  display: grid;
  grid-template-columns: minmax(260px, 0.52fr) minmax(420px, 1fr);
  gap: 12px;
  padding: 14px;
  border-top: 1px solid var(--line);
}

.user-details-panel section {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.user-details-panel h3 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 14px;
}

.user-details-panel .user-profit,
.user-details-panel .user-bot-list {
  min-width: 0;
}

/* Themed scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) var(--panel-deep);
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  border-radius: 999px;
  background: var(--panel-deep);
}

*::-webkit-scrollbar-thumb {
  border: 2px solid var(--panel-deep);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--line-strong), var(--accent));
}

*::-webkit-scrollbar-corner {
  background: var(--panel-deep);
}

@media (max-width: 900px) {
  .admin-table-head {
    display: grid;
    align-items: stretch;
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

  .user-details-panel {
    grid-template-columns: 1fr;
  }

  .users-table {
    min-width: 860px;
  }

  .topbar-actions,
  .market-toolbar,
  .grid-control-bar,
  .active-bots-strip {
    scrollbar-width: none;
  }

  .topbar-actions::-webkit-scrollbar,
  .market-toolbar::-webkit-scrollbar,
  .grid-control-bar::-webkit-scrollbar,
  .active-bots-strip::-webkit-scrollbar {
    display: none;
  }
}

/* Desktop dashboard topbar hard lock: prevents the old sidebar nav rules from stacking controls. */
@media (min-width: 901px) {
  body[data-page="dashboard"] .topbar {
    position: sticky;
    inset: auto;
    top: 0;
    width: 100%;
    height: 58px;
    min-height: 58px;
    max-height: 58px;
    padding: 10px 18px;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    overflow: visible;
    border-width: 0 0 1px;
    border-radius: 0;
  }

  body[data-page="dashboard"] .topbar .brand {
    flex: 0 0 auto;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 0;
    min-width: 0;
  }

  body[data-page="dashboard"] .topbar .brand span:last-child {
    display: inline;
    color: var(--ink);
    font-size: 15px;
    line-height: 1;
    white-space: nowrap;
  }

  body[data-page="dashboard"] .topbar .topbar-actions {
    width: auto;
    min-width: 0;
    flex: 0 1 auto;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    overflow: visible;
  }

  body[data-page="dashboard"] .topbar .theme-switch {
    width: auto;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0;
  }

  body[data-page="dashboard"] .topbar .theme-switch span {
    display: inline;
    white-space: nowrap;
  }

  body[data-page="dashboard"] .topbar .theme-select,
  body[data-page="dashboard"] .topbar .user-pill,
  body[data-page="dashboard"] .topbar .nav-link {
    width: auto;
    min-height: 34px;
    flex: 0 0 auto;
    justify-content: center;
    padding: 7px 12px;
    border-radius: 6px;
    white-space: nowrap;
  }

  body[data-page="dashboard"] .topbar .theme-select {
    min-width: 94px;
  }

  body[data-page="dashboard"] .topbar .user-pill {
    max-width: 190px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  body[data-page="dashboard"] .topbar .topbar-actions .danger {
    margin-top: 0;
  }
}

/* Strict Pro Redesign: final visual authority for the whole product. */
:root {
  --bg: #f4f7fb;
  --body-bg: #f4f7fb;
  --ink: #111827;
  --muted: #64748b;
  --faint: #94a3b8;
  --panel: #ffffff;
  --panel-strong: #ffffff;
  --panel-soft: #f8fafc;
  --panel-deep: #eef3f8;
  --topbar-bg: rgba(255, 255, 255, 0.96);
  --input-bg: #ffffff;
  --table-head: #f1f5f9;
  --chip-bg: #f8fafc;
  --line: rgba(15, 23, 42, 0.10);
  --line-strong: rgba(15, 23, 42, 0.18);
  --accent: #1764e8;
  --accent-strong: #0f58d6;
  --cyan: #1d8dff;
  --cyan-soft: rgba(23, 100, 232, 0.10);
  --amber: #d89c16;
  --red: #e0445f;
  --profit: #1764e8;
  --profit-strong: #0f58d6;
  --blue: #1764e8;
  --warning-bg: rgba(216, 156, 22, 0.10);
  --warning-ink: #845c00;
  --error-bg: rgba(224, 68, 95, 0.10);
  --error-ink: #ad263f;
  --note-bg: rgba(23, 100, 232, 0.08);
  --code-bg: rgba(15, 23, 42, 0.05);
  --shadow: 0 16px 48px rgba(15, 23, 42, 0.08);
  --shadow-hover: 0 20px 60px rgba(15, 23, 42, 0.12);
  --focus-ring: 0 0 0 3px rgba(23, 100, 232, 0.18);
  --edge: linear-gradient(90deg, #1764e8, #1d8dff);
  --button: linear-gradient(135deg, #1764e8, #1d8dff);
  --button-hover: linear-gradient(135deg, #0f58d6, #147ce4);
  --pro-radius: 7px;
  --pro-radius-sm: 5px;
}

:root[data-theme="dark"] {
  --bg: #050914;
  --body-bg: #050914;
  --ink: #f7fbff;
  --muted: #8fa3bf;
  --faint: #60718a;
  --panel: #09111f;
  --panel-strong: #0c1627;
  --panel-soft: #0a1322;
  --panel-deep: #060d19;
  --topbar-bg: rgba(7, 13, 24, 0.96);
  --input-bg: #050c17;
  --table-head: #0a1424;
  --chip-bg: #0b1728;
  --line: rgba(132, 169, 212, 0.14);
  --line-strong: rgba(132, 169, 212, 0.24);
  --accent: #1677ff;
  --accent-strong: #5ba8ff;
  --cyan: #56c7ff;
  --cyan-soft: rgba(22, 119, 255, 0.12);
  --amber: #f0b94e;
  --red: #ff4d6d;
  --profit: #56c7ff;
  --profit-strong: #2f92ff;
  --blue: #56c7ff;
  --warning-bg: rgba(240, 185, 78, 0.11);
  --warning-ink: #ffd88a;
  --error-bg: rgba(255, 77, 109, 0.11);
  --error-ink: #ff9aaf;
  --note-bg: rgba(22, 119, 255, 0.10);
  --code-bg: rgba(86, 199, 255, 0.08);
  --shadow: 0 22px 64px rgba(0, 0, 0, 0.34);
  --shadow-hover: 0 28px 86px rgba(0, 0, 0, 0.46);
  --focus-ring: 0 0 0 3px rgba(22, 119, 255, 0.26);
  --edge: linear-gradient(90deg, #1677ff, #56c7ff);
  --button: linear-gradient(135deg, #1677ff, #0f7af0);
  --button-hover: linear-gradient(135deg, #2d86ff, #48bdff);
}

html {
  background: var(--bg);
}

body {
  min-height: 100svh;
  color: var(--ink);
  background: var(--body-bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-rendering: geometricPrecision;
}

body::before,
body::after {
  display: none;
}

.topbar,
body[data-page="dashboard"] .topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  width: 100%;
  min-height: 58px;
  max-height: 58px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: var(--topbar-bg);
  box-shadow: none;
  backdrop-filter: blur(18px);
}

.brand,
body[data-page="dashboard"] .topbar .brand {
  flex: 0 0 auto;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.brand span:last-child,
body[data-page="dashboard"] .topbar .brand span:last-child {
  display: inline;
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(91, 168, 255, 0.34);
  border-radius: 8px;
  background: var(--button);
  color: #ffffff;
  box-shadow: none;
  font-size: 12px;
}

.topbar-actions,
body[data-page="dashboard"] .topbar .topbar-actions {
  width: auto;
  min-width: 0;
  flex: 0 1 auto;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  overflow: visible;
}

.theme-switch,
body[data-page="dashboard"] .topbar .theme-switch {
  width: auto;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0;
  border: 0;
  background: transparent;
}

.theme-switch span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.theme-select,
.user-pill,
.nav-link,
body[data-page="dashboard"] .topbar .theme-select,
body[data-page="dashboard"] .topbar .user-pill,
body[data-page="dashboard"] .topbar .nav-link {
  width: auto;
  min-height: 34px;
  flex: 0 0 auto;
  justify-content: center;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--pro-radius-sm);
  background: var(--chip-bg);
  color: var(--ink);
  box-shadow: none;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.theme-select {
  min-width: 94px;
}

.nav-link:hover,
.theme-select:hover {
  border-color: rgba(22, 119, 255, 0.42);
  background: var(--panel-strong);
  color: var(--accent-strong);
}

.nav-link.danger,
.topbar-actions .danger {
  color: var(--red);
  border-color: rgba(255, 77, 109, 0.28);
}

.shell,
body[data-page="dashboard"] .shell,
body[data-page="dashboard"] .topbar ~ .shell {
  width: min(100% - 24px, 1860px);
  margin: 0 auto;
  padding: 14px 0 32px;
}

.page-head,
body[data-page="dashboard"] .page-head {
  display: grid;
  grid-template-columns: minmax(240px, 0.34fr) minmax(0, 1fr);
  align-items: end;
  gap: 12px;
  margin: 0 0 12px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.page-head h1,
body[data-page="dashboard"] .page-head h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(26px, 2.2vw, 38px);
  line-height: 1;
  font-weight: 950;
  letter-spacing: 0;
}

.head-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(138px, 1fr));
  gap: 8px;
}

.head-metrics div,
.quick-stats div,
.budget-strip div,
.report-grid div,
.user-profit span,
.user-bot-stats span,
.admin-user-summary span {
  min-height: 68px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--pro-radius);
  background: var(--panel-strong);
  box-shadow: none;
}

.head-metrics span,
.quick-stats span,
.budget-strip strong,
.report-grid strong {
  color: var(--ink);
  font-weight: 950;
}

.head-metrics small,
.quick-stats small,
.budget-strip small,
.report-grid small,
.user-profit small,
.user-bot-stats small,
.admin-user-summary small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

body[data-page="dashboard"] .trading-layout {
  display: grid;
  grid-template-columns: minmax(720px, 1.45fr) minmax(390px, 0.72fr) 326px;
  gap: 8px;
  align-items: start;
}

.market-panel,
body[data-page="dashboard"] .market-panel,
.bot-workspace,
body[data-page="dashboard"] .bot-workspace,
.strategy-sidebar,
body[data-page="dashboard"] .strategy-sidebar,
.bot-card,
.compact-bot-card,
.admin-create,
.admin-table-wrap,
.login-panel,
.exchange-panel,
.strategy-tabs-card,
.pair-search,
.user-details-panel section {
  border: 1px solid var(--line);
  border-radius: var(--pro-radius);
  background: var(--panel);
  box-shadow: none;
}

.market-panel:hover,
.bot-card:hover,
.compact-bot-card:hover {
  transform: none;
  box-shadow: none;
}

body[data-page="dashboard"] .market-panel,
body[data-page="dashboard"] .bot-workspace,
body[data-page="dashboard"] .strategy-sidebar {
  min-height: min(720px, calc(100svh - 136px));
  max-height: calc(100svh - 136px);
}

.market-toolbar,
.grid-control-bar,
.active-bots-strip {
  min-height: 48px;
  padding: 8px 10px;
  border-color: var(--line);
  background: var(--panel);
  gap: 7px;
}

.chart-tool,
.chart-tool-button,
.grid-control-bar button,
.strip-tabs button,
.strip-actions button,
.strategy-mode-switch button,
.strategy-tabs button,
.pair-row,
button {
  border-radius: var(--pro-radius-sm);
}

button,
.primary-button,
.secondary-button,
.start-button,
.stop-button,
.danger-outline-button {
  min-height: 38px;
  border-radius: var(--pro-radius-sm);
  box-shadow: none;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.12s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

.primary-button,
.start-button {
  background: var(--button);
  color: #ffffff;
}

.secondary-button,
.chart-tool-button,
.grid-control-bar button {
  border: 1px solid var(--line);
  background: var(--chip-bg);
  color: var(--ink);
}

.stop-button {
  background: linear-gradient(135deg, #e0445f, #b82942);
  color: #ffffff;
}

.danger-outline-button {
  border-color: rgba(255, 77, 109, 0.30);
  background: var(--error-bg);
  color: var(--red);
}

.price-chart-panel {
  border-top: 1px solid var(--line);
  background: var(--panel-deep);
}

.price-chart-head {
  min-height: 68px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.price-chart-head h3,
.price-chart-head b {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 950;
}

body[data-page="dashboard"] .price-chart,
body[data-page="dashboard"] .terminal-chart-stage,
body[data-page="dashboard"] #priceCanvas {
  min-height: 510px;
  background: var(--panel-deep);
}

.bot-workspace {
  overflow: auto;
}

.bot-card,
.compact-bot-card {
  padding: 14px;
}

.symbol-title {
  color: var(--ink);
  font-size: clamp(30px, 3vw, 44px);
  letter-spacing: 0;
}

.quick-stats,
.compact-budget-strip,
.report-grid,
.user-bot-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.bot-actions,
.bot-actions-compact {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.collapsible-panel {
  border: 1px solid var(--line);
  border-radius: var(--pro-radius);
  background: var(--panel-soft);
}

.collapsible-panel summary {
  min-height: 46px;
  padding: 12px;
  color: var(--ink);
  font-weight: 900;
}

input,
select,
textarea {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--pro-radius-sm);
  background: var(--input-bg);
  color: var(--ink);
  box-shadow: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(22, 119, 255, 0.50);
  box-shadow: var(--focus-ring);
}

label span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.toggle-line {
  min-height: 54px;
  border-radius: var(--pro-radius);
  background: var(--panel-soft);
}

.orders-table,
.users-table {
  border: 1px solid var(--line);
  border-radius: var(--pro-radius);
  background: var(--panel);
  overflow: hidden;
}

th {
  background: var(--table-head);
  color: var(--muted);
  font-size: 10px;
}

td {
  color: var(--ink);
  font-size: 12px;
}

tr:hover td {
  background: var(--panel-soft);
}

.admin-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 12px;
}

.admin-create,
.admin-table-wrap {
  padding: 16px;
}

.admin-table-head {
  margin-bottom: 12px;
}

.admin-table-head h2,
.admin-create h2 {
  font-size: 18px;
  font-weight: 950;
}

.users-table {
  min-width: 980px;
}

.user-details-panel {
  grid-template-columns: minmax(260px, 0.44fr) minmax(430px, 1fr);
}

.status,
.mode-chip,
.mini-badge,
.bot-badge {
  border-radius: 999px;
  box-shadow: none;
}

.login-shell {
  min-height: calc(100svh - 58px);
  padding: 28px;
}

.login-theme {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 70;
}

.login-panel {
  width: min(980px, 100%);
  min-height: 560px;
  grid-template-columns: minmax(0, 0.95fr) 420px;
  overflow: hidden;
}

.login-copy {
  background:
    linear-gradient(135deg, rgba(22, 119, 255, 0.18), transparent 42%),
    var(--panel-deep);
}

.login-copy h1 {
  max-width: 520px;
  font-size: clamp(44px, 6vw, 72px);
  line-height: 0.95;
}

.login-copy p {
  max-width: 420px;
  color: var(--muted);
}

.toast {
  border-radius: var(--pro-radius);
  background: var(--panel-strong);
  color: var(--ink);
  box-shadow: var(--shadow);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) var(--panel-deep);
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: var(--panel-deep);
}

*::-webkit-scrollbar-thumb {
  border: 2px solid var(--panel-deep);
  border-radius: 999px;
  background: var(--line-strong);
}

@media (max-width: 1500px) {
  body[data-page="dashboard"] .trading-layout {
    grid-template-columns: minmax(620px, 1fr) minmax(390px, 0.72fr);
  }

  body[data-page="dashboard"] .strategy-sidebar {
    grid-column: 1 / -1;
    min-height: auto;
    max-height: none;
  }
}

@media (max-width: 900px) {
  .topbar,
  body[data-page="dashboard"] .topbar {
    min-height: auto;
    max-height: none;
    flex-wrap: wrap;
    align-items: flex-start;
    padding: 10px;
  }

  .topbar-actions,
  body[data-page="dashboard"] .topbar .topbar-actions {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .shell,
  body[data-page="dashboard"] .shell,
  body[data-page="dashboard"] .topbar ~ .shell {
    width: min(100% - 12px, 100%);
    padding-top: 8px;
  }

  .page-head,
  body[data-page="dashboard"] .page-head,
  .admin-layout,
  body[data-page="dashboard"] .trading-layout {
    grid-template-columns: 1fr;
  }

  .head-metrics,
  .quick-stats,
  .compact-budget-strip,
  .report-grid,
  .user-bot-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-page="dashboard"] .market-panel,
  body[data-page="dashboard"] .bot-workspace,
  body[data-page="dashboard"] .strategy-sidebar {
    min-height: auto;
    max-height: none;
  }

  body[data-page="dashboard"] .price-chart,
  body[data-page="dashboard"] .terminal-chart-stage,
  body[data-page="dashboard"] #priceCanvas {
    min-height: 440px;
  }

  .bot-actions,
  .bot-actions-compact,
  .user-details-panel,
  .login-panel {
    grid-template-columns: 1fr;
  }

  .login-shell {
    padding: 14px;
  }
}

@media (max-width: 520px) {
  .head-metrics,
  .quick-stats,
  .compact-budget-strip,
  .report-grid,
  .user-bot-stats {
    grid-template-columns: 1fr 1fr;
  }

  .symbol-title {
    font-size: 30px;
  }
}

/* Action and orders polish: fixed controls, compact one-line order rows. */
.bot-actions,
.bot-actions-compact {
  align-items: stretch;
}

.bot-actions button,
.bot-actions-compact button {
  width: 100%;
  min-width: 0;
  height: 54px;
  min-height: 54px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1;
  font-size: 13px;
  font-weight: 950;
}

.orders-table-wrap {
  width: 100%;
  max-width: 100%;
  margin: 0 0 12px;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--line);
  border-radius: var(--pro-radius);
  background: var(--panel);
}

.collapsible-panel .orders-table-wrap {
  margin: 0 12px 12px;
  width: calc(100% - 24px);
}

.orders-table-wrap .orders-table {
  width: 100%;
  min-width: 650px;
  margin: 0;
  border: 0;
  border-radius: 0;
  table-layout: fixed;
}

.orders-table th,
.orders-table td {
  height: 42px;
  padding: 8px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.orders-table th:nth-child(1),
.orders-table td:nth-child(1) {
  width: 72px;
}

.orders-table th:nth-child(2),
.orders-table td:nth-child(2) {
  width: 112px;
}

.orders-table th:nth-child(3),
.orders-table td:nth-child(3) {
  width: 92px;
}

.orders-table th:nth-child(4),
.orders-table td:nth-child(4) {
  width: 96px;
}

.orders-table th:nth-child(5),
.orders-table td:nth-child(5) {
  width: 138px;
}

.orders-table th:nth-child(6),
.orders-table td:nth-child(6) {
  width: 86px;
}

.orders-table .mini-badge {
  min-height: 24px;
  margin: 0;
  padding: 4px 8px;
  font-size: 10px;
  line-height: 1;
}

.run-history-panel {
  min-height: 0;
}

.run-history-list {
  display: grid;
  gap: 10px;
}

.run-session-card {
  border: 1px solid var(--line);
  border-radius: var(--pro-radius);
  background: var(--panel-soft);
  overflow: hidden;
}

.run-session-card summary {
  min-height: 58px;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.run-session-card summary b,
.run-session-card summary strong,
.run-session-card summary small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.run-session-card summary b {
  color: var(--ink);
  font-size: 13px;
  font-weight: 950;
}

.run-session-card summary small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.run-session-details {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.empty-run-history {
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--pro-radius);
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 13px;
  font-weight: 800;
}

@media (max-width: 520px) {
  .bot-actions button,
  .bot-actions-compact button {
    height: 48px;
    min-height: 48px;
  }

  .run-session-card summary {
    grid-template-columns: 1fr;
    align-items: start;
  }
}
