/* BeyondTrader 控制台主题（Flask 页面 + 设计稿共用基础） */

:root {
  --bg: #0a101c;
  --bg-deep: #060a12;
  --bg-mid: #0a101c;
  --bg-elev: #0f1a2e;
  --panel: #121d33;
  --panel-soft: #15243f;
  --text: #eef2fb;
  --muted: #8b9cb8;
  --line: #243049;
  --line-soft: #334668;
  --gold: #cfb65b;
  --gold-strong: #e8dcaa;
  --gold-dim: rgba(207, 182, 91, 0.16);
  --gold-soft: rgba(207, 182, 91, 0.18);
  --green: #0ecb81;
  --green-soft: rgba(14, 203, 129, 0.14);
  --red: #f6465d;
  --red-soft: rgba(246, 70, 93, 0.14);
  --blue: #3b82f6;
  --blue-soft: rgba(59, 130, 246, 0.16);
  --radius-lg: 16px;
  --radius-md: 11px;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.28);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --shell-px: clamp(14px, 1.35vw, 32px);
  --shell-pb: clamp(36px, 3.5vw, 64px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: clamp(13px, 0.32vw + 12px, 15px);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(ellipse 90% 55% at 12% -8%, rgba(207, 182, 91, 0.11) 0%, transparent 52%),
    radial-gradient(ellipse 70% 45% at 88% 0%, rgba(59, 130, 246, 0.08) 0%, transparent 48%),
    radial-gradient(ellipse 120% 80% at 50% -25%, #1a2d4d 0%, var(--bg-deep) 50%),
    linear-gradient(180deg, var(--bg-mid) 0%, var(--bg-deep) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.85) 0%, transparent 85%);
}

a { color: var(--gold-strong); text-decoration: none; transition: color 0.18s var(--ease); }
a:hover { color: #fff; text-decoration: none; }

code {
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(7, 12, 24, 0.75);
  border: 1px solid var(--line-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  color: #c4d4ef;
}

.shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: var(--shell-px) var(--shell-px) var(--shell-pb);
}

/* ── 顶栏 ── */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(51, 70, 104, 0.75);
  background:
    linear-gradient(135deg, rgba(18, 29, 51, 0.88) 0%, rgba(10, 16, 28, 0.82) 100%);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
}

.brand h1 {
  margin: 0 0 8px;
  font-size: clamp(1.45rem, 1.1rem + 0.9vw, 1.85rem);
  font-weight: 800;
  letter-spacing: 0.03em;
  background: linear-gradient(135deg, #fff6dc 0%, var(--gold-strong) 45%, var(--gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
  max-width: min(640px, 100%);
  line-height: 1.55;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
  border: 1px solid var(--line-soft);
  background: rgba(15, 26, 46, 0.72);
  color: var(--muted);
  white-space: nowrap;
}

.pill.live {
  border-color: rgba(14, 203, 129, 0.42);
  background: var(--green-soft);
  color: var(--green);
  box-shadow: 0 0 18px rgba(14, 203, 129, 0.12);
}

.pill.rest {
  border-color: rgba(59, 130, 246, 0.42);
  background: var(--blue-soft);
  color: #93c5fd;
}

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 17px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 800;
  border: 1px solid transparent;
  cursor: default;
  white-space: nowrap;
  transition: transform 0.16s var(--ease), box-shadow 0.16s var(--ease), filter 0.16s var(--ease);
}

button.btn { font-family: inherit; cursor: pointer; appearance: none; }

.btn:hover { transform: translateY(-1px); filter: brightness(1.06); }

.btn.gold {
  background: linear-gradient(180deg, var(--gold-strong) 0%, var(--gold) 100%);
  color: #111827;
  border-color: #8f7b34;
  box-shadow: 0 6px 20px rgba(207, 182, 91, 0.28);
}

.btn.ghost {
  background: rgba(15, 26, 46, 0.55);
  color: var(--gold-strong);
  border-color: rgba(207, 182, 91, 0.28);
}

.btn.blue {
  background: rgba(59, 130, 246, 0.22);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.48);
}

.btn.danger {
  background: linear-gradient(180deg, #ff6b7d 0%, var(--red) 100%);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 6px 20px rgba(246, 70, 93, 0.22);
}

.btn.sm { padding: 6px 13px; font-size: 0.84rem; }

/* ── 卡片 ── */
.card {
  position: relative;
  background:
    linear-gradient(165deg, rgba(20, 32, 56, 0.94) 0%, rgba(11, 18, 32, 0.9) 100%);
  border: 1px solid rgba(51, 70, 104, 0.85);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(207, 182, 91, 0.35), transparent);
  pointer-events: none;
}

.card .head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(51, 70, 104, 0.65);
}

.card .title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--gold-strong);
  letter-spacing: 0.04em;
}

.user-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: rgba(10, 18, 35, 0.62);
  border: 1px solid rgba(51, 70, 104, 0.75);
  margin-bottom: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.user-strip .meta { font-size: 0.92rem; color: var(--muted); }
.user-strip .meta strong { color: var(--text); font-weight: 800; }
.user-strip .spacer { flex: 1; min-width: 12px; }
.user-strip .status {
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 0.84rem;
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid rgba(246, 70, 93, 0.35);
}

/* ── KPI ── */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
  align-items: stretch;
}

.kpi {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 96px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(12, 20, 38, 0.72);
  border: 1px solid rgba(51, 70, 104, 0.8);
  overflow: hidden;
  min-width: 0;
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.kpi::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(207, 182, 91, 0.55), transparent);
  opacity: 0.65;
}

.kpi:hover {
  transform: translateY(-2px);
  border-color: rgba(207, 182, 91, 0.35);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
}

.kpi label {
  display: block;
  flex-shrink: 0;
  min-height: 28px;
  margin-bottom: 6px;
  font-size: 0.84rem;
  line-height: 1.35;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.kpi-body {
  flex: 1;
  display: flex;
  align-items: center;
  min-height: 36px;
  overflow: hidden;
}

.kpi .value {
  width: 100%;
  font-size: clamp(1.05rem, 0.9rem + 0.5vw, 1.28rem);
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.kpi .value.value-sm {
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.kpi-foot {
  flex-shrink: 0;
  min-height: 14px;
  margin-top: 4px;
  font-size: 0.78rem;
  line-height: 1.3;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kpi .up, .kpi .value.up { color: var(--green); text-shadow: 0 0 20px rgba(14, 203, 129, 0.2); }
.kpi .down, .kpi .value.down { color: var(--red); }
.kpi .value.info { color: #93c5fd; text-shadow: none; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 960px) { .grid2 { grid-template-columns: 1fr; } }

.formcol {
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(8, 14, 28, 0.55);
  border: 1px solid rgba(51, 70, 104, 0.75);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.formcol h3 {
  margin: 0 0 14px;
  font-size: 0.98rem;
  color: var(--gold-strong);
  letter-spacing: 0.03em;
}

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 0.84rem; color: var(--muted); margin-bottom: 5px; }

.fake,
.mock-input,
.mock-select {
  width: 100%;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid rgba(51, 70, 104, 0.9);
  background: rgba(6, 10, 20, 0.72);
  color: var(--text);
  font-size: 0.92rem;
  font-family: inherit;
  line-height: 1.4;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}

.mock-select {
  padding-right: 32px;
  cursor: pointer;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% + 2px),
    calc(100% - 12px) calc(50% + 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.mock-select:hover,
.mock-input:hover { border-color: rgba(207, 182, 91, 0.45); }

.mock-select:focus,
.mock-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(207, 182, 91, 0.18);
}

.mock-input[readonly] {
  opacity: 0.88;
  cursor: not-allowed;
  color: var(--muted);
}

.mock-select option { background: #0f1a2e; color: var(--text); }

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: rgba(246, 70, 93, 0.12);
  border: 1px solid rgba(246, 70, 93, 0.38);
  color: #fecaca;
  font-size: 0.92rem;
  margin-bottom: 18px;
  line-height: 1.5;
}

.alert.info {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.38);
  color: #bfdbfe;
}

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 960px) { .split { grid-template-columns: 1fr; } }

.log {
  height: 260px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: #050912;
  border: 1px solid rgba(51, 70, 104, 0.85);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.84rem;
  line-height: 1.55;
  color: #8ba3c0;
  overflow: auto;
  white-space: pre-wrap;
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.35);
}

/* ── 表格 ── */
.tablewrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid rgba(51, 70, 104, 0.85);
  background: rgba(6, 10, 20, 0.35);
}

.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  min-width: 860px;
}

