/* ═══════════════════════════════════════════════════════════════
   MARS-Q v2 · JARVIS 全息投影风 · A股量化终端
   Iron Man / HUD / Holographic aesthetic
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* Base — deep space */
  --bg-void: #030811;
  --bg-deep: #050b1a;
  --bg-panel: rgba(9, 18, 34, 0.72);
  --bg-panel-2: rgba(15, 26, 46, 0.65);
  --bg-inset: rgba(4, 10, 20, 0.55);
  --bg-glass: rgba(10, 22, 42, 0.35);

  /* Holographic accents */
  --hud-cyan: #4ff2ff;
  --hud-cyan-hi: #b6faff;
  --hud-cyan-dim: rgba(79, 242, 255, 0.55);
  --hud-cyan-glow: rgba(79, 242, 255, 0.18);
  --hud-cyan-line: rgba(79, 242, 255, 0.28);
  --hud-cyan-faint: rgba(79, 242, 255, 0.08);
  --hud-gold: #ffcf5c;
  --hud-gold-hi: #ffe4a0;
  --hud-gold-glow: rgba(255, 207, 92, 0.22);
  --hud-amber: #ff9c3f;
  --hud-magenta: #ff5ec8;
  --hud-violet: #b380ff;

  /* Market colors — China convention: 红涨 绿跌 */
  --up: #ff3a5c;
  --up-hi: #ff7a90;
  --up-glow: rgba(255, 58, 92, 0.22);
  --down: #29e082;
  --down-hi: #7bf0b3;
  --down-glow: rgba(41, 224, 130, 0.22);

  /* Text */
  --text: #e6f4ff;
  --text-hi: #f5fcff;
  --muted: #7ea3c7;
  --faint: #4d6b8a;
  --dim: #33506f;

  /* Borders */
  --edge: rgba(79, 242, 255, 0.16);
  --edge-hi: rgba(79, 242, 255, 0.42);
  --edge-gold: rgba(255, 207, 92, 0.35);
  --divider: rgba(126, 163, 199, 0.09);

  /* Fonts */
  --font-sans: "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --font-display: "Orbitron", var(--font-sans);
  --font-hud: "Rajdhani", "Orbitron", var(--font-sans);

  --pad: 14px;
  --radius: 10px;
  --radius-lg: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-void);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  min-width: 1360px;
  overflow-x: auto;
}

/* ═════ AMBIENT BACKGROUND ═════ */
body {
  background:
    radial-gradient(1400px 700px at 12% -8%, rgba(79, 242, 255, 0.09), transparent 60%),
    radial-gradient(1200px 600px at 92% 2%, rgba(255, 207, 92, 0.06), transparent 60%),
    radial-gradient(1000px 500px at 50% 108%, rgba(255, 94, 200, 0.05), transparent 60%),
    linear-gradient(180deg, #030811 0%, #04091a 50%, #030612 100%);
  min-height: 100vh;
  position: relative;
}

/* Particle starfield canvas */
#particleField {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.55;
}

/* Scanline overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
  background:
    repeating-linear-gradient(0deg,
      transparent 0 3px,
      rgba(79, 242, 255, 0.015) 3px 4px);
  mix-blend-mode: screen;
}

/* Vignette */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(3, 8, 17, 0.55) 100%);
}

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.hud  { font-family: var(--font-hud); letter-spacing: 0.08em; text-transform: uppercase; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.up { color: var(--up); }
.down { color: var(--down); }
.right { text-align: right; }
.center { text-align: center; }
.big { font-size: 15px; font-weight: 700; }

/* ═════ HOLOGRAPHIC PANEL ═════ */
.panel {
  position: relative;
  background:
    linear-gradient(135deg, rgba(79, 242, 255, 0.02), transparent 40%),
    var(--bg-panel);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: var(--pad);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2;
}

/* Corner brackets — the iconic JARVIS frame */
.panel::before,
.panel::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 1px solid var(--hud-cyan);
  opacity: 0.85;
  pointer-events: none;
}
.panel::before {
  top: -1px; left: -1px;
  border-right: none;
  border-bottom: none;
}
.panel::after {
  bottom: -1px; right: -1px;
  border-left: none;
  border-top: none;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-hud);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--hud-cyan);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--edge);
  position: relative;
}
.panel-title::before {
  content: "";
  width: 6px; height: 6px;
  background: var(--hud-cyan);
  box-shadow: 0 0 8px var(--hud-cyan);
  border-radius: 50%;
  animation: hudPulse 2.2s ease-in-out infinite;
}
.panel-title .subt {
  margin-left: auto;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.1em;
  font-weight: 400;
}
.panel-title .subt.gold { color: var(--hud-gold); }

