/* ============================================================
   EMS RP — Thème Urgence Médicale
   Rouge Vif · Haute Visibilité · ECG Animations
   ============================================================ */

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

/* ── Variables DARK — Nuit opérationnelle ─────────────────── */
:root {
  /* Fonds — charbon profond */
  --bg-primary:      #080a0c;
  --bg-secondary:    #0e1215;
  --bg-tertiary:     #13181d;
  --bg-hover:        #181e24;
  --bg-active:       #1d2530;
  --bg-card:         rgba(14, 18, 21, 0.85);
  --bg-input:        rgba(8, 10, 12, 0.85);
  --bg-sidebar:      rgba(5, 7, 9, 0.97);
  --bg-topbar:       rgba(8, 10, 12, 0.92);

  /* Texte */
  --text-primary:    #f2f5f7;
  --text-secondary:  #8fa8b0;
  --text-muted:      #3d5560;
  --text-link:       #ff4545;

  /* Accent principal — Rouge EMS (RGB séparé pour rgba()) */
  --accent-rgb:      229, 62, 62;
  --accent:          #e53e3e;
  --accent-hover:    #c53030;
  --accent-light:    rgba(var(--accent-rgb), 0.10);
  --accent-glow:     0 0 20px rgba(var(--accent-rgb), 0.45), 0 0 60px rgba(var(--accent-rgb), 0.18);

  /* Bordures */
  --border:          rgba(var(--accent-rgb), 0.14);
  --border-muted:    rgba(var(--accent-rgb), 0.06);
  --border-glow:     rgba(var(--accent-rgb), 0.45);

  /* Accent secondaire — Orange haute visibilité */
  --accent2:         #f97316;
  --accent2-light:   rgba(249, 115, 22, 0.12);

  /* Statuts médicaux */
  --success:         #22c55e;
  --success-bg:      rgba(34, 197, 94, 0.08);
  --warning:         #f59e0b;
  --warning-bg:      rgba(245, 158, 11, 0.08);
  --danger:          #dc2626;
  --danger-bg:       rgba(220, 38, 38, 0.09);
  --info:            #38bdf8;
  --info-bg:         rgba(56, 189, 248, 0.08);

  /* Tailles */
  --sidebar-width:   250px;
  --topbar-height:   60px;
  --radius:          10px;
  --radius-lg:       14px;
  --radius-xl:       20px;

  /* Transitions */
  --transition:      all .2s cubic-bezier(.4, 0, .2, 1);
  --transition-slow: all .4s cubic-bezier(.4, 0, .2, 1);

  /* Ombres */
  --shadow:          0 4px 24px rgba(0, 0, 0, 0.7);
  --shadow-lg:       0 12px 48px rgba(0, 0, 0, 0.8);
  --shadow-neon:     0 0 30px rgba(var(--accent-rgb), 0.22);
  --shadow-card:     0 8px 32px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255,255,255,0.03);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(ellipse at 15% 50%, rgba(var(--accent-rgb), 0.05) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 15%, rgba(var(--accent-rgb), 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 55% 85%, rgba(var(--accent-rgb), 0.03) 0%, transparent 40%);
  background-attachment: fixed;
}

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

img { max-width: 100%; }
button { cursor: pointer; border: none; background: none; }

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: var(--text-primary);
}

/* ── Layout principal ─────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  transition: transform .3s cubic-bezier(.4, 0, .2, 1), width .25s ease;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 4px 0 40px rgba(0, 0, 0, 0.6), 1px 0 0 rgba(var(--accent-rgb), 0.08);
}

/* Ligne décorative latérale — rouge pulsant */
.sidebar::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 2px;
  height: 100%;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(var(--accent-rgb), 0.6) 20%,
    rgba(var(--accent-rgb), 0.5) 50%,
    rgba(var(--accent-rgb), 0.6) 80%,
    transparent 100%
  );
  animation: sidebarLine 3s ease-in-out infinite;
}

@keyframes sidebarLine {
  0%, 100% { opacity: 0.5; }
  50%       { opacity: 1.0; }
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border);
  min-height: var(--topbar-height);
  position: relative;
}

/* Bande décorative en haut du header */
.sidebar-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), rgba(var(--accent-rgb), 0.4), transparent);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.sidebar-logo i {
  font-size: 22px;
  color: var(--accent);
  filter: drop-shadow(0 0 8px rgba(var(--accent-rgb), 0.8));
  animation: heartbeat 1.5s ease-in-out infinite;
}

.sidebar-logo-img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  border-radius: 8px;
  filter: drop-shadow(0 0 8px rgba(var(--accent-rgb), 0.7));
  animation: heartbeat 1.5s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 8px rgba(var(--accent-rgb), 0.8)); }
  14%       { transform: scale(1.18); filter: drop-shadow(0 0 16px rgba(var(--accent-rgb), 1.0)); }
  28%       { transform: scale(1); }
  42%       { transform: scale(1.10); filter: drop-shadow(0 0 12px rgba(var(--accent-rgb), 0.9)); }
  70%       { transform: scale(1); }
}

.sidebar-logo-text {
  white-space: nowrap;
  overflow: hidden;
  background: linear-gradient(135deg, #f2f5f7 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-toggle {
  color: var(--text-secondary);
  padding: 7px;
  border-radius: var(--radius);
  transition: var(--transition);
  flex-shrink: 0;
  border: 1px solid transparent;
}
.sidebar-toggle:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--border-glow);
  box-shadow: var(--accent-glow);
}