.data th,
.data td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(38, 53, 83, 0.9);
  vertical-align: middle;
}

.data th {
  background: rgba(8, 14, 28, 0.78);
  color: var(--muted);
  font-weight: 800;
  font-size: 0.84rem;
  white-space: nowrap;
  letter-spacing: 0.03em;
}

.data th.num,
.data td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data tbody tr {
  background: rgba(15, 26, 46, 0.22);
  transition: background 0.15s var(--ease);
}

.data tbody tr:nth-child(even) { background: rgba(15, 26, 46, 0.32); }
.data tbody tr:hover { background: rgba(207, 182, 91, 0.07); }

.data tbody tr.pos-row-long { box-shadow: inset 3px 0 0 var(--green); }
.data tbody tr.pos-row-short { box-shadow: inset 3px 0 0 var(--red); }

.data td strong { font-weight: 800; color: var(--text); }

.pos-table-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.tag.buy { background: var(--blue-soft); color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.35); }
.tag.sell { background: var(--red-soft); color: #fda4af; border: 1px solid rgba(246, 70, 93, 0.35); }
.tag.long { background: var(--green-soft); color: var(--green); border: 1px solid rgba(14, 203, 129, 0.35); }
.tag.short { background: var(--red-soft); color: var(--red); border: 1px solid rgba(246, 70, 93, 0.38); }
.tag.ok { background: var(--green-soft); color: var(--green); border: 1px solid rgba(14, 203, 129, 0.35); }
.tag.warn { background: rgba(250, 204, 21, 0.18); color: #facc15; border: 1px solid rgba(250, 204, 21, 0.35); }

.pnl-up, .data td.num.pnl-up { color: var(--green); font-weight: 900; }
.pnl-down, .data td.num.pnl-down { color: var(--red); font-weight: 900; }
.liq-warn { color: #f59e0b; font-weight: 800; }

.chart {
  height: clamp(260px, 28vw, 340px);
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(6, 10, 20, 0.95) 0%, rgba(12, 22, 40, 0.55) 100%);
  border: 1px solid rgba(51, 70, 104, 0.85);
  overflow: hidden;
  box-shadow: inset 0 2px 16px rgba(0, 0, 0, 0.28);
}

.chart svg { display: block; width: 100%; height: 100%; }

.note {
  margin-top: 32px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1px dashed rgba(207, 182, 91, 0.28);
  background: rgba(10, 18, 35, 0.45);
  color: var(--muted);
  font-size: 0.84rem;
  text-align: center;
  line-height: 1.55;
}

.small { font-size: 0.84rem; color: var(--muted); line-height: 1.5; }

/* ── 目录页导航卡片 ── */
.mock-nav {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.mock-nav-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(51, 70, 104, 0.85);
  background: linear-gradient(160deg, rgba(18, 29, 51, 0.92) 0%, rgba(10, 16, 28, 0.88) 100%);
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  text-decoration: none;
  color: inherit;
}

.mock-nav-card:hover {
  transform: translateY(-3px);
  border-color: rgba(207, 182, 91, 0.42);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  color: inherit;
}

.mock-nav-card .nav-kicker {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}

.mock-nav-card h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--gold-strong);
}

.mock-nav-card p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.55;
  flex: 1;
}

.mock-nav-card .nav-cta {
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--gold-strong);
}

/* ── 回测 ── */
.backtest-interval-hint {
  margin: 0 0 8px;
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.45;
}

.backtest-interval-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 12px 14px;
  border-radius: 9px;
  border: 1px solid rgba(51, 70, 104, 0.85);
  background: rgba(6, 10, 20, 0.55);
}

.backtest-interval-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.92rem;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.backtest-interval-option input { width: auto; margin: 0; accent-color: var(--gold); cursor: pointer; }
.backtest-interval-option span { white-space: nowrap; }

.card.report-banner { padding: 12px 16px; margin-bottom: 14px; }

.report-banner-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}

.rb-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  min-width: 0;
  flex: 1 1 360px;
  font-size: 0.92rem;
  line-height: 1.35;
  color: var(--text);
}

.rb-main strong { font-weight: 800; }
.rb-main .muted { color: var(--muted); font-size: 0.84rem; font-weight: 500; }
.rb-sep { color: var(--line-soft); user-select: none; }
.rb-period { font-size: 0.84rem; color: var(--muted); white-space: nowrap; }

.rb-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex: 0 1 auto;
}

.rb-tags .pill { font-size: 0.78rem; padding: 3px 8px; }
.rb-tags .tag.short { font-size: 0.78rem; padding: 2px 7px; }

@media (max-width: 720px) {
  .rb-tags { justify-content: flex-start; width: 100%; }
}

.kpis.hero { grid-template-columns: repeat(6, minmax(0, 1fr)); }