@keyframes hudPulse {
  0%, 100% { opacity: 0.5; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* ═════ TOP BAR ═════ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 62px;
  padding: 0 22px;
  background:
    linear-gradient(180deg, rgba(6, 14, 28, 0.92), rgba(6, 14, 28, 0.72));
  border-bottom: 1px solid var(--edge);
  display: flex;
  align-items: center;
  gap: 20px;
  backdrop-filter: blur(12px);
}
.topbar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--hud-cyan-line) 20%, var(--hud-cyan) 50%, var(--hud-cyan-line) 80%, transparent);
  opacity: 0.7;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo-svg {
  filter: drop-shadow(0 0 8px var(--hud-cyan-glow));
}
.logo-text .brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 0.14em;
  color: var(--hud-cyan-hi);
  text-shadow: 0 0 12px var(--hud-cyan-glow);
  line-height: 1;
}
.logo-text .brand-dot { color: var(--hud-gold); margin: 0 2px; }
.logo-text .tag {
  font-family: var(--font-hud);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin-top: 3px;
}

.market-ticker {
  flex: 1;
  display: flex;
  gap: 22px;
  overflow: hidden;
  padding: 0 12px;
  border-left: 1px solid var(--edge);
  border-right: 1px solid var(--edge);
  height: 40px;
  align-items: center;
}
.ticker-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
}
.ticker-item .tk-name {
  font-family: var(--font-hud);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.ticker-item .tk-val {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-hi);
}
.ticker-item .tk-chg {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
}
.tk-chg.up { color: var(--up-hi); background: var(--up-glow); }
.tk-chg.down { color: var(--down-hi); background: var(--down-glow); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.clock {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--hud-cyan);
  text-shadow: 0 0 8px var(--hud-cyan-glow);
  letter-spacing: 0.06em;
}
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--edge-gold);
  background: rgba(255, 207, 92, 0.06);
  border-radius: 20px;
  font-family: var(--font-hud);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--hud-gold);
}
.status-chip .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--hud-gold);
  box-shadow: 0 0 8px var(--hud-gold);
  animation: hudPulse 1.8s ease-in-out infinite;
}
.status-chip.live { border-color: var(--edge-hi); color: var(--hud-cyan); background: rgba(79, 242, 255, 0.06); }
.status-chip.live .dot { background: var(--hud-cyan); box-shadow: 0 0 8px var(--hud-cyan); }

/* ═════ TIMELINE ═════ */
.timeline {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  padding: 14px 22px;
  gap: 4px;
  background: linear-gradient(180deg, rgba(6, 14, 28, 0.5), transparent);
  border-bottom: 1px solid var(--edge);
}
.tl-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 158px;
}
.tl-dot {
  position: relative;
  width: 12px; height: 12px;
  border: 1.5px solid var(--faint);
  border-radius: 50%;
  background: var(--bg-void);
  flex-shrink: 0;
}
.tl-item.done .tl-dot {
  border-color: var(--hud-cyan);
  background: radial-gradient(circle, var(--hud-cyan) 20%, transparent 60%);
  box-shadow: 0 0 10px var(--hud-cyan-glow);
}
.tl-item.active .tl-dot {
  border-color: var(--hud-gold);
  background: radial-gradient(circle, var(--hud-gold) 20%, transparent 60%);
  box-shadow: 0 0 12px var(--hud-gold-glow);
  animation: hudPulse 1.6s infinite;
}
.tl-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--hud-cyan);
  letter-spacing: 0.06em;
}
.tl-item.active .tl-time { color: var(--hud-gold); }
.tl-item:not(.done):not(.active) .tl-time { color: var(--faint); }
.tl-label {
  font-family: var(--font-hud);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-top: 2px;
}
.tl-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--edge), var(--edge));
  position: relative;
}
.tl-line.done {
  background: linear-gradient(90deg, var(--hud-cyan-line), var(--hud-cyan-line));
}
.tl-line.done::after {
  content: "";
  position: absolute;
  top: -1px; left: 0; right: 0; bottom: -1px;
  background: linear-gradient(90deg, transparent, var(--hud-cyan), transparent);
  opacity: 0.6;
  animation: flowRight 3s linear infinite;
}
@keyframes flowRight {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ═════ MAIN GRID ═════ */
.grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 320px 1fr 460px;
  gap: 14px;
  padding: 14px 22px 22px;
  min-height: calc(100vh - 130px);
}

