:root {
  --primary: #4361ee;
  --primary-dark: #3451d1;
  --primary-light: #eef0fd;
  --sidebar-w: 240px;
  --topbar-h: 58px;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,.06);
  --t: .2s ease;
}
*, *::before, *::after { box-sizing: border-box; }
body { font-family: 'Inter', system-ui, sans-serif; background: #f5f6fa; color: #2d3748; margin: 0; font-size: 14px; line-height: 1.5; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w); background: #1a1f36;
  display: flex; flex-direction: column;
  z-index: 1040; transition: transform var(--t); overflow: hidden;
}
.sidebar-brand {
  display: flex; align-items: center; padding: 0 18px;
  height: var(--topbar-h); color: #fff; font-weight: 700; font-size: 15px;
  border-bottom: 1px solid rgba(255,255,255,.07); flex-shrink: 0; gap: 10px;
}
.sidebar-brand i { font-size: 20px; color: var(--primary); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 0; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.08) transparent; }
.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 18px; color: rgba(255,255,255,.6);
  text-decoration: none; font-size: 13.5px; font-weight: 400;
  transition: color var(--t), background var(--t); margin: 1px 8px; border-radius: 8px;
}
.sidebar-nav .nav-link i { font-size: 17px; flex-shrink: 0; }
.sidebar-nav .nav-link:hover { color: #fff; background: rgba(255,255,255,.07); }
.sidebar-nav .nav-link.active { color: #fff; background: rgba(67,97,238,.25); border-left: 3px solid var(--primary); padding-left: 15px; }
.nav-divider { height: 1px; background: rgba(255,255,255,.07); margin: 6px 16px; }
.sidebar-footer { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.07); color: rgba(255,255,255,.65); }
.avatar-sm { width: 30px; height: 30px; background: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 12px; flex-shrink: 0; }

/* ── Main ────────────────────────────────────────────────── */
.main-content { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; transition: margin-left var(--t); }
.topbar { position: sticky; top: 0; height: var(--topbar-h); background: #fff; display: flex; align-items: center; padding: 0 22px; box-shadow: 0 1px 0 rgba(0,0,0,.06); z-index: 1030; gap: 12px; }
.breadcrumb-title { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content-area { padding: 20px; flex: 1; }

/* ── Cards ───────────────────────────────────────────────── */
.card { border: none; border-radius: var(--radius); box-shadow: var(--shadow); background: #fff; overflow: visible; }
.card-header { background: transparent; border-bottom: 1px solid #f0f0f0; padding: 14px 18px; font-weight: 600; font-size: 13.5px; }

/* ── Stat Cards ──────────────────────────────────────────── */
.stat-card { border-radius: var(--radius); padding: 18px; background: #fff; box-shadow: var(--shadow); display: flex; align-items: center; gap: 14px; transition: transform var(--t), box-shadow var(--t); text-decoration: none; color: inherit; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.1); color: inherit; }
.stat-icon { width: 44px; height: 44px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.stat-icon.blue   { background: #eef0fd; color: var(--primary); }
.stat-icon.green  { background: #e8f8f0; color: #22c55e; }
.stat-icon.orange { background: #fff5e6; color: #f59e0b; }
.stat-icon.red    { background: #fef2f2; color: #ef4444; }
.stat-icon.purple { background: #f5f0ff; color: #8b5cf6; }
.stat-icon.teal   { background: #e0f7f6; color: #14b8a6; }
.stat-value { font-size: 22px; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: 12px; color: #718096; margin-top: 3px; }
.stat-change { font-size: 11px; margin-top: 3px; }
.stat-change.up { color: #22c55e; }
.stat-change.down { color: #ef4444; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn { border-radius: 8px; font-weight: 500; font-size: 13px; transition: all var(--t); }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ── Tables ──────────────────────────────────────────────── */
.table { font-size: 13px; margin-bottom: 0; width: 100% !important; }
.table > thead > tr > th {
  background: #f8f9fc; font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .05em; color: #718096;
  border-top: none; white-space: nowrap; padding: 10px 14px;
  position: sticky; top: 0;
}
.table > tbody > tr { transition: background var(--t); }
.table > tbody > tr:hover { background: #f8f9fc; }
.table td { padding: 10px 14px; vertical-align: middle; }
/* DataTables scroll wrapper */
.dt-scroll-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.dataTables_wrapper { width: 100%; }
.dataTables_wrapper .dataTables_filter input { border-radius: 8px; border: 1.5px solid #e2e8f0; padding: 6px 12px; font-size: 13px; outline: none; }
.dataTables_wrapper .dataTables_filter input:focus { border-color: var(--primary); }
.dataTables_wrapper .dataTables_length select { border-radius: 8px; border: 1.5px solid #e2e8f0; padding: 5px 8px; }
.dataTables_wrapper .dataTables_paginate .paginate_button { border-radius: 6px !important; font-size: 13px !important; padding: 4px 10px !important; }
.dataTables_wrapper .dataTables_paginate .paginate_button.current { background: var(--primary) !important; border-color: var(--primary) !important; color: #fff !important; }
.dataTables_wrapper .dataTables_info { font-size: 12px; color: #718096; }
.dt-top { padding: 14px 18px 0; }
.dt-bot { padding: 10px 18px 14px; }

/* ── Forms ───────────────────────────────────────────────── */
.form-control, .form-select { border-radius: 8px; font-size: 13px; border-color: #e2e8f0; padding: 9px 12px; transition: border-color var(--t), box-shadow var(--t); }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(67,97,238,.12); }
.form-label { font-weight: 500; font-size: 13px; margin-bottom: 5px; color: #4a5568; }

/* ── Badges ──────────────────────────────────────────────── */
.badge { border-radius: 6px; font-weight: 500; font-size: 11px; padding: 3px 8px; }

/* ── Auth ────────────────────────────────────────────────── */
.auth-wrapper { min-height: 100vh; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { background: #fff; border-radius: 16px; padding: 40px; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,.15); }
.auth-logo { font-size: 26px; font-weight: 800; color: var(--primary); margin-bottom: 6px; }
.auth-subtitle { color: #718096; font-size: 14px; margin-bottom: 26px; }

/* ── Admin Mobile Bottom Nav ─────────────────────────────── */
.admin-bottom-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0;
  background: #1a1f36; border-top: 1px solid rgba(255,255,255,.07);
  z-index: 1050; padding: 4px 0 env(safe-area-inset-bottom, 4px);
}
.admin-bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  text-decoration: none; color: rgba(255,255,255,.45); font-size: 9px;
  gap: 2px; padding: 5px 2px 3px; min-width: 0;
}
.admin-bottom-nav a.active, .admin-bottom-nav a:hover { color: #fff; }
.admin-bottom-nav a.active i { color: var(--primary); }
.admin-bottom-nav i { font-size: 20px; display: block; }
.admin-bottom-nav span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52px; text-align: center; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 8px 0 32px rgba(0,0,0,.25); }
  .main-content { margin-left: 0; }
  .admin-bottom-nav { display: flex; }
  .content-area { padding: 14px 12px 76px; }
  .sidebar-overlay { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1039; }
  .stat-card { padding: 12px; gap: 10px; }
  .stat-value { font-size: 18px; }
  .stat-icon { width: 38px; height: 38px; font-size: 17px; border-radius: 9px; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 14px; }
  .topbar { padding: 0 14px; }
  .topbar .ms-auto { display: none !important; }
  .auth-card { padding: 28px 20px; }
}
@media (max-width: 480px) {
  .stat-value { font-size: 15px; }
  .stat-card { padding: 10px 8px; gap: 8px; }
  .stat-icon { width: 34px; height: 34px; font-size: 15px; }
  .content-area { padding: 10px 8px 76px; }
}

/* ── Utilities ───────────────────────────────────────────── */
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.flex-1 { flex: 1; min-width: 0; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.page-title { font-size: 18px; font-weight: 700; margin: 0; }
.sidebar-toggle { background: none; border: none; cursor: pointer; }
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ── Timeline ────────────────────────────────────────────── */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 0; bottom: 0; width: 2px; background: #f0f0f0; }
.timeline-item { position: relative; margin-bottom: 14px; }
.timeline-item::before { content: ''; position: absolute; left: -19px; top: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--primary); }
.timeline-time { font-size: 11px; color: #a0aec0; margin-bottom: 1px; }
.timeline-text { font-size: 13px; }

/* ── Animations ──────────────────────────────────────────── */
.fade-in { animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ── Install ─────────────────────────────────────────────── */
.install-wrapper { min-height: 100vh; background: #f5f6fa; display: flex; align-items: center; justify-content: center; padding: 20px; }
.install-card { background: #fff; border-radius: 16px; padding: 40px; width: 100%; max-width: 520px; box-shadow: 0 4px 24px rgba(0,0,0,.08); }
.install-step { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f0f0f0; }
.install-step:last-child { border: none; }
.step-num { width: 28px; height: 28px; border-radius: 50%; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