@media (max-width: 1200px) {
  .kpis.hero { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .kpis.hero { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.kpis.dense { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 1000px) {
  .kpis.dense { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .kpis.dense { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.kpis.metrics-extended { margin-bottom: 0; }
.kpis.metrics-extended.collapsed .kpi:nth-child(n + 9) { display: none; }

.chart-lg { height: clamp(300px, 32vw, 380px); }

.slider-box {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(6, 10, 20, 0.65);
  border: 1px solid rgba(51, 70, 104, 0.85);
}

.slider-track { position: relative; height: 28px; }

.slider-base {
  position: absolute;
  left: 0;
  right: 0;
  top: 11px;
  height: 6px;
  border-radius: 999px;
  background: #2a3b58;
}

.slider-fill {
  position: absolute;
  left: 0;
  width: 72%;
  top: 11px;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--gold-strong));
  box-shadow: 0 0 12px rgba(207, 182, 91, 0.35);
}

.slider-track input[type="range"] {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 28px;
  margin: 0;
  opacity: 0.01;
  cursor: pointer;
}

.slider-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.84rem;
  color: var(--muted);
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(180px, 1.2fr) minmax(180px, 1.2fr) auto;
  gap: 12px 16px;
  align-items: end;
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(8, 14, 28, 0.55);
  border: 1px solid rgba(51, 70, 104, 0.85);
  margin-bottom: 12px;
}

@media (max-width: 900px) {
  .filter-bar { grid-template-columns: 1fr 1fr; }
  .filter-bar .filter-actions { grid-column: 1 / -1; }
}

.filter-bar .orders-field-label,
.orders-field-label {
  display: block;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.orders-filter-card {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(8, 14, 28, 0.55);
  border: 1px solid rgba(51, 70, 104, 0.85);
  margin-bottom: 12px;
}

.orders-filter-grid {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(180px, 1.2fr) minmax(180px, 1.2fr) auto;
  gap: 12px 16px;
  align-items: end;
}

@media (max-width: 900px) {
  .orders-filter-grid { grid-template-columns: 1fr 1fr; }
  .orders-filter-actions { grid-column: 1 / -1; }
}

.tablewrap.scroll { max-height: 440px; overflow: auto; }
.data.wide { min-width: 1200px; }

.manual-close-block { margin-top: 14px; }

@media (max-width: 720px) {
  .topbar { padding: 14px 16px; }
  .card { padding: 14px 16px; }
}

/* 覆盖模板内联旧样式，确保新主题生效 */
body.console-page {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(ellipse 90% 55% at 12% -8%, rgba(207, 182, 91, 0.11) 0%, transparent 52%),
    radial-gradient(ellipse 70% 45% at 88% 0%, rgba(59, 130, 246, 0.08) 0%, transparent 48%),
    radial-gradient(ellipse 120% 80% at 50% -25%, #1a2d4d 0%, var(--bg-deep) 50%),
    linear-gradient(180deg, var(--bg-mid) 0%, var(--bg-deep) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

body.console-page h1 {
  background: linear-gradient(135deg, #fff6dc 0%, var(--gold-strong) 45%, var(--gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

body.console-page .card {
  position: relative;
  background: linear-gradient(165deg, rgba(20, 32, 56, 0.94) 0%, rgba(11, 18, 32, 0.9) 100%);
  border: 1px solid rgba(51, 70, 104, 0.85);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  backdrop-filter: blur(10px);
  overflow: hidden;
}

body.console-page .shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: var(--shell-px) var(--shell-px) var(--shell-pb);
}


/* ========== Flask 模板兼容层（结构不变，仅视觉） ========== */

.module-title,
.panel h2,
.card h2.module-title {
  margin: 0 0 10px;
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--gold-strong);
  letter-spacing: 0.04em;
  line-height: 1.3;
}

.module-subtitle {
  margin: 0 0 10px;
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--gold-strong);
}

.card > .module-title + .module-desc,
.card > .module-title + p.muted {
  margin-top: -2px;
}

.panel {
  position: relative;
  background: linear-gradient(165deg, rgba(20, 32, 56, 0.94) 0%, rgba(11, 18, 32, 0.9) 100%);
  border: 1px solid rgba(51, 70, 104, 0.85);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.card.full { grid-column: 1 / -1; }

.grid:not(.metrics-extended):not(#metrics-grid):not(.metrics-kpi-row) {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 18px;
  align-items: start;
}

@media (max-width: 960px) {
  .grid:not(.metrics-extended):not(#metrics-grid):not(.metrics-kpi-row) {
    grid-template-columns: 1fr;
  }
}

#metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
  align-items: stretch;
}

@media (max-width: 1000px) {
  #metrics-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  #metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

#metrics-grid .card,
.metrics-kpi-row .card,
#live-hero-kpis .card,
#backtest-hero-kpis .card,
.kpis.hero .card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 96px;
  padding: 14px 16px;
  margin-bottom: 0;
  border-radius: var(--radius-md);
  background: rgba(12, 20, 38, 0.72);
  border: 1px solid rgba(51, 70, 104, 0.8);
  box-shadow: none;
  overflow: hidden;
  min-width: 0;
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

#metrics-grid .card::before,
.metrics-kpi-row .card::before,
#live-hero-kpis .card::before,
#backtest-hero-kpis .card::before,
.kpis.hero .card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(207, 182, 91, 0.55), transparent);
  opacity: 0.65;
  pointer-events: none;
}

#metrics-grid .card:hover,
.metrics-kpi-row .card:hover,
#live-hero-kpis .card:hover,
#backtest-hero-kpis .card:hover {
  transform: translateY(-2px);
  border-color: rgba(207, 182, 91, 0.35);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
}

#metrics-grid .card .k,
.metrics-kpi-row .card .k,
#live-hero-kpis .card .k,
#backtest-hero-kpis .card .k {
  flex-shrink: 0;
  min-height: 28px;
  margin-bottom: 6px;
  font-size: 0.84rem;
  line-height: 1.35;
  color: var(--muted);
  letter-spacing: 0.02em;
}

#metrics-grid .card .v,
.metrics-kpi-row .card .v,
#live-hero-kpis .card .v,
#backtest-hero-kpis .card .v {
  flex: 1;
  display: flex;
  align-items: center;
  min-height: 36px;
  width: 100%;
  font-size: clamp(1.05rem, 0.9rem + 0.5vw, 1.28rem);
  font-weight: 900;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

#metrics-grid .card .sub,
.metrics-kpi-row .card .sub,
#live-hero-kpis .card .sub,
#backtest-hero-kpis .card .sub {
  flex-shrink: 0;
  min-height: 14px;
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#metrics-grid .v-pos,
.metrics-kpi-row .v-pos,
#live-hero-kpis .v-pos,
#backtest-hero-kpis .v-pos { color: var(--green); text-shadow: 0 0 20px rgba(14, 203, 129, 0.2); }

#metrics-grid .v-neg,
.metrics-kpi-row .v-neg,
#live-hero-kpis .v-neg,
#backtest-hero-kpis .v-neg { color: var(--red); }

#metrics-grid .card .v.value-sm,
#metrics-grid .card .v-neutral,
.metrics-kpi-row .v-neutral,
#live-hero-kpis .v-neutral,
#backtest-hero-kpis .v-neutral { color: var(--text); }

#metrics-grid.metrics-collapsed .card:nth-child(n + 9) { display: none; }

.metrics-toggle-wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 0 0 16px;
}

.card.metrics-section-card .head .metrics-toggle-wrap {
  margin: 0;
  justify-content: flex-end;
}

.metrics-section-card #metrics-grid { margin-bottom: 0; }

.metrics-toggle,
.metrics-toggle-wrap .btn.ghost { cursor: pointer; }

.top,
.console-page .topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(51, 70, 104, 0.75);
  background: linear-gradient(135deg, rgba(18, 29, 51, 0.88) 0%, rgba(10, 16, 28, 0.82) 100%);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
}

.top h1,
.console-page .topbar .brand h1 {
  margin: 0 0 8px;
  font-size: clamp(1.45rem, 1.1rem + 0.9vw, 1.85rem);
  font-weight: 800;
  letter-spacing: 0.03em;
  background: linear-gradient(135deg, #fff6dc 0%, var(--gold-strong) 45%, var(--gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.top .btn,
a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 17px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 800;
  text-decoration: none;
  transition: transform 0.16s var(--ease), filter 0.16s var(--ease);
}

.top .btn:hover,
a.btn:hover { transform: translateY(-1px); filter: brightness(1.06); text-decoration: none; }

.top-headline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.top-headline h1 {
  margin: 0;
}

.top-headline .top-headline-desc {
  flex: 1 1 100%;
  margin: 0;
}

.console-top-bar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
}

.console-top-bar-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  flex: 1 1 360px;
  min-width: 0;
}

.console-top-bar-bot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
}

.btn-inline {
  display: inline-flex;
  align-items: center;
  padding: 6px 13px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--gold-strong);
  border: 1px solid rgba(207, 182, 91, 0.28);
  background: rgba(15, 26, 46, 0.55);
  text-decoration: none;
  transition: border-color 0.16s var(--ease), transform 0.16s var(--ease);
}

.btn-inline:hover {
  border-color: rgba(207, 182, 91, 0.45);
  transform: translateY(-1px);
  text-decoration: none;
}