.col-left, .col-mid, .col-right {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

/* ═════ AGENT CARD ═════ */
.agent-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  background: var(--bg-inset);
  border: 1px solid var(--edge);
  border-radius: 8px;
  margin-bottom: 8px;
  position: relative;
  transition: all 0.3s;
  overflow: hidden;
}
.agent-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, transparent, var(--hud-cyan), transparent);
  opacity: 0.4;
}
.agent-card:hover {
  border-color: var(--edge-hi);
  background: rgba(79, 242, 255, 0.04);
}
.agent-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(79, 242, 255, 0.2), rgba(255, 207, 92, 0.12));
  border: 1.5px solid var(--edge-hi);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--hud-cyan-hi);
  text-shadow: 0 0 6px var(--hud-cyan-glow);
  flex-shrink: 0;
  position: relative;
}
.agent-avatar::after {
  content: "";
  position: absolute;
  inset: -3px;
  border: 1px dashed var(--hud-cyan-dim);
  border-radius: 50%;
  animation: spin 8s linear infinite;
  opacity: 0.6;
}
@keyframes spin { to { transform: rotate(360deg); } }

.agent-info { flex: 1; min-width: 0; }
.agent-name {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-hi);
}
.agent-role {
  font-family: var(--font-hud);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--hud-cyan);
  margin-top: 1px;
}
.agent-status {
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.4;
}
.agent-metric {
  display: inline-block;
  padding: 1px 6px;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--hud-gold);
  border: 1px solid var(--edge-gold);
  background: rgba(255, 207, 92, 0.05);
  border-radius: 3px;
}

/* ═════ EVAL BOX ═════ */
.eval-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.eval-tile {
  padding: 8px 10px;
  background: var(--bg-inset);
  border: 1px solid var(--edge);
  border-radius: 6px;
}
.eval-tile .lbl {
  font-family: var(--font-hud);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.eval-tile .val {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-hi);
  margin-top: 4px;
}
.eval-tile .val.up { color: var(--up-hi); text-shadow: 0 0 6px var(--up-glow); }
.eval-tile .val.gold { color: var(--hud-gold-hi); text-shadow: 0 0 6px var(--hud-gold-glow); }

.eval-cta {
  margin-top: 10px;
  padding: 8px 12px;
  width: 100%;
  border: 1px solid var(--edge-gold);
  background: linear-gradient(180deg, rgba(255, 207, 92, 0.14), rgba(255, 207, 92, 0.05));
  color: var(--hud-gold-hi);
  font-family: var(--font-hud);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
}
.eval-cta:hover {
  background: linear-gradient(180deg, rgba(255, 207, 92, 0.22), rgba(255, 207, 92, 0.1));
  box-shadow: 0 0 14px var(--hud-gold-glow);
}

/* ═════ CAUSAL GRAPH ═════ */
.graph-wrap {
  position: relative;
  height: 380px;
  background: radial-gradient(ellipse at center, rgba(79, 242, 255, 0.03), transparent 70%),
              var(--bg-inset);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--edge);
}
.graph-wrap svg { display: block; width: 100%; height: 100%; }
.graph-wrap .hud-ring {
  position: absolute;
  border: 1px dashed var(--hud-cyan-dim);
  border-radius: 50%;
  pointer-events: none;
  animation: spin 40s linear infinite;
  opacity: 0.3;
}
.graph-wrap .hud-ring.r1 {
  width: 380px; height: 380px;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}
