/**
 * CHARTE GRAPHIQUE OFFICIELLE — MAIRIE DE LUSIGNY-SUR-BARSE
 * Application Opérationnelle du Poste de Commandement Communal (PCC)
 * Standard UI/UX Résistant Anti-IA & Accessibilité Vercel Web Guidelines
 */

:root {
  /* Couleurs institutionnelles www.lusigny-sur-barse.fr */
  --lusigny-blue: #1F4E79;
  --lusigny-teal: #00677D;
  --lusigny-teal-dark: #064C58;
  --lusigny-gold: #D99A00;
  --lusigny-gold-light: #FFF8E7;
  --lusigny-mint: #E8F3F1;
  --lusigny-slate: #1C2B2A;
  --lusigny-bg: #F8FAFC;
  --lusigny-surface: #FFFFFF;
  --lusigny-surface-2: #F1F5F9;
  --lusigny-border: #CBD5E1;
  --lusigny-muted: #64748B;
  
  /* Niveaux opérationnels normalisés de Sécurité Civile */
  --lvl-0: #2E7D32; /* Normal / Veille */
  --lvl-1: #D99A00; /* Vigilance */
  --lvl-2: #EA580C; /* Alerte renforcée / Crise */
  --lvl-3: #DC2626; /* Urgence absolue / PPI Rupture */

  /* Badges Opérateurs */
  --op-dos: #6D28D9;
  --op-secu: #00677D;
  --op-mco: #0284C7;
  --op-log: #D97706;
  --op-terrain: #16A34A;

  /* Dimensions & Ergonomie */
  --header-h: 60px;
  --nav-h: 48px;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --focus-ring: 0 0 0 3px rgba(0, 103, 125, 0.35);

  color-scheme: light;
}

:root[data-theme="dark"] {
  --lusigny-bg: #0F172A;
  --lusigny-surface: #1E293B;
  --lusigny-surface-2: #334155;
  --lusigny-border: #475569;
  --lusigny-slate: #F8FAFC;
  --lusigny-muted: #94A3B8;
  --lusigny-teal: #38BDF8;
  --lusigny-teal-dark: #0284C7;
  --lusigny-gold: #FBBF24;
  --lusigny-mint: #1E3A40;

  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: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  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: 700;
  letter-spacing: -0.015em;
}

a { color: var(--lusigny-teal); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--lusigny-gold); 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: #F8FAFC;                                  /* charte v3.27.6 : fond clair uni, aucun panneau latéral */
}

.lock-card {
  width: 100%;
  max-width: 480px;
  background: #EDF5FA;                                  /* charte : carte bleu très clair */
  border: 1px solid #B8CCE0;
  border-radius: var(--radius-lg);
  padding: 32px 30px 34px;
  box-shadow: 0 8px 22px -8px rgba(31, 78, 121, 0.18);
  text-align: center;
}

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

.lock-header h1 {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 4px;
  color: var(--lusigny-teal);
}

.lock-header p {
  font-size: 0.92rem;
  color: #475569;
  margin-bottom: 24px;
}

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

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475569;
  margin-bottom: 6px;
}

.input-field, select.input-field {
  width: 100%;
  padding: 12px 14px;
  min-height: 48px;
  font-size: 1rem;
  border: 1px solid #B8CCE0;
  border-radius: var(--radius);
  background: #FFFFFF;
  color: var(--lusigny-slate);
  transition: border-color 0.15s ease;
}

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

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

.btn-primary:hover { background-color: var(--lusigny-teal-dark); }
.error-banner {
  color: var(--lvl-3);
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 12px;
  min-height: 1.2em;
}

/* ==============================================================================
   2. BANDEAU DE COMMANDEMENT SUPÉRIEUR (HEADER)
   ============================================================================== */
.header-top {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: linear-gradient(90deg, var(--lusigny-blue) 0%, var(--lusigny-teal-dark) 46%, var(--lusigny-teal) 100%);
  color: #fff;
  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: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.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.15;
}

.brand-sub {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--lusigny-gold);
}

.brand-main {
  font-size: 0.95rem;
  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: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  background: rgba(0, 0, 0, 0.2);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}

.level-badge.lvl-0 { background-color: var(--lvl-0); border-color: rgba(255, 255, 255, 0.6); }
.level-badge.lvl-1 { background-color: var(--lvl-1); color: #000; }
.level-badge.lvl-2 { background-color: var(--lvl-2); }
.level-badge.lvl-3 { background-color: var(--lvl-3); animation: pulseAlert 2s infinite; }

@keyframes pulseAlert {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.75; transform: scale(1.02); }
}

/* Statut de Synchronisation Multi-Postes */
.sync-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  font-weight: 600;
  cursor: pointer;
}

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

.sync-indicator.connected .sync-dot { background-color: #4ADE80; box-shadow: 0 0 6px #4ADE80; }
.sync-indicator.offline .sync-dot { background-color: #FBBF24; }

/* Sélecteur de Poste Opérateur */
.role-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  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: 1px 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: 6px;
  padding: 10px 14px;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--lusigny-muted);
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  transition: all 0.15s ease;
  min-height: var(--nav-h);
}

.nav-item:hover { color: var(--lusigny-teal); }
.nav-item[aria-current="page"] {
  color: var(--lusigny-teal-dark);
  border-bottom-color: var(--lusigny-gold);
  background-color: var(--lusigny-mint);
}

.nav-badge {
  background-color: var(--lvl-3);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  margin-left: 2px;
}

@media (max-width: 768px) {
  .module-nav {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    border-top: 1px solid var(--lusigny-border);
    border-bottom: none;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--lusigny-surface);
  }
  .nav-item {
    flex-direction: column;
    justify-content: center;
    padding: 6px 2px;
    font-size: 0.7rem;
    min-height: 56px;
    gap: 2px;
    border-bottom: none;
    border-top: 3px solid transparent;
  }
  .nav-item[aria-current="page"] {
    border-top-color: var(--lusigny-gold);
    border-bottom-color: transparent;
  }
}

