/* ═══════════════════════════════════════════════════
   TRADING PLATFORM — PREMIUM DARK THEME
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ─── CSS Variables ─── */
:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.8);
  --bg-card-hover: rgba(31, 41, 55, 0.9);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --bg-input: rgba(255, 255, 255, 0.05);
  
  --border-primary: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --border-accent: rgba(99, 102, 241, 0.3);
  
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --text-accent: #818cf8;
  
  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%);
  --accent-glow: 0 0 20px rgba(99, 102, 241, 0.3);
  
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.1);
  --success-border: rgba(16, 185, 129, 0.3);
  
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --warning-border: rgba(245, 158, 11, 0.3);
  
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.1);
  --danger-border: rgba(239, 68, 68, 0.3);
  
  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.1);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s ease;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Animated background */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(139, 92, 246, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(16, 185, 129, 0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

a {
  color: var(--text-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-secondary);
}

/* ─── Layout ─── */
.layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.sidebar {
  width: 260px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-primary);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 24px;
  border-bottom: 1px solid var(--border-primary);
  margin-bottom: 24px;
}

.sidebar-logo .logo-icon {
  width: 40px;
  height: 40px;
  background: var(--accent-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: var(--accent-glow);
}

.sidebar-logo h1 {
  font-size: 18px;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section {
  margin-bottom: 20px;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 0 12px;
  margin-bottom: 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.nav-link:hover {
  background: var(--bg-glass);
  color: var(--text-primary);
}

.nav-link.active {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent-primary);
  border-left: 3px solid var(--accent-primary);
}

.nav-link .icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.nav-link .badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.main-content {
  flex: 1;
  margin-left: 260px;
  padding: 32px;
  min-height: 100vh;
}

/* ─── Page Header ─── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.page-header h2 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.page-header .subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ─── Cards ─── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: 24px;
  backdrop-filter: blur(12px);
  transition: all var(--transition-normal);
}

.card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-primary);
}

.card-header h3 {
  font-size: 16px;
  font-weight: 600;
}

/* ─── Stat Cards Grid ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stats-grid.stats-2col {
  grid-template-columns: repeat(2, 1fr);
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-card .stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.stat-card .stat-icon.purple { background: rgba(99, 102, 241, 0.15); }
.stat-card .stat-icon.green { background: rgba(16, 185, 129, 0.15); }
.stat-card .stat-icon.yellow { background: rgba(245, 158, 11, 0.15); }
.stat-card .stat-icon.blue { background: rgba(59, 130, 246, 0.15); }
.stat-card .stat-icon.red { background: rgba(239, 68, 68, 0.15); }

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-card .stat-value {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1;
}

.stat-card .stat-value.accent {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── Tables ─── */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead th {
  background: rgba(255, 255, 255, 0.03);
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-primary);
  white-space: nowrap;
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-primary);
  vertical-align: middle;
}

tbody tr {
  transition: background var(--transition-fast);
}

tbody tr:hover {
  background: var(--bg-glass);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* ─── Badges / Status ─── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge.pending {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.badge.active, .badge.approved, .badge.win, .badge.open {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.badge.disabled, .badge.rejected, .badge.loss, .badge.cancelled {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.badge.closed {
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge.auto {
  background: rgba(139, 92, 246, 0.1);
  color: var(--accent-secondary);
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.badge.manual {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent-primary);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: var(--accent-glow);
}

.btn-primary:hover {
  box-shadow: 0 0 30px rgba(99, 102, 241, 0.4);
  color: white;
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #059669;
  color: white;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
  color: white;
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-primary);
}

.btn-outline:hover {
  background: var(--bg-glass);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 16px;
}

.btn-block {
  display: flex;
  justify-content: center;
  width: 100%;
}

.btn-group {
  display: flex;
  gap: 8px;
}

/* ─── Forms ─── */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  transition: all var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
  background: rgba(255, 255, 255, 0.07);
}

.form-control::placeholder {
  color: var(--text-muted);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239ca3af' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ─── Alerts ─── */
.alert {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid transparent;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.alert-success {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success-border);
}

.alert-error {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
}

.alert-warning {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: var(--warning-border);
}

.alert-info {
  background: var(--info-bg);
  color: var(--info);
  border-color: rgba(59, 130, 246, 0.3);
}

/* ─── Auth Pages ─── */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  z-index: 1;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  padding: 40px;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo .logo-icon {
  width: 64px;
  height: 64px;
  background: var(--accent-gradient);
  border-radius: var(--radius-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin-bottom: 16px;
  box-shadow: var(--accent-glow);
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(99, 102, 241, 0.3); }
  50% { box-shadow: 0 0 40px rgba(99, 102, 241, 0.5); }
}

.auth-logo h1 {
  font-size: 24px;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-logo p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

.auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 14px;
  color: var(--text-secondary);
}

/* ─── Quick Actions Grid ─── */
.actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.action-card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  text-decoration: none;
  color: var(--text-primary);
  display: block;
}

.action-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
  color: var(--text-primary);
}

.action-card .action-icon {
  font-size: 32px;
  margin-bottom: 12px;
  display: block;
}

.action-card .action-label {
  font-size: 14px;
  font-weight: 600;
}

.action-card .action-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ─── Account Status Banner ─── */
.status-banner {
  padding: 16px 24px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
}

.status-banner.pending {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: var(--warning);
}

.status-banner.active {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success);
}

.status-banner.disabled {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger);
}

/* ─── Trade Result Modal ─── */
.trade-result-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fadeIn 0.2s ease;
  padding: 20px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.trade-result-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  padding: 48px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.trade-result-card .result-icon {
  font-size: 64px;
  margin-bottom: 20px;
  display: block;
}

.trade-result-card h3 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}

