@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600&display=swap');

:root {
  --c-bg: #0f0a1e;
  --c-bg2: #1a1130;
  --c-surface: rgba(255,255,255,0.05);
  --c-surface2: rgba(255,255,255,0.08);
  --c-border: rgba(255,255,255,0.10);
  --c-primary: #7C3AED;
  --c-primary-light: #9B59F5;
  --c-primary-dark: #4C1D95;
  --c-gold: #F59E0B;
  --c-gold-light: #FCD34D;
  --c-success: #10B981;
  --c-danger: #EF4444;
  --c-warning: #F59E0B;
  --c-info: #3B82F6;
  --c-text: #F1F0F6;
  --c-text2: #A89FC0;
  --c-text3: #6B5F85;
  --c-mpesa: #e31e24;
  --c-airtel: #FF0000;
  --c-orange: #FF6600;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --shadow: 0 8px 32px rgba(124,58,237,0.15);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.5);
  --transition: 0.3s cubic-bezier(0.4,0,0.2,1);
  --sidebar-w: 260px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

h1,h2,h3,h4,h5,h6 { font-family: 'Outfit', sans-serif; line-height: 1.2; }

a { color: var(--c-primary-light); text-decoration: none; }
a:hover { color: var(--c-gold); }

img { max-width: 100%; display: block; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--c-bg2); }
::-webkit-scrollbar-thumb { background: var(--c-primary-dark); border-radius: 99px; }

/* ── Layout ── */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--c-bg2);
  border-right: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo img { width: 40px; height: 40px; border-radius: 10px; }
.sidebar-logo .brand { font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 1.1rem; }
.sidebar-logo .brand span { color: var(--c-gold); }

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }

.nav-section-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--c-text3);
  padding: 12px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--c-text2);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 2px;
  text-decoration: none;
}

.nav-item:hover { background: var(--c-surface2); color: var(--c-text); }
.nav-item.active {
  background: linear-gradient(135deg, var(--c-primary), var(--c-primary-dark));
  color: #fff;
  box-shadow: 0 4px 15px rgba(124,58,237,0.4);
}

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-badge { margin-left: auto; background: var(--c-danger); color: #fff; font-size: 0.65rem; font-weight: 700; padding: 2px 7px; border-radius: 99px; }

.sidebar-footer { padding: 16px 12px; border-top: 1px solid var(--c-border); }

.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: rgba(15,10,30,0.8);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--c-border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left { display: flex; align-items: center; gap: 16px; min-width: 0; }
.topbar-title { font-family: 'Outfit', sans-serif; font-size: 1.3rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.page-content { padding: 28px; flex: 1; min-width: 0; width: 100%; }

/* ── Cards ── */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 24px;
  backdrop-filter: blur(12px);
  max-width: 100%;
  overflow-x: hidden;
}

.card-glass {
  background: rgba(124,58,237,0.08);
  border: 1px solid rgba(124,58,237,0.2);
  border-radius: var(--radius);
  padding: 24px;
  backdrop-filter: blur(12px);
}

.card-gold {
  background: linear-gradient(135deg, rgba(245,158,11,0.15), rgba(252,211,77,0.08));
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: var(--radius);
  padding: 24px;
}

/* ── Stat cards ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 20px; margin-bottom: 28px; }

.stat-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 22px;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 50%;
  opacity: 0.12;
  background: var(--accent-color, var(--c-primary));
  transform: translate(20px,-20px);
}

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
  background: var(--accent-color, var(--c-primary));
  opacity: 0.9;
}

.stat-icon svg { width: 22px; height: 22px; color: #fff; }
.stat-label { font-size: 0.8rem; color: var(--c-text2); font-weight: 500; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-family: 'Outfit', sans-serif; font-size: 1.8rem; font-weight: 700; line-height: 1; }
.stat-change { font-size: 0.78rem; margin-top: 6px; }
.stat-change.up { color: var(--c-success); }
.stat-change.down { color: var(--c-danger); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  font-family: 'Inter', sans-serif;
  text-decoration: none;
  white-space: nowrap;
}

.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: linear-gradient(135deg, var(--c-primary), var(--c-primary-dark));
  color: #fff;
  box-shadow: 0 4px 15px rgba(124,58,237,0.35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(124,58,237,0.5); color: #fff; }

.btn-gold {
  background: linear-gradient(135deg, var(--c-gold), #D97706);
  color: #1a0a00;
  box-shadow: 0 4px 15px rgba(245,158,11,0.3);
}
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(245,158,11,0.45); color: #1a0a00; }

.btn-outline {
  background: transparent;
  color: var(--c-text);
  border: 1px solid var(--c-border);
}
.btn-outline:hover { background: var(--c-surface2); border-color: var(--c-primary); }

.btn-success { background: linear-gradient(135deg, var(--c-success), #059669); color: #fff; }
.btn-danger { background: linear-gradient(135deg, var(--c-danger), #DC2626); color: #fff; }

.btn-sm { padding: 7px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 32px; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── Forms ── */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--c-text2); margin-bottom: 8px; letter-spacing: 0.03em; }

