/* SAGE — Dark Research Framework CSS */
:root {
  --bg-0: #0a0e1a;
  --bg-1: #0f1629;
  --bg-2: #1a2035;
  --bg-3: #1e2740;
  --bg-card: #141c2e;
  --border: #1e2d4a;
  --border-light: #243352;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #4e6280;
  --accent-blue: #3b82f6;
  --accent-cyan: #06b6d4;
  --accent-green: #22c55e;
  --accent-red: #ef4444;
  --accent-orange: #f59e0b;
  --accent-purple: #a855f7;
  --gradient-trading: linear-gradient(135deg, #1e3a5f, #0f2744);
  --gradient-sports: linear-gradient(135deg, #2d1b4e, #1a0e2e);
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --radius: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow-x: hidden; overflow-y: auto; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-0);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100dvh;
}

/* ═══════════════════════════════════════
   LAYOUT
════════════════════════════════════════ */
.app-shell {
  display: grid;
  grid-template-rows: 56px 40px 1fr 32px;
  min-height: 100dvh;
  height: 100dvh;
  overflow: hidden;
}

/* ═══════════════════════════════════════
   HEADER
════════════════════════════════════════ */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}

.logo-text { font-size: 18px; font-weight: 700; letter-spacing: 2px; color: var(--text-primary); }
.logo-sub { font-size: 11px; color: var(--text-muted); letter-spacing: 1px; }

.header-right { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; margin-left: auto; min-width: 0; max-width: 100%; }


.provider-select {
  min-width: 120px;
  max-width: 170px;
  padding: 8px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 12px;
  cursor: pointer;
}
.provider-select:focus { outline: none; border-color: var(--accent-blue); }

.table-scroll { width: 100%; overflow-x: auto; }
.leaderboard-table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 13px; }
.performance-content, #performance-content { overflow-x: auto; }
.backtest-summary { overflow-x: auto; }
.main-content, .tab-pane, .session-results, .backtest-layout, .perf-grid, .weight-evolution, .equity-section { min-width: 0; }
.pick-card, .session-header, .session-summary, .pick-game, .pick-reasoning, .pick-thesis, .pick-odds-row { overflow-wrap: anywhere; }

/* ═══════════════════════════════════════
   NAV TABS
════════════════════════════════════════ */
.tab-nav {
  display: flex;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  gap: 0;
  overflow-x: auto;
}

.tab-btn {
  padding: 0 20px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all 0.15s;
}

.tab-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.04); }
.tab-btn.active { color: var(--accent-blue); border-bottom-color: var(--accent-blue); }

/* ═══════════════════════════════════════
   MAIN CONTENT
════════════════════════════════════════ */
.main-content { overflow: hidden; position: relative; }
.tab-pane { display: none; min-height: 0; height: 100%; overflow-y: auto; padding: 20px 24px; }
.tab-pane.active { display: block; }

/* ═══════════════════════════════════════
   STATUS BAR
════════════════════════════════════════ */
.status-bar-container {
  background: var(--bg-1);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 20px;
  font-size: 12px;
}

.status-item { color: var(--text-secondary); }
.status-item.ok { color: var(--accent-green); }
.status-item.warn { color: var(--accent-orange); }
.status-item.error { color: var(--accent-red); }

/* ═══════════════════════════════════════
   TRADING & SPORTS SESSION PANELS
════════════════════════════════════════ */
.session-panel {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  height: calc(100% - 0px);
}

.session-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.control-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.control-card h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.context-textarea {
  width: 100%;
  min-height: 120px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
  padding: 10px;
  resize: vertical;
  font-family: inherit;
}

.context-textarea:focus { outline: none; border-color: var(--accent-blue); }
.context-textarea::placeholder { color: var(--text-muted); }

.run-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  letter-spacing: 0.5px;
}

.run-btn:hover { opacity: 0.9; }
.run-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.run-btn.sports { background: linear-gradient(135deg, #7c3aed, #a855f7); }

.progress-container { display: none; }
.progress-bar {
  height: 4px;
  background: var(--bg-3);
  border-radius: 2px;
  margin: 8px 0;
  overflow: hidden;
}

.progress-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan));
  border-radius: 2px;
  width: 0%;
  transition: width 0.5s ease;
}

.progress-label { font-size: 12px; color: var(--text-muted); }

/* ═══════════════════════════════════════
   PICKS GRID
════════════════════════════════════════ */
.session-results { overflow-y: auto; overflow-x: hidden; }

.session-header { margin-bottom: 16px; }

.session-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.session-summary {
  color: var(--text-secondary);
  font-size: 13px;
  font-style: italic;
}

.picks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 12px;
  min-width: 0;
}

