/* ==========================================================================
   TraumaStart V2 — main.css
   Charte : Inter, #E63946 (rouge), slate-900 (header), responsive
   ========================================================================== */

/* --- CSS Variables --- */
:root {
  --color-red: #E63946;
  --color-red-dark: #d62f3c;
  --color-slate-800: #1e293b;
  --color-slate-900: #0f172a;
  --color-gray-50: #f8fafc;
  --color-gray-100: #f1f5f9;
  --color-gray-300: #cbd5e1;
  --color-gray-500: #64748b;
  --color-gray-700: #334155;
  --color-gray-800: #1e293b;
  --color-white: #ffffff;
  --color-orange: #f97316;
  --color-blue: #3b82f6;
  --color-amber: #f59e0b;
  --color-teal: #14b8a6;
  --color-purple: #a855f7;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --header-height: 68px;
  --footer-height: 44px;
  --sidebar-width: 280px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-3xl: 24px;
  --radius-full: 9999px;
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

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

html, body {
  font-family: var(--font-family);
  font-size: 15px;
  line-height: 1.5;
  color: #334155;
  background-color: var(--color-gray-50);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* --- Typography Hierarchy --- */
h1 { font-size: 30px; font-weight: 800; color: #1e293b; line-height: 1.2; margin-bottom: 0.25em; }
h2 { font-size: 24px; font-weight: 700; color: #1e293b; line-height: 1.3; margin-bottom: 0.25em; }
h3 { font-size: 20px; font-weight: 600; color: #334155; line-height: 1.3; margin-bottom: 0.25em; }
h4 { font-size: 17px; font-weight: 600; color: #334155; line-height: 1.4; margin-bottom: 0.15em; }
h5 { font-size: 15px; font-weight: 600; color: #475569; line-height: 1.4; margin-bottom: 0.15em; }
h6 { font-size: 13px; font-weight: 700; color: #64748b; line-height: 1.4;
     text-transform: uppercase; letter-spacing: 1px; margin-bottom: 0.5em; }
p  { font-size: 15px; font-weight: 400; color: #64748b; line-height: 1.5; }
small, .small { font-size: 13px; }
.text-xs { font-size: 12px !important; }

/* KPI specific typography */
.fs-2 { font-size: 36px !important; font-weight: 800 !important; }
.display-5 { font-size: 44px !important; font-weight: 800 !important; }

/* Navigation header links */
.nav-link { font-size: 15px; font-weight: 500; }

/* Sidebar filter labels */
.sidebar-body h6 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #64748b;
}

/* Buttons base */
.btn, button { font-size: 15px; font-weight: 500; }

/* --- Page Container — centered width for full-page modules --- */
.page-container {
  max-width: 1140px;
  margin: 0 auto;
  width: 100%;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
@media (max-width: 1200px) {
  .page-container { max-width: 100%; padding: 1.5rem; }
}
@media (max-width: 768px) {
  .page-container { padding: 1rem; }
}

/* --- App Layout --- */
.app-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-top: var(--header-height);
  padding-bottom: var(--footer-height);
}

/* Pages non authentifiées : pas de padding header */
.app-body--public {
  padding-top: 0;
}

.app-content {
  flex: 1;
  overflow-y: auto;
}

/* --- Header (sticky top, pages authentifiées) --- */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--color-white);
  z-index: 1000;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.08);
}

.header-inner {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 20px;
  max-width: 100%;
}

.header-logo {
  flex-shrink: 0;
}

.header-logo img {
  height: 48px;
  width: auto;
  object-fit: contain;
  display: block;
}

/* Hamburger (mobile only) */
.header-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--color-gray-700);
  font-size: 20px;
  cursor: pointer;
  margin-left: 8px;
  transition: all 0.2s ease;
}

.header-hamburger:hover {
  background: var(--color-gray-100);
}

.header-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 1;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  color: var(--color-gray-500);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--radius-full);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--color-gray-800);
  background: var(--color-gray-100);
}

