/* =========================================
   DASHBOARD
   ========================================= */
.dashboard-body {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-nav {
  padding: 12px 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s;
}
.sidebar-link:hover { background: var(--surface); color: var(--text-primary); }
.sidebar-link.active { background: rgba(59,130,246,0.1); color: var(--accent-bright); font-weight: 500; }
.sidebar-icon { font-size: 16px; width: 20px; text-align: center; }
.sidebar-user {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 36px;
  height: 36px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.user-email { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kyc-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  background: rgba(16,185,129,0.1);
  color: var(--success);
  border-radius: 100px;
  flex-shrink: 0;
}

/* MAIN */
.dashboard-main {
  flex: 1;
  overflow: auto;
  padding: 0 32px 48px;
  min-width: 0;
}
.dash-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}
.dash-title {
  display: flex;
  align-items: center;
  gap: 14px;
}
.dash-title h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
}
.sidebar-toggle {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  cursor: pointer;
}
.dash-topbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.balance-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-secondary);
}
.balance-chip strong { color: var(--text-primary); font-family: var(--font-display); font-size: 15px; }
.btn-xs { padding: 4px 12px; font-size: 12px; border-radius: var(--radius-sm); }

.date-range { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 4px; }
.date-btn {
  padding: 5px 12px;
  font-size: 13px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}
.date-btn.active { background: var(--surface-2); color: var(--text-primary); }

/* KPI */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.kpi-icon-blue   { background: rgba(59,130,246,0.12); }
.kpi-icon-purple { background: rgba(139,92,246,0.12); }
.kpi-icon-green  { background: rgba(16,185,129,0.12); }
.kpi-icon-orange { background: rgba(245,158,11,0.12); }
.kpi-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.kpi-value { font-family: var(--font-display); font-size: 24px; font-weight: 700; line-height: 1; margin-bottom: 6px; }
.kpi-delta { font-size: 12px; }
.kpi-up { color: var(--success); }
.kpi-down { color: var(--accent-bright); }

/* CHARTS */
.charts-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.chart-large {}
.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.chart-header h3 { font-family: var(--font-display); font-size: 15px; font-weight: 700; }
.chart-legend { display: flex; gap: 14px; }
.legend-item { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 5px; }
.legend-item::before { content: ''; width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.legend-requests::before { background: var(--accent); }
.legend-cost::before { background: var(--accent-3); }
.pie-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

/* TABLES */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  overflow: hidden;
}
.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 10px;
}
.table-header h3 { font-family: var(--font-display); font-size: 15px; font-weight: 700; }
.table-actions { display: flex; gap: 8px; align-items: center; }
.table-search {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  padding: 6px 12px;
  outline: none;
  width: 180px;
}
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--bg-3);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 16px;
  font-size: 13px;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  white-space: nowrap;
}
.data-table tr:hover td { background: rgba(255,255,255,0.02); }
code.key-display {
  font-family: 'Fira Code', monospace;
  font-size: 12px;
  color: var(--text-secondary);
}
.copy-btn {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.copy-btn:hover { color: var(--text-primary); }
.usage-bar {
  width: 80px;
  height: 4px;
  background: var(--bg-3);
  border-radius: 2px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}
.usage-fill { height: 100%; background: var(--accent); border-radius: 2px; }

@media (max-width: 1200px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) {
  .sidebar {
    display: none;
    position: fixed;
    z-index: 950;
    width: 260px;
    box-shadow: 4px 0 24px rgba(0,0,0,0.4);
  }
  .sidebar.sidebar-open { display: flex; }
  .sidebar-toggle { display: flex; align-items: center; justify-content: center; }
  .charts-row { grid-template-columns: 1fr; }
  .dashboard-main { padding: 0 16px 48px; }
}
@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .dash-title h2 { font-size: 18px; }
  .table-header { flex-direction: column; align-items: flex-start; }
  .table-search { width: 100%; }
  .table-actions { width: 100%; }
  .data-table th, .data-table td { padding: 8px 10px; font-size: 12px; }
  .balance-chip { padding: 6px 10px; font-size: 12px; }
  .balance-chip strong { font-size: 13px; }
}

/* =========================================
   AUTH PAGES
   ========================================= */
.auth-page { min-height: 100vh; }
.auth-split { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }

.auth-left {
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  padding: 40px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.auth-logo { margin-bottom: 60px; }
.auth-left-content { position: relative; z-index: 1; }
.auth-left-content h2 {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 12px;
}
.auth-left-content p { color: var(--text-secondary); font-size: 16px; margin-bottom: 40px; }
.auth-perks { display: flex; flex-direction: column; gap: 20px; }
.perk { display: flex; align-items: center; gap: 12px; }
.perk span { font-size: 24px; }
.perk p { font-size: 15px; font-weight: 500; }
.auth-left-bg { position: absolute; inset: 0; pointer-events: none; }
.auth-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  animation: pulse-glow 4s ease infinite;
}
.auth-glow-1 {
  width: 300px; height: 300px;
  background: rgba(59,130,246,0.15);
  bottom: -80px; right: -80px;
}
.auth-glow-2 {
  width: 200px; height: 200px;
  background: rgba(139,92,246,0.1);
  top: 100px; right: 50px;
  animation-delay: 2s;
}

.auth-right {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.auth-box { width: 100%; max-width: 440px; }
.auth-box h3 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
}
.auth-sub { font-size: 14px; color: var(--text-muted); margin-bottom: 28px; }
.auth-sub a { color: var(--accent-bright); }

.oauth-btns { display: flex; gap: 10px; margin-bottom: 20px; }
.oauth-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.oauth-btn:hover { border-color: var(--border-bright); color: var(--text-primary); }
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  color: var(--text-muted);
  font-size: 12px;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.phone-input { display: flex; gap: 8px; }
.phone-area {
  width: 110px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  padding: 11px 10px;
  outline: none;
  flex-shrink: 0;
}
.phone-input input { flex: 1; }

.sms-input { display: flex; gap: 8px; }
.sms-input input { flex: 1; }
.btn-sms {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--accent-bright);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.btn-sms:hover { background: rgba(59,130,246,0.08); }
.btn-sms:disabled { color: var(--text-muted); cursor: default; }

.password-input { position: relative; }
.password-input input { padding-right: 44px; width: 100%; }
.toggle-pw {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-muted);
}
.password-strength { margin-top: 6px; display: flex; align-items: center; gap: 8px; }
.strength-bar { flex: 1; height: 3px; background: var(--bg-3); border-radius: 2px; overflow: hidden; }
.strength-fill { height: 100%; width: 0%; border-radius: 2px; transition: width 0.3s, background 0.3s; }
#strengthLabel { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

.auth-footer-note {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 16px;
}
.auth-footer-note a { color: var(--accent-bright); }

@media (max-width: 768px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-left { display: none; }
  .auth-right { padding: 40px 24px; align-items: flex-start; }
  .auth-box { max-width: 100%; }
  .auth-box h3 { font-size: 22px; }
  .oauth-btns { flex-direction: column; }
  .phone-input { flex-direction: column; }
  .phone-area { width: 100%; }
  .sms-input { flex-direction: column; }
  .btn-sms { width: 100%; text-align: center; }
}
@media (max-width: 480px) {
  .auth-right { padding: 24px 16px; }
  .auth-box h3 { font-size: 20px; }
}
