/* ============================================================
   Mailscr.us Admin Portal — Layout & Theme
   Tech theme: Blue/Cyan on dark sidebar
   ============================================================ */

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

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --sidebar-bg-start : #0f172a;
  --sidebar-bg-end   : #1e1b4b;
  --sidebar-width    : 260px;
  --sidebar-collapsed: 68px;
  --primary          : #2563eb;
  --primary-hover    : #1d4ed8;
  --primary-light    : rgba(37,99,235,.12);
  --accent           : #06b6d4;
  --accent-light     : rgba(6,182,212,.12);
  --success          : #10b981;
  --warning          : #f59e0b;
  --danger           : #ef4444;
  --bg               : #f1f5f9;
  --card             : #ffffff;
  --text-main        : #0f172a;
  --text-muted       : #64748b;
  --text-light       : #94a3b8;
  --border           : #e2e8f0;
  --border-dark      : #cbd5e1;
  --shadow-sm        : 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow           : 0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -1px rgba(0,0,0,.04);
  --shadow-md        : 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -2px rgba(0,0,0,.04);
  --shadow-lg        : 0 20px 25px -5px rgba(0,0,0,.1), 0 10px 10px -5px rgba(0,0,0,.04);
  --radius           : 12px;
  --radius-sm        : 8px;
  --radius-xs        : 6px;
  --transition       : 0.2s ease;
  --header-height    : 64px;
  --font             : 'Inter', system-ui, -apple-system, sans-serif;
}

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-main);
  margin: 0;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* ── App Shell ─────────────────────────────────────────────── */
.app-wrapper { display: flex; min-height: 100vh; }

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: linear-gradient(175deg, var(--sidebar-bg-start) 0%, var(--sidebar-bg-end) 100%);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1000;
  transition: width var(--transition);
  overflow: hidden;
  box-shadow: 4px 0 24px rgba(0,0,0,.15);
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }

/* Logo area */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  min-height: var(--header-height);
  overflow: hidden;
}
.sidebar-brand .brand-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(37,99,235,.4);
}
.sidebar-brand .brand-text {
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: opacity var(--transition), max-width var(--transition);
  max-width: 200px;
}
.sidebar-brand .brand-name {
  font-size: 15px; font-weight: 700;
  color: #fff;
  letter-spacing: -.3px;
  white-space: nowrap;
}
.sidebar-brand .brand-sub {
  font-size: 10px; font-weight: 500;
  color: rgba(255,255,255,.4);
  text-transform: uppercase; letter-spacing: 1px;
}
.sidebar.collapsed .brand-text { opacity: 0; max-width: 0; }

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

.nav-section-label {
  font-size: 10px; font-weight: 600;
  color: rgba(255,255,255,.3);
  text-transform: uppercase; letter-spacing: 1.2px;
  padding: 16px 20px 6px;
  white-space: nowrap;
  transition: opacity var(--transition);
}
.sidebar.collapsed .nav-section-label { opacity: 0; height: 0; padding: 0; overflow: hidden; }

.nav-item { list-style: none; margin: 2px 8px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px !important;
  border-radius: 10px !important;
  color: rgba(255,255,255,.65) !important;
  font-size: 13.5px; font-weight: 500 !important;
  transition: all var(--transition) !important;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
}
.nav-link:hover {
  background: rgba(255,255,255,.08) !important;
  color: #fff !important;
}
.nav-link.active {
  background: linear-gradient(135deg, rgba(37,99,235,.35), rgba(6,182,212,.2)) !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(37,99,235,.25) !important;
}
.nav-link.active::before {
  content: '';
  position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.nav-link .nav-icon {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  border-radius: 8px;
  background: rgba(255,255,255,.05);
  transition: background var(--transition);
}
.nav-link.active .nav-icon,
.nav-link:hover .nav-icon { background: rgba(255,255,255,.12); }
.nav-link .nav-text { transition: opacity var(--transition); flex: 1; }
.sidebar.collapsed .nav-link { justify-content: center; padding: 10px !important; }
.sidebar.collapsed .nav-text,
.sidebar.collapsed .nav-badge { opacity: 0; width: 0; overflow: hidden; }

.nav-badge {
  font-size: 10px; font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  background: var(--primary);
  color: #fff;
  flex-shrink: 0;
  transition: opacity var(--transition);
}

/* Sidebar footer */
.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid rgba(255,255,255,.07);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background var(--transition);
  overflow: hidden;
}
.sidebar-user:hover { background: rgba(255,255,255,.08); }
.sidebar-user .user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.sidebar-user .user-info { flex: 1; overflow: hidden; transition: opacity var(--transition); }
.sidebar-user .user-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .user-role { font-size: 11px; color: rgba(255,255,255,.4); }
.sidebar.collapsed .sidebar-user .user-info { opacity: 0; width: 0; }
.sidebar.collapsed .sidebar-user { justify-content: center; }