.nav-link--active {
  color: var(--color-white);
  background: var(--color-red);
  font-weight: 600;
}

.nav-link--active:hover {
  background: var(--color-red-dark);
  color: var(--color-white);
}

.nav-link i {
  font-size: 15px;
  width: 18px;
  text-align: center;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.header-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--color-gray-500);
  font-size: 17px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.header-icon-btn:hover {
  color: var(--color-gray-800);
  background: var(--color-gray-100);
}

.header-icon-btn--logout:hover {
  color: var(--color-red);
  background: rgba(230, 57, 70, 0.1);
}

/* --- Mobile nav drawer (< 768px) --- */
@media (max-width: 767px) {
  .header-hamburger {
    display: inline-flex;
  }

  .header-nav {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--color-white);
    flex-direction: column;
    align-items: stretch;
    padding: 8px 16px 16px;
    box-shadow: 0 4px 12px rgb(0 0 0 / 0.1);
    border-top: 1px solid var(--color-gray-100);
    gap: 2px;
    z-index: 999;
  }

  .header-nav--open {
    display: flex;
  }

  .header-nav .nav-link {
    justify-content: flex-start;
    padding: 10px 14px;
    border-radius: var(--radius-lg);
    font-size: 15px;
  }
}

/* --- Footer (sticky bottom, toutes les pages) --- */
.app-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--footer-height);
  background: var(--color-red);
  color: var(--color-white);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer-inner {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.025em;
  text-align: center;
  opacity: 0.95;
}

.footer-inner strong {
  font-weight: 700;
}

/* --- Page Splash (publique) --- */
.splash-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--footer-height));
  padding: 40px 32px;
  position: relative;
  background: linear-gradient(135deg, var(--color-gray-50), var(--color-white), var(--color-gray-100));
}

.splash-brand {
  text-align: center;
  margin-bottom: 48px;
}

.splash-brand img {
  height: 64px;
  width: auto;
  margin-bottom: 12px;
}

@media (min-width: 768px) {
  .splash-brand img {
    height: 80px;
  }
}

.splash-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-slate-800);
  margin-top: 24px;
}

.splash-subtitle {
  font-size: 1.1rem;
  color: var(--color-gray-500);
  font-weight: 500;
  margin-top: 8px;
}

.splash-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.splash-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #d1fae5;
  color: #047857;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: var(--radius-full);
}

.splash-timestamp {
  font-size: 13px;
  color: var(--color-gray-500);
  font-weight: 500;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 24px;
  width: 100%;
  max-width: 1280px;
  margin-bottom: 48px;
}

@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat-card {
  background: var(--color-white);
  border-radius: var(--radius-3xl);
  box-shadow: var(--shadow-lg);
  padding: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1px solid var(--color-gray-100);
  transition: all 0.4s ease;
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  box-shadow: var(--shadow-xl);
  transform: translateY(-4px);
}

.stat-card__icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  transition: transform 0.4s ease;
}

.stat-card:hover .stat-card__icon {
  transform: scale(1.1);
}

.stat-card__icon i {
  font-size: 28px;
}

.stat-card__value {
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: -0.025em;
  line-height: 1;
  margin-bottom: 8px;
}