/* Navigation */
.sidebar-nav {
  flex: 1;
  padding: 16px 10px;
  overflow-y: auto;
}

.nav-group { margin-bottom: 24px; }

.nav-group-label {
  display: block;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 10px 8px;
  position: relative;
}

.nav-group-label::after {
  content: '';
  position: absolute;
  left: 10px;
  bottom: 5px;
  width: 20px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0.6;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: var(--transition);
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  margin-bottom: 2px;
  border: 1px solid transparent;
}

.nav-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-light), transparent);
  opacity: 0;
  transition: opacity .2s ease;
  border-radius: inherit;
}

.nav-item:hover {
  color: var(--text-primary);
  border-color: var(--border);
  text-decoration: none;
}
.nav-item:hover::before { opacity: 1; }

.nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
  border-color: rgba(var(--accent-rgb), 0.28);
  box-shadow: inset 0 0 20px rgba(var(--accent-rgb), 0.06);
}

.nav-item.active::after {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent2));
  border-radius: 0 4px 4px 0;
  box-shadow: 0 0 10px var(--accent);
  animation: navPulse 2s ease-in-out infinite;
}

@keyframes navPulse {
  0%, 100% { box-shadow: 0 0 8px var(--accent); }
  50%       { box-shadow: 0 0 16px var(--accent), 0 0 30px rgba(var(--accent-rgb), 0.4); }
}

.nav-item i {
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  font-size: 14px;
  transition: var(--transition);
}
.nav-item:hover i, .nav-item.active i {
  filter: drop-shadow(0 0 5px currentColor);
}

.nav-item span:first-of-type { flex: 1; }

.nav-badge {
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  color: var(--text-secondary);
  backdrop-filter: blur(4px);
  letter-spacing: .04em;
}

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

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-lg);
  transition: var(--transition);
  border: 1px solid transparent;
  cursor: pointer;
}

.user-card:hover {
  background: var(--accent-light);
  border-color: var(--border-glow);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid rgba(var(--accent-rgb), 0.35);
  box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.2);
}

.user-info { flex: 1; min-width: 0; }

.user-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  display: block;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-logout {
  color: var(--text-muted);
  padding: 6px;
  border-radius: var(--radius);
  transition: var(--transition);
  flex-shrink: 0;
}
.user-logout:hover {
  color: var(--accent);
  background: var(--accent-light);
  text-decoration: none;
  box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.2);
}

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

/* ── Topbar ───────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: var(--bg-topbar);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

/* Ligne ECG en bas du topbar */
.topbar::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(var(--accent-rgb), 0.6) 25%,
    rgba(var(--accent-rgb), 0.5) 50%,
    rgba(var(--accent-rgb), 0.6) 75%,
    transparent 100%
  );
  animation: topbarGlow 3.5s ease-in-out infinite;
}

@keyframes topbarGlow {
  0%, 100% { opacity: 0.25; }
  50%       { opacity: 0.75; }
}

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

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

.sidebar-toggle-mobile {
  display: none;
  color: var(--text-secondary);
  padding: 7px;
  border-radius: var(--radius);
  transition: var(--transition);
  border: 1px solid var(--border);
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
}
.sidebar-toggle-mobile:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--border-glow);
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.breadcrumb-sep { font-size: 9px; color: var(--text-muted); }

.breadcrumb-link {
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition);
  font-weight: 500;
}
.breadcrumb-link:hover { color: var(--accent); }

.breadcrumb-current {
  color: var(--text-primary);
  font-weight: 600;
}

/* Search bar */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(var(--accent-rgb), 0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 14px;
  width: 270px;
  transition: var(--transition);
}

.search-bar:focus-within {
  border-color: rgba(var(--accent-rgb), 0.5);
  background: var(--accent-light);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.1), 0 0 20px rgba(var(--accent-rgb), 0.12);
}

.search-icon { color: var(--text-muted); font-size: 12px; }

.search-bar input {
  border: none;
  background: none;
  outline: none;
  width: 100%;
  font-size: 13px;
  color: var(--text-primary);
}
.search-bar input::placeholder { color: var(--text-muted); }

.topbar-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: var(--transition);
  border: 1px solid transparent;
}
.topbar-btn:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--border-glow);
  box-shadow: var(--accent-glow);
}

.topbar-divider {
  width: 1px;
  height: 22px;
  background: var(--border);
  flex-shrink: 0;
}

/* ── Theme toggle ─────────────────────────────────────────── */
.theme-toggle {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: var(--transition);
  border: 1px solid transparent;
  background: transparent;
}
.theme-toggle:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--border-glow);
  box-shadow: var(--accent-glow);
}
.theme-toggle-icon {
  font-size: 15px;
  transition: transform .4s cubic-bezier(.34, 1.56, .64, 1);
}
.theme-toggle:hover .theme-toggle-icon { transform: rotate(20deg) scale(1.15); }