.graph-wrap .hud-ring.r2 {
  width: 260px; height: 260px;
  top: 50%; left: 50%;
  animation-duration: 25s;
  animation-direction: reverse;
}
.graph-wrap .corner-tick {
  position: absolute;
  color: var(--hud-cyan);
  font-family: var(--font-hud);
  font-size: 9px;
  letter-spacing: 0.14em;
  opacity: 0.6;
}
.graph-wrap .ct-tl { top: 10px; left: 10px; }
.graph-wrap .ct-tr { top: 10px; right: 10px; }
.graph-wrap .ct-bl { bottom: 10px; left: 10px; }
.graph-wrap .ct-br { bottom: 10px; right: 10px; }

.graph-legend {
  display: flex;
  gap: 12px;
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--bg-inset);
  border: 1px solid var(--edge);
  border-radius: 6px;
  font-family: var(--font-hud);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--muted);
  flex-wrap: wrap;
}
.legend-swatch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legend-swatch::before {
  content: "";
  width: 10px; height: 2px;
  background: currentColor;
}
.legend-swatch.drive { color: var(--hud-cyan); }
.legend-swatch.assoc { color: var(--hud-gold); }
.legend-swatch.conflict { color: var(--up); }

/* ═════ EQUITY CURVE ═════ */
.equity-hero {
  position: relative;
}
.equity-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.eq-metric {
  padding: 10px 12px;
  background: var(--bg-inset);
  border: 1px solid var(--edge);
  border-radius: 6px;
  position: relative;
}
.eq-metric .lbl {
  font-family: var(--font-hud);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  color: var(--muted);
}
.eq-metric .val {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 18px;
  color: var(--text-hi);
  margin-top: 4px;
  line-height: 1;
}
.eq-metric .val.up { color: var(--up-hi); text-shadow: 0 0 8px var(--up-glow); }
.eq-metric .val.gold { color: var(--hud-gold-hi); text-shadow: 0 0 8px var(--hud-gold-glow); }
.eq-metric .val.cyan { color: var(--hud-cyan-hi); text-shadow: 0 0 8px var(--hud-cyan-glow); }
.eq-metric .sub {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 3px;
}

.equity-canvas-wrap {
  position: relative;
  height: 280px;
  background: var(--bg-inset);
  border: 1px solid var(--edge);
  border-radius: 6px;
  padding: 8px;
}
.equity-canvas-wrap canvas { display: block; width: 100%; height: 100%; }