.stat-card__label {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-gray-500);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Couleurs KPI */
.stat-card--orange .stat-card__icon { background: linear-gradient(135deg, #fed7aa, #ffedd5); }
.stat-card--orange .stat-card__icon i, .stat-card--orange .stat-card__value { color: var(--color-orange); }

.stat-card--blue .stat-card__icon { background: linear-gradient(135deg, #bfdbfe, #dbeafe); }
.stat-card--blue .stat-card__icon i, .stat-card--blue .stat-card__value { color: var(--color-blue); }

.stat-card--amber .stat-card__icon { background: linear-gradient(135deg, #fde68a, #fef3c7); }
.stat-card--amber .stat-card__icon i, .stat-card--amber .stat-card__value { color: var(--color-amber); }

.stat-card--red .stat-card__icon { background: linear-gradient(135deg, #fecaca, #fee2e2); }
.stat-card--red .stat-card__icon i, .stat-card--red .stat-card__value { color: var(--color-red); }

.stat-card--teal .stat-card__icon { background: linear-gradient(135deg, #99f6e4, #ccfbf1); }
.stat-card--teal .stat-card__icon i, .stat-card--teal .stat-card__value { color: var(--color-teal); }

.stat-card--purple .stat-card__icon { background: linear-gradient(135deg, #e9d5ff, #f3e8ff); }
.stat-card--purple .stat-card__icon i, .stat-card--purple .stat-card__value { color: var(--color-purple); }

/* CTA Button */
.cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: linear-gradient(to right, var(--color-red), var(--color-red-dark));
  color: var(--color-white);
  font-weight: 700;
  font-size: 1.1rem;
  padding: 16px 40px;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(230, 57, 70, 0.35);
  transition: all 0.3s ease;
  text-decoration: none;
}

.cta-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 15px 30px rgba(230, 57, 70, 0.45);
}

.cta-btn i {
  transition: transform 0.3s ease;
}

.cta-btn:hover i {
  transform: translateX(4px);
}

/* --- Page Login --- */
.login-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--footer-height));
  padding: 40px 24px;
  background: var(--color-gray-100);
}

.login-card {
  background: var(--color-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 32px;
  width: 100%;
  max-width: 420px;
}

.login-brand {
  text-align: center;
  margin-bottom: 24px;
}

.login-brand__logo {
  height: 80px;
  width: auto;
  object-fit: contain;
  display: inline-block;
}

.login-card h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-gray-800);
  margin-bottom: 4px;
}

.login-card .login-desc {
  font-size: 13px;
  color: var(--color-gray-500);
  margin-bottom: 24px;
}

.login-field {
  margin-bottom: 16px;
}

.login-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-gray-700);
  margin-bottom: 6px;
}

.login-field input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-gray-300);
  border-radius: 8px;
  font-size: 13px;
  font-family: var(--font-family);
  outline: none;
  transition: all 0.2s ease;
}

.login-field input:focus {
  border-color: var(--color-red);
  box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.15);
}

.login-field__password {
  position: relative;
}

.login-field__password input {
  padding-right: 44px;
}

.login-toggle-pw {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--color-gray-500);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 14px;
}

.login-toggle-pw:hover {
  color: var(--color-gray-700);
}