.live-stack .grid .card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 96px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(12, 20, 38, 0.72);
  border: 1px solid rgba(51, 70, 104, 0.8);
  box-shadow: none;
  margin-bottom: 0;
}

.live-stack .grid .card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(207, 182, 91, 0.55), transparent);
  opacity: 0.65;
  pointer-events: none;
}

.live-stack .grid .card .k {
  font-size: 0.84rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.live-stack .grid .card .v {
  font-size: clamp(1.05rem, 0.9rem + 0.5vw, 1.28rem);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.live-stack .grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

@media (max-width: 1100px) {
  .live-stack .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.dir-badge,
.tag.short {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 900;
}

.dir-short,
.tag.short,
.dir-badge.dir-short {
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid rgba(246, 70, 93, 0.38);
}

.dir-long,
.dir-badge.dir-long,
.tag.long {
  color: var(--green);
  background: var(--green-soft);
  border-color: rgba(14, 203, 129, 0.35);
}

.sub { color: var(--muted); font-size: 0.92rem; }
.ok { color: var(--green); }
.down { color: var(--red); }
.pnl-pos { color: var(--green); font-weight: 800; }
.pnl-neg { color: var(--red); font-weight: 800; }
.pnl-flat { color: var(--muted); }

.badge-buy, .tag.buy { background: var(--blue-soft); color: #93c5fd; border: 1px solid rgba(59, 130, 246, 0.35); }
.badge-sell, .tag.sell { background: var(--red-soft); color: #fda4af; border: 1px solid rgba(246, 70, 93, 0.35); }
.badge-open { background: var(--green-soft); color: var(--green); }
.badge-close { background: var(--red-soft); color: #fda4af; }
.badge-type {
  background: rgba(207, 182, 91, 0.18);
  color: var(--gold-strong);
  border: 1px solid rgba(207, 182, 91, 0.38);
}
.badge-status, .tag.ok { background: var(--green-soft); color: var(--green); border: 1px solid rgba(14, 203, 129, 0.35); }

.orders-field-control {
  width: 100%;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid rgba(51, 70, 104, 0.9);
  background: rgba(6, 10, 20, 0.72);
  color: var(--text);
  font-size: 0.92rem;
  font-family: inherit;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}

.orders-field-control:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(207, 182, 91, 0.18);
}

.orders-filter-actions button.orders-filter-primary {
  background: linear-gradient(180deg, var(--gold-strong) 0%, var(--gold) 100%);
  color: #111827;
  border-color: #8f7b34;
  box-shadow: 0 6px 20px rgba(207, 182, 91, 0.28);
}

body.console-page input,
body.console-page select,
body.console-page textarea {
  border-radius: 9px;
  border: 1px solid rgba(51, 70, 104, 0.9);
  background: rgba(6, 10, 20, 0.72);
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}

body.console-page input:focus,
body.console-page select:focus,
body.console-page textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(207, 182, 91, 0.18);
}

body.console-page button:not(.btn) {
  cursor: pointer;
  background: linear-gradient(180deg, var(--gold-strong) 0%, var(--gold) 100%);
  border: 1px solid #8f7b34;
  color: #111827;
  font-weight: 700;
  border-radius: var(--radius-md);
  transition: transform 0.16s var(--ease), filter 0.16s var(--ease);
}

body.console-page button:not(.btn):hover { transform: translateY(-1px); filter: brightness(1.06); }

body.console-page button.secondary {
  background: rgba(59, 130, 246, 0.22);
  border-color: rgba(59, 130, 246, 0.48);
  color: #93c5fd;
}

body.console-page button.warn {
  background: linear-gradient(180deg, #ff6b7d 0%, var(--red) 100%);
  border-color: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.live-banner {
  border-radius: var(--radius-md);
  margin-bottom: 14px;
  padding: 12px 16px;
  font-size: 0.92rem;
}

/* ========== 控制台页：覆盖内联样式 ========== */
body.console-page .console-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 18px;
}

body.console-page .console-stack > .card {
  width: 100%;
  margin-bottom: 0;
}

body.console-page .user-strip.card,
body.console-page .card.user-strip {
  padding: 14px 18px;
  margin-bottom: 18px;
  background: rgba(10, 18, 35, 0.62);
  border: 1px solid rgba(51, 70, 104, 0.75);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

body.console-page .position-panel-wrap {
  position: static !important;
  top: auto !important;
  z-index: auto !important;
  margin-bottom: 18px;
  padding-bottom: 0;
  background: transparent !important;
}

body.console-page .position-panel-caption { display: none; }

body.console-page .position-status-line {
  display: block;
  width: 100%;
  margin: 0 0 12px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(51, 70, 104, 0.82);
  background: rgba(7, 12, 24, 0.42);
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.console-page #console-position-board { display: block; }

body.console-page .position-table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid rgba(51, 70, 104, 0.85);
  background: rgba(6, 10, 20, 0.35);
}

body.console-page .position-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  font-size: 0.92rem;
}

body.console-page .position-table th,
body.console-page .position-table td {
  padding: 11px 14px;
  border-bottom: 1px solid rgba(38, 53, 83, 0.9);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

body.console-page .position-table th {
  background: rgba(8, 14, 28, 0.78);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

body.console-page .position-table td {
  color: var(--text);
  font-weight: 800;
}

body.console-page .position-table tbody tr {
  background: rgba(15, 26, 46, 0.22);
  transition: background 0.15s var(--ease);
}

body.console-page .position-table tbody tr:hover { background: rgba(207, 182, 91, 0.07); }

body.console-page .position-table tbody tr.pos-row-long { box-shadow: inset 3px 0 0 var(--green); }
body.console-page .position-table tbody tr.pos-row-short { box-shadow: inset 3px 0 0 var(--red); }

body.console-page .position-table th.num,
body.console-page .position-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

body.console-page .position-table .pos-table-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

body.console-page .position-table .tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

body.console-page .position-table .tag.short {
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid rgba(246, 70, 93, 0.38);
}

body.console-page .position-table .tag.long {
  color: var(--green);
  background: var(--green-soft);
  border: 1px solid rgba(14, 203, 129, 0.35);
}

body.console-page .position-table .pnl-pos,
body.console-page .position-table .pos-table-sub.pnl-pos { color: var(--green); font-weight: 900; }

body.console-page .position-table .pnl-neg,
body.console-page .position-table .pos-table-sub.pnl-neg { color: var(--red); font-weight: 900; }

body.console-page .position-table .liq-warn { color: #f59e0b; font-weight: 800; }

body.console-page .topbar .bot-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

body.console-page .topbar .bot-actions.bot-actions--compact {
  display: flex;
  grid-template-columns: unset;
}

body.console-page .topbar .actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

body.console-page .topbar .bot-actions form { margin: 0; }

body.console-page .topbar .bot-actions button,
body.console-page .topbar .bot-actions .btn {
  width: auto;
  min-width: 0;
  white-space: nowrap;
}

body.console-page .card .head .actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

body.console-page .card .head .actions form {
  margin: 0;
  display: inline-flex;
}

body.console-page button.btn,
body.console-page a.btn {
  width: auto;
  max-width: 100%;
}

body.console-page .user-strip .btn,
body.console-page .user-strip .btn-inline,
body.console-page .user-strip button.btn,
body.console-page .user-strip form {
  width: auto;
  margin: 0;
}

body.console-page .user-strip form button {
  width: auto;
}

body.console-page .manual-trade-dual.grid2 { gap: 18px; }

body.console-page .manual-trade-actions,
body.console-page .manual-close-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

body.console-page .manual-close-actions {
  margin-top: 0;
}

body.console-page .manual-trade-col form .actions .btn,
body.console-page .manual-close-actions .btn {
  width: auto;
  min-width: 120px;
}

body.console-page .card-manual .row,
body.console-page .formcol .row,
body.console-page #config-form .config-col .row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  margin-bottom: 12px;
  width: 100%;
  text-align: left;
}

body.console-page .formcol .row > label,
body.console-page #config-form .config-col .row > label {
  display: block;
  width: 100%;
  text-align: left;
  font-size: 0.84rem;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.35;
}

body.console-page .formcol .row > input,
body.console-page .formcol .row > select,
body.console-page .formcol .row > textarea,
body.console-page #config-form .config-col .row > input,
body.console-page #config-form .config-col .row > select {
  width: 100%;
  min-width: 0;
}

body.console-page .formcol .row > div,
body.console-page #config-form .config-col .row > div {
  width: 100%;
  min-width: 0;
}

body.console-page #config-form .config-core-col .row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(168px, 46%);
  flex-direction: unset;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

body.console-page #config-form .config-core-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 18px;
  align-items: stretch;
}

body.console-page #config-form .config-core-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.console-page #config-form .config-core-col .row:last-child {
  margin-bottom: 0;
}

body.console-page #config-form .config-col--notional {
  display: flex;
  flex-direction: column;
  gap: 0;
}

body.console-page #config-form .config-col--core {
  display: flex;
  flex-direction: column;
}

