/* ============================================================
   SGI-DGPA — Système de Gestion Intégré
   Direction Générale des Productions Agricoles — Algérie
   Style Principal v2024
   ============================================================ */

:root {
  /* Palette institutionnelle */
  --primary: #0f5132;
  --primary-light: #198754;
  --primary-lighter: #e8f5e9;
  --primary-dark: #0a3622;
  --accent: #d4a017;
  --accent-light: #fff3cd;
  
  /* Couleurs fonctionnelles */
  --blue: #0d6efd;
  --blue-light: #e7f0ff;
  --red: #dc3545;
  --red-light: #fde8ea;
  --orange: #fd7e14;
  --orange-light: #fff0e6;
  --green: #198754;
  --green-light: #e8f5e9;
  --purple: #6f42c1;
  --purple-light: #f0ebff;
  --cyan: #0dcaf0;
  
  /* UI Colors */
  --bg-main: #f0f4f0;
  --bg-card: #ffffff;
  --bg-sidebar: #0a3622;
  --border: #dee2e6;
  --border-light: #e9ecef;
  --text-main: #1a2e1a;
  --text-secondary: #6c757d;
  --text-muted: #adb5bd;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 4px;
  
  /* Sidebar */
  --sidebar-w: 280px;
  --topbar-h: 64px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- RESET ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body { font-family: 'Inter', 'Cairo', sans-serif; background: var(--bg-main); color: var(--text-main); min-height: 100vh; overflow-x: hidden; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 0.95rem; }
ul { list-style: none; }

/* ============================================================
   ÉCRAN DE CONNEXION
   ============================================================ */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0a3622 0%, #0f5132 40%, #1a6b3a 70%, #2d8a4e 100%);
  position: relative;
  overflow: hidden;
}

.login-bg-overlay {
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
}

.particles { position: absolute; inset: 0; pointer-events: none; }
.particle {
  position: absolute;
  width: 4px; height: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  animation: float 8s infinite ease-in-out;
}
.particle:nth-child(1) { left: 10%; top: 20%; animation-delay: 0s; }
.particle:nth-child(2) { left: 30%; top: 60%; animation-delay: 1.5s; width: 6px; height: 6px; }
.particle:nth-child(3) { left: 60%; top: 30%; animation-delay: 3s; }
.particle:nth-child(4) { left: 80%; top: 70%; animation-delay: 4.5s; width: 3px; height: 3px; }
.particle:nth-child(5) { left: 50%; top: 80%; animation-delay: 2s; }
.particle:nth-child(6) { left: 90%; top: 15%; animation-delay: 6s; width: 5px; height: 5px; }

@keyframes float {
  0%, 100% { transform: translateY(0px) scale(1); opacity: 0.2; }
  50% { transform: translateY(-30px) scale(1.2); opacity: 0.5; }
}

.login-container {
  width: 100%;
  max-width: 700px;
  padding: 2rem;
  position: relative;
  z-index: 10;
}

.login-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding: 1.5rem 2rem;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
}

.emblem-circle {
  width: 70px; height: 70px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #f0b93a);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem;
  color: var(--primary-dark);
  box-shadow: 0 4px 20px rgba(212, 160, 23, 0.4);
  flex-shrink: 0;
}

.login-org-ministry {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.6;
}

.login-org-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  margin-top: 0.3rem;
  line-height: 1.3;
}

.login-org-subtitle {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 500;
  margin-top: 0.2rem;
  letter-spacing: 0.08em;
}

.login-form-card {
  background: rgba(255,255,255,0.97);
  border-radius: var(--radius);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
}

.login-form-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}

.login-form-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.8rem;
}

.login-error {
  background: var(--red-light);
  border: 1px solid #f5c6cb;
  color: var(--red);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.form-group { margin-bottom: 1.2rem; }
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  color: var(--text-main);
  background: #fff;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 81, 50, 0.1);
}

.password-wrapper { position: relative; }
.password-wrapper input { padding-right: 3rem; }
.toggle-pw {
  position: absolute;
  right: 1rem; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}
.toggle-pw:hover { color: var(--primary); }

.btn-login {
  width: 100%;
  padding: 0.9rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  transition: var(--transition);
  margin-top: 0.5rem;
}
.btn-login:hover { background: linear-gradient(135deg, var(--primary-dark), var(--primary)); transform: translateY(-1px); box-shadow: 0 4px 15px rgba(15,81,50,0.3); }

.login-demo {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-light);
}
.demo-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.8rem;
}
.demo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}
.demo-btn {
  padding: 0.5rem;
  background: var(--primary-lighter);
  color: var(--primary);
  border: 1px solid rgba(15,81,50,0.2);
  border-radius: var(--radius-xs);
  font-size: 0.75rem;
  font-weight: 500;
  transition: var(--transition);
  text-align: center;
}
.demo-btn:hover { background: var(--primary); color: white; }

.login-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 1.5rem;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.5);
  padding: 0 0.5rem;
}

/* ============================================================
   LAYOUT PRINCIPAL
   ============================================================ */
.app { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: linear-gradient(180deg, var(--bg-sidebar) 0%, #0d4829 100%);
  color: rgba(255,255,255,0.85);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 1000;
  transition: var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }

.sidebar.collapsed { width: 72px; }
.sidebar.collapsed .sidebar-brand,
.sidebar.collapsed .user-info,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .sidebar-live span { display: none; }
.sidebar.collapsed .sidebar-user { padding: 1rem 0; justify-content: center; }
.sidebar.collapsed .nav-item { padding: 0.9rem; justify-content: center; }
.sidebar.collapsed .nav-item i { margin: 0; font-size: 1.2rem; }

.sidebar-header {
  padding: 1.2rem 1.2rem 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo { display: flex; align-items: center; gap: 0.8rem; }
.sidebar-emblem {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--accent), #f0b93a);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  color: var(--primary-dark);
  flex-shrink: 0;
}

.brand-title { font-size: 1rem; font-weight: 700; color: white; }
.brand-subtitle { font-size: 0.65rem; color: rgba(255,255,255,0.55); display: block; }

.sidebar-toggle {
  color: rgba(255,255,255,0.6);
  font-size: 1rem;
  padding: 0.4rem;
  border-radius: var(--radius-xs);
  transition: var(--transition);
}
.sidebar-toggle:hover { color: white; background: rgba(255,255,255,0.1); }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 1.2rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  cursor: default;
}

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

.user-name { font-size: 0.85rem; font-weight: 600; color: white; }
.user-role-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  background: rgba(212, 160, 23, 0.3);
  border: 1px solid rgba(212, 160, 23, 0.5);
  border-radius: 20px;
  font-size: 0.65rem;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.05em;
  margin: 0.15rem 0;
}
.user-dir { font-size: 0.7rem; color: rgba(255,255,255,0.5); }

/* Navigation */
.sidebar-nav { flex: 1; padding: 0.8rem 0; }
.nav-section-title {
  padding: 0.6rem 1.2rem 0.3rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  margin-top: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.7rem 1.2rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255,255,255,0.7);
  transition: var(--transition);
  position: relative;
  margin: 0.1rem 0.5rem;
  border-radius: var(--radius-sm);
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: white; }
.nav-item.active { background: rgba(255,255,255,0.12); color: white; }
.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-item i { font-size: 0.95rem; width: 18px; text-align: center; flex-shrink: 0; }
.nav-item span { flex: 1; }

.nav-badge {
  padding: 0.1rem 0.5rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--blue);
  color: white;
}
.nav-badge.warn { background: var(--orange); }
.nav-badge.danger { background: var(--red); }

.sidebar-live {
  padding: 0.8rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.75rem;
  color: rgba(255,255,255,0.5);
}

/* MAIN WRAPPER */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: var(--transition);
}
.main-wrapper.expanded { margin-left: 72px; }

/* TOPBAR */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.topbar-left { display: flex; align-items: center; gap: 1rem; }
.topbar-menu-btn { font-size: 1.1rem; color: var(--text-secondary); padding: 0.5rem; border-radius: var(--radius-xs); transition: var(--transition); }
.topbar-menu-btn:hover { background: var(--border-light); }
.topbar-breadcrumb { font-size: 0.95rem; font-weight: 600; color: var(--primary); }

.topbar-center { display: flex; flex-direction: column; align-items: center; }
.topbar-clock { font-size: 1.3rem; font-weight: 700; color: var(--primary); font-variant-numeric: tabular-nums; letter-spacing: 0.05em; }
.topbar-date { font-size: 0.7rem; color: var(--text-secondary); }

.topbar-right { display: flex; align-items: center; gap: 0.5rem; }

.live-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.8rem;
  background: var(--green-light);
  border: 1px solid rgba(25, 135, 84, 0.3);
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--green);
  letter-spacing: 0.05em;
}

.live-dot, .live-pulse {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
}
.live-pulse { animation: pulse 1.5s infinite; }
.live-dot { animation: pulse-slow 2s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}
@keyframes pulse-slow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.topbar-icon-btn {
  position: relative;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-size: 1rem;
  color: var(--text-secondary);
  transition: var(--transition);
}
.topbar-icon-btn:hover { background: var(--border-light); color: var(--primary); }

.topbar-badge {
  position: absolute;
  top: 2px; right: 2px;
  min-width: 18px; height: 18px;
  background: var(--red);
  color: white;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid white;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.topbar-user:hover { background: var(--border-light); }

.topbar-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
}
.topbar-user-info span { display: block; font-size: 0.85rem; font-weight: 600; }
.topbar-user-info small { font-size: 0.7rem; color: var(--text-secondary); }
.topbar-user i { font-size: 0.7rem; color: var(--text-muted); }

.user-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 200px;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  overflow: hidden;
}

.dropdown-item {
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition);
}
.dropdown-item:hover { background: var(--primary-lighter); color: var(--primary); }
.dropdown-item.danger { color: var(--red); }
.dropdown-item.danger:hover { background: var(--red-light); }
.dropdown-divider { height: 1px; background: var(--border-light); }

/* ============================================================
   PAGE CONTENT
   ============================================================ */
.page-content {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
}