.pick-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  position: relative;
  transition: border-color 0.15s;
}

.pick-card:hover { border-color: var(--border-light); }
.pick-card.trading { border-left: 3px solid var(--accent-blue); }
.pick-card.sports { border-left: 3px solid var(--accent-purple); }

.pick-rank {
  position: absolute;
  top: 10px; right: 12px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.pick-ticker {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.pick-action {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  margin: 4px 0;
}

.pick-action.buy { background: rgba(34,197,94,0.15); color: var(--accent-green); }
.pick-action.sell { background: rgba(239,68,68,0.15); color: var(--accent-red); }
.pick-action.hold { background: rgba(245,158,11,0.15); color: var(--accent-orange); }

.pick-levels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 8px 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.pick-levels strong { color: var(--text-primary); }
.pick-thesis { font-size: 12px; color: var(--text-secondary); margin: 8px 0; line-height: 1.4; }

.pick-footer {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
}

.pick-actions { display: flex; gap: 8px; margin-top: 10px; }

/* Sports pick specifics */
.sport-badge {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-cyan);
  margin-bottom: 4px;
}

.pick-game { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.bet-type-badge {
  display: inline-block;
  padding: 2px 8px;
  background: var(--bg-3);
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.pick-pick {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-purple);
  margin-bottom: 6px;
}

.pick-odds-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0;
}

.odds-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-green);
  font-family: var(--font-mono);
}

.implied-prob { font-size: 12px; color: var(--text-secondary); }
.units { font-size: 13px; color: var(--accent-orange); font-weight: 600; }

.pick-confidence { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.pick-reasoning { font-size: 12px; color: var(--text-muted); line-height: 1.4; margin-bottom: 8px; }
.pick-agents { font-size: 11px; color: var(--text-muted); }

/* ═══════════════════════════════════════
   BUTTONS
════════════════════════════════════════ */
.btn-sm {
  padding: 5px 10px;
  border-radius: 5px;
  border: 1px solid var(--border-light);
  background: var(--bg-3);
  color: var(--text-primary);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-sm:hover { background: var(--bg-2); border-color: var(--accent-blue); }
.win-btn { border-color: rgba(34,197,94,0.4); color: var(--accent-green); }
.win-btn:hover { background: rgba(34,197,94,0.1); }
.loss-btn { border-color: rgba(239,68,68,0.4); color: var(--accent-red); }
.loss-btn:hover { background: rgba(239,68,68,0.1); }

.btn-primary {
  padding: 8px 16px;
  background: var(--accent-blue);
  border: none;
  border-radius: 6px;
  color: white;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-primary:hover { opacity: 0.85; }

/* ═══════════════════════════════════════
   BADGES
════════════════════════════════════════ */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-3);
  color: var(--text-secondary);
}

.badge-shadow { background: rgba(59,130,246,0.15); color: var(--accent-blue); }
.badge-spawned { background: rgba(168,85,247,0.15); color: var(--accent-purple); }
.badge-warn { background: rgba(245,158,11,0.15); color: var(--accent-orange); }

.regime-badge {
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-3);
}

/* ═══════════════════════════════════════
   AGENT CARDS
════════════════════════════════════════ */
.domain-section { margin-bottom: 32px; }

.domain-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  font-size: 13px;
}

.domain-header.trading { background: var(--gradient-trading); border: 1px solid rgba(59,130,246,0.3); }
.domain-header.sports { background: var(--gradient-sports); border: 1px solid rgba(168,85,247,0.3); }

.domain-actions { display: flex; gap: 8px; }

.layer-section { margin-bottom: 20px; }
.layer-label {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 10px;
  padding-left: 4px;
  border-left: 2px solid var(--border-light);
}

.agents-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.agent-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}

.agent-card:hover { border-color: var(--accent-blue); transform: translateY(-1px); }

.agent-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.agent-name { font-size: 12px; font-weight: 600; line-height: 1.3; }
.agent-weight { font-size: 14px; font-weight: 700; font-family: var(--font-mono); }

.weight-bar {
  height: 3px;
  background: var(--bg-3);
  border-radius: 2px;
  margin-bottom: 8px;
  overflow: hidden;
}

.weight-fill { height: 100%; border-radius: 2px; transition: width 0.5s; }