.sidebar-toggle {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.5);
  cursor: pointer;
  transition: all var(--transition);
  margin-left: auto;
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: rgba(255,255,255,.12); color: #fff; }
.sidebar.collapsed .sidebar-toggle { margin: 0 auto; }
.sidebar.collapsed .sidebar-toggle i { transform: rotate(180deg); }

/* ── Main Content ───────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition);
}
.sidebar.collapsed ~ .main-content { margin-left: var(--sidebar-collapsed); }

/* ── Top Header ─────────────────────────────────────────────── */
.top-header {
  height: var(--header-height);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: var(--shadow-sm);
}
.header-breadcrumb { flex: 1; }
.breadcrumb { margin: 0; padding: 0; background: none; font-size: 13px; }
.breadcrumb-item { color: var(--text-muted); }
.breadcrumb-item.active { color: var(--text-main); font-weight: 600; }
.breadcrumb-item + .breadcrumb-item::before { color: var(--text-light); content: "/"; }
.page-title { font-size: 18px; font-weight: 700; color: var(--text-main); margin: 0; }
.header-actions { display: flex; align-items: center; gap: 8px; }

.btn-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--card);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  text-decoration: none;
}
.btn-icon:hover { background: var(--bg); color: var(--primary); border-color: var(--primary); }

.notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--card);
}
.header-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(37,99,235,.3);
}

/* ── Page Content ───────────────────────────────────────────── */
.page-content { flex: 1; padding: 24px; }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow); }
.card-header {
  display: flex; align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  background: transparent;
  border-radius: var(--radius) var(--radius) 0 0;
}
.card-title { font-size: 14px; font-weight: 700; color: var(--text-main); margin: 0; }
.card-body { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: #fafbfc;
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ── Stat Cards ─────────────────────────────────────────────── */
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  overflow: hidden;
  position: relative;
}
.stat-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  opacity: 0;
  transition: opacity var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card:hover::after { opacity: 1; }
