/**
 * CHARTE GRAPHIQUE OFFICIELLE — MAIRIE DE LUSIGNY-SUR-BARSE
 * Direction 1 : « Vigie Républicaine » (Ardoise Civique & Bleu Barse)
 * Application Opérationnelle du Poste de Commandement Communal (PCC)
 * Standard UI/UX & Facteurs Humains — 100 % Hors Ligne — WCAG AA / AAA
 */

:root {
  /* Palette Direction 1 — Vigie Républicaine (Jour) */
  --lusigny-blue: #1F4E79;
  --lusigny-teal: #005A70;
  --lusigny-teal-dark: #064C58;
  --lusigny-gold: #C2410C;
  --lusigny-gold-light: #FFEDD5;
  --lusigny-mint: #E6F3F6;
  --lusigny-slate: #0F172A;
  --lusigny-bg: #F1F5F9;
  --lusigny-surface: #FFFFFF;
  --lusigny-surface-2: #F8FAFC;
  --lusigny-border: #CBD5E1;
  --lusigny-border-strong: #64748B;
  --lusigny-muted: #475569;

  /* Couleurs sémantiques de statut et d'alerte (contrastes WCAG AAA >= 7:1 jour et nuit) */
  --cmd-actif-fond: #1F4E79;
  --cmd-actif-txt: #FFFFFF;
  --cmd-chiffre: #0F172A;
  --st-rouge: #7F1D1D;
  --st-rouge-fond: #FEE2E2;
  --st-rouge-bord: #991B1B;
  --st-orange: #7C2D12;
  --st-orange-fond: #FFEDD5;
  --st-orange-bord: #9A3412;
  --st-ambre: #78350F;
  --st-ambre-fond: #FEF3C7;
  --st-ambre-bord: #B45309;
  --st-vert: #14532D;
  --st-vert-fond: #DCFCE7;
  --st-vert-bord: #166534;
  --st-gris: #334155;
  --st-gris-fond: #F1F5F9;
  --st-gris-bord: #64748B;

  /* Niveaux opérationnels normalisés de Sécurité Civile (Vert / Ambre / Orange / Rouge — AAA >= 7:1) */
  --lvl-0: #166534; /* Niveau 0 — Normal / Veille (Vert, texte blanc #FFFFFF = 7,13:1 AAA) */
  --lvl-1: #F59E0B; /* Niveau 1 — Vigilance (Ambre, texte sombre #0F172A = 8,31:1 AAA) */
  --lvl-2: #FB923C; /* Niveau 2 — Alerte renforcée / Crise (Orange sécurité vif, texte sombre #0F172A = 7,89:1 AAA) */
  --lvl-3: #991B1B; /* Niveau 3 — Urgence absolue / PPI Rupture (Rouge, texte blanc #FFFFFF = 8,31:1 AAA) */

  /* Badges Opérateurs : zéro violet (#6D28D9 banni), couleur neutre de charte */
  --op-dos: #1F4E79;
  --op-secu: #005A70;
  --op-mco: #1F4E79;
  --op-log: #064C58;
  --op-terrain: #166534;

  /* Dimensions & Ergonomie */
  --header-h: 60px;
  --nav-h: 48px;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 10px;
  --focus-ring: 0 0 0 3px rgba(2, 132, 199, 0.45);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --lusigny-bg: #0B1120;
  --lusigny-surface: #111827;
  --lusigny-surface-2: #1E293B;
  --lusigny-border: #475569;
  --lusigny-border-strong: #94A3B8;
  --lusigny-slate: #F8FAFC;
  --lusigny-muted: #CBD5E1;
  --lusigny-blue: #93C5FD;
  --lusigny-teal: #7DD3FC;
  --lusigny-teal-dark: #7DD3FC;
  --lusigny-gold: #FBBF24;
  --lusigny-gold-light: #431407;
  --lusigny-mint: #0C2D48;
  --st-rouge: #FECACA;
  --st-rouge-fond: #450A0A;
  --st-rouge-bord: #FCA5A5;
  --st-orange: #FFEDD5;
  --st-orange-fond: #431407;
  --st-orange-bord: #FB923C;
  --st-ambre: #FEF3C7;
  --st-ambre-fond: #451A03;
  --st-ambre-bord: #FBBF24;
  --st-vert: #DCFCE7;
  --st-vert-fond: #052E16;
  --st-vert-bord: #4ADE80;
  --st-gris: #E2E8F0;
  --st-gris-fond: #1E293B;
  --st-gris-bord: #94A3B8;
  --lvl-0: #4ADE80;
  --lvl-1: #FBBF24;
  --lvl-2: #FB923C;
  --lvl-3: #FCA5A5;
  --focus-ring: 0 0 0 3px rgba(56, 189, 248, 0.65);

  color-scheme: dark;
}

/* Reset & Typographie institutionnelle */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  padding: 0;
  background-color: var(--lusigny-bg);
  color: var(--lusigny-slate);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  color: var(--lusigny-slate);
  text-wrap: balance;
  margin-top: 0;
  font-weight: 800;
  letter-spacing: -0.015em;
}