.agent-stats {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.agent-badges { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 4px; }
.agent-rewrites { font-size: 10px; color: var(--text-muted); }

/* ═══════════════════════════════════════
   PERFORMANCE TAB
════════════════════════════════════════ */
.perf-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.perf-section { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.perf-section h3 { font-size: 13px; font-weight: 600; margin-bottom: 12px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px; }

.leaderboard-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.leaderboard-table th { color: var(--text-muted); font-weight: 500; padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; font-size: 11px; letter-spacing: 0.5px; text-transform: uppercase; }
.leaderboard-table td { padding: 6px 8px; border-bottom: 1px solid rgba(30,45,74,0.5); }
.leaderboard-table tr:hover { background: var(--bg-3); }
.leaderboard-table .top-agent { background: rgba(34,197,94,0.05); }
.leaderboard-table .bot-agent { background: rgba(239,68,68,0.05); }
.agent-name-cell:hover { color: var(--accent-blue); text-decoration: underline; }

.equity-section, .weight-evolution {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

/* ═══════════════════════════════════════
   REGIME PANEL
════════════════════════════════════════ */
.regime-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.regime-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.regime-icon { font-size: 36px; margin-bottom: 8px; }
.regime-label { font-size: 11px; color: var(--text-muted); letter-spacing: 1px; text-transform: uppercase; }
.regime-name { font-size: 22px; font-weight: 700; margin: 6px 0; }
.regime-desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.regime-cohort { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; font-style: italic; }

.regime-select {
  width: 100%;
  padding: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
}

/* ═══════════════════════════════════════
   BACKTEST
════════════════════════════════════════ */
.backtest-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
}

.bt-control { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }

.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.form-group input, .form-group select {
  width: 100%;
  padding: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
}

.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--accent-blue); }

.bt-progress-bar { height: 6px; background: var(--bg-3); border-radius: 3px; overflow: hidden; margin: 8px 0; }
.bt-progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan)); border-radius: 3px; width: 0%; transition: width 0.5s; }

.backtest-summary { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 12px 0 20px; }
.summary-card { background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px; padding: 12px; text-align: center; }
.s-label { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.s-value { font-size: 22px; font-weight: 700; font-family: var(--font-mono); }
.s-value.positive { color: var(--accent-green); }
.s-value.negative { color: var(--accent-red); }

.wbar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.wbar-name { width: 200px; font-size: 12px; color: var(--text-secondary); }
.wbar-track { flex: 1; height: 8px; background: var(--bg-3); border-radius: 4px; overflow: hidden; }
.wbar-fill { height: 100%; border-radius: 4px; transition: width 0.5s; }

/* ═══════════════════════════════════════
   MODAL
════════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg-1);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  width: min(900px, 95vw);
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: var(--shadow);
  position: relative;
}

.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

.modal-close:hover { color: var(--text-primary); }
.modal-agent-header { margin-bottom: 20px; }
.modal-agent-header h2 { font-size: 20px; margin-bottom: 8px; }
.modal-meta { display: flex; gap: 8px; flex-wrap: wrap; }

.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }

.stats-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.stats-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); }
.stats-table td:first-child { color: var(--text-secondary); }

.prompt-history { display: flex; flex-direction: column; gap: 10px; max-height: 300px; overflow-y: auto; }
.prompt-version { background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px; padding: 10px; }
.prompt-version.current { border-color: var(--accent-green); }
.prompt-ver-header { font-size: 11px; font-weight: 600; color: var(--accent-green); margin-bottom: 4px; }
.prompt-reason { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; font-style: italic; }
.prompt-preview { font-size: 11px; color: var(--text-secondary); font-family: var(--font-mono); white-space: pre-wrap; line-height: 1.5; }

.blind-spots-list { list-style: none; }
.blind-spots-list li { padding: 6px 10px; background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.2); border-radius: 4px; margin-bottom: 4px; font-size: 13px; }

.shadow-alert { background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.3); border-radius: 6px; padding: 12px; margin: 12px 0; font-size: 13px; }

.picks-list { display: flex; flex-direction: column; gap: 4px; max-height: 200px; overflow-y: auto; }
.pick-item { display: grid; grid-template-columns: 100px 1fr 80px 80px; gap: 8px; padding: 6px 8px; background: var(--bg-2); border-radius: 4px; font-size: 12px; min-width: 0; }
.pick-item.win { background: rgba(34,197,94,0.08); }
.pick-item.loss { background: rgba(239,68,68,0.08); }

/* ═══════════════════════════════════════
   DEBUG LOG
════════════════════════════════════════ */
.layer-debug { margin-top: 20px; }
.layer-debug details { background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.layer-debug summary { padding: 10px 14px; cursor: pointer; font-size: 13px; color: var(--text-secondary); }
.layer-debug summary:hover { color: var(--text-primary); }
.layer-log { padding: 12px 14px; border-top: 1px solid var(--border); }
.layer-log h4 { font-size: 12px; color: var(--accent-cyan); margin-bottom: 8px; letter-spacing: 1px; text-transform: uppercase; }
.agent-log { background: var(--bg-2); border: 1px solid var(--border); border-radius: 4px; margin-bottom: 8px; overflow: hidden; }
.agent-log.error { border-color: rgba(239,68,68,0.4); }
.agent-log-header { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; background: var(--bg-3); font-size: 12px; }
.agent-log-raw { padding: 10px; font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary); white-space: pre-wrap; max-height: 200px; overflow-y: auto; }
.error-badge { background: rgba(239,68,68,0.15); color: var(--accent-red); padding: 2px 6px; border-radius: 3px; font-size: 10px; }

/* ═══════════════════════════════════════
   SETTINGS
════════════════════════════════════════ */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.settings-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.settings-card h3 { font-size: 14px; font-weight: 600; margin-bottom: 16px; }

.setting-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }
.setting-row:last-child { border-bottom: none; }
.setting-label { font-size: 13px; color: var(--text-secondary); }
.setting-value { font-size: 12px; color: var(--accent-cyan); font-family: var(--font-mono); }

