/* ═══════════════════════════════════════════════════════════════════════════
   MNQ 25-5 Live Trading Dashboard — Dark Theme Stylesheet
   Design System:
     bg:        #0a0a0f
     card:      #141420
     border:    #2a2a40
     green:     #00ff88
     red:       #ff4466
     orange:    #ffaa00
     blue:      #4488ff
     text:      #e0e0e8
     muted:     #6a6a7a
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: #0a0a0f;
  color: #e0e0e8;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Utility Classes ──────────────────────────────────────────────────────── */
.mono {
  font-family: "SF Mono", "Cascadia Code", "JetBrains Mono", "Fira Code",
    "Consolas", monospace;
  font-variant-numeric: tabular-nums;
}

.text-green  { color: #00ff88; }
.text-red    { color: #ff4466; }
.text-orange { color: #ffaa00; }
.text-blue   { color: #4488ff; }
.text-muted  { color: #6a6a7a; }
.text-right  { text-align: right; }
.text-center { text-align: center; }

/* ── Header Bar ───────────────────────────────────────────────────────────── */
#header-bar {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0d0d14;
  border-bottom: 1px solid #2a2a40;
  padding: 0 20px;
  height: 52px;
  gap: 16px;
  flex-wrap: wrap;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  white-space: nowrap;
}

.header-left .bot-name {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #ffffff;
}

/* Status badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: background 0.2s ease, color 0.2s ease;
}

.status-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-running .dot {
  background: #00ff88;
  box-shadow: 0 0 6px #00ff88;
  animation: pulse-dot 1.4s ease-in-out infinite;
}

.status-idle .dot {
  background: #6a6a7a;
}

.status-error .dot {
  background: #ff4466;
  box-shadow: 0 0 6px #ff4466;
  animation: pulse-dot 0.7s ease-in-out infinite;
}

.status-killing .dot {
  background: #ffaa00;
  box-shadow: 0 0 6px #ffaa00;
  animation: pulse-dot 0.5s ease-in-out infinite;
}

.status-paused .dot {
  background: #ffaa00;
  box-shadow: 0 0 6px #ffaa00;
}

.status-running  { background: rgba(0, 255, 136, 0.12); color: #00ff88; border: 1px solid rgba(0, 255, 136, 0.25); }
.status-idle     { background: rgba(106, 106, 122, 0.12); color: #6a6a7a; border: 1px solid rgba(106, 106, 122, 0.2); }
.status-error    { background: rgba(255, 68, 102, 0.12); color: #ff4466; border: 1px solid rgba(255, 68, 102, 0.25); }
.status-killing  { background: rgba(255, 170, 0, 0.12); color: #ffaa00; border: 1px solid rgba(255, 170, 0, 0.25); }
.status-paused   { background: rgba(255, 170, 0, 0.12); color: #ffaa00; border: 1px solid rgba(255, 170, 0, 0.25); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

/* Header right */
.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.8rem;
  color: #8a8a9a;
}

.header-right .info-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  background: #141420;
  border-radius: 8px;
  border: 1px solid #2a2a40;
}

.header-right .info-chip .label {
  color: #6a6a7a;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.header-right .info-chip .value {
  font-weight: 600;
}

.on-track-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.on-track-indicator.on {
  background: rgba(0, 255, 136, 0.1);
  color: #00ff88;
  border: 1px solid rgba(0, 255, 136, 0.2);
}

.on-track-indicator.off {
  background: rgba(255, 68, 102, 0.1);
  color: #ff4466;
  border: 1px solid rgba(255, 68, 102, 0.2);
}

/* Connection status */
.conn-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 4px;
}

.conn-dot.connected { background: #00ff88; }
.conn-dot.disconnected { background: #ff4466; }

/* ── Stats Bar ────────────────────────────────────────────────────────────── */
#stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  padding: 14px 20px;
  background: #0d0d14;
  border-bottom: 1px solid #1a1a30;
}

.stat-card {
  background: #141420;
  border: 1px solid #2a2a40;
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.stat-card:hover {
  border-color: #3a3a55;
}

.stat-card .stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6a6a7a;
}

.stat-card .stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  font-family: "SF Mono", "Cascadia Code", "JetBrains Mono", "Consolas", monospace;
  font-variant-numeric: tabular-nums;
}

.stat-card .stat-sub {
  font-size: 0.7rem;
  color: #6a6a7a;
}

/* ── Control Bar ──────────────────────────────────────────────────────────── */
#control-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: #0d0d14;
  border-bottom: 1px solid #1a1a30;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  letter-spacing: 0.02em;
  font-family: inherit;
  outline: none;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-start {
  background: rgba(0, 255, 136, 0.12);
  color: #00ff88;
  border-color: rgba(0, 255, 136, 0.3);
}

.btn-start:hover:not(:disabled) {
  background: rgba(0, 255, 136, 0.22);
  box-shadow: 0 0 16px rgba(0, 255, 136, 0.12);
}

.btn-stop {
  background: rgba(255, 68, 102, 0.12);
  color: #ff4466;
  border-color: rgba(255, 68, 102, 0.3);
}

.btn-stop:hover:not(:disabled) {
  background: rgba(255, 68, 102, 0.22);
  box-shadow: 0 0 16px rgba(255, 68, 102, 0.10);
}

.btn-kill {
  background: rgba(255, 68, 102, 0.16);
  color: #ff4466;
  border-color: rgba(255, 68, 102, 0.5);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.btn-kill:hover:not(:disabled) {
  background: #ff4466;
  color: #0a0a0f;
}

.btn-mode {
  background: #141420;
  color: #8a8a9a;
  border-color: #2a2a40;
  min-width: 64px;
}

.btn-mode:hover {
  color: #e0e0e8;
  border-color: #4488ff;
}

.btn-mode.active {
  background: rgba(68, 136, 255, 0.15);
  color: #4488ff;
  border-color: rgba(68, 136, 255, 0.5);
}

/* Grid & Exit mode selectors */
.grid-selector {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 8px;
  font-size: 0.7rem;
  color: #6a6a7a;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-grid, .btn-exit, .btn-trail, .btn-session {
  background: #141420;
  color: #8a8a9a;
  border: 1px solid #2a2a40;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  cursor: pointer;
  font-family: inherit;
}

.btn-grid:hover, .btn-exit:hover, .btn-trail:hover, .btn-session:hover {
  border-color: #4488ff;
  color: #e0e0e8;
}

.btn-grid.active {
  background: rgba(0, 255, 136, 0.12);
  color: #00ff88;
  border-color: rgba(0, 255, 136, 0.4);
}

.btn-exit.active {
  background: rgba(255, 170, 0, 0.12);
  color: #ffaa00;
  border-color: rgba(255, 170, 0, 0.4);
}

.btn-trail.active {
  background: rgba(0, 255, 136, 0.1);
  color: #00ff88;
  border-color: rgba(0, 255, 136, 0.35);
}

.btn-session.active {
  background: rgba(68, 136, 255, 0.12);
  color: #4488ff;
  border-color: rgba(68, 136, 255, 0.35);
}

/* Grid dropdown */
.grid-dropdown {
  background: #141420;
  color: #e0e0e8;
  border: 1px solid #2a2a40;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-family: inherit;
  cursor: pointer;
}

.grid-dropdown:focus {
  border-color: #4488ff;
  outline: none;
}

.grid-rescue2-display {
  color: #4488ff;
  font-size: 0.7rem;
  font-family: monospace;
  font-weight: 700;
  min-width: 16px;
  text-align: center;
}

.btn-grid-lock {
  background: #141420;
  color: #8a8a9a;
  border: 1px solid #2a2a40;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.65rem;
  cursor: pointer;
  font-family: inherit;
}

.btn-grid-lock:hover {
  border-color: #00ff88;
  color: #00ff88;
}

#grid-lock-section.locked {
  border: 1px solid rgba(0, 255, 136, 0.5);
  border-radius: 6px;
  padding: 2px 6px;
  box-shadow: 0 0 8px rgba(0, 255, 136, 0.15);
}

/* Dry-run toggle */
.dry-run-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
  font-size: 0.75rem;
  color: #8a8a9a;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #2a2a40;
  border-radius: 22px;
  transition: background 0.25s ease;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: #6a6a7a;
  border-radius: 50%;
  transition: transform 0.25s ease, background 0.25s ease;
}