.form-control {
  width: 100%;
  background: var(--c-surface2);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--c-text);
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.2);
}

.form-control::placeholder { color: var(--c-text3); }

select.form-control { cursor: pointer; }
select.form-control option { background: var(--c-bg2); }

.input-group { position: relative; }
.input-group .form-control { padding-left: 44px; }
.input-group .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--c-text3);
  display: flex;
  align-items: center;
}
.input-group .input-icon svg { width: 18px; height: 18px; }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; font-size: 0.75rem; font-weight: 600; }
.badge-success { background: rgba(16,185,129,0.15); color: var(--c-success); border: 1px solid rgba(16,185,129,0.3); }
.badge-danger { background: rgba(239,68,68,0.15); color: var(--c-danger); border: 1px solid rgba(239,68,68,0.3); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--c-gold); border: 1px solid rgba(245,158,11,0.3); }
.badge-info { background: rgba(59,130,246,0.15); color: var(--c-info); border: 1px solid rgba(59,130,246,0.3); }
.badge-primary { background: rgba(124,58,237,0.15); color: var(--c-primary-light); border: 1px solid rgba(124,58,237,0.3); }

/* ── Table ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
thead th { background: var(--c-surface2); padding: 12px 16px; font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--c-text2); text-align: left; border-bottom: 1px solid var(--c-border); }
tbody td { padding: 14px 16px; font-size: 0.88rem; border-bottom: 1px solid rgba(255,255,255,0.04); vertical-align: middle; }
tbody tr:hover { background: var(--c-surface); }
tbody tr:last-child td { border-bottom: none; }

/* ── Operator buttons ── */
.operator-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.operator-btn {
  background: var(--c-surface);
  border: 2px solid var(--c-border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: all var(--transition);
  color: var(--c-text);
  font-weight: 600;
  font-size: 0.85rem;
}
.operator-btn:hover { border-color: var(--c-primary); background: rgba(124,58,237,0.08); }
.operator-btn.selected { border-color: var(--c-primary); background: rgba(124,58,237,0.15); box-shadow: 0 0 20px rgba(124,58,237,0.3); }
.operator-dot { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1rem; color: #fff; }

/* ── PIN input ── */
.pin-inputs { display: flex; gap: 10px; justify-content: center; margin: 20px 0; }
.pin-input {
  width: 52px; height: 60px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--c-surface2);
  border: 2px solid var(--c-border);
  border-radius: var(--radius-sm);
  color: var(--c-text);
  outline: none;
  transition: border-color var(--transition);
  font-family: 'Outfit', sans-serif;
}
.pin-input:focus { border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(124,58,237,0.2); }

/* ── Progress / KYC Steps ── */
.steps-bar { display: flex; align-items: center; gap: 0; margin-bottom: 32px; }
.step { display: flex; flex-direction: column; align-items: center; flex: 1; position: relative; }
.step:not(:last-child)::after { content: ''; position: absolute; top: 18px; left: 50%; width: 100%; height: 2px; background: var(--c-border); z-index: 0; }
.step.done:not(:last-child)::after { background: var(--c-primary); }
.step-dot { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--c-border); background: var(--c-bg2); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; z-index: 1; position: relative; transition: all var(--transition); }
.step.active .step-dot { border-color: var(--c-primary); background: var(--c-primary); box-shadow: 0 0 15px rgba(124,58,237,0.5); color: #fff; }
.step.done .step-dot { border-color: var(--c-success); background: var(--c-success); color: #fff; }
.step-label { font-size: 0.72rem; margin-top: 6px; color: var(--c-text3); text-align: center; }
.step.active .step-label { color: var(--c-text); font-weight: 600; }

/* ── Alert / Toast ── */
.alert { padding: 14px 18px; border-radius: var(--radius-sm); font-size: 0.88rem; display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px; }
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-danger { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }
.alert-success { background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.3); color: #6ee7b7; }
.alert-warning { background: rgba(245,158,11,0.12); border: 1px solid rgba(245,158,11,0.3); color: var(--c-gold-light); }
.alert-info { background: rgba(59,130,246,0.12); border: 1px solid rgba(59,130,246,0.3); color: #93c5fd; }

/* ── Toast ── */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--c-bg2); border: 1px solid var(--c-border); border-radius: var(--radius-sm); padding: 14px 18px; font-size: 0.88rem; display: flex; align-items: center; gap: 10px; min-width: 280px; box-shadow: var(--shadow-lg); animation: slideInRight 0.3s ease; }
.toast svg { width: 18px; height: 18px; flex-shrink: 0; }
.toast.success { border-left: 4px solid var(--c-success); }
.toast.error { border-left: 4px solid var(--c-danger); }
.toast.info { border-left: 4px solid var(--c-info); }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 500; display: flex; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(4px); opacity: 0; pointer-events: none; transition: opacity var(--transition); }
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal { background: var(--c-bg2); border: 1px solid var(--c-border); border-radius: var(--radius-lg); padding: 32px; width: 100%; max-width: 480px; transform: scale(0.95) translateY(20px); transition: transform var(--transition); }
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.modal-title { font-family: 'Outfit', sans-serif; font-size: 1.2rem; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--c-text2); cursor: pointer; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 8px; transition: all var(--transition); }
.modal-close:hover { background: var(--c-surface2); color: var(--c-text); }