a { color: var(--lusigny-teal); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid #0284C7; outline-offset: 2px; }

[hidden] { display: none !important; }

/* ==============================================================================
   1. ÉCRAN DE VERROUILLAGE / ACCÈS DE CRISE
   ============================================================================== */
.lock-screen {
  position: relative;
  z-index: 2200;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: var(--lusigny-bg);
}

.lock-card {
  width: 100%;
  max-width: 480px;
  background: var(--lusigny-surface);
  border: 1.5px solid var(--lusigny-border);
  border-top: 5px solid var(--lusigny-blue);
  border-radius: var(--radius-lg);
  padding: 32px 30px 34px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  text-align: center;
}

.lock-blason {
  width: 170px;
  height: auto;
  max-height: 120px;
  margin: 0 auto 14px;
  display: block;
}

.lock-header h1 {
  font-size: 1.45rem;
  font-weight: 800;
  margin-bottom: 6px;
  color: var(--lusigny-slate);
}

.lock-header p {
  font-size: 1rem;
  color: var(--lusigny-muted);
  margin-bottom: 24px;
}

.form-group {
  text-align: left;
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: var(--lusigny-slate);
  margin-bottom: 6px;
}

.input-field, select.input-field {
  width: 100%;
  padding: 10px 14px;
  min-height: 48px;
  font-size: 1rem;
  border: 1.5px solid var(--lusigny-border-strong);
  border-radius: var(--radius);
  background: var(--lusigny-surface);
  color: var(--lusigny-slate);
  font-variant-numeric: tabular-nums;
  transition: border-color 0.1s ease;
}

.input-field:focus {
  border-color: var(--lusigny-blue);
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn-primary {
  width: 100%;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 700;
  color: #FFFFFF;
  background-color: var(--lusigny-blue);
  border: 1.5px solid var(--lusigny-blue);
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color 0.1s ease;
  min-height: 48px;
}

.btn-primary:hover { background-color: var(--lusigny-teal-dark); border-color: var(--lusigny-teal-dark); }
.error-banner {
  color: var(--st-rouge);
  font-size: 1rem;
  font-weight: 700;
  margin-top: 12px;
  min-height: 1.2em;
}

/* ==============================================================================
   2. BANDEAU DE COMMANDEMENT SUPÉRIEUR (HEADER — ARDOISE CIVIQUE UNI)
   ============================================================================== */
.header-top {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #0F172A;
  border-bottom: 2px solid #1F4E79;
  color: #FFFFFF;
  min-height: var(--header-h);
  padding: 6px 16px;
  padding-top: max(6px, env(safe-area-inset-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-blason {
  width: 86px;
  height: 44px;
  flex-shrink: 0;
}

.brand-titles {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-sub {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #FFF7D6;
}

.brand-main {
  font-size: 1rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Statut Niveau PCS interactif */
.level-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  background: #1E293B;
  color: #FFFFFF;
  cursor: pointer;
  white-space: nowrap;
}

.level-badge.lvl-0 { background-color: #166534; color: #FFFFFF; border-color: #86EFAC; }
.level-badge.lvl-1 { background-color: #F59E0B; color: #0F172A; border-color: #FDE68A; }
.level-badge.lvl-2 { background-color: #FB923C; color: #0F172A; border-color: #FED7AA; }
.level-badge.lvl-3 { background-color: #991B1B; color: #FFFFFF; border-color: #FCA5A5; }

/* Alignement badges niveau 2 (orange #FB923C) en style inline (ex. badge équipe « En mission ») : texte sombre #0F172A AAA (7,89:1) */
[style*="background:var(--lvl-2)"],
[style*="background: var(--lvl-2)"],
[style*="background-color:var(--lvl-2)"],
[style*="background-color: var(--lvl-2)"],
.level-badge[style*="var(--lvl-2)"] {
  background-color: #FB923C !important;
  color: #0F172A !important;
}

/* Statut de Synchronisation Multi-Postes */
.sync-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 1rem;
  padding: 6px 12px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.14);
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  font-weight: 700;
  color: #FFFFFF;
  cursor: pointer;
}

.sync-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: #94A3B8;
}

.sync-indicator.connected .sync-dot { background-color: #4ADE80; }
.sync-indicator.offline .sync-dot { background-color: #FBBF24; }

/* Sélecteur de Poste Opérateur */
.role-pill {
  font-size: 1rem;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: var(--radius);
  background: #1F4E79;
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  color: #FFFFFF;
  cursor: pointer;
}

/* ==============================================================================
   3. BARRE DE NAVIGATION MODULES (DESKTOP & MOBILE)
   ============================================================================== */
.module-nav {
  position: sticky;
  top: var(--header-h);
  z-index: 999;
  background: var(--lusigny-surface);
  border-bottom: 1.5px solid var(--lusigny-border);
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
}

.module-nav::-webkit-scrollbar { display: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 1rem;
  font-weight: 650;
  color: var(--lusigny-slate);
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  transition: background-color 0.1s ease;
  min-height: var(--nav-h);
}

.nav-item:hover { color: var(--lusigny-blue); background-color: var(--lusigny-surface-2); }
.nav-item[aria-current="page"] {
  color: var(--lusigny-teal-dark);
  border-bottom-color: var(--lusigny-blue);
  background-color: var(--lusigny-mint);
  font-weight: 800;
}

.nav-badge {
  background-color: var(--st-rouge);
  color: #FFFFFF;
  font-size: 1rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 4px;
}

/* ==============================================================================
   4. STRUCTURE DE TRAVAIL (SPLIT-VIEW LISTE + CARTE)
   ============================================================================== */
.workspace-container {
  display: grid;
  grid-template-columns: 1fr;
  min-height: calc(100dvh - var(--header-h) - var(--nav-h));
}

@media (min-width: 1024px) {
  body[data-layout="split"] .workspace-container {
    grid-template-columns: minmax(520px, 58%) 1fr;
    height: calc(100dvh - var(--header-h) - var(--nav-h));
    overflow: hidden;
  }
  body[data-layout="split"] #mainView {
    overflow-y: auto;
    border-right: 1.5px solid var(--lusigny-border);
  }
  body[data-layout="split"] #mapViewPane {
    display: block;
    height: 100%;
  }
}

#mainView {
  padding: 20px 20px 80px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  font-size: 1rem;
}

/* Plancher ergonomique : neutralisation des micro-tailles en ligne (< 16 px) hors impression */
@media screen {
  #mainView [style*="font-size:0.7"],
  #mainView [style*="font-size: 0.7"],
  #mainView [style*="font-size:.7"],
  #mainView [style*="font-size:0.8"],
  #mainView [style*="font-size: 0.8"],
  #mainView [style*="font-size:.8"],
  #mainView [style*="font-size:0.9"],
  #mainView [style*="font-size: 0.9"],
  #mainView small {
    font-size: 1rem !important;
  }
}

#mapViewPane {
  position: relative;
  height: calc(100dvh - var(--header-h) - var(--nav-h));
  display: none;
}

body[data-layout="map"] #mainView { display: none; }
body[data-layout="map"] #mapViewPane { display: block; }

#leafletMap, #crisisMap {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--lusigny-surface-2);
}

.help-text { margin: 4px 0 0; font-size: 1rem; color: var(--lusigny-muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.needs-fieldset { border: 1.5px solid var(--lusigny-border); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 1rem; }
.needs-fieldset legend { color: var(--lusigny-teal-dark); font-weight: 800; padding: 0 6px; font-size: 1rem; }
.person-list { display: grid; gap: 10px; }
.person-card { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding: 14px; border: 1.5px solid var(--lusigny-border); border-left: 5px solid var(--lusigny-teal); border-radius: var(--radius); background: var(--lusigny-surface); }
.person-card select { min-width: 180px; min-height: 48px; padding: 8px 10px; font-size: 1rem; }
.person-card .btn { margin-top: 6px; width: 100%; }
.ops-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ops-form { margin-top: 12px; }
.ops-form h2 { font-size: 1.15rem; color: var(--lusigny-teal-dark); }
.contact-grid, .team-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.contact-card, .team-card { display: grid; gap: 8px; padding: 14px; border: 1.5px solid var(--lusigny-border); border-radius: var(--radius); background: var(--lusigny-surface); font-size: 1rem; }
.contact-card { border-top: 4px solid var(--lusigny-blue); }
.team-card { border-left: 5px solid var(--lusigny-teal); }
.contact-card small, .team-card small { color: var(--lusigny-muted); font-size: 1rem; }
.contact-tag { width: max-content; padding: 3px 10px; border-radius: 6px; background: var(--lusigny-mint); color: var(--lusigny-teal-dark); font-size: 1rem; font-weight: 800; }

/* Restructuration R1 : Mise en regard claire du pôle CARE (D9) et du pôle Appels Vulnérables (D11) */
#carteCare { border-top: 5px solid var(--lusigny-teal); }
#carteAppels { border-top: 5px solid var(--lusigny-blue); }

@media (max-width: 620px) {
  .form-grid { grid-template-columns: 1fr; }
  .person-card { flex-direction: column; }
  .person-card select { width: 100%; }
}

/* ==============================================================================
   5. COMPOSANTS DE GESTION DE CRISE (COCKPIT & CARDS — ZÉRO OMBRE DIFFUSE)
   ============================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--lusigny-surface);
  border: 1.5px solid var(--lusigny-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
}

.kpi-card .kpi-label {
  font-size: 1rem;
  font-weight: 700;
  color: var(--st-gris);
}

.kpi-card .kpi-val {
  font-size: 2rem;
  font-weight: 850;
  color: var(--cmd-chiffre);
  line-height: 1.1;
  margin: 4px 0 2px;
  font-variant-numeric: tabular-nums;
}

.kpi-card .kpi-sub {
  font-size: 1rem;
  color: var(--st-gris);
}

.card {
  background: var(--lusigny-surface);
  border: 1.5px solid var(--lusigny-border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: none;
}

.card-header {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  border-bottom: 1.5px solid var(--lusigny-border);
  padding-bottom: 10px;
}

.card-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--lusigny-slate);
  margin: 0;
}

/* Main Courante Opérationnelle (MCO) — Corps >= 16 px & alignement tabulaire */
.mco-entry {
  display: grid;
  grid-template-columns: 96px auto 1fr;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--lusigny-border);
  font-size: 1rem;
  align-items: start;
}

.mco-entry:hover { background-color: var(--lusigny-surface-2); }
.mco-entry.struck { opacity: 0.55; text-decoration: line-through; }

.mco-time {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--st-gris);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.mco-badge {
  font-size: 1rem;
  font-weight: 800;
  padding: 2px 10px;
  border-radius: var(--radius-sm);
  text-align: center;
  text-transform: uppercase;
  background-color: var(--cmd-actif-fond);
  color: var(--cmd-actif-txt);
}

.badge-dos, .badge-secu, .badge-mco, .badge-log, .badge-terrain {
  background-color: var(--cmd-actif-fond);
  color: var(--cmd-actif-txt);
}

/* Porte-à-Porte (B3) Progress — Cibles >= 44 px */
.sector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 14px;
}

.sector-card {
  border: 1.5px solid var(--lusigny-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--lusigny-surface);
  font-size: 1rem;
}

.sector-card.completed {
  border-color: var(--st-vert-bord);
  background-color: var(--st-vert-fond);
}

.progress-bar-bg {
  width: 100%;
  height: 10px;
  background: var(--lusigny-surface-2);
  border: 1px solid var(--lusigny-border);
  border-radius: 999px;
  overflow: hidden;
  margin: 8px 0;
}

.progress-bar-fill {
  height: 100%;
  background: var(--lusigny-teal);
  transition: width 0.1s ease;
}

/* Boutons & Contrôles — Plancher 48 px & 16 px */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  min-width: 48px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  border: 1.5px solid var(--lusigny-border-strong);
  background: var(--lusigny-surface);
  color: var(--lusigny-slate);
  cursor: pointer;
  transition: background-color 0.1s ease, border-color 0.1s ease;
}

.btn:hover { border-color: var(--lusigny-blue); background-color: var(--lusigny-surface-2); color: var(--lusigny-slate); }
.btn-sm { min-height: 48px; min-width: 48px; padding: 6px 12px; font-size: 1rem; }
.btn-danger { background-color: var(--st-plein-rouge, #991B1B); color: #FFFFFF; border-color: var(--st-plein-rouge, #991B1B); }
.btn-danger:hover { background-color: #7F1D1D; color: #FFFFFF; }

/* Styles d'impression officiels */
@media print {
  .header-top, .module-nav, #mapViewPane, .btn, .no-print { display: none !important; }
  body { background: #fff !important; color: #000 !important; font-size: 11pt; }
  #mainView { max-width: 100% !important; padding: 0 !important; }
  .card { border: none !important; box-shadow: none !important; padding: 0 !important; margin-bottom: 20px !important; }
  .print-header { display: block !important; border-bottom: 2px solid #000; padding-bottom: 10px; margin-bottom: 15px; }
}

/* ==============================================================================
   v3.20 — Bandeau discret « Nouvelles données reçues : actualiser »
   ============================================================================== */
.remote-update-banner {
  position: fixed;
  top: calc(var(--header-h) + var(--nav-h) + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1500;
}
.remote-update-banner[hidden] { display: none; }
.remote-update-banner button {
  background: var(--lusigny-blue);
  color: #FFFFFF;
  border: 2px solid #FFFFFF;
  border-radius: 999px;
  min-height: 48px;
  padding: 8px 18px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}
@media (min-width: 1024px) {
  body[data-layout="split"] .remote-update-banner { left: 280px; }
}

/* ==============================================================================
   v3.21 — Mode exercice, intégrité de la main courante (E1), fiches PCS v6.3
   ============================================================================== */
.bandeau-exercice {
  position: sticky; top: 0; z-index: 3000;
  background-color: #7C2D12;
  background-image: repeating-linear-gradient(135deg, #9A3412 0 18px, #7C2D12 18px 36px);
  color: #FFFFFF; font-weight: 800; letter-spacing: 0.04em; text-align: center;
  padding: 6px 12px; font-size: 1rem; text-transform: uppercase;
}
.bandeau-exercice[hidden] { display: none; }
body.mode-exercice .header-top { box-shadow: inset 0 -4px 0 #F59E0B; }

.chain-indicator {
  border: 1.5px solid rgba(255,255,255,0.55); border-radius: var(--radius); padding: 6px 12px;
  font-size: 1rem; font-weight: 800; cursor: pointer; color: #FFFFFF; background: #166534;
}
.chain-indicator.ko { background: #991B1B; }

.chain-banner { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 12px; font-size: 1rem; border: 1.5px solid var(--lusigny-border); background: var(--lusigny-surface); }
.chain-banner.ok { border-color: var(--st-vert-bord); background: var(--st-vert-fond); color: var(--st-vert); }
.chain-banner.ko { border-color: var(--st-rouge-bord); background: var(--st-rouge-fond); color: var(--st-rouge); }
.chain-banner ul { margin: 6px 0 4px 18px; padding: 0; }

.mco-filtres { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; margin: 0 0 12px; align-items: center; }
.mco-filtres .input-field { padding: 8px 12px; font-size: 1rem; min-height: 48px; }
.mco-entry.marquant { border-left: 5px solid var(--st-orange-bord); background: var(--st-orange-fond); }
.mco-entry.altered { background: var(--st-rouge-fond); border-left: 6px solid var(--st-rouge-bord); }
.mco-entry .mco-actions { display: flex; gap: 6px; align-items: flex-start; }
.mco-entry .mco-actions .btn { width: auto; min-height: 48px; padding: 6px 12px; font-size: 1rem; }
.mco-lien { display: block; color: var(--lusigny-muted); font-style: italic; font-size: 1rem; }
.mco-lien.ko { color: var(--st-rouge); font-style: normal; font-weight: 700; }
.mco-seal { font-size: 1rem; color: var(--st-vert); font-family: var(--font-mono); }
.mco-seal.legacy { color: var(--lusigny-muted); }
.mco-correction-banner { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: var(--st-orange-fond); border: 1.5px solid var(--st-orange-bord); color: var(--st-orange); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 10px; font-size: 1rem; font-weight: 700; }

.fiche-sous-titre { margin: 4px 0 8px; color: var(--lusigny-slate); font-weight: 700; font-size: 1.05rem; }
.fiche-h { color: var(--lusigny-teal-dark); margin-top: 18px; font-size: 1.15rem; }
.fiche-h4 { font-size: 1.05rem; }
.check-list { display: grid; gap: 4px; margin: 8px 0; }
.encart { border-left: 5px solid var(--lusigny-teal); background: var(--lusigny-mint); border-radius: var(--radius-sm); padding: 10px 14px; margin: 10px 0; font-size: 1rem; }
.encart-titre { font-weight: 800; font-size: 1rem; text-transform: uppercase; color: var(--lusigny-teal-dark); margin-bottom: 4px; }
button[disabled] { opacity: 0.55; cursor: not-allowed; }
@media print { .bandeau-exercice { position: static; } .mco-actions, .mco-filtres { display: none !important; } }
[data-theme="dark"] .chain-banner.ok { background: #14532D; color: #DCFCE7; border-color: #166534; }
[data-theme="dark"] .chain-banner.ko, [data-theme="dark"] .mco-entry.altered { background: #450A0A; color: #FECACA; }
[data-theme="dark"] .mco-correction-banner { background: #431407; border-color: #9A3412; color: #FED7AA; }
@media (min-width: 1024px) {
  body.mode-exercice[data-layout="split"] .workspace-container { height: calc(100dvh - var(--header-h) - var(--nav-h) - 34px); }
}
body.mode-exercice #mapViewPane { height: calc(100dvh - var(--header-h) - var(--nav-h) - 34px); }

/* ================= v3.22 Pilotage — Tableaux >= 16 px & En-têtes figés ================= */
.sous-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; padding-bottom: 8px; border-bottom: 1.5px solid var(--lusigny-border); }
.sous-nav a { padding: 8px 14px; border: 1.5px solid var(--lusigny-border-strong); border-radius: var(--radius); font-size: 1rem; font-weight: 700; color: var(--lusigny-slate); text-decoration: none; background: var(--lusigny-surface); }
.sous-nav a.actif { background: var(--lusigny-blue); border-color: var(--lusigny-blue); color: #FFFFFF; }
.a-traiter { border-left: 6px solid var(--st-rouge-bord); }
.a-traiter.calme { border-left-color: var(--st-vert-bord); }
.a-traiter-liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.a-traiter-liste li { padding: 10px 12px; border-radius: var(--radius-sm); font-weight: 700; font-size: 1rem; }
.a-traiter-liste li a { color: inherit; text-decoration: none; display: block; }
.a-traiter-liste li.rouge { background: var(--st-rouge-fond); color: var(--st-rouge); }
.a-traiter-liste li.orange { background: var(--st-orange-fond); color: var(--st-orange); }
.a-traiter-liste li.info { background: var(--st-gris-fond); color: var(--st-gris); }

.table-pilotage { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table-pilotage td, .table-pilotage th { padding: 8px 10px; border: 1px solid var(--lusigny-border); vertical-align: middle; font-size: 1rem; text-align: left; }
.table-pilotage thead th { position: sticky; top: 0; z-index: 2; background: var(--lusigny-surface-2); font-weight: 800; color: var(--lusigny-slate); border-bottom: 2px solid var(--lusigny-border-strong); }
.table-pilotage select.input-field { padding: 6px 10px; font-size: 1rem; min-width: 130px; min-height: 48px; }
.table-pilotage tr.retard td, tr.non-recu td, p.non-recu { background: var(--st-rouge-fond); color: var(--st-rouge); font-weight: 700; }
.actions-cell { display: flex; gap: 6px; flex-wrap: wrap; }
.actions-cell .btn { width: auto; }
.seuil-ligne { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0 10px; font-size: 1rem; }
.txt-rouge { color: var(--st-rouge); font-weight: 700; }
.rappel-radio { margin: 6px 0 0; font-weight: 800; letter-spacing: 0.03em; color: var(--lusigny-teal-dark); font-size: 1rem; }
.lien-module { margin-left: 8px; font-size: 1rem; font-weight: 700; color: var(--lusigny-blue); white-space: nowrap; }
.cl-champs label { display: grid; gap: 4px; font-size: 1rem; font-weight: 700; color: var(--lusigny-slate); }
.bilan .data-table { width: 100%; border-collapse: collapse; margin: 6px 0 14px; }
.bilan .data-table td, .bilan .data-table th { border: 1px solid var(--lusigny-border); padding: 8px 10px; font-size: 1rem; text-align: left; }
[data-theme="dark"] .a-traiter-liste li.rouge, [data-theme="dark"] .table-pilotage tr.retard td, [data-theme="dark"] tr.non-recu td, [data-theme="dark"] p.non-recu { background: #450A0A; color: #FECACA; }
[data-theme="dark"] .a-traiter-liste li.orange { background: #431407; color: #FED7AA; }
@media print { .sous-nav, .lien-module { display: none !important; } .bilan { box-shadow: none; border: none; } }

/* ================= v3.23 Accès & Impressions ================= */
.kpi-mob { display: flex; flex-wrap: wrap; gap: 10px 18px; margin: 6px 0 14px; font-weight: 800; font-size: 1rem; padding: 10px 14px; background: var(--lusigny-surface-2); border-radius: var(--radius); border: 1px solid var(--lusigny-border); }
.impression { background: #fff; color: #111; padding: 12px; border-radius: var(--radius-sm, 6px); }
.impr-bandeau { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.impr-bandeau td { border: 1px solid #00677D; padding: 6px 10px; vertical-align: middle; }
.impr-code { background: #00677D; color: #fff; font-weight: 800; font-size: 1.6rem; text-align: center; width: 70px; }
.impr-titre { font-weight: 800; font-size: 1.05rem; color: #00677D; }
.impr-sous { font-size: 0.85rem; color: #333; }
.impr-meta { font-size: 0.8rem; width: 190px; color: #333; }
.impr-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.impr-table th { background: #00677D; color: #fff; text-align: left; padding: 6px 8px; border: 1px solid #00677D; }
.impr-table td { border: 1px solid #666; padding: 6px 8px; vertical-align: top; }
.impr-table tr.vide td { height: 24px; }
.impr-pied { font-size: 0.8rem; color: #333; margin-top: 6px; }
@media print {
  .impression { padding: 0; }
  .impr-table th, .impr-code { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .impr-table thead { display: table-header-group; }
  .impr-table tr { break-inside: avoid; }
}

/* ================= v3.24 : nouvelle version du PCS ================= */
.bandeau-pcs-maj { position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px; z-index: 2100; background: var(--lusigny-blue); color: #fff; padding: 12px 16px; border-radius: 10px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; max-width: calc(100% - 32px); font-weight: 700; font-size: 1rem; }
.bandeau-pcs-maj .btn { background: #fff; color: var(--lusigny-blue); }

/* ================= v3.25 : styles sortis d'index.html (CSP sans style en ligne) ================= */
.recherche-globale { flex: 1 1 180px; max-width: 300px; }
.recherche-champ { padding: 6px 14px; font-size: 1rem; height: 48px; border-radius: var(--radius); }
.groupe-case { display: flex; align-items: center; gap: 10px; }
.groupe-case input[type="checkbox"] { width: 22px; height: 22px; }
.groupe-case label { margin: 0; text-transform: none; font-size: 1rem; font-weight: 500; cursor: pointer; }
.bascule-affichage { display: flex; border: 1.5px solid rgba(255,255,255,0.5); border-radius: var(--radius); overflow: hidden; }
.bascule-affichage .btn { border: none; border-radius: 0; color: #fff; background: transparent; font-size: 1rem; padding: 0 12px; }
body[data-layout="split"] .bascule-affichage [data-view="split"]:not(.actif):only-of-type { background: rgba(255,255,255,0.2); }
.outils-entete { display: flex; gap: 6px; }
.btn-entete { color: #fff; background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.45); }
.toast { position: fixed; bottom: 20px; right: 20px; z-index: 2000; background: #0F172A; color: #FFFFFF; border: 2px solid var(--lusigny-teal); padding: 12px 18px; border-radius: var(--radius); display: none; font-size: 1rem; font-weight: 700; }

/* ================= v3.25 : droits du serveur, saisie express, arrêtés ================= */
.bandeau-droits { position: sticky; top: 0; z-index: 1500; padding: 8px 14px; font-weight: 800; text-align: center; font-size: 1rem; }
.bandeau-droits.absents { background: #7F1D1D; color: #FFFFFF; }
.bandeau-droits.degrade { background-color: #7C2D12; background-image: repeating-linear-gradient(45deg, #9A3412, #9A3412 14px, #7C2D12 14px, #7C2D12 28px); color: #FFFFFF; letter-spacing: 0.03em; }
.saisie-express[hidden] { display: none; }
.saisie-express { display: flex; gap: 10px; align-items: center; padding: 8px 16px; background: var(--lusigny-surface-2); border-bottom: 1.5px solid var(--lusigny-border); }
.saisie-express label { font-weight: 800; font-size: 1rem; white-space: nowrap; color: var(--lusigny-teal-dark); }
.saisie-express input { flex: 1 1 auto; min-height: 44px; padding: 6px 12px; font-size: 1rem; }
.saisie-express .se-msg { font-size: 1rem; min-width: 0; font-weight: 600; }
.saisie-express .se-msg.ok { color: var(--st-vert); }
.saisie-express .se-msg.ko { color: var(--st-rouge); font-weight: 700; }
.arrete-champ { background: #FFF3C4; border-bottom: 2px dashed #B45309; padding: 0 4px; font-weight: 700; color: #0F172A; }
.arrete-auto { background: #E0F2FE; border-bottom: 2px dotted #1F4E79; padding: 0 4px; font-style: italic; font-weight: 600; color: #0F172A; }   /* v3.28.4 : numéro automatique, pas un champ à compléter */
[data-theme="dark"] .arrete-champ { background: #451A03; color: #FEF3C7; border-bottom-color: #FBBF24; }
[data-theme="dark"] .arrete-auto { background: #0C4A6E; color: #E0F2FE; border-bottom-color: #7DD3FC; }
.situation-imprimable .data-table th { width: 160px; background: var(--lusigny-surface-2); color: var(--lusigny-slate); font-weight: 800; }
/* Mode mur projeté VISU : seul #dbNouvelleAction est masqué en CSS (le masquage de .module-nav, #navMobile et .saisie-express est réservé au futur lot JS/HTML VISU) */
body[data-role="visu"] #dbNouvelleAction { display: none !important; }
.arrete-texte { white-space: pre-wrap; font-family: Georgia, "Times New Roman", serif; line-height: 1.6; font-size: 1rem; }
.arrete-editeur { width: 100%; min-height: 420px; font-family: Georgia, "Times New Roman", serif; font-size: 1rem; line-height: 1.55; }
.arrete-statut { display: inline-block; padding: 4px 12px; border-radius: var(--radius-sm); font-size: 1rem; font-weight: 800; }
.arrete-statut.brouillon { background: var(--st-orange-fond); color: var(--st-orange); border: 1.5px solid var(--st-orange-bord); }
.arrete-statut.valide { background: var(--st-vert-fond); color: var(--st-vert); border: 1.5px solid var(--st-vert-bord); }
.arrete-page { position: relative; background: #fff; color: #111; padding: 18mm 18mm 22mm; max-width: 210mm; margin: 0 auto; border: 1px solid var(--lusigny-border); }
.arrete-page .entete-arrete { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #00677D; padding-bottom: 6mm; margin-bottom: 8mm; font-size: 0.95rem; }
.arrete-page .signature { margin-top: 14mm; text-align: right; }
.arrete-page .empreinte { margin-top: 10mm; font-size: 0.8rem; color: #444; word-break: break-all; font-family: var(--font-mono); }
.filigrane-exercice { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; font-size: 110px; font-weight: 900; color: rgba(220, 38, 38, 0.16); transform: rotate(-30deg); letter-spacing: 0.1em; }
@media print {
  body.impression-arrete .header-top, body.impression-arrete .module-nav, body.impression-arrete #mapViewPane,
  body.impression-arrete .saisie-express, body.impression-arrete .bandeau-droits, body.impression-arrete .no-print { display: none !important; }
  body.impression-arrete .arrete-page { box-shadow: none; border: none; padding: 0; max-width: none; }
  body.impression-arrete .filigrane-exercice { position: fixed; color: rgba(220, 38, 38, 0.18); }
}

.btn-auto { width: auto; }

/* =====================================================================================================
   v3.26.1 (B21) — Contrastes (WCAG AA / AAA), thème sombre fort contraste, zones tactiles 48 × 48
   ===================================================================================================== */
.brand-sub { color: #7A4F00; }
.header-top .brand-sub { color: #FFF7D6; }
[data-theme="dark"] .brand-sub { color: #FBBF24; }
[data-theme="dark"] .header-top .brand-sub { color: #FFF7D6; }
.btn.btn-primary { color: #FFFFFF; background-color: var(--lusigny-blue); border-color: var(--lusigny-blue); }
.btn.btn-primary:hover { color: #FFFFFF; background-color: var(--lusigny-teal-dark); border-color: var(--lusigny-teal-dark); }
.sync-indicator, .role-pill, .chain-indicator, .header-top .btn, .header-top button:not(.level-badge), .btn-entete { color: #FFFFFF; }
.header-top .btn:hover, .header-top button:not(.level-badge):hover, .btn-entete:hover { color: #FFFFFF; border-color: #FFFFFF; background: rgba(255,255,255,0.18); }
[data-theme="dark"] .header-top .btn, [data-theme="dark"] .header-top button:not(.level-badge), [data-theme="dark"] .header-top .btn:hover, [data-theme="dark"] .header-top button:not(.level-badge):hover, [data-theme="dark"] .btn-entete, [data-theme="dark"] .btn-entete:hover { color: #FFFFFF !important; }
.header-top .sync-indicator, .header-top .role-pill { background: rgba(255, 255, 255, 0.14); border: 1.5px solid rgba(255, 255, 255, 0.5); }
.chain-indicator { background: #166534; }
.bascule-affichage .btn.actif, body[data-layout="split"] .bascule-affichage [data-view="split"]:not(.actif) { background: transparent; }
.bascule-affichage .btn.actif { background: #1F4E79; box-shadow: inset 0 -3px 0 #FDE68A; }
body[data-layout="split"] .bascule-affichage:not(:has(.actif)) [data-view="split"] { background: #1F4E79; box-shadow: inset 0 -3px 0 #FDE68A; }
.card .role-pill, .card-header .role-pill { background: var(--lusigny-blue); color: #FFFFFF; border-color: transparent; font-size: 1rem; }

/* --- Bandeau « Mise à jour disponible » (B20) --- */
.bandeau-maj-app { position: fixed; left: 50%; transform: translateX(-50%); bottom: 72px; z-index: 2150; background: #1F4E79; color: #FFFFFF;
  padding: 12px 16px; border-radius: 10px; display: flex; gap: 10px; align-items: center;
  flex-wrap: wrap; max-width: calc(100% - 32px); font-weight: 700; font-size: 1rem; }
.bandeau-maj-app .btn { background: #FFFFFF; color: #1F4E79; border-color: #FFFFFF; }
.bandeau-maj-app[hidden] { display: none; }

/* --- Réglages : affichage --- */
.carte-affichage { margin-bottom: 20px; }
.titre-carte-reglage { font-size: 1.15rem; margin-bottom: 8px; }
.choix-theme { display: flex; gap: 10px 20px; flex-wrap: wrap; }
.choix-theme-option { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 8px; cursor: pointer; font-weight: 700; font-size: 1rem; }
.choix-theme-option input { width: 22px; height: 22px; }

/* --- Thème sombre fort contraste (Direction 1 — Nuit 2 h du matin, contrastes AAA >= 7:1 sur toutes les alertes) --- */
[data-theme="dark"] .header-top { background: #060B14; border-bottom-color: #334155; }
[data-theme="dark"] .btn-primary, [data-theme="dark"] .btn.btn-primary, [data-theme="dark"] .sous-nav a.actif { background-color: #075985; border-color: #7DD3FC; color: #FFFFFF; }
[data-theme="dark"] [style*="background:var(--lusigny-teal)"], [data-theme="dark"] [style*="background: var(--lusigny-teal)"],
[data-theme="dark"] [style*="background-color:var(--lusigny-teal)"] { background: #075985 !important; color: #FFFFFF; }
[data-theme="dark"] [style*="background-color:var(--lvl-0)"], [data-theme="dark"] [style*="background:var(--lvl-0)"] { background-color: #166534 !important; color: #FFFFFF !important; }
[data-theme="dark"] [style*="background-color:var(--lvl-1)"], [data-theme="dark"] [style*="background:var(--lvl-1)"] { background-color: #FBBF24 !important; color: #0F172A !important; }
[data-theme="dark"] [style*="background-color:var(--lvl-2)"], [data-theme="dark"] [style*="background:var(--lvl-2)"],
[data-theme="dark"] [style*="background: var(--lvl-2)"], [data-theme="dark"] [style*="background-color: var(--lvl-2)"],
[data-theme="dark"] .level-badge[style*="var(--lvl-2)"] { background-color: #FB923C !important; color: #0F172A !important; }
[data-theme="dark"] [style*="background:var(--lvl-3)"], [data-theme="dark"] [style*="background-color:var(--lvl-3)"] { background-color: #991B1B !important; color: #FFFFFF !important; }
[data-theme="dark"] .btn-primary:hover, [data-theme="dark"] .btn.btn-primary:hover { background-color: #0369A1; color: #FFFFFF; }
[data-theme="dark"] .toast { background: #075985; border-color: #FFFFFF; }
[data-theme="dark"] .nav-item:hover, [data-theme="dark"] .btn:hover, [data-theme="dark"] .rappel-radio, [data-theme="dark"] .lien-module { color: #7DD3FC; }
[data-theme="dark"] .level-badge.lvl-0 { background-color: #4ADE80 !important; color: #052E16 !important; border-color: #BBF7D0; }
[data-theme="dark"] .level-badge.lvl-1 { background-color: #FBBF24 !important; color: #0F172A !important; border-color: #FEF3C7; }
[data-theme="dark"] .level-badge.lvl-2 { background-color: #FB923C !important; color: #0F172A !important; border-color: #FED7AA; }
[data-theme="dark"] .level-badge.lvl-3, [data-theme="dark"] .btn-danger, [data-theme="dark"] .nav-badge { background-color: #991B1B !important; border-color: #FCA5A5; color: #FFFFFF !important; }
[data-theme="dark"] .mco-seal { color: #86EFAC; }
[data-theme="dark"] .card .role-pill, [data-theme="dark"] .card-header .role-pill { background: #075985; }
[data-theme="dark"] .bandeau-pcs-maj { background: #075985; }
[data-theme="dark"] .bandeau-pcs-maj .btn { color: #0F172A; }

/* --- Impression : toujours en clair, quel que soit le thème choisi --- */
@media print {
  :root[data-theme="dark"] {
    --lusigny-bg: #FFFFFF; --lusigny-surface: #FFFFFF; --lusigny-surface-2: #F1F5F9; --lusigny-border: #CBD5E1;
    --lusigny-slate: #0F172A; --lusigny-muted: #475569; --lusigny-blue: #1F4E79; --lusigny-teal: #005A70;
    --lusigny-teal-dark: #064C58; --lusigny-gold: #C2410C; --lusigny-gold-light: #FFEDD5; --lusigny-mint: #E6F3F6;
    --lvl-0: #166534; --lvl-1: #F59E0B; --lvl-2: #FB923C; --lvl-3: #991B1B;
    color-scheme: light;
  }
  [data-theme="dark"] body { background: #fff; color: #0F172A; }
}

/* --- Zones tactiles ≥ 48 × 48 px et suppression du délai de double-tap --- */
a, button, input, select, textarea, summary, label, [role="button"], [role="tab"], [tabindex] { touch-action: manipulation; }
.btn, .btn-sm, .header-top button, .level-badge[role="button"], button.level-badge { min-height: 48px; min-width: 48px; }
.input-field, input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="range"]), select, textarea { min-height: 48px; font-size: 1rem; }
input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; accent-color: var(--lusigny-blue); }
.groupe-case { min-height: 48px; }
.groupe-case label { display: inline-flex; align-items: center; min-height: 48px; }
.groupe-case input[type="checkbox"] { width: 22px; height: 22px; }
label:has(> input[type="checkbox"]), label:has(> input[type="radio"]) { min-height: 48px; display: flex; align-items: center; gap: 8px; font-size: 1rem !important; cursor: pointer; }
summary { min-height: 48px; display: list-item; padding: 12px 0; cursor: pointer; font-size: 1rem; font-weight: 700; }
.sous-nav a, .nav-item, a.btn { min-height: 48px; display: inline-flex; align-items: center; }
.recherche-champ { height: 48px; min-width: 48px; }
.header-top { flex-wrap: wrap; row-gap: 6px; }
.brand-section { flex: 1 1 280px; }
@media (max-width: 760px) {
  .header-top { position: relative; }
  .recherche-globale { flex: 1 1 100%; max-width: none; }
}

/* v3.26 : fond de secours hors ligne (carte de synthèse fixe du PCS) */
.fond-secours { position: absolute; inset: 0; z-index: 900; background: #fff; display: flex; flex-direction: column; gap: 6px; padding: 8px; }
.fond-secours[hidden] { display: none; }
.fond-secours img { flex: 1 1 auto; min-height: 0; width: 100%; object-fit: contain; }
.fond-secours-titre { margin: 0; font-weight: 700; font-size: 1rem; color: #7A2E00; background: #FFF7D6; padding: 8px 12px; border-radius: 6px; }
.fond-secours .btn { align-self: flex-start; }

/* ==============================================================================
   v3.27.3 — Navigation mobile (barre du bas sur UNE ligne), dialogue intégré, toasts
   ============================================================================== */
.nav-mobile, .plus-drawer { display: none; }
.dlg-fond { position: fixed; inset: 0; z-index: 3000; background: rgba(6, 11, 20, 0.72); display: flex; align-items: flex-start; justify-content: center; padding: 12px; overflow-y: auto; }
.dlg-boite { background: var(--lusigny-surface); color: var(--lusigny-slate); border: 1.5px solid var(--lusigny-border-strong); border-radius: var(--radius-lg); width: 100%; max-width: 500px; max-height: calc(100dvh - 24px); overflow-y: auto; padding: 20px; margin-top: 8vh; }
.dlg-titre { margin: 0 0 8px; font-size: 1.25rem; font-weight: 800; }
.dlg-msg { margin: 0 0 12px; color: var(--lusigny-muted); white-space: pre-line; font-size: 1rem; }
.dlg-champ { display: block; margin-bottom: 12px; }
.dlg-lib { display: block; font-weight: 700; font-size: 1rem; margin-bottom: 4px; color: var(--lusigny-slate); }
.dlg-saisie { width: 100%; box-sizing: border-box; min-height: 48px; font-size: 1rem; padding: 8px 12px; border: 1.5px solid var(--lusigny-border-strong); border-radius: var(--radius-sm); background: var(--lusigny-surface-2); color: inherit; }
.dlg-erreur { color: var(--st-rouge); font-weight: 700; font-size: 1rem; margin: 0 0 8px; }
.dlg-erreur[hidden] { display: none; }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; }
.dlg-actions .btn { min-height: 48px; min-width: 48px; padding: 8px 16px; }
body.dlg-ouvert { overflow: hidden; }

@media (max-width: 1023px) {
  .bascule-affichage [data-view="split"] { display: none; }
}
@media (max-width: 768px) {
  .module-nav { display: none; }
  .nav-mobile { display: flex; flex-wrap: nowrap; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000; height: calc(var(--navm-h, 60px) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--lusigny-surface); border-top: 1.5px solid var(--lusigny-border); }
  .nm-item { flex: 1 1 0; min-width: 0; min-height: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 3px 2px; font: inherit; font-size: 0.8125rem; font-weight: 700; line-height: 1.1; text-align: center; color: var(--lusigny-muted); background: none; border: 0; border-top: 3px solid transparent; cursor: pointer; text-decoration: none; }
  .nm-item[data-route="mco"] { flex: 1.4 1 0; }
  .nm-item i { font-style: normal; font-size: 1.15rem; line-height: 1; }
  .nm-item span { display: block; max-width: 100%; overflow: hidden; white-space: normal; overflow-wrap: break-word; }
  .nm-item[aria-current="page"] { color: var(--lusigny-teal-dark); border-top-color: var(--lusigny-blue); background: var(--lusigny-mint); font-weight: 800; }
  .plus-drawer:not([hidden]) { display: flex; flex-direction: column; gap: 6px; position: fixed; left: 8px; right: 8px; bottom: calc(60px + env(safe-area-inset-bottom) + 8px); max-height: 64dvh; overflow-y: auto; z-index: 1001; padding: 12px; background: var(--lusigny-surface); border: 1.5px solid var(--lusigny-border-strong); border-radius: var(--radius-lg); }
  .pd-titre { margin: 0 0 6px; font-weight: 800; font-size: 1.05rem; }
  .pd-lien { display: flex; align-items: center; min-height: 48px; padding: 8px 12px; border-radius: var(--radius-sm); font-size: 1rem; font-weight: 700; color: inherit; text-decoration: none; border: 1px solid var(--lusigny-border); }
  .pd-fermer, .pd-deco { min-height: 48px; margin-top: 4px; font-size: 1rem; }
  #mainView { padding-bottom: calc(60px + env(safe-area-inset-bottom) + 90px); }
  #mapViewPane { height: calc(100dvh - var(--header-h) - 60px - env(safe-area-inset-bottom)); }
  body[data-layout="map"] #mapViewPane { margin-bottom: calc(60px + env(safe-area-inset-bottom)); }
  .toast { left: 12px; right: 12px; bottom: calc(60px + env(safe-area-inset-bottom) + 12px); text-align: center; z-index: 1002; }
  .remote-update-banner { bottom: calc(60px + env(safe-area-inset-bottom) + 4px); }
}
@media (max-width: 768px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  .header-top { padding: 6px 10px; gap: 10px; row-gap: 6px; border-bottom-width: 0; }
  .brand-section { flex: 1 1 100%; min-width: 0; gap: 10px; }
  .brand-titles { min-width: 0; flex: 1 1 0; line-height: 1.15; }
  .brand-sub, .header-top .brand-sub { font-size: 0.65rem; white-space: normal; letter-spacing: .04em; }
  .brand-main, .header-top .brand-main { font-size: 0.95rem; white-space: normal; overflow: visible; }
  .brand-blason { width: 64px; height: 33px; }
  .header-top .level-badge { font-size: 0.8rem; padding: 5px 12px; min-height: 48px; min-width: 48px; }
  .header-top .clock-chip { font-size: 0.78rem; padding: 3px 10px; min-height: 48px; min-width: 48px; }
  .header-top .sync-indicator { font-size: 0.75rem; padding: 4px 10px; }
  .header-top .chain-indicator { font-size: 0.78rem; padding: 4px 10px; min-height: 48px; min-width: 48px; }
  .header-top .role-pill { font-size: 0.75rem; padding: 4px 8px; }
  .header-top .bascule-affichage .btn, .header-top .btn-entete, .header-top button { min-height: 48px; min-width: 48px; padding: 6px 12px; font-size: 0.8rem; }
  .header-top .recherche-champ { height: 48px; min-height: 48px; padding: 4px 6px; font-size: 0.78rem; letter-spacing: -0.015em; }
  .header-top .recherche-champ::placeholder { font-size: 0.78rem; letter-spacing: -0.015em; }
}

/* v3.27.3 — C2 : stocks par quantité */
.stock-zero td { background: var(--st-rouge-fond); color: var(--st-rouge); font-weight: 700; }
.stock-zero .stock-dispo { color: var(--st-rouge); font-weight: 800; }
.stock-alerte { display: inline-block; padding: 2px 10px; border-radius: 6px; background: var(--st-plein-rouge, #991B1B); color: #FFFFFF; font-size: 1rem; font-weight: 800; }
[data-theme="dark"] .stock-zero td { background: #450A0A; color: #FECACA; }
.c2-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; align-items: end; margin-top: 12px; }
td.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); }

/* v3.27.3 — fiche de relève : impression propre */
@media print { .releve { box-shadow: none; border: none; } .releve .table-pilotage { font-size: 11px; } body > header, .module-nav, .nav-mobile, .plus-drawer { display: none !important; } }

/* v3.27.3 — CARE (personnes) et liste d'appel (vulnérables) */
.care-centre { border: 1.5px solid var(--lusigny-border); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; font-size: 1rem; }
.care-complet { border-color: var(--st-rouge-bord); background: var(--st-rouge-fond); color: var(--st-rouge); }
[data-theme="dark"] .care-complet { background: #450A0A; color: #FECACA; }
.care-tete { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 1.1rem; font-weight: 800; }
.care-etat { padding: 2px 10px; border-radius: 6px; font-size: 1rem; font-weight: 800; color: #FFFFFF; }
.care-etat.ouvert { background: #166534; }
.care-etat.ferme { background: #334155; }
.care-chiffres { display: flex; gap: 16px; flex-wrap: wrap; margin: 8px 0; font-size: 1rem; font-variant-numeric: tabular-nums; }
.care-jauge { height: 12px; border-radius: 999px; background: var(--lusigny-border); overflow: hidden; }
.care-jauge-barre { height: 100%; background: var(--lusigny-teal); }
.care-complet .care-jauge-barre { background: #991B1B; }
.care-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.care-actions .btn { min-height: 48px; }
.care-besoins { margin: 8px 0 0; padding-left: 18px; font-size: 1rem; }
.care-besoins li.ok { opacity: .65; text-decoration: line-through; }
.appel-prio { padding: 2px 10px; border-radius: 6px; font-size: 1rem; font-weight: 800; background: var(--st-gris-fond); color: var(--st-gris); border: 1px solid var(--st-gris-bord); }
.appel-prio.haute { background: var(--st-plein-rouge, #991B1B); color: #FFFFFF; border-color: var(--st-plein-rouge, #991B1B); }
.appel-clos td { opacity: .65; }

/* ==============================================================================
   v3.27.6 — CHARTE : page de connexion
   ============================================================================== */
.lock-card .groupe-case { display: flex; align-items: flex-start; gap: 12px; text-align: left; }
.lock-card .groupe-case input[type="checkbox"] { width: 24px; height: 24px; margin-top: 2px; flex: 0 0 auto; accent-color: var(--lusigny-blue); }
.lock-card .groupe-case label { text-transform: none; letter-spacing: 0; font-size: 1rem; font-weight: 500; color: var(--lusigny-slate); margin: 0; }
.lock-card .btn-primary { min-height: 52px; font-size: 1.05rem; background-color: var(--lusigny-blue); }
.lock-card .btn-primary:hover { background-color: var(--lusigny-teal-dark); }
:root[data-theme="dark"] .lock-screen { background: #0B1120; }
:root[data-theme="dark"] .lock-card { background: #111827; border-color: #475569; }
:root[data-theme="dark"] .lock-card .input-field, :root[data-theme="dark"] .lock-card select.input-field { background: #0B1120; border-color: #64748B; color: #F8FAFC; }
:root[data-theme="dark"] .lock-header p, :root[data-theme="dark"] .form-group label, :root[data-theme="dark"] .lock-card .groupe-case label { color: #CBD5E1; }
:root[data-theme="dark"] .lock-card .btn-primary { background-color: #075985; border-color: #7DD3FC; color: #FFFFFF; }
@media (max-width: 480px) {
  .lock-screen { padding: 16px 12px; align-items: start; }
  .lock-card { padding: 24px 18px 26px; }
  .lock-blason { width: 150px; }
}

/* ==============================================================================
   v3.27.7 — EN-TÊTE OPÉRATIONNEL COMMUN des documents imprimés (js/22-entete.js)
   ============================================================================== */
:root { --op-teal: #00677D; --op-sombre: #1B2A33; --op-orange: #C94905; --op-filet: #B8CCE0; }
.print-only-bloc { display: none; }
.entete-op { color: var(--op-sombre); margin: 0 0 12px; font-family: inherit; break-inside: avoid; }
.eo-ligne { display: grid; grid-template-columns: 120px 1fr 200px; gap: 12px; align-items: center; padding-bottom: 10px; border-bottom: 3px solid var(--op-teal); }
.eo-logo img { display: block; width: 100px; height: auto; }
.eo-centre { text-align: center; line-height: 1.3; }
.eo-mairie { font-weight: 700; font-size: .78rem; letter-spacing: .03em; color: var(--op-teal); }
.eo-cellule { font-weight: 800; font-size: 1.2rem; color: var(--op-sombre); margin: 4px 0; letter-spacing: .01em; }
.eo-poste-cmd { font-size: .78rem; color: var(--op-teal); }
.eo-droite { font-size: .78rem; text-align: right; line-height: 1.9; }
.eo-droite span { color: var(--op-teal); }
.eo-droite b { color: var(--op-sombre); }
.eo-bandeau { display: grid; grid-template-columns: 1.05fr 1fr 1fr; margin-top: 8px; border: 2px solid var(--op-sombre); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.eo-champ { padding: 6px 10px 8px; min-width: 0; color: #fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.eo-champ:nth-child(2) { background: var(--op-teal); }
.eo-champ:nth-child(3) { background: var(--op-sombre); }
.eo-champ span { display: block; font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; opacity: .9; }
.eo-champ b { display: block; font-size: .9rem; margin-top: 6px; overflow-wrap: anywhere; }
.eo-champ i { font-style: normal; letter-spacing: 1px; margin-left: 6px; }
.eo-niv-0 .eo-champ-niveau { background: #166534; color: #FFFFFF; }
.eo-niv-1 .eo-champ-niveau { background: #F59E0B; color: #0F172A; }
.eo-niv-2 .eo-champ-niveau { background: #FB923C; color: #0F172A; }
.eo-niv-3 .eo-champ-niveau { background: #991B1B; color: #FFFFFF; }
.eo-exercice { margin: 8px 0 0; color: var(--op-orange); font-weight: 700; font-size: .85rem; letter-spacing: .02em; }
.eo-titre { font-size: 1.5rem; margin: 14px 0 2px; color: var(--op-teal); font-weight: 800; text-transform: uppercase; }
.eo-sous { margin: 0 0 8px; color: #475569; font-size: .95rem; }
.entete-op ~ h2, .impression h2, .releve h2 { text-transform: uppercase; font-size: .9rem; letter-spacing: .04em; color: var(--op-teal); border-bottom: 1px solid var(--op-filet); padding-bottom: 3px; margin-top: 16px; font-weight: 700; }
.impr-table, .releve table { border-collapse: collapse; }
.impr-table th, .releve table th { background: var(--op-teal); color: #fff; font-weight: 700; border: 1px solid var(--op-sombre); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.impr-table td, .releve table td { border: 1px solid var(--op-sombre); }
.etat-fort { font-weight: 800; }
.pied-op { display: none; }
@media (max-width: 640px) { .eo-ligne { grid-template-columns: 70px 1fr; } .eo-droite { grid-column: 1 / -1; text-align: left; } .eo-bandeau { grid-template-columns: 1fr; } .eo-logo img { width: 64px; } }
@page { margin: 12mm 12mm 16mm; @bottom-right { content: "Page " counter(page) " / " counter(pages); font-family: Inter, Arial, Helvetica, sans-serif; font-size: 8pt; color: #00677D; } }
@media print {
  .print-only-bloc { display: block !important; }
  .entete-op { margin-bottom: 10px; }
  .eo-droite span { color: #00677D; }
  .pied-op { display: block !important; position: fixed; bottom: 0; left: 0; right: 0; text-align: center; padding-top: 3px; font-size: 8pt; color: #00677D; border-top: 1px solid #B8CCE0; }
  #piedImpressionAuto { display: block !important; }
  .nav-mobile, .plus-drawer, #saisieExpress, #toastNotification, #bandeauDroits, .bandeau-maj-app { display: none !important; }
}

/* ==============================================================================
   v3.27.10 — TABLEAU DE BORD « Pilotage de crise » (accueil) + barre latérale (bureau >= 1024 px)
   Regroupement visuel du menu en 3 pôles métier (Option N1/N2)
   ============================================================================== */
.nav-logo, .db-sr { display: none; }
.db-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.db-carte-tete { display: none; }

@media (min-width: 1024px) {
  :root { --nav-h: 0px; --nav-w: 228px; --header-real: 60px; }
  #crisisApp:not([hidden]) { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); grid-template-rows: auto auto 1fr; align-items: start; }
  #crisisApp > .header-top { grid-column: 1 / -1; grid-row: 1; }
  #crisisApp > .module-nav { grid-column: 1; grid-row: 2 / span 3; }
  #crisisApp > .saisie-express { grid-column: 2; grid-row: 2; }
  #crisisApp > .workspace-container { grid-column: 2; grid-row: 3; width: 100%; min-width: 0; }
  .module-nav {
    position: sticky; top: var(--header-real); align-self: start; height: calc(100dvh - var(--header-real));
    flex-direction: column; flex-wrap: nowrap; overflow-x: hidden; overflow-y: auto; gap: 2px; padding: 12px 10px 14px;
    border-bottom: 0; border-right: 1.5px solid var(--lusigny-border); background: var(--lusigny-surface);
  }
  .nav-logo { display: flex; align-items: center; gap: 10px; padding: 4px 6px 12px; margin-bottom: 6px; border-bottom: 1.5px solid var(--lusigny-border); color: var(--lusigny-slate); text-decoration: none; }
  .nav-logo img { width: 56px; height: auto; flex: none; }
  .nav-logo b { display: block; font-size: 1rem; line-height: 1.15; color: var(--lusigny-slate); }
  .nav-logo small { display: block; font-size: 1rem; color: var(--lusigny-muted); }
  .module-nav .nav-item {
    border-bottom: 0; border-left: 4px solid transparent; border-radius: var(--radius); padding: 8px 12px; font-size: 1rem; font-weight: 650;
    color: var(--lusigny-slate); min-height: 44px; flex: none;
  }
  /* Séparateurs visuels des 3 pôles métier (Pilotage / Terrain & Population / Cadre & Système) */
  .module-nav .nav-item[data-route="secteurs"],
  .module-nav .nav-item[data-route="fiche"] {
    border-top: 1px solid var(--lusigny-border);
    margin-top: 4px;
  }
  .module-nav .nav-item i { width: 22px; text-align: center; font-style: normal; color: var(--lusigny-muted); }
  .module-nav .nav-item:hover { background: var(--lusigny-surface-2); color: var(--lusigny-slate); }
  .module-nav .nav-item[aria-current="page"] { background: var(--lusigny-mint); border-left-color: var(--lusigny-blue); color: var(--lusigny-teal-dark); font-weight: 800; }
  .module-nav .nav-item[aria-current="page"] i { color: var(--lusigny-teal-dark); }
  .module-nav .nav-item[data-route="reglages"] { margin-top: auto; border-top: 1px solid var(--lusigny-border); }
  .module-nav .nav-badge { margin-left: auto; }
  .header-top .brand-blason { display: none; }
  .remote-update-banner { top: calc(var(--header-real) + 8px); }
}

/* --- tableau de bord : structure (toutes tailles) --- */
body.dash .workspace-container { display: block; position: relative; height: auto; min-height: 0; overflow: visible; }
body.dash #mainView { max-width: none; width: 100%; margin: 0; padding: 20px 24px 40px; overflow: visible; border-right: 0; }
body.dash #mapViewPane {
  position: absolute; display: flex; flex-direction: column; overflow: hidden; z-index: 1;
  background: var(--lusigny-surface); border: 1.5px solid var(--lusigny-border); border-radius: var(--radius-lg);
}
body.dash #mapViewPane .db-carte-tete { display: flex; }
body.dash #crisisMap { flex: 1 1 auto; min-height: 0; height: auto; }

.db { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.db > * { min-width: 0; }
.db .card { margin-bottom: 0; border-radius: var(--radius-lg); box-shadow: none; }
.db-niveau { display: none; grid-column: 1 / -1; align-items: center; gap: 10px; padding: 14px 16px; border-radius: 10px; font-size: 1.05rem; font-weight: 800; color: #FFFFFF; background: #166534; }
.db-niveau.lvl-0 { background: #166534; color: #FFFFFF; }
.db-niveau.lvl-1 { background: #F59E0B; color: #0F172A; }
.db-niveau.lvl-2 { background: #FB923C; color: #0F172A; }
.db-niveau.lvl-3 { background: #991B1B; color: #FFFFFF; }
[data-theme="dark"] .db-niveau.lvl-0 { background: #4ADE80; color: #052E16; }
[data-theme="dark"] .db-niveau.lvl-1 { background: #FBBF24; color: #0F172A; }
[data-theme="dark"] .db-niveau.lvl-2 { background: #FB923C; color: #0F172A; }
[data-theme="dark"] .db-niveau.lvl-3 { background: #991B1B; color: #FFFFFF; }
.db-tete { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.db-tete-titre { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.db-h1 { margin: 0; font-size: 1.7rem; color: var(--lusigny-slate); }
.db-maj { font-size: 1rem; color: var(--st-gris); }
.db-tete-actions { display: flex; align-items: center; gap: 10px; }
.db-tete-actions .btn { width: auto; }
.db-nouvelle { padding: 0 20px; font-weight: 700; }
.db-pastille { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 6px; font-size: 1rem; font-weight: 800; border: 1.5px solid transparent; }
.db-pastille::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.db-pastille-veille { color: var(--st-vert); background: var(--st-vert-fond); border-color: var(--st-vert-bord); }
.db-pastille-actif { color: var(--st-rouge); background: var(--st-rouge-fond); border-color: var(--st-rouge-bord); }
.db-pastille-clos { color: var(--st-gris); background: var(--st-gris-fond); border-color: var(--st-gris-bord); }

.db-alerte { grid-column: 1 / -1; }
.db-alerte .card { margin-bottom: 0; padding: 12px 16px; }
.db-alerte .card-header { margin-bottom: 6px; padding-bottom: 4px; }
.db-cartes { display: contents; }
.db-k { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; grid-column: span 1; }
.db-k-titre { margin: 0; font-size: 1rem; font-weight: 750; letter-spacing: .02em; text-transform: uppercase; color: var(--st-gris); }
.db-k-val { margin: 2px 0 0; font-size: 2.3rem; font-weight: 850; line-height: 1.05; color: var(--cmd-chiffre); }
.db-k-txt { font-size: 1.15rem; line-height: 1.3; color: var(--lusigny-slate); font-weight: 750; }
.db-k-sur { font-size: 1.15rem; font-weight: 650; color: var(--st-gris); }
.db-k-sous { margin: 0; font-size: 1rem; color: var(--st-gris); }
.db-k-liste { margin: 4px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 1rem; }
.db-k-liste li { display: flex; gap: 8px; align-items: baseline; }
.db-k-liste a { color: var(--lusigny-slate); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-prio { flex: none; font-size: 1rem; font-weight: 750; padding: 2px 8px; border-radius: 6px; background: var(--st-gris-fond); color: var(--st-gris); border: 1.5px solid var(--st-gris-bord); }
.db-prio-vitale { background: var(--st-rouge-fond); color: var(--st-rouge); border-color: var(--st-rouge-bord); }
.db-prio-urgente { background: var(--st-orange-fond); color: var(--st-orange); border-color: var(--st-orange-bord); }
.db-lien { color: var(--cmd-actif-fond); font-weight: 700; font-size: 1rem; text-decoration: none; }
.db-lien:hover { text-decoration: underline; }
.db-k-lien { margin-top: auto; padding-top: 8px; display: inline-flex; align-items: center; min-height: 48px; }
.db-attention { color: var(--st-orange); font-weight: 700; }

/* fil d'activité */
.db-fil { grid-column: 1 / span 2; padding: 16px 18px; min-height: 420px; }
.db-carte-tete { align-items: center; justify-content: space-between; gap: 10px; }
.db-fil .db-carte-tete { display: flex; margin-bottom: 8px; }
.db-h2 { margin: 0; font-size: 1.15rem; color: var(--lusigny-slate); }
.db-fil-liste { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.db-evt { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--lusigny-border); }
.db-evt:first-child { border-top: 0; }
.db-evt-ico { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--st-gris-fond); color: var(--st-gris); font-weight: 800; }
.db-evt-alerte .db-evt-ico { background: var(--st-orange-fond); color: var(--st-orange); }
.db-evt-corps { min-width: 0; flex: 1; }
.db-evt-ligne { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.db-evt-h { font-size: 1rem; color: var(--st-gris); font-variant-numeric: tabular-nums; font-family: var(--font-mono); }
.db-evt-titre { font-size: 1rem; color: var(--lusigny-slate); }
.db-evt-txt { margin: 2px 0 0; font-size: 1rem; color: var(--lusigny-slate); overflow-wrap: anywhere; }
.db-evt-de { color: var(--st-gris); font-size: 1rem; }
.db-badge { font-size: 1rem; font-weight: 750; padding: 2px 10px; border-radius: 6px; border: 1.5px solid transparent; }
.db-badge-fait { background: var(--st-vert-fond); color: var(--st-vert); border-color: var(--st-vert-bord); }
.db-badge-suivre { background: var(--st-orange-fond); color: var(--st-orange); border-color: var(--st-orange-bord); }
.db-acquitter { width: auto; margin-top: 6px; }
.db-vide { margin: 8px 0; color: var(--st-gris); font-size: 1rem; }

/* carte de la commune */
.db-place { grid-column: 3 / span 2; min-height: 420px; }
#mapViewPane .db-carte-tete { padding: 10px 14px; border-bottom: 1.5px solid var(--lusigny-border); background: var(--lusigny-surface); }
.db-secteur { margin-left: auto; margin-right: 8px; }
.db-secteur select { min-height: 48px; padding: 6px 10px; width: auto; max-width: 220px; font-size: 1rem; }
#dbPleinEcran { width: auto; }
.db-outils { grid-column: 1 / -1; order: 9; }
.db-outils > .card:first-child { margin-top: 4px; }

/* tablette et téléphone : une seule colonne, la carte en dernier */
@media (max-width: 1023px) {
  body.dash #mainView { padding: 12px 12px 130px; }
  .db { grid-template-columns: 1fr; gap: 12px; }
  .db-niveau { order: 0; display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: 10px; font-size: 1.05rem; font-weight: 800; color: #fff; background: #166534; }
  .db-niveau.lvl-1 { background: #F59E0B; color: #0F172A; }
  .db-niveau.lvl-2 { background: #FB923C; color: #0F172A; }
  .db-niveau.lvl-3 { background: #991B1B; color: #FFFFFF; }
  [data-theme="dark"] .db-niveau.lvl-1 { background: #FBBF24; color: #0F172A; }
  [data-theme="dark"] .db-niveau.lvl-2 { background: #FB923C; color: #0F172A; }
  [data-theme="dark"] .db-niveau.lvl-3 { background: #991B1B; color: #FFFFFF; }
  .db-tete { order: 1; } .db-alerte { order: 2; }
  .db-cartes { order: 3; display: flex; flex-direction: column; gap: 8px; }
  .db-fil { order: 4; grid-column: 1; min-height: 0; }
  .db-outils { order: 5; }
  .db-place { order: 6; grid-column: 1; min-height: 360px; height: 360px; }
  .db-h1 { font-size: 1.35rem; }
  .db-tete-actions { width: 100%; } .db-tete-actions .btn { flex: 1; }
  .db-k { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 14px; row-gap: 2px; padding: 10px 14px; min-height: 64px; }
  .db-k-titre { grid-column: 1 / -1; }
  .db-k-val { font-size: 1.7rem; grid-row: 2; min-width: 2.2ch; }
  .db-k-txt { font-size: 1rem; grid-column: 1 / -1; }
  .db-k-sous, .db-k-liste { grid-column: 2; grid-row: 2; }
  .db-k-txt + .db-k-sous { grid-column: 1 / -1; grid-row: auto; }
  .db-k-lien { grid-column: 1 / -1; margin-top: 0; padding-top: 0; min-height: 48px; }
  .db-secteur select { max-width: 150px; min-height: 48px; }
  .db-lien { display: inline-flex; align-items: center; min-height: 48px; }
  .db-fil .db-carte-tete .db-lien { min-width: 48px; }
  .db-outils #quickMcoForm { flex-wrap: wrap; }
  .db-outils #quickMcoTxt { min-width: 60%; }
}
@media (min-width: 1024px) and (max-width: 1279px) { .db-k-val { font-size: 1.9rem; } .db-h1 { font-size: 1.45rem; } }
@media print { .db-tete-actions, .db-acquitter, .db-carte-tete a { display: none !important; } body.dash #mapViewPane { display: none !important; } .db-place { display: none; } }

/* En-tête sur une seule ligne dès 1024 px : zéro défilement horizontal à 1100–1366 px, titre entier à 1366x768, recherche >= 160 px à 1366 px */
@media (min-width: 1024px) and (max-width: 1365px) {
  .header-top { flex-wrap: nowrap; gap: 4px; padding: 6px 8px; }
  .header-top .brand-section { flex: 1 1 135px; min-width: 115px; gap: 6px; }
  .header-top .brand-titles { min-width: 0; line-height: 1.12; }
  .header-top .brand-sub { font-size: 0.64rem; letter-spacing: 0.008em; white-space: normal; overflow: visible; text-overflow: clip; }
  .header-top .brand-main { font-size: 0.78rem; letter-spacing: -0.01em; white-space: normal; overflow: visible; text-overflow: clip; }
  .header-top .recherche-globale { flex: 0 1 160px; min-width: 135px; }
  .header-top .recherche-champ { padding: 4px 7px; font-size: 0.80rem; height: 42px; min-height: 42px; }
  .header-top .level-badge, .header-top .clock-chip, .header-top .sync-indicator, .header-top .chain-indicator, .header-top .role-pill { flex: 0 1 auto; padding: 3px 6px; font-size: 0.74rem; min-height: 42px; min-width: 40px; gap: 4px; white-space: nowrap; }
  .header-top .bascule-affichage, .header-top .outils-entete { flex: none; gap: 3px; }
  .header-top .bascule-affichage .btn, .header-top .btn-entete, .header-top button { padding: 0 6px; font-size: 0.75rem; min-height: 42px; min-width: 38px; }
}
@media (min-width: 1024px) and (max-width: 1220px) {
  .header-top #headerSyncLabel { display: none; }
  .header-top .sync-indicator { padding: 4px 8px; min-width: 36px; justify-content: center; }
}
@media (min-width: 1280px) and (max-width: 1365px) {
  .header-top .recherche-globale { flex: 0 0 165px; min-width: 160px; }
}
@media (min-width: 1366px) {
  .header-top { flex-wrap: nowrap; gap: 5px; padding: 6px 10px; }
  .header-top .brand-section { flex: 1 0 324px; min-width: 324px; gap: 8px; }
  .header-top .brand-titles { min-width: 0; line-height: 1.18; }
  .header-top .brand-sub { font-size: 0.67rem; letter-spacing: 0.008em; white-space: nowrap; overflow: visible; text-overflow: clip; }
  .header-top .brand-main { font-size: 0.82rem; letter-spacing: -0.01em; white-space: nowrap; overflow: visible; text-overflow: clip; }
  .header-top .recherche-globale { flex: 0 0 172px; min-width: 165px; }
  .header-top .recherche-champ { padding: 4px 8px; font-size: 0.82rem; height: 42px; min-height: 42px; }
  .header-top .level-badge, .header-top .clock-chip, .header-top .sync-indicator, .header-top .chain-indicator, .header-top .role-pill { flex: none; padding: 4px 6px; font-size: 0.76rem; min-height: 42px; min-width: 40px; gap: 4px; }
  .header-top .bascule-affichage, .header-top .outils-entete { flex: none; gap: 4px; }
  .header-top .bascule-affichage .btn, .header-top .btn-entete { padding: 0 6px; font-size: 0.76rem; min-height: 42px; min-width: 40px; }
}
@media (min-width: 1600px) {
  .header-top { gap: 10px; padding: 6px 16px; }
  .header-top .brand-section { flex: 1 0 430px; min-width: 430px; }
  .header-top .brand-sub { font-size: 0.875rem; letter-spacing: 0.03em; }
  .header-top .brand-main { font-size: 1rem; letter-spacing: 0; }
  .header-top .recherche-globale { flex: 0 1 240px; min-width: 180px; }
  .header-top .recherche-champ { padding: 6px 12px; font-size: 1rem; height: 48px; min-height: 48px; }
  .header-top .level-badge, .header-top .clock-chip, .header-top .sync-indicator, .header-top .chain-indicator, .header-top .role-pill { padding: 6px 12px; font-size: 1rem; min-height: 48px; min-width: 48px; gap: 6px; }
  .header-top .bascule-affichage .btn, .header-top .btn-entete { padding: 0 12px; font-size: 1rem; min-height: 48px; min-width: 48px; }
}
.db-sous-titre { margin: 8px 0 10px; font-size: 1.15rem; }

/* ==============================================================================
   v3.27.11 — PAYSAGE TÉLÉPHONE (hauteur ≤ 520 px)
   En-tête sur UNE ligne de 48 px, rail d'icônes à gauche (48 px), carte à toute la hauteur.
   ============================================================================== */
.land-only { display: none; }
#landMenu { display: contents; }
@media (orientation: landscape) and (max-height: 520px) {
  :root { --header-h: 48px; --nav-h: 0px; --rail-w: calc(48px + env(safe-area-inset-left, 0px)); }
  html, body { max-width: 100%; overflow-x: hidden; }
  .land-only { display: inline-flex; align-items: center; justify-content: center; }

  /* 1. En-tête : UNE ligne, 48 px (sélecteurs préfixés .header-top pour l'emporter sur @media (max-width: 768px)) */
  .header-top { position: fixed; top: 0; left: 0; right: 0; height: 48px; min-height: 48px; padding: 0 max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left)); gap: 6px; row-gap: 0; flex-wrap: nowrap; justify-content: flex-start; overflow: visible; }
  .header-top button, .header-top .btn, .header-top .btn-entete, .header-top .bascule-affichage .btn { min-height: 40px; min-width: 40px; padding: 0 8px; font-size: 0.75rem; }
  .header-top .brand-section, .brand-section { flex: 0 0 auto; gap: 6px; min-width: 0; }
  .header-top .brand-blason, .brand-blason { width: 40px; height: 20px; display: block; }
  .header-top .brand-sub, .brand-sub { display: none; }
  .header-top .brand-titles, .brand-titles { flex: 0 0 auto; min-width: 0; }
  .header-top .brand-main, .brand-main { font-size: 0; line-height: 0; white-space: nowrap; }
  .header-top .brand-main::before, .brand-main::before { content: 'PCC'; font-size: .95rem; line-height: 1.1; font-weight: 800; letter-spacing: .05em; }
  .header-top .level-badge, .header-top .clock-chip, .header-top .sync-indicator, .header-top .chain-indicator, .header-top .role-pill { min-height: 40px; min-width: 0; padding: 0 8px; font-size: .75rem; line-height: 1.1; flex: 0 1 auto; max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-flex; align-items: center; gap: 4px; }
  .header-top .level-badge { max-width: 160px; }
  .header-top > .land-only:first-of-type { margin-left: auto; }
  #landSearchBtn { margin-left: auto; }
  .header-top .land-only { flex: 0 0 auto; font-size: 1.1rem; padding: 0; min-width: 40px; min-height: 40px; }
  .header-top .recherche-globale, .recherche-globale { display: none; }
  body.land-search-open .header-top .recherche-globale, body.land-search-open .recherche-globale { display: flex; position: fixed; top: 0; left: 0; right: 0; height: 48px; padding: 4px max(8px, env(safe-area-inset-right)) 4px max(8px, env(safe-area-inset-left)); z-index: 1101; max-width: none; background: #0F172A; }
  body.land-search-open .header-top .recherche-champ, body.land-search-open .recherche-champ { flex: 1 1 auto; height: 40px; min-height: 40px; }
  #landMenu { display: none; }
  body.land-menu-open #landMenu { display: flex; flex-direction: column; gap: 8px; position: fixed; top: 50px; right: max(8px, env(safe-area-inset-right)); z-index: 1101; padding: 8px; background: #0F172A; border: 1.5px solid rgba(255,255,255,.5); border-radius: 10px; max-height: calc(100dvh - 56px); overflow-y: auto; }
  body.land-menu-open #landMenu .bascule-affichage { display: flex; }
  body.land-menu-open #landMenu .bascule-affichage [data-view="split"] { display: none; }
  body.land-menu-open #landMenu .outils-entete { display: flex; justify-content: flex-start; }

  /* 2. Menu : rail d'icônes à gauche (48 px) */
  .nav-mobile, .plus-drawer, .plus-drawer:not([hidden]) { display: none !important; }
  .module-nav { display: flex !important; flex-direction: column; flex-wrap: nowrap; grid-template-columns: none; position: fixed; top: 48px; bottom: 0; left: 0; right: auto; width: var(--rail-w); padding: 0 0 0 env(safe-area-inset-left, 0px); overflow-x: hidden; overflow-y: auto; border-top: 0; border-bottom: 0; border-right: 1px solid var(--lusigny-border); z-index: 999; scrollbar-width: none; }
  .module-nav::-webkit-scrollbar { display: none; }
  .nav-logo { display: none; }
  .nav-item, .rail-carte { flex: 0 0 auto; position: relative; display: flex; align-items: center; justify-content: center; width: 48px; min-height: 44px; padding: 0; font-size: 0; gap: 0; border: 0; border-left: 3px solid transparent; background: transparent; color: var(--lusigny-muted); cursor: pointer; font-family: inherit; }
  .nav-item i, .rail-carte i { font-style: normal; font-size: 1.25rem; line-height: 1; }
  .nav-item[aria-current="page"], .rail-carte[aria-current="page"] { border-left-color: var(--lusigny-blue); border-top-color: transparent; background: var(--lusigny-mint); color: var(--lusigny-teal-dark); }
  .nav-badge { position: absolute; top: 3px; right: 3px; min-width: 16px; height: 16px; padding: 0 3px; font-size: 10px; line-height: 16px; }

  /* 3. Contenu : pleine largeur à droite du rail */
  #crisisApp { padding-top: 48px; padding-left: var(--rail-w); }
  .workspace-container { min-height: calc(100dvh - 48px); }
  #mainView { max-width: none; padding: 8px max(10px, env(safe-area-inset-right)) 16px 10px; }
  #mapViewPane { height: calc(100dvh - 48px); margin-bottom: 0; }
  body[data-layout="map"] #mapViewPane { margin-bottom: 0; }
  .db-carte-tete { display: none !important; }
  .toast { left: 12px; right: 12px; bottom: 12px; }
  .remote-update-banner { bottom: 4px; }
  .saisie-express { padding: 4px 10px; }
  .saisie-express input { height: 40px; min-height: 40px; }
  .bandeau-exercice { top: 48px; }
  .bandeau-droits { top: 48px; padding: 2px 10px; font-size: .78rem; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dlg-boite { margin-top: 2vh; max-height: calc(100dvh - 12px); }

  /* 4. Autres onglets en paysage */
  body.dash #mainView { padding: 8px max(10px, env(safe-area-inset-right)) 16px 10px; }
  .db { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; }
  .db-niveau, .db-tete, .db-alerte, .db-outils { grid-column: 1 / -1; }
  .db-niveau { padding: 8px 12px; font-size: 1rem; }
  .db-cartes { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .db-fil { grid-column: 1; }
  .db-place { grid-column: 2; min-height: 240px; height: 240px; }
  .db-tete-actions { width: auto; }
  .card { padding: 12px; }
  #mainView img, #mainView table { max-width: 100%; }
  #mainView .table-wrap, #mainView .table-pilotage { overflow-x: auto; }
}
@media (orientation: landscape) and (max-height: 520px) and (max-width: 700px) {
  .header-top { gap: 4px; padding: 0 max(6px, env(safe-area-inset-right)) 0 max(6px, env(safe-area-inset-left)); }
  .header-top .brand-blason { width: 32px; height: 16px; }
  .header-top .brand-main::before { font-size: 0.85rem; }
  .header-top .level-badge, .header-top .clock-chip, .header-top .sync-indicator, .header-top .chain-indicator, .header-top .role-pill { padding: 0 5px; font-size: 0.68rem; gap: 3px; max-width: 115px; }
  .header-top .land-only { min-width: 40px; min-height: 40px; width: 40px; height: 40px; font-size: 1.1rem; }
}
@media (orientation: landscape) and (max-height: 520px) and (max-width: 600px) {
  .header-top { gap: 3px; padding: 0 4px; }
  .header-top .brand-blason { display: none; }
  .header-top #headerSyncLabel { display: none; }
  .header-top .level-badge, .header-top .clock-chip, .header-top .sync-indicator, .header-top .chain-indicator, .header-top .role-pill { padding: 0 4px; font-size: 0.65rem; max-width: 98px; }
  .header-top .land-only { min-width: 40px; min-height: 40px; width: 40px; height: 40px; font-size: 1.1rem; }
}

/* ==============================================================================
   v3.28.2 — CARTE EN PLEIN ÉCRAN dans la coquille (body.carte-pe)
   ============================================================================== */
.pe-quitter, .pe-menu-bascule { display: none; }
body.carte-pe { overflow: hidden; }
body.carte-pe .pe-quitter:not([hidden]) {
  display: inline-flex; align-items: center; gap: 8px; position: fixed; z-index: 3000; min-height: 48px; min-width: 48px; padding: 0 16px;
  top: calc(8px + env(safe-area-inset-top, 0px)); left: calc(8px + env(safe-area-inset-left, 0px));
  font: 700 1rem/1 inherit; color: #fff; background: #0F172A; border: 1.5px solid rgba(255, 255, 255, .5); border-radius: 10px; cursor: pointer;
}
body.carte-pe .pe-quitter:focus-visible, body.carte-pe .pe-menu-bascule:focus-visible { outline: 3px solid #fde047; outline-offset: 2px; }
body.carte-pe .header-top, body.carte-pe #navMobile, body.carte-pe #plusDrawer, body.carte-pe .saisie-express, body.carte-pe #bandeauExercice,
body.carte-pe #bandeauDroits, body.carte-pe .remote-update-banner, body.carte-pe .db-carte-tete, body.carte-pe #mainView { display: none !important; }
body.carte-pe #crisisApp:not([hidden]) { display: block; padding: 0 !important; }
body.carte-pe .workspace-container { display: block; height: auto; min-height: 0; overflow: visible; }
body.carte-pe #mapViewPane {
  display: block !important; position: fixed !important; z-index: 2000; top: 0 !important; right: 0 !important; bottom: auto !important; left: 0 !important;
  width: 100vw !important; height: 100vh !important; height: 100dvh !important; margin: 0 !important; padding: 0; border: 0 !important; border-radius: 0 !important; box-shadow: none !important; overflow: hidden; background: var(--lusigny-surface-2);
}
body.carte-pe #crisisMap { display: block; width: 100%; height: 100% !important; flex: none; }
@media (max-width: 899px) {
  body.carte-pe .module-nav { display: none !important; }
  body.carte-pe .pe-menu-bascule { display: none !important; }
}
@media (min-width: 900px) {
  body.carte-pe .module-nav {
    display: flex !important; flex-direction: column; flex-wrap: nowrap; position: fixed !important; z-index: 2600; top: 0; bottom: 0; left: 0; width: 56px; height: 100dvh !important;
    padding: 56px 4px 8px; gap: 2px; overflow: hidden auto; border: 0; border-right: 1.5px solid var(--lusigny-border); background: var(--lusigny-surface);
    transition: width .12s ease;
  }
  body.carte-pe .module-nav .nav-logo { display: none; }
  body.carte-pe .module-nav .nav-item, body.carte-pe .module-nav .nav-deco { font-size: 0; width: 100%; min-width: 48px; min-height: 48px; padding: 0; justify-content: center; border-left: 0; border-radius: 8px; overflow: hidden; position: relative; }
  body.carte-pe .module-nav .nav-item i, body.carte-pe .module-nav .nav-deco i { font-size: 1.25rem; width: auto; margin: 0; }
  body.carte-pe .module-nav .nav-item .nav-badge { position: absolute; top: 4px; right: 4px; margin: 0; font-size: .7rem; }
  body.carte-pe .module-nav:hover, body.carte-pe .module-nav:focus-within, body.carte-pe.pe-menu-ouvert .module-nav { width: 228px; }
  body.carte-pe .module-nav:hover .nav-item, body.carte-pe .module-nav:focus-within .nav-item, body.carte-pe.pe-menu-ouvert .module-nav .nav-item, body.carte-pe .module-nav:hover .nav-deco, body.carte-pe .module-nav:focus-within .nav-deco, body.carte-pe.pe-menu-ouvert .module-nav .nav-deco { font-size: 1rem; justify-content: flex-start; padding: 0 12px; gap: 10px; }
  body.carte-pe .module-nav:hover .nav-item .nav-badge, body.carte-pe .module-nav:focus-within .nav-item .nav-badge, body.carte-pe.pe-menu-ouvert .module-nav .nav-item .nav-badge { position: static; margin-left: auto; }
  body.carte-pe #mapViewPane { left: 56px !important; width: calc(100vw - 56px) !important; }
  body.carte-pe .pe-menu-bascule { display: inline-flex; align-items: center; justify-content: center; position: fixed; z-index: 2700; top: 4px; left: 4px; width: 48px; height: 48px; font-size: 1.3rem; color: var(--lusigny-slate); background: transparent; border: 0; border-radius: 8px; cursor: pointer; }
  body.carte-pe .pe-quitter:not([hidden]) { left: 68px; }
}

/* v3.28.2 : bouton « Se déconnecter » du menu */
.module-nav .nav-deco { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 12px; border: 0; background: transparent; color: var(--lusigny-slate); font: inherit; font-size: 1rem; font-weight: 700; cursor: pointer; border-radius: 8px; text-align: left; }
.module-nav .nav-deco:hover { background: var(--lusigny-surface-2); }
.module-nav .nav-deco i { width: 22px; text-align: center; font-style: normal; color: inherit; }
@media (min-width: 1024px) { .module-nav .nav-deco { margin-top: 4px; } }