/* ── Page content ─────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 28px;
  animation: pageLoad .35s cubic-bezier(.4, 0, .2, 1);
}

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

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

.page-title {
  font-size: 24px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 5px;
}

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

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}
.card:hover {
  border-color: rgba(var(--accent-rgb), 0.22);
  box-shadow: var(--shadow-card), 0 0 30px rgba(var(--accent-rgb), 0.06);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(var(--accent-rgb), 0.02);
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.card-body { padding: 22px; }
.card-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

/* Stat cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  transition: var(--transition-slow);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  isolation: isolate;
}

/* Barre top colorée */
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--card-accent, var(--accent)), var(--accent2), transparent);
}

/* Halo en coin */
.stat-card::after {
  content: '';
  position: absolute;
  top: -40%;
  right: -40%;
  width: 80%;
  height: 80%;
  background: radial-gradient(circle, var(--card-accent-bg, rgba(var(--accent-rgb),0.07)) 0%, transparent 70%);
  pointer-events: none;
  transition: var(--transition-slow);
}

.stat-card:hover {
  border-color: var(--card-accent, var(--accent));
  transform: translateY(-4px) scale(1.01);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(var(--accent-rgb), 0.12);
}
.stat-card:hover::after { transform: scale(1.5); }

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: var(--card-accent-bg, var(--accent-light));
  color: var(--card-accent, var(--accent));
  flex-shrink: 0;
  box-shadow: 0 0 20px var(--card-accent-bg, var(--accent-light));
  position: relative;
  z-index: 1;
}

.stat-info { min-width: 0; position: relative; z-index: 1; }
.stat-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -0.02em;
}
.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 5px;
  font-weight: 500;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
  position: relative;
  overflow: hidden;
  letter-spacing: 0.01em;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: opacity .2s;
}
.btn:hover::after { opacity: 1; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 20px rgba(var(--accent-rgb), 0.35), 0 0 0 1px rgba(var(--accent-rgb), 0.3);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 30px rgba(var(--accent-rgb), 0.45), 0 0 0 1px rgba(var(--accent-rgb), 0.5);
  text-decoration: none;
  color: #fff;
}

.btn-secondary {
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
  border-color: var(--border);
  backdrop-filter: blur(8px);
}
.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: rgba(var(--accent-rgb), 0.3);
  color: var(--text-primary);
}

.btn-success {
  background: linear-gradient(135deg, var(--success), #16a34a);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 20px rgba(34, 197, 94, 0.25);
}
.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 30px rgba(34, 197, 94, 0.35);
  color: #fff;
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #991b1b);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 20px rgba(220, 38, 38, 0.25);
}
.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 30px rgba(220, 38, 38, 0.4);
  color: #fff;
}

.btn-warning {
  background: linear-gradient(135deg, var(--warning), #d97706);
  color: #000;
  border-color: transparent;
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.25);
}
.btn-warning:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 30px rgba(245, 158, 11, 0.35);
  color: #000;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-ghost:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: rgba(var(--accent-rgb), 0.3);
}

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }

/* Bouton Discord */
.btn-discord {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 14px 24px;
  background: linear-gradient(135deg, #5865F2, #4752c4);
  color: #fff;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 700;
  transition: var(--transition);
  text-decoration: none;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(88, 101, 242, 0.4);
  letter-spacing: 0.02em;
}
.btn-discord:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 40px rgba(88, 101, 242, 0.6);
  text-decoration: none;
  color: #fff;
}

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 7px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.form-label.required::after {
  content: ' *';
  color: var(--accent);
}

.form-control,
.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13.5px;
  transition: var(--transition);
  outline: none;
  font-family: inherit;
}

.form-control:focus,
.form-input:focus {
  border-color: rgba(var(--accent-rgb), 0.6);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.1), 0 0 20px rgba(var(--accent-rgb), 0.08);
  background: rgba(var(--accent-rgb), 0.04);
}

.form-control::placeholder,
.form-input::placeholder { color: var(--text-muted); }

textarea.form-control,
textarea.form-input { resize: vertical; min-height: 80px; }

select.form-control,
select.form-input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%238fa8b0'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

select.form-control option,
select.form-input option {
  background-color: #0e1215;
  color: var(--text-primary);
  font-weight: 500;
  padding: 8px 12px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }

.form-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 5px; }

.form-error {
  font-size: 12px;
  color: var(--accent);
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ── Tables ───────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-card);
}

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

.table thead tr {
  background: rgba(var(--accent-rgb), 0.04);
  border-bottom: 1px solid var(--border);
}

.table th {
  padding: 13px 18px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .1em;
  white-space: nowrap;
}

.table td {
  padding: 14px 18px;
  font-size: 13.5px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-muted);
}

.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: rgba(var(--accent-rgb), 0.04); }
.table tbody tr:last-child td { border-bottom: none; }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
  border-color: rgba(34, 197, 94, 0.25);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.1);
}
.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(220, 38, 38, 0.25);
  box-shadow: 0 0 10px rgba(220, 38, 38, 0.1);
}
.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: rgba(245, 158, 11, 0.25);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.1);
}
.badge-info {
  background: var(--info-bg);
  color: var(--info);
  border-color: rgba(56, 189, 248, 0.25);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.1);
}
.badge-accent {
  background: var(--accent-light);
  color: var(--accent);
  border-color: rgba(var(--accent-rgb), 0.28);
}
.badge-muted,
.badge-default {
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
  border-color: var(--border);
}

.badge-primary {
  background: var(--accent-light);
  color: var(--accent);
  border-color: rgba(var(--accent-rgb), 0.25);
}