body.console-page #config-form .config-col--core .config-core-grid {
  flex: 0 0 auto;
  min-height: auto;
}

body.console-page #config-form .config-notional-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 0 0 auto;
  min-height: auto;
}

body.console-page #config-form .config-col--notional .config-notional-row.row {
  display: grid;
  grid-template-columns: minmax(148px, max-content) 1fr;
  flex-direction: unset;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

body.console-page #config-form .config-notional-row:last-child {
  margin-bottom: 0;
}

body.console-page #config-form .config-notional-row > label {
  font-size: 0.84rem;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.25;
}

body.console-page #config-form .config-notional-row > input {
  width: 100%;
  min-width: 0;
}

body.console-page #config-form .config-footer-split {
  width: 100%;
  flex: 0 0 auto;
  margin-top: 16px;
  clear: both;
  position: relative;
  z-index: 1;
}

body.console-page #config-form .config-footer-split > .formcol {
  display: flex;
  flex-direction: column;
  min-height: auto;
}

body.console-page #config-form .config-interval-col h3 {
  flex: 0 0 auto;
}

body.console-page #config-form .config-interval-col .backtest-interval-group {
  margin-top: 4px;
}

body.console-page #config-form .config-save-col .backtest-col-actions {
  justify-content: flex-start;
}

body.console-page #config-form .config-save-col .backtest-col-actions .pill {
  flex: 0 1 auto;
  text-align: left;
}

@media (max-width: 900px) {
  body.console-page #config-form .config-panels-row {
    align-items: flex-start;
    gap: 14px;
  }

  body.console-page #config-form .config-panels-row > .config-col.formcol {
    flex: none;
    width: 100%;
    min-height: auto;
    overflow: visible;
  }

  body.console-page #config-form .config-core-grid {
    grid-template-columns: 1fr;
  }

  body.console-page #config-form .config-notional-row {
    grid-template-columns: minmax(120px, max-content) 1fr;
  }

  body.console-page #config-form .config-footer-split.split {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  body.console-page #config-form .config-footer-split > .formcol {
    width: 100%;
    min-height: auto;
  }

  body.console-page #config-form .config-save-col .backtest-col-actions {
    margin-top: 12px;
  }

  body.console-page #config-form .config-interval-col .backtest-interval-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

body.console-page #config-form .config-col h3,
body.console-page .formcol h3 {
  margin: 0 0 14px;
  text-align: left;
}

body.console-page #config-form > button[type="submit"] {
  display: none;
}

body.console-page .config-col--notional {
  display: flex;
  flex-direction: column;
  min-height: auto;
  overflow: visible;
}

body.console-page .config-col--core .config-col-actions,
body.console-page .config-col--core .actions {
  display: none !important;
}

body.console-page .backtest-split {
  align-items: stretch;
}

body.console-page .backtest-split > .formcol {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.console-page .backtest-log-col {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

body.console-page .backtest-log-col h3 {
  flex: 0 0 auto;
}

body.console-page .backtest-log-col pre.log {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  margin: 0;
}

body.console-page .backtest-col-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 10px 12px;
  width: 100%;
  flex: 0 0 auto;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(51, 70, 104, 0.65);
  box-sizing: border-box;
}

body.console-page .backtest-col-actions .btn,
body.console-page .backtest-col-actions form {
  width: auto;
  margin: 0;
  flex: 0 0 auto;
}

body.console-page .backtest-col-actions .btn.gold {
  width: auto;
  min-width: 0;
}

body.console-page .backtest-interval-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

body.console-page .backtest-interval-row > label {
  text-align: left;
  width: 100%;
}

body.console-page .backtest-interval-hint {
  text-align: left;
  margin: 0 0 8px;
}

body.console-page .dt-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  width: 100%;
  align-items: center;
}

body.console-page .dt-shift-btn {
  width: 42px;
  min-width: 42px;
  padding: 8px 0;
}

body.console-page .split > .formcol {
  min-width: 0;
}

body.console-page .card-manual .row {
  grid-template-columns: unset;
}

body.console-page #config-form .config-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

body.console-page #config-form .config-panels-row {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 16px 18px;
  width: 100%;
}

body.console-page #config-form .config-panels-row > .config-col.formcol {
  flex: 1 1 0;
  min-width: 0;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(8, 14, 28, 0.55);
  border: 1px solid rgba(51, 70, 104, 0.75);
  box-sizing: border-box;
}

body.console-page #config-form .config-panels-row > .config-col > h3 {
  flex: 0 0 auto;
  margin-bottom: 14px;
}

@media (max-width: 900px) {
  body.console-page #config-form .config-panels-row {
    flex-direction: column;
  }
}

body.console-page pre.log {
  height: 260px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: #050912;
  border: 1px solid rgba(51, 70, 104, 0.85);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.84rem;
  line-height: 1.55;
  color: #8ba3c0;
  overflow: auto;
  white-space: pre-wrap;
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.35);
}

body.console-page button.btn,
body.console-page a.btn {
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}

body.console-page button.btn.blue,
body.console-page button.secondary.btn.blue {
  background: rgba(59, 130, 246, 0.22);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.48);
}

body.console-page button.btn.danger,
body.console-page button.warn.btn {
  background: linear-gradient(180deg, #ff6b7d 0%, var(--red) 100%);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 6px 20px rgba(246, 70, 93, 0.22);
}

body.console-page .bot-events-scroll.tablewrap {
  border: 1px solid rgba(51, 70, 104, 0.85);
  background: rgba(6, 10, 20, 0.35);
}

body.console-page .bot-events-scroll .data th {
  background: rgba(8, 14, 28, 0.78);
  color: var(--muted);
  font-size: 0.84rem;
}

body.console-page .position-push-status-text.pill { font-size: 0.84rem; }

body.console-page .manual-close-alert { margin-top: 14px; margin-bottom: 12px; }
body.console-page .manual-close-actions { margin-top: 0; }

.metrics-kpi-row,
#live-hero-kpis,
#backtest-hero-kpis,
#console-hero-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
  align-items: stretch;
}