.login-submit {
  width: 100%;
  padding: 12px;
  background: linear-gradient(to right, #ef4444, #dc2626);
  color: var(--color-white);
  font-weight: 600;
  font-size: 14px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  font-family: var(--font-family);
  margin-top: 8px;
}

.login-submit:hover {
  background: linear-gradient(to right, #dc2626, #b91c1c);
  box-shadow: 0 6px 10px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

.login-info {
  background: #eff6ff;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  padding: 14px;
  margin-top: 20px;
  display: flex;
  gap: 10px;
}

.login-info i {
  color: var(--color-blue);
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 2px;
}

.login-info__text {
  font-size: 12px;
  color: #1e40af;
  line-height: 1.5;
}

.login-info__text strong {
  display: block;
  font-weight: 600;
}

.login-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  color: #991b1b;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.login-error i {
  color: var(--color-red);
}

.login-help {
  text-align: center;
  margin-top: 20px;
  font-size: 12px;
  color: var(--color-gray-500);
}

/* --- Dashboard (Accueil) --- */
.dashboard-filters {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  padding: 16px 24px;
  background: var(--color-white);
  border-bottom: 1px solid var(--color-gray-100);
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filter-group select,
.filter-group input[type="date"] {
  padding: 7px 12px;
  border: 1px solid var(--color-gray-300);
  border-radius: 8px;
  font-size: 13px;
  font-family: var(--font-family);
  color: var(--color-gray-800);
  background: var(--color-white);
  outline: none;
  transition: border-color 0.2s;
  min-width: 140px;
}

.filter-group select:focus,
.filter-group input[type="date"]:focus {
  border-color: var(--color-red);
  box-shadow: 0 0 0 2px rgba(230, 57, 70, 0.12);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
  padding: 16px 24px;
}

@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

.kpi-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.06);
  border: 1px solid var(--color-gray-100);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-card__info {
  display: flex;
  flex-direction: column;
}

.kpi-card__label {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-gray-500);
  margin-bottom: 4px;
}

.kpi-card__value {
  font-size: 36px;
  font-weight: 800;
  color: var(--color-gray-800);
  line-height: 1;
}

.kpi-card__icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-card__icon i { font-size: 16px; }

.kpi-card--red .kpi-card__icon    { background: #fef2f2; }
.kpi-card--red .kpi-card__icon i  { color: var(--color-red); }
.kpi-card--blue .kpi-card__icon   { background: #eff6ff; }
.kpi-card--blue .kpi-card__icon i { color: var(--color-blue); }
.kpi-card--purple .kpi-card__icon   { background: #faf5ff; }
.kpi-card--purple .kpi-card__icon i { color: var(--color-purple); }
.kpi-card--orange .kpi-card__icon   { background: #fff7ed; }
.kpi-card--orange .kpi-card__icon i { color: var(--color-orange); }
.kpi-card--teal .kpi-card__icon   { background: #f0fdfa; }
.kpi-card--teal .kpi-card__icon i { color: var(--color-teal); }
.kpi-card--dark .kpi-card__icon   { background: var(--color-gray-100); }
.kpi-card--dark .kpi-card__icon i { color: var(--color-gray-700); }

.dashboard-main {
  display: flex;
  gap: 24px;
  padding: 0 24px 24px;
  flex: 1;
  min-height: 0;
}

.map-section {
  flex: 7;
  min-height: 400px;
}

.map-section .leaflet-container {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-gray-100);
}

.charts-sidebar {
  flex: 3;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 280px;
}

@media (max-width: 1024px) {
  .dashboard-main { flex-direction: column; }
  .map-section { min-height: 350px; }
  .charts-sidebar { min-width: 0; }
}

.chart-panel {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.06);
  border: 1px solid var(--color-gray-100);
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 220px;
}

.chart-panel__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-gray-800);
}

.chart-panel__subtitle {
  font-size: 11px;
  color: var(--color-gray-500);
  margin-bottom: 12px;
}

.chart-panel__body {
  flex: 1;
  min-height: 0;
}

/* --- Sidebar (pages avec filtres) --- */
.page-with-sidebar {
  display: flex;
  flex: 1;
  min-height: 0;
}

.app-sidebar {
  width: var(--sidebar-width);
  background: var(--color-slate-800);
  color: var(--color-white);
  padding: 20px;
  overflow-y: auto;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .app-sidebar {
    display: none;
  }
  .page-with-sidebar {
    flex-direction: column;
  }
}

.sidebar-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

.sidebar-section {
  margin-bottom: 24px;
}

.sidebar-section__title {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

.sidebar-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
}

.sidebar-check input[type="checkbox"] {
  accent-color: var(--color-red);
  width: 16px;
  height: 16px;
}

.sidebar-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-white);
  font-size: 13px;
  font-family: var(--font-family);
  outline: none;
  margin-bottom: 8px;
}

.sidebar-input:focus {
  border-color: var(--color-red);
}

.sidebar-btn {
  width: 100%;
  padding: 10px;
  background: var(--color-red);
  color: var(--color-white);
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  transition: background 0.2s;
}

.sidebar-btn:hover {
  background: var(--color-red-dark);
}