/* ── Maintenance banner ───────────────────────────────────── */
@keyframes maintenance-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .7; }
}
@keyframes maintenance-slide {
  from { transform: translateX(-4px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
.maintenance-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0;
  background: linear-gradient(135deg, #7c2d00 0%, #b45309 40%, #d97706 70%, #b45309 100%);
  background-size: 300% 100%;
  animation: maintenance-slide .4s ease both;
  border-bottom: 3px solid #f59e0b;
  box-shadow: 0 4px 24px rgba(245,158,11,.35), 0 1px 0 rgba(255,255,255,.06) inset;
  color: #fef3c7;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  letter-spacing: .01em;
  position: sticky;
  top: 0;
  z-index: 200;
  overflow: hidden;
}
/* Animated stripe overlay */
.maintenance-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -55deg,
    transparent,
    transparent 10px,
    rgba(0,0,0,.06) 10px,
    rgba(0,0,0,.06) 20px
  );
  pointer-events: none;
}
.maintenance-banner-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 28px;
  position: relative;
  z-index: 1;
}
.maintenance-banner .maint-icon {
  font-size: 18px;
  animation: maintenance-pulse 2s ease-in-out infinite;
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(251,191,36,.7));
}
.maintenance-banner .maint-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 999px;
  padding: 2px 10px 2px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #fde68a;
  flex-shrink: 0;
}
.maintenance-banner .maint-text {
  flex: 1;
  text-shadow: 0 1px 3px rgba(0,0,0,.4);
}
.auth-page .maintenance-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  border-radius: 0;
}

/* ── Flash messages ───────────────────────────────────────── */
.flash {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  margin: 0 28px 18px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  animation: flashSlide .35s cubic-bezier(.34, 1.56, .64, 1);
  backdrop-filter: blur(10px);
}

@keyframes flashSlide {
  from { opacity: 0; transform: translateY(-14px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.flash-success {
  background: rgba(34, 197, 94, 0.07);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.22);
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.08);
}
.flash-error {
  background: rgba(var(--accent-rgb), 0.07);
  color: var(--accent);
  border: 1px solid rgba(var(--accent-rgb), 0.22);
  box-shadow: 0 0 20px rgba(var(--accent-rgb), 0.08);
}
.flash-info {
  background: rgba(56, 189, 248, 0.07);
  color: var(--info);
  border: 1px solid rgba(56, 189, 248, 0.22);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.08);
}
.flash-warning {
  background: rgba(245, 158, 11, 0.07);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.22);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.08);
}

.flash-close {
  margin-left: auto;
  color: inherit;
  opacity: .6;
  padding: 2px 6px;
  border-radius: 4px;
  transition: opacity .15s;
  flex-shrink: 0;
}
.flash-close:hover { opacity: 1; }

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

.auth-bg { position: absolute; inset: 0; pointer-events: none; }

.auth-bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: .12;
  animation: orbFloat 10s ease-in-out infinite;
}

.auth-bg-orb--1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, var(--accent), transparent);
  top: -200px; left: -200px;
  animation-delay: 0s;
}
.auth-bg-orb--2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, var(--accent2), transparent);
  bottom: -150px; right: -150px;
  animation-delay: -4s;
}
.auth-bg-orb--3 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #22c55e, transparent);
  top: 40%; right: 20%;
  animation-delay: -8s;
}

/* Grille en fond */
.auth-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(var(--accent-rgb), 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(30px, -30px) scale(1.05); }
  66%       { transform: translate(-20px, 20px) scale(.95); }
}

.auth-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  padding: 24px;
  text-align: center;
}

.auth-header { margin-bottom: 36px; }

.auth-logo {
  width: 90px;
  height: 90px;
  background: rgba(var(--accent-rgb), 0.08);
  border: 2px solid rgba(var(--accent-rgb), 0.45);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  font-size: 36px;
  color: var(--accent);
  box-shadow: 0 0 40px rgba(var(--accent-rgb), 0.3), inset 0 0 20px rgba(var(--accent-rgb), 0.05);
  animation: logoPulse 2s ease-in-out infinite;
  overflow: hidden;
}

.auth-logo-img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(var(--accent-rgb), 0.5));
}

@keyframes logoPulse {
  0%, 100% { box-shadow: 0 0 40px rgba(var(--accent-rgb),0.3), inset 0 0 20px rgba(var(--accent-rgb),0.05); }
  50%       { box-shadow: 0 0 60px rgba(var(--accent-rgb),0.5), inset 0 0 30px rgba(var(--accent-rgb),0.08); }
}

.auth-title {
  font-size: 32px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
  letter-spacing: -0.03em;
}

.auth-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

.auth-card {
  background: rgba(14, 18, 21, 0.85);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px;
  box-shadow: 0 24px 80px rgba(0,0,0,.75), inset 0 1px 0 rgba(255,255,255,0.04);
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20%; right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.6;
}

.auth-card-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 26px;
  line-height: 1.7;
}