.trade-result-card .result-amount {
  font-size: 36px;
  font-weight: 800;
  margin: 16px 0;
}

.trade-result-card .result-amount.win {
  color: var(--success);
}

.trade-result-card .result-amount.loss {
  color: var(--danger);
}

/* ─── Referral Section ─── */
.referral-box {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 32px;
}

.referral-code-display {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-top: 12px;
}

.referral-code-display code {
  flex: 1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-accent);
  letter-spacing: 2px;
}

.referral-code-display .btn {
  flex-shrink: 0;
}

/* ─── Modal ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h3 {
  font-size: 20px;
  margin-bottom: 20px;
}

/* ─── Empty State ─── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 15px;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ─── Pending/Confirm Banner ─── */
.confirm-banner {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}

.confirm-banner h4 {
  color: var(--warning);
  margin-bottom: 12px;
}

.confirm-banner .detail-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
}

.confirm-banner .detail-row .value {
  font-weight: 600;
}

/* ─── Admin Specific ─── */
.admin-sidebar {
  background: linear-gradient(180deg, #0f1629, #111827);
}

.filter-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.filter-bar .btn.active {
  background: var(--accent-primary);
  color: white;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  /* Sidebar: hidden by default via transform, NOT display:none */
  /* display:none was blocking the JS hamburger toggle from working */
  .sidebar {
    display: flex !important; /* override any display:none so JS open class works */
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
  }
  
  .main-content {
    margin-left: 0;
    padding: 0 16px 32px;
  }
  
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .actions-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  
  .page-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 20px;
  }

  .page-header h2 {
    font-size: 22px;
  }

  /* Tables: allow horizontal scroll with a subtle shadow hint */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
    box-shadow: inset -8px 0 12px -8px rgba(0,0,0,0.4);
  }

  table {
    min-width: 0;
  }

  /* Hide non-essential columns on mobile */
  .hide-mobile {
    display: none !important;
  }

  /* Compress table cells on mobile */
  tbody td, thead th {
    padding: 10px 10px;
    font-size: 13px;
  }

  /* Buttons: wrap gracefully on small screens */
  .btn-group {
    flex-wrap: wrap;
  }

  /* Filter bar: wrap on mobile */
  .filter-bar {
    gap: 8px;
  }

  /* Referral box: stack content vertically */
  .referral-box .d-flex {
    flex-direction: column;
    gap: 8px;
  }

  .referral-code-display {
    flex-wrap: wrap;
    gap: 6px;
  }

  .referral-code-display .btn {
    flex: 1;
    min-width: 100px;
    justify-content: center;
    padding: 8px 10px;
    font-size: 12px;
  }

  .referral-code-display code {
    font-size: 13px;
    letter-spacing: 1px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Stat card: smaller value font */
  .stat-card .stat-value {
    font-size: 18px;
  }

  .stat-card .stat-icon {
    width: 32px;
    height: 32px;
    font-size: 15px;
    margin-bottom: 8px;
  }

  .stat-card {
    padding: 14px 12px;
  }

  /* Card padding reduction */
  .card {
    padding: 16px;
  }

  /* Status banner: smaller text */
  .status-banner {
    font-size: 13px;
    padding: 12px 16px;
  }

  /* Trade chart modal: full screen friendly on mobile */
  .trade-chart-overlay {
    padding: 10px;
    align-items: flex-end;
  }

  .trade-chart-modal {
    max-height: 90vh;
    overflow-y: auto;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .chart-container {
    height: 200px;
  }

  .trade-live-stats {
    grid-template-columns: repeat(3, 1fr);
    padding: 12px 14px;
    gap: 8px;
  }

  .live-stat-value {
    font-size: 13px;
  }

  /* Pagination buttons */
  .pagination-bar {
    gap: 6px;
  }

  .pagination-bar .btn-sm {
    padding: 5px 10px;
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .stat-card {
    padding: 12px 10px;
  }

  .stat-card .stat-value {
    font-size: 16px;
    letter-spacing: 0;
  }

  .stat-card .stat-label {
    font-size: 10px;
  }

  .stat-card .stat-icon {
    width: 28px;
    height: 28px;
    font-size: 13px;
    margin-bottom: 6px;
  }
  
  .actions-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .action-card {
    padding: 14px 10px;
  }

  .action-card .action-icon {
    font-size: 24px;
    margin-bottom: 8px;
  }

  .action-card .action-label {
    font-size: 13px;
  }

  .action-card .action-desc {
    display: none;
  }
  
  .auth-card {
    padding: 24px 20px;
  }

  .auth-container {
    padding: 16px;
  }

  .auth-logo .logo-icon {
    width: 52px;
    height: 52px;
    font-size: 26px;
  }

  .auth-logo h1 {
    font-size: 20px;
  }

  /* Modal full width on small phones */
  .modal {
    padding: 24px 16px;
    border-radius: var(--radius-lg);
  }

  /* Trade result card */
  .trade-result-card {
    padding: 28px 16px;
  }

  .trade-result-card h3 {
    font-size: 20px;
  }

  .trade-result-card .result-amount {
    font-size: 28px;
  }
}

/* ─── Utility Classes ─── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-accent { color: var(--text-accent) !important; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.fw-bold { font-weight: 700; }
.d-flex { display: flex; }
.gap-2 { gap: 16px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* ─── Pagination Bar ─── */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 0 4px;
  flex-wrap: wrap;
}

.pagination-info {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 8px;
}

/* ─── Wallet Address Box ─── */
.wallet-address-box {
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
}

.wallet-address-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--success);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.wallet-address-value {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.wallet-address-value code {
  flex: 1;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 13px;
  color: var(--text-accent);
  word-break: break-all;
  line-height: 1.5;
}

@media (max-width: 480px) {
  .wallet-address-value code {
    font-size: 11px;
  }
}

/* ─── Mobile Header & Hamburger Menu ─── */
.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-primary);
  margin-bottom: 20px;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
}