@media (max-width: 1200px) {
  .metrics-kpi-row,
  #live-hero-kpis,
  #backtest-hero-kpis,
  #console-hero-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .metrics-kpi-row,
  #live-hero-kpis,
  #backtest-hero-kpis,
  #console-hero-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

body.console-page .live-stack .panel.card,
body.console-page .live-stack .card.panel {
  background: linear-gradient(165deg, rgba(20, 32, 56, 0.94) 0%, rgba(11, 18, 32, 0.9) 100%);
  border: 1px solid rgba(51, 70, 104, 0.85);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

body.console-page .live-banner.alert {
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.38);
  color: #bfdbfe;
}

body.console-page .grid:not(.metrics-extended):not(#metrics-grid):not(.metrics-kpi-row) {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

body.console-page .orders-filter-card.filter-bar {
  padding: 14px 16px;
  margin: 12px 0 10px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(51, 70, 104, 0.85);
  background: rgba(8, 14, 28, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

body.console-page .orders-filter-card.filter-bar .orders-filter-grid {
  display: grid;
  grid-template-columns: minmax(120px, 0.75fr) minmax(220px, 1fr) minmax(220px, 1fr) minmax(210px, auto);
  gap: 12px;
  align-items: end;
}

body.console-page .orders-filter-card.filter-bar .orders-field-label {
  display: block;
  margin: 0 0 6px;
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--muted);
}

body.console-page .orders-filter-card.filter-bar .orders-field-control {
  height: 38px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid rgba(51, 70, 104, 0.95);
  background: rgba(6, 10, 20, 0.72);
  color: var(--text);
}

body.console-page .orders-filter-card.filter-bar .orders-filter-actions {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 8px;
  min-width: 210px;
}

body.console-page .orders-filter-card.filter-bar .orders-filter-actions button {
  width: auto;
  min-width: 96px;
  height: 38px;
  padding: 0 14px;
  white-space: nowrap;
  border-radius: 9px;
  font-size: 0.92rem;
  font-weight: 800;
}

body.console-page .orders-filter-card.filter-bar .orders-filter-actions #orders-filter-clear {
  background: rgba(15, 26, 46, 0.68);
  color: var(--gold-strong);
  border-color: rgba(207, 182, 91, 0.28);
}

body.console-page .orders-filter-hint {
  margin: 8px 0 12px;
  padding: 10px 14px;
  border-left: 3px solid var(--gold);
  border-radius: 8px;
  background: rgba(207, 182, 91, 0.08);
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

body.console-page .orders-filter-hint strong { color: var(--text); font-weight: 800; }

@media (max-width: 980px) {
  body.console-page .orders-filter-card.filter-bar .orders-filter-grid { grid-template-columns: 1fr 1fr; }
  body.console-page .orders-filter-card.filter-bar .orders-filter-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    min-width: 0;
  }
}

@media (max-width: 560px) {
  body.console-page .orders-filter-card.filter-bar .orders-filter-grid { grid-template-columns: 1fr; }
  body.console-page .orders-filter-card.filter-bar .orders-filter-actions {
    flex-direction: column;
    align-items: stretch;
  }
  body.console-page .orders-filter-card.filter-bar .orders-filter-actions button { width: 100%; }
}

body.console-page .console-toast-layer,
body.console-page .progress-overlay {
  background:
    radial-gradient(ellipse 70% 60% at 50% 20%, rgba(26, 45, 77, 0.26), transparent 58%),
    rgba(2, 6, 23, 0.76);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

body.console-page .console-toast {
  min-width: 220px;
  max-width: min(88vw, 420px);
  padding: 16px 22px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(51, 70, 104, 0.95);
  background: linear-gradient(165deg, rgba(18, 29, 51, 0.96) 0%, rgba(11, 18, 32, 0.94) 100%);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.56), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.55;
}

body.console-page .console-toast.is-success {
  border-color: rgba(226, 209, 149, 0.45);
  color: var(--gold-strong);
}

body.console-page .console-toast.is-error {
  border-color: rgba(246, 70, 93, 0.52);
  background: linear-gradient(165deg, rgba(72, 20, 32, 0.9) 0%, rgba(11, 18, 32, 0.94) 100%);
  color: #fecaca;
}

body.console-page .progress-box {
  width: min(560px, 92vw);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(51, 70, 104, 0.95);
  background: linear-gradient(165deg, rgba(18, 29, 51, 0.96) 0%, rgba(11, 18, 32, 0.94) 100%);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.56);
  color: var(--text);
  font-family: var(--font);
}

body.console-page .progress-title {
  color: var(--gold-strong);
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0.03em;
}

body.console-page .progress-sub,
body.console-page .progress-elapsed {
  color: var(--muted);
  font-size: 0.92rem;
}

body.console-page .progress-track {
  height: 10px;
  background: rgba(6, 10, 20, 0.72);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
}

body.console-page .progress-fill {
  background: linear-gradient(90deg, var(--gold), var(--gold-strong));
  box-shadow: 0 0 12px rgba(207, 182, 91, 0.35);
}

body.console-page .msg {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(51, 70, 104, 0.85);
  background: rgba(8, 14, 28, 0.55);
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
  margin-bottom: 18px;
  white-space: pre-wrap;
}

body.console-page .msg.is-success {
  border-color: rgba(14, 203, 129, 0.38);
  background: rgba(14, 203, 129, 0.1);
  color: #a7f3d0;
}

body.console-page .msg.is-hidden { display: none; }

body.console-page .module-desc { font-size: 0.92rem; color: var(--muted); line-height: 1.55; margin-bottom: 14px; }

body.console-page .chart-wrap,
body.console-page .chart-shell {
  border-radius: var(--radius-md);
  border: 1px solid rgba(51, 70, 104, 0.85);
  background: linear-gradient(180deg, rgba(6, 10, 20, 0.95) 0%, rgba(12, 22, 40, 0.55) 100%);
  box-shadow: inset 0 2px 16px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

body.console-page .orders-scroll,
body.console-page #order-history-scroll {
  border-radius: var(--radius-md);
  border: 1px solid rgba(51, 70, 104, 0.85);
  background: rgba(6, 10, 20, 0.35);
}

body.console-page .orders-scroll table,
body.console-page #order-history-scroll table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

body.console-page .orders-scroll th,
body.console-page #order-history-scroll th {
  background: rgba(8, 14, 28, 0.78);
  color: var(--muted);
  font-weight: 800;
  padding: 11px 14px;
  border-bottom: 1px solid rgba(38, 53, 83, 0.9);
}

body.console-page .orders-scroll td,
body.console-page #order-history-scroll td {
  padding: 11px 14px;
  border-bottom: 1px solid rgba(38, 53, 83, 0.9);
}

body.console-page .orders-scroll tbody tr:nth-child(even),
body.console-page #order-history-scroll tbody tr:nth-child(even) {
  background: rgba(15, 26, 46, 0.32);
}

body.console-page .orders-scroll tbody tr:hover,
body.console-page #order-history-scroll tbody tr:hover {
  background: rgba(207, 182, 91, 0.07);
}

body.console-page .metrics-toggle-arrow { margin-left: 4px; }

body.console-page .slider-box {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(6, 10, 20, 0.65);
  border: 1px solid rgba(51, 70, 104, 0.85);
}

body.console-page .slider-fill {
  box-shadow: 0 0 12px rgba(207, 182, 91, 0.35);
}

