/*
 * ============================================================
 * SPYQINEX MOBILE DARK THEME OVERHAUL v3.0
 * © 2026 Vriksham LLC
 * Replaces the peach/light theme with the dark trading UI
 * that matches the mockup design exactly.
 * ============================================================
 */

/* ─── FONTS ──────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600;700&family=DM+Sans:wght@400;500;600;700&display=swap');

/* ─── DESIGN TOKENS ──────────────────────────────────────── */
:root {
  --bg: #0d0f14;
  --surface: #161a23;
  --surface2: #1e2330;
  --surface3: #252b3b;
  --border: #2a3044;
  --border-light: #353d55;
  --accent: #f0a500;
  --accent-dim: rgba(240, 165, 0, 0.15);
  --green: #00d97e;
  --green-dim: rgba(0, 217, 126, 0.12);
  --red: #ff4757;
  --red-dim: rgba(255, 71, 87, 0.15);
  --blue: #4dabff;
  --text: #e8eaf0;
  --muted: #6b7394;
  --muted2: #8891b0;
  --nav-h: 62px;
  --top-h: 44px;
  --status-h: 40px;
  --ctrl-h: 46px;
  --sel-h: 42px;
  --r: 10px;
  --r-sm: 6px;
}

/* ─── ONLY APPLY ON MOBILE ───────────────────────────────── */
@media (max-width: 1280px) {

  /* ══════════════════════════════════════════════════════════
   1. GLOBAL DARK THEME
   ══════════════════════════════════════════════════════════ */
  html,
  body {
    background: var(--bg) !important;
    color: var(--text) !important;
    font-family: 'DM Sans', sans-serif !important;
    margin: 0 !important;
    padding: 0 !important;
    padding-bottom: calc(var(--nav-h) + 8px) !important;
    overflow-x: hidden !important;
    -webkit-tap-highlight-color: transparent !important;
  }

  /* Remove the peach watermark pseudo-element */
  body::before {
    display: none !important;
  }

  .container {
    background: var(--bg) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: visible !important;
    padding-top: 92px !important;
  }

  /* ══════════════════════════════════════════════════════════
   2. TOP TICKER BAR — Compact, dark, sticky
   ══════════════════════════════════════════════════════════ */
  .live-ticker-bar {
    position: fixed !important;
    top: 48px !important;
    z-index: 1001 !important;
    left: 0 !important;
    width: 100% !important;
    background: var(--surface) !important;
    border-bottom: 1px solid var(--border) !important;
    padding: 0 12px !important;
    height: var(--top-h) !important;
    display: flex !important;
    align-items: center !important;
    gap: 0 !important;
    flex-wrap: nowrap !important;
    overflow: hidden !important;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.6) !important;
    color: var(--text) !important;
  }

  /* Logo text — inject via CSS so it appears without HTML change */
  .live-ticker-bar::before {
    content: 'SPYQINEX';
    font-family: 'DM Sans', sans-serif;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 2px;
    color: var(--accent);
    flex-shrink: 0;
    margin-right: 10px;
  }

  /* Hide date */
  .live-ticker-bar #liveTickerDate {
    display: none !important;
  }

  /* Time */
  .live-ticker-bar>span:first-child {
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 9px !important;
    color: var(--muted) !important;
    flex-shrink: 0;
    margin-right: 6px;
  }

  /* SPX / NDX */
  .live-ticker-bar>span:nth-child(2),
  .live-ticker-bar>span:nth-child(3) {
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 10px !important;
    color: var(--muted2) !important;
    margin-right: 8px;
    flex-shrink: 0;
    white-space: nowrap;
  }

  .live-ticker-bar>span:nth-child(2) strong,
  .live-ticker-bar>span:nth-child(3) strong {
    color: var(--green) !important;
    font-size: 11px !important;
    font-weight: 700 !important;
  }

  /* Right side */
  .live-ticker-bar>div:last-child {
    flex: 1 !important;
    justify-content: flex-end !important;
    gap: 8px !important;
    display: flex !important;
    align-items: center !important;
  }

  /* Mute button */
  #muteBtn {
    background: var(--surface2) !important;
    border: 1px solid var(--border) !important;
    color: var(--muted) !important;
    padding: 3px 6px !important;
    font-size: 9px !important;
    border-radius: 4px !important;
  }

  #muteBtn span {
    display: none !important;
  }

  /* Streaming pill */
  #topStreamingBar {
    width: 24px !important;
    height: 6px !important;
    border-radius: 3px !important;
  }

  #topStreamingText {
    font-size: 9px !important;
    min-width: 36px !important;
  }

  #streamingStatusLabel {
    font-size: 9px !important;
    color: var(--muted) !important;
  }

  /* Hide icon buttons in top bar on mobile */
  .live-ticker-bar>div:last-child>div:last-child {
    display: none !important;
  }

  /* ══════════════════════════════════════════════════════════
   3. AUTH / ALERT WARNING BANNERS
   ══════════════════════════════════════════════════════════ */
  #authWarningBar {
    background: var(--red-dim) !important;
    border-bottom: 1px solid var(--red) !important;
    color: var(--red) !important;
    font-size: 10px !important;
    padding: 6px 10px !important;
  }

  #alertHeader {
    background: var(--red) !important;
    color: #fff !important;
    font-size: 11px !important;
    padding: 7px 10px !important;
    position: sticky !important;
    top: var(--top-h) !important;
    z-index: 999 !important;
  }

  /* ══════════════════════════════════════════════════════════
   4. HEADER — Status strip (dark version of the mockup)
   ══════════════════════════════════════════════════════════ */
  .header {
    background: var(--surface) !important;
    border-bottom: 1px solid var(--border) !important;
    padding: 0 !important;
    flex-direction: column !important;
    gap: 0 !important;
    position: sticky !important;
    top: var(--top-h) !important;
    z-index: 99 !important;
  }

  /* Hide logo + tagline */
  .header-content {
    display: none !important;
  }

  .header-actions {
    flex-direction: column !important;
    width: 100% !important;
    gap: 0 !important;
    padding: 0 !important;
  }

  /* ── Status row: API stats + mode badge ── */
  .header-status-panel {
    flex-direction: row !important;
    align-items: center !important;
    height: var(--status-h) !important;
    padding: 0 10px !important;
    gap: 6px !important;
    background: var(--surface) !important;
    border-radius: 0 !important;
    border: none !important;
    border-bottom: 1px solid var(--border) !important;
    flex: unset !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Bot running dot + text */
  .header-status-indicator {
    flex-shrink: 0;
    gap: 5px !important;
    min-width: 0 !important;
  }

  .status-indicator {
    width: 8px !important;
    height: 8px !important;
    border-radius: 50% !important;
  }

  .status-indicator.running {
    background: var(--green) !important;
    box-shadow: 0 0 6px var(--green) !important;
  }

  #statusText {
    font-size: 10px !important;
    color: var(--muted2) !important;
    white-space: nowrap;
  }

  /* Stat chips */
  .header-stat-group {
    display: flex !important;
    gap: 5px !important;
    padding: 0 !important;
    border: none !important;
    flex: 1 !important;
    overflow: hidden !important;
  }

  .header-stat-item {
    background: var(--surface2) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--r-sm) !important;
    padding: 2px 6px !important;
    min-width: 0 !important;
    flex: 1 !important;
    align-items: center !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .header-stat-label {
    font-size: 7px !important;
    color: var(--muted) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    text-align: center;
  }

  .header-stat-value {
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    color: var(--text) !important;
  }

  #streamingStatus {
    color: var(--green) !important;
  }

  #paperWalletGroup {
    display: none !important;
  }

  /* Bot controls */
  .header-bot-controls {
    display: flex !important;
    gap: 4px !important;
    flex-shrink: 0 !important;
  }

  .header-btn {
    height: 26px !important;
    padding: 0 8px !important;
    font-size: 9px !important;
    font-weight: 700 !important;
    border-radius: var(--r-sm) !important;
    border: none !important;
    white-space: nowrap;
    letter-spacing: 0.5px;
  }

  .header-btn-start {
    background: var(--green) !important;
    color: #000 !important;
    box-shadow: 0 0 10px rgba(0, 217, 126, 0.3) !important;
  }

  .header-btn-stop {
    background: var(--red-dim) !important;
    color: var(--red) !important;
    border: 1px solid rgba(255, 71, 87, 0.4) !important;
  }

  /* ── Action row: START / STOP / E-STOP ── */
  .trading-mode-panel {
    display: none !important;
    /* merged into action row below */
  }

  .emergency-stop {
    display: none !important;
    /* merged into action row below */
  }

  /* Inject a virtual action row after header using a wrapper trick */
  /* We repurpose the header-actions to hold our action strip */
  .header-actions::after {
    content: '';
    display: block;
    height: 0;
  }

  /* ── Trading mode + E-stop combined pill row ── */
  /* We show trading mode as a badge next to the stat chips */
  #paperStatusText {
    font-size: 9px !important;
    font-weight: 700 !important;
    padding: 2px 7px !important;
    border-radius: 20px !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    letter-spacing: 0.5px !important;
  }

  /* Live mode styling */
  .header-status-panel #paperStatusText[style*="dc3545"],
  .header-status-panel #paperStatusText {
    background: var(--red-dim) !important;
    color: var(--red) !important;
    border: 1px solid rgba(255, 71, 87, 0.4) !important;
  }

  /* ══════════════════════════════════════════════════════════
   5. CONTROL ROW — START / STOP / E-STOP (3-button strip)
   Uses the trading-mode-panel + emergency-stop as a row
   ══════════════════════════════════════════════════════════ */
  /* Re-show and restyle the trading mode panel as a control row */
  .trading-mode-panel {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: stretch !important;
    padding: 6px 10px !important;
    gap: 8px !important;
    background: var(--surface) !important;
    border-radius: 0 !important;
    border: none !important;
    border-bottom: 1px solid var(--border) !important;
    width: 100% !important;
    box-sizing: border-box !important;
    height: var(--ctrl-h) !important;
  }

  /* START button via trading mode panel repurpose */
  .mode-label {
    display: none !important;
  }

  .mode-status {
    font-size: 10px !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    color: var(--red) !important;
  }

  /* The toggle stays */
  .switch {
    transform: scale(0.85) !important;
    flex-shrink: 0;
  }

  .slider {
    background: var(--border) !important;
  }

  input:checked+.slider {
    background: var(--green) !important;
  }

  /* Re-show emergency stop as the 3rd button in the strip */
  .emergency-stop {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 1 !important;
    height: 34px !important;
    border-radius: var(--r-sm) !important;
    background: var(--red) !important;
    color: #fff !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    letter-spacing: 0.5px !important;
    box-shadow: 0 0 12px rgba(255, 71, 87, 0.25) !important;
  }

  /* ══════════════════════════════════════════════════════════
   6. MOBILE TAB SELECTOR — styled like the mockup
   ══════════════════════════════════════════════════════════ */
  .mobile-tab-selector {
    display: block !important;
    position: sticky !important;
    top: calc(var(--top-h) + var(--status-h) + var(--ctrl-h)) !important;
    z-index: 98 !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 14px !important;
    height: var(--sel-h) !important;
    font-family: 'DM Sans', sans-serif !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    color: var(--text) !important;
    background-color: var(--surface2) !important;
    border: none !important;
    border-bottom: 2px solid var(--accent) !important;
    border-radius: 0 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg' width%3D'292' height%3D'292'%3E%3Cpath fill%3D'%23f0a500' d%3D'M287 69a18 18 0 00-13-5H18a18 18 0 00-13 18 18 0 006 13l128 128a18 18 0 0025 0L287 95a18 18 0 000-26z'%2F%3E%3C%2Fsvg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    background-size: 10px !important;
    cursor: pointer !important;
    box-sizing: border-box !important;
    letter-spacing: 0.5px !important;
  }

  .mobile-tab-selector option {
    background: var(--surface2) !important;
    color: var(--text) !important;
  }

  /* ══════════════════════════════════════════════════════════
   7. TAB CONTENT AREAS
   ══════════════════════════════════════════════════════════ */
  .tab-content {
    background: var(--bg) !important;
    padding: 10px !important;
    color: var(--text) !important;
    animation: sqxFade 0.2s ease !important;
  }

  @keyframes sqxFade {
    from {
      opacity: 0;
      transform: translateY(5px);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* Section headers */
  .dashboard-section-header {
    color: var(--text) !important;
    font-size: 14px !important;
    border-bottom: 1px solid var(--border) !important;
    padding-bottom: 8px !important;
    margin-bottom: 12px !important;
  }

  .dashboard-section-header i {
    color: var(--accent) !important;
  }

  .dashboard-section-header small {
    color: var(--muted) !important;
    font-size: 10px !important;
  }

  /* ══════════════════════════════════════════════════════════
   8. CARDS / TICKER SECTIONS
   ══════════════════════════════════════════════════════════ */
  .ticker-section,
  .spread-card,
  .monitor-card,
  .settings-section,
  .profile-section,
  .perf-section,
  .positions-container,
  .stat-card {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--r) !important;
    color: var(--text) !important;
  }

  .ticker-section:hover {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 1px var(--accent-dim) !important;
  }

  .ticker-section.disabled {
    background: var(--surface2) !important;
    opacity: 0.55 !important;
    filter: none !important;
  }

  .ticker-section.top-tier {
    background: var(--surface) !important;
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 1px var(--accent-dim) !important;
  }

  .ticker-title {
    color: var(--accent) !important;
  }

  .ticker-badge {
    font-size: 9px !important;
    padding: 2px 7px !important;
    border-radius: 20px !important;
  }

  .ticker-description {
    background: rgba(240, 165, 0, 0.08) !important;
    border-left-color: var(--accent) !important;
    color: var(--muted2) !important;
    font-size: 10px !important;
  }

  .ticker-section h3,
  .ticker-section h4 {
    color: var(--text) !important;
  }

  /* Trading grid */
  .trading-grid,
  #tradingGrid,
  #spreadsGrid,
  .spreads-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
  }

  /* Butterflies 2-col */
  #butterflies .spreads-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }

  #butterflies .ticker-section {
    padding: 10px !important;
  }

  #butterflies .ticker-title {
    font-size: 11px !important;
  }

  /* ══════════════════════════════════════════════════════════
   9. ALERTS TAB — Matching the mockup exactly
   ══════════════════════════════════════════════════════════ */
  /* Filter chips row */
  #alerts>div>div:nth-child(2) {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 5px !important;
    margin-bottom: 10px !important;
    align-items: center !important;
  }

  #alertsTickerFilter {
    height: 28px !important;
    padding: 0 8px !important;
    font-size: 11px !important;
    background: var(--surface2) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    border-radius: 20px !important;
    appearance: none !important;
  }

  /* Auto-refresh indicator */
  #alerts>div>div:nth-child(2)>div:last-child {
    margin-left: auto;
    font-size: 10px !important;
    color: var(--green) !important;
  }

  /* The table itself */
  #alertsTabTable {
    width: 100% !important;
    font-size: 11px !important;
    table-layout: fixed !important;
    border-collapse: collapse !important;
    font-family: 'JetBrains Mono', monospace !important;
  }

  /* Column widths — match the mockup's tight layout */
  #alertsTabTable col:nth-child(1),
  #alertsTabTable th:nth-child(1),
  #alertsTabTable td:nth-child(1) {
    width: 44px !important;
  }

  #alertsTabTable col:nth-child(2),
  #alertsTabTable th:nth-child(2),
  #alertsTabTable td:nth-child(2) {
    width: 34px !important;
  }

  #alertsTabTable col:nth-child(3),
  #alertsTabTable th:nth-child(3),
  #alertsTabTable td:nth-child(3) {
    width: 42px !important;
  }

  #alertsTabTable col:nth-child(4),
  #alertsTabTable th:nth-child(4),
  #alertsTabTable td:nth-child(4) {
    width: 56px !important;
  }

  #alertsTabTable col:nth-child(5),
  #alertsTabTable th:nth-child(5),
  #alertsTabTable td:nth-child(5) {
    width: auto !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  /* Header row */
  #alertsTabTable thead tr {
    border-bottom: 1px solid var(--border) !important;
  }

  #alertsTabTable th {
    padding: 5px 4px !important;
    font-size: 9px !important;
    color: var(--muted) !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    font-weight: 600 !important;
    background: var(--bg) !important;
    position: sticky !important;
    top: calc(var(--top-h) + var(--status-h) + var(--ctrl-h) + var(--sel-h)) !important;
    z-index: 5 !important;
  }

  /* Data rows */
  #alertsTabTable td {
    padding: 6px 4px !important;
    font-size: 11px !important;
    border-bottom: 1px solid rgba(42, 48, 68, 0.6) !important;
    color: var(--text) !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  /* Bullish rows */
  #alertsTabTable tr[style*="rgba(34,197,94"],
  #alertsTabTable tr[style*="rgba(63,185,80"] {
    background: rgba(0, 217, 126, 0.04) !important;
    border-left: 2px solid var(--green) !important;
  }

  /* Bearish rows */
  #alertsTabTable tr[style*="rgba(239,68,68"],
  #alertsTabTable tr[style*="rgba(248,81,73"] {
    background: rgba(255, 71, 87, 0.04) !important;
    border-left: 2px solid var(--red) !important;
  }

  /* Direction text colors */
  #alertsTabTable td:nth-child(3) span[style*="0a6b2e"],
  #alertsTabTable td:nth-child(3) span[style*="28a745"] {
    color: var(--green) !important;
  }

  #alertsTabTable td:nth-child(3) span[style*="b91c1c"],
  #alertsTabTable td:nth-child(3) span[style*="dc3545"] {
    color: var(--red) !important;
  }

  /* Price column */
  #alertsTabTable td:nth-child(4) {
    color: var(--text) !important;
  }

  /* Details column */
  #alertsTabTable td:nth-child(5) {
    color: var(--muted2) !important;
    font-size: 10px !important;
  }

  /* ══════════════════════════════════════════════════════════
   10. STATUS BAR (generic, inside tab contents)
   ══════════════════════════════════════════════════════════ */
  .status-bar {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--r) !important;
    color: var(--text) !important;
    padding: 10px !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
  }

  .bot-status {
    color: var(--text) !important;
  }

  .stat-label {
    color: var(--muted) !important;
  }

  .stat-value {
    color: var(--text) !important;
  }

  /* ══════════════════════════════════════════════════════════
   11. BUTTONS
   ══════════════════════════════════════════════════════════ */
  .btn-success,
  .call-btn {
    background: var(--green) !important;
    color: #000 !important;
    border: none !important;
    border-radius: var(--r-sm) !important;
    font-weight: 700 !important;
  }

  .btn-danger,
  .put-btn {
    background: var(--red-dim) !important;
    color: var(--red) !important;
    border: 1px solid rgba(255, 71, 87, 0.4) !important;
    border-radius: var(--r-sm) !important;
    font-weight: 700 !important;
  }

  .btn-primary {
    background: var(--blue) !important;
    color: #000 !important;
    border: none !important;
    border-radius: var(--r-sm) !important;
  }

  .action-btn {
    border-radius: var(--r-sm) !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    padding: 9px 12px !important;
  }

  .action-btn[style*="2a5298"] {
    background: rgba(77, 171, 255, 0.15) !important;
    color: var(--blue) !important;
    border: 1px solid rgba(77, 171, 255, 0.3) !important;
  }

  .action-btn[style*="28a745"],
  .action-btn.call-btn {
    background: var(--green) !important;
    color: #000 !important;
  }

  .action-btn[style*="dc3545"],
  .action-btn.put-btn {
    background: var(--red-dim) !important;
    color: var(--red) !important;
    border: 1px solid rgba(255, 71, 87, 0.3) !important;
  }

  .action-btn[style*="6c757d"] {
    background: var(--surface2) !important;
    color: var(--muted2) !important;
    border: 1px solid var(--border) !important;
  }

  /* ORB call/put buttons */
  .action-btn.call-btn[style*="height: 60px"],
  .action-btn.put-btn[style*="height: 60px"] {
    height: 52px !important;
    font-size: 13px !important;
  }

  /* ══════════════════════════════════════════════════════════
   12. FORMS & INPUTS
   ══════════════════════════════════════════════════════════ */
  .form-group input,
  .form-group select,
  .input-row input,
  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="password"],
  input[type="date"],
  input[type="time"],
  input[type="tel"],
  select {
    background: var(--surface2) !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
    border-radius: var(--r-sm) !important;
    font-family: 'DM Sans', sans-serif !important;
  }

  input::placeholder {
    color: var(--muted) !important;
  }

  input:focus,
  select:focus {
    border-color: var(--accent) !important;
    outline: none !important;
    box-shadow: 0 0 0 2px var(--accent-dim) !important;
  }

  .form-group label {
    color: var(--muted2) !important;
    font-size: 11px !important;
  }

  .form-help {
    color: var(--muted) !important;
    font-size: 10px !important;
  }

  /* Settings sections */
  .settings-section {
    padding: 12px !important;
    margin-bottom: 12px !important;
  }

  .settings-section h3 {
    color: var(--accent) !important;
    font-size: 13px !important;
    border-bottom: 1px solid var(--border) !important;
  }

  /* ══════════════════════════════════════════════════════════
   13. TABLES
   ══════════════════════════════════════════════════════════ */
  table {
    border-collapse: collapse !important;
  }

  th {
    background: var(--surface2) !important;
    color: var(--muted) !important;
    font-size: 10px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    border-bottom: 1px solid var(--border) !important;
  }

  td {
    color: var(--text) !important;
    border-bottom: 1px solid rgba(42, 48, 68, 0.5) !important;
    font-size: 11px !important;
  }

  tr:hover td {
    background: rgba(255, 255, 255, 0.02) !important;
  }

  /* ══════════════════════════════════════════════════════════
   14. PERFORMANCE TAB
   ══════════════════════════════════════════════════════════ */
  .perf-header {
    background: linear-gradient(135deg, var(--surface2), var(--surface)) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--r) !important;
    color: var(--text) !important;
  }

  .perf-subtitle {
    color: var(--muted2) !important;
  }

  .perf-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }

  .perf-card {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--r) !important;
    padding: 12px !important;
  }

  .perf-card.positive {
    border-left-color: var(--green) !important;
  }

  .perf-card.negative {
    border-left-color: var(--red) !important;
  }

  .perf-card-title {
    color: var(--muted) !important;
    font-size: 10px !important;
  }

  .perf-card-value {
    color: var(--text) !important;
    font-size: 1.4em !important;
  }

  .perf-card-subtitle {
    color: var(--muted) !important;
    font-size: 10px !important;
  }

  .perf-metric-item {
    background: var(--surface2) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--r-sm) !important;
  }

  .perf-metric-label {
    color: var(--muted) !important;
  }

  .perf-metric-value {
    color: var(--text) !important;
  }

  .perf-profit {
    color: var(--green) !important;
  }

  .perf-loss {
    color: var(--red) !important;
  }

  .perf-section {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--r) !important;
    margin-bottom: 12px !important;
    padding: 14px !important;
  }

  .perf-section h3 {
    color: var(--accent) !important;
    font-size: 13px !important;
  }

  .perf-filter-bar {
    background: var(--surface2) !important;
    border-radius: var(--r-sm) !important;
    flex-direction: column !important;
    gap: 8px !important;
    padding: 10px !important;
  }

  .perf-filter-group label {
    color: var(--muted) !important;
    font-size: 10px !important;
  }

  .perf-metrics-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }

  /* ══════════════════════════════════════════════════════════
   15. CHART TAB
   ══════════════════════════════════════════════════════════ */
  .chart-main-container {
    flex-direction: column !important;
    height: auto !important;
    min-height: auto !important;
    background: var(--surface) !important;
    border-radius: var(--r) !important;
    overflow: hidden !important;
  }

  .chart-left-section {
    min-height: 300px !important;
  }

  .chart-toolbar {
    background: var(--surface2) !important;
    border-bottom: 1px solid var(--border) !important;
    flex-wrap: wrap !important;
    padding: 8px !important;
    gap: 6px !important;
  }

  .chart-symbol {
    color: var(--text) !important;
    font-size: 14px !important;
  }

  .chart-price {
    font-size: 18px !important;
  }

  .chart-tf-btn {
    background: var(--surface3) !important;
    border-color: var(--border-light) !important;
    color: var(--muted2) !important;
    padding: 4px 8px !important;
    font-size: 10px !important;
  }

  .chart-tf-btn.active {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: #000 !important;
  }

  .chart-indicators-sidebar {
    width: 100% !important;
    background: var(--surface2) !important;
    border-top: 1px solid var(--border) !important;
    border-left: none !important;
    max-height: 320px !important;
    overflow-y: auto !important;
    padding: 12px !important;
  }

  .indicator-panel-title {
    color: var(--muted2) !important;
    font-size: 11px !important;
  }

  .indicator-table,
  .key-matrix {
    background: var(--surface3) !important;
    border-radius: var(--r-sm) !important;
  }

  .indicator-row,
  .matrix-row {
    border-bottom-color: var(--border) !important;
    padding: 7px 10px !important;
  }

  .indicator-label,
  .matrix-label {
    color: var(--muted2) !important;
    font-size: 11px !important;
  }

  .indicator-value {
    color: var(--text) !important;
    font-size: 11px !important;
  }

  .indicator-value.bullish {
    color: var(--green) !important;
  }

  .indicator-value.bearish {
    color: var(--red) !important;
  }

  .matrix-value.green {
    background: var(--green-dim) !important;
    color: var(--green) !important;
  }

  .matrix-value.red {
    background: var(--red-dim) !important;
    color: var(--red) !important;
  }

  .camarilla-item {
    background: var(--surface3) !important;
  }

  .camarilla-label {
    color: var(--muted) !important;
  }

  .camarilla-value {
    color: var(--green) !important;
  }

  /* ══════════════════════════════════════════════════════════
   16. POSITIONS TAB
   ══════════════════════════════════════════════════════════ */
  .positions-container {
    background: var(--bg) !important;
    border: none !important;
  }

  .positions-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin-bottom: 14px !important;
  }

  .positions-actions .action-btn {
    font-size: 10px !important;
    padding: 8px 6px !important;
    text-align: center !important;
    justify-content: center !important;
  }

  .position-card {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-left: 3px solid var(--green) !important;
    border-radius: var(--r-sm) !important;
  }

  .position-symbol {
    color: var(--text) !important;
  }

  .detail-label {
    color: var(--muted) !important;
  }

  .detail-value {
    color: var(--text) !important;
  }

  /* ══════════════════════════════════════════════════════════
   17. GAMMA TAB
   ══════════════════════════════════════════════════════════ */
  #gamma .status-bar {
    flex-direction: column !important;
    gap: 8px !important;
    align-items: stretch !important;
  }

  #gamma .status-bar>div {
    width: 100% !important;
    justify-content: space-between !important;
  }

  #gammaKeyLevels {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 6px !important;
  }

  #gammaKeyLevels>div {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--r-sm) !important;
    padding: 6px 4px !important;
  }

  #gammaKeyLevels>div>div:first-child {
    font-size: 8px !important;
  }

  #gammaKeyLevels>div>div:last-child {
    font-size: 12px !important;
    color: var(--text) !important;
  }

  #gammaChartContainer {
    background: var(--surface) !important;
    border-radius: var(--r) !important;
    border: 1px solid var(--border) !important;
  }

  #loadingGamma {
    color: var(--muted) !important;
  }

  #gammaNegStat {
    background: var(--red-dim) !important;
    border-color: rgba(255, 71, 87, 0.3) !important;
  }

  #gammaNegStat>div {
    color: var(--red) !important;
  }

  #valGammaNeg {
    color: var(--red) !important;
  }

  #gammaPosStat {
    background: var(--green-dim) !important;
    border-color: rgba(0, 217, 126, 0.3) !important;
  }

  #gammaPosStat>div {
    color: var(--green) !important;
  }

  #valGammaPos {
    color: var(--green) !important;
  }

  #gammaNetStat {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
  }

  #gammaTicker {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
    border-radius: var(--r-sm) !important;
  }

  /* ══════════════════════════════════════════════════════════
   18. LOGS TAB
   ══════════════════════════════════════════════════════════ */
  .logs-container {
    background: #0a0c12 !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--r) !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 10px !important;
    color: #c9d1d9 !important;
    padding: 10px !important;
    min-height: 280px !important;
    max-height: 65vh !important;
  }

  .log-entry {
    border-bottom-color: var(--border) !important;
    color: #c9d1d9 !important;
  }

  /* ══════════════════════════════════════════════════════════
   19. HISTORY TAB
   ══════════════════════════════════════════════════════════ */
  #history .table-responsive {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--r) !important;
    max-height: 68vh !important;
  }

  #historyTable thead {
    background: var(--surface2) !important;
  }

  #historyTable thead th {
    background: var(--surface2) !important;
    color: var(--muted) !important;
    border-bottom: 1px solid var(--border) !important;
  }

  /* ══════════════════════════════════════════════════════════
   20. PROFILE TAB
   ══════════════════════════════════════════════════════════ */
  .profile-header {
    background: linear-gradient(135deg, var(--surface2), var(--surface)) !important;
    border: 1px solid var(--border) !important;
    flex-direction: column !important;
    text-align: center !important;
    gap: 14px !important;
    padding: 18px !important;
    border-radius: var(--r) !important;
    margin-bottom: 14px !important;
  }

  .profile-avatar {
    background: linear-gradient(135deg, var(--accent), #ff6b00) !important;
    border-color: var(--border) !important;
    width: 68px !important;
    height: 68px !important;
    font-size: 26px !important;
    margin: 0 auto;
  }

  .profile-info h2 {
    font-size: 18px !important;
    color: var(--text) !important;
  }

  .profile-info p {
    color: var(--muted2) !important;
    font-size: 12px !important;
  }

  .profile-stats {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }

  .stat-card {
    padding: 12px !important;
    border-left: 3px solid var(--accent) !important;
  }

  .stat-card h3 {
    color: var(--muted) !important;
    font-size: 10px !important;
  }

  .stat-card .stat-value {
    color: var(--text) !important;
    font-size: 22px !important;
  }

  .broker-account-card {
    background: var(--surface2) !important;
    border: 1px solid var(--border) !important;
    flex-direction: column !important;
    gap: 10px !important;
    border-radius: var(--r-sm) !important;
    padding: 14px !important;
  }

  .broker-account-info h4 {
    color: var(--text) !important;
  }

  .broker-account-info p {
    color: var(--muted) !important;
  }

  .btn-add-broker {
    background: linear-gradient(135deg, var(--accent), #ff6b00) !important;
    border-radius: var(--r-sm) !important;
  }

  /* ══════════════════════════════════════════════════════════
   21. MODAL
   ══════════════════════════════════════════════════════════ */
  .modal {
    background: rgba(0, 0, 0, 0.75) !important;
  }

  .modal-content {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--r) !important;
    width: 94% !important;
    margin: 12% auto !important;
    padding: 18px !important;
    max-height: 82vh !important;
    overflow-y: auto !important;
  }

  .modal-header {
    border-bottom-color: var(--border) !important;
  }

  .modal-header h2 {
    color: var(--text) !important;
    font-size: 16px !important;
  }

  .modal-close {
    color: var(--muted) !important;
  }

  /* ══════════════════════════════════════════════════════════
   22. TOAST NOTIFICATIONS
   ══════════════════════════════════════════════════════════ */
  #toastContainer {
    bottom: calc(var(--nav-h) + 10px) !important;
    right: 10px !important;
    left: 10px !important;
  }

  .toast {
    background: var(--surface2) !important;
    border-left: 3px solid var(--accent) !important;
    color: var(--text) !important;
    font-size: 12px !important;
    border-radius: var(--r-sm) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5) !important;
  }

  .toast.success {
    border-left-color: var(--green) !important;
  }

  .toast.error {
    border-left-color: var(--red) !important;
  }

  .toast.warning {
    border-left-color: var(--accent) !important;
  }

  /* ══════════════════════════════════════════════════════════
   23. OAUTH WARNING BANNER
   ══════════════════════════════════════════════════════════ */
  #oauthWarning {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.15), rgba(255, 135, 135, 0.1)) !important;
    border-bottom: 1px solid rgba(255, 71, 87, 0.3) !important;
    padding: 10px !important;
    font-size: 11px !important;
    color: var(--text) !important;
  }

  #oauthWarning>div {
    flex-direction: column !important;
    gap: 8px !important;
  }

  #oauthCountdown {
    background: var(--red-dim) !important;
    color: var(--red) !important;
    font-size: 18px !important;
    border-radius: var(--r-sm) !important;
  }

  /* ══════════════════════════════════════════════════════════
   24. ABOUT / UPCOMING TABS
   ══════════════════════════════════════════════════════════ */
  #about>div,
  #about>div>div {
    background: var(--surface) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--r) !important;
  }

  #about h1 {
    color: var(--accent) !important;
  }

  #about p {
    color: var(--muted2) !important;
  }

  #about strong {
    color: var(--text) !important;
  }

  #about code {
    color: var(--accent) !important;
    background: var(--surface2) !important;
    padding: 1px 5px !important;
    border-radius: 3px !important;
  }

  #upcoming>div>div[style*="grid"] {
    grid-template-columns: 1fr !important;
  }

  #upcoming>div>div>div[style*="background: white"] {
    background: var(--surface) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
  }

  #upcoming h3 {
    color: var(--text) !important;
  }

  #upcoming p {
    color: var(--muted2) !important;
  }

  /* ══════════════════════════════════════════════════════════
   25. DATABASE TAB
   ══════════════════════════════════════════════════════════ */
  #database .status-bar {
    flex-direction: column !important;
    background: var(--surface) !important;
    border-color: var(--blue) !important;
    padding: 10px !important;
    gap: 8px !important;
  }

  #database .status-bar>div {
    width: 100% !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }

  #dbSearch,
  #expiryFilter,
  #dbTableSelect {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
    border-radius: var(--r-sm) !important;
    width: 100% !important;
    margin-left: 0 !important;
  }

  #database>div:nth-child(2) {
    background: var(--surface) !important;
    border: 1px solid var(--blue) !important;
    border-radius: var(--r) !important;
    padding: 12px !important;
    flex-direction: column !important;
  }

  #database>div:nth-child(2)>div:nth-child(2) {
    flex-direction: column !important;
    gap: 8px !important;
  }

  .table-responsive {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--r) !important;
  }

  #dbTable thead tr th {
    background: var(--surface2) !important;
  }

  /* ══════════════════════════════════════════════════════════
   26. BACKTEST TAB
   ══════════════════════════════════════════════════════════ */
  #backtest>div>div:nth-child(1) {
    flex-direction: column !important;
    gap: 8px !important;
  }

  #backtest>div>div:nth-child(1)>button {
    width: 100% !important;
    min-width: auto !important;
  }

  #btCSVPanel>div:nth-child(2) {
    flex-direction: column !important;
    gap: 10px !important;
  }

  /* Backtest dark elements already use dark theme, just ensure containers work */
  #backtest .table-responsive {
    max-height: 60vh !important;
  }

  /* ══════════════════════════════════════════════════════════
   27. STRANGLE / ORB CARDS
   ══════════════════════════════════════════════════════════ */
  #spxStrangleCard,
  #ndxStrangleCard,
  #spxMidpointCard,
  #ndxMidpointCard {
    width: 100% !important;
    margin: 0 0 10px 0 !important;
  }

  /* Inner white panels */
  .ticker-section>div[style*="background: white"],
  .ticker-section>div[style*="background:#f8f9fa"],
  .ticker-section>div[style*="background: #f8f9fa"] {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
    border-radius: var(--r-sm) !important;
  }

  /* ORB level stat cards */
  .ticker-section .stat-card {
    background: var(--surface3) !important;
    border: 1px solid var(--border) !important;
  }

  .ticker-section .stat-label {
    color: var(--muted) !important;
  }

  .ticker-section .stat-value {
    color: var(--text) !important;
  }

  /* Execution log */
  #orbLog,
  #spxExecutionLog,
  #ndxExecutionLog,
  #spxMidLog,
  #ndxMidLog,
  #spxCallBfLog,
  #spxPutBfLog,
  #ndxCallBfLog,
  #ndxPutBfLog {
    color: var(--muted2) !important;
  }

  /* Note boxes */
  .auto-profit-info {
    background: var(--green-dim) !important;
    border-left-color: var(--green) !important;
    color: var(--muted2) !important;
  }

  /* Input groups */
  .input-group {
    background: var(--surface2) !important;
    border-color: var(--border) !important;
    border-radius: var(--r-sm) !important;
  }

  .input-group label {
    color: var(--muted2) !important;
  }

  .help-text {
    color: var(--blue) !important;
  }

  /* ══════════════════════════════════════════════════════════
   28. FOOTER
   ══════════════════════════════════════════════════════════ */
  footer {
    background: transparent !important;
    border-top-color: var(--border) !important;
    color: var(--muted) !important;
    margin-bottom: calc(var(--nav-h) + 6px) !important;
    font-size: 10px !important;
  }

  footer strong {
    color: var(--muted2) !important;
  }

  /* ══════════════════════════════════════════════════════════
   29. QUICK-ACCESS SCROLL FIX
   ══════════════════════════════════════════════════════════ */
  /* All tab content fills height and has smooth scroll */
  .tab-content.active,
  .tab-content[style*="block"] {
    min-height: calc(100vh - var(--top-h) - var(--status-h) - var(--ctrl-h) - var(--sel-h) - var(--nav-h) - 20px) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  /* ══════════════════════════════════════════════════════════
   30. SECTION DESCRIPTION BOXES
   ══════════════════════════════════════════════════════════ */
  div[style*="background: #fff3cd"],
  div[style*="background: #fff4e6"],
  div[style*="background: #fdf2e9"],
  div[style*="background:#fff3cd"] {
    background: rgba(240, 165, 0, 0.08) !important;
    border-left-color: var(--accent) !important;
    color: var(--muted2) !important;
    border-radius: var(--r-sm) !important;
  }

  div[style*="background: #d4edda"] {
    background: var(--green-dim) !important;
    border-left-color: var(--green) !important;
    color: var(--muted2) !important;
  }

  div[style*="background: #e7f3ff"],
  div[style*="background: #e7f1ff"] {
    background: rgba(77, 171, 255, 0.08) !important;
    border-left-color: var(--blue) !important;
    color: var(--muted2) !important;
  }

  /* White inline panels inside cards */
  div[style*="background: white"],
  div[style*="background:white"],
  div[style*="background: #fff"],
  div[style*="background: #f8f9fa"],
  div[style*="background:#f8f9fa"],
  .quick-start-guide,
  .ticker-config-item {
    background: var(--surface2) !important;
    color: var(--text) !important;
    border-radius: var(--r-sm) !important;
  }

  .note-box {
    background: rgba(240, 165, 0, 0.08) !important;
    border-left-color: var(--accent) !important;
    color: var(--muted2) !important;
  }

  .spread-type-label {
    background: rgba(77, 171, 255, 0.08) !important;
    border-left-color: var(--blue) !important;
    color: var(--muted2) !important;
  }

}