/* ═══════════════════════════════════════
   TOAST
════════════════════════════════════════ */
#toast-container {
  position: fixed;
  bottom: 48px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transform: translateX(20px);
  transition: all 0.25s;
  max-width: 360px;
  box-shadow: var(--shadow);
}

.toast.show { opacity: 1; transform: translateX(0); }
.toast-success { background: rgba(34,197,94,0.15); border: 1px solid rgba(34,197,94,0.4); color: var(--accent-green); }
.toast-error { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.4); color: var(--accent-red); }
.toast-warning { background: rgba(245,158,11,0.15); border: 1px solid rgba(245,158,11,0.4); color: var(--accent-orange); }
.toast-info { background: rgba(59,130,246,0.15); border: 1px solid rgba(59,130,246,0.4); color: var(--accent-blue); }

/* ═══════════════════════════════════════
   LOADING OVERLAY
════════════════════════════════════════ */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-0);
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.loading-spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: var(--text-secondary); font-size: 14px; }

/* ═══════════════════════════════════════
   EMPTY STATE
════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 14px;
  font-style: italic;
}

/* ═══════════════════════════════════════
   SCROLLBAR
════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-0); }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ═══════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════ */
@media (max-width: 900px) {
  .app-shell { grid-template-rows: auto auto 1fr auto; }
  .app-header { padding: 10px 12px; align-items: center; }
  .logo { min-width: 0; }
  .logo-text { font-size: 16px; }
  .header-right { gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
  .provider-select { min-width: 96px; max-width: 128px; font-size: 11px; }
  .user-btn { padding: 6px 10px; }
  .user-btn span:last-child { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tab-nav { padding: 0 12px; }
  .tab-btn { padding: 0 14px; }
  .tab-pane { padding: 16px 12px; }
  .session-panel { grid-template-columns: 1fr; }
  .perf-grid { grid-template-columns: 1fr; }
  .regime-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .modal-grid { grid-template-columns: 1fr; }
  .backtest-layout { grid-template-columns: 1fr; }
  .leaderboard-table { min-width: 620px; }
  .wbar-name { width: 120px; }
  .main-content { min-height: 0; }
  .session-results, .performance-content, #performance-content, .backtest-summary { overflow-x: auto; }
}

/* ═══════════════════════════════════════
   AUTH SCREEN
════════════════════════════════════════ */
#auth-screen {
  position: fixed; inset: 0;
  background: var(--bg-0);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.auth-card {
  background: var(--bg-1);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 32px;
  width: min(420px, 95vw);
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}

.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo-icon { font-size: 40px; margin-bottom: 8px; }
.auth-logo-text { font-size: 28px; font-weight: 800; letter-spacing: 4px; background: linear-gradient(135deg, #3b82f6, #06b6d4); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.auth-logo-sub { font-size: 11px; color: var(--text-muted); letter-spacing: 1px; margin-top: 4px; }

.auth-tabs { display: flex; background: var(--bg-2); border-radius: 8px; padding: 3px; margin-bottom: 20px; }
.auth-tab { flex: 1; padding: 8px; border: none; background: transparent; color: var(--text-secondary); font-size: 13px; font-weight: 500; border-radius: 6px; cursor: pointer; transition: all 0.15s; }
.auth-tab.active { background: var(--bg-3); color: var(--text-primary); }

.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-field label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 5px; }
.auth-field input {
  width: 100%; padding: 10px 12px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text-primary); font-size: 14px;
}
.auth-field input:focus { outline: none; border-color: var(--accent-blue); }

.auth-error { font-size: 12px; color: var(--accent-red); min-height: 18px; }

.auth-submit-btn {
  width: 100%; padding: 12px;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
  border: none; border-radius: 8px; color: white;
  font-size: 15px; font-weight: 600; cursor: pointer; transition: opacity 0.15s;
  margin-top: 4px;
}
.auth-submit-btn:hover { opacity: 0.9; }
.auth-submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.auth-footer { margin-top: 20px; }
.auth-security-note {
  font-size: 11px; color: var(--text-muted); text-align: center;
  background: var(--bg-2); border-radius: 6px; padding: 10px; line-height: 1.6;
}

.link-btn { background: none; border: none; color: var(--accent-blue); cursor: pointer; font-size: 11px; padding: 0; }

.profile-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 6px;
  cursor: pointer; margin-bottom: 4px; transition: border-color 0.15s;
}
.profile-chip:hover { border-color: var(--accent-blue); }
.profile-chip-avatar {
  width: 24px; height: 24px;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: white;
}

/* ═══════════════════════════════════════
   USER BUTTON (header)
════════════════════════════════════════ */
.user-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 20px;
  color: var(--text-primary); font-size: 13px; cursor: pointer; transition: all 0.15s;
}
.user-btn:hover { border-color: var(--accent-blue); }
.user-avatar {
  width: 24px; height: 24px;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: white;
}

