/* ================================================================
   Prasad Electronic POS — Global Design System
   Modern Blue Gradient Theme | Dark Mode Enabled
   Font: Inter (Google Fonts)
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── CSS Custom Properties ─────────────────────────────────────── */
:root {
  /* Blue Gradient Palette */
  --primary:        #1a56db;
  --primary-dark:   #1342a8;
  --primary-light:  #3b82f6;
  --primary-glow:   rgba(26, 86, 219, 0.25);
  --sky:            #0ea5e9;
  --sky-light:      #38bdf8;

  /* Gradients */
  --grad-primary:   linear-gradient(135deg, #1a56db 0%, #0ea5e9 100%);
  --grad-dark:      linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  --grad-card:      linear-gradient(135deg, #1e40af 0%, #1d4ed8 100%);
  --grad-success:   linear-gradient(135deg, #059669 0%, #10b981 100%);
  --grad-warning:   linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
  --grad-danger:    linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
  --grad-info:      linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
  --grad-purple:    linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);

  /* Surface Colors (Light Mode) */
  --bg-body:        #f0f4ff;
  --bg-sidebar:     #0f172a;
  --bg-topbar:      #ffffff;
  --bg-card:        #ffffff;
  --bg-modal:       #ffffff;
  --bg-input:       #f8fafc;
  --bg-hover:       #f1f5fe;
  --bg-table-head:  #f1f5ff;
  --bg-table-alt:   #f8faff;

  /* Text */
  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;
  --text-white:     #ffffff;
  --text-sidebar:   #cbd5e1;
  --text-sidebar-active: #ffffff;

  /* Borders */
  --border-color:   #e2e8f0;
  --border-light:   #f1f5f9;

  /* Shadows */
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md:      0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.05);
  --shadow-lg:      0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --shadow-xl:      0 20px 25px rgba(0,0,0,0.1), 0 10px 10px rgba(0,0,0,0.04);
  --shadow-glow:    0 0 20px var(--primary-glow);
  --shadow-card:    0 4px 24px rgba(26, 86, 219, 0.08);

  /* Layout */
  --sidebar-width:     260px;
  --sidebar-collapsed: 70px;
  --topbar-height:     64px;
  --border-radius:     12px;
  --border-radius-sm:  8px;
  --border-radius-lg:  16px;
  --border-radius-xl:  24px;

  /* Transitions */
  --transition:        0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast:   0.15s ease;
  --transition-slow:   0.4s ease;
}

/* ── Dark Mode ─────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg-body:        #0a0f1e;
  --bg-sidebar:     #050d1a;
  --bg-topbar:      #0f172a;
  --bg-card:        #111827;
  --bg-modal:       #1f2937;
  --bg-input:       #1f2937;
  --bg-hover:       #1e293b;
  --bg-table-head:  #1e293b;
  --bg-table-alt:   #111827;
  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;
  --border-color:   #1e293b;
  --border-light:   #1e293b;
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:      0 4px 6px rgba(0,0,0,0.4);
  --shadow-lg:      0 10px 15px rgba(0,0,0,0.5);
  --shadow-card:    0 4px 24px rgba(0,0,0,0.4);
}

/* ── Reset & Base ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition: background-color var(--transition), color var(--transition);
  overflow-x: hidden;
}

/* ── Scrollbar ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ================================================================
   SIDEBAR
   ================================================================ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: width var(--transition);
  overflow: hidden;
  box-shadow: 4px 0 24px rgba(0,0,0,0.3);
}

.sidebar.collapsed { width: var(--sidebar-collapsed); }

/* Sidebar Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  height: var(--topbar-height);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  text-decoration: none;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-brand-icon {
  width: 36px;
  height: 36px;
  background: var(--grad-primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
  color: white;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-brand-text .brand-name {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.sidebar-brand-text .brand-sub {
  font-size: 10px;
  color: rgba(255,255,255,0.45);
  font-weight: 400;
}

/* Sidebar Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); }

.nav-section-title {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,0.25);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 16px 20px 6px;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar.collapsed .nav-section-title { opacity: 0; height: 0; padding: 0; }

.nav-item { position: relative; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  color: var(--text-sidebar);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-radius: 0;
  transition: all var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  position: relative;
  margin: 1px 8px;
  border-radius: 8px;
}

.nav-link:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
  transform: translateX(2px);
}

.nav-link.active {
  background: var(--grad-primary);
  color: #fff;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.nav-link.active::before {
  content: '';
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 60%;
  background: var(--sky-light);
  border-radius: 2px 0 0 2px;
}

.nav-link .nav-icon {
  font-size: 17px;
  flex-shrink: 0;
  width: 22px;
  text-align: center;
}

.nav-link .nav-label { transition: opacity var(--transition); }
.sidebar.collapsed .nav-link .nav-label { opacity: 0; width: 0; overflow: hidden; }

.nav-link .badge {
  margin-left: auto;
  font-size: 10px;
  padding: 2px 6px;
  flex-shrink: 0;
}

.sidebar.collapsed .nav-link .badge { display: none; }

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 10px;
  text-decoration: none;
  transition: background var(--transition-fast);
  overflow: hidden;
}

.sidebar-user:hover { background: rgba(255,255,255,0.06); }

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--primary-light);
}

.sidebar-user-avatar-placeholder {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--grad-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.sidebar-user-info { overflow: hidden; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: rgba(255,255,255,0.4); text-transform: capitalize; }

.sidebar.collapsed .sidebar-user-info { display: none; }

/* ================================================================
   TOPBAR
   ================================================================ */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--topbar-height);
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 24px;
  z-index: 999;
  gap: 16px;
  transition: left var(--transition);
  box-shadow: var(--shadow-sm);
}