/* ==============================================================================
   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(480px, 560px) 1fr;
    height: calc(100dvh - var(--header-h) - var(--nav-h));
    overflow: hidden;
  }
  body[data-layout="split"] #mainView {
    overflow-y: auto;
    border-right: 1px solid var(--lusigny-border);
  }
  body[data-layout="split"] #mapViewPane {
    display: block;
    height: 100%;
  }
}

#mainView {
  padding: 20px 16px 80px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

#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 {
  width: 100%;
  height: 100%;
  background: var(--lusigny-surface-2);
}

#crisisMap { display:block; width:100%; height:100%; border:0; background:var(--lusigny-surface-2); }
.help-text { margin:2px 0 0; font-size:.84rem; color:var(--lusigny-muted); }
.form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.needs-fieldset { border:1px solid var(--lusigny-border); border-radius:var(--radius-sm); display:flex; flex-wrap:wrap; gap:8px 14px; font-size:.84rem; }
.needs-fieldset legend { color:var(--lusigny-teal-dark); font-weight:700; padding:0 5px; }
.person-list { display:grid; gap:8px; }
.person-card { display:flex; justify-content:space-between; gap:12px; align-items:flex-start; padding:12px; border:1px solid var(--lusigny-border); border-left:4px solid var(--lusigny-teal); border-radius:var(--radius-sm); }
.person-card select { min-width:170px; padding:6px 8px; font-size:.82rem; }
.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:1rem; color:var(--lusigny-teal-dark); }
.contact-grid, .team-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(230px,1fr)); gap:10px; }
.contact-card, .team-card { display:grid; gap:7px; padding:12px; border:1px solid var(--lusigny-border); border-radius:var(--radius-sm); background:var(--lusigny-surface); }
.contact-card { border-top:3px solid var(--lusigny-blue); }
.team-card { border-left:4px solid var(--lusigny-teal); }
.contact-card small, .team-card small { color:var(--lusigny-muted); }
.contact-tag { width:max-content; padding:2px 7px; border-radius:999px; background:var(--lusigny-mint); color:var(--lusigny-teal-dark); font-size:.72rem; font-weight:700; }

@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)
   ============================================================================== */
.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: 1px solid var(--lusigny-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
}

.kpi-card .kpi-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--lusigny-muted);
  letter-spacing: 0.03em;
}

.kpi-card .kpi-val {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--lusigny-teal-dark);
  line-height: 1.1;
  margin: 4px 0 2px;
}

.kpi-card .kpi-sub {
  font-size: 0.75rem;
  color: var(--lusigny-muted);
}

.card {
  background: var(--lusigny-surface);
  border: 1px solid var(--lusigny-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

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

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--lusigny-teal-dark);
  margin: 0;
}

/* Main Courante Opérationnelle (MCO) */
.mco-entry {
  display: grid;
  grid-template-columns: 80px 100px 1fr;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--lusigny-border);
  font-size: 0.88rem;
  align-items: start;
}

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

.mco-time {
  font-weight: 700;
  color: var(--lusigny-muted);
  font-size: 0.82rem;
}

.mco-badge {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  text-align: center;
  text-transform: uppercase;
  color: #fff;
}

.badge-dos { background-color: var(--op-dos); }
.badge-secu { background-color: var(--op-secu); }
.badge-mco { background-color: var(--op-mco); }
.badge-log { background-color: var(--op-log); }
.badge-terrain { background-color: var(--op-terrain); }

/* Porte-à-Porte (D3) Progress */
.sector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.sector-card {
  border: 1px solid var(--lusigny-border);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--lusigny-surface);
}

.sector-card.completed {
  border-color: var(--lvl-0);
  background-color: rgba(46, 125, 50, 0.05);
}

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

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

/* Boutons & Contrôles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 650;
  border: 1.5px solid var(--lusigny-border);
  background: var(--lusigny-surface);
  color: var(--lusigny-slate);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn:hover { border-color: var(--lusigny-teal); color: var(--lusigny-teal); }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: 0.78rem; }
.btn-danger { background-color: var(--lvl-3); color: #fff; border-color: var(--lvl-3); }
.btn-danger:hover { background-color: #B91C1C; }

/* 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 »
   (affiché quand une mise à jour distante arrive pendant une saisie)
   ============================================================================== */