/* END @media (max-width: 768px) */


/* ════════════════════════════════════════════════════════════
   BOTTOM NAV BAR — matches mockup's dark style
   ════════════════════════════════════════════════════════════ */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 62px;
  background: rgba(14, 17, 27, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(240, 165, 0, 0.2);
  z-index: 1001;
  justify-content: space-around;
  align-items: center;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.6);
}

@media (min-width: 769px) {
  .mobile-nav {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .mobile-nav {
    display: flex;
  }
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #6b7394;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.2s ease;
  padding: 5px 8px;
  border-radius: 10px;
  flex: 1;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.nav-item i {
  width: 22px;
  height: 22px;
  margin-bottom: 2px;
  stroke-width: 2px;
  transition: all 0.2s ease;
}

.nav-item.active {
  color: #f0a500;
}

.nav-item.active i {
  color: #f0a500;
  filter: drop-shadow(0 0 4px rgba(240, 165, 0, 0.5));
  transform: translateY(-1px);
}

/* Active dot indicator */
.nav-item.active::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #f0a500;
  box-shadow: 0 0 6px rgba(240, 165, 0, 0.7);
}

.nav-item:active {
  transform: scale(0.9);
}

/* ══════════════════════════════════════════════════════════
   LIGHT THEME OVERRIDES
   Applied when html.light-theme class is active.
   Only targets elements with hardcoded colors not using vars.
   ══════════════════════════════════════════════════════════ */
[data-theme="light"] .mobile-nav {
  background: rgba(255, 255, 255, 0.97) !important;
  border-top: 1px solid #d1d5db !important;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.08) !important;
}

[data-theme="light"] .nav-item {
  color: #64748b !important;
}

[data-theme="light"] .nav-item.active {
  color: #d48a00 !important;
}

[data-theme="light"] .nav-item.active i {
  color: #d48a00 !important;
}

[data-theme="light"] .nav-item.active::after {
  background: #d48a00 !important;
  box-shadow: 0 0 6px rgba(212, 138, 0, 0.5) !important;
}

@media (max-width: 1280px) {

  /* Ticker bar inline bg override */
  [data-theme="light"] .live-ticker-bar {
    background: #ffffff !important;
    border-bottom: 1px solid #d1d5db !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06) !important;
    color: #1a1a2e !important;
  }

  [data-theme="light"] .live-ticker-bar>span:first-child {
    color: #64748b !important;
  }

  [data-theme="light"] .live-ticker-bar>span:nth-child(2),
  [data-theme="light"] .live-ticker-bar>span:nth-child(3) {
    color: #475569 !important;
  }

  [data-theme="light"] .live-ticker-bar>span:nth-child(2) strong {
    color: #059669 !important;
  }

  [data-theme="light"] .live-ticker-bar>span:nth-child(3) strong {
    color: #2563eb !important;
  }

  /* Mute button */
  [data-theme="light"] #muteBtn {
    background: #eef0f4 !important;
    border: 1px solid #d1d5db !important;
    color: #475569 !important;
  }

  /* Scrollbar */
  [data-theme="light"] ::-webkit-scrollbar-track {
    background: #f5f5f0 !important;
  }

  [data-theme="light"] ::-webkit-scrollbar-thumb {
    background: #c7cbd3 !important;
  }
}