/* ── Divider ── */
.divider { height: 1px; background: var(--c-border); margin: 24px 0; }
.divider-text { display: flex; align-items: center; gap: 12px; color: var(--c-text3); font-size: 0.82rem; }
.divider-text::before, .divider-text::after { content: ''; flex: 1; height: 1px; background: var(--c-border); }

/* ── Avatar ── */
.avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, var(--c-primary), var(--c-gold)); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1rem; color: #fff; flex-shrink: 0; }

/* ── Spinner ── */
.spinner { width: 24px; height: 24px; border: 3px solid var(--c-border); border-top-color: var(--c-primary); border-radius: 50%; animation: spin 0.7s linear infinite; }

/* ── QR Container ── */
.qr-box { background: #fff; border-radius: var(--radius); padding: 20px; display: inline-flex; align-items: center; justify-content: center; margin: 0 auto; }

/* ── Chart Container ── */
.chart-container { position: relative; height: 300px; width: 100%; }

/* ── Responsive ── */
.hamburger { display: none; background: none; border: none; color: var(--c-text); cursor: pointer; padding: 6px; }
.hamburger svg { width: 24px; height: 24px; }

/* ── Responsive Grids ── */
.responsive-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.responsive-grid-2-1 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}
.responsive-three-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0) !important; z-index: 1000; }
  .main-content { margin-left: 0 !important; padding-bottom: 84px !important; }
  .hamburger { display: flex !important; align-items: center; justify-content: center; }
  .sidebar-overlay { display: none; }
  .sidebar-overlay.active { display: block !important; }
  .page-content { padding: 16px; }
  .stat-grid { grid-template-columns: repeat(2,1fr); gap: 12px; }
  .stat-card { padding: 14px 16px; }
  .stat-value { font-size: clamp(1.2rem, 4vw, 1.45rem); }
  .topbar { padding: 12px 16px; }
  .card { padding: 20px; }
  .card-glass { padding: 20px; }
  .card-gold { padding: 20px; }
  
  .responsive-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  .responsive-grid-2-1 {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  .responsive-three-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
}


  #userInfo { display: none !important; }
  #toast-container { bottom: 84px !important; right: 16px !important; left: 16px !important; width: auto !important; }

@media (max-width: 540px) {
  .page-content { padding: 12px; }
  .stat-grid { grid-template-columns: 1fr; gap: 10px; }
  .stat-value { font-size: clamp(1.25rem, 5vw, 1.4rem); }
  .operator-grid { grid-template-columns: 1fr; gap: 8px; }
  .operator-btn { padding: 12px; flex-direction: row; justify-content: flex-start; text-align: left; }
  .operator-dot { width: 36px; height: 36px; font-size: 0.9rem; margin-right: 12px; margin-bottom: 0; }
  .pin-input { width: 42px; height: 52px; font-size: 1.2rem; }
  .card { padding: 16px; }
  .card-glass { padding: 16px; }
  .card-gold { padding: 16px; }
  .topbar-title { font-size: 1.15rem; }
  .avatar { width: 32px; height: 32px; font-size: 0.85rem; }
  .section-title { font-size: 1rem; }
  
  /* Make inline button groups block on tiny screens */
  .btn-group-mobile { flex-direction: column; width: 100%; align-items: stretch !important; }
  .btn-group-mobile .btn { width: 100%; justify-content: center; }
}

/* ── Gradient text ── */
.gradient-text {
  background: linear-gradient(135deg, var(--c-primary-light), var(--c-gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Section header ── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-title { font-family: 'Outfit', sans-serif; font-size: 1.1rem; font-weight: 700; }

/* ── Sidebar overlay for mobile ── */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 99; }
.sidebar-overlay.open { display: block; }

/* ── Full page overlay ── */
.loading-screen { position: fixed; inset: 0; background: var(--c-bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; z-index: 9998; }
.loading-screen img { width: 80px; animation: pulse 1.5s ease infinite; }

/* ── Mobile Bottom Navigation Bar ── */
.mobile-bottom-nav {
  display: none;
}

@media (max-width: 900px) {
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 72px;
    background: rgba(10, 6, 22, 0.94);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    justify-content: space-around;
    align-items: center;
    z-index: 999;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.6);
    padding-left: 8px;
    padding-right: 8px;
  }
  
  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--c-text2);
    text-decoration: none;
    font-size: 0.68rem;
    font-weight: 600;
    height: 52px;
    padding: 6px 10px;
    border-radius: 14px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    max-width: 80px;
    flex: 1;
  }
  
  .mobile-nav-item svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.2;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .mobile-nav-item:active svg {
    transform: scale(0.85);
  }
  
  .mobile-nav-item.active {
    color: var(--c-primary-light);
    background: rgba(124, 58, 237, 0.15);
    box-shadow: inset 0 0 0 1px rgba(124, 58, 237, 0.15);
  }
  
  .mobile-nav-item.active svg {
    transform: scale(1.05);
    stroke-width: 2.4;
  }
}