.sidebar.collapsed ~ .topbar,
body.sidebar-collapsed .topbar { left: var(--sidebar-collapsed); }

.topbar-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.topbar-toggle:hover { background: var(--bg-hover); color: var(--primary); }

.topbar-breadcrumb {
  flex: 1;
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-breadcrumb .current {
  color: var(--text-primary);
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-btn {
  position: relative;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  padding: 8px;
  border-radius: 10px;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.topbar-btn:hover { background: var(--bg-hover); color: var(--primary); }

.topbar-badge {
  position: absolute;
  top: 4px; right: 4px;
  width: 16px; height: 16px;
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-topbar);
}

.theme-toggle {
  background: var(--bg-hover);
  border: none;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 10px;
  transition: all var(--transition-fast);
}

.theme-toggle:hover { color: var(--primary); }

/* Search Bar */
.topbar-search {
  position: relative;
  flex: 1;
  max-width: 360px;
}

.topbar-search input {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  padding: 8px 12px 8px 36px;
  font-size: 13px;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  transition: border-color var(--transition-fast);
  outline: none;
}

.topbar-search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.topbar-search .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 15px;
}

/* ================================================================
   MAIN CONTENT
   ================================================================ */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--topbar-height);
  padding: 24px;
  min-height: calc(100vh - var(--topbar-height));
  transition: margin-left var(--transition);
}

body.sidebar-collapsed .main-content { margin-left: var(--sidebar-collapsed); }

/* ================================================================
   CARDS
   ================================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow var(--transition);
}

.card:hover { box-shadow: var(--shadow-lg); }

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body { padding: 20px; }

/* ── Stat Cards ─────────────────────────────────────────────────── */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-card);
  transition: all var(--transition);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  position: relative;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px;
  height: 100%;
  background: var(--stat-color, var(--primary));
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-xl);
  border-color: var(--stat-color, var(--primary));
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #fff;
  flex-shrink: 0;
  background: var(--stat-color, var(--primary));
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.stat-info { flex: 1; min-width: 0; }

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}

.stat-value.money { font-size: 18px; }