.auth-footer-note {
  margin-top: 18px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.auth-version {
  margin-top: 28px;
  font-size: 11.5px;
  color: var(--text-muted);
}

/* ── Modales ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn .2s ease;
  padding: 16px;
}

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

.modal {
  background: rgba(14, 18, 21, 0.97);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid rgba(var(--accent-rgb), 0.22);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlide .3s cubic-bezier(.34, 1.56, .64, 1);
  box-shadow: 0 32px 80px rgba(0,0,0,.85), 0 0 60px rgba(var(--accent-rgb), 0.07);
  position: relative;
}

.modal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 15%; right: 15%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), 0.7), transparent);
}

@keyframes modalSlide {
  from { opacity: 0; transform: translateY(28px) scale(.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes modalClose {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(16px) scale(.97); }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

@keyframes modalShake {
  0%, 100% { transform: translateX(0); }
  18%  { transform: translateX(-7px); }
  36%  { transform: translateX(7px); }
  54%  { transform: translateX(-5px); }
  72%  { transform: translateX(5px); }
  88%  { transform: translateX(-2px); }
}

.modal-shake {
  animation: modalShake .42s cubic-bezier(.36,.07,.19,.97) both !important;
}

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

.modal-title {
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.modal-close {
  color: var(--text-muted);
  padding: 5px 9px;
  border-radius: var(--radius);
  transition: var(--transition);
  border: 1px solid transparent;
}
.modal-close:hover {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(220,38,38,0.3);
}

.modal-body { padding: 26px; }
.modal-footer {
  padding: 18px 26px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  background: rgba(0,0,0,0.2);
}

/* ── Toast notifications ──────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: rgba(14, 18, 21, 0.97);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px 18px 16px;
  min-width: 320px;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.75), 0 4px 16px rgba(0,0,0,0.4);
  animation: toastIn .4s cubic-bezier(.34, 1.56, .64, 1) both;
  position: relative;
  overflow: hidden;
  pointer-events: auto;
  cursor: default;
}

.toast-icon {
  flex-shrink: 0;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
}

.toast-msg {
  flex: 1;
  line-height: 1.45;
  color: var(--text-primary);
}

.toast-close {
  flex-shrink: 0;
  color: var(--text-muted);
  padding: 3px 6px;
  border-radius: var(--radius);
  transition: color .15s, background .15s;
  font-size: 11px;
}
.toast-close:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.08);
}

/* Progress bar */
.toast-bar {
  position: absolute;
  bottom: 0; left: 0;
  height: 3px;
  width: 100%;
  transform-origin: left center;
  animation: toastProgress var(--toast-duration, 4500ms) linear forwards;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

@keyframes toastProgress {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(110%) scale(.92); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to   { opacity: 0; transform: translateX(80%) scale(.9); }
}

.toast-leaving {
  animation: toastOut .35s cubic-bezier(.4,0,.6,1) both !important;
}

.toast-success {
  border-left: 3px solid var(--success);
  box-shadow: 0 20px 60px rgba(0,0,0,0.75), -3px 0 24px rgba(87,242,135,0.15);
}
.toast-success .toast-bar { background: var(--success); }

.toast-error {
  border-left: 3px solid var(--danger);
  box-shadow: 0 20px 60px rgba(0,0,0,0.75), -3px 0 24px rgba(237,66,69,0.18);
}
.toast-error .toast-bar { background: var(--danger); }

.toast-info {
  border-left: 3px solid var(--info);
  box-shadow: 0 20px 60px rgba(0,0,0,0.75), -3px 0 24px rgba(0,176,244,0.15);
}
.toast-info .toast-bar { background: var(--info); }

.toast-warning {
  border-left: 3px solid var(--warning);
  box-shadow: 0 20px 60px rgba(0,0,0,0.75), -3px 0 24px rgba(250,166,26,0.15);
}
.toast-warning .toast-bar { background: var(--warning); }

/* ── Patient card ─────────────────────────────────────────── */
.patient-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
  transition: var(--transition-slow);
  position: relative;
  overflow: hidden;
}

.patient-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(var(--accent-rgb),0.03), transparent);
  opacity: 0;
  transition: opacity .3s;
}

.patient-card:hover {
  border-color: rgba(var(--accent-rgb), 0.3);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(var(--accent-rgb),0.08);
}
.patient-card:hover::before { opacity: 1; }

.patient-avatar {
  width: 68px;
  height: 68px;
  border-radius: var(--radius-lg);
  object-fit: cover;
  background: var(--bg-secondary);
  border: 2px solid rgba(var(--accent-rgb), 0.22);
  flex-shrink: 0;
  box-shadow: 0 0 20px rgba(var(--accent-rgb),0.1);
}

.patient-id {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 11.5px;
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--accent);
  padding: 2px 10px;
  border-radius: 6px;
  display: inline-block;
  margin-bottom: 6px;
  border: 1px solid rgba(var(--accent-rgb), 0.22);
  letter-spacing: 0.06em;
}

/* ── Timeline médicale ────────────────────────────────────── */
.timeline { position: relative; padding-left: 36px; }

.timeline::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 4px; bottom: 4px;
  width: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent2), transparent);
  opacity: 0.4;
}

.timeline-item { position: relative; margin-bottom: 24px; }

.timeline-dot {
  position: absolute;
  left: -26px;
  top: 6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-primary);
  box-shadow: 0 0 10px var(--accent), 0 0 20px rgba(var(--accent-rgb),0.3);
}

.timeline-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 5px;
  font-family: 'JetBrains Mono', monospace;
}

.timeline-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  transition: var(--transition);
}
.timeline-card:hover { border-color: rgba(var(--accent-rgb),0.25); }