/* ═════ TAB PANEL ═════ */
.tabbar {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--edge);
  margin-bottom: 12px;
  overflow-x: auto;
}
.tab {
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: var(--font-hud);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  position: relative;
}
.tab:hover { color: var(--hud-cyan); }
.tab.active {
  color: var(--hud-cyan-hi);
  border-bottom-color: var(--hud-cyan);
  text-shadow: 0 0 8px var(--hud-cyan-glow);
}
.tab .pro-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 4px;
  font-size: 8.5px;
  color: var(--hud-gold);
  border: 1px solid var(--edge-gold);
  border-radius: 3px;
  letter-spacing: 0.06em;
}
.tab.active .pro-badge {
  background: rgba(255, 207, 92, 0.12);
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ═════ STEPPER ═════ */
.stepper {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  padding: 10px 8px;
  background: var(--bg-inset);
  border: 1px solid var(--edge);
  border-radius: 6px;
}
.step {
  flex: 1;
  padding: 6px 8px;
  border-radius: 4px;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}
.step-num {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(79, 242, 255, 0.08);
  border: 1px solid var(--edge);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
}
.step-info { min-width: 0; }
.step-name {
  font-family: var(--font-hud);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
}
.step-desc {
  font-size: 10px;
  color: var(--faint);
  margin-top: 1px;
}
.step.active {
  background: rgba(79, 242, 255, 0.06);
  border: 1px solid var(--edge-hi);
}
.step.active .step-num {
  background: var(--hud-cyan);
  color: var(--bg-void);
  border-color: var(--hud-cyan);
  box-shadow: 0 0 10px var(--hud-cyan-glow);
}
.step.active .step-name { color: var(--hud-cyan-hi); }
.step.done .step-num {
  background: rgba(41, 224, 130, 0.14);
  color: var(--down-hi);
  border-color: rgba(41, 224, 130, 0.4);
}

/* ═════ FORM ROWS ═════ */
.form-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--divider);
}
.form-row:last-child { border-bottom: none; }
.form-label {
  min-width: 90px;
  font-family: var(--font-hud);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
}
.form-value {
  flex: 1;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip-group { display: inline-flex; gap: 2px; border: 1px solid var(--edge); border-radius: 6px; overflow: hidden; }
.chip {
  padding: 5px 12px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}
.chip:not(:last-child) { border-right: 1px solid var(--edge); }
.chip:hover { color: var(--hud-cyan); background: rgba(79, 242, 255, 0.06); }
.chip.active {
  background: linear-gradient(180deg, rgba(79, 242, 255, 0.18), rgba(79, 242, 255, 0.06));
  color: var(--hud-cyan-hi);
  text-shadow: 0 0 6px var(--hud-cyan-glow);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.toggle {
  position: relative;
  width: 32px; height: 18px;
  background: rgba(79, 242, 255, 0.08);
  border: 1px solid var(--edge);
  border-radius: 12px;
  transition: all 0.2s;
}
.toggle::before {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 12px; height: 12px;
  background: var(--muted);
  border-radius: 50%;
  transition: all 0.2s;
}
.toggle.on {
  background: rgba(79, 242, 255, 0.28);
  border-color: var(--hud-cyan);
}
.toggle.on::before {
  left: 16px;
  background: var(--hud-cyan);
  box-shadow: 0 0 6px var(--hud-cyan-glow);
}

.range-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}
.range-track {
  flex: 1;
  height: 4px;
  background: rgba(79, 242, 255, 0.1);
  border-radius: 2px;
  position: relative;
}
.range-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, var(--hud-cyan-dim), var(--hud-cyan));
  border-radius: 2px;
  box-shadow: 0 0 6px var(--hud-cyan-glow);
}
.range-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 12px; height: 12px;
  background: var(--hud-cyan);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--hud-cyan-glow);
}
.range-val {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--hud-cyan-hi);
  min-width: 30px;
  text-align: right;
}

.cta-primary {
  padding: 10px 20px;
  background: linear-gradient(180deg, rgba(79, 242, 255, 0.22), rgba(79, 242, 255, 0.08));
  border: 1px solid var(--hud-cyan);
  color: var(--hud-cyan-hi);
  font-family: var(--font-hud);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
  text-shadow: 0 0 8px var(--hud-cyan-glow);
  box-shadow: 0 0 12px rgba(79, 242, 255, 0.14), inset 0 0 12px rgba(79, 242, 255, 0.08);
}
.cta-primary:hover {
  background: linear-gradient(180deg, rgba(79, 242, 255, 0.36), rgba(79, 242, 255, 0.14));
  box-shadow: 0 0 20px var(--hud-cyan-glow), inset 0 0 16px rgba(79, 242, 255, 0.12);
}
.cta-gold {
  padding: 10px 20px;
  background: linear-gradient(180deg, rgba(255, 207, 92, 0.22), rgba(255, 207, 92, 0.08));
  border: 1px solid var(--hud-gold);
  color: var(--hud-gold-hi);
  font-family: var(--font-hud);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
  text-shadow: 0 0 8px var(--hud-gold-glow);
  box-shadow: 0 0 12px rgba(255, 207, 92, 0.14);
}
.cta-gold:hover {
  background: linear-gradient(180deg, rgba(255, 207, 92, 0.36), rgba(255, 207, 92, 0.14));
  box-shadow: 0 0 20px var(--hud-gold-glow);
}