/* --- Empty state --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--color-gray-500);
}

.empty-state__icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--color-gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.empty-state__icon i {
  font-size: 24px;
  color: var(--color-gray-500);
}

.empty-state__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-gray-700);
  margin-bottom: 4px;
}

.empty-state__text {
  font-size: 13px;
  line-height: 1.5;
}

/* --- Background Decorations (splash) --- */
.splash-bg-decor {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.splash-bg-decor__blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  mix-blend-mode: multiply;
  animation: pulse 8s infinite alternate;
}

.splash-bg-decor__blob--1 {
  top: -15%;
  left: -8%;
  width: 700px;
  height: 700px;
  background: linear-gradient(135deg, #fecaca, #fed7aa);
  opacity: 0.2;
}

.splash-bg-decor__blob--2 {
  bottom: -15%;
  right: -8%;
  width: 800px;
  height: 800px;
  background: linear-gradient(135deg, #bfdbfe, #99f6e4);
  opacity: 0.2;
  animation-delay: 2s;
}

.splash-bg-decor__blob--3 {
  top: 40%;
  left: 50%;
  width: 600px;
  height: 600px;
  background: linear-gradient(135deg, #e9d5ff, #fbcfe8);
  opacity: 0.12;
  animation-delay: 4s;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 0.15; }
  100% { transform: scale(1.05); opacity: 0.25; }
}

/* --- Avatar & Dropdown --- */
.avatar-wrapper {
  position: relative;
  margin-left: 4px;
}

.avatar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--color-red);
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

.avatar-btn:hover {
  box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.25);
}

.avatar-initials {
  color: var(--color-white);
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-family);
  letter-spacing: 0.02em;
  line-height: 1;
  user-select: none;
}

.avatar-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 240px;
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 40px rgb(0 0 0 / 0.12), 0 2px 8px rgb(0 0 0 / 0.08);
  border: 1px solid var(--color-gray-100);
  z-index: 1100;
  overflow: hidden;
}

.avatar-dropdown--open {
  display: block;
}

.avatar-dropdown__info {
  padding: 14px 16px;
}

.avatar-dropdown__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-gray-800);
}

.avatar-dropdown__role {
  font-size: 12px;
  color: var(--color-gray-500);
  margin-top: 2px;
  text-transform: capitalize;
}

.avatar-dropdown__sep {
  height: 1px;
  background: var(--color-gray-100);
}

.avatar-dropdown__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-gray-700);
  text-decoration: none;
  transition: background 0.15s ease;
}

.avatar-dropdown__item:hover {
  background: var(--color-gray-50);
}

.avatar-dropdown__item i {
  width: 16px;
  text-align: center;
  font-size: 14px;
  color: var(--color-gray-500);
}

.avatar-dropdown__item--danger {
  color: var(--color-red);
}

.avatar-dropdown__item--danger i {
  color: var(--color-red);
}

.avatar-dropdown__item--danger:hover {
  background: #fef2f2;
}

/* --- Modal de confirmation --- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.modal-overlay--open {
  display: flex;
}

.modal-card {
  background: var(--color-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: 32px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  margin: 16px;
}

.modal-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #fef2f2;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.modal-icon i {
  font-size: 22px;
  color: var(--color-red);
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-gray-800);
  margin-bottom: 8px;
}

.modal-text {
  font-size: 14px;
  color: var(--color-gray-500);
  margin-bottom: 24px;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.modal-btn {
  padding: 10px 24px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.modal-btn--cancel {
  background: var(--color-gray-100);
  color: var(--color-gray-700);
}

.modal-btn--cancel:hover {
  background: var(--color-gray-300);
}

.modal-btn--confirm {
  background: var(--color-red);
  color: var(--color-white);
}

.modal-btn--confirm:hover {
  background: var(--color-red-dark);
}

/* --- Utilities --- */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }

