/* ════════════════════════════════════════════════════════════════
   ADMIN DASHBOARD
   ════════════════════════════════════════════════════════════════ */

   .admin-body {
    margin: 0;
    background: #f1f5f9;
    font-family: 'Inter', -apple-system, sans-serif;
    color: #0f172a;
    min-height: 100vh;
  }
  
  .admin-dashboard {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px;
  }
  
  /* ── Header ─────────────────────────────────────────────────── */
  .admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 32px;
  }
  .admin-header h1 { font-size: 28px; font-weight: 800; margin: 0; }
  .admin-header p { color: #64748b; margin: 4px 0 0; font-size: 14px; }
  .admin-header-actions { display: flex; align-items: center; gap: 12px; }
  .admin-badge {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    color: white;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
  }
  .btn-admin-secondary {
    background: white;
    color: #0f172a;
    padding: 10px 18px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    border: 1px solid #e2e8f0;
  }
  .btn-admin-secondary:hover { background: #f8fafc; }
  
  /* ── Hero KPI cards ─────────────────────────────────────────── */
  .admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 16px;
  }
  .admin-stat-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    position: relative;
    overflow: hidden;
    transition: box-shadow .2s ease;
  }
  .admin-stat-card:hover { box-shadow: 0 6px 16px rgba(15, 23, 42, .06); }
  .admin-stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, #16a34a, #4ade80);
  }
  .admin-stat-card.revenue::before { background: linear-gradient(90deg, #16a34a, #4ade80); }
  .admin-stat-card.users::before   { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
  .admin-stat-card.paid::before    { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
  .admin-stat-card.trades::before  { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
  .admin-stat-card.brokers::before { background: linear-gradient(90deg, #06b6d4, #22d3ee); }
  .admin-stat-card.active::before  { background: linear-gradient(90deg, #ec4899, #f472b6); }
  .admin-stat-card.ai::before      { background: linear-gradient(90deg, #f97316, #fb923c); }
  
  .admin-stat-label {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 8px;
  }
  .admin-stat-value {
    font-size: 28px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -.5px;
    margin-bottom: 4px;
  }
  .admin-stat-change { font-size: 12px; color: #64748b; font-weight: 500; }
  
  .stat-delta { font-weight: 700; font-size: 11px; margin-left: 4px; white-space: nowrap; }
  .stat-delta.up   { color: #16a34a; }
  .stat-delta.down { color: #dc2626; }
  
  /* ── Quick numbers strip ────────────────────────────────────── */
  .admin-quick-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    margin-bottom: 24px;
  }
  .admin-quick-item {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 16px;
  }
  .admin-quick-item .q-label {
    font-size: 10px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .5px;
  }
  .admin-quick-item .q-value { font-size: 20px; font-weight: 800; margin-top: 4px; }
  .admin-quick-item .q-sub { font-size: 11px; color: #94a3b8; margin-top: 2px; }
  
  /* ── Card rows ──────────────────────────────────────────────── */
  .admin-charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
  }
  .admin-charts-row.three-col { grid-template-columns: repeat(3, 1fr); }
  .admin-chart-card {
    background: white;
    padding: 24px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    transition: box-shadow .2s ease;
  }
  .admin-chart-card:hover { box-shadow: 0 6px 16px rgba(15, 23, 42, .06); }
  .admin-chart-card h3 {
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
  }
  .h3-sub { font-size: 11px; font-weight: 500; color: #94a3b8; }
  
  /* ── Tables ─────────────────────────────────────────────────── */
  .admin-table { width: 100%; border-collapse: collapse; }
  .admin-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .5px;
    border-bottom: 1px solid #e2e8f0;
  }
  .admin-table td { padding: 12px; font-size: 13px; border-bottom: 1px solid #f8fafc; }
  .admin-table tbody tr:hover { background: #f8fafc; }
  .admin-table tbody tr:last-child td { border-bottom: 0; }
  .admin-table td.positive, .metric-row .m-value.positive { color: #16a34a; font-weight: 600; }
  .admin-table td.negative, .metric-row .m-value.negative { color: #dc2626; font-weight: 600; }
  .admin-table td.rank { color: #94a3b8; font-weight: 700; width: 30px; }
  
  /* ── Chips / badges ─────────────────────────────────────────── */
  .plan-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
  }
  .plan-badge.plan-free    { background: #f1f5f9; color: #64748b; }
  .plan-badge.plan-starter { background: #dbeafe; color: #1e40af; }
  .plan-badge.plan-pro     { background: #fef3c7; color: #92400e; }
  
  .chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
  .stat-chip {
    background: #f1f5f9;
    color: #475569;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
  }
  .stat-chip.good { background: #dcfce7; color: #166534; }
  .stat-chip.warn { background: #fef3c7; color: #92400e; }
  .stat-chip.bad  { background: #fee2e2; color: #991b1b; }
  
  .side-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    background: #f1f5f9;
    color: #475569;
  }
  .side-chip.long    { background: #dcfce7; color: #166534; }
  .side-chip.short   { background: #fee2e2; color: #991b1b; }
  .side-chip.neutral { background: #f1f5f9; color: #64748b; }
  
  .ok-mark { color: #16a34a; font-weight: 700; }
  .m-muted { color: #94a3b8; font-size: 11px; }
  
  /* ── Plan distribution bars ─────────────────────────────────── */
  .plan-distribution { display: flex; flex-direction: column; gap: 16px; margin-bottom: 16px; }
  .plan-row { display: grid; grid-template-columns: 150px 1fr 50px; align-items: center; gap: 12px; }
  .plan-label { font-size: 13px; font-weight: 600; color: #475569; }
  .plan-bar { height: 24px; background: #f1f5f9; border-radius: 6px; overflow: hidden; }
  .plan-fill { height: 100%; transition: width .6s ease; }
  .plan-fill.free    { background: linear-gradient(90deg, #94a3b8, #cbd5e1); }
  .plan-fill.starter { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
  .plan-fill.pro     { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
  .plan-count { font-size: 13px; font-weight: 700; color: #0f172a; text-align: right; }
  
  /* ── Metric list ────────────────────────────────────────────── */
  .metric-list { display: flex; flex-direction: column; }
  .metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
  }
  .metric-row:last-child { border-bottom: 0; }
  .metric-row .m-label { color: #64748b; }
  .metric-row .m-value { font-weight: 700; }
  
  /* ── Funnel ─────────────────────────────────────────────────── */
  .funnel { display: flex; flex-direction: column; gap: 14px; }
  .funnel-step {
    display: grid;
    grid-template-columns: 160px 1fr 60px 56px;
    align-items: center;
    gap: 12px;
  }
  .funnel-name { font-size: 12px; font-weight: 600; color: #475569; }
  .funnel-track { height: 22px; background: #f1f5f9; border-radius: 6px; overflow: hidden; }
  .funnel-fill {
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    transition: width .6s ease;
    min-width: 2px;
  }
  .funnel-count { font-size: 13px; font-weight: 700; text-align: right; }
  .funnel-pct { font-size: 11px; color: #94a3b8; text-align: right; }
  
  /* ── Performance grid (donut + metrics) ─────────────────────── */
  .performance-grid {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 24px;
    align-items: center;
  }
  .donut-wrap { max-width: 240px; }
  
  /* ── Mini list ──────────────────────────────────────────────── */
  .mini-list { margin-top: 16px; }
  .mini-list-title {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 8px;
  }
  .mini-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f8fafc;
    font-size: 12px;
  }
  .mini-list-item:last-child { border-bottom: 0; }
  
  .footnote { font-size: 11px; color: #94a3b8; margin: 12px 0 0; }
  
  /* ── Responsive ─────────────────────────────────────────────── */
  @media (max-width: 1100px) {
    .admin-quick-grid { grid-template-columns: repeat(3, 1fr); }
  }
  @media (max-width: 1024px) {
    .admin-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .admin-charts-row { grid-template-columns: 1fr; }
    .admin-charts-row.three-col { grid-template-columns: 1fr; }
  }
  @media (max-width: 640px) {
    .admin-dashboard { padding: 16px; }
    .admin-stats-grid { grid-template-columns: 1fr; }
    .admin-quick-grid { grid-template-columns: repeat(2, 1fr); }
    .plan-row { grid-template-columns: 100px 1fr 40px; }
    .funnel-step { grid-template-columns: 110px 1fr 40px 44px; }
    .performance-grid { grid-template-columns: 1fr; }
  }
  