:root {
  --bg0: #0b1220;
  --bg1: #121a2b;
  --card: #162033;
  --line: #2a3a55;
  --text: #e8eef8;
  --muted: #8fa3c1;
  --accent: #3d8bfd;
  --ok: #2f8f6a;
  --danger: #d45a5a;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: radial-gradient(1200px 600px at 20% -10%, #1a2b4d 0%, var(--bg0) 55%);
  min-height: 100vh;
}
.auth-body { display: grid; place-items: center; padding: 24px; }
.auth-shell {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
}
@media (max-width: 800px) {
  .auth-shell { grid-template-columns: 1fr; }
}
.brand-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 36px 28px;
  background: linear-gradient(160deg, #15233a, #0e1626 70%);
  min-height: 320px;
}
.brand-glow {
  position: absolute;
  inset: auto -20% -40% auto;
  width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(61,139,253,.35), transparent 70%);
  pointer-events: none;
}
.brand-eyebrow {
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  font-size: 12px;
}
.brand-title {
  margin: 12px 0 10px;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.15;
}
.brand-sub { color: var(--muted); line-height: 1.7; max-width: 28em; }
.auth-card, .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
}
.auth-card h2, .panel h2 { margin: 0 0 16px; font-size: 20px; }
label { display: block; margin: 0 0 12px; font-size: 13px; color: var(--muted); }
input, select, textarea {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0f1726;
  color: var(--text);
}
.pw-field {
  position: relative;
  margin-top: 6px;
}
.pw-field input {
  margin-top: 0;
  padding-right: 44px;
}
.pw-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.pw-toggle:hover { color: var(--text); background: rgba(255,255,255,0.06); }
.pw-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pw-toggle svg { width: 18px; height: 18px; display: block; }
.btn {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  color: #fff;
  background: #334155;
}
.btn.primary { background: var(--accent); width: 100%; font-weight: 600; }
.btn.ok { background: var(--ok); }
.btn.danger { background: var(--danger); }
.msg { min-height: 1.2em; color: var(--danger); font-size: 13px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 16px; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid var(--line); background: #0e1624;
}
.topbar a { color: var(--accent); text-decoration: none; margin-left: 12px; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 20px; }
.wrap-wide { max-width: 1180px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: left; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px;
  background: #24324a; margin-left: 6px; vertical-align: middle;
}
.badge.live { background: rgba(212,90,90,.2); color: #f0a0a0; }
.badge.dry { background: rgba(47,143,106,.2); color: #7dcea0; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.user-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 8px;
  background: #0f1726;
}
.user-card.is-open {
  border-color: #3d5a8a;
  padding-bottom: 14px;
}
.user-card-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px;
  align-items: center;
}
.user-card.is-open .user-card-head { margin-bottom: 12px; }
.user-card-title { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.user-name-btn {
  border: 0; background: transparent; color: var(--text);
  cursor: pointer; padding: 4px 6px 4px 0; font: inherit;
  display: inline-flex; align-items: center; gap: 6px;
}
.user-name-btn:hover strong { color: var(--accent); }
.user-name-btn .chev { color: var(--muted); width: 1em; }
.user-card-body[hidden] { display: none !important; }
.user-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px 16px;
}
.field-pair { grid-column: span 1; }
.field-title { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field-row { display: flex; gap: 8px; }
.field-row label { flex: 1; margin: 0; }
.chk-live, .chk-inline {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 0; color: var(--text); font-size: 13px; cursor: pointer;
}
.chk-live input, .chk-inline input { width: auto; margin: 0; }
.mode-toggle {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.mode-btn {
  width: auto !important;
  min-width: 96px;
  border: 1px solid var(--line);
  transition: opacity .15s, border-color .15s, background .15s;
}
.mode-btn.is-on.mode-dry {
  background: rgba(47, 143, 106, .35);
  border-color: #3d9a72;
  color: #9ee0bd;
  font-weight: 600;
  opacity: 1;
}
.mode-btn.is-on.mode-live {
  background: rgba(212, 90, 90, .35);
  border-color: #d45a5a;
  color: #f0b0b0;
  font-weight: 600;
  opacity: 1;
}
.mode-btn.is-off {
  background: #121a2b;
  color: var(--muted);
  opacity: .45;
}
.mode-btn.is-off:hover {
  opacity: .75;
  border-color: #3d5a8a;
}
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin: 0 0 14px;
}
.filter-btn {
  border: 1px solid var(--line);
  background: #121a2b;
  color: var(--text);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font: inherit;
}
.filter-btn:hover { border-color: #3d5a8a; }
.user-search-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0 0 12px;
}
.user-search-bar input {
  margin-top: 0;
  flex: 1;
  min-width: 0;
}
.user-pager {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  margin-top: 14px;
  flex-wrap: wrap;
}
.user-pager .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.trading-stats {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.stats-mode-block {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0f1726;
}
.stats-mode-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}
.stats-mode-head .btn {
  flex-shrink: 0;
  padding: 6px 10px;
  font-size: 12px;
}
.stats-kpis {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  font-size: 12px;
  color: var(--muted);
}
.stats-kpis strong { font-size: 14px; }
.stats-trades-wrap {
  margin-top: 10px;
  max-height: 11.5rem; /* 约表头 + 5 行 */
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.stats-trades {
  width: 100%;
  margin: 0;
  font-size: 12px;
  border-collapse: collapse;
}
.stats-trades thead th {
  position: sticky;
  top: 0;
  background: #152033;
  z-index: 1;
}
.stats-trades th, .stats-trades td {
  padding: 5px 6px;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.stats-scroll-hint {
  margin: 6px 0 0;
  font-size: 11px;
}
.pnl-pos { color: var(--ok); }
.pnl-neg { color: var(--danger); }
.filter-btn.active {
  background: rgba(61, 139, 253, 0.18);
  border-color: var(--accent);
  color: #cfe3ff;
}
.filter-n {
  display: inline-block;
  min-width: 1.4em;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: #24324a;
  font-size: 12px;
}
.badge.online { background: rgba(47,143,106,.25); color: #7dcea0; }
.badge.offline { background: #24324a; color: var(--muted); }
.desk-hero {
  margin: 20px; padding: 28px; border-radius: 16px;
  border: 1px solid var(--line); background: var(--card);
}
.desk-hero h1 { margin: 0 0 8px; }