.stat-trend {
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 4px;
}

.stat-trend.up   { color: #10b981; }
.stat-trend.down { color: #ef4444; }

/* ── Gradient Stat Cards ─────────────────────────────────────────── */
.stat-card-gradient {
  background: var(--stat-gradient, var(--grad-primary));
  border: none;
  color: #fff;
}

.stat-card-gradient::before { display: none; }
.stat-card-gradient .stat-label { color: rgba(255,255,255,0.75); }
.stat-card-gradient .stat-value { color: #fff; }
.stat-card-gradient .stat-icon { background: rgba(255,255,255,0.2); }
.stat-card-gradient .stat-trend.up   { color: rgba(255,255,255,0.9); }
.stat-card-gradient .stat-trend.down { color: rgba(255,255,255,0.7); }

/* ================================================================
   TABLES
   ================================================================ */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.table-responsive { overflow-x: auto; }

table.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

table.table thead th {
  background: var(--bg-table-head);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

table.table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  color: var(--text-primary);
}

table.table tbody tr:last-child td { border-bottom: none; }

table.table tbody tr:hover td { background: var(--bg-hover); }
table.table tbody tr:nth-child(even) td { background: var(--bg-table-alt); }
table.table tbody tr:nth-child(even):hover td { background: var(--bg-hover); }

/* ================================================================
   FORMS
   ================================================================ */
.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.form-control, .form-select {
  background: var(--bg-input);
  border: 1.5px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  padding: 9px 12px;
  transition: all var(--transition-fast);
  outline: none;
  width: 100%;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: var(--bg-card);
}

.form-control::placeholder { color: var(--text-muted); }

.input-group-text {
  background: var(--bg-table-head);
  border: 1.5px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 13px;
}

/* ================================================================
   BUTTONS
   ================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--border-radius-sm);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: 'Inter', sans-serif;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--grad-primary);
  color: #fff;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  box-shadow: 0 6px 20px var(--primary-glow);
  transform: translateY(-1px);
  color: #fff;
}

.btn-success { background: var(--grad-success); color: #fff; }
.btn-success:hover { opacity: 0.9; transform: translateY(-1px); color: #fff; }

.btn-danger  { background: var(--grad-danger);  color: #fff; }
.btn-danger:hover  { opacity: 0.9; transform: translateY(-1px); color: #fff; }

.btn-warning { background: var(--grad-warning); color: #fff; }
.btn-warning:hover { opacity: 0.9; transform: translateY(-1px); color: #fff; }

.btn-info    { background: var(--grad-info);    color: #fff; }
.btn-info:hover    { opacity: 0.9; transform: translateY(-1px); color: #fff; }

.btn-secondary {
  background: var(--bg-table-head);
  color: var(--text-secondary);
  border: 1.5px solid var(--border-color);
}

.btn-secondary:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-outline-primary {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}

.btn-outline-primary:hover { background: var(--primary); color: #fff; }

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon { padding: 8px; border-radius: 8px; }

/* ================================================================
   BADGES
   ================================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
}

.bg-primary   { background: var(--primary) !important; }
.bg-success   { background: #059669 !important; }
.bg-danger    { background: #dc2626 !important; }
.bg-warning   { background: #d97706 !important; }
.bg-info      { background: #0284c7 !important; }
.bg-secondary { background: #475569 !important; }
.bg-purple    { background: #7c3aed !important; }

/* ================================================================
   ALERTS & TOASTS
   ================================================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--border-radius-sm);
  font-size: 13px;
  border: none;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}

.alert-success { background: rgba(16,185,129,0.12); color: #059669; border-left: 4px solid #10b981; }
.alert-danger  { background: rgba(239,68,68,0.12);  color: #dc2626; border-left: 4px solid #ef4444; }
.alert-warning { background: rgba(245,158,11,0.12); color: #d97706; border-left: 4px solid #f59e0b; }
.alert-info    { background: rgba(14,165,233,0.12); color: #0284c7; border-left: 4px solid #0ea5e9; }

/* Toast Notifications */
#toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}

.toast-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: slideInRight 0.3s ease;
  border-left: 4px solid var(--primary);
}

.toast-item.success { border-left-color: #10b981; }
.toast-item.error   { border-left-color: #ef4444; }
.toast-item.warning { border-left-color: #f59e0b; }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);   opacity: 1; }
}

/* ================================================================
   PAGE HEADER
   ================================================================ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  margin: 0;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.breadcrumb {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  list-style: none;
  padding: 0;
}

.breadcrumb-item + .breadcrumb-item::before {
  content: '/';
  color: var(--text-muted);
}

.breadcrumb-item a { color: var(--primary); text-decoration: none; }
.breadcrumb-item.active { color: var(--text-secondary); }

/* ================================================================
   MODALS
   ================================================================ */
.modal-backdrop {
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
}

.modal-content {
  background: var(--bg-modal);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-xl);
}

.modal-header {
  background: transparent;
  border-bottom: 1px solid var(--border-color);
  padding: 18px 24px;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-body { padding: 24px; }

.modal-footer {
  border-top: 1px solid var(--border-color);
  padding: 16px 24px;
  gap: 8px;
}

/* ================================================================
   LOADING & SPINNERS
   ================================================================ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255,255,255,0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.btn-loading { position: relative; pointer-events: none; }
.btn-loading::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  right: 10px;
}

/* ================================================================
   UTILITIES
   ================================================================ */
.text-primary-color { color: var(--primary) !important; }
.text-muted-custom  { color: var(--text-muted) !important; }
.text-gradient {
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.bg-card  { background: var(--bg-card)  !important; }
.bg-body  { background: var(--bg-body)  !important; }
.bg-input { background: var(--bg-input) !important; }

.rounded-custom   { border-radius: var(--border-radius) !important; }
.rounded-custom-sm { border-radius: var(--border-radius-sm) !important; }
.shadow-custom    { box-shadow: var(--shadow-card) !important; }

.avatar {
  border-radius: 50%;
  object-fit: cover;
  display: inline-block;
}

.avatar-sm  { width: 32px;  height: 32px; }
.avatar-md  { width: 44px;  height: 44px; }
.avatar-lg  { width: 60px;  height: 60px; }
.avatar-xl  { width: 80px;  height: 80px; }

.avatar-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--grad-primary);
  color: #fff;
  font-weight: 700;
}

.divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 16px 0;
}

.gap-8 { gap: 8px; }

/* Filter Bar */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

/* DataTable overrides */
.dataTables_wrapper { padding: 0; }
.dataTables_filter input {
  background: var(--bg-input) !important;
  border: 1.5px solid var(--border-color) !important;
  border-radius: 8px !important;
  color: var(--text-primary) !important;
  padding: 6px 10px !important;
  font-family: 'Inter', sans-serif;
  outline: none;
}
.dataTables_filter input:focus { border-color: var(--primary) !important; }

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
  }
  .sidebar.mobile-open { transform: translateX(0); }

  .topbar { left: 0 !important; }
  .main-content { margin-left: 0 !important; }

  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
  }
}

@media (max-width: 576px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .main-content { padding: 16px 12px; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .topbar-search { display: none; }
}

/* ================================================================
   ANIMATIONS
   ================================================================ */
@keyframes fadeIn    { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp   { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes scaleIn   { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes pulse     { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

.animate-fade   { animation: fadeIn 0.3s ease; }
.animate-up     { animation: slideUp 0.4s ease; }
.animate-scale  { animation: scaleIn 0.3s ease; }

/* Staggered children */
.stagger-children > *:nth-child(1) { animation-delay: 0s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.25s; }

/* ================================================================
   PRINT
   ================================================================ */
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main-content { margin: 0 !important; padding: 0 !important; }
  body { background: #fff !important; }
}