.timeline-type {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.timeline-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ── Grille de documents ──────────────────────────────────── */
.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px;
}

.doc-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition-slow);
  cursor: pointer;
  position: relative;
}

.doc-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  opacity: 0;
  transition: opacity .3s;
}

.doc-card:hover {
  border-color: rgba(var(--accent-rgb), 0.3);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), 0 0 30px rgba(var(--accent-rgb),0.1);
}
.doc-card:hover::before { opacity: 1; }

.doc-card-preview {
  height: 150px;
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.doc-card-preview::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(var(--accent-rgb),0.04), transparent);
}

.doc-card-preview img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.doc-card-preview-icon {
  font-size: 52px;
  color: var(--text-muted);
  position: relative;
  z-index: 1;
  opacity: 0.4;
}

.doc-card-body { padding: 16px; }
.doc-card-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-card-meta { font-size: 11.5px; color: var(--text-muted); }

.doc-card-actions {
  display: flex;
  gap: 6px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
}

/* ── Pagination ───────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  padding: 18px;
}

.page-btn {
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  transition: var(--transition);
  text-decoration: none;
  padding: 0 12px;
}
.page-btn:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: rgba(var(--accent-rgb), 0.4);
  box-shadow: 0 0 15px rgba(var(--accent-rgb),0.15);
}
.page-btn.active {
  background: linear-gradient(135deg, var(--accent), #c0392b);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 20px rgba(var(--accent-rgb),0.35);
}
.page-btn:disabled, .page-btn.disabled { opacity: .35; pointer-events: none; }

/* ── Body selector (opérations) ──────────────────────────── */
.body-selector {
  display: flex;
  gap: 32px;
  justify-content: center;
  padding: 20px;
}

.body-svg-wrap {
  position: relative;
  display: inline-block;
}
.body-svg-wrap svg { display: block; }

.body-zone {
  fill: var(--bg-secondary);
  stroke: rgba(var(--accent-rgb),0.3);
  stroke-width: 1.5;
  cursor: pointer;
  transition: fill .2s, stroke .2s;
}
.body-zone:hover {
  fill: var(--accent-light);
  stroke: var(--accent);
  filter: drop-shadow(0 0 6px rgba(var(--accent-rgb),0.4));
}
.body-zone.selected {
  fill: rgba(var(--accent-rgb),0.2);
  stroke: var(--accent);
  filter: drop-shadow(0 0 8px rgba(var(--accent-rgb),0.6));
}
.body-zone.injured {
  fill: var(--danger-bg);
  stroke: var(--danger);
  filter: drop-shadow(0 0 6px rgba(220,38,38,0.5));
}

/* ═══════════════════════════════════════════════════════════
   LIGHT THEME — Blanc Clinique EMS
   ═══════════════════════════════════════════════════════════ */

[data-theme="light"] {
  --bg-primary:      #f5f7fa;
  --bg-secondary:    #eceef3;
  --bg-tertiary:     #e2e5ec;
  --bg-hover:        #e8ecf4;
  --bg-active:       #dde2ed;
  --bg-card:         rgba(255, 255, 255, 0.94);
  --bg-input:        rgba(255, 255, 255, 0.98);
  --bg-sidebar:      rgba(255, 255, 255, 0.98);
  --bg-topbar:       rgba(255, 255, 255, 0.95);

  --text-primary:    #0a0c10;
  --accent-rgb:      192, 57, 43;
  --text-secondary:  #374868;
  --text-muted:      #8094b4;
  --text-link:       #c0392b;

  --border:          rgba(var(--accent-rgb), 0.13);
  --border-muted:    rgba(var(--accent-rgb), 0.06);
  --border-glow:     rgba(var(--accent-rgb), 0.35);

  --accent:          #c0392b;
  --accent-hover:    #a93226;
  --accent-light:    rgba(var(--accent-rgb), 0.08);
  --accent-glow:     0 0 16px rgba(var(--accent-rgb), 0.2), 0 0 40px rgba(var(--accent-rgb), 0.08);

  --accent2:         #e67e22;
  --accent2-light:   rgba(230, 126, 34, 0.09);

  --success:         #16a34a;
  --success-bg:      rgba(22, 163, 74, 0.08);
  --warning:         #d97706;
  --warning-bg:      rgba(217, 119, 6, 0.08);
  --danger:          #991b1b;
  --danger-bg:       rgba(153, 27, 27, 0.08);
  --info:            #0284c7;
  --info-bg:         rgba(2, 132, 199, 0.08);

  --shadow:          0 4px 20px rgba(10, 12, 16, 0.10);
  --shadow-lg:       0 12px 44px rgba(10, 12, 16, 0.14);
  --shadow-neon:     0 0 20px rgba(192, 57, 43, 0.08);
  --shadow-card:     0 2px 12px rgba(10, 12, 16, 0.08), 0 1px 3px rgba(10, 12, 16, 0.05);
}

/* Fond light — ambiance salle de soins */
[data-theme="light"] body {
  background-image:
    radial-gradient(ellipse at 15% 50%, rgba(var(--accent-rgb), 0.04) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 15%, rgba(var(--accent-rgb), 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 55% 85%, rgba(22, 163, 74, 0.02) 0%, transparent 40%);
}

/* Ligne sidebar light */
[data-theme="light"] .sidebar::after {
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(var(--accent-rgb), 0.3) 20%,
    rgba(var(--accent-rgb), 0.25) 50%,
    rgba(var(--accent-rgb), 0.3) 80%,
    transparent 100%
  );
}

