:root {
  --primary: #FF1461;
  --primary-hover: #E0004D;
  --primary-glow: rgba(255, 20, 97, 0.25);
  --cyan: #00F0FF;
  --cyan-glow: rgba(0, 240, 255, 0.2);
  --purple: #8B5CF6;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;

  /* THEME SOMBRE (DÉFAUT) */
  --bg-app: #080C16;
  --bg-surface: #0F172A;
  --bg-surface-hover: #162238;
  --bg-card: #111A2E;
  --bg-input: #0A101D;
  --border: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(255, 20, 97, 0.5);
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --text-subtle: #64748B;
  --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.35);
  --header-bg: rgba(15, 23, 42, 0.85);
  --sidebar-bg: #0B1120;
}

[data-theme="light"] {
  --bg-app: #F1F5F9;
  --bg-surface: #FFFFFF;
  --bg-surface-hover: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-input: #F8FAFC;
  --border: #E2E8F0;
  --border-focus: rgba(255, 20, 97, 0.4);
  --text-main: #0F172A;
  --text-muted: #64748B;
  --text-subtle: #94A3B8;
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08);
  --shadow-card: 0 2px 10px rgba(0, 0, 0, 0.04);
  --header-bg: rgba(255, 255, 255, 0.9);
  --sidebar-bg: #FFFFFF;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  transition: background-color 0.25s ease, border-color 0.2s ease, color 0.2s ease;
}

body {
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   1. ÉCRAN DE VERROUILLAGE / CODE PIN
   ========================================================================== */
#lockScreen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at 50% 30%, rgba(255, 20, 97, 0.12), transparent 60%), var(--bg-app);
}

.lock-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 42px 36px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
  position: relative;
  overflow: hidden;
}

.lock-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--cyan));
}

.lock-logo {
  width: 68px;
  height: 68px;
  border-radius: 18px;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px var(--primary-glow);
}

.lock-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
}

.lock-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 26px;
}

.pin-display {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 28px;
}

.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pin-dot.filled {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 0 14px var(--primary);
  transform: scale(1.15);
}

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.pin-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-main);
  font-size: 22px;
  font-weight: 700;
  height: 62px;
  border-radius: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  user-select: none;
}

.pin-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-focus);
  transform: translateY(-2px);
}

.pin-btn:active {
  transform: translateY(1px) scale(0.96);
}

.pin-error {
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
  min-height: 18px;
  margin-top: 6px;
}

/* ==========================================================================
   2. STRUCTURE DU PANEL (SIDEBAR + MAIN)
   ========================================================================== */
#adminApp {
  display: none;
  min-height: 100vh;
  width: 100%;
}

/* SIDEBAR */
.sidebar {
  width: 270px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s ease;
  overflow: hidden;
}

.sidebar.collapsed {
  width: 80px;
}

.sidebar-header {
  height: 72px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  overflow: hidden;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  box-shadow: 0 4px 14px var(--primary-glow);
  flex-shrink: 0;
}

.brand-info {
  display: flex;
  flex-direction: column;
  white-space: nowrap;
}

.brand-name {
  font-size: 17px;
  font-weight: 900;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.brand-name span {
  color: var(--primary);
}

.brand-badge {
  font-size: 9px;
  font-weight: 800;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 18px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section-title {
  font-size: 10px;
  font-weight: 800;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 12px 14px 6px;
  white-space: nowrap;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 14px;
  border-radius: 14px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  transition: all 0.2s ease;
}

.nav-item:hover {
  background: var(--bg-surface-hover);
  color: var(--text-main);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(255, 20, 97, 0.15), rgba(255, 20, 97, 0.05));
  color: var(--primary);
  font-weight: 700;
  border-left: 3px solid var(--primary);
}

.nav-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.nav-label {
  flex: 1;
}

.nav-count {
  background: var(--primary);
  color: #FFF;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 10px;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.nav-count.cyan {
  background: var(--cyan);
  color: #0A0E1A;
}

.sidebar.collapsed .brand-info,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .nav-count,
.sidebar.collapsed .user-pill-info {
  display: none;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 12px 0;
}

/* SIDEBAR FOOTER */
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.admin-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

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

.user-pill-info {
  white-space: nowrap;
}

.user-pill-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.user-pill-role {
  font-size: 10px;
  color: var(--cyan);
  font-weight: 600;
}

/* ==========================================================================
   3. CONTENU PRINCIPAL & TOPBAR
   ========================================================================== */
.main-wrapper {
  flex: 1;
  margin-left: 270px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-wrapper.expanded {
  margin-left: 80px;
}

/* TOPBAR */
.topbar {
  height: 72px;
  background: var(--header-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  max-width: 500px;
}

.btn-sidebar-toggle {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-sidebar-toggle:hover {
  background: var(--bg-surface-hover);
  border-color: var(--primary);
}

.global-search {
  position: relative;
  width: 100%;
}

.global-search input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 42px 10px 38px;
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  transition: all 0.2s;
}

.global-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
}

.global-search .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--text-muted);
}