.toggle-switch input:checked + .toggle-slider {
  background: rgba(0, 255, 136, 0.25);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
  background: #00ff88;
}

/* ── Account Selector ─────────────────────────────────────────────────────── */
#account-select {
  background: #141420;
  border: 1px solid #2a2a40;
  color: #e0e0e8;
  padding: 6px 12px;
  border-radius: 8px;
  font-family: "SF Mono", "Cascadia Code", "JetBrains Mono", "Fira Code", "Consolas", monospace;
  font-size: 12px;
  min-width: 260px;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
  cursor: pointer;
}
#account-select:focus {
  outline: none;
  border-color: #ffaa00;
  box-shadow: 0 0 0 3px rgba(255, 170, 0, 0.15);
}
#account-select option {
  background: #141420;
  color: #e0e0e8;
  font-family: "SF Mono", "Cascadia Code", "JetBrains Mono", "Fira Code", "Consolas", monospace;
  font-size: 11px;
  padding: 6px 10px;
}

/* ── Copy Trading Strip (TakeProfitTrader) ─────────────────────────────────── */
.copy-strip {
  background: linear-gradient(135deg, rgba(68, 136, 255, 0.06), rgba(68, 136, 255, 0.02));
  border: 1px solid rgba(68, 136, 255, 0.15);
  border-radius: 12px;
  padding: 12px 16px;
  margin: 12px 20px 0;
}
.copy-strip-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.copy-strip-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: #4488ff;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.copy-strip-hint {
  font-size: 0.68rem;
  color: #6a6a7a;
  flex: 1;
}
.copy-strip-targets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.copy-target-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 8px;
  border: 1px solid rgba(68, 136, 255, 0.2);
  background: rgba(68, 136, 255, 0.06);
  font-size: 0.72rem;
  color: #a0b8e0;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.copy-target-item:hover {
  border-color: rgba(68, 136, 255, 0.4);
  background: rgba(68, 136, 255, 0.12);
}
.copy-target-item.checked {
  border-color: #00ff88;
  background: rgba(0, 255, 136, 0.08);
  color: #00ff88;
}
.copy-target-item input[type="checkbox"] {
  accent-color: #00ff88;
  width: 13px;
  height: 13px;
  cursor: pointer;
}
.copy-target-name {
  font-weight: 600;
}
.copy-target-badge {
  font-size: 0.6rem;
  padding: 1px 6px;
  border-radius: 6px;
  font-weight: 600;
  text-transform: uppercase;
}
.copy-target-badge.live {
  background: rgba(0, 255, 136, 0.12);
  color: #00ff88;
}
.copy-target-badge.sim {
  background: rgba(106, 106, 122, 0.12);
  color: #6a6a7a;
}
.copy-target-badge.tpt {
  background: rgba(255, 170, 0, 0.12);
  color: #ffaa00;
}