.mobile-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.mobile-menu-btn {
  background: var(--bg-glass);
  border: 1px solid var(--border-primary);
  color: var(--text-primary);
  font-size: 20px;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.mobile-menu-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 90;
  opacity: 0;
  transition: opacity var(--transition-normal);
  backdrop-filter: blur(2px);
}

.sidebar-overlay.show {
  display: block;
  opacity: 1;
}

@media (max-width: 768px) {
  /* Sidebar slides in from left — open class added by JS */
  .sidebar.open {
    transform: translateX(0) !important;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.6);
  }

  .main-content {
    margin-left: 0;
    padding: 0 16px 32px;
  }

  .mobile-header {
    display: flex;
    margin-left: -16px;
    margin-right: -16px;
    margin-top: 0;
  }

  .trading-cards-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ─── Trading Grid Layout Fix ─── */
.trading-cards-grid {
  display: grid; 
  grid-template-columns: 1fr 1fr; 
  gap: 24px; 
  margin-bottom: 32px;
}

/* ─── Trade Chart Modal ─── */
.trade-chart-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(4, 6, 12, 0.9);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.trade-chart-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.trade-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--border-primary);
  background: rgba(255, 255, 255, 0.02);
}

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

.trade-pair h3 {
  font-size: 18px;
  margin-bottom: 2px;
  font-weight: 700;
}

.pair-icon {
  font-size: 32px;
  background: var(--bg-glass);
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border-primary);
}

.trade-type-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.2);
  color: var(--accent-primary);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.trade-amount-display {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.chart-container {
  height: 280px;
  background: #0a0e17;
  position: relative;
}

.trade-timer-bar {
  padding: 16px 20px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border-primary);
}

.timer-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 14px;
}

.timer-label {
  color: var(--text-secondary);
}

.timer-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.timer-progress {
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
}

.timer-progress-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--accent-primary), #818cf8);
  border-radius: 3px;
  transition: width 1s linear;
}

.trade-live-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 16px 20px;
  gap: 16px;
}

.live-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.live-stat-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}

.live-stat-value {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