/* ==========================================================================
   Module Page Layout (collapsible sidebar + content)
   ========================================================================== */

/* Page wrapper with sidebar */
.module-page {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* --- Collapsible Sidebar --- */
.module-sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: var(--footer-height);
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height) - var(--footer-height));
  background: #f8f9fa;
  border-right: none;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: visible;
  z-index: 20;
}

.module-sidebar.collapsed {
  width: 0;
}

.sidebar-toggle-btn {
  position: absolute;
  right: -16px;
  top: 80px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #ffffff;
  color: #6b7280;
  cursor: pointer;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1050;
  padding: 0;
  flex-shrink: 0;
  transition: all 0.2s;
}

.sidebar-toggle-btn:hover {
  background: #f3f4f6;
  color: #1f2937;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

.sidebar-toggle-btn .bi {
  font-size: 14px;
  transition: transform 0.3s;
}

.module-sidebar.collapsed .sidebar-toggle-btn {
  right: -32px;
}

.module-sidebar.collapsed .sidebar-toggle-btn .bi {
  transform: rotate(180deg);
}

.sidebar-body {
  padding: 15px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
  flex: 1;
  opacity: 1;
  transition: opacity 0.15s ease;
  min-width: 232px;
}

.module-sidebar.collapsed .sidebar-body {
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  min-width: 0;
  width: 0;
}

/* --- Sidebar form overrides --- */
.module-sidebar .form-group { margin-bottom: 0; }
.module-sidebar .shiny-input-container { width: 100% !important; }
.module-sidebar .checkbox { margin-top: 0; margin-bottom: 0; }

.module-sidebar .checkbox label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 6px 0;
  font-size: 14px;
  font-weight: 500;
  color: #4b5563;
  transition: color 0.15s;
}

.module-sidebar .checkbox label:hover { color: #111827; }

.module-sidebar .checkbox input[type="checkbox"] {
  accent-color: #ef4444;
  width: 20px;
  height: 20px;
  cursor: pointer;
  flex-shrink: 0;
}

.module-sidebar .control-label {
  font-size: 13px;
  font-weight: 500;
  color: #4b5563;
  margin-bottom: 4px;
}

.module-sidebar .form-control {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  color: #374151;
  background: #ffffff;
  transition: all 0.2s;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
}

.module-sidebar .form-control:focus {
  border-color: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.1);
  outline: none;
}

/* --- Module content area --- */
.module-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px;
  padding-top: 20px;
  gap: 24px;
  overflow-y: auto;
  background: rgba(249, 250, 251, 0.5);
  margin-left: var(--sidebar-width);
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Content shifts when sidebar collapses */
.module-sidebar.collapsed ~ .module-content {
  margin-left: 40px;
}

.module-content > :first-child h1 {
  margin-top: 15px;
}

.module-content .leaflet-container {
  border-radius: 12px;
}

/* --- Chart period toggle (radio pills) --- */
.chart-period-toggle {
  display: inline-flex;
  background: #f3f4f6;
  padding: 2px;
  border-radius: 6px;
  gap: 1px;
}

.chart-period-toggle .shiny-input-radiogroup {
  display: inline-flex;
  gap: 1px;
}

.chart-period-toggle .radio-inline {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s;
  margin: 0;
  line-height: 1.3;
}

.chart-period-toggle .radio-inline input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.chart-period-toggle .radio-inline:has(input:checked) {
  background: #ffffff;
  color: #ef4444;
  font-weight: 600;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08);
}

/* ==============================================================================
   Module Tabs — Shared tab bar for donnees + utilisateurs
   ============================================================================== */