.stat-card.primary::after { background: linear-gradient(90deg, var(--primary), var(--accent)); }
.stat-card.success::after { background: linear-gradient(90deg, var(--success), #34d399); }
.stat-card.warning::after { background: linear-gradient(90deg, var(--warning), #fbbf24); }
.stat-card.danger::after  { background: linear-gradient(90deg, var(--danger), #f87171); }
.stat-card.accent::after  { background: linear-gradient(90deg, var(--accent), #67e8f9); }
.stat-card.purple::after  { background: linear-gradient(90deg, #8b5cf6, var(--primary)); }

.stat-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.stat-icon.primary { background: linear-gradient(135deg, var(--primary), #60a5fa); color: #fff; box-shadow: 0 6px 16px rgba(37,99,235,.3); }
.stat-icon.success { background: linear-gradient(135deg, var(--success), #34d399); color: #fff; box-shadow: 0 6px 16px rgba(16,185,129,.3); }
.stat-icon.warning { background: linear-gradient(135deg, var(--warning), #fbbf24); color: #fff; box-shadow: 0 6px 16px rgba(245,158,11,.3); }
.stat-icon.danger  { background: linear-gradient(135deg, var(--danger), #f87171); color: #fff; box-shadow: 0 6px 16px rgba(239,68,68,.3); }
.stat-icon.accent  { background: linear-gradient(135deg, var(--accent), #67e8f9); color: #fff; box-shadow: 0 6px 16px rgba(6,182,212,.3); }
.stat-icon.purple  { background: linear-gradient(135deg, #8b5cf6, var(--primary)); color: #fff; box-shadow: 0 6px 16px rgba(139,92,246,.3); }

.stat-info { flex: 1; min-width: 0; }
.stat-value { font-size: 26px; font-weight: 800; color: var(--text-main); line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 12px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.stat-change { font-size: 11px; font-weight: 600; margin-top: 4px; }
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }
.stat-change.neutral { color: var(--text-muted); }

/* ── Tables ─────────────────────────────────────────────────── */
/* Allow Bootstrap dropdowns to escape overflow containers (desktop only) */
@media (min-width: 768px) {
  .table-responsive { overflow: visible !important; }
  .card { overflow: visible !important; }
}

.table-wrapper {
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: visible;
}
.table { margin: 0; font-size: 13px; width: 100%; }
.table thead th {
  background: #f8fafc;
  color: var(--text-muted);
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  border-top: none;
  white-space: nowrap;
}
.table tbody td {
  padding: 12px 16px;
  vertical-align: middle;
  border-color: var(--border);
  color: var(--text-main);
}
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: #f8fafc !important; }
.table-striped > tbody > tr:nth-of-type(odd) > * { background-color: rgba(241,245,249,.5); }
.table-clickable tbody tr { cursor: pointer; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px; letter-spacing: .3px; }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: rgba(16,185,129,.12); color: #059669; }
.badge-warning { background: rgba(245,158,11,.12); color: #b45309; }
.badge-danger  { background: rgba(239,68,68,.12); color: var(--danger); }
.badge-accent  { background: var(--accent-light); color: #0e7490; }
.badge-gray    { background: #f1f5f9; color: var(--text-muted); }
.badge-purple  { background: rgba(139,92,246,.12); color: #7c3aed; }
.badge-dark    { background: #1e293b; color: #e2e8f0; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  font-family: var(--font);
  font-size: 13px; font-weight: 600;
  border-radius: var(--radius-xs);
  transition: all var(--transition);
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  border-color: var(--primary); color: #fff;
  box-shadow: 0 2px 8px rgba(37,99,235,.3);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-hover), #1e40af);
  box-shadow: 0 4px 12px rgba(37,99,235,.4); color: #fff;
}
.btn-outline-primary { border-color: var(--primary); color: var(--primary); background: transparent; }
.btn-outline-primary:hover { background: var(--primary); color: #fff; }
.btn-success  { background: linear-gradient(135deg, var(--success), #059669); border-color: var(--success); color: #fff; box-shadow: 0 2px 8px rgba(16,185,129,.3); }
.btn-danger   { background: linear-gradient(135deg, var(--danger), #dc2626); border-color: var(--danger); color: #fff; box-shadow: 0 2px 8px rgba(239,68,68,.3); }
.btn-warning  { background: linear-gradient(135deg, var(--warning), #d97706); border-color: var(--warning); color: #fff; box-shadow: 0 2px 8px rgba(245,158,11,.3); }
.btn-secondary { background: #f1f5f9; border-color: var(--border); color: var(--text-muted); }
.btn-secondary:hover { background: #e2e8f0; color: var(--text-main); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; border-radius: 5px; }

/* ── Form Controls ───────────────────────────────────────────── */
.form-control, .form-select {
  font-family: var(--font);
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 8px 12px;
  color: var(--text-main);
  background: var(--card);
  transition: all var(--transition);
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
  outline: none;
}
.form-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 6px; }
.input-group-text { background: #f8fafc; border-color: var(--border); color: var(--text-muted); font-size: 13px; }

/* ── Modal ───────────────────────────────────────────────────── */
.modal-content { border: none; border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.modal-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 18px 24px; border: none;
}
.modal-header .modal-title { font-size: 15px; font-weight: 700; color: #fff; }
.modal-header .btn-close { filter: invert(1); opacity: .8; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); background: #f8fafc; border-radius: 0 0 var(--radius) var(--radius); }

/* ── Toast Notifications ─────────────────────────────────────── */
#toast-container {
  position: fixed; top: 20px; right: 20px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast-item {
  min-width: 300px; max-width: 380px;
  background: var(--card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px;
  pointer-events: all;
  border-left: 4px solid;
  animation: toastIn .35s cubic-bezier(.34,1.56,.64,1) forwards;
}
.toast-item.hide { animation: toastOut .3s ease forwards; }
@keyframes toastIn  { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { to   { transform: translateX(120%); opacity: 0; } }
.toast-item.success { border-color: var(--success); }
.toast-item.error   { border-color: var(--danger); }
.toast-item.warn    { border-color: var(--warning); }
.toast-item.info    { border-color: var(--accent); }
.toast-icon { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; margin-top: 1px; }
.toast-item.success .toast-icon { background: rgba(16,185,129,.12); color: var(--success); }
.toast-item.error   .toast-icon { background: rgba(239,68,68,.12); color: var(--danger); }
.toast-item.warn    .toast-icon { background: rgba(245,158,11,.12); color: var(--warning); }
.toast-item.info    .toast-icon { background: var(--accent-light); color: var(--accent); }
.toast-body { flex: 1; }
.toast-title { font-size: 13px; font-weight: 700; color: var(--text-main); }
.toast-msg   { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.toast-close { background: none; border: none; color: var(--text-light); cursor: pointer; font-size: 14px; padding: 0; line-height: 1; transition: color var(--transition); flex-shrink: 0; }
.toast-close:hover { color: var(--text-main); }

/* ── Skeleton Loading ────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-xs);
}
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
.skeleton-text   { height: 14px; border-radius: 4px; margin-bottom: 8px; }
.skeleton-title  { height: 20px; border-radius: 4px; margin-bottom: 10px; }
.skeleton-circle { border-radius: 50%; }
.skeleton-card   { height: 100px; border-radius: var(--radius); }
.skeleton-row    { height: 44px; margin-bottom: 1px; border-radius: 0; }

/* ── Tabs ────────────────────────────────────────────────────── */
.nav-tabs { border-bottom: 2px solid var(--border); gap: 2px; }
.nav-tabs .nav-link {
  color: var(--text-muted) !important;
  border: none !important;
  border-radius: var(--radius-xs) var(--radius-xs) 0 0 !important;
  padding: 10px 18px !important;
  font-size: 13px; font-weight: 600 !important;
  position: relative;
  background: transparent !important;
  box-shadow: none !important;
  transition: color var(--transition), background var(--transition) !important;
}
.nav-tabs .nav-link::before { display: none !important; }
.nav-tabs .nav-link:hover { background: #f8fafc !important; color: var(--text-main) !important; }
.nav-tabs .nav-link.active { color: var(--primary) !important; background: var(--card) !important; }
.nav-tabs .nav-link.active::after {
  content: '';
  position: absolute; bottom: -2px; left: 0; right: 0;
  height: 2px; background: var(--primary);
  border-radius: 2px 2px 0 0;
}

/* ── Pagination ──────────────────────────────────────────────── */
.pagination { gap: 3px; margin: 0; }
.page-link {
  font-family: var(--font); font-size: 13px; font-weight: 500;
  color: var(--text-muted); border: 1px solid var(--border);
  border-radius: var(--radius-xs) !important;
  padding: 6px 12px; transition: all var(--transition);
}
.page-link:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.page-item.active .page-link { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(37,99,235,.3); }
.page-item.disabled .page-link { color: var(--text-light); background: #f8fafc; }

/* ── Dropdown ────────────────────────────────────────────────── */
.dropdown-menu { border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-md); padding: 6px; font-size: 13px; min-width: 160px; }
.dropdown-item { border-radius: var(--radius-xs); padding: 8px 12px; font-size: 13px; font-weight: 500; color: var(--text-main); display: flex; align-items: center; gap: 8px; transition: background var(--transition); }
.dropdown-item i { width: 14px; text-align: center; color: var(--text-muted); }
.dropdown-item:hover { background: #f1f5f9; color: var(--text-main); }
.dropdown-item.text-danger { color: var(--danger); }
.dropdown-item.text-danger i { color: var(--danger); }
.dropdown-item.text-danger:hover { background: rgba(239,68,68,.08); }
.dropdown-divider { margin: 4px 0; border-color: var(--border); }

/* ── Search Box ──────────────────────────────────────────────── */
.search-box { position: relative; display: flex; align-items: center; }
.search-box .search-icon { position: absolute; left: 10px; color: var(--text-light); font-size: 13px; pointer-events: none; }
.search-box .form-control { padding-left: 32px; }

/* ── Filter Toolbar ──────────────────────────────────────────── */
.filter-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 20px; border-bottom: 1px solid var(--border); background: #fafbfc;
}

/* ── Status Dot ──────────────────────────────────────────────── */
.status-dot { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; }
.status-dot::before { content: ''; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.status-dot.online::before    { background: var(--success); box-shadow: 0 0 0 2px rgba(16,185,129,.2); }
.status-dot.offline::before   { background: var(--danger);  box-shadow: 0 0 0 2px rgba(239,68,68,.2); }
.status-dot.active::before    { background: var(--success); box-shadow: 0 0 0 2px rgba(16,185,129,.2); }
.status-dot.suspended::before { background: var(--warning); box-shadow: 0 0 0 2px rgba(245,158,11,.2); }
.status-dot.expired::before   { background: var(--danger); }
.status-dot.pending::before   { background: var(--text-light); }

/* ── Progress Bar ────────────────────────────────────────────── */
.progress { height: 6px; background: var(--border); border-radius: 20px; overflow: hidden; }
.progress-bar { border-radius: 20px; }

/* ── Alert ───────────────────────────────────────────────────── */
.alert { border: none; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; padding: 12px 16px; display: flex; align-items: flex-start; gap: 10px; border-left: 4px solid; }
.alert-info    { background: var(--accent-light); border-color: var(--accent); color: #0e7490; }
.alert-success { background: rgba(16,185,129,.08); border-color: var(--success); color: #065f46; }
.alert-warning { background: rgba(245,158,11,.08); border-color: var(--warning); color: #92400e; }
.alert-danger  { background: rgba(239,68,68,.08); border-color: var(--danger); color: #991b1b; }

/* ── Empty State ─────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state i { font-size: 48px; color: var(--text-light); margin-bottom: 16px; display: block; }
.empty-state h6 { font-weight: 700; color: var(--text-muted); margin-bottom: 8px; }
.empty-state p  { font-size: 13px; color: var(--text-light); margin: 0; }

/* ── Switch ──────────────────────────────────────────────────── */
.form-switch .form-check-input { width: 38px; height: 20px; border-radius: 20px; cursor: pointer; }
.form-check-input { width: 15px; height: 15px; border-color: var(--border-dark); cursor: pointer; }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-check-input:focus { box-shadow: 0 0 0 3px rgba(37,99,235,.12); border-color: var(--primary); }

/* ── Login Page ──────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(37,99,235,.18) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 20%, rgba(6,182,212,.12) 0%, transparent 50%),
    radial-gradient(ellipse at 60% 80%, rgba(139,92,246,.1) 0%, transparent 45%);
}
.login-card {
  background: rgba(255,255,255,.04);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 20px;
  padding: 48px;
  width: 100%; max-width: 440px;
  position: relative; z-index: 1;
  box-shadow: 0 32px 64px rgba(0,0,0,.4);
}
.login-card .form-control {
  background: rgba(255,255,255,.07);
  border-color: rgba(255,255,255,.12); color: #fff;
  padding: 12px 16px; font-size: 14px;
}
.login-card .form-control::placeholder { color: rgba(255,255,255,.3); }
.login-card .form-control:focus { background: rgba(255,255,255,.1); border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.2); color: #fff; }
.login-card .form-label { color: rgba(255,255,255,.7); font-size: 13px; }
.login-card .input-group-text { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.12); color: rgba(255,255,255,.4); }

/* ── Mobile Menu Toggle Button ───────────────────────────────── */
.mobile-menu-btn {
  display: none;
  width: 36px; height: 36px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-muted);
  cursor: pointer;
  align-items: center; justify-content: center;
  font-size: 16px;
  transition: all var(--transition);
  flex-shrink: 0;
}
.mobile-menu-btn:hover { background: var(--bg); color: var(--primary); border-color: var(--primary); }

/* ── Mobile Overlay ─────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}
.sidebar-overlay.show { opacity: 1; pointer-events: all; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .sidebar { width: var(--sidebar-collapsed); }
  .sidebar .brand-text, .sidebar .nav-text, .sidebar .nav-badge,
  .sidebar .nav-section-label, .sidebar .user-info { opacity: 0; width: 0; overflow: hidden; }
  .sidebar .sidebar-user, .sidebar .nav-link { justify-content: center; }
  .main-content { margin-left: var(--sidebar-collapsed); }
  .stat-card .stat-value { font-size: 22px; }
}
@media (max-width: 767.98px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-width); }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar.mobile-open .brand-text, .sidebar.mobile-open .nav-text,
  .sidebar.mobile-open .nav-badge, .sidebar.mobile-open .nav-section-label,
  .sidebar.mobile-open .user-info { opacity: 1; width: auto; overflow: visible; }
  .sidebar.mobile-open .sidebar-user, .sidebar.mobile-open .nav-link { justify-content: flex-start; }
  .sidebar-overlay { display: block; }
  .main-content { margin-left: 0; }
  .mobile-menu-btn { display: flex; }
  .page-content { padding: 16px; }
  .top-header { padding: 0 12px; gap: 8px; }
  .page-title { font-size: 15px; }

  /* Tables scroll horizontally on mobile */
  .table-responsive { overflow-x: auto !important; overflow-y: visible !important; -webkit-overflow-scrolling: touch; }
  .card { overflow: hidden !important; }
  .table-wrapper { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
  .table { min-width: 560px; }
  .table thead th { padding: 10px 12px; font-size: 10px; white-space: nowrap; }
  .table tbody td { padding: 12px; font-size: 13px; }
  .table tbody tr { min-height: 44px; /* Touch-friendly row height */ }

  /* Bigger touch targets for buttons */
  .btn { min-height: 36px; padding: 8px 12px; }
  .btn-sm { min-height: 32px; padding: 6px 10px; font-size: 12px; }
  .btn-xs { min-height: 28px; padding: 4px 8px; }
  .btn-icon { width: 40px; height: 40px; }

  /* Filter bar stacks */
  .filter-bar { padding: 10px 12px; gap: 8px; }
  .filter-bar .form-control, .filter-bar .form-select { font-size: 12px; min-width: 0; }
  .filter-bar .search-box { width: 100%; order: -1; }
  .filter-bar .search-box .form-control { width: 100%; }

  /* Stat cards */
  .stat-card { padding: 14px; gap: 12px; }
  .stat-icon { width: 42px; height: 42px; font-size: 16px; border-radius: 10px; }
  .stat-value { font-size: 20px; }
  .stat-label { font-size: 11px; }

  /* Cards */
  .card-header { padding: 12px 14px; flex-wrap: wrap; gap: 8px; }
  .card-body { padding: 14px; }

  /* Toast - fit mobile screens */
  #toast-container { left: 12px; right: 12px; bottom: 12px; }
  .toast-item { min-width: 0; max-width: 100%; }

  /* Modal */
  .modal-body { padding: 16px; }
  .modal-header { padding: 14px 16px; }
  .modal-footer { padding: 12px 16px; }

  /* Buttons */
  .btn { font-size: 12px; padding: 6px 10px; }
  .btn-sm { padding: 4px 8px; font-size: 11px; }

  /* Pagination */
  .page-link { padding: 5px 8px; font-size: 12px; }

  /* Notification panel full width */
  .notif-panel { width: 100%; }

  /* Customer detail panel full width */
  .customer-detail { width: 100% !important; }

  /* Empty state */
  .empty-state { padding: 32px 16px; }
  .empty-state i { font-size: 36px; }

  /* Breadcrumb hide on mobile */
  .breadcrumb { display: none; }

  /* Utility: hide elements on mobile */
  .d-mobile-none { display: none !important; }
}

/* Extra small phones */
@media (max-width: 374px) {
  .page-content { padding: 10px; }
  .stat-card { padding: 10px; }
  .stat-icon { width: 36px; height: 36px; font-size: 14px; }
  .stat-value { font-size: 18px; }
  .card-header { padding: 10px 12px; }
  .card-body { padding: 10px 12px; }
  .top-header { padding: 0 8px; }
  .login-card { padding: 28px 20px; }
}

/* ── Animations ──────────────────────────────────────────────── */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.fade-in-up { animation: fadeInUp .4s ease forwards; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
.animate-pulse { animation: pulse 2s infinite; }

/* ── Overlay ─────────────────────────────────────────────────── */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 799; opacity: 0; pointer-events: none; transition: opacity .3s; }
.overlay.show { opacity: 1; pointer-events: all; }

/* ── Utilities ───────────────────────────────────────────────── */
.text-primary-custom { color: var(--primary) !important; }
.text-success-custom { color: var(--success) !important; }
.fw-600 { font-weight: 600 !important; }
.fw-700 { font-weight: 700 !important; }
.fw-800 { font-weight: 800 !important; }
.fs-11 { font-size: 11px !important; }
.fs-12 { font-size: 12px !important; }
.fs-13 { font-size: 13px !important; }
.cursor-pointer { cursor: pointer; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }
::selection { background: rgba(37,99,235,.18); }

/* ── NProgress Bar ───────────────────────────────────────────── */
#nprogress { pointer-events: none; position: fixed; top: 0; left: 0; right: 0; z-index: 9999; }
#nprogress .bar {
  background: linear-gradient(90deg, var(--primary), var(--accent));
  position: fixed; top: 0; left: 0; width: 100%; height: 3px;
  transform: translateX(-100%);
  transition: transform .2s ease, opacity .3s ease;
  box-shadow: 0 0 12px rgba(37,99,235,.6);
}
#nprogress .peg {
  display: block; position: absolute; right: 0; width: 100px; height: 100%;
  box-shadow: 0 0 10px var(--primary), 0 0 5px var(--primary);
  opacity: 1; transform: rotate(3deg) translate(0, -4px);
}

/* ── Notification Bell ───────────────────────────────────────── */
.notif-bell-wrap { position: relative; }
.notif-bell {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; transition: all .2s; position: relative;
}
.notif-bell:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.notif-bell.active { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.notif-badge {
  position: absolute; top: -6px; right: -6px;
  min-width: 18px; height: 18px; border-radius: 9px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; border: 2px solid var(--card);
  transition: transform .2s;
}
.notif-badge.pulse { animation: badgePulse .4s ease; }
@keyframes badgePulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.4); } }

/* ── Notification Panel ──────────────────────────────────────── */
.notif-overlay {
  position: fixed; inset: 0; z-index: 1040;
  background: rgba(0,0,0,.3); opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
.notif-overlay.show { opacity: 1; pointer-events: all; }

.notif-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 380px; max-width: 100vw;
  background: var(--card); z-index: 1050;
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .3s cubic-bezier(.4,0,.2,1);
  box-shadow: -8px 0 32px rgba(0,0,0,.12);
}
.notif-panel.open { transform: translateX(0); }

.notif-panel-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg, #0f172a, #1e1b4b);
}
.notif-panel-header h5 {
  color: #fff; font-size: 15px; font-weight: 700; margin: 0;
  display: flex; align-items: center; gap: 8px;
}
.notif-panel-header h5 i { color: var(--accent); }
.notif-header-actions { display: flex; gap: 8px; }
.notif-header-actions button {
  font-size: 11px; padding: 4px 10px; border-radius: 6px; border: none; cursor: pointer;
}
.btn-mark-all { background: rgba(255,255,255,.1); color: rgba(255,255,255,.7); }
.btn-mark-all:hover { background: rgba(255,255,255,.2); color: #fff; }
.btn-close-panel { background: rgba(255,255,255,.08); color: rgba(255,255,255,.5); font-size: 14px !important; }
.btn-close-panel:hover { background: rgba(239,68,68,.3); color: #fff; }

.notif-list {
  flex: 1; overflow-y: auto; padding: 8px 0;
}
.notif-empty {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 10px; height: 200px;
  color: var(--text-light); font-size: 13px;
}
.notif-empty i { font-size: 36px; opacity: .4; }

.notif-item {
  display: flex; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid #f8fafc; cursor: pointer;
  transition: background .15s; position: relative;
}
.notif-item:hover { background: #f8fafc; }
.notif-item.unread { background: rgba(37,99,235,.04); }
.notif-item.unread:hover { background: rgba(37,99,235,.08); }

.notif-icon {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.notif-icon.info    { background: rgba(6,182,212,.12); color: var(--accent); }
.notif-icon.success { background: rgba(16,185,129,.12); color: var(--success); }
.notif-icon.warning { background: rgba(245,158,11,.12); color: var(--warning); }
.notif-icon.error   { background: rgba(239,68,68,.12); color: var(--danger); }

.notif-content { flex: 1; min-width: 0; }
.notif-title { font-size: 13px; font-weight: 600; color: var(--text-main); margin-bottom: 2px; }
.notif-msg { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.notif-time { font-size: 11px; color: var(--text-light); margin-top: 4px; }

.notif-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary); flex-shrink: 0; margin-top: 4px;
}

.notif-del {
  position: absolute; top: 8px; right: 8px;
  width: 20px; height: 20px; border-radius: 4px;
  background: transparent; border: none; cursor: pointer;
  color: var(--text-light); font-size: 11px;
  opacity: 0; transition: opacity .15s;
  display: flex; align-items: center; justify-content: center;
}
.notif-item:hover .notif-del { opacity: 1; }
.notif-del:hover { background: #fee2e2; color: var(--danger); }

.notif-panel-footer {
  padding: 12px 16px; border-top: 1px solid var(--border);
  display: flex; justify-content: center;
}

/* ── Toast Improvements ──────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999; display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast-item {
  display: flex; align-items: flex-start; gap: 12px;
  background: #fff; border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.06);
  min-width: 300px; max-width: 380px;
  border-left: 4px solid var(--primary);
  pointer-events: all;
  animation: toastIn .35s cubic-bezier(.34,1.56,.64,1) forwards;
  transition: transform .2s, opacity .2s;
}
.toast-item.hide { animation: toastOut .3s ease forwards; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(120%) scale(.9); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to   { opacity: 0; transform: translateX(120%) scale(.9); }
}
.toast-item.success { border-color: var(--success); }
.toast-item.error   { border-color: var(--danger); }
.toast-item.warn    { border-color: var(--warning); }
.toast-item.info    { border-color: var(--accent); }

.toast-icon {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.toast-item.success .toast-icon { background: rgba(16,185,129,.12); color: var(--success); }
.toast-item.error   .toast-icon { background: rgba(239,68,68,.12);   color: var(--danger);  }
.toast-item.warn    .toast-icon { background: rgba(245,158,11,.12);   color: var(--warning); }
.toast-item.info    .toast-icon { background: rgba(6,182,212,.12);    color: var(--accent);  }

.toast-body { flex: 1; min-width: 0; }
.toast-title { font-size: 13px; font-weight: 700; color: var(--text-main); }
.toast-msg   { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.toast-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-light); padding: 0; font-size: 14px;
  align-self: flex-start; transition: color .15s;
}
.toast-close:hover { color: var(--danger); }

/* ── Smooth page transitions ─────────────────────────────────── */
.page-content { animation: pageIn .3s ease; }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.stat-card { transition: transform .2s, box-shadow .2s; }
.stat-card:hover { transform: translateY(-2px); }

/* ── Floating bg particles ───────────────────────────────────── */
.particle {
  position: absolute; border-radius: 50%;
  pointer-events: none; animation: floatUp linear infinite; opacity: .06;
}
@keyframes floatUp { 0% { transform: translateY(100vh) rotate(0deg); } 100% { transform: translateY(-10vh) rotate(360deg); } }