.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-teal);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}
.remote-update-banner button:hover { filter: brightness(1.1); }
@media (min-width: 1024px) {
  /* Vue scindée : bandeau centré au-dessus du volet de gauche (ne masque pas la carte) */
  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: repeating-linear-gradient(135deg, #B45309 0 18px, #92400E 18px 36px);
  color: #fff; font-weight: 800; letter-spacing: 0.04em; text-align: center;
  padding: 6px 12px; font-size: 0.9rem; text-transform: uppercase;
}
.bandeau-exercice[hidden] { display: none; }
body.mode-exercice .header-top { box-shadow: inset 0 -4px 0 #B45309; }

.chain-indicator {
  border: 1px solid rgba(255,255,255,0.45); border-radius: 999px; padding: 4px 10px;
  font-size: 0.78rem; font-weight: 700; cursor: pointer; color: #fff; background: rgba(21,128,61,0.85);
}
.chain-indicator.ko { background: #B91C1C; animation: pcc-clignote 1.4s ease-in-out infinite; }
@keyframes pcc-clignote { 50% { opacity: 0.6; } }

.chain-banner { padding: 8px 12px; border-radius: var(--radius-sm); margin-bottom: 12px; font-size: 0.85rem; border: 1px solid var(--lusigny-border); background: var(--lusigny-surface); }
.chain-banner.ok { border-color: #86EFAC; background: #F0FDF4; color: #14532D; }
.chain-banner.ko { border-color: #FCA5A5; background: #FEF2F2; color: #7F1D1D; }
.chain-banner ul { margin: 6px 0 4px 18px; padding: 0; }

.mco-filtres { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 0 0 12px; align-items: center; }
.mco-filtres .input-field { padding: 6px 10px; font-size: 0.85rem; }
.mco-entry.marquant { border-left: 4px solid #F59E0B; }
.mco-entry.altered { background: #FEF2F2; border-left: 4px solid #B91C1C; }
.mco-entry .mco-actions { display: flex; gap: 4px; align-items: flex-start; }
.mco-entry .mco-actions .btn { width: auto; padding: 2px 8px; }
.mco-lien { display: block; color: var(--lusigny-muted); font-style: italic; }
.mco-lien.ko { color: #B91C1C; font-style: normal; font-weight: 700; }
.mco-seal { font-size: 0.72rem; color: #166534; }
.mco-seal.legacy { color: var(--lusigny-muted); }
.mco-correction-banner { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: #FFF7ED; border: 1px solid #FDBA74; border-radius: var(--radius-sm); padding: 6px 10px; margin-bottom: 10px; font-size: 0.85rem; }

.fiche-sous-titre { margin: 2px 0 6px; color: var(--lusigny-slate); font-weight: 600; }
.fiche-h { color: var(--lusigny-teal); margin-top: 16px; }
.fiche-h4 { font-size: 0.95rem; }
.check-list { display: grid; gap: 2px; margin: 6px 0; }
.encart { border-left: 4px solid var(--lusigny-teal); background: var(--lusigny-mint); border-radius: var(--radius-sm); padding: 8px 12px; margin: 10px 0; }
.encart-titre { font-weight: 800; font-size: 0.82rem; 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; }
@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 ================= */
.sous-nav { display:flex; flex-wrap:wrap; gap:6px; margin:0 0 12px; }
.sous-nav a { padding:6px 12px; border:1px solid var(--lusigny-border); border-radius:999px; font-size:0.85rem; font-weight:600; color:var(--lusigny-text, inherit); text-decoration:none; background:var(--lusigny-card, transparent); }
.sous-nav a.actif { background:var(--lusigny-teal); border-color:var(--lusigny-teal); color:#fff; }
.a-traiter { border-left:6px solid #C62828; }
.a-traiter.calme { border-left-color:#2E7D32; }
.a-traiter-liste { list-style:none; margin:0; padding:0; display:grid; gap:6px; }
.a-traiter-liste li { padding:8px 10px; border-radius:var(--radius-sm, 6px); font-weight:600; }
.a-traiter-liste li a { color:inherit; text-decoration:none; display:block; }
.a-traiter-liste li.rouge { background:#FDECEA; color:#8E1B1B; }
.a-traiter-liste li.orange { background:#FFF4E5; color:#7A4200; }
.a-traiter-liste li.info { background:var(--lusigny-mint); }
.table-pilotage td, .table-pilotage th { padding:6px 8px; border:1px solid var(--lusigny-border); vertical-align:top; font-size:0.86rem; }
.table-pilotage select.input-field { padding:4px 6px; font-size:0.82rem; min-width:120px; }
.table-pilotage tr.retard td, tr.non-recu td, p.non-recu { background:#FDECEA; color:#8E1B1B; }
.actions-cell { display:flex; gap:4px; 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:0.9rem; }
.txt-rouge { color:#C62828; }
.rappel-radio { margin:4px 0 0; font-weight:800; letter-spacing:0.04em; color:var(--lusigny-teal); font-size:0.85rem; }
.lien-module { margin-left:8px; font-size:0.78rem; font-weight:700; color:var(--lusigny-teal); white-space:nowrap; }
.cl-champs label { display:grid; gap:4px; font-size:0.82rem; font-weight:700; color:var(--lusigny-muted); }
.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:5px 8px; font-size:0.84rem; text-align:left; }
/* v3.26 : couleurs sombres seulement si le thème sombre est CHOISI (le thème clair reste celui par défaut) */
[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:#4A1A1A; color:#FFD6D6; }
[data-theme="dark"] .a-traiter-liste li.orange { background:#4A3310; color:#FFE2B8; }
@media print { .sous-nav, .lien-module { display:none !important; } .bilan { box-shadow:none; border:none; } }

/* ================= v3.23 Accès ================= */
[hidden] { display: none !important; }
.kpi-mob { display:flex; flex-wrap:wrap; gap:8px 16px; margin:4px 0 12px; font-weight:700; font-size:0.9rem; }
.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.8rem; color:#333; }
.impr-meta { font-size:0.75rem; width:190px; color:#333; }
.impr-table { width:100%; border-collapse:collapse; font-size:0.8rem; }
.impr-table th { background:#00677D; color:#fff; text-align:left; padding:5px 6px; border:1px solid #00677D; }
.impr-table td { border:1px solid #999; padding:5px 6px; vertical-align:top; }
.impr-table tr.vide td { height:24px; }
.impr-pied { font-size:0.72rem; color:#444; 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:#00677D; color:#fff; padding:10px 14px; border-radius:10px; box-shadow:0 6px 18px rgba(0,0,0,.25); display:flex; gap:10px; align-items:center; flex-wrap:wrap; max-width:calc(100% - 32px); font-weight:600; }
.bandeau-pcs-maj .btn { background:#fff; color:#00677D; }

/* ================= v3.25 : styles sortis d'index.html (CSP sans style en ligne) ================= */
.recherche-globale { flex: 1 1 180px; max-width: 320px; }
.recherche-champ { padding: 6px 12px; font-size: 0.85rem; height: 36px; border-radius: 999px; }
.groupe-case { display: flex; align-items: center; gap: 8px; }
.groupe-case input[type="checkbox"] { width: 18px; height: 18px; }
.groupe-case label { margin: 0; text-transform: none; font-size: 0.85rem; font-weight: normal; cursor: pointer; }
.bascule-affichage { display: flex; border: 1px solid rgba(255,255,255,0.4); border-radius: var(--radius-sm); overflow: hidden; }
.bascule-affichage .btn { border: none; border-radius: 0; color: #fff; background: transparent; }
body[data-layout="split"] .bascule-affichage [data-view="split"]:not(.actif):only-of-type { background: rgba(0,0,0,0.3); }
.outils-entete { display: flex; gap: 6px; }
.btn-entete { color: #fff; background: transparent; border-color: rgba(255,255,255,0.4); }
.toast { position: fixed; bottom: 20px; right: 20px; z-index: 2000; background: var(--lusigny-teal-dark); color: #fff; padding: 10px 18px; border-radius: var(--radius); box-shadow: 0 4px 14px rgba(0,0,0,0.25); display: none; font-size: 0.9rem; font-weight: 600; }

/* ================= 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: 0.9rem; }
.bandeau-droits.absents { background: #7f1d1d; color: #fff; }
.bandeau-droits.degrade { background: repeating-linear-gradient(45deg, #b45309, #b45309 14px, #92400e 14px, #92400e 28px); color: #fff; letter-spacing: 0.03em; }
.saisie-express[hidden] { display: none; }
.saisie-express { display: flex; gap: 8px; align-items: center; padding: 6px 12px; background: var(--lusigny-mint, #e8f3f1); border-bottom: 1px solid rgba(0,0,0,0.08); }
.saisie-express label { font-weight: 700; font-size: 0.8rem; white-space: nowrap; color: var(--lusigny-teal-dark, #004f60); }
.saisie-express input { flex: 1 1 auto; height: 34px; padding: 4px 10px; font-size: 0.9rem; }
.saisie-express .se-msg { font-size: 0.8rem; min-width: 0; }
.saisie-express .se-msg.ok { color: #166534; }
.saisie-express .se-msg.ko { color: #991b1b; font-weight: 700; }
.arrete-champ { background: #fff3c4; border-bottom: 2px dashed #b45309; padding: 0 3px; font-weight: 700; }
.arrete-texte { white-space: pre-wrap; font-family: Georgia, 'Times New Roman', serif; line-height: 1.55; font-size: 1rem; }
.arrete-editeur { width: 100%; min-height: 420px; font-family: Georgia, 'Times New Roman', serif; font-size: 0.95rem; line-height: 1.5; }
.arrete-statut { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 800; }
.arrete-statut.brouillon { background: #fef3c7; color: #92400e; }
.arrete-statut.valide { background: #dcfce7; color: #166534; }
.arrete-page { position: relative; background: #fff; color: #111; padding: 18mm 18mm 22mm; max-width: 210mm; margin: 0 auto; box-shadow: 0 2px 12px rgba(0,0,0,0.12); }
.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.85rem; }
.arrete-page .signature { margin-top: 14mm; text-align: right; }
.arrete-page .empreinte { margin-top: 10mm; font-size: 0.7rem; color: #555; word-break: break-all; }
.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; 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, texte ≥ 4,5:1), thème sombre fort contraste, zones tactiles 48 × 48
   ===================================================================================================== */
/* --- Thème clair : corrections de contraste (mesurées par _test/e2e26.py) --- */
:root { --lusigny-muted: #475569; }
.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: #fff; background-color: var(--lusigny-teal); border-color: var(--lusigny-teal); }
.btn.btn-primary:hover { color: #fff; background-color: var(--lusigny-teal-dark); }
.sync-indicator, .role-pill, .chain-indicator, .header-top .btn, .header-top button, .btn-entete { color: #fff; }
.header-top .btn:hover, .header-top button:hover, .btn-entete:hover { color: #fff; border-color: #fff; }
[data-theme="dark"] .header-top .btn, [data-theme="dark"] .header-top button, [data-theme="dark"] .header-top .btn:hover, [data-theme="dark"] .header-top button: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(0, 0, 0, 0.3); border: 1px solid rgba(255, 255, 255, 0.45); }
.chain-indicator { background: #15803D; }
.bascule-affichage .btn.actif, body[data-layout="split"] .bascule-affichage [data-view="split"]:not(.actif) { background: transparent; }
.bascule-affichage .btn.actif { background: rgba(0, 0, 0, 0.35); box-shadow: inset 0 -3px 0 #FDE68A; }
body[data-layout="split"] .bascule-affichage:not(:has(.actif)) [data-view="split"] { background: rgba(0, 0, 0, 0.35); box-shadow: inset 0 -3px 0 #FDE68A; }
.card .role-pill, .card-header .role-pill { background: var(--lusigny-teal-dark); color: #fff; border-color: transparent; }

/* --- Bandeau « Mise à jour disponible » (B20) --- */
.bandeau-maj-app { position: fixed; left: 50%; transform: translateX(-50%); bottom: 72px; z-index: 2150; background: #0070BA; color: #fff;
  padding: 10px 14px; border-radius: 10px; box-shadow: 0 6px 18px rgba(0,0,0,.3); display: flex; gap: 10px; align-items: center;
  flex-wrap: wrap; max-width: calc(100% - 32px); font-weight: 600; }
.bandeau-maj-app .btn { background: #fff; color: #00507F; border-color: #fff; }
.bandeau-maj-app[hidden] { display: none; }

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

/* --- Thème sombre fort contraste (fond #0F172A, accent #0070BA) --- */
:root[data-theme="dark"] {
  --lusigny-bg: #0F172A;
  --lusigny-surface: #1E293B;
  --lusigny-surface-2: #334155;
  --lusigny-border: #64748B;
  --lusigny-slate: #F1F5F9;
  --lusigny-muted: #CBD5E1;
  --lusigny-blue: #93C5FD;
  --lusigny-teal: #7DD3FC;          /* texte d'accent sur fond sombre (les FONDS d'accent passent à #0070BA, ci-dessous) */
  --lusigny-teal-dark: #7DD3FC;     /* titres et textes d'accent sur fond sombre (≥ 9:1) */
  --lusigny-gold: #FBBF24;
  --lusigny-gold-light: #3B2F12;
  --lusigny-mint: #16303A;
  --lvl-0: #4ADE80;
  --lvl-1: #FBBF24;
  --lvl-2: #FB923C;
  --lvl-3: #F87171;
  --focus-ring: 0 0 0 3px rgba(125, 211, 252, 0.6);
  color-scheme: dark;
}
[data-theme="dark"] .header-top { background: linear-gradient(90deg, #0B1D33 0%, #0A3358 50%, #0070BA 100%); }
/* accent de la charte #0070BA pour les FONDS (texte blanc 5,4:1) */
[data-theme="dark"] .btn-primary, [data-theme="dark"] .sous-nav a.actif { background-color: #0070BA; border-color: #0070BA; color: #fff; }
[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: #0070BA !important; color: #fff; }
[data-theme="dark"] [style*="background-color:var(--lvl-0)"], [data-theme="dark"] [style*="background:var(--lvl-0)"] { background-color: #15803D !important; color: #fff; }
[data-theme="dark"] [style*="background:var(--lvl-3)"], [data-theme="dark"] [style*="background-color:var(--lvl-3)"] { background-color: #B91C1C !important; color: #fff; }
[data-theme="dark"] .btn-primary:hover, [data-theme="dark"] .btn.btn-primary:hover { background-color: #005A96; color: #fff; }
[data-theme="dark"] .toast { background: #0070BA; }
[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: #15803D; }
[data-theme="dark"] .level-badge.lvl-1 { background-color: #FBBF24; color: #111827; }
[data-theme="dark"] .level-badge.lvl-2 { background-color: #C2410C; }
[data-theme="dark"] .level-badge.lvl-3, [data-theme="dark"] .btn-danger, [data-theme="dark"] .nav-badge { background-color: #B91C1C; border-color: #B91C1C; color: #fff; }
[data-theme="dark"] .mco-seal { color: #4ADE80; }
[data-theme="dark"] .card .role-pill, [data-theme="dark"] .card-header .role-pill { background: #0070BA; }
[data-theme="dark"] .bandeau-pcs-maj { background: #0070BA; }
[data-theme="dark"] .bandeau-pcs-maj .btn { color: #00507F; }

/* --- 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: #1C2B2A; --lusigny-muted: #475569; --lusigny-blue: #1F4E79; --lusigny-teal: #00677D;
    --lusigny-teal-dark: #064C58; --lusigny-gold: #D99A00; --lusigny-gold-light: #FFF8E7; --lusigny-mint: #E8F3F1;
    --lvl-0: #2E7D32; --lvl-1: #D99A00; --lvl-2: #EA580C; --lvl-3: #DC2626;
    color-scheme: light;
  }
  [data-theme="dark"] body { background: #fff; color: #1C2B2A; }
}

/* --- 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; }
input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; }
.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; }
summary { min-height: 48px; display: list-item; padding: 12px 0; cursor: pointer; }
.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; }          /* sur téléphone, l'en-tête défile (la navigation reste en bas) */
  .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: .85rem; color: #7A2E00; background: #FFF7D6; padding: 6px 10px; 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(0,0,0,.55); display: flex; align-items: flex-start; justify-content: center; padding: 12px; overflow-y: auto; }
.dlg-boite { background: var(--lusigny-surface); color: var(--lusigny-text, inherit); border-radius: var(--radius); box-shadow: 0 8px 30px rgba(0,0,0,.35); width: 100%; max-width: 480px; max-height: calc(100dvh - 24px); overflow-y: auto; padding: 16px; margin-top: 8vh; }
.dlg-titre { margin: 0 0 8px; font-size: 1.1rem; }
.dlg-msg { margin: 0 0 10px; color: var(--lusigny-muted); white-space: pre-line; }
.dlg-champ { display: block; margin-bottom: 10px; }
.dlg-lib { display: block; font-weight: 650; font-size: .85rem; margin-bottom: 4px; }
.dlg-saisie { width: 100%; box-sizing: border-box; min-height: 48px; font-size: 16px; padding: 8px 10px; border: 1px solid var(--lusigny-border); border-radius: var(--radius-sm); background: var(--lusigny-surface-2, #fff); color: inherit; }
.dlg-erreur { color: var(--lvl-3); font-weight: 650; 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; }      /* sous 1024 px : pas de « Split », choix Liste / Carte */
}
@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: 1px solid var(--lusigny-border); box-shadow: 0 -2px 8px rgba(0,0,0,.12); }
  .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: 4px 2px; font: inherit; font-size: .75rem; font-weight: 650; 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 i { font-style: normal; font-size: 1.25rem; line-height: 1; }
  .nm-item span { display: block; max-width: 100%; overflow: hidden; white-space: normal; overflow-wrap: anywhere; }   /* « Main courante » passe sur 2 lignes plutôt que d'être coupé */
  .nm-item[aria-current="page"] { color: var(--lusigny-teal-dark); border-top-color: var(--lusigny-gold); background: var(--lusigny-mint); }
  .plus-drawer:not([hidden]) { display: flex; flex-direction: column; gap: 4px; position: fixed; left: 8px; right: 8px; bottom: calc(60px + env(safe-area-inset-bottom) + 8px); max-height: 60dvh; overflow-y: auto; z-index: 1001; padding: 10px; background: var(--lusigny-surface); border: 1px solid var(--lusigny-border); border-radius: var(--radius); box-shadow: 0 -4px 18px rgba(0,0,0,.25); }
  .pd-titre { margin: 0 0 4px; font-weight: 700; }
  .pd-lien { display: flex; align-items: center; min-height: 48px; padding: 8px 12px; border-radius: var(--radius-sm); font-weight: 650; color: inherit; text-decoration: none; border: 1px solid var(--lusigny-border); }
  .pd-fermer { min-height: 48px; margin-top: 4px; }
  #mainView { padding-bottom: calc(60px + env(safe-area-inset-bottom) + 90px); }          /* rien ne passe sous la barre */
  #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; }   /* au-dessus de la barre, jamais dessus */
  .remote-update-banner { bottom: calc(60px + env(safe-area-inset-bottom) + 4px); }
}
@media (max-width: 768px) {
  /* v3.27.3 : l'en-tête ne doit jamais élargir la page (sinon le navigateur dézoome et la barre du bas se décale) */
  html, body { max-width: 100%; overflow-x: hidden; }
  .brand-section { flex: 1 1 100%; min-width: 0; }
  .brand-titles { min-width: 0; flex: 1 1 0; }
  .brand-sub { white-space: normal; letter-spacing: .04em; }
  .brand-main { white-space: normal; overflow: visible; }
  .brand-blason { width: 64px; height: 33px; }
}

/* v3.27.3 — C2 : stocks par quantité */
.stock-zero td { background: #FDE2E2; color: #7F1D1D; font-weight: 700; }
.stock-zero .stock-dispo { color: #B91C1C; }
.stock-alerte { display: inline-block; padding: 1px 8px; border-radius: 999px; background: #B91C1C; color: #fff; font-size: .72rem; letter-spacing: .04em; }
[data-theme="dark"] .stock-zero td { background: #5B1414; color: #FEE2E2; }
.c2-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; align-items: end; margin-top: 10px; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* 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: 1px solid var(--lusigny-border); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.care-complet { border-color: #B91C1C; background: #FDE2E2; color: #7F1D1D; }
[data-theme="dark"] .care-complet { background: #5B1414; color: #FEE2E2; }
.care-tete { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 1.05rem; }
.care-etat { padding: 1px 8px; border-radius: 999px; font-size: .72rem; font-weight: 800; color: #fff; } .care-etat.ouvert { background: #047857; } .care-etat.ferme { background: #64748B; }
.care-chiffres { display: flex; gap: 14px; flex-wrap: wrap; margin: 6px 0; }
.care-jauge { height: 10px; border-radius: 999px; background: var(--lusigny-border); overflow: hidden; } .care-jauge-barre { height: 100%; background: var(--lusigny-teal); } .care-complet .care-jauge-barre { background: #B91C1C; }
.care-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; } .care-actions .btn { min-height: 48px; }
.care-besoins { margin: 8px 0 0; padding-left: 18px; } .care-besoins li.ok { opacity: .65; text-decoration: line-through; }
.appel-prio { padding: 1px 8px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--lusigny-border); } .appel-prio.haute { background: #B91C1C; color: #fff; }
.appel-clos td { opacity: .6; }


/* ==============================================================================
   v3.27.6 — CHARTE : page de connexion (ancien flux conservé, seulement la forme change)
   ============================================================================== */
.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-teal); }
.lock-card .groupe-case label { text-transform: none; letter-spacing: 0; font-size: 0.92rem; font-weight: 500; color: #334155; margin: 0; }
.lock-card .btn-primary { min-height: 52px; font-size: 1.05rem; background-color: var(--lusigny-teal); }
.lock-card .btn-primary:hover { background-color: var(--lusigny-teal-dark); }
:root[data-theme="dark"] .lock-screen { background: #0F172A; }
:root[data-theme="dark"] .lock-card { background: #1E293B; border-color: #475569; }
:root[data-theme="dark"] .lock-card .input-field, :root[data-theme="dark"] .lock-card select.input-field { background: #0F172A; border-color: #475569; 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; }
@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), aligné sur le modèle « EXEMPLE_entete-operationnel »
   Logo à gauche · bloc central (mairie / CELLULE DE CRISE COMMUNALE / poste de commandement) · n° d'ordre, date / heure, poste à droite
   · filet teal épais · bandeau de 3 cases (niveau d'alerte coloré, événement teal, diffusion sombre) · titre teal en capitales.
   Teal #00677D · sombre #1B2A33 · orange réservé à « exemple / à suivre » · sobre, lisible en noir et blanc (le niveau est ÉCRIT, avec jauge)
   ============================================================================== */
: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: .72rem; 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: .72rem; color: var(--op-teal); }
.eo-droite { font-size: .72rem; 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: .58rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; opacity: .9; }
.eo-champ b { display: block; font-size: .85rem; 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: #2E7D32; }
.eo-niv-1 .eo-champ-niveau { background: #7A6200; }
.eo-niv-2 .eo-champ-niveau { background: #B45309; }
.eo-niv-3 .eo-champ-niveau { background: #B91C1C; }
.eo-exercice { margin: 8px 0 0; color: var(--op-orange); font-weight: 700; font-size: .78rem; 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: .85rem; }
.entete-op ~ h2, .impression h2, .releve h2 { text-transform: uppercase; font-size: .75rem; 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.6 : bouton de connexion lisible en thème sombre (texte blanc sur fond bleu foncé, contraste ≥ 4,5:1) */
:root[data-theme="dark"] .lock-card .btn-primary { background-color: #075985; border-color: #7DD3FC; color: #fff; }

/* ==============================================================================
   v3.27.10 — TABLEAU DE BORD « Pilotage de crise » (accueil) + barre latérale (bureau >= 1024 px)
   Mêmes jetons que la charte v3.27.6 ; cartes blanches, ombre douce, rayon 12 px ; l'orange n'est utilisé que pour « à suivre / attention ».
   ============================================================================== */
.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; }

/* --- barre latérale : seulement sur grand écran --- */
@media (min-width: 1024px) {
  :root { --nav-h: 0px; --nav-w: 224px; --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: 1px solid var(--lusigny-border); box-shadow: 1px 0 6px rgba(15, 23, 42, .04);
  }
  .nav-logo { display: flex; align-items: center; gap: 10px; padding: 4px 6px 14px; margin-bottom: 8px; border-bottom: 1px 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: .95rem; line-height: 1.15; color: var(--lusigny-slate); }
  .nav-logo small { display: block; font-size: .78rem; color: var(--lusigny-muted); }
  .module-nav .nav-item {
    border-bottom: 0; border-left: 4px solid transparent; border-radius: 8px; padding: 10px 12px; font-size: .92rem; font-weight: 600;
    color: var(--lusigny-slate); min-height: 44px; flex: none;
  }
  .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-teal); color: var(--lusigny-teal-dark); font-weight: 750; }
  .module-nav .nav-item[aria-current="page"] i { color: var(--lusigny-teal-dark); }
  .module-nav .nav-item[data-route="reglages"] { margin-top: auto; }
  .module-nav .nav-badge { margin-left: auto; }
  .header-top .brand-blason { display: none; }
  .remote-update-banner { top: calc(var(--header-real) + 8px); }
}
/* le split classique (liste + carte) n'a plus de sens sur l'accueil : le tableau de bord contient déjà la carte */

/* --- 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: 1px solid var(--lusigny-border); border-radius: 12px; box-shadow: 0 2px 10px rgba(15, 23, 42, .07);
}
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: 12px; box-shadow: 0 2px 10px rgba(15, 23, 42, .07); }
.db-niveau { display: none; }
.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: .86rem; color: var(--lusigny-muted); }
.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: 999px; font-size: .84rem; font-weight: 700; border: 1px solid transparent; }
.db-pastille::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.db-pastille-veille { color: #166534; background: #DCFCE7; border-color: #86EFAC; }
.db-pastille-actif { color: #991B1B; background: #FEE2E2; border-color: #FCA5A5; }
.db-pastille-clos { color: #334155; background: #E2E8F0; border-color: #CBD5E1; }
[data-theme="dark"] .db-pastille-veille { color: #BBF7D0; background: #14532D; border-color: #166534; }
[data-theme="dark"] .db-pastille-actif { color: #FECACA; background: #7F1D1D; border-color: #991B1B; }
[data-theme="dark"] .db-pastille-clos { color: #E2E8F0; background: #334155; border-color: #475569; }
.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: .86rem; font-weight: 750; letter-spacing: .02em; text-transform: uppercase; color: var(--lusigny-muted); }
.db-k-val { margin: 2px 0 0; font-size: 2.3rem; font-weight: 800; line-height: 1.05; color: var(--lusigny-teal-dark); }
.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(--lusigny-muted); }
.db-k-sous { margin: 0; font-size: .86rem; color: var(--lusigny-muted); }
.db-k-liste { margin: 4px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: .88rem; }
.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: .7rem; font-weight: 750; padding: 1px 7px; border-radius: 999px; background: var(--lusigny-surface-2); color: var(--lusigny-slate); border: 1px solid var(--lusigny-border); }
.db-prio-vitale { background: #FEE2E2; color: #991B1B; border-color: #FCA5A5; }
.db-prio-urgente { background: #FFF3E0; color: #9A3412; border-color: #FDBA74; }
[data-theme="dark"] .db-prio-vitale { background: #7F1D1D; color: #FECACA; border-color: #991B1B; }
[data-theme="dark"] .db-prio-urgente { background: #7C2D12; color: #FFEDD5; border-color: #C2410C; }
.db-lien { color: var(--lusigny-teal-dark); font-weight: 700; font-size: .88rem; text-decoration: none; }
[data-theme="dark"] .db-lien { color: #7DD3FC; }
.db-lien:hover { text-decoration: underline; }
.db-k-lien { margin-top: auto; padding-top: 8px; display: inline-flex; align-items: center; min-height: 40px; }
.db-attention { color: #9A3412; font-weight: 700; }
[data-theme="dark"] .db-attention { color: #FDBA74; }

/* 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.05rem; 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: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--lusigny-mint); color: var(--lusigny-teal-dark); font-weight: 800; }
.db-evt-alerte .db-evt-ico { background: #FFF3E0; color: #9A3412; }
[data-theme="dark"] .db-evt-alerte .db-evt-ico { background: #7C2D12; color: #FFEDD5; }
.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: .84rem; color: var(--lusigny-muted); font-variant-numeric: tabular-nums; }
.db-evt-titre { font-size: .95rem; color: var(--lusigny-slate); }
.db-evt-txt { margin: 2px 0 0; font-size: .88rem; color: var(--lusigny-slate); overflow-wrap: anywhere; }
.db-evt-de { color: var(--lusigny-muted); font-size: .78rem; }
.db-badge { font-size: .74rem; font-weight: 750; padding: 2px 9px; border-radius: 999px; border: 1px solid transparent; }
.db-badge-fait { background: #E8F3F1; color: #064C58; border-color: #A7D3CC; }
.db-badge-suivre { background: #FFF3E0; color: #9A3412; border-color: #FDBA74; }
[data-theme="dark"] .db-badge-fait { background: #1E3A40; color: #BAE6FD; border-color: #0E7490; }
[data-theme="dark"] .db-badge-suivre { background: #7C2D12; color: #FFEDD5; border-color: #C2410C; }
.db-acquitter { width: auto; margin-top: 6px; }
.db-vide { margin: 8px 0; color: var(--lusigny-muted); }

/* carte de la commune (l'iframe v3.27.9 est cadrée ici, son contenu ne change pas) */
.db-place { grid-column: 3 / span 2; min-height: 420px; }
#mapViewPane .db-carte-tete { padding: 10px 14px; border-bottom: 1px solid var(--lusigny-border); background: var(--lusigny-surface); }
.db-secteur { margin-left: auto; margin-right: 8px; }
.db-secteur select { min-height: 40px; padding: 4px 10px; width: auto; max-width: 220px; }
#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: 12px; font-size: 1.05rem; font-weight: 800; color: #fff; background: var(--lvl-0); }
  .db-niveau.lvl-1 { background: #92400E; }
  .db-niveau.lvl-2 { background: #C2410C; }
  .db-niveau.lvl-3 { background: #B91C1C; }
  .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; }
}
@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 1180 px (le bandeau d'état reste toujours visible) */
@media (min-width: 1180px) {
  .header-top { flex-wrap: nowrap; gap: 10px; padding-top: 6px; }
  .header-top .brand-section { flex: 1 1 180px; min-width: 0; }
  .header-top .brand-titles { min-width: 0; }
  .header-top .brand-sub { font-size: .66rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .header-top .brand-main { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .header-top .recherche-globale { flex: 0 1 190px; min-width: 120px; }
  .header-top .level-badge, .header-top .sync-indicator, .header-top .chain-indicator, .header-top .role-pill { flex: none; }
  .header-top .bascule-affichage, .header-top .outils-entete { flex: none; }
}
.db-sous-titre{margin:8px 0 10px}
@media (max-width: 1023px) {
  .db-lien { display: inline-flex; align-items: center; min-height: 48px; }
  .db-fil .db-carte-tete .db-lien { min-width: 48px; }
  .db-secteur select { min-height: 48px; }
  .db-outils #quickMcoForm { flex-wrap: wrap; }
  .db-outils #quickMcoTxt { min-width: 60%; }
}

/* ==============================================================================
   v3.27.11 — PAYSAGE TÉLÉPHONE (hauteur ≤ 520 px). Bureau et portrait : inchangés.
   En-tête sur UNE ligne de 48 px, rail d'icônes à gauche (48 px) à la place du menu horizontal et de la barre du bas, 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 */
  .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, .btn-entete { min-height: 40px; min-width: 40px; }
  .brand-section { flex: 0 0 auto; gap: 6px; min-width: 0; }
  .brand-blason { width: 40px; height: 20px; }
  .brand-sub { display: none; }
  .brand-titles { flex: 0 0 auto; min-width: 0; }
  .brand-main { font-size: 0; }
  .brand-main::before { content: 'PCC'; font-size: .95rem; font-weight: 800; letter-spacing: .05em; }
  .level-badge, .sync-indicator, .chain-indicator, .role-pill { min-height: 40px; padding: 0 8px; font-size: .72rem; line-height: 1.1; flex: 0 1 auto; min-width: 0; max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-flex; align-items: center; gap: 4px; }
  .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; }
  /* recherche : une icône qui ouvre un champ par-dessus l'en-tête */
  .recherche-globale { display: none; }
  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: linear-gradient(90deg, var(--lusigny-blue) 0%, var(--lusigny-teal-dark) 100%); }
  body.land-search-open .recherche-champ { flex: 1 1 auto; height: 40px; min-height: 40px; }
  /* impression, thème, affichage : dans le menu « ⋯ » */
  #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: var(--lusigny-teal-dark); border: 1px solid rgba(255,255,255,.45); border-radius: 10px; box-shadow: 0 6px 18px rgba(0,0,0,.35); 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), jamais deux rangées, pas de barre du bas */
  .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-gold); 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, carte à toute la hauteur restante */
  #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: .72rem; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }   /* mode dégradé : une ligne, sous l'en-tête (jamais dessus) */
  .dlg-boite { margin-top: 2vh; max-height: calc(100dvh - 12px); }
}
@media (orientation: landscape) and (max-height: 520px) {
  /* 4. Autres onglets : pleine largeur, cartes sur 2 colonnes, rien ne dépasse */
  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: .95rem; }
  .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; }
}

/* ==============================================================================
   v3.28.2 — CARTE EN PLEIN ÉCRAN dans la coquille (body.carte-pe), téléphone/tablette (< 900 px) et bureau (>= 900 px)
   ============================================================================== */
.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 .95rem/1 inherit; color: #fff; background: rgba(15, 23, 42, .92); border: 1px solid rgba(255, 255, 255, .35); border-radius: 12px; box-shadow: 0 3px 12px rgba(0, 0, 0, .35); 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; }
  /* le bouton ✕ de la carte (dans l'iframe) est remplacé par le bouton de la coquille : un seul « Quitter » visible */
}
@media (min-width: 900px) {
  /* bandeau d'icônes de 56 px à gauche ; se déplie au survol, au clavier (focus) ou avec le bouton ☰ */
  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: 1px solid var(--lusigny-border); background: var(--lusigny-surface); box-shadow: 2px 0 10px rgba(15, 23, 42, .12);
    transition: width .15s 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: .65rem; }
  body.carte-pe .module-nav:hover, body.carte-pe .module-nav:focus-within, body.carte-pe.pe-menu-ouvert .module-nav { width: 224px; }
  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: .92rem; 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 (hors .nav-item : la liste des modules reste de 10 entrées) */
.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-weight: 600; 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; } }