.page { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.page-subtitle { font-size: 0.875rem; color: var(--text-secondary); margin-top: 0.2rem; }
.page-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

/* ============================================================
   BOUTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 12px rgba(15,81,50,0.3); }

.btn-success { background: var(--green); color: white; }
.btn-success:hover { background: #157347; }

.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #bb2d3b; box-shadow: 0 4px 12px rgba(220,53,69,0.3); }

.btn-warning { background: var(--orange); color: white; }
.btn-warning:hover { background: #e8690a; box-shadow: 0 4px 12px rgba(253,126,20,0.3); }

.btn-outline {
  background: white;
  color: var(--text-main);
  border: 1.5px solid var(--border);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-lighter); }

.btn-outline.active { background: var(--primary); color: white; border-color: var(--primary); }

.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.8rem; }
.btn-lg { padding: 0.8rem 1.5rem; font-size: 1rem; }

/* ============================================================
   KPI GRID
   ============================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.4rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--border-light);
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
}
.kpi-card.blue::before { background: var(--blue); }
.kpi-card.green::before { background: var(--green); }
.kpi-card.red::before { background: var(--red); }
.kpi-card.orange::before { background: var(--orange); }
.kpi-card.purple::before { background: var(--purple); }
.kpi-card.teal::before { background: #0d9488; }

.kpi-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.kpi-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.kpi-card.blue .kpi-icon { background: var(--blue-light); color: var(--blue); }
.kpi-card.green .kpi-icon { background: var(--green-light); color: var(--green); }
.kpi-card.red .kpi-icon { background: var(--red-light); color: var(--red); }
.kpi-card.orange .kpi-icon { background: var(--orange-light); color: var(--orange); }
.kpi-card.purple .kpi-icon { background: var(--purple-light); color: var(--purple); }
.kpi-card.teal .kpi-icon { background: #ccfbf1; color: #0d9488; }

.kpi-value { font-size: 2rem; font-weight: 800; color: var(--text-main); line-height: 1; }
.kpi-label { font-size: 0.8rem; color: var(--text-secondary); margin-top: 0.2rem; }
.kpi-trend { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.4rem; }

/* ============================================================
   DASHBOARD GRID
   ============================================================ */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.2rem;
}

/* Cartes spécifiques dashboard */
.agenda-dash-card,
.reunions-dash-card { grid-column: span 1; }

