/* ============================================================
   INTRANET ALF - Style Principal (Dark Mode Premium)
   ============================================================ */

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

/* ─── Variables ─────────────────────────────────────────── */
:root {
  --bg-primary:      #080c18;
  --bg-secondary:    #0d1224;
  --bg-card:         #111827;
  --bg-card-hover:   #161f35;
  --bg-glass:        rgba(17, 24, 39, 0.85);
  --border:          rgba(255,255,255,0.06);
  --border-accent:   rgba(30,144,255,0.3);

  --text-primary:    #f0f4ff;
  --text-secondary:  #8892b0;
  --text-muted:      #4a5568;

  --accent:          #1e90ff;
  --accent-hover:    #3aa0ff;
  --accent-glow:     rgba(30,144,255,0.25);

  --gendarmerie:     #1565C0;
  --gendarmerie-light:#1e90ff;
  --medical:         #c62828;
  --medical-light:   #ef5350;
  --penitentiaire:   #e65100;
  --penitentiaire-light:#ff6f00;
  --banque:          #1b5e20;
  --banque-light:    #43a047;
  --business:        #4a148c;
  --business-light:  #9c27b0;
  --rh:              #006064;
  --rh-light:        #00acc1;

  --success:   #00c853;
  --warning:   #ffab00;
  --danger:    #ff1744;
  --info:      #00b0ff;

  --radius-sm:  6px;
  --radius:     12px;
  --radius-lg:  18px;
  --radius-xl:  24px;

  --shadow:     0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg:  0 8px 48px rgba(0,0,0,0.6);
  --shadow-glow:0 0 30px var(--accent-glow);

  --transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
  --sidebar-w:  260px;
}

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

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

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

a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; }

/* ─── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: rgba(30,144,255,0.4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ─── Layout ─────────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  transition: var(--transition);
}

.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 0 20px var(--accent-glow);
  flex-shrink: 0;
}

.sidebar-logo-text { line-height: 1.2; }
.sidebar-logo-text h1 { font-size: 1.05rem; font-weight: 800; letter-spacing: 0.05em; color: var(--text-primary); }
.sidebar-logo-text span { font-size: 0.7rem; color: var(--text-secondary); font-weight: 500; text-transform: uppercase; letter-spacing: 0.1em; }

/* ─── Nav ─────────────────────────────────────────────────── */
.sidebar-nav { flex: 1; padding: 16px 12px; }

.nav-section { margin-bottom: 8px; }

.nav-section-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  padding: 4px 10px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item:hover {
  background: rgba(30,144,255,0.08);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(30,144,255,0.15);
  color: var(--accent);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.nav-icon { font-size: 1.1rem; flex-shrink: 0; width: 20px; text-align: center; }

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* Service color nav items */
.nav-item[data-service="gendarmerie"].active { color: var(--gendarmerie-light); background: rgba(21,101,192,0.15); }
.nav-item[data-service="gendarmerie"].active::before { background: var(--gendarmerie-light); }
.nav-item[data-service="medical"].active { color: var(--medical-light); background: rgba(198,40,40,0.15); }
.nav-item[data-service="medical"].active::before { background: var(--medical-light); }
.nav-item[data-service="penitentiaire"].active { color: var(--penitentiaire-light); background: rgba(230,81,0,0.15); }
.nav-item[data-service="penitentiaire"].active::before { background: var(--penitentiaire-light); }
.nav-item[data-service="banque"].active { color: var(--banque-light); background: rgba(27,94,32,0.2); }
.nav-item[data-service="banque"].active::before { background: var(--banque-light); }
.nav-item[data-service="business"].active { color: var(--business-light); background: rgba(74,20,140,0.2); }
.nav-item[data-service="business"].active::before { background: var(--business-light); }
.nav-item[data-service="rh"].active { color: var(--rh-light); background: rgba(0,96,100,0.2); }
.nav-item[data-service="rh"].active::before { background: var(--rh-light); }

/* ─── Sidebar Footer ─────────────────────────────────────── */
.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
}

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 0.82rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.7rem; color: var(--text-secondary); }

.logout-btn {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  background: rgba(255,23,68,0.1);
  border: none;
  color: var(--danger);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: var(--transition);
  flex-shrink: 0;
  text-decoration: none;
}

.logout-btn:hover { background: rgba(255,23,68,0.25); }

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