/* 实盘监控：历史委托 / 成交记录 — 对齐设计稿 card.head */
body.console-page .panel.live-order-history-panel,
body.console-page .panel.live-orders-panel {
  position: relative;
  background: linear-gradient(165deg, rgba(20, 32, 56, 0.94) 0%, rgba(11, 18, 32, 0.9) 100%);
  border: 1px solid rgba(51, 70, 104, 0.85);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  overflow: hidden;
}

body.console-page .orders-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(51, 70, 104, 0.65);
}

body.console-page .head.orders-panel-head .orders-panel-toggle {
  flex: 0 1 auto;
  justify-content: flex-start;
}

body.console-page .head.orders-panel-head .actions {
  flex: 0 0 auto;
  margin-left: auto;
}

body.console-page .orders-panel-head h2,
body.console-page .orders-panel-toggle h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--gold-strong);
  letter-spacing: 0.04em;
  text-align: left;
}

body.console-page .orders-panel-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  width: auto;
  min-width: 0;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  color: inherit;
  cursor: pointer;
  font: inherit;
  transform: none !important;
  filter: none !important;
}

body.console-page .orders-panel-toggle:hover {
  transform: none !important;
  filter: none !important;
}

body.console-page .orders-toggle-arrow {
  font-size: 0.78rem;
  line-height: 1;
  color: var(--muted);
}

body.console-page .live-orders-panel-collapsed .orders-panel-head {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

body.console-page .btn-export {
  width: auto;
  white-space: nowrap;
}

body.console-page .orders-caption {
  margin: 0 0 12px;
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.55;
  text-align: left;
}

body.console-page .orders-scroll,
body.console-page #order-history-scroll,
body.console-page #orders-scroll {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid rgba(51, 70, 104, 0.85);
  background: rgba(6, 10, 20, 0.35);
}

body.console-page .orders-scroll table,
body.console-page #order-history-scroll table,
body.console-page #orders-scroll table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  font-size: 0.92rem;
}

body.console-page .orders-col-header th,
body.console-page .orders-scroll th,
body.console-page #order-history-scroll th,
body.console-page #orders-scroll th {
  padding: 11px 14px !important;
  text-align: left;
  border-bottom: 1px solid rgba(38, 53, 83, 0.9) !important;
  background: rgba(8, 14, 28, 0.78);
  color: var(--muted);
  font-weight: 800;
  font-size: 0.84rem;
  white-space: nowrap;
}

body.console-page .orders-col-header th[style*="text-align:right"],
body.console-page .orders-scroll th[style*="text-align:right"],
body.console-page #orders-scroll th[style*="text-align:right"] {
  text-align: right !important;
}

body.console-page .orders-scroll td,
body.console-page #order-history-scroll td,
body.console-page #orders-scroll td {
  padding: 11px 14px !important;
  border-bottom: 1px solid rgba(38, 53, 83, 0.9) !important;
  vertical-align: middle;
}

body.console-page .orders-scroll tbody tr:nth-child(even),
body.console-page #order-history-scroll tbody tr:nth-child(even),
body.console-page #orders-scroll tbody tr:nth-child(even) {
  background: rgba(15, 26, 46, 0.32);
}

body.console-page .orders-scroll tbody tr:hover,
body.console-page #order-history-scroll tbody tr:hover,
body.console-page #orders-scroll tbody tr:hover {
  background: rgba(207, 182, 91, 0.07);
}

body.console-page .orders-load-status {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  text-align: right;
}

body.console-page .bot-events-toolbar {
  margin-bottom: 12px;
}

body.console-page .bot-events-toolbar .muted {
  text-align: left;
  margin: 0;
  line-height: 1.55;
}

body.console-page .bot-events-scroll thead th {
  background: rgba(8, 14, 28, 0.78) !important;
  box-shadow: none;
}

body.console-page .bot-events-scroll .data th:nth-child(6),
body.console-page .bot-events-scroll .data th:nth-child(7),
body.console-page .bot-events-scroll .data td:nth-child(6),
body.console-page .bot-events-scroll .data td:nth-child(7) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ========== 登录 / 注册 / 账户页 ========== */

body.auth-page {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(ellipse 90% 55% at 12% -8%, rgba(207, 182, 91, 0.11) 0%, transparent 52%),
    radial-gradient(ellipse 70% 45% at 88% 0%, rgba(59, 130, 246, 0.08) 0%, transparent 48%),
    radial-gradient(ellipse 120% 80% at 50% -25%, #1a2d4d 0%, var(--bg-deep) 50%),
    linear-gradient(180deg, var(--bg-mid) 0%, var(--bg-deep) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

body.auth-page::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.85) 0%, transparent 85%);
}

body.auth-page.auth-page--center {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 4vw, 40px);
}

.auth-shell {
  position: relative;
  z-index: 1;
  width: 100%;
}

.auth-shell--narrow {
  max-width: 420px;
}

.auth-shell--wide {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--shell-px) var(--shell-px) var(--shell-pb);
}

.auth-brand {
  text-align: center;
  margin-bottom: 18px;
}