.global-search .shortcut-tag {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-subtle);
  padding: 2px 6px;
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-main);
  height: 38px;
  padding: 0 14px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
}

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

.topbar-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: #FFF;
  font-size: 10px;
  font-weight: 800;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-surface);
}

/* NOTIFICATIONS DROPDOWN */
.notif-dropdown {
  position: absolute;
  top: 72px;
  right: 32px;
  width: 360px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 16px;
  display: none;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
}

.notif-dropdown.active {
  display: flex;
  animation: fadeInDown 0.25s ease;
}

.notif-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.notif-title {
  font-size: 14px;
  font-weight: 800;
}

.notif-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}

.notif-item {
  display: flex;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  font-size: 12px;
  cursor: pointer;
}

.notif-item:hover {
  background: var(--bg-surface-hover);
}

/* ==========================================================================
   4. PAGES & CONTENU
   ========================================================================== */
.content-area {
  flex: 1;
  padding: 32px;
}

.page-view {
  display: none;
}

.page-view.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-title {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* BOUTONS SAAS */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #FFFFFF;
  border: none;
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 15px var(--primary-glow);
  transition: all 0.2s;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px var(--primary-glow);
}

.btn-secondary {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-focus);
}

/* STATS GRID */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 20, 97, 0.3);
}

.stat-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: rgba(255, 20, 97, 0.12);
  color: var(--primary);
}

.stat-icon.cyan { background: rgba(0, 240, 255, 0.12); color: var(--cyan); }
.stat-icon.purple { background: rgba(139, 92, 246, 0.12); color: var(--purple); }
.stat-icon.success { background: rgba(16, 185, 129, 0.12); color: var(--success); }
.stat-icon.warning { background: rgba(245, 158, 11, 0.12); color: var(--warning); }
.stat-icon.danger { background: rgba(239, 68, 68, 0.12); color: var(--danger); }

.stat-trend {
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
}

.trend-up { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.trend-down { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

.stat-value {
  font-size: 28px;
  font-weight: 900;
  color: var(--text-main);
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

/* CHARTS ROW */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-bottom: 30px;
}

.card-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow-card);
}

.card-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.card-box-title {
  font-size: 16px;
  font-weight: 800;
}

.period-pill-group {
  display: inline-flex;
  background: var(--bg-input);
  padding: 3px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.period-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.2s;
}

.period-btn.active {
  background: var(--primary);
  color: #FFF;
  box-shadow: 0 2px 8px var(--primary-glow);
}

/* ==========================================================================
   5. TABLEAUX & FILTRES SAAS
   ========================================================================== */
.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 14px;
}

.table-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-tab {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-tab:hover {
  background: var(--bg-surface-hover);
  color: var(--text-main);
}

.filter-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFF;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.table-container {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--bg-card);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

table.data-table thead th {
  background: var(--bg-surface);
  padding: 14px 18px;
  font-size: 11px;
  font-weight: 800;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table.data-table tbody td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table.data-table tbody tr:hover {
  background: var(--bg-surface-hover);
}

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

/* BADGES DE STATUT */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-purple { background: rgba(139, 92, 246, 0.15); color: var(--purple); border: 1px solid rgba(139, 92, 246, 0.3); }
.badge-cyan { background: rgba(0, 240, 255, 0.15); color: var(--cyan); border: 1px solid rgba(0, 240, 255, 0.3); }
.badge-muted { background: rgba(148, 163, 184, 0.15); color: var(--text-muted); border: 1px solid rgba(148, 163, 184, 0.25); }

/* ACTIONS BOUTONS DANS TABLE */
.action-btn-group {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
}

.action-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.action-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-focus);
}

.action-btn.btn-danger-action:hover {
  background: var(--danger);
  color: #FFF;
  border-color: var(--danger);
}

/* PAGINATION */
.table-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