/* ── Journal des Trades ────────────────────────────────────────────────────── */
.journal-panel {
  margin-top: 8px;
}
.journal-table {
  width: 100%;
  border-collapse: collapse;
  font-family: "SF Mono", "Cascadia Code", "JetBrains Mono", "Fira Code", "Consolas", monospace;
  font-size: 0.7rem;
}
.journal-table thead th {
  position: sticky;
  top: 0;
  background: #141420;
  color: #6a6a7a;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 6px;
  text-align: center;
  border-bottom: 2px solid #2a2a40;
  white-space: nowrap;
}
.journal-table tbody td {
  padding: 5px 6px;
  text-align: center;
  border-bottom: 1px solid rgba(42, 42, 64, 0.3);
  white-space: nowrap;
  color: #c0c0d0;
}
.journal-table tbody tr:hover td {
  background: rgba(68, 136, 255, 0.04);
}
.journal-table .pnl-positive { color: #00ff88; font-weight: 600; }
.journal-table .pnl-negative { color: #ff4466; font-weight: 600; }
.journal-table .side-long  { color: #00ff88; }
.journal-table .side-short { color: #ff4466; }
.journal-table .outcome-tp { color: #00ff88; }
.journal-table .outcome-sl { color: #ff4466; }
.journal-table .outcome-rescue { color: #ffaa00; }
.journal-table tfoot td {
  padding: 8px 6px;
  font-weight: 700;
  font-size: 0.75rem;
  border-top: 2px solid #2a2a40;
  text-align: center;
}
.journal-table tfoot .total-label { color: #8a8a9a; text-align: right; }

/* ── Main Content Grid ────────────────────────────────────────────────────── */
#main-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 14px 20px;
}

@media (max-width: 1024px) {
  #main-content {
    grid-template-columns: 1fr;
  }
  #stats-bar {
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  }
}

/* ── Panels / Cards ───────────────────────────────────────────────────────── */
.panel {
  background: #141420;
  border: 1px solid #2a2a40;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #1a1a30;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #8a8a9a;
  background: rgba(255, 255, 255, 0.015);
}

.panel-body {
  padding: 12px 14px;
  flex: 1;
  min-height: 0;
}

/* Chart panels get special handling */
.panel.chart-panel .panel-body {
  padding: 8px 10px;
  position: relative;
}

/* ▸ Chart panels must allow content to determine their height.
   The default .panel-body { flex:1; min-height:0 } combined with
   .panel { overflow:hidden } collapses the panel to ~35px and
   clips the 500px chart canvas — rendering it completely invisible.
   Override both to let the chart breathe. */
.chart-panel-fullwidth .panel-body,
.chart-panel-fullwidth {
  min-height: auto !important;
  overflow: visible !important;
  flex: 0 0 auto !important;
}
.chart-panel-fullwidth .panel-body {
  height: 500px !important;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 340px;
}

.chart-container canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.chart-container.large {
  height: 420px;
}

/* ── Active Cycle Panel ───────────────────────────────────────────────────── */
.cycle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.cycle-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cycle-item .cycle-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6a6a7a;
}

.cycle-item .cycle-value {
  font-size: 0.95rem;
  font-weight: 700;
  font-family: "SF Mono", "Cascadia Code", "JetBrains Mono", "Consolas", monospace;
  font-variant-numeric: tabular-nums;
}

.cycle-item .cycle-value.flash-negative {
  animation: flash-red 0.6s ease-in-out infinite;
}

@keyframes flash-red {
  0%, 100% { color: #ff4466; }
  50%      { color: #ff6688; }
}

.direction-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.direction-badge.long  { background: rgba(0, 255, 136, 0.12); color: #00ff88; }
.direction-badge.short { background: rgba(255, 68, 102, 0.12); color: #ff4466; }

.rescue-state {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
}

.rescue-state.none   { background: rgba(106, 106, 122, 0.1); color: #6a6a7a; }
.rescue-state.rescue1 { background: rgba(255, 170, 0, 0.12); color: #ffaa00; }
.rescue-state.rescue2 { background: rgba(68, 136, 255, 0.12); color: #4488ff; }

/* ── Grid DCA Table ───────────────────────────────────────────────────────── */
.dca-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.dca-table th {
  text-align: left;
  padding: 6px 8px;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6a6a7a;
  border-bottom: 1px solid #1a1a30;
}

.dca-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #141425;
  font-family: "SF Mono", "Cascadia Code", "JetBrains Mono", "Consolas", monospace;
  font-variant-numeric: tabular-nums;
}

.dca-table .status-filled    { color: #00ff88; }
.dca-table .status-pending   { color: #ffaa00; }
.dca-table .status-notrigger { color: #6a6a7a; }

/* ── Trades Table ─────────────────────────────────────────────────────────── */
.trades-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
  max-height: 320px;
  overflow-y: auto;
  display: block;
}

.trades-table thead,
.trades-table tbody {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.trades-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

.trades-table th {
  text-align: left;
  padding: 6px 8px;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6a6a7a;
  border-bottom: 1px solid #1a1a30;
  background: #141420;
}

.trades-table td {
  padding: 5px 8px;
  border-bottom: 1px solid #141425;
  font-family: "SF Mono", "Cascadia Code", "JetBrains Mono", "Consolas", monospace;
  font-variant-numeric: tabular-nums;
}

.trades-table tr.win  { background: rgba(0, 255, 136, 0.03); }
.trades-table tr.loss { background: rgba(255, 68, 102, 0.03); }

.trades-table .cumulative-row {
  font-weight: 700;
  border-top: 2px solid #2a2a40;
  background: rgba(255, 255, 255, 0.02);
}

/* ── Signal State Panel ───────────────────────────────────────────────────── */
.signal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.signal-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.signal-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.signal-badge.active  { background: rgba(0, 255, 136, 0.12); color: #00ff88; }
.signal-badge.waiting { background: rgba(106, 106, 122, 0.1);  color: #6a6a7a; }

.level-tag {
  display: inline-block;
  padding: 2px 6px;
  margin: 2px;
  border-radius: 3px;
  font-size: 0.65rem;
  font-family: "SF Mono", "Cascadia Code", "JetBrains Mono", "Consolas", monospace;
  background: rgba(255, 255, 255, 0.04);
  color: #8a8a9a;
  border: 1px solid #2a2a40;
}

.level-tag.active {
  background: rgba(68, 136, 255, 0.1);
  color: #4488ff;
  border-color: rgba(68, 136, 255, 0.3);
}

/* ── Events Panel ─────────────────────────────────────────────────────────── */
.events-list {
  max-height: 240px;
  overflow-y: auto;
  font-size: 0.7rem;
  font-family: "SF Mono", "Cascadia Code", "JetBrains Mono", "Consolas", monospace;
}

.event-item {
  padding: 4px 0;
  border-bottom: 1px solid #141425;
  display: flex;
  gap: 8px;
}

.event-time {
  color: #6a6a7a;
  white-space: nowrap;
  min-width: 68px;
}

.event-msg {
  color: #b0b0c0;
}

.event-item.warn  .event-msg { color: #ffaa00; }
.event-item.error .event-msg { color: #ff4466; }
.event-item.info  .event-msg { color: #4488ff; }
.event-item.trade .event-msg { color: #00ff88; }

/* ── Footer ────────────────────────────────────────────────────────────────── */
#footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px;
  border-top: 1px solid #1a1a30;
  font-size: 0.68rem;
  color: #4a4a5a;
  background: #0d0d14;
  flex-wrap: wrap;
  gap: 8px;
}

#footer-bar span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.footer-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #00ff88;
  display: inline-block;
}

/* ── Modal ─────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.15s ease;
}

.modal-box {
  background: #141420;
  border: 1px solid #2a2a40;
  border-radius: 12px;
  padding: 24px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
}

.modal-box h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
  color: #ff4466;
}

.modal-box p {
  font-size: 0.85rem;
  color: #8a8a9a;
  margin-bottom: 18px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── Bot Offline Overlay ──────────────────────────────────────────────────── */
#offline-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
}

#offline-overlay.visible {
  display: flex;
}

#offline-overlay .offline-icon {
  font-size: 3rem;
  opacity: 0.6;
}

#offline-overlay .offline-text {
  font-size: 1.2rem;
  font-weight: 600;
  color: #6a6a7a;
}

#offline-overlay .offline-sub {
  font-size: 0.8rem;
  color: #4a4a5a;
}

/* ── Empty State ──────────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  color: #4a4a5a;
  font-size: 0.8rem;
  font-style: italic;
}

/* ── Responsive Tweaks ────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  html { font-size: 12px; }
  #header-bar {
    height: auto;
    padding: 10px 12px;
    gap: 8px;
  }
  #header-bar .header-right {
    flex-wrap: wrap;
    gap: 6px;
  }
  #stats-bar {
    padding: 10px 12px;
    gap: 6px;
  }
  #control-bar {
    padding: 10px 12px;
    gap: 6px;
  }
  #main-content {
    padding: 10px 12px;
    gap: 8px;
  }
  .chart-container {
    height: 260px;
  }
  .chart-container.large {
    height: 310px;
  }
  .cycle-grid {
    grid-template-columns: 1fr 1fr;
  }
  .btn {
    padding: 6px 12px;
    font-size: 0.72rem;
  }
}

/* ── Vue d'ensemble (overview) ────────────────────────────────────────── */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.overview-item {
  background: #0d0d18;
  border: 1px solid #1e1e35;
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.overview-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6a6a7a;
}

.overview-value {
  font-size: 0.9rem;
  font-weight: 700;
}

.overview-sub {
  font-size: 0.6rem;
  color: #4a4a5a;
}

.overview-bar-container {
  position: relative;
  height: 28px;
  background: #141420;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #2a2a40;
}

.ov-bar-fill {
  position: absolute;
  top: 0;
  height: 100%;
  transition: width 0.5s ease;
}

.ov-bar-line {
  position: absolute;
  top: 0;
  width: 3px;
  height: 100%;
  transition: left 0.5s ease;
}

@media (max-width: 480px) {
  #main-content {
    grid-template-columns: 1fr;
  }
  .cycle-grid {
    grid-template-columns: 1fr;
  }
  .signal-grid {
    grid-template-columns: 1fr;
  }
}

/* ═══════════════════════════════════════════════════════════════ */
/* FLASH CRASH BANNER                                           */
/* ═══════════════════════════════════════════════════════════════ */
#flash-crash-banner {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1000;
  pointer-events: none;
}
.flash-crash-frame {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border: 4px solid #ff2222;
  box-shadow: inset 0 0 120px rgba(255,0,0,0.15), 0 0 60px rgba(255,0,0,0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(180,0,0,0.05);
  animation: flash-pulse 1.2s ease-in-out infinite;
}
.flash-crash-icon {
  font-size: 3rem;
  animation: flash-blink 0.6s ease-in-out infinite;
}
.flash-crash-text {
  font-family: 'SF Mono','Fira Code',monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: #ff2222;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  text-shadow: 0 0 20px rgba(255,0,0,0.5);
}
.flash-crash-countdown {
  font-family: 'SF Mono','Fira Code',monospace;
  font-size: 2rem;
  font-weight: 800;
  color: #ff4444;
  text-shadow: 0 0 30px rgba(255,0,0,0.6);
}
@keyframes flash-pulse {
  0%, 100% { box-shadow: inset 0 0 120px rgba(255,0,0,0.15), 0 0 60px rgba(255,0,0,0.1); }
  50%      { box-shadow: inset 0 0 160px rgba(255,0,0,0.25), 0 0 80px rgba(255,0,0,0.2); }
}
@keyframes flash-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.3; }
}