/* ─── Topbar ──────────────────────────────────────────────── */
.topbar {
  height: 64px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title { font-size: 1.1rem; font-weight: 700; flex: 1; }
.topbar-subtitle { font-size: 0.75rem; color: var(--text-secondary); font-weight: 400; }

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

.topbar-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: var(--transition);
  position: relative;
}

.topbar-btn:hover { background: rgba(30,144,255,0.1); border-color: var(--border-accent); color: var(--accent); }

.topbar-btn .notif-dot {
  position: absolute;
  top: 7px; right: 7px;
  width: 7px; height: 7px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg-secondary);
}

.topbar-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
}

/* ─── Page Content ───────────────────────────────────────── */
.page { padding: 28px; flex: 1; }

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

.page-title h2 { font-size: 1.6rem; font-weight: 800; color: var(--text-primary); }
.page-title p { color: var(--text-secondary); font-size: 0.88rem; margin-top: 4px; }

/* ─── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: var(--transition);
}

.card:hover { border-color: var(--border-accent); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

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

.card-title .icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

/* ─── Stats Grid ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  cursor: default;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 100px; height: 100px;
  border-radius: 50%;
  opacity: 0.06;
  transform: translate(30px, -30px);
  transition: var(--transition);
}

.stat-card:hover { transform: translateY(-3px); border-color: var(--border-accent); box-shadow: var(--shadow); }
.stat-card:hover::before { opacity: 0.12; }

.stat-card.blue::before   { background: var(--accent); }
.stat-card.red::before    { background: var(--medical-light); }
.stat-card.orange::before { background: var(--penitentiaire-light); }
.stat-card.green::before  { background: var(--banque-light); }
.stat-card.purple::before { background: var(--business-light); }
.stat-card.cyan::before   { background: var(--rh-light); }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 16px;
}

.stat-card.blue .stat-icon   { background: rgba(30,144,255,0.15); }
.stat-card.red .stat-icon    { background: rgba(239,83,80,0.15); }
.stat-card.orange .stat-icon { background: rgba(255,111,0,0.15); }
.stat-card.green .stat-icon  { background: rgba(67,160,71,0.15); }
.stat-card.purple .stat-icon { background: rgba(156,39,176,0.15); }
.stat-card.cyan .stat-icon   { background: rgba(0,172,193,0.15); }

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  line-height: 1;
  margin-bottom: 6px;
}

.stat-card.blue .stat-value   { color: var(--accent); }
.stat-card.red .stat-value    { color: var(--medical-light); }
.stat-card.orange .stat-value { color: var(--penitentiaire-light); }
.stat-card.green .stat-value  { color: var(--banque-light); }
.stat-card.purple .stat-value { color: var(--business-light); }
.stat-card.cyan .stat-value   { color: var(--rh-light); }

.stat-label { font-size: 0.8rem; color: var(--text-secondary); font-weight: 500; }

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

.stat-trend.up   { color: var(--success); }
.stat-trend.down { color: var(--danger); }

/* ─── Grid Layouts ───────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* ─── Tables ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead th {
  background: rgba(255,255,255,0.03);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.03); }

tbody td {
  padding: 13px 16px;
  color: var(--text-secondary);
  vertical-align: middle;
}

tbody td:first-child { color: var(--text-primary); font-weight: 500; }

/* ─── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.badge-blue    { background: rgba(30,144,255,0.15); color: var(--accent); border: 1px solid rgba(30,144,255,0.3); }
.badge-red     { background: rgba(239,83,80,0.15);  color: var(--medical-light); border: 1px solid rgba(239,83,80,0.3); }
.badge-orange  { background: rgba(255,111,0,0.15);  color: var(--penitentiaire-light); border: 1px solid rgba(255,111,0,0.3); }
.badge-green   { background: rgba(0,200,83,0.15);   color: var(--success); border: 1px solid rgba(0,200,83,0.3); }
.badge-yellow  { background: rgba(255,171,0,0.15);  color: var(--warning); border: 1px solid rgba(255,171,0,0.3); }
.badge-purple  { background: rgba(156,39,176,0.15); color: var(--business-light); border: 1px solid rgba(156,39,176,0.3); }
.badge-cyan    { background: rgba(0,172,193,0.15);  color: var(--rh-light); border: 1px solid rgba(0,172,193,0.3); }
.badge-gray    { background: rgba(255,255,255,0.06);color: var(--text-secondary); border: 1px solid var(--border); }

/* Online status */
.online-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
}