.pagination-controls {
  display: flex;
  gap: 6px;
}

.page-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-main);
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFF;
}

/* ==========================================================================
   6. MODALES & TIROIRS LATÉRAUX (DRAWER)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 14, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.active {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  width: 100%;
  max-width: 580px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
  position: relative;
  overflow: hidden;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 22px 26px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
}

.modal-close:hover {
  color: var(--text-main);
  background: var(--bg-surface);
}

.modal-body {
  padding: 24px 26px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 18px 26px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-surface);
}

/* TIROIR DÉTAILS UTILISATEUR (SLIDE-OVER DRAWER) */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 14, 0.6);
  backdrop-filter: blur(5px);
  z-index: 400;
  display: none;
}

.drawer-backdrop.active {
  display: block;
}

.drawer-panel {
  position: fixed;
  top: 0;
  right: -520px;
  bottom: 0;
  width: 500px;
  max-width: 95vw;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  box-shadow: -15px 0 40px rgba(0, 0, 0, 0.6);
  z-index: 450;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.drawer-panel.open {
  right: 0;
}

/* ==========================================================================
   7. COMPOSANTS SPÉCIFIQUES (TICKETS, PHOTOS, ETC.)
   ========================================================================== */
/* GRILLE PHOTOS MODÉRATION */
.photo-mod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.photo-mod-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}

.photo-mod-preview {
  width: 100%;
  height: 280px;
  object-fit: cover;
  background: #000;
}

.photo-mod-body {
  padding: 16px;
  flex: 1;
}

.photo-mod-actions {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--bg-surface);
}

/* CHAT INTERFACE SUPPORT */
.support-chat-container {
  display: grid;
  grid-template-columns: 320px 1fr;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-card);
  height: 650px;
  overflow: hidden;
}

.support-tickets-list {
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.ticket-item {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.ticket-item:hover, .ticket-item.active {
  background: var(--bg-surface);
}

.support-chat-main {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.support-chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.msg-bubble {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 13px;
}

.msg-user {
  align-self: flex-start;
  background: var(--bg-surface);
  border: 1px solid var(--border);
}

.msg-admin {
  align-self: flex-end;
  background: var(--primary);
  color: #FFF;
}

.support-chat-input {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  background: var(--bg-surface);
}

/* TOAST NOTIFICATIONS */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 20px;
  color: var(--text-main);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
  animation: slideInRight 0.3s ease;
  min-width: 280px;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.danger { border-left: 4px solid var(--danger); }

/* FORM ELEMENTS */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 14px;
  color: var(--text-main);
  font-size: 13px;
  outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

/* ANIMATIONS */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

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

/* ==========================================================================
   8. RESPONSIVE DESIGN (TABLETTE & MOBILE)
   ========================================================================== */
@media (max-width: 1024px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 270px !important;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

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

  .topbar {
    padding: 0 16px;
  }

  .content-area {
    padding: 20px 16px;
  }

  .support-chat-container {
    grid-template-columns: 1fr;
    height: auto;
  }
}

/* ==========================================================================
   9. COMPOSANTS ADDITIONNELS (AVATARS, ACTIVITÉS, CERTIFS)
   ========================================================================== */
.table-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.verified-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--info);
  color: #FFF;
  font-size: 11px;
  font-weight: 900;
}

.activity-feed-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  font-size: 13px;
  transition: all 0.2s ease;
}

.activity-feed-item:hover {
  background: var(--bg-surface-hover);
  border-color: rgba(255, 20, 97, 0.3);
}

.activity-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  background: rgba(255, 20, 97, 0.12);
  flex-shrink: 0;
}

.activity-icon-wrap.cyan { background: rgba(0, 240, 255, 0.12); }
.activity-icon-wrap.success { background: rgba(16, 185, 129, 0.12); }
.activity-icon-wrap.danger { background: rgba(239, 68, 68, 0.12); }
.activity-icon-wrap.warning { background: rgba(245, 158, 11, 0.12); }
.activity-icon-wrap.purple { background: rgba(139, 92, 246, 0.12); }

.activity-text-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.activity-time {
  font-size: 11px;
  color: var(--text-muted);
}

.drawer-photo-wrap {
  position: relative;
  width: 110px;
  height: 140px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.drawer-photo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-delete-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #FFF;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  transition: all 0.2s;
}

.photo-delete-btn:hover {
  background: var(--danger);
  border-color: var(--danger);
}