.module-nav-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 1.5rem;
}
.module-nav-tabs .nav-link {
  padding: 0.75rem 1.5rem;
  font-size: 15px;
  font-weight: 500;
  color: #6b7280;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}
.module-nav-tabs .nav-link:hover {
  color: #374151;
}
.module-nav-tabs .nav-link.active {
  color: #E63946;
  font-weight: 600;
  border-bottom-color: #E63946;
}

/* Shiny tabsetPanel override — Level 1 tabs: red underline */
.nav-tabs {
  border-bottom: 1px solid #e5e7eb;
}
.nav-tabs .nav-link {
  color: #64748b;
  border: none !important;
  border-bottom: 2px solid transparent !important;
  border-radius: 0 !important;
  background: transparent !important;
  font-weight: 500;
  font-size: 15px;
  padding: 0.75rem 1.5rem;
  transition: all 0.15s;
}
.nav-tabs .nav-link:hover {
  color: #374151;
  border-bottom-color: #d1d5db !important;
  background: transparent !important;
}
.nav-tabs .nav-link.active {
  color: #E63946 !important;
  border-bottom: 2px solid #E63946 !important;
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  font-weight: 600;
}

/* Level 2 sub-tabs: smaller, grey underline via wrapper */
.sub-tabs-wrapper .nav.nav-tabs {
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
  padding-left: 0.5rem;
}
.sub-tabs-wrapper .nav.nav-tabs .nav-link {
  font-size: 13px !important;
  padding: 8px 16px !important;
  border: none !important;
  border-bottom: 2px solid transparent !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: #94a3b8 !important;
  font-weight: 500 !important;
  transition: all 0.15s;
}
.sub-tabs-wrapper .nav.nav-tabs .nav-link:hover {
  color: #475569 !important;
  border-bottom-color: #cbd5e1 !important;
  background: transparent !important;
}
.sub-tabs-wrapper .nav.nav-tabs .nav-link.active {
  border-bottom: 2px solid #64748b !important;
  color: #334155 !important;
  background: transparent !important;
  font-weight: 600 !important;
}

/* ==============================================================================
   DT DataTable — Refined typography & compact layout
   ============================================================================== */
.dataTables_wrapper {
  font-size: 15px;
}
.dataTables_wrapper .dataTable thead th {
  background-color: #f8fafc !important;
  color: #64748b !important;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 8px 12px !important;
  border-bottom: 1px solid #e5e7eb;
  border-right: none;
}
.dataTables_wrapper .dataTable tbody td {
  padding: 8px 12px !important;
  font-size: 15px;
  vertical-align: middle;
  color: #334155;
}
.dataTables_wrapper .dataTable tbody tr:nth-child(odd) {
  background-color: #ffffff;
}
.dataTables_wrapper .dataTable tbody tr:nth-child(even) {
  background-color: #f8fafc;
}
.dataTables_wrapper .dataTable tbody tr:hover {
  background-color: #eff6ff !important;
}
/* DT info, length, search */
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
  font-size: 13px;
  color: #64748b;
}
.dataTables_wrapper .dataTables_filter input {
  font-size: 15px;
  padding: 4px 8px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
}
/* DT buttons — rose matching mockup */
.dataTables_wrapper .dt-buttons .dt-button {
  background: #fda4af !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 4px !important;
  padding: 5px 14px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  margin-right: 4px !important;
}
.dataTables_wrapper .dt-buttons .dt-button:hover {
  background: #fb7185 !important;
}
/* DT pagination — red active page */
.dataTables_wrapper .dataTables_paginate {
  font-size: 13px;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: #E63946 !important;
  color: #ffffff !important;
  border: 1px solid #E63946 !important;
  border-radius: 4px;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: 4px !important;
}

/* ==============================================================================
   Donnees Export — Download button
   ============================================================================== */
.btn-export-xlsx {
  background-color: #10b981;
  color: #ffffff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.15s;
}
.btn-export-xlsx:hover {
  background-color: #059669;
}

/* ==============================================================================
   Utilisateurs — Filter bar, badges, action buttons, modal
   ============================================================================== */