.online-dot::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.online-dot.online { color: var(--success); }
.online-dot.online::before { background: var(--success); box-shadow: 0 0 6px var(--success); animation: pulse 2s infinite; }
.online-dot.offline { color: var(--text-muted); }
.online-dot.offline::before { background: var(--text-muted); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.6; transform: scale(0.8); }
}

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
  font-family: 'Inter', sans-serif;
}

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

.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 6px 20px var(--accent-glow); color: #fff; }

.btn-secondary {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-secondary:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.15); color: var(--text-primary); }

.btn-danger { background: rgba(255,23,68,0.15); color: var(--danger); border-color: rgba(255,23,68,0.3); }
.btn-danger:hover { background: rgba(255,23,68,0.25); color: var(--danger); }

.btn-success { background: rgba(0,200,83,0.15); color: var(--success); border-color: rgba(0,200,83,0.3); }
.btn-success:hover { background: rgba(0,200,83,0.25); color: var(--success); }

.btn-sm { padding: 6px 12px; font-size: 0.78rem; }
.btn-lg { padding: 12px 28px; font-size: 0.95rem; }

/* ─── Forms ──────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.05em; }

.form-control {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-family: 'Inter', sans-serif;
  transition: var(--transition);
  outline: none;
}

.form-control:focus { border-color: var(--accent); background: rgba(30,144,255,0.05); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-control::placeholder { color: var(--text-muted); }

select.form-control option { background: var(--bg-card); color: var(--text-primary); }

/* ─── Search Bar ─────────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  transition: var(--transition);
}

.search-bar:focus-within { border-color: var(--accent); background: rgba(30,144,255,0.05); }

.search-bar input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.88rem;
  font-family: 'Inter', sans-serif;
  flex: 1;
  min-width: 200px;
}

.search-bar input::placeholder { color: var(--text-muted); }
.search-bar .search-icon { color: var(--text-muted); font-size: 0.9rem; }

/* ─── Filters Row ────────────────────────────────────────── */
.filters-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

/* ─── Alert Boxes ────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}

.alert-info    { background: rgba(0,176,255,0.1);  border: 1px solid rgba(0,176,255,0.3);  color: var(--info); }
.alert-success { background: rgba(0,200,83,0.1);   border: 1px solid rgba(0,200,83,0.3);   color: var(--success); }
.alert-warning { background: rgba(255,171,0,0.1);  border: 1px solid rgba(255,171,0,0.3);  color: var(--warning); }
.alert-danger  { background: rgba(255,23,68,0.1);  border: 1px solid rgba(255,23,68,0.3);  color: var(--danger); }

/* ─── Progress Bars ──────────────────────────────────────── */
.progress-bar {
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
  position: relative;
  overflow: hidden;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer { to { left: 100%; } }

/* ─── Timeline ───────────────────────────────────────────── */
.timeline { padding-left: 20px; border-left: 2px solid var(--border); }

.timeline-item {
  position: relative;
  padding: 0 0 20px 20px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -7px; top: 5px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-card);
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-date { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 4px; font-family: 'JetBrains Mono', monospace; }
.timeline-content { font-size: 0.85rem; color: var(--text-secondary); }
.timeline-content strong { color: var(--text-primary); }

/* ─── Modal ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
}

.modal-overlay.open .modal { transform: scale(1) translateY(0); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title { font-size: 1.1rem; font-weight: 700; }

.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: var(--transition);
}

.modal-close:hover { background: rgba(255,23,68,0.15); color: var(--danger); }

/* ─── Login Page ─────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

.login-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 800px 600px at 20% 50%, rgba(30,144,255,0.06) 0%, transparent 70%),
    radial-gradient(ellipse 600px 400px at 80% 20%, rgba(124,58,237,0.06) 0%, transparent 70%),
    radial-gradient(ellipse 500px 400px at 60% 80%, rgba(198,40,40,0.04) 0%, transparent 70%);
}

.login-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(30,144,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30,144,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}

.login-card {
  position: relative;
  width: 440px;
  background: rgba(13,18,36,0.9);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo-icon {
  width: 72px; height: 72px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: 0 0 40px var(--accent-glow);
}

.login-logo h1 { font-size: 1.6rem; font-weight: 900; letter-spacing: -0.02em; }
.login-logo p { color: var(--text-secondary); font-size: 0.85rem; margin-top: 4px; }

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.login-divider::before, .login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ─── Service Module Header ──────────────────────────────── */
.service-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  border: 1px solid;
  position: relative;
  overflow: hidden;
}