/* ═════ TABLES ═════ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}
.data-table thead th {
  padding: 8px 6px;
  text-align: left;
  font-family: var(--font-hud);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
  border-bottom: 1px solid var(--edge);
  background: linear-gradient(180deg, transparent, rgba(79, 242, 255, 0.02));
}
.data-table thead th.right { text-align: right; }
.data-table tbody tr {
  border-bottom: 1px solid var(--divider);
  transition: background 0.15s;
}
.data-table tbody tr:hover {
  background: rgba(79, 242, 255, 0.04);
}
.data-table tbody td {
  padding: 8px 6px;
  color: var(--text);
}
.data-table tbody td.right { text-align: right; font-family: var(--font-mono); }
.data-table tbody td.code { font-family: var(--font-mono); color: var(--muted); font-size: 10.5px; }
.data-table tbody td .stock-name {
  font-weight: 600;
  color: var(--text-hi);
}
.data-table tbody td .stock-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 5px;
  font-family: var(--font-hud);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--hud-cyan);
  background: rgba(79, 242, 255, 0.08);
  border: 1px solid var(--edge);
  border-radius: 3px;
}

/* ═════ METRIC GRID (6-cell) ═════ */
.mgrid6 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.mgrid6 .mcell {
  padding: 10px;
  background: var(--bg-inset);
  border: 1px solid var(--edge);
  border-radius: 6px;
  text-align: center;
}
.mgrid6 .mcell .lbl {
  font-family: var(--font-hud);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.mgrid6 .mcell .val {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-hi);
  margin-top: 4px;
}
.mgrid6 .mcell .val.up { color: var(--up-hi); }
.mgrid6 .mcell .val.down { color: var(--down-hi); }
.mgrid6 .mcell .val.cyan { color: var(--hud-cyan-hi); }
.mgrid6 .mcell .val.gold { color: var(--hud-gold-hi); }

/* Price range bar */
.price-bar-wrap {
  margin-top: 12px;
  padding: 12px;
  background: var(--bg-inset);
  border: 1px solid var(--edge);
  border-radius: 6px;
}
.price-bar-title {
  font-family: var(--font-hud);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 10px;
  text-transform: uppercase;
}
.price-bar {
  position: relative;
  height: 8px;
  background: linear-gradient(90deg,
    var(--down) 0%,
    var(--down-hi) 25%,
    var(--muted) 50%,
    var(--up-hi) 75%,
    var(--up) 100%);
  border-radius: 4px;
  box-shadow: 0 0 12px rgba(79, 242, 255, 0.1);
}
.price-marker {
  position: absolute;
  top: -6px;
  width: 2px; height: 20px;
  background: var(--hud-cyan-hi);
  box-shadow: 0 0 8px var(--hud-cyan);
  transform: translateX(-50%);
}
.price-marker::after {
  content: attr(data-label);
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--hud-cyan-hi);
  white-space: nowrap;
}
.price-bar-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
}

/* ═════ CHIP DISTRIBUTION ═════ */
.chip-dist-wrap {
  height: 160px;
  background: var(--bg-inset);
  border: 1px solid var(--edge);
  border-radius: 6px;
  padding: 8px;
  position: relative;
}
.chip-dist-wrap canvas { display: block; width: 100%; height: 100%; }

