:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --sidebar-w: 255px;
  --topbar-h: 60px;
}

* { box-sizing: border-box; }
body { font-family: 'Inter', system-ui, sans-serif; background: #f0f2f5; font-size: .9rem; }

/* ── Sidebar ──────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); min-height: 100vh;
  background: #1e1b4b; color: #a5b4fc;
  flex-shrink: 0; overflow-y: auto;
  position: sticky; top: 0; max-height: 100vh;
}
.sidebar-brand {
  display: flex; align-items: center; gap: .75rem;
  padding: 1.25rem 1rem; border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 800; flex-shrink: 0;
}
.brand-name { color: #fff; font-weight: 700; font-size: 1.1rem; }
.sidebar-nav { padding: .5rem .75rem 2rem; }
.nav-section {
  font-size: .65rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: #6d7dc4;
  padding: 1rem .5rem .25rem;
}
.sidebar .nav-link {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem .75rem; border-radius: 8px;
  color: #a5b4fc; text-decoration: none;
  font-weight: 500; font-size: .85rem;
  margin-bottom: 2px; transition: background .15s, color .15s;
}
.sidebar .nav-link i { font-size: 1rem; flex-shrink: 0; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.07); color: #e0e7ff; }
.sidebar .nav-link.active { background: var(--primary); color: #fff; }

/* ── Topbar ───────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h); background: #fff;
  border-bottom: 1px solid #e5e7eb;
  position: sticky; top: 0; z-index: 800;
}

/* ── Page content ─────────────────────────────────────────────────── */
.page-title { font-size: 1.35rem; font-weight: 700; margin: 0; }

/* ── Stat cards ──────────────────────────────────────────────────── */
.stat-card {
  border-radius: 14px; padding: 1.1rem;
  display: flex; align-items: center; gap: .9rem; color: #fff;
}
.stat-green  { background: linear-gradient(135deg,#10b981,#059669); }
.stat-blue   { background: linear-gradient(135deg,#3b82f6,#1d4ed8); }
.stat-orange { background: linear-gradient(135deg,#f59e0b,#d97706); }
.stat-purple { background: linear-gradient(135deg,#8b5cf6,#6d28d9); }
.stat-red    { background: linear-gradient(135deg,#ef4444,#b91c1c); }
.stat-icon {
  width: 46px; height: 46px; background: rgba(255,255,255,.22);
  border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; flex-shrink: 0;
}
.stat-label { font-size: .72rem; opacity: .85; }
.stat-val   { font-size: 1.25rem; font-weight: 700; line-height: 1.1; }

/* ── Quick action buttons ─────────────────────────────────────────── */
.quick-btn {
  display: flex; flex-direction: column; align-items: center;
  gap: .4rem; padding: 1rem .75rem;
  background: #fff; border: 2px solid #e5e7eb; border-radius: 12px;
  color: #1e293b; text-decoration: none; font-size: .78rem; font-weight: 600;
  text-align: center; transition: border-color .15s, box-shadow .15s;
}
.quick-btn i { font-size: 1.4rem; color: var(--primary); }
.quick-btn:hover { border-color: var(--primary); box-shadow: 0 0 0 3px #eef2ff; color: var(--primary); }

/* ── Avatar ───────────────────────────────────────────────────────── */
.avatar-sm {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .8rem; flex-shrink: 0;
}

/* ── Method badges ────────────────────────────────────────────────── */
.badge.method-mpesa   { background:#dcfce7 !important; color:#166534; }
.badge.method-card,
.badge.method-stripe  { background:#dbeafe !important; color:#1e40af; }
.badge.method-paypal  { background:#fef3c7 !important; color:#92400e; }
.badge.method-cashapp { background:#d1fae5 !important; color:#065f46; }
.badge.method-crypto  { background:#fef9c3 !important; color:#713f12; }
.badge.method-bank    { background:#f1f5f9 !important; color:#475569; }
.badge.method-wallet  { background:#e0e7ff !important; color:#3730a3; }

/* ── Cards ────────────────────────────────────────────────────────── */
.card { border-radius: 12px !important; }

/* ── Forms ────────────────────────────────────────────────────────── */
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.btn-primary { background: var(--primary); border-color: var(--primary); font-weight: 600; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

/* ── Auth pages ───────────────────────────────────────────────────── */
.auth-bg {
  min-height: 100vh;
  background: linear-gradient(135deg,#1e1b4b,#4f46e5);
  display: flex; align-items: center; justify-content: center; padding: 1.5rem;
}
.auth-wrap { width: 100%; max-width: 430px; }
.auth-card { background: #fff; border-radius: 20px; padding: 2.25rem; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.brand-icon-lg {
  width: 52px; height: 52px; border-radius: 14px;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; font-weight: 800;
}
.brand-title { font-size: 1.4rem; font-weight: 800; color: #1e1b4b; margin: .5rem 0 .2rem; }
.brand-sub   { color: #94a3b8; font-size: .82rem; margin: 0; }

/* ── Payment page method picker ──────────────────────────────────── */
.method-opt {
  border: 2px solid #e5e7eb; border-radius: 10px;
  padding: .75rem .5rem; text-align: center;
  cursor: pointer; font-size: .78rem; font-weight: 600;
  transition: border-color .15s, background .15s;
}
.method-opt:hover { border-color: #a5b4fc; background: #f5f3ff; }
.method-opt.active { border-color: var(--primary); background: #eef2ff; color: var(--primary); }

/* ── Tables ───────────────────────────────────────────────────────── */
.table th { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #94a3b8; }
.table td { font-size: .875rem; }

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .sidebar { position: fixed; left: 0; top: 0; height: 100vh; z-index: 1050; transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: translateX(0); }
  .wrapper { display: block !important; }
  .main-content { margin-left: 0 !important; }
}

/* ── Sticky top ────────────────────────────────────────────────────── */
.sticky-top { position: sticky; }

/* ── Invoice table tfoot ──────────────────────────────────────────── */
.table tfoot tr td { padding:.5rem .5rem; }

/* ── Disbursement method labels ─────────────────────────────────────  */
.method-label {
  display:flex; flex-direction:column; align-items:center;
  gap:.25rem; padding:.7rem .5rem;
  border:2px solid #e5e7eb; border-radius:10px;
  cursor:pointer; transition:all .15s;
}
.method-label:hover, .method-label.active {
  border-color: #4f46e5; background: #eef2ff; color: #4f46e5;
}

/* ── Code blocks in API docs ─────────────────────────────────────────────── */
pre { margin: 0; overflow-x: auto; font-size: .8rem; line-height: 1.5; }
pre code { font-size: inherit; }

/* ── Avatar large ────────────────────────────────────────────────────────── */
.avatar-lg {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 700; flex-shrink: 0;
}

/* ── Invoice brand icon small ────────────────────────────────────────────── */
.brand-icon-sm {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .9rem;
}

/* ── Navigation active underline fix ─────────────────────────────────────── */
.sidebar .nav-link.text-danger:hover { background: rgba(239,68,68,.08); color: #dc2626 !important; }

/* ── Topbar wallet badge ──────────────────────────────────────────────────── */
.topbar .wallet-badge { font-size: .78rem; font-weight: 600; }

/* ── Table striped light ─────────────────────────────────────────────────── */
.table-sm td { font-size: .82rem; }

/* ── Modal fixes ──────────────────────────────────────────────────────────── */
.modal-content { border: 0; border-radius: 14px; }
.modal-header  { padding: 1.25rem 1.5rem .75rem; }
.modal-body    { padding: 1rem 1.5rem; }
.modal-footer  { padding: .75rem 1.5rem 1.25rem; }

/* ── Pay page specifics ───────────────────────────────────────────────────── */
.pay-page .method-opt { cursor: pointer; transition: all .15s; }
.pay-page .method-opt:hover { border-color: var(--primary); }
.pay-page .method-opt.active { border-color: var(--primary); background: #eef2ff; color: var(--primary); }

/* ── Stat card value on small screen ─────────────────────────────────────── */
@media (max-width: 575.98px) {
  .stat-val  { font-size: 1rem; }
  .stat-icon { width: 38px; height: 38px; font-size: 1.1rem; }
}

/* ── Yellow stat card ─────────────────────────────────────────────────────── */
.stat-card.stat-yellow .stat-icon { background: #fef9c3; color: #ca8a04; }

/* ── Wallet method-opt (same as pay page) ─────────────────────────────────── */
.method-opt { cursor: pointer; border: 2px solid #e5e7eb; border-radius: 12px;
              padding: .6rem .4rem; text-align: center; transition: all .15s; user-select: none; }
.method-opt:hover  { border-color: #4f46e5; background: #f5f3ff; }
.method-opt.active { border-color: #4f46e5; background: #eef2ff; color: #4f46e5; }