/* Logo gradient light */
[data-theme="light"] .sidebar-logo-text {
  background: linear-gradient(135deg, #0a0c10 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Page title light */
[data-theme="light"] .page-title {
  background: linear-gradient(135deg, #0a0c10 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Auth title light */
[data-theme="light"] .auth-title {
  background: linear-gradient(135deg, #0a0c10 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Modal title light */
[data-theme="light"] .modal-title {
  background: linear-gradient(135deg, #0a0c10, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Table light */
[data-theme="light"] .table thead tr {
  background: rgba(var(--accent-rgb), 0.04);
}
[data-theme="light"] .table tbody tr:hover {
  background: rgba(var(--accent-rgb), 0.03);
}

/* Cards light */
[data-theme="light"] .card-header {
  background: rgba(var(--accent-rgb), 0.02);
}
[data-theme="light"] .card-footer {
  background: rgba(0, 0, 0, 0.025);
}
[data-theme="light"] .doc-card-actions {
  background: rgba(0, 0, 0, 0.025);
}
[data-theme="light"] .doc-card-preview {
  background: linear-gradient(135deg, #eceef3, #e2e5ec);
}

/* Modal / Toast light */
[data-theme="light"] .modal {
  background: rgba(255, 255, 255, 0.98);
}
[data-theme="light"] .modal-footer {
  background: rgba(0, 0, 0, 0.03);
}
[data-theme="light"] .modal-overlay {
  background: rgba(8, 10, 14, 0.5);
}
[data-theme="light"] .toast {
  background: rgba(255, 255, 255, 0.98);
}

/* Auth card light */
[data-theme="light"] .auth-card {
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 80px rgba(10,12,16,0.15), 0 1px 0 rgba(255,255,255,1);
}
[data-theme="light"] .auth-bg::before {
  background-image:
    linear-gradient(rgba(var(--accent-rgb), 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.04) 1px, transparent 1px);
}

/* Select options light */
[data-theme="light"] select.form-control option,
[data-theme="light"] select.form-input option {
  background-color: #fff;
  color: #0a0c10;
}

/* Body zones light */
[data-theme="light"] .body-zone {
  fill: #eceef3;
  stroke: rgba(192,57,43,0.25);
}
[data-theme="light"] .body-zone:hover {
  fill: rgba(192,57,43,0.1);
  stroke: var(--accent);
}
[data-theme="light"] .body-zone.selected {
  fill: rgba(192,57,43,0.18);
  stroke: var(--accent);
}

/* Maintenance banner light */
[data-theme="light"] .maintenance-banner {
  background: linear-gradient(135deg, #92400e 0%, #b45309 40%, #d97706 70%, #b45309 100%);
  color: #fff7ed;
}

/* Scrollbar light */
[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.5), rgba(230,126,34,0.5));
}
[data-theme="light"] * {
  scrollbar-color: rgba(var(--accent-rgb), 0.4) transparent;
}

/* ═══════════════════════════════════════════════════════════
   TRANSITION FLUIDE ENTRE THÈMES
   ═══════════════════════════════════════════════════════════ */

.theme-transitioning,
.theme-transitioning *,
.theme-transitioning *::before,
.theme-transitioning *::after {
  transition:
    background-color .3s ease,
    border-color .3s ease,
    color .2s ease,
    box-shadow .3s ease !important;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(4px);
  z-index: 99;
}

/* Tablette ≤ 1024px */
@media (max-width: 1024px) {
  :root { --sidebar-width: 224px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .page-content { padding: 22px; }
  .search-bar { width: 220px; }
  .docs-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

/* Tablette petite ≤ 900px */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 60px rgba(0, 0, 0, 0.65);
  }
  .main-content { margin-left: 0; }
  .sidebar-toggle-mobile { display: flex; }
  .sidebar-toggle { display: none; }
  .sidebar-overlay.open { display: block; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .search-bar { width: 190px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 0 16px; }
}

/* Mobile ≤ 640px */
@media (max-width: 640px) {
  :root { --topbar-height: 56px; }

  .page-content { padding: 14px; }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
  }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; justify-content: center; }

  .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-card { padding: 16px; gap: 12px; }
  .stat-icon { width: 42px; height: 42px; font-size: 18px; }
  .stat-value { font-size: 24px; }

  .docs-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }

  .topbar { padding: 0 14px; }
  .search-bar { display: none; }

  .card-header { padding: 14px 16px; }
  .card-body   { padding: 16px; }
  .card-footer { padding: 12px 16px; }

  .modal-header { padding: 16px 18px; }
  .modal-body   { padding: 18px; }
  .modal-footer { padding: 14px 18px; flex-wrap: wrap; }
  .modal-footer .btn { flex: 1; justify-content: center; }

  .table th, .table td { padding: 10px 12px; }
  .table th { font-size: 9.5px; }
  .table td { font-size: 12.5px; }

  .toast-container { bottom: 16px; right: 12px; left: 12px; }
  .toast { min-width: unset; width: 100%; }

  .flash { margin: 0 14px 14px; }

  .patient-card { flex-direction: column; gap: 14px; }
  .patient-avatar { width: 56px; height: 56px; }

  .breadcrumb { display: none; }
  .topbar-left { gap: 10px; }
  .topbar-right { gap: 8px; }
}

/* Très petit ≤ 400px */
@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr; }
  .page-content { padding: 12px; }
  .topbar-btn:not(.sidebar-toggle-mobile):not(.theme-toggle) { display: none; }
}

/* ═══════════════════════════════════════════════════════════
   SIDEBAR COLLAPSE DESKTOP
   ═══════════════════════════════════════════════════════════ */

.sidebar.collapsed { width: 58px; }
.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .nav-group-label,
.sidebar.collapsed .user-info,
.sidebar.collapsed .user-logout {
  opacity: 0;
  pointer-events: none;
  width: 0;
  overflow: hidden;
}
.sidebar.collapsed + .main-content { margin-left: 58px; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 9px; }
.sidebar.collapsed .nav-item i { width: auto; font-size: 16px; }
.sidebar.collapsed .sidebar-logo { display: none; }
.sidebar.collapsed .sidebar-header { justify-content: center; padding: 14px 8px; }
.sidebar.collapsed .sidebar-toggle { margin: 0 auto; }
.sidebar.collapsed .user-card { justify-content: center; padding: 8px; }
.sidebar.collapsed .user-avatar { margin: 0 auto; }
.sidebar.collapsed .nav-group { margin-bottom: 4px; }

/* Tooltip nav items quand sidebar repliée */
.sidebar.collapsed .nav-item { position: relative; }
.sidebar.collapsed .nav-item:hover::after {
  content: attr(data-label);
  position: absolute;
  left: 62px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 5px 10px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  pointer-events: none;
}

.sidebar .sidebar-logo-text,
.sidebar .nav-item span,
.sidebar .nav-badge,
.sidebar .nav-group-label,
.sidebar .user-info,
.sidebar .user-logout {
  transition: opacity .2s ease, width .2s ease;
}

@media (max-width: 900px) {
  .sidebar.collapsed { width: var(--sidebar-width); }
  .sidebar.collapsed + .main-content { margin-left: 0; }
}

/* ═══════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════ */

.d-flex           { display: flex; }
.align-center     { align-items: center; }
.justify-between  { justify-content: space-between; }
.gap-1 { gap: 8px; }  .gap-2 { gap: 16px; }
.mt-1  { margin-top: 8px; }  .mt-2 { margin-top: 16px; }  .mt-3 { margin-top: 24px; }
.mb-1  { margin-bottom: 8px; }  .mb-2 { margin-bottom: 16px; }  .mb-3 { margin-bottom: 24px; }
.text-muted    { color: var(--text-muted); }
.text-success  { color: var(--success); }
.text-danger   { color: var(--danger); }
.text-warning  { color: var(--warning); }
.text-accent   { color: var(--accent); }
.text-center   { text-align: center; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fs-12  { font-size: 12px; }
.fs-13  { font-size: 13px; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rounded-full { border-radius: 9999px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

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

code {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 0.875em;
  background: var(--accent-light);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid rgba(var(--accent-rgb), 0.18);
}

/* ═══════════════════════════════════════════════════════════
   SCROLLBAR CUSTOM
   ═══════════════════════════════════════════════════════════ */

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--accent), var(--accent2));
  border-radius: 10px;
  opacity: 0.5;
}
::-webkit-scrollbar-thumb:hover { opacity: 1; }

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--accent-rgb), 0.45) transparent;
}

/* ═══════════════════════════════════════════════════════════
   LOADING SPINNER
   ═══════════════════════════════════════════════════════════ */

.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(var(--accent-rgb), 0.15);
  border-top-color: var(--accent);
  border-right-color: var(--accent2);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.2);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════ */