.service-header::before {
  content: '';
  position: absolute;
  right: -20px; top: -20px;
  width: 150px; height: 150px;
  border-radius: 50%;
  opacity: 0.08;
}

.service-header.gendarmerie { background: rgba(21,101,192,0.1); border-color: rgba(21,101,192,0.3); }
.service-header.gendarmerie::before { background: var(--gendarmerie-light); }
.service-header.medical    { background: rgba(198,40,40,0.1);  border-color: rgba(198,40,40,0.3); }
.service-header.medical::before    { background: var(--medical-light); }
.service-header.penitentiaire { background: rgba(230,81,0,0.1); border-color: rgba(230,81,0,0.3); }
.service-header.penitentiaire::before { background: var(--penitentiaire-light); }
.service-header.banque     { background: rgba(27,94,32,0.15);  border-color: rgba(27,94,32,0.4); }
.service-header.banque::before     { background: var(--banque-light); }
.service-header.business   { background: rgba(74,20,140,0.15); border-color: rgba(74,20,140,0.4); }
.service-header.business::before   { background: var(--business-light); }
.service-header.rh         { background: rgba(0,96,100,0.15);  border-color: rgba(0,96,100,0.4); }
.service-header.rh::before         { background: var(--rh-light); }

.service-header-icon {
  width: 56px; height: 56px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  flex-shrink: 0;
  z-index: 1;
}

.service-header-text { z-index: 1; }
.service-header-text h2 { font-size: 1.3rem; font-weight: 800; }
.service-header-text p { font-size: 0.82rem; opacity: 0.8; margin-top: 2px; }

/* ─── Priority Indicators ────────────────────────────────── */
.priority {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.priority::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
}

.priority-critique { color: var(--danger); }
.priority-critique::before { background: var(--danger); box-shadow: 0 0 6px var(--danger); }
.priority-haute    { color: var(--warning); }
.priority-haute::before { background: var(--warning); }
.priority-normale  { color: var(--text-muted); }
.priority-normale::before { background: var(--text-muted); }

/* ─── Chart Placeholder ──────────────────────────────────── */
.chart-bar-container {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 120px;
  padding: 8px 0;
}

.chart-bar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}

.chart-bar {
  width: 100%;
  border-radius: 4px 4px 0 0;
  transition: height 0.8s cubic-bezier(0.4,0,0.2,1);
  position: relative;
  min-height: 4px;
}

.chart-bar-label { font-size: 0.65rem; color: var(--text-muted); text-align: center; }

/* ─── Notification Toast ─────────────────────────────────── */
#toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 0.85rem;
  min-width: 260px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: all;
  animation: slideInRight 0.3s ease forwards;
  transition: var(--transition);
}

.toast.removing { animation: slideOutRight 0.3s ease forwards; }

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

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

/* ─── Loading ────────────────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  padding: 40px;
}

.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ─── Empty State ────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-state .icon { font-size: 3rem; margin-bottom: 12px; opacity: 0.5; }
.empty-state h3 { font-size: 1rem; color: var(--text-primary); margin-bottom: 4px; }
.empty-state p { font-size: 0.85rem; }

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .page { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr; }
  .login-card { padding: 28px 20px; width: calc(100vw - 32px); }
}

/* ─── Animations ─────────────────────────────────────────── */
.fade-in {
  animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.slide-in {
  animation: slideIn 0.3s ease forwards;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0); }
}

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

/* ─── Misc Utilities ─────────────────────────────────────── */
.text-primary   { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted     { color: var(--text-muted) !important; }
.text-accent    { color: var(--accent) !important; }
.text-success   { color: var(--success) !important; }
.text-danger    { color: var(--danger) !important; }
.text-warning   { color: var(--warning) !important; }
.text-center    { text-align: center; }
.text-right     { text-align: right; }
.font-mono      { font-family: 'JetBrains Mono', monospace; }
.fw-bold        { font-weight: 700; }
.fw-800         { font-weight: 800; }

.d-flex       { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8   { gap: 8px; }
.gap-12  { gap: 12px; }
.gap-16  { gap: 16px; }
.gap-20  { gap: 20px; }

.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }

.w-full { width: 100%; }
.overflow-hidden { overflow: hidden; }
.relative { position: relative; }

.divider { height: 1px; background: var(--border); margin: 20px 0; }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