.auth-brand-mark {
  display: inline-block;
  font-size: clamp(1.05rem, 0.9rem + 0.5vw, 1.25rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  background: linear-gradient(135deg, #fff6dc 0%, var(--gold-strong) 45%, var(--gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

body.auth-page .auth-card,
body.auth-page .card {
  position: relative;
  background: linear-gradient(165deg, rgba(20, 32, 56, 0.94) 0%, rgba(11, 18, 32, 0.9) 100%);
  border: 1px solid rgba(51, 70, 104, 0.85);
  border-radius: var(--radius-lg);
  padding: clamp(20px, 2.5vw, 26px);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

body.auth-page .auth-title,
body.auth-page .auth-top h1 {
  margin: 0 0 8px;
  font-size: clamp(1.25rem, 1rem + 0.6vw, 1.45rem);
  font-weight: 800;
  letter-spacing: 0.03em;
  background: linear-gradient(135deg, #fff6dc 0%, var(--gold-strong) 45%, var(--gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

body.auth-page .auth-subtitle,
body.auth-page .muted {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

body.auth-page .auth-subtitle {
  margin: 0 0 18px;
}

body.auth-page .auth-form label,
body.auth-page .auth-field label {
  display: block;
  margin: 0 0 6px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--muted);
}

body.auth-page .auth-field {
  margin-bottom: 14px;
}

body.auth-page .auth-form input,
body.auth-page .auth-form select,
body.auth-page .auth-field input,
body.auth-page .auth-field select {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(51, 70, 104, 0.9);
  background: rgba(6, 10, 20, 0.72);
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}

body.auth-page .auth-form input:focus,
body.auth-page .auth-form select:focus,
body.auth-page .auth-field input:focus,
body.auth-page .auth-field select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(207, 182, 91, 0.18);
}

body.auth-page .auth-form .btn,
body.auth-page .auth-actions .btn {
  width: 100%;
  margin-top: 6px;
}

body.auth-page .auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

body.auth-page .auth-actions .btn {
  width: auto;
  flex: 0 0 auto;
}

body.auth-page .auth-links {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(51, 70, 104, 0.65);
  font-size: 0.92rem;
  text-align: center;
}

body.auth-page .auth-banner {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 0.92rem;
  line-height: 1.5;
}

body.auth-page .auth-banner--err {
  background: rgba(246, 70, 93, 0.12);
  border: 1px solid rgba(246, 70, 93, 0.38);
  color: #fecaca;
}

body.auth-page .auth-banner--ok {
  background: rgba(14, 203, 129, 0.1);
  border: 1px solid rgba(14, 203, 129, 0.38);
  color: #a7f3d0;
}

body.auth-page .auth-banner--info {
  background: rgba(207, 182, 91, 0.12);
  border: 1px solid rgba(207, 182, 91, 0.38);
  color: var(--gold-strong);
}

body.auth-page .auth-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

body.auth-page .auth-top .brand {
  flex: 1 1 240px;
  min-width: 0;
}

body.auth-page .auth-section-title {
  margin: 0 0 10px;
  font-size: 1rem;
  font-weight: 800;
  color: var(--gold-strong);
}

body.auth-page .auth-divider {
  margin: 20px 0;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(51, 70, 104, 0.65);
}

body.auth-page .auth-status {
  margin: 0 0 14px;
  font-size: 0.92rem;
  color: var(--muted);
}

body.auth-page .auth-foot {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

body.auth-page .auth-foot .muted {
  margin: 0;
}

body.auth-page .auth-code-block {
  display: block;
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: rgba(6, 10, 20, 0.72);
  border: 1px solid rgba(51, 70, 104, 0.75);
  font-size: 0.78rem;
  word-break: break-all;
  line-height: 1.45;
  color: #c4d4ef;
}

body.auth-page form {
  margin: 0;
}

body.auth-page button.btn {
  font-family: inherit;
  cursor: pointer;
  appearance: none;
}

@media (max-width: 520px) {
  body.auth-page.auth-page--center {
    align-items: flex-start;
    padding-top: 28px;
  }

  body.auth-page .auth-top {
    flex-direction: column;
    align-items: stretch;
  }

  body.auth-page .auth-top .btn {
    width: 100%;
  }
}

/* ========== 移动端适配（手机） ========== */

@media (max-width: 640px) {
  :root {
    --shell-px: 12px;
    --shell-pb: 28px;
  }

  html {
    font-size: 14px;
  }

  body.console-page,
  body.auth-page {
    overflow-x: clip;
  }

  .shell {
    padding-left: max(var(--shell-px), env(safe-area-inset-left, 0px));
    padding-right: max(var(--shell-px), env(safe-area-inset-right, 0px));
    padding-bottom: max(var(--shell-pb), env(safe-area-inset-bottom, 0px));
  }

  .topbar,
  body.console-page .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 14px 16px;
  }

  .topbar .brand,
  body.console-page .topbar .brand {
    min-width: 0;
  }

  .topbar .brand p,
  body.console-page .topbar .brand p {
    max-width: none;
  }

  .topbar .actions,
  body.console-page .topbar .actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 10px;
  }

  body.console-page .topbar .bot-actions,
  body.console-page .topbar .bot-actions.bot-actions--compact {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }

  body.console-page .topbar .bot-actions form,
  body.console-page .topbar .bot-actions button,
  body.console-page .topbar .bot-actions .btn {
    width: 100%;
    min-width: 0;
  }

  .user-strip,
  body.console-page .user-strip.card,
  body.console-page .card.user-strip {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 14px;
  }

  .user-strip .meta,
  body.console-page .user-strip .meta {
    width: 100%;
    font-size: 0.88rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
  }

  .user-strip .spacer {
    display: none;
  }

  body.console-page .user-strip .btn,
  body.console-page .user-strip button.btn,
  body.console-page .user-strip form {
    width: 100%;
    margin: 0;
  }

  body.console-page .user-strip form button {
    width: 100%;
    justify-content: center;
  }

  .card .head,
  body.console-page .card .head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  body.console-page .card .head .actions {
    width: 100%;
    margin-left: 0;
    justify-content: stretch;
    flex-direction: column;
    align-items: stretch;
  }

  body.console-page .card .head .actions .btn,
  body.console-page .card .head .actions a.btn,
  body.console-page .card .head .actions form {
    width: 100%;
  }

  body.console-page .card .head .actions .btn,
  body.console-page .card .head .actions a.btn {
    justify-content: center;
  }

  .metrics-kpi-row,
  #console-hero-kpis,
  #live-hero-kpis,
  #backtest-hero-kpis,
  #metrics-grid {
    gap: 10px;
  }

  body.console-page #config-form .config-grid {
    gap: 16px;
  }

  body.console-page #config-form .config-panels-row {
    align-items: flex-start;
    gap: 12px;
  }

  body.console-page #config-form .config-panels-row > .config-col.formcol {
    flex: none;
    width: 100%;
    min-height: auto;
    overflow: visible;
  }

  body.console-page #config-form .config-notional-list {
    flex: none;
    min-height: auto;
    width: 100%;
  }

  body.console-page #config-form .config-footer-split {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid rgba(51, 70, 104, 0.65);
  }

  body.console-page #config-form .config-footer-split.split {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  body.console-page #config-form .config-save-col .backtest-col-actions {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
  }

  body.console-page #config-form .config-core-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  body.console-page #config-form .config-core-col .row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    grid-template-columns: 1fr;
    gap: 5px;
  }

  body.console-page #config-form .config-notional-row,
  body.console-page #config-form .config-col--notional .config-notional-row.row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    grid-template-columns: 1fr;
    gap: 5px;
  }

  body.console-page .backtest-col-actions {
    flex-direction: column;
    align-items: stretch;
  }

  body.console-page .backtest-col-actions .btn,
  body.console-page .backtest-col-actions .pill {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  body.console-page .manual-trade-actions,
  body.console-page .manual-close-actions {
    flex-direction: column;
    align-items: stretch;
  }

  body.console-page .manual-trade-col form .actions .btn,
  body.console-page .manual-close-actions .btn {
    width: 100%;
    min-width: 0;
  }

  .report-banner-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .rb-tags {
    width: 100%;
    justify-content: flex-start;
  }

  body.console-page .orders-panel-head {
    flex-direction: column;
    align-items: stretch;
  }

  body.console-page .head.orders-panel-head .actions {
    margin-left: 0;
    width: 100%;
  }

  body.console-page .btn-export {
    width: 100%;
    justify-content: center;
  }

  .console-top-bar-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .console-top-bar-left,
  .console-top-bar-bot {
    flex-basis: 100%;
    width: 100%;
  }

  body.console-page .position-status-line {
    white-space: normal;
  }

  body.console-page .position-panel-wrap--below-summary {
    position: static !important;
    top: auto !important;
    padding-bottom: 0;
    background: transparent !important;
  }

  body.console-page .dt-wrap {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  body.console-page .dt-shift-btn {
    width: 100%;
    min-width: 0;
  }

  .filter-bar,
  .orders-filter-grid,
  body.console-page .orders-filter-card.filter-bar .orders-filter-grid {
    grid-template-columns: 1fr;
  }

  .filter-actions,
  .orders-filter-actions,
  body.console-page .orders-filter-card.filter-bar .orders-filter-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-actions button,
  .orders-filter-actions button,
  body.console-page .orders-filter-card.filter-bar .orders-filter-actions button {
    width: 100%;
    min-width: 0;
  }

  .chart-lg {
    height: min(52vh, 320px);
  }

  body.console-page .chart-wrap .chart,
  body.console-page .chart-shell .chart {
    height: min(52vh, 320px);
  }

  .pill {
    max-width: 100%;
    white-space: normal;
    text-align: center;
    justify-content: center;
  }
}

@media (max-width: 400px) {
  .metrics-kpi-row,
  #console-hero-kpis,
  #live-hero-kpis,
  #backtest-hero-kpis {
    grid-template-columns: 1fr;
  }

  #metrics-grid {
    grid-template-columns: 1fr;
  }

  .kpis.hero,
  .kpis.dense {
    grid-template-columns: 1fr;
  }
}