/* ═══════════════════════════════════════
   PROFILE MODAL
════════════════════════════════════════ */
.profile-header { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.profile-avatar {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; color: white; flex-shrink: 0;
}
.profile-name { font-size: 18px; font-weight: 700; }
.profile-sub { font-size: 12px; color: var(--text-muted); }
.profile-divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.profile-section { margin-bottom: 8px; }
.profile-section h3 { font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.profile-hint { font-size: 11px; color: var(--text-muted); font-weight: 400; }

.keys-grid { display: flex; flex-direction: column; gap: 12px; }
.key-row { }
.key-row label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 5px; }
.key-input-row { display: flex; gap: 8px; }
.key-input-row input, .key-row input, .key-row textarea { flex: 1; }
.key-row input {
  width: 100%; padding: 8px 10px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text-primary); font-size: 13px;
}
.key-row input:focus { outline: none; border-color: var(--accent-blue); }
.get-key-link { font-size: 11px; color: var(--accent-blue); margin-left: 8px; }
.test-btn { flex-shrink: 0; white-space: nowrap; }
.test-result { font-size: 11px; margin-top: 4px; min-height: 16px; }
.test-result.ok { color: var(--accent-green); }
.test-result.err { color: var(--accent-red); }
.test-result.warn { color: var(--accent-orange); }

.sub-form {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.sub-form input {
  padding: 8px 10px; background: var(--bg-3);
  border: 1px solid var(--border); border-radius: 6px;
  color: var(--text-primary); font-size: 13px; width: 100%;
}

/* ═══════════════════════════════════════
   ERROR BANNER & EMPTY RESULTS
════════════════════════════════════════ */
.error-banner {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--accent-red);
  margin-bottom: 14px;
  line-height: 1.5;
}

.empty-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 24px;
  text-align: center;
}

.how-to-box {
  margin-top: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 16px;
  text-align: left;
  max-width: 560px;
  font-size: 13px;
}

.how-to-box strong { color: var(--text-primary); display: block; margin-bottom: 10px; }
.how-to-box pre {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-cyan);
  white-space: pre-wrap;
  margin-bottom: 10px;
}
.how-to-box p { color: var(--text-secondary); font-size: 12px; margin: 0; }

/* picks count badge */
.picks-count {
  font-size: 13px;
  color: var(--accent-green);
  font-weight: 600;
}

/* ═══════════════════════════════════════
   AUTO-FETCH CARD
════════════════════════════════════════ */
.auto-fetch-card {
  background: linear-gradient(135deg, rgba(6,182,212,0.08), rgba(59,130,246,0.08));
  border: 1px solid rgba(6,182,212,0.3);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}

.auto-fetch-icon { font-size: 24px; margin-bottom: 4px; }
.auto-fetch-title { font-size: 13px; font-weight: 600; color: var(--accent-cyan); margin-bottom: 6px; }
.auto-fetch-sources { font-size: 11px; color: var(--text-muted); line-height: 1.6; }

.odds-key-nudge {
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-orange);
}

/* ═══════════════════════════════════════
   WHAT FETCHES BOX (empty state)
════════════════════════════════════════ */
.what-fetches-box {
  margin-top: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: left;
  max-width: 440px;
}

.wf-row {
  display: flex;
  gap: 10px;
  padding: 5px 0;
  font-size: 12px;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(30,45,74,0.5);
}
.wf-row:last-child { border-bottom: none; }
.wf-row span { line-height: 1.5; }