.dash-agenda-list,
.dash-reunions-list {
  padding: 0.6rem 0.8rem;
  display: flex; flex-direction: column; gap: 0.4rem;
  max-height: 220px; overflow-y: auto;
}
.dash-agenda-item {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.5rem 0.6rem; border-radius: var(--radius-sm);
  background: #f8faf8; border-left: 3px solid var(--primary);
  cursor: pointer; transition: var(--transition); font-size: 0.82rem;
}
.dash-agenda-item:hover { background: var(--primary-lighter); transform: translateX(2px); }
.dash-agenda-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.dash-agenda-time { font-size: 0.7rem; color: var(--text-muted); min-width: 55px; font-weight: 600; }
.dash-agenda-title { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-agenda-date { font-size: 0.68rem; color: var(--text-muted); white-space: nowrap; }

.dash-reun-item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.5rem 0.6rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border-light); background: white;
  cursor: pointer; transition: var(--transition); font-size: 0.82rem;
}
.dash-reun-item:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.dash-reun-icon {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; flex-shrink: 0;
}
.dash-reun-info { flex: 1; min-width: 0; }
.dash-reun-titre { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-reun-meta { font-size: 0.7rem; color: var(--text-secondary); margin-top: 0.1rem; }


.dash-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.dash-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border-light);
}
.dash-card-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Urgences list in dashboard */
.urgences-list { padding: 0.8rem; display: flex; flex-direction: column; gap: 0.5rem; max-height: 240px; overflow-y: auto; }
.urgence-item-mini {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.urgence-item-mini:hover { transform: translateX(3px); }
.urgence-item-mini.critique { background: #fff5f5; border-left: 3px solid var(--red); }
.urgence-item-mini.alerte { background: #fff8f0; border-left: 3px solid var(--orange); }
.urgence-item-mini.avertissement { background: #fffef0; border-left: 3px solid #ffc107; }
.urgence-item-mini.info { background: var(--blue-light); border-left: 3px solid var(--blue); }

.urg-level-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.urg-level-dot.critique { background: var(--red); animation: pulse 1.5s infinite; }
.urg-level-dot.alerte { background: var(--orange); }
.urg-level-dot.avertissement { background: #ffc107; }
.urg-level-dot.info { background: var(--blue); }

.urg-mini-title { font-size: 0.85rem; font-weight: 500; }
.urg-mini-dir { font-size: 0.72rem; color: var(--text-secondary); }
.urg-mini-time { font-size: 0.7rem; color: var(--text-muted); margin-left: auto; }

/* Courriers compact */
.courriers-list-compact { padding: 0.8rem; display: flex; flex-direction: column; gap: 0.4rem; max-height: 240px; overflow-y: auto; }
.courrier-item-mini {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: var(--transition);
}
.courrier-item-mini:hover { background: var(--primary-lighter); }
.courrier-type-dot {
  width: 28px; height: 28px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem;
  flex-shrink: 0;
}
.courrier-type-dot.arrivee { background: var(--blue-light); color: var(--blue); }
.courrier-type-dot.depart { background: var(--green-light); color: var(--green); }
.courrier-type-dot.interne { background: var(--purple-light); color: var(--purple); }
.courrier-type-dot.circulaire { background: var(--orange-light); color: var(--orange); }

.cour-mini-body { flex: 1; min-width: 0; }
.cour-mini-objet { font-size: 0.83rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cour-mini-objet.unread-text { font-weight: 700; color: var(--text-main); }
.cour-mini-meta { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.15rem; flex-wrap: wrap; }
.cour-mini-date { font-size: 0.7rem; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.courrier-item-mini.unread { background: var(--blue-light); }
.courrier-item-mini.unread:hover { background: #d0e8ff; }

.action-mini-body { flex: 1; min-width: 0; }

/* Kanban Mini */
.kanban-mini {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  padding: 0.8rem;
  border-bottom: 1px solid var(--border-light);
}
.kanban-mini-col { text-align: center; padding: 0.5rem; border-radius: var(--radius-xs); background: var(--bg-main); }
.kmini-title { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.3rem; }
.kmini-title.pending { color: var(--text-secondary); }
.kmini-title.progress { color: var(--blue); }
.kmini-title.review { color: var(--orange); }
.kmini-title.done { color: var(--green); }
.kmini-count { font-size: 1.5rem; font-weight: 800; color: var(--text-main); }

.actions-list-compact { padding: 0.8rem; display: flex; flex-direction: column; gap: 0.4rem; max-height: 160px; overflow-y: auto; }
.action-item-mini {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: var(--transition);
}
.action-item-mini:hover { background: var(--primary-lighter); }

/* Directions status grid */
.directions-status-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.dir-status-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  padding: 1rem;
  transition: var(--transition);
}
.dir-status-card:hover { box-shadow: var(--shadow); border-color: var(--primary); }
.dir-status-header { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.8rem; }
.dir-status-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--primary-lighter);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
}
.dir-status-name { font-size: 0.82rem; font-weight: 600; line-height: 1.3; }
.dir-status-code { font-size: 0.7rem; color: var(--text-secondary); }
.dir-stats { display: flex; gap: 0.5rem; }
.dir-stat-pill {
  flex: 1;
  text-align: center;
  padding: 0.3rem;
  border-radius: var(--radius-xs);
  font-size: 0.7rem;
}
.dir-stat-pill span { display: block; font-size: 1rem; font-weight: 700; }
.dir-stat-pill.courriers { background: var(--blue-light); color: var(--blue); }
.dir-stat-pill.actions { background: var(--green-light); color: var(--green); }
.dir-stat-pill.urgences { background: var(--red-light); color: var(--red); }

/* ============================================================
   FILTERS BAR
   ============================================================ */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  padding: 1rem;
  background: white;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}
.filter-group { display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; }
.filter-btn {
  padding: 0.4rem 0.9rem;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
  background: white;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.filter-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

.filter-right { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.filter-select {
  padding: 0.4rem 0.8rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  background: white;
  color: var(--text-main);
}
.filter-select:focus { outline: none; border-color: var(--primary); }

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-box i { position: absolute; left: 0.7rem; color: var(--text-muted); font-size: 0.85rem; }
.search-box input {
  padding: 0.4rem 0.8rem 0.4rem 2rem;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: 0.85rem;
  width: 220px;
  transition: var(--transition);
}
.search-box input:focus { outline: none; border-color: var(--primary); width: 260px; }

/* ============================================================
   TABLEAU DE DONNÉES
   ============================================================ */
.table-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead tr {
  background: #f8faf8;
  border-bottom: 2px solid var(--border);
}
.data-table th {
  padding: 0.9rem 1rem;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition);
}
.data-table tbody tr:hover { background: #f9fbf9; }
.data-table tbody tr:last-child { border-bottom: none; }

.data-table td {
  padding: 0.8rem 1rem;
  font-size: 0.875rem;
  vertical-align: middle;
}

.table-empty {
  text-align: center;
  padding: 2.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.table-empty i { font-size: 2rem; display: block; margin-bottom: 0.5rem; }

.table-pagination {
  padding: 0.8rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  justify-content: flex-end;
  border-top: 1px solid var(--border-light);
}

/* ============================================================
   BADGES & PILLS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-blue { background: var(--blue-light); color: var(--blue); }
.badge-green { background: var(--green-light); color: var(--green); }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-orange { background: var(--orange-light); color: var(--orange); }
.badge-purple { background: var(--purple-light); color: var(--purple); }
.badge-gray { background: #f0f0f0; color: #555; }
.badge-gold { background: var(--accent-light); color: #856404; }

/* Type courrier */
.type-arrivee { background: var(--blue-light); color: var(--blue); }
.type-depart { background: var(--green-light); color: var(--green); }
.type-interne { background: var(--purple-light); color: var(--purple); }
.type-circulaire { background: var(--orange-light); color: var(--orange); }

/* Priorité */
.priorite-tres_urgente { background: #fde8ea; color: var(--red); font-weight: 700; }
.priorite-urgente { background: var(--orange-light); color: var(--orange); }
.priorite-normale { background: #f0f0f0; color: #555; }
.priorite-confidentielle { background: var(--purple-light); color: var(--purple); }

/* Statut courrier */
.statut-en_attente { background: var(--blue-light); color: var(--blue); font-weight: 700; }
.statut-lu { background: #f0f0f0; color: #555; }
.statut-traite { background: var(--green-light); color: var(--green); font-weight: 600; }
.statut-archive { background: #e9ecef; color: #6c757d; }
/* Statut action */
.statut-en_cours { background: #dbeafe; color: #1d4ed8; font-weight: 600; }
.statut-en_revision { background: var(--orange-light); color: var(--orange); font-weight: 600; }
.statut-termine { background: var(--green-light); color: var(--green); font-weight: 600; }
/* Statut urgence */
.statut-prise_en_charge { background: var(--orange-light); color: var(--orange); font-weight: 700; }
.statut-resolue { background: var(--green-light); color: var(--green); font-weight: 600; }
.statut-cloturee { background: #e9ecef; color: #6c757d; }
.statut-planifiee { background: var(--blue-light); color: var(--blue); }
.statut-annulee { background: #e9ecef; color: #6c757d; }
.statut-terminee { background: var(--green-light); color: var(--green); }

/* ============================================================
   KANBAN
   ============================================================ */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  align-items: start;
}

.kanban-col {
  background: #f8faf8;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  min-height: 400px;
}

.kanban-col-header {
  padding: 0.8rem 1rem;
  font-size: 0.875rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 2px solid;
  border-radius: var(--radius) var(--radius) 0 0;
}
.kanban-col-header.pending { color: var(--text-secondary); border-color: var(--border); background: #f0f0f0; }
.kanban-col-header.progress { color: var(--blue); border-color: var(--blue); background: var(--blue-light); }
.kanban-col-header.review { color: var(--orange); border-color: var(--orange); background: var(--orange-light); }
.kanban-col-header.done { color: var(--green); border-color: var(--green); background: var(--green-light); }

.col-count {
  margin-left: auto;
  background: rgba(0,0,0,0.1);
  padding: 0.1rem 0.5rem;
  border-radius: 20px;
  font-size: 0.75rem;
}

.kanban-col-body { padding: 0.8rem; display: flex; flex-direction: column; gap: 0.6rem; min-height: 150px; }

.kanban-card {
  background: white;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  padding: 0.9rem;
  cursor: grab;
  transition: var(--transition);
  position: relative;
}
.kanban-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: 0.5; }

.kcard-title { font-size: 0.875rem; font-weight: 600; margin-bottom: 0.4rem; }
.kcard-dir { font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 0.6rem; display: flex; align-items: center; gap: 0.3rem; }
.kcard-meta { display: flex; align-items: center; justify-content: space-between; }
.kcard-priority {
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-xs);
  font-size: 0.7rem;
  font-weight: 600;
}
.kcard-priority.critique { background: var(--red-light); color: var(--red); }
.kcard-priority.haute { background: var(--orange-light); color: var(--orange); }
.kcard-priority.normale { background: #f0f0f0; color: #555; }
.kcard-priority.faible { background: var(--green-light); color: var(--green); }

.kcard-progress { margin-top: 0.6rem; }
.progress-bar-wrap { background: var(--border-light); border-radius: 4px; height: 4px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--primary), var(--primary-light)); transition: width 0.4s ease; }

.kcard-due { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.4rem; display: flex; align-items: center; gap: 0.3rem; }
.kcard-due.overdue { color: var(--red); font-weight: 600; }

.kcard-actions { position: absolute; top: 0.5rem; right: 0.5rem; display: none; gap: 0.2rem; }
.kanban-card:hover .kcard-actions { display: flex; }
.kcard-btn { width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; border-radius: 4px; font-size: 0.75rem; color: var(--text-muted); transition: var(--transition); background: var(--border-light); }
.kcard-btn:hover { background: var(--primary); color: white; }

/* ============================================================
   URGENCES
   ============================================================ */
.urgences-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.2rem;
}
.urg-stat {
  background: white;
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  text-align: center;
  border: 1px solid var(--border-light);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.urg-stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.urg-stat i { font-size: 1.4rem; }
.urg-stat-val { font-size: 1.8rem; font-weight: 800; }
.urg-stat.critique { color: var(--red); }
.urg-stat.alerte { color: var(--orange); }
.urg-stat.avertissement { color: #856404; }
.urg-stat.resolue { color: var(--green); }

.urgences-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.urgence-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  overflow: hidden;
  transition: var(--transition);
}
.urgence-card:hover { box-shadow: var(--shadow-lg); }

.urgence-card-header {
  padding: 0.8rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.urgence-card-header.critique { background: linear-gradient(90deg, var(--red-light), #fff); border-left: 4px solid var(--red); }
.urgence-card-header.alerte { background: linear-gradient(90deg, var(--orange-light), #fff); border-left: 4px solid var(--orange); }
.urgence-card-header.avertissement { background: linear-gradient(90deg, #fff9e6, #fff); border-left: 4px solid #ffc107; }
.urgence-card-header.info { background: linear-gradient(90deg, var(--blue-light), #fff); border-left: 4px solid var(--blue); }
.urgence-card-header.resolue { background: linear-gradient(90deg, var(--green-light), #fff); border-left: 4px solid var(--green); }

.urgence-card-body { padding: 1rem; }
.urg-titre { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.4rem; }
.urg-desc { font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 0.8rem; }
.urg-meta { font-size: 0.75rem; color: var(--text-muted); display: flex; gap: 0.8rem; flex-wrap: wrap; }
.urg-meta span { display: flex; align-items: center; gap: 0.2rem; }
.urgence-card-footer { padding: 0.6rem 1rem; border-top: 1px solid var(--border-light); display: flex; gap: 0.4rem; justify-content: flex-end; }

/* ============================================================
   MESSAGERIE
   ============================================================ */
.messaging-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  height: calc(100vh - var(--topbar-h) - 6rem);
  overflow: hidden;
}

.messaging-sidebar {
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.msg-sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border-light);
  background: #f8faf8;
}

.msg-search {
  position: relative;
  display: flex;
  align-items: center;
}
.msg-search i { position: absolute; left: 0.7rem; font-size: 0.8rem; color: var(--text-muted); }
.msg-search input {
  width: 100%;
  padding: 0.5rem 0.8rem 0.5rem 2rem;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: 0.8rem;
}
.msg-search input:focus { outline: none; border-color: var(--primary); }

.msg-channels {
  overflow-y: auto;
  padding: 0.5rem 0;
}
.msg-channel-section {
  padding: 0.5rem 1rem 0.2rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.msg-channel {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 1rem;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.msg-channel:hover { background: var(--primary-lighter); }
.msg-channel.active { background: var(--primary-lighter); }
.msg-channel.active::before {
  content: '';
  position: absolute;
  left: 0; top: 10%; bottom: 10%;
  width: 3px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}

.ch-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.ch-icon.general { background: var(--primary-lighter); color: var(--primary); }
.ch-icon.annonce { background: var(--accent-light); color: #856404; }
.ch-icon.direction { background: var(--blue-light); color: var(--blue); }
.ch-icon.user { background: #f0f0f0; color: #555; }

.ch-info { flex: 1; min-width: 0; }
.ch-name { font-size: 0.85rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-last { font-size: 0.72rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-badge {
  background: var(--primary);
  color: white;
  border-radius: 50%;
  width: 20px; height: 20px;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* Chat Area */
.messaging-main { display: flex; flex-direction: column; overflow: hidden; }

.chat-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: white;
}
.chat-title { font-size: 1rem; font-weight: 700; color: var(--primary); }
.chat-subtitle { font-size: 0.75rem; color: var(--text-secondary); }
.chat-header-actions { display: flex; gap: 0.4rem; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.chat-message { display: flex; gap: 0.7rem; max-width: 80%; }
.chat-message.own { align-self: flex-end; flex-direction: row-reverse; }
.chat-message.own .msg-bubble { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: white; }
.chat-message.own .msg-bubble a { color: rgba(255,255,255,0.8); }

.msg-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--primary-lighter);
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 4px;
}

.msg-content { display: flex; flex-direction: column; gap: 0.2rem; }
.msg-sender { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; }
.chat-message.own .msg-sender { text-align: right; }

.msg-bubble {
  background: white;
  border: 1px solid var(--border-light);
  border-radius: 12px 12px 12px 4px;
  padding: 0.7rem 1rem;
  font-size: 0.875rem;
  line-height: 1.5;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.chat-message.own .msg-bubble { border-radius: 12px 12px 4px 12px; }

.msg-bubble.msg-important { border-left: 3px solid var(--orange); background: #fff8f0; }
.msg-bubble.msg-annonce { border-left: 3px solid var(--primary); background: var(--primary-lighter); }
.msg-bubble.msg-info { border-left: 3px solid var(--blue); background: var(--blue-light); }

.msg-time { font-size: 0.68rem; color: var(--text-muted); }
.chat-message.own .msg-time { text-align: right; }

.chat-date-divider {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.chat-date-divider::before, .chat-date-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-light);
}

.chat-loading { display: flex; align-items: center; justify-content: center; gap: 0.5rem; color: var(--text-muted); font-size: 0.9rem; padding: 2rem; }

.chat-input-area {
  border-top: 1px solid var(--border-light);
  padding: 1rem;
}
.chat-input-toolbar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}
.chat-tool-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: var(--transition);
}
.chat-tool-btn:hover { background: var(--border-light); color: var(--primary); }
.msg-type-select {
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 0.75rem;
  margin-left: auto;
  background: white;
}

.chat-input-wrapper { display: flex; gap: 0.5rem; align-items: flex-end; }
.chat-input-wrapper textarea {
  flex: 1;
  padding: 0.7rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  resize: none;
  font-size: 0.875rem;
  transition: var(--transition);
  max-height: 100px;
}
.chat-input-wrapper textarea:focus { outline: none; border-color: var(--primary); }

.btn-send {
  width: 42px; height: 42px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.95rem;
  transition: var(--transition);
  flex-shrink: 0;
}
.btn-send:hover { background: var(--primary-dark); transform: scale(1.05); }

.chat-input-hint { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.3rem; }

/* ============================================================
   NOTIFICATIONS
   ============================================================ */
.notifications-list { display: flex; flex-direction: column; gap: 0.5rem; }

.notif-item {
  background: white;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--border);
  padding: 1rem 1.2rem;
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  transition: var(--transition);
  cursor: pointer;
}
.notif-item:hover { box-shadow: var(--shadow); }
.notif-item.unread { background: #f8faf8; border-left-color: var(--primary); }
.notif-item.type-urgence { border-left-color: var(--red); }
.notif-item.type-courrier { border-left-color: var(--blue); }
.notif-item.type-action { border-left-color: var(--green); }
.notif-item.type-message { border-left-color: var(--orange); }

.notif-icon {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}
.notif-item.type-urgence .notif-icon { background: var(--red-light); color: var(--red); }
.notif-item.type-courrier .notif-icon { background: var(--blue-light); color: var(--blue); }
.notif-item.type-action .notif-icon { background: var(--green-light); color: var(--green); }
.notif-item.type-message .notif-icon { background: var(--orange-light); color: var(--orange); }

.notif-content { flex: 1; }
.notif-title { font-size: 0.875rem; font-weight: 600; margin-bottom: 0.2rem; }
.notif-msg { font-size: 0.8rem; color: var(--text-secondary); }
.notif-time { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.3rem; }
.notif-unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 0.4rem; flex-shrink: 0; }

/* ============================================================
   RAPPORTS
   ============================================================ */
.reports-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.2rem;
}

.report-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  padding: 1.2rem;
}
.report-card h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 1rem; color: var(--primary); }

/* ============================================================
   ORGANIGRAMME
   ============================================================ */
.organigramme-wrapper { overflow-x: auto; padding: 1rem; }

.org-tree {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.org-level { display: flex; gap: 1.5rem; justify-content: center; flex-wrap: wrap; }

.org-node {
  background: white;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  padding: 0.8rem 1.2rem;
  text-align: center;
  min-width: 180px;
  max-width: 200px;
  position: relative;
  transition: var(--transition);
}
.org-node:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.org-node.root { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: white; border-color: var(--primary); min-width: 280px; max-width: 320px; }
.org-node.directeur { border-color: var(--blue); border-top: 4px solid var(--blue); }
.org-node.sous-directeur { border-color: var(--border); border-top: 3px solid var(--accent); background: #fafafa; min-width: 150px; max-width: 170px; }

.org-node-title { font-size: 0.8rem; font-weight: 600; margin-bottom: 0.3rem; }
.org-node-code { font-size: 0.7rem; opacity: 0.7; }
.org-node-icon { font-size: 1.3rem; margin-bottom: 0.4rem; }

.org-connector {
  width: 2px;
  height: 30px;
  background: var(--border);
  margin: 0 auto;
}

.org-children {
  display: flex;
  gap: 1rem;
  justify-content: center;
  padding-top: 1rem;
  border-top: 2px solid var(--border);
  margin-top: 1rem;
  flex-wrap: wrap;
}

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
  animation: overlayFadeIn 0.2s ease;
}
@keyframes overlayFadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: white;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  max-height: 90vh;
  overflow-y: auto;
  width: 100%;
  animation: modalSlideIn 0.3s ease;
}
@keyframes modalSlideIn { from { opacity: 0; transform: translateY(-20px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }

.modal { max-width: 560px; }
.modal-lg { max-width: 780px; }
.modal-xl { max-width: 1000px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
}
.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.modal-header.danger-header { background: #fff5f5; border-bottom-color: #fde8ea; }
.modal-header.danger-header h2 { color: var(--red); }

.modal-close {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-size: 1rem;
  color: var(--text-muted);
  transition: var(--transition);
}
.modal-close:hover { background: var(--border-light); color: var(--text-main); }

.modal-body { padding: 1.5rem; }
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-light);
  background: #f8faf8;
}

/* Form elements in modals */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-hint { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.2rem; }

.select-multi {
  height: 100px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.4rem;
}
.select-multi option { padding: 0.3rem 0.5rem; border-radius: 3px; }
.select-multi option:checked { background: var(--primary); color: white; }

.urgence-warning {
  background: #fff8f0;
  border: 1px solid #ffd280;
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  font-size: 0.85rem;
  color: #856404;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: white;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  padding: 0.9rem 1.2rem;
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  min-width: 300px;
  max-width: 400px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  animation: toastIn 0.3s ease;
  position: relative;
  overflow: hidden;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
.toast.removing { animation: toastOut 0.3s ease forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateX(100%); } }

.toast::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
}
.toast.success::before { background: var(--green); }
.toast.error::before { background: var(--red); }
.toast.warning::before { background: var(--orange); }
.toast.info::before { background: var(--blue); }

.toast-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 2px; }
.toast.success .toast-icon { color: var(--green); }
.toast.error .toast-icon { color: var(--red); }
.toast.warning .toast-icon { color: var(--orange); }
.toast.info .toast-icon { color: var(--blue); }

.toast-title { font-size: 0.875rem; font-weight: 600; }
.toast-msg { font-size: 0.8rem; color: var(--text-secondary); margin-top: 0.15rem; }

.toast-close { margin-left: auto; color: var(--text-muted); font-size: 0.8rem; cursor: pointer; padding: 2px; }
.toast-close:hover { color: var(--text-main); }

/* ============================================================
   LOADING & EMPTY STATES
   ============================================================ */
.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 3rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}
.empty-state i { font-size: 3rem; display: block; margin-bottom: 1rem; opacity: 0.4; }
.empty-state p { font-size: 0.9rem; margin-bottom: 0.5rem; }
.empty-state small { font-size: 0.8rem; }

.empty-state-sm {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ============================================================
   PROFIL & ADMIN
   ============================================================ */
.profil-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  align-items: start;
}

.profil-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  padding: 2rem;
  text-align: center;
}
.profil-avatar-lg {
  width: 80px; height: 80px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
  margin: 0 auto 1rem;
}
.profil-name { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.4rem; }
.profil-role {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  background: var(--primary-lighter);
  color: var(--primary);
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.profil-dir { font-size: 0.8rem; color: var(--text-secondary); }

/* Badge dernière modification */
.profil-badge-last {
  margin-top: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.8rem;
  background: var(--green-light);
  color: var(--green);
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
}

/* ============================================================
   MODULE CHANGEMENT MOT DE PASSE
   ============================================================ */

.profil-section-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.7rem;
  border-bottom: 2px solid var(--primary-lighter);
}

.pw-change-card {
  border-color: rgba(15,81,50,0.15) !important;
  background: linear-gradient(135deg, #fafffb, #fff) !important;
}

.pw-alert {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}
.pw-alert i { flex-shrink: 0; margin-top: 2px; }
.pw-success { background: var(--green-light); color: var(--green); border: 1px solid rgba(25,135,84,0.3); }
.pw-error   { background: var(--red-light);   color: var(--red);   border: 1px solid rgba(220,53,69,0.3); }

/* Jauge de force du mot de passe */
.pw-strength-wrap {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: 0.5rem;
}
.pw-strength-bar {
  flex: 1;
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
}
.pw-strength-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease, background 0.4s ease;
  width: 0%;
}
.pw-strength-fill.weak   { background: var(--red);    width: 25%; }
.pw-strength-fill.fair   { background: var(--orange);  width: 50%; }
.pw-strength-fill.good   { background: #ffc107;        width: 75%; }
.pw-strength-fill.strong { background: var(--green);   width: 100%; }

.pw-strength-label {
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  min-width: 70px;
}
.pw-strength-label.weak   { color: var(--red); }
.pw-strength-label.fair   { color: var(--orange); }
.pw-strength-label.good   { color: #856404; }
.pw-strength-label.strong { color: var(--green); }

/* Critères */
.pw-criteria {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem 1rem;
  margin-top: 0.6rem;
  padding: 0.7rem 0.9rem;
  background: #f8faf8;
  border-radius: var(--radius-sm);
}
.pw-crit {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition);
}
.pw-crit i { font-size: 0.6rem; }
.pw-crit.ok   { color: var(--green); }
.pw-crit.ok i::before { content: "\f058"; } /* fa-check-circle */
.pw-crit.fail { color: var(--red); }
.pw-crit.fail i::before { content: "\f057"; } /* fa-times-circle */

/* Correspondance confirmation */
.pw-match-hint {
  margin-top: 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.pw-match-hint.match   { color: var(--green); }
.pw-match-hint.nomatch { color: var(--red); }

/* Boutons action */
.pw-action-row {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-light);
}

/* Monospace pour l'identifiant */
.detail-value.mono {
  font-family: 'Courier New', monospace;
  background: #f4f4f4;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-xs);
  font-size: 0.9rem;
  display: inline-block;
}

/* Champ requis */
.required { color: var(--red); margin-left: 2px; }

.profil-details {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.detail-group { padding-bottom: 1rem; border-bottom: 1px solid var(--border-light); }
.detail-group:last-child { border-bottom: none; padding-bottom: 0; }
.detail-label { font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.3rem; display: flex; align-items: center; gap: 0.4rem; }
.detail-value { font-size: 0.95rem; font-weight: 500; }

.admin-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.admin-tab {
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  display: flex; align-items: center; gap: 0.4rem;
  transition: var(--transition);
}
.admin-tab.active { background: var(--primary); color: white; border-color: var(--primary); }
.admin-tab:hover:not(.active) { border-color: var(--primary); color: var(--primary); }
.admin-panel { display: none; }
.admin-panel:first-child { display: block; }

/* ============================================================
   UTILITAIRES
   ============================================================ */
.text-red { color: var(--red); }
.text-green { color: var(--green); }
.text-blue { color: var(--blue); }
.text-orange { color: var(--orange); }
.text-purple { color: var(--purple); }

.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.section-header h2 { font-size: 1.1rem; font-weight: 700; color: var(--primary); display: flex; align-items: center; gap: 0.5rem; }

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

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1400px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kanban-board { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-280px); width: 280px !important; }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-wrapper { margin-left: 0 !important; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .messaging-layout { grid-template-columns: 1fr; }
  .messaging-sidebar { display: none; }
  .reports-grid { grid-template-columns: 1fr; }
  .profil-layout { grid-template-columns: 1fr; }
  .urgences-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .demo-grid { grid-template-columns: repeat(2,1fr); }
  .directions-status-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar-user-info { display: none; }
}

@media (max-width: 600px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .urgences-stats { grid-template-columns: repeat(2, 1fr); }
  .kanban-board { grid-template-columns: 1fr; }
  .page-content { padding: 1rem; }
  .login-header { flex-direction: column; text-align: center; }
  .login-form-card { padding: 1.5rem; }
  .directions-status-grid { grid-template-columns: 1fr; }
  .topbar-clock { font-size: 1rem; }
}

/* View toggle */
.view-toggle { display: flex; gap: 0; }
.view-toggle .btn { border-radius: 0; }
.view-toggle .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.view-toggle .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* ============================================================
   MODULE RÉUNIONS
   ============================================================ */
.reun-stats-bar {
  display: flex; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.reun-stat-pill {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 1rem; border-radius: 20px;
  font-size: 0.82rem; font-weight: 600;
  border: 1.5px solid transparent;
}
.reun-stat-pill span { font-size: 1.1rem; font-weight: 800; }
.reun-stat-pill.blue { background: var(--blue-light); color: var(--blue); border-color: rgba(13,110,253,.2); }
.reun-stat-pill.green { background: var(--green-light); color: var(--green); border-color: rgba(25,135,84,.2); }
.reun-stat-pill.orange { background: var(--orange-light); color: var(--orange); border-color: rgba(253,126,20,.2); }
.reun-stat-pill.red { background: var(--red-light); color: var(--red); border-color: rgba(220,53,69,.2); }

.reunions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.reunion-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
}
.reunion-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

.reunion-card-header {
  padding: 0.9rem 1.1rem;
  display: flex; align-items: flex-start; gap: 0.7rem;
  border-bottom: 1px solid var(--border-light);
}
.reunion-type-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}
.rtype-coordination { background: #e7f0ff; color: var(--blue); }
.rtype-bilan        { background: var(--green-light); color: var(--green); }
.rtype-urgence      { background: var(--red-light); color: var(--red); }
.rtype-formation    { background: var(--purple-light); color: var(--purple); }
.rtype-autre        { background: #f0f0f0; color: #555; }

.reunion-titre { font-size: 0.95rem; font-weight: 700; line-height: 1.3; }
.reunion-type-label { font-size: 0.72rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 0.15rem; }

.reunion-card-body { padding: 0.9rem 1.1rem; }
.reunion-meta { display: flex; flex-direction: column; gap: 0.35rem; }
.reunion-meta-item {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.82rem; color: var(--text-secondary);
}
.reunion-meta-item i { width: 16px; text-align: center; color: var(--text-muted); }
.reunion-meta-item strong { color: var(--text-main); }

.reunion-participants {
  display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.6rem;
}
.participant-chip {
  padding: 0.15rem 0.5rem;
  background: var(--primary-lighter); color: var(--primary);
  border-radius: 20px; font-size: 0.7rem; font-weight: 600;
}

.reunion-card-footer {
  padding: 0.6rem 1.1rem;
  border-top: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
}

/* Statut réunion */
.reun-statut { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0.6rem; border-radius: 20px; font-size: 0.72rem; font-weight: 700; }
.reun-statut.planifiee    { background: var(--blue-light); color: var(--blue); }
.reun-statut.en_cours     { background: var(--orange-light); color: var(--orange); }
.reun-statut.terminee     { background: var(--green-light); color: var(--green); }
.reun-statut.annulee      { background: #f0f0f0; color: #888; text-decoration: line-through; }

/* ============================================================
   MODULE CALENDRIER / PLANNING
   ============================================================ */
.cal-nav-bar {
  display: flex; align-items: center; gap: 0.7rem;
  margin-bottom: 1.2rem; flex-wrap: wrap;
}
.cal-current-period {
  font-size: 1.2rem; font-weight: 700; color: var(--primary);
  flex: 1; text-align: center;
}

.cal-grid-wrap {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  overflow: hidden;
  margin-bottom: 1rem;
}

.cal-month-header {
  display: grid; grid-template-columns: repeat(7, 1fr);
  background: var(--primary); color: white;
}
.cal-month-header div {
  text-align: center; padding: 0.7rem; font-size: 0.8rem;
  font-weight: 700; letter-spacing: 0.05em;
}

.cal-month-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
}

.cal-day {
  min-height: 100px;
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  padding: 0.3rem;
  position: relative;
  vertical-align: top;
  cursor: pointer;
  transition: background 0.15s;
}
.cal-day:hover { background: #f8fbf8; }
.cal-day:nth-child(7n) { border-right: none; }
.cal-day.other-month .cal-day-num { color: var(--text-muted); }
.cal-day.other-month { background: #fbfbfb; }
.cal-day.today { background: var(--primary-lighter); }
.cal-day.today .cal-day-num {
  background: var(--primary); color: white;
  border-radius: 50%; width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
}
.cal-day-num { font-size: 0.82rem; font-weight: 600; margin-bottom: 0.2rem; }

.cal-event {
  background: var(--blue); color: white;
  border-radius: 3px; padding: 1px 5px;
  font-size: 0.68rem; font-weight: 500;
  margin-bottom: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  cursor: pointer;
  transition: opacity 0.15s;
}
.cal-event:hover { opacity: 0.85; }

.cal-more {
  font-size: 0.65rem; color: var(--text-muted);
  cursor: pointer; padding: 0 2px;
}
.cal-more:hover { color: var(--primary); }

/* Vue agenda */
.agenda-list { display: flex; flex-direction: column; gap: 0.5rem; }
.agenda-day-group { margin-bottom: 1.2rem; }
.agenda-day-label {
  font-size: 0.85rem; font-weight: 700; color: var(--primary);
  padding: 0.4rem 0.8rem; background: var(--primary-lighter);
  border-radius: var(--radius-sm); margin-bottom: 0.5rem;
  display: flex; align-items: center; gap: 0.5rem;
}
.agenda-day-label.today-label { background: var(--primary); color: white; }

.agenda-item {
  background: white; border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--blue);
  padding: 0.7rem 1rem;
  display: flex; align-items: center; gap: 0.8rem;
  cursor: pointer; transition: var(--transition);
}
.agenda-item:hover { box-shadow: var(--shadow); transform: translateX(3px); }
.agenda-time { font-size: 0.78rem; font-weight: 700; color: var(--text-secondary); min-width: 70px; }
.agenda-content { flex: 1; }
.agenda-title { font-size: 0.875rem; font-weight: 600; }
.agenda-sub { font-size: 0.75rem; color: var(--text-secondary); }

/* Vue semaine */
.cal-week-grid {
  background: white; border-radius: var(--radius);
  border: 1px solid var(--border-light); overflow-x: auto;
}
.cal-week-row { display: grid; grid-template-columns: 60px repeat(7,1fr); border-bottom: 1px solid var(--border-light); }
.cal-week-row.header { background: var(--primary); color: white; font-size: 0.8rem; font-weight: 700; }
.cal-week-cell { padding: 0.5rem; border-right: 1px solid var(--border-light); min-height: 60px; font-size: 0.75rem; }
.cal-week-cell.time-label { text-align: right; color: var(--text-muted); font-size: 0.72rem; padding-top: 0.3rem; }
.cal-week-cell.today-col { background: #f8fbf8; }

/* Légende calendrier */
.cal-legend {
  display: flex; flex-wrap: wrap; gap: 1rem;
  padding: 0.8rem 1rem; background: white;
  border-radius: var(--radius-sm); border: 1px solid var(--border-light);
}
.leg-item {
  display: flex; align-items: center; gap: 0.4rem;
  font-size: 0.78rem; color: var(--text-secondary);
}
.leg-item i { color: var(--c, #888); font-size: 0.65rem; }

/* ============================================================
   MODULE DOCUMENTS / GED
   ============================================================ */
.doc-categories {
  display: flex; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.doc-cat {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 1rem; background: white;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; transition: var(--transition);
  font-size: 0.82rem; font-weight: 500;
}
.doc-cat:hover { border-color: var(--primary); color: var(--primary); }
.doc-cat.active { background: var(--primary); color: white; border-color: var(--primary); }
.doc-cat small { background: rgba(255,255,255,0.25); padding: 0.1rem 0.4rem; border-radius: 20px; font-size: 0.7rem; font-weight: 700; }
.doc-cat:not(.active) small { background: var(--border-light); color: var(--text-muted); }

.documents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.doc-card {
  background: white; border-radius: var(--radius);
  border: 1px solid var(--border-light);
  overflow: hidden; transition: var(--transition);
  cursor: pointer;
}
.doc-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

.doc-card-header {
  padding: 1rem; display: flex; align-items: center; gap: 0.8rem;
  border-bottom: 1px solid var(--border-light);
}
.doc-icon {
  width: 48px; height: 48px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; flex-shrink: 0;
}
.dtype-rapport    { background: #e7f0ff; color: var(--blue); }
.dtype-note       { background: var(--orange-light); color: var(--orange); }
.dtype-circulaire { background: #fff3cd; color: #856404; }
.dtype-guide      { background: var(--green-light); color: var(--green); }
.dtype-modele     { background: var(--purple-light); color: var(--purple); }
.dtype-autre      { background: #f0f0f0; color: #555; }

.doc-card-title { font-size: 0.9rem; font-weight: 700; line-height: 1.3; }
.doc-card-sub { font-size: 0.72rem; color: var(--text-secondary); margin-top: 0.15rem; }

.doc-card-body { padding: 0.7rem 1rem; }
.doc-card-desc { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 0.6rem; }
.doc-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.doc-tag { padding: 0.15rem 0.5rem; background: var(--primary-lighter); color: var(--primary); border-radius: 20px; font-size: 0.68rem; font-weight: 600; }

.doc-card-footer {
  padding: 0.6rem 1rem; border-top: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
}
.doc-meta-info { font-size: 0.72rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.4rem; }

/* ============================================================
   MODULE NOTES & MÉMOS
   ============================================================ */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  align-items: start;
}

.note-card {
  border-radius: var(--radius);
  border: 1px solid rgba(0,0,0,0.1);
  padding: 1rem;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.note-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

.note-pin {
  position: absolute; top: 0.6rem; right: 0.6rem;
  color: var(--orange); font-size: 0.9rem;
}

.note-titre { font-size: 0.9rem; font-weight: 700; margin-bottom: 0.5rem; color: var(--text-main); }
.note-contenu {
  font-size: 0.82rem; color: #444;
  line-height: 1.5; max-height: 120px; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical;
}
.note-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 0.8rem; padding-top: 0.5rem;
  border-top: 1px solid rgba(0,0,0,0.08);
  font-size: 0.72rem; color: #777;
}
.note-tags-wrap { display: flex; flex-wrap: wrap; gap: 0.2rem; margin-top: 0.5rem; }
.note-tag {
  padding: 0.1rem 0.4rem; border-radius: 20px;
  background: rgba(0,0,0,0.07); color: #555;
  font-size: 0.68rem; font-weight: 600;
}
.note-vis-badge {
  padding: 0.1rem 0.4rem; border-radius: 20px;
  background: rgba(0,0,0,0.07); font-size: 0.68rem; font-weight: 600;
}
.note-actions { display: flex; gap: 0.3rem; }
.note-btn {
  width: 28px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; color: #666; transition: var(--transition);
  background: rgba(0,0,0,0.05);
}
.note-btn:hover { background: rgba(0,0,0,0.15); }

/* Sélecteur de couleur pour les notes */
.color-picker-row {
  display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center;
  margin-top: 0.4rem;
}
.color-chip {
  width: 28px; height: 28px; border-radius: 50%;
  cursor: pointer; transition: var(--transition);
  border: 2px solid transparent;
}
.color-chip:hover { transform: scale(1.2); }
.color-chip.active { border-color: var(--primary); transform: scale(1.15); box-shadow: 0 0 0 2px white, 0 0 0 4px var(--primary); }

/* ============================================================
   MODULE ANNUAIRE
   ============================================================ */
.annuaire-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.contact-card {
  background: white; border-radius: var(--radius);
  border: 1px solid var(--border-light);
  padding: 1.2rem; transition: var(--transition);
}
.contact-card:hover { box-shadow: var(--shadow); border-color: var(--primary); }

.contact-header { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 0.8rem; }
.contact-avatar {
  width: 50px; height: 50px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white; font-size: 1rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.contact-avatar.directeur  { background: linear-gradient(135deg, var(--blue), #0a58ca); }
.contact-avatar.sous-dir    { background: linear-gradient(135deg, #555, #333); }

.contact-name { font-size: 0.88rem; font-weight: 700; line-height: 1.3; }
.contact-role { font-size: 0.7rem; color: var(--text-secondary); }
.contact-dir-badge {
  display: inline-block; padding: 0.15rem 0.5rem;
  background: var(--primary-lighter); color: var(--primary);
  border-radius: 20px; font-size: 0.68rem; font-weight: 700;
  margin-top: 0.2rem;
}

.contact-details { font-size: 0.8rem; display: flex; flex-direction: column; gap: 0.35rem; }
.contact-detail { display: flex; align-items: center; gap: 0.5rem; color: var(--text-secondary); }
.contact-detail i { width: 14px; text-align: center; color: var(--text-muted); flex-shrink: 0; }
.contact-detail a { color: var(--primary); text-decoration: none; }
.contact-detail a:hover { text-decoration: underline; }

.contact-actions { display: flex; gap: 0.4rem; margin-top: 0.8rem; padding-top: 0.6rem; border-top: 1px solid var(--border-light); }
.contact-btn {
  flex: 1; padding: 0.4rem; border-radius: var(--radius-xs);
  font-size: 0.75rem; font-weight: 600; text-align: center;
  cursor: pointer; transition: var(--transition);
  display: flex; align-items: center; justify-content: center; gap: 0.3rem;
}
.contact-btn.msg { background: var(--primary-lighter); color: var(--primary); }
.contact-btn.msg:hover { background: var(--primary); color: white; }
.contact-btn.mail { background: var(--blue-light); color: var(--blue); }
.contact-btn.mail:hover { background: var(--blue); color: white; }

/* ============================================================
   RESPONSIVE NOUVEAUX MODULES
   ============================================================ */
@media (max-width: 900px) {
  .reunions-grid { grid-template-columns: 1fr; }
  .documents-grid { grid-template-columns: 1fr; }
  .notes-grid { grid-template-columns: repeat(2, 1fr); }
  .annuaire-grid { grid-template-columns: 1fr; }
  .cal-month-grid .cal-day { min-height: 60px; }
  .doc-categories { gap: 0.3rem; }
}
@media (max-width: 600px) {
  .notes-grid { grid-template-columns: 1fr; }
  .reun-stats-bar { gap: 0.4rem; }
  .cal-month-header div { font-size: 0.65rem; padding: 0.4rem 0.2rem; }
}

/* ============================================================
   MODALS PREMIUM — DÉTAIL COURRIER / ACTION / URGENCE
   ============================================================ */

/* Layout général du contenu de détail */
.detail-modal-layout {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

/* Bandeau en-tête */
.detail-header-band {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.2rem;
  background: var(--bg-main);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}
.detail-type-icon {
  width: 48px; height: 48px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; flex-shrink: 0;
}
.detail-header-info { flex: 1; min-width: 0; }
.detail-ref {
  font-family: 'SF Mono', 'Fira Mono', monospace;
  font-size: 0.78rem; color: var(--text-secondary);
  margin-bottom: 0.25rem;
}
.detail-type-label { font-size: 1rem; font-weight: 700; color: var(--text-main); }
.detail-badges-stack { display: flex; flex-direction: column; align-items: flex-end; gap: 0.3rem; flex-shrink: 0; }

/* Bloc objet */
.detail-objet-block {
  padding: 1rem 1.2rem;
  background: linear-gradient(135deg, var(--primary-lighter), #f0faf4);
  border-radius: var(--radius-sm);
  border: 1px solid var(--primary-lighter);
}
.detail-objet-label {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em;
  color: var(--primary); text-transform: uppercase; margin-bottom: 0.4rem;
}
.detail-objet { font-size: 1.05rem; font-weight: 700; color: var(--text-main); line-height: 1.4; }

/* Grille métadonnées */
.detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
  margin-bottom: 0.5rem;
}
.detail-meta-item {
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  padding: 0.7rem 0.9rem;
}
.meta-label {
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.05em;
  color: var(--text-secondary); text-transform: uppercase;
  margin-bottom: 0.35rem; display: flex; align-items: center; gap: 0.4rem;
}
.meta-value { font-size: 0.88rem; font-weight: 600; color: var(--text-main); }
.meta-sub { font-size: 0.72rem; color: var(--text-secondary); margin-top: 0.15rem; }
.text-danger { color: var(--red) !important; }

/* Chips direction */
.chip-dir {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  background: var(--blue-light); color: var(--blue);
  border-radius: 20px; font-size: 0.72rem; font-weight: 700;
  margin-right: 0.3rem; margin-bottom: 0.2rem;
}

/* Corps du courrier / description */
.detail-corps-block {
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.detail-corps-label {
  padding: 0.6rem 1rem;
  background: var(--bg-main);
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.05em;
  color: var(--text-secondary); text-transform: uppercase;
  border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; gap: 0.5rem;
}
.detail-corps {
  padding: 1rem;
  font-size: 0.9rem; line-height: 1.7;
  white-space: pre-wrap; color: var(--text-main);
  max-height: 200px; overflow-y: auto;
}

/* Workflow steps */
.detail-workflow {
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
}
.workflow-title {
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-secondary);
  margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem;
}
.workflow-steps {
  display: flex; align-items: center; gap: 0; overflow-x: auto; padding: 0.3rem 0;
}
.wf-step {
  display: flex; flex-direction: column; align-items: center;
  gap: 0.4rem; flex: 1; min-width: 70px;
  opacity: 0.4; transition: var(--transition);
}
.wf-step.done { opacity: 1; }
.wf-step.active { opacity: 1; }
.wf-step-icon {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem;
  background: var(--bg-main); color: var(--text-secondary);
  border: 2px solid var(--border);
  transition: var(--transition);
}
.wf-step.done .wf-step-icon { background: var(--green-light); color: var(--green); border-color: var(--green); }
.wf-step.active .wf-step-icon { background: var(--primary); color: white; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(15,81,50,0.15); }
.wf-step-label { font-size: 0.68rem; font-weight: 600; color: var(--text-secondary); text-align: center; white-space: nowrap; }
.wf-step.done .wf-step-label, .wf-step.active .wf-step-label { color: var(--text-main); }
.wf-connector {
  flex: 1; height: 2px; background: var(--border); margin-bottom: 1.5rem;
  min-width: 16px; max-width: 40px;
}

/* Bloc rapport d'avancement */
.detail-rapport-block {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
  background: white;
}
.detail-rapport-block.readonly {
  background: var(--green-light);
  border-color: var(--green);
}
.rapport-title {
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--primary);
  margin-bottom: 0.8rem; display: flex; align-items: center; gap: 0.5rem;
}
.detail-rapport-textarea {
  width: 100%; border: 1.5px solid var(--border);
  border-radius: var(--radius-xs); padding: 0.8rem;
  font-size: 0.88rem; line-height: 1.6; resize: vertical; height: 110px;
  font-family: inherit; color: var(--text-main);
  background: var(--bg-main); transition: var(--transition);
}
.detail-rapport-textarea:focus {
  outline: none; border-color: var(--primary);
  background: white; box-shadow: 0 0 0 3px rgba(15,81,50,0.1);
}
.rapport-content { font-size: 0.88rem; line-height: 1.6; color: var(--text-main); white-space: pre-wrap; }
.rapport-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.8rem; }

/* Bloc visa */
.detail-visa-block { padding: 0.7rem 0; }
.visa-badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.35rem 0.9rem; border-radius: 20px; font-size: 0.8rem; font-weight: 700;
}
.visa-badge.approuve { background: var(--green-light); color: var(--green); }
.visa-badge.refuse { background: var(--red-light); color: var(--red); }
.visa-badge.en_attente { background: var(--accent-light); color: #b45309; }

/* Bannière DGPA instruction */
.detail-dgpa-notice {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.7rem 1rem;
  background: #fffbeb; border: 1px solid #f59e0b;
  border-radius: var(--radius-xs); font-size: 0.82rem;
  color: #92400e; font-weight: 600;
}

/* Badge DG */
.badge-dg {
  background: linear-gradient(135deg, #d4a017, #b8860b);
  color: white; font-weight: 700;
}

/* Bouton danger outline */
.btn-danger-outline {
  border-color: var(--red) !important;
  color: var(--red) !important;
}
.btn-danger-outline:hover { background: var(--red) !important; color: white !important; }

/* ---- DETAIL ACTION — Progression circulaire ---- */
.action-detail-top {
  display: flex; gap: 1.2rem; align-items: flex-start;
}
.action-progress-circle-wrap {
  position: relative; width: 90px; height: 90px; flex-shrink: 0;
}
.progress-ring { width: 90px; height: 90px; transform: rotate(0deg); }
.progress-ring-label {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 800; color: var(--text-main);
}
.action-info-cols { flex: 1; min-width: 0; }

/* ---- DETAIL URGENCE ---- */
.urg-detail-banner {
  display: flex; align-items: flex-start; gap: 1rem;
  padding: 1rem 1.2rem;
  border-radius: var(--radius-sm);
}
.urg-detail-banner-icon { font-size: 1.8rem; padding-top: 0.2rem; }
.urg-detail-banner-body { flex: 1; min-width: 0; }
.urg-detail-niveau { font-size: 0.8rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.25rem; }
.urg-detail-titre { font-size: 1.05rem; font-weight: 700; margin-bottom: 0.4rem; color: var(--text-main); }
.urg-detail-meta { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 0.78rem; color: var(--text-secondary); }
.urg-detail-meta span { display: flex; align-items: center; gap: 0.3rem; }
.urg-detail-banner-badges { display: flex; flex-direction: column; gap: 0.3rem; align-items: flex-end; }

/* ---- Timeline urgence ---- */
.urg-detail-timeline {
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
}
.urg-timeline { display: flex; flex-direction: column; gap: 0; }
.urg-tl-item {
  display: flex; gap: 0.8rem; align-items: flex-start;
  position: relative;
}
.urg-tl-icon {
  width: 36px; height: 36px; border-radius: 50%; border: 2px solid;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; flex-shrink: 0; position: relative; z-index: 1;
  background: white;
}
.urg-tl-body { flex: 1; padding-bottom: 1rem; }
.urg-tl-label { font-size: 0.88rem; font-weight: 700; color: var(--text-main); }
.urg-tl-detail { font-size: 0.78rem; color: var(--text-secondary); margin-top: 0.15rem; }
.urg-tl-date { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.2rem; }
.urg-tl-line {
  position: absolute; left: 17px; top: 36px;
  width: 2px; height: calc(100% - 36px);
  background: var(--border-light); z-index: 0;
}

/* form-range style */
.form-range {
  width: 100%; height: 6px; accent-color: var(--primary);
  cursor: pointer; margin-top: 0.5rem;
}

/* Override pour les grandes modals de détail */
.modal.modal-lg .modal-body { overflow-y: auto; max-height: calc(90vh - 130px); }

/* ============================================================
   RESPONSIVE DETAILMODALS
   ============================================================ */
@media (max-width: 700px) {
  .detail-header-band { flex-wrap: wrap; }
  .detail-meta-grid { grid-template-columns: 1fr; }
  .action-detail-top { flex-direction: column; }
  .action-progress-circle-wrap { align-self: center; }
  .urg-detail-banner { flex-wrap: wrap; }
  .workflow-steps { gap: 0.2rem; }
  .wf-step-label { font-size: 0.6rem; }
}

/* ============================================================
   MODULE SUIVI D'AVANCEMENT
   ============================================================ */
.suivi-kpis {
  display: grid; grid-template-columns: repeat(5,1fr);
  gap: 1rem; margin-bottom: 1.5rem;
}
.suivi-kpi-card {
  background: white; border-radius: var(--radius);
  padding: 1.2rem 1rem; text-align: center;
  border-top: 4px solid transparent;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}
.suivi-kpi-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.suivi-kpi-card.red    { border-top-color: var(--red); }
.suivi-kpi-card.blue   { border-top-color: var(--blue); }
.suivi-kpi-card.orange { border-top-color: var(--orange); }
.suivi-kpi-card.green  { border-top-color: var(--green); }
.suivi-kpi-card.purple { border-top-color: var(--purple); }
.suivi-kpi-icon { font-size: 1.5rem; margin-bottom: 0.5rem; opacity: 0.7; }
.suivi-kpi-card.red    .suivi-kpi-icon { color: var(--red); }
.suivi-kpi-card.blue   .suivi-kpi-icon { color: var(--blue); }
.suivi-kpi-card.orange .suivi-kpi-icon { color: var(--orange); }
.suivi-kpi-card.green  .suivi-kpi-icon { color: var(--green); }
.suivi-kpi-card.purple .suivi-kpi-icon { color: var(--purple); }
.suivi-kpi-val   { font-size: 2rem; font-weight: 800; line-height: 1; margin-bottom: 0.3rem; color: var(--text-primary); }
.suivi-kpi-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; }
.suivi-global-progress { padding: 1.2rem 1.5rem; }
.suivi-dir-card {
  background: white; border-radius: var(--radius);
  border: 1px solid var(--border-light); padding: 1.2rem;
  box-shadow: var(--shadow-sm); transition: box-shadow 0.2s;
}
.suivi-dir-card:hover { box-shadow: var(--shadow); }
.suivi-dir-header {
  display: flex; align-items: center; gap: 0.8rem;
  margin-bottom: 1rem; padding-left: 0.5rem;
}
.suivi-dir-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
}
.suivi-dir-code  { font-size: 0.75rem; font-weight: 800; color: var(--text-secondary); text-transform: uppercase; }
.suivi-dir-label { font-size: 0.82rem; font-weight: 600; color: var(--text-primary); }
.suivi-dir-taux  { font-size: 1.4rem; font-weight: 800; margin-left: auto; flex-shrink: 0; }
.suivi-dir-bar-wrap { margin-bottom: 1rem; }
.suivi-dir-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 0.5rem; text-align: center; }
.suivi-dir-stat  { font-size: 0.72rem; color: var(--text-muted); line-height: 1.4; }
.suivi-dir-stat span:first-child { font-size: 1.1rem; display: block; }
.suivi-dir-alert {
  margin-top: 0.8rem; padding: 0.4rem 0.7rem;
  background: #fff5f5; border: 1px solid #fecaca;
  border-radius: 6px; font-size: 0.75rem; color: var(--red); font-weight: 600;
}
.row-overdue td { background: #fff8f8 !important; }
.suivi-rapport-preview {
  font-size: 0.75rem; color: var(--text-secondary);
  max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.modal.modal-sm { max-width: 560px; width: 95%; }
@media (max-width: 900px) { .suivi-kpis { grid-template-columns: repeat(3,1fr); } }
@media (max-width: 600px) {
  .suivi-kpis { grid-template-columns: repeat(2,1fr); }
  .suivi-dir-stats { grid-template-columns: repeat(2,1fr); }
}

/* ============================================================
   MODULE SECRÉTARIAT DGPA
   ============================================================ */

/* Onglets secrétariat */
.sec-tabs {
  display: flex; gap: 0; border-bottom: 2px solid var(--border-light);
  margin-bottom: 1.5rem; overflow-x: auto; flex-wrap: nowrap;
}
.sec-tab {
  background: none; border: none; border-bottom: 3px solid transparent;
  padding: 0.7rem 1.2rem; font-size: 0.88rem; font-weight: 600;
  color: var(--text-muted); cursor: pointer; white-space: nowrap;
  display: flex; align-items: center; gap: 0.5rem;
  transition: color 0.2s, border-color 0.2s;
  margin-bottom: -2px;
}
.sec-tab:hover { color: var(--primary); }
.sec-tab.active { color: var(--primary); border-bottom-color: var(--primary); background: #f0f7ff; border-radius: 6px 6px 0 0; }
.sec-tab-badge {
  background: var(--primary); color: white;
  border-radius: 10px; padding: 1px 7px; font-size: 0.72rem; font-weight: 700; min-width: 20px; text-align: center;
}
.sec-tab-badge.danger { background: var(--red); }
.sec-tab-badge.warn { background: var(--orange); }

/* Panels */
.sec-panel { animation: fadeIn 0.2s ease; }

/* Stats parapheurs */
.par-stats-row {
  display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem;
}
.par-stat-card {
  display: flex; align-items: center; gap: 0.6rem;
  background: white; border-radius: var(--radius);
  padding: 0.7rem 1.2rem; box-shadow: var(--shadow-sm);
  font-size: 0.88rem; font-weight: 600; flex: 1; min-width: 100px;
}
.par-stat-card i { font-size: 1.2rem; }
.par-stat-card span { font-size: 1.5rem; font-weight: 800; }
.par-stat-card.orange { border-top: 3px solid var(--orange); }
.par-stat-card.orange i { color: var(--orange); }
.par-stat-card.green  { border-top: 3px solid var(--green); }
.par-stat-card.green i { color: var(--green); }
.par-stat-card.red    { border-top: 3px solid var(--red); }
.par-stat-card.red i  { color: var(--red); }
.par-stat-card.blue   { border-top: 3px solid var(--blue); }
.par-stat-card.blue i { color: var(--blue); }

/* Parapheurs grid */
.parapheurs-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 1rem;
}
.par-card {
  background: white; border-radius: var(--radius); box-shadow: var(--shadow-sm);
  cursor: pointer; transition: box-shadow 0.2s, transform 0.15s;
  overflow: hidden;
}
.par-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.par-card.par-signed { background: #f0fdf4; }
.par-card-header {
  display: flex; align-items: flex-start; gap: 0.8rem;
  padding: 1rem 1rem 0.8rem;
}
.par-card-title { font-weight: 700; font-size: 0.92rem; margin-bottom: 4px; color: var(--text-primary); }
.par-card-meta  { font-size: 0.78rem; color: var(--text-muted); }
.par-card-body  { padding: 0 1rem 0.8rem; }
.par-card-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.7rem 1rem; border-top: 1px solid var(--border-light);
  background: #fafafa;
}

/* Agenda secrétariat */
.sec-agenda-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem; flex-wrap: wrap; gap: 0.5rem;
}
.sec-agenda-cal { margin-bottom: 1rem; }
.sec-cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 4px; background: white; border-radius: var(--radius);
  padding: 1rem; box-shadow: var(--shadow-sm);
}
.sec-cal-head {
  text-align: center; font-size: 0.75rem; font-weight: 700;
  color: var(--text-muted); padding: 4px; text-transform: uppercase;
}
.sec-cal-cell {
  min-height: 52px; border-radius: 6px; cursor: pointer; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding: 6px 2px; transition: background 0.15s; font-size: 0.85rem;
}
.sec-cal-cell:hover:not(.empty) { background: #eff6ff; }
.sec-cal-cell.today { background: var(--primary); color: white; font-weight: 700; }
.sec-cal-cell.today .sec-cal-dot { background: white; color: var(--primary); }
.sec-cal-cell.empty { cursor: default; }
.sec-cal-cell.has-event { }
.sec-cal-day { font-size: 0.88rem; }
.sec-cal-dot {
  background: var(--primary); color: white; border-radius: 10px;
  font-size: 0.65rem; padding: 1px 5px; margin-top: 2px; font-weight: 700;
}
.sec-agenda-list-panel { background: white; border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow-sm); }
.agenda-event-row {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.7rem; border-radius: 6px; margin-bottom: 0.5rem;
  background: #fafafa; padding-left: 1rem;
  transition: background 0.15s;
}
.agenda-event-row:hover { background: #f0f7ff; }
.agenda-event-date { text-align: center; min-width: 60px; font-weight: 700; font-size: 0.82rem; }
.agenda-event-info { flex: 1; }

/* Tâches secrétariat */
.sec-taches-grid { display: flex; flex-direction: column; gap: 0.5rem; }
.sec-tache-item {
  background: white; border-radius: 8px; padding: 0.9rem 1rem;
  box-shadow: var(--shadow-sm); transition: box-shadow 0.15s;
}
.sec-tache-item:hover { box-shadow: var(--shadow); }
.sec-tache-item.done { opacity: 0.65; background: #f9fafb; }

/* Panel validation */
.val-item-card {
  background: white; border-radius: var(--radius);
  padding: 1.1rem 1.3rem; margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s;
}
.val-item-card:hover { box-shadow: var(--shadow); }

/* Badge secrétariat */
.badge-validation-pending {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: #fef3c7; color: #92400e; padding: 5px 12px;
  border-radius: 20px; font-size: 0.8rem; font-weight: 700;
  border: 1px solid #fcd34d;
}
.badge-validated {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: #d1fae5; color: #065f46; padding: 5px 12px;
  border-radius: 20px; font-size: 0.8rem; font-weight: 700;
  border: 1px solid #6ee7b7;
}
.badge-rejected {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: #fee2e2; color: #991b1b; padding: 5px 12px;
  border-radius: 20px; font-size: 0.8rem; font-weight: 700;
  border: 1px solid #fca5a5; cursor: help;
}
.btn-signaler {
  background: linear-gradient(135deg, #059669, #047857);
  color: white; border: none; padding: 0.5rem 1.2rem;
  border-radius: var(--radius); font-weight: 700; cursor: pointer;
  font-size: 0.88rem; display: inline-flex; align-items: center; gap: 0.5rem;
  transition: opacity 0.2s, transform 0.15s;
}
.btn-signaler:hover { opacity: 0.9; transform: translateY(-1px); }

/* Responsive secrétariat */
@media (max-width: 900px) {
  .parapheurs-grid { grid-template-columns: 1fr; }
  .par-stats-row { gap: 0.5rem; }
  .par-stat-card { min-width: 80px; padding: 0.5rem 0.8rem; }
}
@media (max-width: 600px) {
  .sec-tabs { gap: 0; }
  .sec-tab { padding: 0.5rem 0.7rem; font-size: 0.78rem; }
  .sec-cal-grid { gap: 2px; padding: 0.5rem; }
  .sec-cal-cell { min-height: 38px; font-size: 0.78rem; }
}

/* ============================================================
   SECRÉTARIAT — Header Band & KPIs redesign
   ============================================================ */

/* Bandeau d'en-tête secrétariat */
.sec-header-band {
  background: linear-gradient(135deg, #1e3a5f 0%, #0f2b4a 100%);
  border-radius: var(--radius-lg, 12px);
  padding: 1.4rem 1.6rem;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 1rem;
  margin-bottom: 1.2rem;
  box-shadow: 0 4px 20px rgba(30,58,95,0.25);
}
.sec-header-info {
  display: flex; align-items: center; gap: 1rem;
}
.sec-header-avatar {
  width: 52px; height: 52px; border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: white; font-size: 1.3rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid rgba(255,255,255,0.3);
}
.sec-header-title {
  color: white; font-size: 1.25rem; font-weight: 800; line-height: 1.2;
}
.sec-header-sub {
  color: rgba(255,255,255,0.65); font-size: 0.85rem; margin-top: 3px;
}
.sec-header-actions {
  display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center;
}
.sec-btn-white {
  background: rgba(255,255,255,0.1);
  color: white; border-color: rgba(255,255,255,0.3);
}
.sec-btn-white:hover { background: rgba(255,255,255,0.2); }

/* KPIs secrétariat */
.sec-kpi-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.8rem;
  margin-bottom: 1.2rem;
}
.sec-kpi {
  background: white; border-radius: var(--radius);
  padding: 1rem; display: flex; align-items: center; gap: 0.8rem;
  box-shadow: var(--shadow-sm); cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  border: 1px solid var(--border-light);
}
.sec-kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.sec-kpi-icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
}
.sec-kpi-val {
  font-size: 1.7rem; font-weight: 800; line-height: 1;
  color: var(--text-primary);
}
.sec-kpi-label {
  font-size: 0.75rem; color: var(--text-muted);
  margin-top: 2px; font-weight: 500; line-height: 1.3;
}

/* Notice de validation */
.sec-validation-notice {
  background: linear-gradient(135deg, #fff8e1, #fffbeb);
  border: 1px solid #fcd34d;
  border-radius: 8px; padding: 1rem 1.2rem;
  margin-bottom: 1rem; font-size: 0.88rem; color: #92400e;
  line-height: 1.6;
}

/* Upload zone parapheur */
.par-upload-zone {
  border: 2px dashed var(--border-light);
  border-radius: 10px; padding: 1.5rem;
  text-align: center; cursor: pointer;
  background: #fafbfc;
  transition: border-color 0.2s, background 0.2s;
  min-height: 100px;
  display: flex; align-items: center; justify-content: center;
}
.par-upload-zone:hover,
.par-upload-zone.drag-over {
  border-color: var(--primary);
  background: #eff6ff;
}
.par-upload-zone.has-file {
  border-color: #10b981;
  background: #f0fdf4;
}

/* Bloc fichier scanné dans la vue détail */
.par-file-preview-block {
  margin-top: 1rem;
  padding: 1rem;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: 8px;
}

/* Badge urgent parapheur */
.par-urgent-badge {
  background: #fee2e2; color: #dc2626;
  padding: 2px 8px; border-radius: 12px;
  font-size: 0.72rem; font-weight: 700;
}

/* Agenda layout côte à côte */
.sec-agenda-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
}

/* Responsive KPIs secrétariat */
@media (max-width: 1100px) { .sec-kpi-row { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px)  {
  .sec-kpi-row   { grid-template-columns: repeat(2, 1fr); }
  .sec-header-band { flex-direction: column; align-items: flex-start; }
  .sec-agenda-wrap { grid-template-columns: 1fr; }
  .par-upload-zone { padding: 1rem; }
}
@media (max-width: 480px)  {
  .sec-kpi-row { grid-template-columns: 1fr 1fr; }
  .sec-header-actions .btn { font-size: 0.78rem; padding: 0.4rem 0.7rem; }
}

/* ============================================================
   ZONE UPLOAD PARAPHEUR (fichier scanné)
   ============================================================ */
.par-upload-zone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius);
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  background: #f8fafc;
  transition: border-color 0.2s, background 0.2s;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.par-upload-zone:hover,
.par-upload-zone.drag-over {
  border-color: var(--primary);
  background: #eff6ff;
}
.par-upload-zone.has-file {
  border-color: #10b981;
  background: #f0fdf4;
}
.par-file-preview-img {
  max-height: 120px;
  max-width: 100%;
  border-radius: 6px;
  object-fit: contain;
  margin-bottom: 0.5rem;
}
.par-file-preview-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #374151;
}
.par-file-clear-btn {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 1rem;
  padding: 0 4px;
}
.par-file-clear-btn:hover { color: #b91c1c; }

/* ============================================================
   PROFIL — FORMULAIRE COORDONNÉES
   ============================================================ */
.coords-form-section {
  background: white;
  border-radius: var(--radius);
  padding: 1.2rem 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
#coords-success-msg,
#coords-error-msg {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.88rem;
  margin-bottom: 1rem;
}
#coords-success-msg { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
#coords-error-msg   { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