.empty-state {
  text-align: center;
  padding: 70px 24px;
  color: var(--text-muted);
}
.empty-state i {
  font-size: 56px;
  margin-bottom: 20px;
  opacity: .2;
  display: block;
  filter: drop-shadow(0 0 20px var(--accent));
}
.empty-state h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.empty-state p { font-size: 13.5px; }

/* ═══════════════════════════════════════════════════════════
   DÉCORATIONS EMS
   ═══════════════════════════════════════════════════════════ */

/* Séparateur néon rouge */
.neon-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent2), transparent);
  opacity: 0.4;
  margin: 24px 0;
}

/* Glow utils */
.glow-red    { box-shadow: 0 0 20px rgba(var(--accent-rgb),0.35); }
.glow-orange { box-shadow: 0 0 20px rgba(249,115,22,0.35); }
.glow-green  { box-shadow: 0 0 20px rgba(34,197,94,0.35); }
.glow-blue   { box-shadow: 0 0 20px rgba(56,189,248,0.35); }

/* Texte gradient EMS */
.text-gradient {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Focus accessible */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius);
}

/* ID médical monospace */
.medical-id,
.patient-id {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 11.5px;
  letter-spacing: 0.06em;
}

/* Badge urgence clignotant */
.badge-urgent {
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--accent);
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  animation: urgentPulse 1.5s ease-in-out infinite;
}
@keyframes urgentPulse {
  0%, 100% { box-shadow: 0 0 6px rgba(var(--accent-rgb),0.2); opacity: 1; }
  50%       { box-shadow: 0 0 14px rgba(var(--accent-rgb),0.5); opacity: 0.85; }
}
