:root {
    --bg-base: #05050A;
    --bg-glass: rgba(18, 20, 31, 0.65);
    --border-glass: rgba(255, 255, 255, 0.08);
    --text-main: #E2E8F0;
    --text-muted: #94A3B8;
    --accent-blue: #3B82F6;
    --accent-purple: #8B5CF6;
    --color-profit: #10B981;
    --color-loss: #EF4444;
    --color-warn: #F59E0B;
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --font-ui: 'Outfit', sans-serif;
    --font-mono: 'Fira Code', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: var(--font-ui);
    height: 100vh;
    overflow: hidden; /* App container handles it */
}

/* Base Utility Classes */
.glass-panel {
    background: var(--bg-glass);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
}
.mono { font-family: var(--font-mono); }
.text-profit { color: var(--color-profit) !important; }
.text-loss { color: var(--color-loss) !important; }
.text-warn { color: var(--color-warn) !important; }
.text-right { text-align: right; }
.flex-1 { flex: 1; min-width: 0; }
.flex-grow { flex-grow: 1; }
.mt-3 { margin-top: 12px; }
.p-0 { padding: 0 !important; }

/* Layout Structure */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 12px;
    gap: 12px;
}

/* Top Bar */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    height: 56px;
    flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { font-size: 1.2rem; font-weight: 700; background: linear-gradient(to right, #fff, #94A3B8); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.logo-icon { font-size: 1.4rem; }

.system-health { display: flex; gap: 24px; align-items: center; }
.health-item { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.health-item .label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; }
.health-item .val { font-size: 0.9rem; font-family: var(--font-mono); font-weight: 600; }

.badge { font-size: 0.7rem; padding: 4px 8px; border-radius: var(--radius-sm); font-weight: 600; }
.mode-badge { background: var(--accent-purple); color: #fff; }

.btn { border: none; border-radius: var(--radius-sm); padding: 8px 16px; font-weight: 600; cursor: pointer; transition: 0.2s; font-family: var(--font-ui); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-warn { background: rgba(245, 158, 11, 0.15); color: #F59E0B; border: 1px solid rgba(245, 158, 11, 0.4); }
.btn-danger { background: rgba(239, 68, 68, 0.15); color: #EF4444; border: 1px solid rgba(239, 68, 68, 0.4); }
.btn-warn:hover { background: rgba(245, 158, 11, 0.3); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.3); }
.controls { display: flex; gap: 8px; }

/* Portfolio Panel */
.portfolio-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between; /* Spread items across the width */
    gap: 24px;
    padding: 16px 24px;
    flex-shrink: 0;
}
.metric-box { display: flex; flex-direction: column; gap: 6px; }
.metric-box .label { font-size: 0.9rem; color: var(--text-muted); text-transform: uppercase; font-weight: 500; letter-spacing: 0.5px; }
.metric-box .val { font-size: 1.6rem; font-weight: 600; }
.box-main .val { font-size: 2.2rem; color: #fff; font-weight: 700; }
.metric-divider { width: 1px; height: 48px; background: var(--border-glass); margin: 0 8px; }

.theme-select {
    background: #000; color: #fff; border: 1px solid var(--border-glass);
    padding: 6px 12px; border-radius: var(--radius-sm); font-family: var(--font-ui);
    outline: none; cursor: pointer;
}

/* Middle Row */
.middle-row { display: flex; gap: 12px; flex: 1; min-height: 0; }
.left-sidebar { width: 260px; display: flex; flex-direction: column; }
.right-sidebar { width: 300px; display: flex; flex-direction: column; }
.chart-split-container { 
    flex: 1; 
    display: flex; 
    gap: 12px; 
    min-width: 0; 
    min-height: 200px; 
}
.chart-half { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    position: relative; 
    overflow: hidden; 
}
#tv_chart_container, #advanced_tv_widget { 
    flex: 1; 
    width: 100%; 
    height: 100%; 
    position: relative; 
}

.panel-flex { display: flex; flex-direction: column; overflow: hidden; }
.panel-header { padding: 12px 16px; border-bottom: 1px solid var(--border-glass); background: rgba(0,0,0,0.2); display: flex; justify-content: space-between; align-items: center; }
.panel-header h2 { font-size: 0.95rem; font-weight: 600; }
.panel-content { padding: 12px; overflow-y: auto; flex-grow: 1; }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

/* Performance Grid */
.perf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 8px; }
.p-item { display: flex; flex-direction: column; }
.p-lbl { font-size: 0.75rem; color: #94A3B8; text-transform: uppercase; font-weight: 500; letter-spacing: 0.4px; }
.p-val { font-size: 0.95rem; font-family: var(--font-mono); font-weight: 700; color: #E2E8F0; }

/* Equity Sparkline */
.sparkline-container { padding: 8px 12px 10px; border-top: 1px solid var(--border-glass); }
.sparkline-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.sparkline-label { font-size: 0.72rem; color: #94A3B8; text-transform: uppercase; font-weight: 500; letter-spacing: 0.4px; }
.sparkline-range { font-size: 0.8rem; font-family: var(--font-mono); font-weight: 700; }
#equity-sparkline { width: 100%; display: block; }

/* AI Vision */
.ai-vision-list { display: flex; flex-direction: column; gap: 8px; }
.ai-card { background: rgba(0,0,0,0.3); border: 1px solid var(--border-glass); border-radius: var(--radius-sm); padding: 10px; }
.ai-card-header { display: flex; justify-content: space-between; margin-bottom: 6px; }
.ai-pair { font-weight: 700; font-family: var(--font-mono); font-size: 0.9rem; color: #E2E8F0; }
.ai-action { font-weight: 700; font-size: 0.82rem; }
.ai-action.BUY { color: var(--color-profit); }
.ai-action.SELL { color: var(--color-loss); }
.ai-action.WAIT_BUY { color: var(--color-warn); }
.ai-action.WAIT_SELL { color: var(--color-warn); }
.ai-action.SKIP { color: #64748B; }
.ai-reason { font-size: 0.78rem; color: #94A3B8; line-height: 1.5; font-weight: 400; }

/* Terminal */
.terminal-dots { display: flex; gap: 4px; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot.red { background: #FF5F56; }
.dot.yellow { background: #FFBD2E; }
.dot.green { background: #27C93F; }
.terminal-content { font-family: var(--font-mono); font-size: 0.75rem; display: flex; flex-direction: column; gap: 6px; background: rgba(0,0,0,0.4); }
.log-line { border-bottom: 1px dashed rgba(255,255,255,0.05); padding-bottom: 4px; word-wrap: break-word; }
.log-time { color: var(--text-muted); margin-right: 6px; }
.log-info { color: #E2E8F0; }
.log-warn { color: var(--color-warn); }
.log-error { color: var(--color-loss); font-weight: 600; }
.log-success { color: var(--color-profit); }
.log-debug { color: #64748B; }

/* Bottom Row & Tables */
.bottom-row { display: flex; gap: 12px; height: 260px; flex-shrink: 0; }
.table-wrapper { overflow: auto; }
.pro-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.pro-table thead { position: sticky; top: 0; background: rgba(18, 20, 31, 0.95); z-index: 1;}
.pro-table th { text-align: left; padding: 6px 16px; color: var(--text-muted); font-weight: 500; font-size: 0.75rem; text-transform: uppercase; border-bottom: 1px solid var(--border-glass); }
.pro-table td { padding: 5px 16px; border-bottom: 1px solid rgba(255,255,255,0.03); font-family: var(--font-mono); }
.pro-table tbody tr:hover { background: rgba(255,255,255,0.02); }

.side-badge { padding: 2px 6px; border-radius: 4px; font-size: 0.7rem; font-weight: 700; font-family: var(--font-ui); }
.side-long { background: rgba(16, 185, 129, 0.15); color: var(--color-profit); }
.side-short { background: rgba(239, 68, 68, 0.15); color: var(--color-loss); }

.empty-state { padding: 20px; text-align: center; color: var(--text-muted); font-style: italic; font-size: 0.85rem; }

.pulse-indicator { width: 6px; height: 6px; border-radius: 50%; background: var(--color-profit); animation: pulse 2s infinite; }
@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 4px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Funding Rate cell */
.funding-rate { font-family: var(--font-mono); font-size: 0.82rem; font-weight: 700; }

/* Pause / Resume button */
.btn-pause { background: rgba(234, 179, 8, 0.15); color: #EAB308; border: 1px solid rgba(234,179,8,0.3); }
.btn-pause:hover { background: rgba(234,179,8,0.25); }
.btn-pause.paused { background: rgba(16,185,129,0.15); color: #10B981; border-color: rgba(16,185,129,0.3); }
.btn-icon { background: rgba(255,255,255,0.06); border: 1px solid var(--border-glass); font-size: 1rem; padding: 6px 10px; }
.btn-icon:hover { background: rgba(255,255,255,0.12); }
.btn-primary { background: linear-gradient(135deg, #6366F1, #8B5CF6); color: #fff; border: none; padding: 8px 20px; border-radius: var(--radius-sm); cursor: pointer; font-weight: 600; }
.btn-primary:hover { opacity: 0.9; }

/* Settings Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-box { width: 480px; max-width: 95vw; border-radius: var(--radius-md); padding: 0; overflow: hidden; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border-glass); }
.modal-header h2 { font-size: 1rem; color: #E2E8F0; margin: 0; }
.btn-close { background: none; border: none; color: var(--text-muted); font-size: 1.1rem; cursor: pointer; padding: 4px 8px; border-radius: 4px; }
.btn-close:hover { background: rgba(255,255,255,0.08); color: #E2E8F0; }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 18px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border-glass); display: flex; align-items: center; gap: 16px; }
.setting-row { display: flex; flex-direction: column; gap: 8px; }
.setting-row label { font-size: 0.78rem; color: #94A3B8; text-transform: uppercase; font-weight: 500; letter-spacing: 0.4px; }
.setting-input-row { display: flex; align-items: center; gap: 12px; }
.setting-input-row input[type=range] { flex: 1; accent-color: #6366F1; cursor: pointer; }
.setting-val { font-family: var(--font-mono); font-size: 0.9rem; font-weight: 700; color: #E2E8F0; min-width: 40px; text-align: right; }

/* Toggle Switch */
.toggle-switch { position: relative; width: 44px; height: 24px; display: inline-block; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: rgba(255,255,255,0.1); border-radius: 24px; transition: 0.3s; }
.toggle-slider::before { content: ''; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background: #94A3B8; border-radius: 50%; transition: 0.3s; }
.toggle-switch input:checked + .toggle-slider { background: #6366F1; }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); background: #fff; }

/* Close trade button in active positions table */
.btn-close-trade {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #EF4444;
    width: 28px; height: 28px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
    transition: all 0.2s;
    display: flex; align-items: center; justify-content: center;
}
.btn-close-trade:hover {
    background: rgba(239, 68, 68, 0.3);
    transform: scale(1.1);
}

/* ============================================================
   MOBILE BOTTOM NAV â€” hidden on desktop
   ============================================================ */
.mobile-bottom-nav { display: none; }

/* ============================================================
   MOBILE REDESIGN â€” screens <= 768px  (Cyberpunk HiTech)
   ============================================================ */
@media (max-width: 768px) {

  /* â”€â”€ Base â”€â”€ */
  body {
    height: 100dvh;
    overflow: hidden;
    background: #03030A;
    background-image:
      radial-gradient(ellipse at 20% 0%, rgba(99,102,241,0.12) 0%, transparent 60%),
      radial-gradient(ellipse at 80% 100%, rgba(16,185,129,0.08) 0%, transparent 60%);
  }

  .app-container {
    height: calc(100dvh - 68px);
    padding: 0;
    gap: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }

  /* â”€â”€ Animated scan line effect â”€â”€ */
  .app-container::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 68px;
    background: repeating-linear-gradient(
      0deg,
      transparent,
      transparent 3px,
      rgba(99,102,241,0.015) 3px,
      rgba(99,102,241,0.015) 4px
    );
    pointer-events: none;
    z-index: 0;
  }

  /* â”€â”€ Desktop sections hidden on mobile â”€â”€ */
  .middle-row,
  .bottom-row { display: none !important; }

  /* â”€â”€ Mobile Top Bar â”€â”€ */
  .top-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    height: 56px;
    background: rgba(3,3,10,0.92);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(99,102,241,0.2);
    box-shadow: 0 0 30px rgba(99,102,241,0.08);
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
  }

  .brand { gap: 8px; }
  .brand h1 {
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #6366F1, #22D3EE);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }
  .logo-icon { font-size: 1.2rem; }
  .system-health { display: none; }

  .controls {
    display: flex;
    gap: 6px;
    align-items: center;
  }
  .controls .btn-pause { font-size: 0.75rem; width: 36px; height: 36px; padding: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
  .controls .btn-warn { font-size: 0.75rem; width: 36px; height: 36px; padding: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
  .controls #btn-emergency-stop { font-size: 0.65rem; padding: 0 8px; height: 36px; border-radius: 18px; }
  .controls #btn-settings { width: 36px; height: 36px; border-radius: 50%; padding: 0; font-size: 1rem; }

  /* â”€â”€ Portfolio Panel â†’ Hero Card â”€â”€ */
  .portfolio-panel {
    margin: 12px 12px 8px;
    padding: 0;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(99,102,241,0.15) 0%, rgba(34,211,238,0.08) 100%);
    border: 1px solid rgba(99,102,241,0.3);
    box-shadow: 0 0 40px rgba(99,102,241,0.12), inset 0 1px 0 rgba(255,255,255,0.06);
    overflow: hidden;
    display: block;
    position: relative;
    flex-shrink: 0;
  }

  /* Glow line at top of hero */
  .portfolio-panel::before {
    content: '';
    position: absolute;
    top: 0; left: 20%; right: 20%;
    height: 1px;
    background: linear-gradient(90deg, transparent, #6366F1, #22D3EE, transparent);
    animation: glowScan 3s ease-in-out infinite;
  }

  @keyframes glowScan {
    0%,100% { opacity: 0.4; }
    50% { opacity: 1; }
  }

  .metric-divider { display: none; }
  .metric-box { display: none; }

  /* Show only key metrics as hero layout */
  .metric-box:nth-child(1) { /* Total Equity */
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 20px 8px;
    text-align: center;
  }
  .metric-box:nth-child(1) .label {
    font-size: 0.65rem;
    letter-spacing: 2px;
    color: rgba(99,102,241,0.8);
    font-weight: 600;
  }
  .metric-box:nth-child(1) .val {
    font-size: 2.6rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.1;
    font-family: var(--font-mono);
    text-shadow: 0 0 20px rgba(99,102,241,0.5);
  }

  .metric-box:nth-child(4) { /* Floating PnL */
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 0 20px 4px;
    text-align: center;
  }
  .metric-box:nth-child(4) .label {
    font-size: 0.65rem;
    color: var(--text-muted);
  }
  .metric-box:nth-child(4) .val {
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-mono);
  }

  .metric-box:nth-child(5), /* Realized PnL */
  .metric-box:nth-child(6)  /* ROI */ {
    display: flex;
  }

  /* Bottom row of hero: ROI + Drawdown in grid */
  .portfolio-panel .metric-box:nth-child(5),
  .portfolio-panel .metric-box:nth-child(6),
  .portfolio-panel .metric-box:nth-child(7),
  .portfolio-panel .metric-box:nth-child(8) {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  /* Create 4-col grid for stats row */
  .portfolio-panel::after {
    content: '';
    display: block;
    height: 8px;
  }

  /* Stats row wrapper - override flex with grid */
  .portfolio-panel {
    display: grid;
    grid-template-rows: auto auto auto;
  }

  /* Restyle ALL metric-boxes in portfolio as a stats grid */
  .portfolio-panel .metric-box {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 8px 12px;
  }

  /* First box (Total Equity) spans full width */
  .portfolio-panel .metric-box:first-child {
    grid-column: 1;
    padding: 20px 20px 4px;
  }

  .portfolio-panel .metric-box .label {
    font-size: 0.6rem;
    letter-spacing: 1.5px;
    color: rgba(148,163,184,0.7);
    text-transform: uppercase;
  }
  .portfolio-panel .metric-box .val {
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-mono);
    color: #E2E8F0;
  }
  .portfolio-panel .box-main .val {
    font-size: 2.6rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 0 24px rgba(99,102,241,0.5);
    font-family: var(--font-mono);
  }

  /* Stats row - horizontal scroll strip */
  .portfolio-panel {
    display: flex;
    flex-direction: column;
  }
  .portfolio-panel .metric-box:not(.box-main):not(:last-child) {
    display: flex;
  }

  /* Use a wrapper approach: make bottom stats horizontal */
  .portfolio-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto auto;
    padding: 0;
  }

  /* Hero (Total Equity) - spans both columns */
  .portfolio-panel .box-main {
    grid-column: 1 / -1;
    padding: 18px 20px 8px;
    text-align: center;
    border-bottom: 1px solid rgba(99,102,241,0.1);
  }

  /* Chart selector - full width at bottom */
  .portfolio-panel .metric-box:last-child {
    grid-column: 1 / -1;
    padding: 10px 16px;
    border-top: 1px solid rgba(99,102,241,0.1);
    align-items: flex-start;
  }

  /* Individual stat boxes */
  .portfolio-panel .metric-box {
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
  }
  .portfolio-panel .metric-box:nth-child(odd):not(.box-main):not(:last-child) {
    border-right: 1px solid rgba(255,255,255,0.04);
  }

  /* â”€â”€ Mobile Tab System â”€â”€ */
  .mobile-tab-content { display: none; }
  .mobile-tab-content.active { display: block; }

  /* â”€â”€ Mobile Content Sections â”€â”€ */
  .mobile-section {
    margin: 0 12px 12px;
    border-radius: 16px;
    background: rgba(12,14,24,0.8);
    border: 1px solid rgba(255,255,255,0.07);
    overflow: hidden;
  }

  .mobile-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    background: rgba(99,102,241,0.05);
  }

  .mobile-section-header h3 {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(148,163,184,0.9);
    display: flex;
    align-items: center;
    gap: 8px;
  }

  /* â”€â”€ Performance cards (mobile-only) â”€â”€ */
  .mobile-perf-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: rgba(255,255,255,0.04);
  }
  .mobile-perf-card {
    padding: 14px 16px;
    background: rgba(6,8,18,0.9);
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .mobile-perf-card .lbl {
    font-size: 0.62rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(148,163,184,0.6);
    font-weight: 500;
  }
  .mobile-perf-card .val {
    font-size: 1.1rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: #E2E8F0;
  }

  /* â”€â”€ Trade cards (replace table on mobile) â”€â”€ */
  .mobile-trade-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
  }
  .mobile-trade-card:last-child { border-bottom: none; }
  .mobile-trade-card .tc-left { display: flex; flex-direction: column; gap: 3px; }
  .mobile-trade-card .tc-symbol { font-size: 0.95rem; font-weight: 700; color: #E2E8F0; }
  .mobile-trade-card .tc-meta { font-size: 0.7rem; color: var(--text-muted); font-family: var(--font-mono); }
  .mobile-trade-card .tc-right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
  .mobile-trade-card .tc-pnl { font-size: 1.05rem; font-weight: 700; font-family: var(--font-mono); }
  .mobile-trade-card .tc-hold { font-size: 0.65rem; color: var(--text-muted); }

  /* Side badge */
  .side-long {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    background: rgba(16,185,129,0.15);
    color: #10B981;
    border: 1px solid rgba(16,185,129,0.3);
    letter-spacing: 1px;
  }
  .side-short {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    background: rgba(239,68,68,0.15);
    color: #EF4444;
    border: 1px solid rgba(239,68,68,0.3);
    letter-spacing: 1px;
  }

  /* â”€â”€ Log terminal (mobile) â”€â”€ */
  .mobile-log-box {
    height: calc(100dvh - 56px - 68px - 60px);
    overflow-y: auto;
    padding: 10px 12px;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    line-height: 1.7;
    color: rgba(148,163,184,0.85);
    background: #030508;
    -webkit-overflow-scrolling: touch;
  }
  .mobile-log-box .log-time { color: rgba(99,102,241,0.7); }
  .mobile-log-box .log-profit { color: #10B981; }
  .mobile-log-box .log-loss { color: #EF4444; }
  .mobile-log-box .log-warn { color: #F59E0B; }

  /* â”€â”€ Quick Settings (mobile tab) â”€â”€ */
  .mobile-settings-panel {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
  }

  /* â”€â”€ Bottom Navigation Bar â”€â”€ */
  .mobile-bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 68px;
    background: rgba(6,8,18,0.97);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(99,102,241,0.25);
    z-index: 200;
    box-shadow: 0 -4px 30px rgba(99,102,241,0.1);
  }

  .nav-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: none;
    background: transparent;
    color: rgba(148,163,184,0.5);
    cursor: pointer;
    transition: all 0.2s;
    padding: 8px 4px;
    position: relative;
  }

  .nav-tab.active {
    color: #6366F1;
  }

  .nav-tab.active::before {
    content: '';
    position: absolute;
    top: 0; left: 20%; right: 20%;
    height: 2px;
    background: linear-gradient(90deg, #6366F1, #22D3EE);
    border-radius: 0 0 4px 4px;
    box-shadow: 0 0 12px rgba(99,102,241,0.8);
  }

  .nav-icon { font-size: 1.3rem; line-height: 1; }
  .nav-label { font-size: 0.6rem; font-weight: 600; letter-spacing: 0.5px; font-family: var(--font-ui); text-transform: uppercase; }

  /* â”€â”€ Modal â”€â”€ */
  .modal-box {
    width: 95vw !important;
    max-width: 95vw !important;
    max-height: 90dvh;
    overflow-y: auto;
    border-radius: 20px !important;
  }

  /* â”€â”€ Tables (keep for tablet size, horizontal scroll) â”€â”€ */
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .pro-table { min-width: 480px; font-size: 0.75rem; }
  .pro-table th, .pro-table td { padding: 7px 8px; white-space: nowrap; }

  select.theme-select { width: 100%; padding: 10px 12px; font-size: 0.9rem; }
}