.users-filter-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.users-filter-bar .form-control,
.users-filter-bar .form-select {
  font-size: 0.875rem;
  padding: 0.625rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
}
.badge-profil {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}
.badge-statut {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}
.btn-action {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  background: transparent;
}
.btn-action--edit { color: #2563eb; }
.btn-action--edit:hover { background: #eff6ff; }
.btn-action--danger { color: #dc2626; }
.btn-action--danger:hover { background: #fef2f2; }
.btn-action--success { color: #16a34a; }
.btn-action--success:hover { background: #f0fdf4; }

/* Btn primary red */
.btn-trauma {
  background: linear-gradient(to right, #ef4444, #dc2626);
  color: #ffffff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}
.btn-trauma:hover {
  background: linear-gradient(to right, #dc2626, #b91c1c);
  box-shadow: 0 6px 8px -1px rgba(0,0,0,0.15);
}

/* User modal overlay */
.user-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1050;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.user-modal-overlay.show {
  display: flex;
}
.user-modal-card {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
}
.user-modal-header {
  position: sticky;
  top: 0;
  background: #ffffff;
  padding: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  border-radius: 16px 16px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
}
.user-modal-body {
  padding: 1.5rem;
}

/* ==============================================================================
   Profil Page — Avatar + Cards
   ============================================================================== */
/* profil-page inherits from .page-container, narrower max-width */
.profil-page {
  max-width: 900px;
}
.profil-avatar {
  width: 96px;
  height: 96px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #E63946;
  color: #ffffff;
  font-size: 2rem;
  font-weight: 700;
  flex-shrink: 0;
}
.profil-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}
.profil-card-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
}
.profil-card-body {
  padding: 1.5rem;
}
.perm-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
.perm-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: #f9fafb;
  border-radius: 8px;
  font-size: 0.875rem;
  color: #374151;
}
.perm-item i { color: #16a34a; }

/* Logs timeline */
.log-entry {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid #f3f4f6;
}
.log-entry:last-child { border-bottom: none; }
.log-icon {
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.log-icon--green  { background: #dcfce7; color: #16a34a; }
.log-icon--blue   { background: #dbeafe; color: #2563eb; }
.log-icon--orange { background: #ffedd5; color: #ea580c; }
.log-icon--red    { background: #fee2e2; color: #dc2626; }
.log-icon--purple { background: #f3e8ff; color: #9333ea; }
.log-icon--indigo { background: #e0e7ff; color: #4f46e5; }
.log-icon--yellow { background: #fef9c3; color: #ca8a04; }

/* ==============================================================================
   DT Row Selection — Blue instead of red
   ============================================================================== */
table.dataTable tbody tr.selected,
table.dataTable tbody tr.selected td {
  background-color: #EFF6FF !important;
  color: #1e293b !important;
}
table.dataTable tbody tr.active,
table.dataTable tbody tr.active td {
  background-color: #EFF6FF !important;
  color: #1e293b !important;
}

/* ==============================================================================
   Filter Indicator — Donnees module accident filter bar
   ============================================================================== */
.filter-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  margin-bottom: 16px;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  border-radius: 8px;
  color: #1e40af;
  font-size: 14px;
  font-weight: 500;
}
.filter-indicator i.fa-filter {
  color: #3b82f6;
}
.filter-indicator .btn {
  font-size: 13px;
  padding: 4px 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ==============================================================================
   Badge Cell — Rounded badges inside DT table cells
   ============================================================================== */
.badge-cell {
  display: inline-block;
  border-radius: 12px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  line-height: 1.4;
}

/* Uniformize all .badge inside DT tables */
.dataTables_wrapper .badge {
  border-radius: 12px !important;
  padding: 4px 10px !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  white-space: nowrap;
  line-height: 1.4;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .module-sidebar:not(.collapsed) {
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
  }

  .module-sidebar.collapsed ~ .module-content {
    margin-left: 0;
  }
}

@media (max-width: 640px) {
  .module-content {
    padding: 16px;
    gap: 16px;
  }
}