/* ═══════════════════════════════════════
   FETCH SUMMARY (shown while agents run)
════════════════════════════════════════ */
.fetch-summary {
  background: var(--bg-card);
  border: 1px solid rgba(6,182,212,0.3);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 4px;
}

.fetch-summary-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-cyan);
  margin-bottom: 10px;
}

.fetch-summary-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.source-chip {
  background: rgba(6,182,212,0.1);
  border: 1px solid rgba(6,182,212,0.3);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--accent-cyan);
}

.fetch-raw-details { font-size: 12px; color: var(--text-muted); }
.fetch-raw-details summary { cursor: pointer; margin-bottom: 6px; }
.fetch-raw {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
  white-space: pre-wrap;
  max-height: 180px;
  overflow-y: auto;
}

@media (orientation: landscape) and (max-width: 900px) {
  .app-header { padding: 0 12px; }
  .header-right { justify-content: flex-end; gap: 8px; margin-left: auto; }
  .provider-select { max-width: 140px; }
}

/* ═══════════════════════════════════════
   MOBILE PORTRAIT — comprehensive fix
   Targets phones ≤ 600px wide
════════════════════════════════════════ */
@media (max-width: 600px) {

  /* ── Layout: let content scroll naturally ── */
  .app-shell {
    grid-template-rows: 52px 38px 1fr 0px;
    height: 100dvh;
    overflow: hidden;
  }

  /* main-content must scroll — not clip */
  .main-content {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
  }

  /* tab pane: auto height so it doesn't clip */
  .tab-pane {
    height: auto !important;
    min-height: calc(100dvh - 90px);
    overflow: visible !important;
    padding: 10px 10px 80px 10px;
  }

  /* hide status bar (too cramped) */
  .status-bar-container { display: none; }

  /* ── Header ── */
  .app-header { padding: 0 10px; }
  .logo-sub { display: none; }
  .logo-text { font-size: 15px; letter-spacing: 1px; }
  .header-right .btn-sm { display: none; } /* hide desktop refresh buttons */
  .header-right { gap: 6px; }
  .user-btn { padding: 5px 8px; font-size: 12px; }

  /* ── Tab nav: scroll horizontally, no wrap ── */
  .tab-nav { padding: 0 4px; gap: 0; overflow-x: auto; scrollbar-width: none; }
  .tab-nav::-webkit-scrollbar { display: none; }
  .tab-btn { padding: 0 10px; font-size: 12px; white-space: nowrap; flex-shrink: 0; }

  /* ── Session panel: stack, results first ── */
  .session-panel {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }
  .session-controls { order: 2; }
  .session-results  { order: 1; min-height: 160px; }

  /* ── Picks grid: single column ── */
  .picks-grid { grid-template-columns: 1fr !important; gap: 10px; }
  .pick-card { padding: 12px; }
  .pick-ticker { font-size: 18px; }

  /* ── Agents grid ── */
  .agents-row { grid-template-columns: 1fr 1fr !important; gap: 8px; }
  .agent-card { padding: 10px; }
  .agent-name { font-size: 11px; }

  /* ── Performance: wrap table horizontally ── */
  .perf-grid { grid-template-columns: 1fr !important; }
  .leaderboard-table { font-size: 11px; min-width: unset !important; }
  .leaderboard-table th,
  .leaderboard-table td { padding: 4px 5px; }
  /* Hide less important columns on tiny screens */
  .leaderboard-table th:nth-child(7),
  .leaderboard-table td:nth-child(7),
  .leaderboard-table th:nth-child(8),
  .leaderboard-table td:nth-child(8) { display: none; }

  /* ── Regime panel ── */
  .regime-grid { grid-template-columns: 1fr !important; }

  /* ── Backtest ── */
  .backtest-layout { grid-template-columns: 1fr !important; }

  /* ── Settings ── */
  .settings-grid { grid-template-columns: 1fr !important; }

  /* ── Modals ── */
  .modal { padding: 14px; width: 100vw; max-height: 92dvh; margin: 0; border-radius: 12px 12px 0 0; }
  .modal-overlay { align-items: flex-end; }
  .modal-grid { grid-template-columns: 1fr !important; }

  /* ── Auth screen ── */
  .auth-card { padding: 20px 16px; width: 100vw; border-radius: 12px; }

  /* ── Profile keys ── */
  .keys-grid { gap: 10px; }
  .key-input-row { flex-direction: row; }
  .key-input-row input { font-size: 12px; }

  /* ── Run buttons ── */
  .run-btn { padding: 11px; font-size: 13px; }

  /* ── Prevent any horizontal overflow ── */
  .what-fetches-box { max-width: 100%; }
  .fetch-summary-sources { gap: 4px; }
  .source-chip { font-size: 10px; }
  .how-to-box { max-width: 100%; }
  .how-to-box pre { font-size: 10px; overflow-x: auto; }

  /* ── Layer debug (full width) ── */
  .agent-log-raw { font-size: 10px; }

  /* ── Weight bars ── */
  .wbar-name { width: 90px; font-size: 11px; }
  .wbar-row { gap: 6px; }

  /* ── Summary cards ── */
  .summary-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .s-value { font-size: 18px; }
}