/* ═════ MA LADDER ═════ */
.ma-ladder {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
.ma-cell {
  padding: 8px 6px;
  background: var(--bg-inset);
  border: 1px solid var(--edge);
  border-radius: 5px;
  text-align: center;
}
.ma-cell .lbl {
  font-family: var(--font-hud);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.ma-cell .val {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  margin-top: 3px;
}
.ma-cell.up .val { color: var(--up-hi); }
.ma-cell.down .val { color: var(--down-hi); }
.ma-cell .delta {
  font-family: var(--font-mono);
  font-size: 9.5px;
  margin-top: 2px;
}

/* ═════ SECTION SUB TITLE ═════ */
.sub-title {
  font-family: var(--font-hud);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--hud-cyan);
  margin: 14px 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sub-title::before {
  content: "▸";
  color: var(--hud-cyan);
  font-size: 10px;
}
.sub-title .badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  border: 1px solid var(--edge);
  border-radius: 3px;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}

/* ═════ COMPARE TABLE (backtest) ═════ */
.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.strategy-card {
  padding: 12px;
  background: var(--bg-inset);
  border: 1px solid var(--edge);
  border-radius: 8px;
  position: relative;
}
.strategy-card.A { border-color: var(--edge-hi); }
.strategy-card.B { border-color: var(--edge-gold); }
.strategy-card .st-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.strategy-card.A .st-title { color: var(--hud-cyan-hi); }
.strategy-card.B .st-title { color: var(--hud-gold-hi); }
.strategy-card .st-desc {
  font-size: 10.5px;
  color: var(--muted);
  margin-bottom: 10px;
  line-height: 1.5;
}
.strategy-card .st-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.strategy-card .st-cell {
  padding: 6px 8px;
  background: rgba(3, 8, 17, 0.6);
  border: 1px solid var(--edge);
  border-radius: 4px;
}
.strategy-card .st-cell .lbl {
  font-family: var(--font-hud);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.strategy-card .st-cell .val {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-hi);
  margin-top: 2px;
}
.strategy-card .st-cell .val.up { color: var(--up-hi); }
.strategy-card .st-cell .val.gold { color: var(--hud-gold-hi); }

/* ═════ TRADE RECORD ═════ */
.trade-record {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--edge);
  border-radius: 6px;
  background: var(--bg-inset);
}
.trade-record::-webkit-scrollbar { width: 6px; }
.trade-record::-webkit-scrollbar-thumb { background: var(--edge); border-radius: 3px; }

/* ═════ MODAL ═════ */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(3, 8, 17, 0.82);
  backdrop-filter: blur(6px);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-bg.open { display: flex; }
.modal {
  width: min(920px, 96vw);
  max-height: 90vh;
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(9, 18, 34, 0.98), rgba(6, 14, 28, 0.96));
  border: 1px solid var(--edge-hi);
  border-radius: 12px;
  padding: 22px;
  position: relative;
  box-shadow: 0 0 60px rgba(79, 242, 255, 0.18);
}
.modal::before, .modal::after {
  content: "";
  position: absolute;
  width: 20px; height: 20px;
  border: 1.5px solid var(--hud-cyan);
  pointer-events: none;
}
.modal::before {
  top: -1px; left: -1px;
  border-right: none;
  border-bottom: none;
}
.modal::after {
  bottom: -1px; right: -1px;
  border-left: none;
  border-top: none;
}
.modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--edge);
  margin-bottom: 16px;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--hud-cyan-hi);
  text-shadow: 0 0 10px var(--hud-cyan-glow);
}
.modal-close {
  margin-left: auto;
  width: 28px; height: 28px;
  border: 1px solid var(--edge);
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}
.modal-close:hover { border-color: var(--up); color: var(--up); }

.sample-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.sample-card {
  padding: 12px;
  background: var(--bg-inset);
  border: 1px solid var(--edge);
  border-radius: 6px;
}
.sample-card .sc-title {
  font-family: var(--font-hud);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--hud-cyan);
  margin-bottom: 6px;
  text-transform: uppercase;
}
.sample-card .sc-total {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--up-hi);
  text-shadow: 0 0 8px var(--up-glow);
  margin-bottom: 4px;
}
.sample-card .sc-days {
  font-size: 10.5px;
  color: var(--muted);
  margin-bottom: 8px;
}
.sample-card .sc-days .dot-ok, .sample-card .sc-days .dot-ko {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 2px;
  margin: 0 2px;
  vertical-align: middle;
}
.sample-card .sc-days .dot-ok { background: var(--up); }
.sample-card .sc-days .dot-ko { background: var(--down); }
.sample-card .sc-mini {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  line-height: 1.6;
}

/* ═════ FOOTER ═════ */
.footer {
  position: relative;
  z-index: 2;
  padding: 14px 22px;
  border-top: 1px solid var(--edge);
  color: var(--faint);
  font-family: var(--font-hud);
  font-size: 10px;
  letter-spacing: 0.14em;
  display: flex;
  justify-content: space-between;
  text-transform: uppercase;
}

/* Utility */
.spacer { flex: 1; }
.hidden { display: none !important; }