/* ── Tiny screens (≤380px, e.g. SE) ── */
@media (max-width: 380px) {
  .tab-btn { padding: 0 8px; font-size: 11px; }
  .agents-row { grid-template-columns: 1fr !important; }
  .leaderboard-table th:nth-child(n+5),
  .leaderboard-table td:nth-child(n+5) { display: none; }
}

/* ══════════════════════════════════════════════════
   IMPROVED PICK CARDS — Sports & Trading v2
   ══════════════════════════════════════════════════ */

/* ── Sports pick card ── */
.sports-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.sport-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-primary);
}
.event-datetime {
  font-size: 11px;
  color: var(--accent-cyan);
  font-weight: 600;
  white-space: nowrap;
}
.pick-game-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1.3;
}
.bet-meta-row {
  margin-bottom: 8px;
}
.bet-type-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}
.pick-selection {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 12px;
  padding: 8px 10px;
  background: var(--bg-3);
  border-left: 3px solid var(--accent-cyan);
  border-radius: 4px;
}
.odds-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 10px;
}
.odds-main {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.odds-number {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1;
}
.odds-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.odds-secondary {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.implied-prob-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.units-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(234, 179, 8, 0.12);
  color: #facc15;
  border: 1px solid rgba(234, 179, 8, 0.25);
}
.sports-covered {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}
.agents-agree {
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 8px;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: 4px;
  margin-top: 6px;
  margin-bottom: 6px;
}

/* ── Confidence bar (shared trading + sports) ── */
.conf-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
}
.conf-label {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  width: 70px;
  flex-shrink: 0;
}
.conf-bar-wrap {
  flex: 1;
  height: 6px;
  background: var(--bg-3);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.conf-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}
.conf-val {
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  width: 40px;
  text-align: right;
}

/* ── Improved trading pick card ── */
.pick-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.pick-action-badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
}
.pick-action-badge.buy   { background: rgba(34,197,94,.15); color:#22c55e; border:1px solid rgba(34,197,94,.3); }
.pick-action-badge.sell  { background: rgba(239,68,68,.15); color:#ef4444; border:1px solid rgba(239,68,68,.3); }
.pick-action-badge.hold  { background: rgba(234,179,8,.15); color:#facc15; border:1px solid rgba(234,179,8,.3); }
.pick-levels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
}
.level-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 8px;
  background: var(--bg-3);
  border-radius: 6px;
  border: 1px solid var(--border);
}
.level-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.target-val { color: #22c55e; }
.stop-val   { color: #ef4444; }
.agent-source {
  font-size: 11px;
  color: var(--text-muted);
  padding-top: 4px;
}

/* sport-specific left border colors */
.sport-nfl  { border-left: 3px solid #22c55e; }
.sport-nba  { border-left: 3px solid #3b82f6; }
.sport-mlb  { border-left: 3px solid #ef4444; }
.sport-nhl  { border-left: 3px solid #06b6d4; }
.sport-mma  { border-left: 3px solid #f59e0b; }

/* ── Apps Script settings row ── */
.apps-script-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 12px;
}
.apps-script-row input {
  flex: 1;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  color: var(--text-primary);
  font-size: 12px;
}

/* ══════════════════════════════════════════════════
   SAGE2 — Agent Table, Consensus, Status Bar
   ══════════════════════════════════════════════════ */

/* Agent domain section */
.agent-domain-section { margin-bottom: 28px; }
.domain-label { font-size: 14px; font-weight: 700; margin: 0 0 12px; color: var(--text-primary); }
.agent-table-wrap { overflow-x: auto; border-radius: 8px; border: 1px solid var(--border); }
.agent-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
}
.agent-table thead th {
  padding: 9px 12px; text-align: left;
  background: var(--bg-3); color: var(--text-muted);
  font-weight: 600; font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.05em; white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.agent-table tbody tr.agent-row {
  cursor: pointer; transition: background 0.15s;
  border-bottom: 1px solid var(--border);
}
.agent-table tbody tr.agent-row:hover { background: var(--bg-3); }
.agent-table tbody td { padding: 9px 12px; color: var(--text-secondary); vertical-align: middle; }
.agent-name-cell { display: flex; align-items: center; gap: 6px; }
.agent-name-text { font-weight: 600; color: var(--text-primary); font-size: 12px; }
.badge-mini { font-size: 10px; }
.badge-mini.warn { color: #f59e0b; }
.layer-badge {
  display: inline-block; padding: 1px 7px; border-radius: 3px;
  font-size: 10px; font-weight: 600; letter-spacing: 0.03em;
  background: var(--bg-1); border: 1px solid var(--border);
  color: var(--text-muted); white-space: nowrap;
}
.weight-cell { display: flex; align-items: center; gap: 8px; }
.weight-bar-mini {
  flex: 1; height: 5px; background: var(--bg-1);
  border-radius: 3px; overflow: hidden; min-width: 40px;
}
.weight-bar-mini > div { height: 100%; border-radius: 3px; }

/* Agents header */
.agents-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.agents-header h2 { margin: 0; font-size: 18px; }
.agent-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Consensus status item */
.status-item.ok { color: #22c55e; }
.status-item.warn { color: #f59e0b; }
.status-item[onclick] { cursor: pointer; }
.status-item[onclick]:hover { opacity: 0.8; }

/* How-to instruction box for empty sports results */
.how-to-box {
  margin-top: 16px; padding: 12px 16px;
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 8px; text-align: left; max-width: 560px;
  font-size: 12px; color: var(--text-secondary);
}
.how-to-box pre {
  margin: 8px 0 0; padding: 10px; background: var(--bg-1);
  border-radius: 6px; font-size: 11px; white-space: pre-wrap;
  color: var(--accent-cyan); overflow-x: auto;
}


/* ───────────────────────────────────────
   MOBILE TWEAKS
──────────────────────────────────────── */
@media (max-width: 900px) {
  .app-header { padding: 0 14px; }
  .tab-nav { padding: 0 12px; }
  .tab-pane { padding: 14px 12px; }
  .agents-header, .agent-header-actions, .perf-grid { gap: 10px; }
  .agents-header { align-items: flex-start; }
  .agent-header-actions { flex-wrap: wrap; }
  .agent-header-actions .btn-sm,
  .agent-header-actions .btn-primary { width: 100%; }
  .perf-grid { display: grid; grid-template-columns: 1fr; }
  .session-panel { grid-template-columns: 1fr; }
  .session-controls { order: 1; }
  .session-results { order: 2; }
}

@media (max-width: 700px) {
  .logo-text { font-size: 16px; }
  .header-right { gap: 6px; }
  .provider-select { min-width: 88px; max-width: 120px; font-size: 11px; }
  .user-btn { padding: 6px 8px; font-size: 12px; }
  .tab-btn { padding: 0 8px; font-size: 11px; }
  .agent-table, .leaderboard-table { min-width: 820px; }
  .agent-table thead th, .leaderboard-table thead th { font-size: 11px; padding: 8px 6px; }
  .agent-table tbody td, .leaderboard-table tbody td { padding: 8px 6px; font-size: 12px; }
  .agents-header h2, .perf-section h3, .equity-section h3, .weight-evolution h3 { font-size: 16px; }
}


.hyper-toggle-btn {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.35);
  background: linear-gradient(180deg, rgba(17,24,39,0.95), rgba(2,6,23,0.98));
  color: #e2e8f0;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 30px rgba(0,0,0,0.24);
  transition: transform .18s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease, color .2s ease;
}
.hyper-toggle-btn:hover { transform: translateY(-1px); }
.hyper-toggle-btn.hyper-on {
  position: relative;
  border-color: rgba(255, 180, 70, 0.95);
  color: #fff7e0;
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,0.28), transparent 20%),
    radial-gradient(circle at 50% 0%, rgba(255,255,255,0.18), transparent 30%),
    linear-gradient(180deg, #ffd36a 0%, #ff8a00 30%, #ff4d00 60%, #7a1200 100%);
  box-shadow:
    0 0 12px rgba(255, 196, 73, 0.75),
    0 0 24px rgba(255, 111, 0, 0.62),
    0 0 54px rgba(255, 47, 0, 0.45),
    inset 0 2px 10px rgba(255,255,255,0.34),
    inset 0 -8px 16px rgba(72, 7, 0, 0.45);
  animation: hyperFire 0.9s ease-in-out infinite;
}
@keyframes hyperFire {
  0%, 100% { transform: translateY(0) scale(1); filter: saturate(1.1) brightness(1.05); }
  50% { transform: translateY(-1px) scale(1.02); filter: saturate(1.45) brightness(1.18); }
}
.agents-agree.agree-strong {
  border-color: rgba(250, 204, 21, 0.5);
  background: rgba(250, 204, 21, 0.08);
  box-shadow: inset 0 0 0 1px rgba(250, 204, 21, 0.12);
}
