/* ═══════════════════════════════════════════════════════════
   GazMaint Pro — Styles globaux
   ═══════════════════════════════════════════════════════════ */

:root {
  --navy:        #0B1929;
  --navy-mid:    #0F2340;
  --navy-light:  #162E52;
  --navy-card:   #0D2340;
  --cobalt:      #1A5EA8;
  --cobalt-l:    #2779D4;
  --cobalt-xl:   #4A9EF0;
  --cyan:        #0FA3C2;
  --amber:       #F5A623;
  --amber-d:     #D4881A;
  --orange:      #E8631A;
  --white:       #EEF2F7;
  --white-d:     #BCC8DA;
  --silver:      #9BAABF;
  --silver-d:    #5A6E8A;
  --green:       #0EAD69;
  --green-d:     #0A8A52;
  --red:         #D94F3D;
  --purple:      #7B5EA7;
  --teal:        #0D8C7A;
  --border:      rgba(39,121,212,0.18);
  --border-l:    rgba(39,121,212,0.35);
  --shadow:      0 4px 24px rgba(0,0,0,0.4);

  /* Gas colors */
  --gas-gn:     #F5C842;
  --gas-pr:     #E8631A;
  --gas-bu:     #D4881A;
  --gas-n2:     #87CEEB;
  --gas-o2:     #2779D4;
  --gas-ac:     #9BAABF;
  --gas-h2:     #A07DD4;
  --gas-c2h2:   #D94F3D;

  --navbar-h:   52px;
  --sidebar-w:  260px;
  --toolbar-h:  46px;
  --statusbar-h:28px;
  --radius:     10px;
  --radius-sm:  6px;
  --transition: 0.18s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%; width: 100%;
  overflow: hidden;
  background: var(--navy);
  color: var(--white);
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.4;
}

/* ─── APP LAYOUT ──────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ─── NAVBAR ──────────────────────────────── */
#navbar {
  height: var(--navbar-h);
  background: var(--navy-mid);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 0;
  flex-shrink: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.nav-logo {
  display: flex; align-items: center; gap: 10px;
  margin-right: 24px;
  text-decoration: none;
}
.nav-logo-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--amber), var(--orange));
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  box-shadow: 0 0 12px rgba(245,166,35,0.35);
}
.nav-logo-text {
  font-size: 15px; font-weight: 800;
  background: linear-gradient(90deg, #fff 0%, var(--amber) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  letter-spacing: -0.3px;
}

.nav-tabs {
  display: flex; align-items: center; gap: 2px;
  flex: 1;
}
.nav-tab {
  height: var(--navbar-h);
  padding: 0 18px;
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 500;
  color: var(--silver);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
  white-space: nowrap;
  user-select: none;
}
.nav-tab:hover { color: var(--white); }
.nav-tab.active {
  color: var(--white);
  border-bottom-color: var(--amber);
}
.nav-tab .tab-icon { font-size: 14px; }

.nav-right {
  display: flex; align-items: center; gap: 10px;
  margin-left: auto;
}
.nav-badge {
  display: flex; align-items: center; gap: 5px;
  background: rgba(14,173,105,0.12);
  border: 1px solid rgba(14,173,105,0.3);
  border-radius: 20px; padding: 4px 12px;
  font-size: 11px; color: var(--green);
}
.nav-badge .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 6px var(--green);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* ─── NAV SITE SWITCHER ───────────────────── */
.nav-site-wrap { position: relative; }
.nav-site-btn {
  display: flex; align-items: center; gap: 6px;
  background: rgba(14,173,105,0.12);
  border: 1px solid rgba(14,173,105,0.3);
  border-radius: 20px; padding: 4px 10px;
  font-size: 11px; color: var(--green); cursor: pointer;
}
.nav-site-btn .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 6px var(--green);
  animation: pulse 2s infinite;
}

/* ─── NAV USER DROPDOWN ───────────────────── */
.nav-user-wrap { position: relative; }
.nav-user-btn {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border-l);
  border-radius: 20px; padding: 4px 10px 4px 4px;
  cursor: pointer; color: var(--text);
}
.nav-user-btn:hover { background: rgba(255,255,255,0.1); }
.nav-user-btn.open { background: rgba(255,255,255,0.1); border-color: var(--cobalt); }
.nav-user-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, var(--cobalt), var(--cobalt-l));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.nav-user-fullname { font-size: 12px; font-weight: 500; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-affichage-arrow { font-size: 10px; color: var(--text-dim); }

/* Dropdown menus utilisateur + site — IDs spécifiques pour éviter conflit */
#nav-user-menu,
#nav-site-menu {
  right: 0 !important; left: auto !important;
  top: calc(100% + 8px) !important;
  border-radius: 10px !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4) !important;
  min-width: 210px;
  flex-direction: column !important;
  z-index: 9999 !important;
  padding: 4px 0;
}
.nav-aff-icon { font-size: 14px; }

/* Info bloc utilisateur dans le menu */
.nav-user-info-block { padding: 12px 14px 8px; }
.nav-ui-name { font-size: 13px; font-weight: 600; color: var(--text); }
.nav-ui-role { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.nav-dd-sep { height: 1px; background: var(--border); margin: 4px 0; }
.nav-logout-item { color: #f47067 !important; }
.nav-logout-item:hover { background: rgba(244,112,103,0.1) !important; }

/* ─── CONTENT AREA ────────────────────────── */
#content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ─── SIDEBAR ─────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  background: var(--navy-mid);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar-section {
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-section-header {
  padding: 10px 14px 8px;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer;
  user-select: none;
}
.sidebar-section-title {
  font-size: 10px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--silver-d);
}
.sidebar-section-toggle {
  font-size: 10px; color: var(--silver-d);
  transition: transform var(--transition);
}
.sidebar-section.collapsed .sidebar-section-toggle { transform: rotate(-90deg); }
.sidebar-section-body { padding: 6px 10px 10px; }
.sidebar-section.collapsed .sidebar-section-body { display: none !important; }

/* Layer toggles */
.layer-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 4px; border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}
.layer-row:hover { background: rgba(39,121,212,0.08); }
.layer-check {
  width: 15px; height: 15px; border-radius: 3px;
  border: 1.5px solid var(--silver-d);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 9px; cursor: pointer;
  transition: all var(--transition);
}
.layer-check.checked {
  background: var(--cobalt-l); border-color: var(--cobalt-l);
}
.layer-icon { font-size: 13px; }
.layer-name { font-size: 12px; color: var(--white-d); flex: 1; }
.sat-opacity-slider {
  width: 52px; height: 3px; cursor: pointer;
  accent-color: var(--cyan-d);
  flex-shrink: 0;
}
.sat-corner-handle {
  transition: r 0.1s;
}
.sat-corner-handle:hover { r: 9; }
.sat-rot-handle:hover { r: 11; }

/* ─── CAL MEASURES PANEL ──────────────────────────────── */
.cal-panel {
  position: fixed;
  z-index: 2500;
  background: var(--card-bg, #1e2432);
  border: 1px solid rgba(0,208,255,0.25);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.5);
  width: 280px;
  overflow: hidden;
}
.cal-panel.hidden { display: none; }
.cal-panel-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: rgba(0,208,255,0.07);
  border-bottom: 1px solid rgba(0,208,255,0.12);
}
.cal-panel-icon  { font-size: 14px; }
.cal-panel-title { font-size: 12px; font-weight: 600; color: var(--cyan-d,#00d0ff); flex: 1; letter-spacing: 0.3px; }
.cal-panel-close {
  background: none; border: none; color: var(--silver-d); font-size: 16px;
  cursor: pointer; padding: 0 2px; line-height: 1;
}
.cal-panel-close:hover { color: #fff; }
.cal-panel-scale {
  padding: 7px 12px;
  font-size: 11px;
  color: var(--amber, #F5A623);
  background: rgba(245,166,35,0.06);
  border-bottom: 1px solid rgba(245,166,35,0.12);
  letter-spacing: 0.2px;
}
.cal-panel-list { max-height: 220px; overflow-y: auto; padding: 4px 0; }
.cal-panel-empty {
  padding: 18px 12px;
  text-align: center;
  font-size: 11px;
  color: var(--silver-d);
}
.cal-measure-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.12s;
}
.cal-measure-row:hover { background: rgba(255,255,255,0.03); }
.cal-measure-info { flex: 1; min-width: 0; }
.cal-measure-label { font-size: 11px; color: #c8d4e8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-measure-meta  { font-size: 10px; color: var(--silver-d); margin-top: 1px; }
.cal-measure-vis {
  background: none; border: none;
  font-size: 13px; cursor: pointer; color: #c8d4e8;
  padding: 2px 4px; border-radius: 3px; flex-shrink: 0;
  transition: opacity 0.15s;
}
.cal-measure-vis:hover { opacity: 1 !important; }
.cal-measure-del {
  background: none; border: none;
  color: #D94F3D; font-size: 14px; cursor: pointer;
  padding: 2px 4px; border-radius: 3px; flex-shrink: 0;
  opacity: 0.7; transition: opacity 0.12s;
}
.cal-measure-del:hover { opacity: 1; }
.cal-panel-footer {
  padding: 8px 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.cal-panel-add-btn {
  width: 100%; justify-content: center;
  gap: 6px; font-size: 12px;
}

/* ─── CALIBRATION DIALOG ───────────────────────────── */
.calibrate-dialog {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3000;
  background: var(--card-bg, #1e2432);
  border: 1px solid rgba(0,208,255,0.35);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.55);
  width: 300px;
  padding: 0;
  overflow: hidden;
}
.calibrate-dialog.hidden { display: none; }
.cal-dialog-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  background: rgba(0,208,255,0.08);
  border-bottom: 1px solid rgba(0,208,255,0.15);
}
.cal-dialog-icon { font-size: 16px; }
.cal-dialog-title { font-size: 13px; font-weight: 600; color: var(--cyan-d, #00d0ff); letter-spacing: 0.3px; }
.cal-dialog-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.cal-field { display: flex; flex-direction: column; gap: 4px; }
.cal-label { font-size: 10px; letter-spacing: 0.8px; text-transform: uppercase; color: var(--silver-d, #9baabf); }
.cal-input {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 5px;
  color: #e8edf5;
  font-size: 13px;
  padding: 6px 9px;
  outline: none;
  transition: border-color 0.15s;
}
.cal-input:focus { border-color: var(--cyan-d, #00d0ff); }
.cal-dialog-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

/* ─── AUTO-LENGTH HINT (fiche réseau) ─────────────── */
.pf-auto-length-hint {
  display: flex; align-items: center; gap: 5px;
  margin-top: 4px;
  padding: 3px 7px;
  background: rgba(0,208,255,0.07);
  border-radius: 4px;
  border: 1px solid rgba(0,208,255,0.18);
}
#pf-auto-length-val {
  font-size: 10px; color: var(--cyan-d, #00d0ff);
  flex: 1;
}
.pf-auto-use-btn {
  background: none; border: none;
  color: var(--cyan-d, #00d0ff);
  font-size: 13px; cursor: pointer;
  padding: 0 2px; line-height: 1;
  opacity: 0.8;
}
.pf-auto-use-btn:hover { opacity: 1; }

/* ─── SCALE MEASURE (SVG) — style curseur calibrate ── */
.tool-calibrate { cursor: crosshair; }

/* ─── LAYER LOCK BUTTON ─────────────────────────────── */
.layer-lock-btn {
  background: none;
  border: none;
  padding: 0 2px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.45;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.layer-lock-btn:hover { opacity: 0.85; }
.layer-lock-btn.locked { opacity: 1; }

/* ── Bouton reset positions étiquettes mesures ── */
.layer-measure-reset {
  background: none;
  border: none;
  padding: 0 3px;
  cursor: pointer;
  font-size: 13px;
  color: var(--silver-d);
  opacity: 0.7;
  line-height: 1;
  flex-shrink: 0;
  transition: opacity 0.15s, color 0.15s;
}
.layer-measure-reset:hover { opacity: 1; color: var(--cyan); }

/* ─── ÉTIQUETTES MESURES (SVG) ──────────────── */
.ml-group { pointer-events: none; }
.ml-box   { pointer-events: all; }
.ml-drag-zone { pointer-events: all; }
.ml-dragging .ml-drag-zone { cursor: grabbing !important; }

/* ─── GAS ENVIRONMENT SIDEBAR ───────────── */
.gas-env-add-btn {
  margin-left: auto; margin-right: 6px;
  width: 20px; height: 20px;
  background: rgba(39,121,212,0.15);
  border: 1px solid rgba(39,121,212,0.4);
  border-radius: 5px;
  color: var(--cobalt-xl); font-size: 15px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background 0.15s;
}
.gas-env-add-btn:hover { background: rgba(39,121,212,0.3); }

.gas-env-empty {
  padding: 10px 4px 6px;
  font-size: 11px; color: var(--silver-d); line-height: 1.6;
}
.gas-env-empty strong { color: var(--cobalt-xl); }

.gas-env-row {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 4px 5px 2px;
  border-radius: 7px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
  margin-bottom: 2px;
}
.gas-env-row:hover { background: rgba(39,121,212,0.07); }
.gas-env-row.active {
  background: rgba(39,121,212,0.12);
  border-color: rgba(39,121,212,0.3);
}
.gas-env-row.env-hidden { opacity: 0.45; }

.gas-env-badge {
  min-width: 30px; height: 20px; padding: 0 4px;
  border-radius: 4px; font-size: 8.5px; font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; letter-spacing: 0.3px;
}
.gas-env-name {
  flex: 1; font-size: 11.5px; color: var(--white-d);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gas-env-eye {
  background: none; border: none; cursor: pointer;
  color: var(--silver); padding: 2px 3px; border-radius: 3px;
  display: flex; align-items: center; transition: color 0.15s;
  flex-shrink: 0;
}
.gas-env-eye:hover { color: var(--white); }
.gas-env-eye.off { color: var(--silver-d); opacity: 0.5; }
.gas-env-del {
  background: none; border: none; cursor: pointer;
  color: var(--silver-d); font-size: 14px; line-height: 1;
  padding: 1px 4px; border-radius: 3px; flex-shrink: 0;
  transition: color 0.15s;
}
.gas-env-del:hover { color: var(--red); }

/* ─── GAS DELETE CONFIRM ────────────────── */
.gas-delete-overlay {
  position: fixed; inset: 0; z-index: 8300;
  background: rgba(6,15,28,0.80);
  backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
}
.gas-delete-overlay.open { display: flex; }

.gas-delete-panel {
  width: 420px; max-width: 95vw;
  background: var(--navy-card);
  border: 1px solid rgba(217,79,61,0.35);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.55), 0 0 0 1px rgba(217,79,61,0.1);
  overflow: hidden;
  animation: search-drop 0.18s cubic-bezier(0.22,1,0.36,1);
}
.gas-delete-header {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid rgba(217,79,61,0.2);
  font-size: 14px; font-weight: 600; color: var(--red);
}
.gas-delete-icon {
  width: 28px; height: 28px; flex-shrink: 0;
  background: rgba(217,79,61,0.15);
  border: 1px solid rgba(217,79,61,0.35);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.gas-delete-body { padding: 18px 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.gas-delete-desc { font-size: 13px; color: var(--white-d); line-height: 1.55; }
.gas-delete-desc strong { color: var(--white); }
.gas-delete-detail {
  padding: 8px 12px;
  background: rgba(217,79,61,0.08);
  border: 1px solid rgba(217,79,61,0.25);
  border-radius: 7px;
  font-size: 12px; color: #f08080; line-height: 1.5;
}
.gas-delete-detail strong { color: var(--red); }
.gas-delete-instruction { font-size: 12px; color: var(--silver-d); line-height: 1.5; }
.gas-delete-instruction code {
  display: inline-block; padding: 1px 7px;
  background: rgba(217,79,61,0.12);
  border: 1px solid rgba(217,79,61,0.3);
  border-radius: 4px;
  color: #f08080; font-family: 'JetBrains Mono', monospace; font-size: 12px;
  letter-spacing: 0.3px;
}
.gas-delete-input {
  width: 100%; padding: 9px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-l);
  border-radius: 8px;
  color: var(--white); font-size: 13px; font-family: inherit;
  outline: none; transition: border-color 0.15s;
}
.gas-delete-input:focus { border-color: rgba(217,79,61,0.5); }
.gas-delete-input.valid { border-color: var(--green); color: var(--green); }
.gas-delete-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.gas-delete-cancel {
  padding: 8px 16px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  border-radius: 8px; color: var(--silver); font-size: 13px;
  cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.gas-delete-cancel:hover { background: rgba(255,255,255,0.09); color: var(--white); }
.gas-delete-confirm {
  padding: 8px 16px;
  background: rgba(217,79,61,0.15); border: 1px solid rgba(217,79,61,0.4);
  border-radius: 8px; color: var(--red); font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.gas-delete-confirm:disabled {
  opacity: 0.35; cursor: not-allowed;
}
.gas-delete-confirm:not(:disabled):hover {
  background: rgba(217,79,61,0.28); border-color: var(--red); color: #fff;
}

/* ─── GAS CREATE MODAL ───────────────────── */
.gas-create-overlay {
  position: fixed; inset: 0; z-index: 8200;
  background: rgba(6, 15, 28, 0.75);
  backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
}
.gas-create-overlay.open { display: flex; }

.gas-create-panel {
  width: 520px; max-width: 96vw; max-height: 86vh;
  background: var(--navy-card);
  border: 1px solid var(--border-l);
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.55);
  overflow: hidden; display: flex; flex-direction: column;
  animation: search-drop 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.gas-create-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.gas-create-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 600; color: var(--white);
}
.gas-create-icon {
  width: 28px; height: 28px;
  background: rgba(245,166,35,0.15);
  border: 1px solid rgba(245,166,35,0.35);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.gas-create-hint {
  padding: 10px 18px 4px;
  font-size: 11.5px; color: var(--silver-d); line-height: 1.5;
  flex-shrink: 0;
}
.gas-catalog-grid {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 8px; padding: 12px 18px 20px;
  overflow-y: auto;
}
.gas-catalog-btn {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 12px 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer; transition: all 0.18s; font-family: inherit;
  text-align: center; position: relative;
}
.gas-catalog-btn:hover:not(:disabled) {
  background: rgba(39,121,212,0.1);
  border-color: var(--cobalt-l);
  transform: translateY(-1px);
}
.gas-catalog-btn.added { opacity: 0.45; cursor: not-allowed; }
.gas-catalog-btn strong { font-size: 11.5px; color: var(--white); font-weight: 600; }
.gas-catalog-dot {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
}
.gas-catalog-abbr {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px; font-weight: 700; letter-spacing: 0.5px;
}
.gas-catalog-check {
  font-size: 9px; color: var(--green); font-weight: 600;
  position: absolute; top: 5px; right: 6px;
}

/* Equipment library */
.equip-library {
  flex: 1;
  overflow-y: auto;
  padding: 6px 10px 12px;
}
.equip-library::-webkit-scrollbar { width: 4px; }
.equip-library::-webkit-scrollbar-track { background: transparent; }
.equip-library::-webkit-scrollbar-thumb { background: var(--navy-light); border-radius: 2px; }

.equip-lib-toggle-all {
  background: none; border: none; cursor: pointer;
  color: var(--silver-d); font-size: 14px; line-height: 1;
  padding: 2px 4px; border-radius: 3px;
  margin-right: 4px; flex-shrink: 0;
  transition: color var(--transition), background var(--transition);
}
.equip-lib-toggle-all:hover { color: var(--white-d); background: rgba(255,255,255,0.08); }

.equip-cat-group { margin-bottom: 2px; }

.equip-category-title {
  font-size: 9px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--silver-d);
  margin: 10px 4px 5px;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; user-select: none;
  padding: 2px 4px; border-radius: 4px;
  transition: background var(--transition);
}
.equip-category-title:hover { background: rgba(255,255,255,0.04); color: var(--white-d); }
.equip-cat-label { flex: 1; }
.equip-cat-arrow {
  font-size: 7px; color: var(--silver-d);
  transition: transform var(--transition);
  line-height: 1;
}
.equip-cat-group.collapsed .equip-cat-arrow { transform: rotate(-90deg); }
.equip-cat-body { overflow: hidden; }
.equip-cat-group.collapsed .equip-cat-body { display: none; }

.equip-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px;
  margin-bottom: 3px;
  background: rgba(22,46,82,0.5);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: grab; user-select: none;
  transition: all var(--transition);
}
.equip-item:hover {
  background: rgba(39,121,212,0.15);
  border-color: var(--border-l);
  transform: translateX(2px);
}
.equip-item:active { cursor: grabbing; }
.equip-item-icon {
  width: 26px; height: 26px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; flex-shrink: 0;
}
.equip-item-name { font-size: 11.5px; color: var(--white-d); flex: 1; }
.equip-item-abbr {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px; font-weight: 700; color: var(--silver-d);
}

/* ─── MAIN PLAN AREA ──────────────────────── */
#main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* ─── TOOLBAR ─────────────────────────────── */
#toolbar {
  height: var(--toolbar-h);
  background: var(--navy-mid);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  flex-shrink: 0;
  z-index: 50;
}

.toolbar-sep {
  width: 1px; height: 26px;
  background: var(--border);
  margin: 0 4px;
}

.tool-btn {
  height: 32px;
  padding: 0 12px;
  display: flex; align-items: center; gap: 6px;
  background: rgba(22,46,82,0.5);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--silver);
  font-size: 12px; font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  user-select: none;
}
.tool-btn:hover { background: rgba(39,121,212,0.15); color: var(--white); border-color: var(--border-l); }
.tool-btn.active {
  background: var(--cobalt);
  border-color: var(--cobalt-l);
  color: #fff;
}
.tool-btn.active-draw {
  background: rgba(245,166,35,0.18);
  border-color: rgba(245,166,35,0.5);
  color: var(--amber);
}
.tool-btn.danger:hover { background: rgba(217,79,61,0.15); border-color: rgba(217,79,61,0.4); color: var(--red); }
.tool-btn .btn-icon { font-size: 14px; }

/* Gas type selector in toolbar */
.gas-selector {
  display: flex; align-items: center; gap: 4px;
}
.gas-btn {
  height: 28px; padding: 0 10px;
  border-radius: 14px;
  border: 1.5px solid transparent;
  font-size: 11px; font-weight: 600;
  cursor: pointer; user-select: none;
  transition: all var(--transition);
  opacity: 0.4;
  font-family: 'JetBrains Mono', monospace;
}
.gas-btn.active { opacity: 1; }
.gas-btn:hover { opacity: 0.8; }

/* Zoom controls */
.zoom-group {
  display: flex; align-items: center; gap: 2px;
  margin-left: auto;
}
.zoom-btn {
  width: 28px; height: 28px;
  background: rgba(22,46,82,0.5);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--silver);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 14px;
  transition: all var(--transition);
  user-select: none;
}
.zoom-btn:hover { background: rgba(39,121,212,0.15); color: var(--white); }
.zoom-val {
  width: 48px; text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--silver);
}

.upload-btn {
  height: 32px; padding: 0 14px;
  background: rgba(14,173,105,0.1);
  border: 1px solid rgba(14,173,105,0.3);
  border-radius: var(--radius-sm);
  color: var(--green);
  font-size: 12px; font-weight: 600;
  cursor: pointer; gap: 6px;
  display: flex; align-items: center;
  transition: all var(--transition);
  white-space: nowrap;
}
.upload-btn:hover { background: rgba(14,173,105,0.2); }

/* ─── DROPDOWN PLAN ───────────────────────── */
.plan-dropdown-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.plan-dropdown-btn { gap: 5px; }
.plan-dd-arrow {
  font-size: 9px;
  opacity: 0.6;
  margin-left: 1px;
  transition: transform 0.18s;
}
.plan-dropdown-btn.active .plan-dd-arrow {
  transform: rotate(180deg);
  opacity: 1;
}
.plan-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 500;
  flex-direction: column;
  min-width: 192px;
  background: var(--navy-card);
  border: 1px solid var(--border-l);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45), 0 2px 8px rgba(0,0,0,0.3);
  padding: 4px 0;
  overflow: hidden;
}
.plan-dropdown-menu.open { display: flex; }
.plan-dd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: none;
  border: none;
  color: var(--silver);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
  width: 100%;
}
.plan-dd-item:hover { background: rgba(39,121,212,0.12); color: var(--white); }
.plan-dd-icon { font-size: 14px; width: 18px; text-align: center; flex-shrink: 0; }
.plan-dd-item-export { color: #7DB4FF; }
.plan-dd-item-export:hover { background: rgba(39,121,212,0.18); color: #a8d0ff; }
.plan-dd-sep { height: 1px; margin: 3px 10px; background: var(--border); }

/* ─── PLAN CANVAS CONTAINER ───────────────── */
#canvas-wrap {
  flex: 1;
  overflow: hidden;
  position: relative;
  background:
    radial-gradient(ellipse 60% 40% at 50% 50%, rgba(26,94,168,0.06) 0%, transparent 70%),
    var(--navy);
  cursor: crosshair;
}

#canvas-wrap.tool-select  { cursor: default; }
#canvas-wrap.tool-draw    { cursor: crosshair; }
#canvas-wrap.tool-erase   { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20'%3E%3Ccircle cx='10' cy='10' r='8' fill='none' stroke='%23D94F3D' stroke-width='2'/%3E%3C/svg%3E") 10 10, crosshair; }
#canvas-wrap.tool-pan     { cursor: grab; }
#canvas-wrap.tool-pan.dragging { cursor: grabbing; }

#plan-svg {
  width: 100%; height: 100%;
  display: block;
}

/* SVG styles */
.pipe-line {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  cursor: pointer;
  transition: stroke-width 0.1s;
}
.pipe-line:hover { stroke-width: 5; }
.pipe-line.selected { stroke-width: 5; filter: drop-shadow(0 0 4px currentColor); }

.pipe-preview {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 8 4;
  pointer-events: none;
  opacity: 0.7;
}

.equipment-group { cursor: grab; }
.equipment-group:active { cursor: grabbing; }
.equipment-group:hover .equip-circle { filter: brightness(1.2) drop-shadow(0 0 6px rgba(255,255,255,0.3)); }
.equipment-group.selected .equip-circle { filter: drop-shadow(0 0 8px rgba(255,255,255,0.5)); }
.equipment-group.eq-dragging .equip-circle {
  filter: brightness(1.4) drop-shadow(0 0 10px rgba(39,121,212,0.7));
  stroke-width: 2.5;
}
.ouvrage-drop-target { stroke-width: 3 !important; filter: drop-shadow(0 0 10px #F5A623) brightness(1.4) !important; }

/* ── Étiquettes inline des tronçons ── */
.pipe-label-drag-zone { cursor: grab; }
.pipe-label-drag-zone:active { cursor: grabbing; }
.pipe-label-box { transition: filter 0.1s ease; }
.pipe-label-box:hover { filter: brightness(1.15); }

/* ── Poignées de déplacement des tronçons ── */
#pipe-handles { pointer-events: all; }

.pipe-endpoint-handle {
  transition: filter 0.12s ease;
}
.pipe-endpoint-handle:hover {
  filter: drop-shadow(0 0 6px rgba(39,121,212,0.9));
}

.pipe-vertex-handle {
  transition: filter 0.12s ease;
}
.pipe-vertex-handle:hover {
  filter: drop-shadow(0 0 6px rgba(245,166,35,0.9));
}

/* Grid pattern */
.svg-grid {
  fill: none;
  stroke: rgba(39,121,212,0.06);
  stroke-width: 1;
}

/* ─── LEGEND BAR ──────────────────────────── */
#legend-bar {
  position: absolute;
  bottom: var(--statusbar-h);
  left: 0; right: 0;
  height: 32px;
  background: rgba(11,25,41,0.85);
  backdrop-filter: blur(6px);
  border-top: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 14px; gap: 20px;
  font-size: 11px;
  pointer-events: none;
}
.legend-item {
  display: flex; align-items: center; gap: 6px; color: var(--silver);
}
.legend-line {
  width: 28px; height: 3px; border-radius: 2px;
}

/* ─── STATUS BAR ──────────────────────────── */
#status-bar {
  height: var(--statusbar-h);
  background: var(--navy-mid);
  border-top: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 14px; gap: 16px;
  font-size: 11px; color: var(--silver-d);
  flex-shrink: 0;
  font-family: 'JetBrains Mono', monospace;
}
#status-bar .status-item { display: flex; align-items: center; gap: 4px; }
#status-bar .status-sep { color: var(--border-l); }
#coords-display { margin-left: auto; }

/* ─── FICHE MODAL ─────────────────────────── */
#fiche-panel {
  position: absolute;
  top: 0; right: 0;
  width: 360px;
  height: 100%;
  background: var(--navy-mid);
  border-left: 1px solid var(--border-l);
  display: flex; flex-direction: column;
  z-index: 200;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
  box-shadow: -8px 0 32px rgba(0,0,0,0.4);
}
#fiche-panel.open { transform: translateX(0); }

.fiche-header {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-shrink: 0;
}
.fiche-type-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 10px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.fiche-name {
  font-size: 16px; font-weight: 700; color: var(--white); line-height: 1.2;
}
.fiche-id {
  font-size: 10px; color: var(--silver-d);
  font-family: 'JetBrains Mono', monospace;
  margin-top: 2px;
}
.fiche-close {
  width: 28px; height: 28px; border-radius: 6px;
  background: rgba(22,46,82,0.5); border: 1px solid var(--border);
  color: var(--silver); font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  transition: all var(--transition);
}
.fiche-close:hover { background: rgba(217,79,61,0.2); border-color: rgba(217,79,61,0.4); color: var(--red); }

.fiche-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 14px 18px;
}
.fiche-body::-webkit-scrollbar { width: 4px; }
.fiche-body::-webkit-scrollbar { width: 5px; }
.fiche-body::-webkit-scrollbar-track { background: rgba(0,0,0,0.1); }
.fiche-body::-webkit-scrollbar-thumb { background: var(--border-l); border-radius: 3px; }
.fiche-body::-webkit-scrollbar-thumb:hover { background: var(--silver-d); }

/* ── Bouton tout-replier dans header fiche ── */
.fiche-toggle-all-btn {
  background: none; border: none; cursor: pointer;
  color: var(--silver-d); font-size: 14px; line-height: 1;
  padding: 3px 5px; border-radius: 4px; flex-shrink: 0;
  transition: color var(--transition), background var(--transition);
}
.fiche-toggle-all-btn:hover { color: var(--white-d); background: rgba(255,255,255,0.08); }

/* ── Sections repliables (fiche-sec) ── */
.fiche-sec { margin-bottom: 2px; }

.fiche-section-title {
  font-size: 9px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--silver-d);
  margin: 14px 0 6px;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; user-select: none;
  padding: 3px 0; border-radius: 3px;
  transition: color var(--transition);
}
.fiche-section-title:hover { color: var(--white-d); }
.fiche-sec-arrow {
  font-size: 8px; color: var(--silver-d);
  transition: transform var(--transition); flex-shrink: 0;
}
.fiche-sec.collapsed .fiche-sec-arrow { transform: rotate(-90deg); }
.fiche-sec-body { padding-bottom: 4px; }
.fiche-sec.collapsed .fiche-sec-body { display: none; }

.fiche-field {
  margin-bottom: 10px;
}

/* Bandeau pression réseau — fiche équipement */
/* ── Photos ────────────────────────────────────── */
.photos-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px; margin-bottom: 10px;
}
.photo-thumb {
  position: relative; border-radius: 6px; overflow: hidden;
  aspect-ratio: 4/3; background: var(--navy-deep);
  border: 1px solid var(--border);
}
.photo-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  display: block; cursor: zoom-in;
  transition: opacity 0.15s;
}
.photo-thumb img:hover { opacity: 0.85; }
.photo-del-btn {
  position: absolute; top: 4px; right: 4px;
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(10,24,48,0.85); border: none;
  color: var(--silver-d); font-size: 10px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.15s;
}
.photo-thumb:hover .photo-del-btn { opacity: 1; }
.photo-del-btn:hover { color: var(--danger); }
.photos-add-btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; padding: 8px; border-radius: 6px; cursor: pointer;
  border: 1.5px dashed rgba(255,255,255,0.15);
  color: var(--silver-d); font-size: 12px;
  transition: border-color 0.15s, color 0.15s;
}
.photos-add-btn:hover { border-color: var(--cyan-d); color: var(--cyan-d); }
.photo-viewer-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.88);
  display: flex; align-items: center; justify-content: center;
}
.photo-viewer-box {
  position: relative; max-width: 90vw; max-height: 90vh;
}
.photo-viewer-box img {
  max-width: 90vw; max-height: 88vh;
  border-radius: 8px; display: block;
}
.photo-viewer-close {
  position: absolute; top: -14px; right: -14px;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--navy-mid); border: 1px solid var(--border);
  color: var(--silver); font-size: 13px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.photo-viewer-close:hover { color: var(--danger); }

/* Wrapper champ pression nominale équipement */
.fiche-pression-wrap {
  display: flex; align-items: center; gap: 4px;
}
.fiche-pression-wrap .fiche-input { flex: 1; }
.fiche-pression-reset-btn {
  flex-shrink: 0;
  background: rgba(39,121,212,0.12);
  border: 1px solid rgba(39,121,212,0.3);
  color: #7DB4FF;
  border-radius: 5px;
  width: 28px; height: 30px;
  font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.fiche-pression-reset-btn:hover { background: rgba(39,121,212,0.25); color: #acd4ff; }
.fiche-pression-status {
  font-size: 9.5px; margin-top: 3px; display: flex; align-items: center; gap: 4px;
}
.fiche-ps-auto     { color: #14C4A8; }
.fiche-ps-override { color: #9BAABF; }
.fiche-input.fiche-auto-mode { border-color: rgba(20,196,168,0.35); }

/* Bandeau pression réseau — fiche équipement (référence en mode override) */
.fiche-network-pressure-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; margin: 4px 0 10px;
  background: rgba(20,196,168,0.07);
  border: 1px solid rgba(20,196,168,0.2);
  border-radius: 6px;
}
.fiche-np-icon { font-size: 14px; color: #14C4A8; opacity: 0.7; flex-shrink: 0; }
.fiche-np-label { font-size: 10px; font-weight: 600; color: var(--silver); text-transform: uppercase; letter-spacing: .4px; flex: 1; }
.fiche-np-value { font-size: 13px; font-weight: 700; color: #14C4A8; font-family: 'JetBrains Mono', monospace; }
.fiche-label {
  font-size: 10px; color: var(--silver-d); margin-bottom: 3px;
  letter-spacing: 0.3px;
}
.fiche-input {
  width: 100%;
  background: rgba(11,25,41,0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  color: var(--white);
  font-size: 12px; font-family: inherit;
  transition: border-color var(--transition);
  outline: none;
}
.fiche-input:focus { border-color: var(--cobalt-l); }
.fiche-input[readonly] { color: var(--silver); background: rgba(11,25,41,0.3); cursor: default; }
.fiche-select {
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%235A6E8A'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}
.fiche-select option { background: #0D2340; color: var(--white); }
.fiche-textarea {
  resize: vertical; min-height: 64px;
  font-family: inherit;
}

.fiche-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }


.fiche-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px;
  flex-shrink: 0;
}
.btn-primary {
  flex: 1; height: 34px;
  background: var(--cobalt);
  border: none; border-radius: var(--radius-sm);
  color: #fff; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all var(--transition);
}
.btn-primary:hover { background: var(--cobalt-l); }
.btn-secondary {
  height: 34px; padding: 0 14px;
  background: rgba(22,46,82,0.5);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--silver); font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all var(--transition);
}
.btn-secondary:hover { background: rgba(39,121,212,0.15); color: var(--white); }
.btn-danger {
  height: 34px; padding: 0 14px;
  background: rgba(217,79,61,0.1);
  border: 1px solid rgba(217,79,61,0.3); border-radius: var(--radius-sm);
  color: var(--red); font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all var(--transition);
}
.btn-danger:hover { background: rgba(217,79,61,0.2); }

/* Maintenance status badge */
.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 8px;
  font-size: 10px; font-weight: 600;
}
.status-ok     { background: rgba(14,173,105,0.15); color: var(--green); border: 1px solid rgba(14,173,105,0.3); }
.status-warn   { background: rgba(245,166,35,0.15); color: var(--amber); border: 1px solid rgba(245,166,35,0.3); }
.status-alert  { background: rgba(217,79,61,0.15);  color: var(--red);   border: 1px solid rgba(217,79,61,0.3); }

/* ─── NOTIFICATIONS ───────────────────────── */
#notifications {
  position: fixed;
  bottom: 48px; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 6px;
  z-index: 9999;
  pointer-events: none;
}
.notif {
  padding: 8px 18px; border-radius: 20px;
  font-size: 12px; font-weight: 500;
  animation: notif-in 0.3s ease, notif-out 0.3s ease 2.7s forwards;
  pointer-events: none;
}
.notif-info    { background: rgba(39,121,212,0.9); color: #fff; }
.notif-success { background: rgba(14,173,105,0.9); color: #fff; }
.notif-warn    { background: rgba(245,166,35,0.9); color: #000; }
.notif-error   { background: rgba(217,79,61,0.9);  color: #fff; }
@keyframes notif-in  { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
@keyframes notif-out { from{opacity:1} to{opacity:0} }

/* ─── CONTEXT MENU ────────────────────────── */
#context-menu {
  position: fixed;
  background: var(--navy-card);
  border: 1px solid var(--border-l);
  border-radius: var(--radius);
  padding: 6px;
  min-width: 160px;
  z-index: 5000;
  display: none;
  box-shadow: var(--shadow);
}
#context-menu.visible { display: block; }
.ctx-item {
  padding: 7px 12px; border-radius: var(--radius-sm);
  font-size: 12px; color: var(--white-d);
  cursor: pointer; display: flex; align-items: center; gap: 8px;
  transition: background var(--transition);
}
.ctx-item:hover { background: rgba(39,121,212,0.15); color: var(--white); }
.ctx-item.danger:hover { background: rgba(217,79,61,0.15); color: var(--red); }
.ctx-sep { height: 1px; background: var(--border); margin: 4px 0; }

/* ─── NO BACKGROUND HINT ──────────────────── */
#empty-hint {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
  pointer-events: none;
}
#empty-hint.hidden { display: none; }
.empty-icon { font-size: 48px; opacity: 0.3; }
.empty-text { font-size: 15px; font-weight: 600; color: var(--silver-d); opacity: 0.6; }
.empty-sub  { font-size: 12px; color: var(--silver-d); opacity: 0.4; }

/* ─── EQUIPMENT COMPACT ───────────────────── */
.equipment-group .equip-circle {
  transition: r 0.12s ease, stroke-width 0.12s ease;
}
.equipment-group:hover .equip-circle {
  stroke-width: 2.5;
  filter: drop-shadow(0 0 4px currentColor);
}
.equipment-group.selected .equip-circle {
  stroke-width: 2.5;
  filter: drop-shadow(0 0 6px rgba(255,255,255,0.4));
}

/* Label callout */
.equip-label-callout {
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5));
}
.label-fiche-btn {
  transition: opacity 0.1s;
}
.label-fiche-btn:hover {
  opacity: 0.8;
}

/* ─── DRAWING POINT ───────────────────────── */
.draw-vertex {
  cursor: pointer;
}
.draw-vertex circle:hover { r: 5; }

/* ─── SCROLLBAR ───────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--navy-light); border-radius: 3px; }

/* ─── HIDDEN FILE INPUT ───────────────────── */
#bg-file-input { display: none; }

/* ─── VIEW PLACEHOLDER TABS ──────────────── */
.view-placeholder {
  flex: 1; display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 14px;
}
.view-placeholder-icon { font-size: 56px; opacity: 0.2; }
.view-placeholder-text { font-size: 18px; font-weight: 700; color: var(--silver-d); opacity: 0.5; }
.view-placeholder-sub  { font-size: 13px; color: var(--silver-d); opacity: 0.3; }

/* ═══════════════════════════════════════════════════════════
   MAINTENANCE — New Matrix Design
   ═══════════════════════════════════════════════════════════ */

/* Top bar */
/* ─── Maintenance layout ─── */
.maint-topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg-deep); flex-shrink: 0;
}
.maint-topbar-left  { display: flex; align-items: center; gap: 16px; }
.maint-topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* Workspace = backlog gauche + zone droite */
.maint-workspace {
  display: flex; flex: 1; overflow: hidden;
}
.maint-right {
  flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0;
}

/* ─── Backlog panel ─── */
.maint-backlog {
  width: 272px; min-width: 220px; flex-shrink: 0;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--border-l);
  background: var(--deep-navy);
  overflow: hidden;
}
.maint-backlog-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 13px 7px; border-bottom: 1px solid var(--border-l); flex-shrink: 0;
}
.maint-backlog-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .8px; color: var(--silver);
}
.maint-backlog-hint {
  font-size: 9px; color: var(--silver-d); opacity: .55; font-style: italic;
}
.maint-backlog-sec {
  display: flex; flex-direction: column; overflow: hidden; flex: 1; min-height: 0;
}
.maint-backlog-sec:first-of-type { flex: 1.6; }
.maint-backlog-sec-hdr {
  display: flex; align-items: center; gap: 6px;
  width: 100%; padding: 6px 13px;
  background: rgba(255,255,255,0.03);
  border: none; border-bottom: 1px solid var(--border-l);
  color: var(--white); cursor: pointer;
  font-size: 11px; font-weight: 600; text-align: left;
}
.maint-backlog-sec-hdr:hover { background: rgba(255,255,255,0.06); }
.maint-backlog-sec-count {
  margin-left: auto; font-size: 9px; font-weight: 700; color: var(--silver-d);
  background: rgba(255,255,255,0.08); padding: 1px 6px; border-radius: 9px;
}
.maint-backlog-sec-chevron { font-size: 10px; color: var(--silver-d); }
.maint-backlog-sec-body {
  overflow-y: auto; flex: 1; padding: 5px 7px;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.backlog-cat-hdr {
  font-size: 8.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: var(--silver-d);
  padding: 8px 4px 3px; margin-top: 4px;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.backlog-cat-hdr:first-child { margin-top: 0; border-top: none; padding-top: 3px; }
.backlog-item {
  background: rgba(255,255,255,0.035); border: 1px solid rgba(255,255,255,0.07);
  border-radius: 5px; padding: 5px 7px; margin-bottom: 3px;
  cursor: grab; user-select: none;
  transition: background .12s, border-color .12s;
}
.backlog-item:hover { background: rgba(39,121,212,0.1); border-color: rgba(39,121,212,0.28); }
.backlog-item:active { cursor: grabbing; }
.backlog-item-dragging { opacity: .35; }
.backlog-item-corr { border-left: 2px solid rgba(232,99,26,0.5); }
.backlog-item-action {
  display: block; font-size: 10.5px; color: var(--white);
  line-height: 1.35; margin-bottom: 4px;
}
.backlog-item-meta {
  display: flex; align-items: center; gap: 5px;
}
.backlog-item-period, .backlog-item-ref {
  font-size: 9px; color: var(--silver-d); flex: 1;
}
.backlog-item-crit { font-size: 9px; font-weight: 700; }
.backlog-regl-dot  { font-size: 9px; opacity: .7; }
.backlog-empty {
  font-size: 10.5px; color: var(--silver-d);
  padding: 14px 6px; font-style: italic; text-align: center;
}

/* Drag-over feedback sur les buckets */
.maint-bucket.bucket-drag-over {
  outline: 2px dashed rgba(39,121,212,0.6);
  outline-offset: -3px;
  background: rgba(39,121,212,0.07) !important;
}

/* Voyants */
.maint-voyant-group { display: flex; align-items: center; gap: 7px; }
.maint-voyant {
  width: 14px; height: 14px; border-radius: 50%;
  background: #5A6E8A; flex-shrink: 0;
  transition: background .4s, box-shadow .4s;
}
.maint-voyant-lbl { font-size: 11px; font-weight: 600; color: var(--silver-d); }

/* ─── Visualiser les actions dropdown ─── */
.nav-affichage-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.nav-affichage-btn {
  /* inherits .maint-btn-secondary; just add gap and arrow */
  display: flex !important; align-items: center; gap: 6px;
  white-space: nowrap;
}
.nav-affichage-btn.open { background: rgba(39,121,212,0.15) !important; color: #90C3F9 !important; border-color: rgba(39,121,212,0.35) !important; }
.nav-affichage-arrow {
  font-size: 9px; opacity: .6; transition: transform .18s, opacity .18s; margin-left: 2px;
}
.nav-affichage-btn.open .nav-affichage-arrow { transform: rotate(180deg); opacity: 1; }

.nav-affichage-menu {
  display: none; flex-direction: column;
  position: absolute; top: calc(100% + 6px); left: 0;
  background: #0D2340; border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px; padding: 5px 0; min-width: 170px; z-index: 9999;
  box-shadow: 0 12px 40px rgba(0,0,0,0.45);
  animation: ddFadeIn .14s ease;
}
.nav-affichage-menu.open { display: flex; }
@keyframes ddFadeIn { from { opacity:0; transform:translateY(-4px); } to { opacity:1; transform:none; } }

.nav-affichage-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 16px; font-size: 12px; font-weight: 500;
  color: var(--silver-d); cursor: pointer; transition: background .12s, color .12s;
}
.nav-affichage-item:hover { background: rgba(39,121,212,0.1); color: var(--white); }
.nav-affichage-item.active {
  color: #14C4A8; background: rgba(20,196,168,0.08);
  font-weight: 700;
}
.nav-aff-icon { font-size: 14px; width: 18px; text-align: center; flex-shrink: 0; }

/* Filter bar */
.maint-filterbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg-panel); flex-shrink: 0;
}
.maint-type-btns { display: flex; gap: 4px; }
.maint-type-btn {
  padding: 5px 12px; border-radius: 6px; font-size: 11px; font-weight: 600;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  color: var(--silver-d); cursor: pointer; transition: background .15s;
  display: flex; align-items: center; gap: 5px;
}
.maint-type-btn:hover  { background: rgba(255,255,255,0.08); }
.maint-type-btn.active { background: rgba(39,121,212,0.18); border-color: rgba(39,121,212,0.4); color: #90C3F9; }


.badge-p { display:inline-flex;align-items:center;justify-content:center; width:16px;height:16px;border-radius:4px; background:#14C4A8;color:#fff;font-size:10px;font-weight:700; }
.badge-c { display:inline-flex;align-items:center;justify-content:center; width:16px;height:16px;border-radius:4px; background:#F5A623;color:#fff;font-size:10px;font-weight:700; }

.maint-sel { padding:4px 8px; border-radius:6px; font-size:11px; background:rgba(255,255,255,0.05); border:1px solid var(--border); color:var(--white-d); cursor:pointer; }
.maint-search-inp { padding:4px 10px; border-radius:6px; font-size:11px; background:rgba(255,255,255,0.05); border:1px solid var(--border); color:var(--white); width:160px; }
.maint-show-done-lbl { font-size:11px; color:var(--silver-d); display:flex; align-items:center; gap:5px; cursor:pointer; }
.maint-btn-primary   { padding:6px 14px; border-radius:7px; font-size:12px; font-weight:600; background:var(--accent); border:none; color:#fff; cursor:pointer; }
.maint-btn-primary:hover { filter: brightness(1.1); }
.maint-btn-secondary { padding:6px 12px; border-radius:7px; font-size:11px; font-weight:600; background:rgba(255,255,255,0.06); border:1px solid var(--border); color:var(--white-d); cursor:pointer; }
.maint-btn-secondary:hover { background:rgba(255,255,255,0.1); }
.maint-btn-danger { padding:6px 12px; border-radius:7px; font-size:11px; font-weight:600; background:rgba(217,79,61,0.08); border:1px solid rgba(217,79,61,0.3); color:#D94F3D; cursor:pointer; transition: background .15s, border-color .15s; }
.maint-btn-danger:hover { background:rgba(217,79,61,0.18); border-color:rgba(217,79,61,0.55); }

/* ─── Calendrier maintenance ─── */
.maint-calendar {
  display: flex; flex: 1; overflow-x: auto; overflow-y: hidden;
  background: var(--border); gap: 1px;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.maint-bucket {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg-panel); min-height: 0;
  min-width: 185px; flex: 1; flex-shrink: 0;
  transition: background .15s;
}
.maint-bucket-hdr {
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
  padding: 7px 10px 6px; border-bottom: 2px solid var(--bcolor, #5A6E8A);
  flex-shrink: 0;
}
.maint-bucket-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--bcolor, #90A0B4); flex: 1;
}
.maint-bucket-date {
  font-size: 8.5px; color: var(--silver-d); opacity: .65;
  order: 3; width: 100%; line-height: 1; padding-top: 1px;
}
.maint-bucket-count {
  font-size: 9px; font-weight: 700; padding: 1px 6px; border-radius: 8px;
  background: rgba(255,255,255,0.08); color: var(--silver-d);
  min-width: 18px; text-align: center; flex-shrink: 0;
}
.maint-bucket-body {
  flex: 1; overflow-y: auto; padding: 6px;
  display: flex; flex-direction: column; gap: 5px;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.bucket-empty {
  text-align: center; color: var(--silver-d); font-size: 10px;
  padding: 18px 6px; font-style: italic; opacity: .55;
  border: 1px dashed rgba(255,255,255,0.08); border-radius: 6px; margin: 4px;
}

/* ─── Calendrier mensuel view ─── */
.maint-cal {
  flex: 1; display: flex; overflow: hidden; min-height: 0;
}
.maint-cal-left {
  display: flex; flex-direction: column; padding: 20px 24px;
  border-right: 1px solid var(--border-l); flex-shrink: 0;
  width: 340px; gap: 14px;
}
.maint-cal-nav {
  display: flex; align-items: center; justify-content: space-between;
}
.maint-cal-nav-btn {
  background: rgba(255,255,255,0.05); border: 1px solid var(--border-l);
  color: var(--white-d); border-radius: 6px; width: 28px; height: 28px;
  font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .14s;
}
.maint-cal-nav-btn:hover { background: rgba(255,255,255,0.1); }
.maint-cal-month-title {
  font-size: 15px; font-weight: 700; color: var(--white);
}
.maint-cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
}
.cal-wh {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--silver-d);
  text-align: center; padding: 4px 0 6px;
}
.cal-day {
  display: flex; flex-direction: column; align-items: center;
  padding: 5px 2px 4px; border-radius: 7px; cursor: pointer;
  transition: background .12s; min-height: 46px; position: relative;
}
.cal-day:hover { background: rgba(255,255,255,0.05); }
.cal-day-empty { cursor: default; pointer-events: none; }
.cal-day-num {
  font-size: 12px; font-weight: 500; color: var(--white-d); line-height: 1;
  width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
}
.cal-today .cal-day-num {
  background: #2779D4; color: #fff; font-weight: 700;
  box-shadow: 0 0 0 2px rgba(39,121,212,0.3);
}
.cal-selected .cal-day-num {
  background: rgba(39,121,212,0.2); color: #90C3F9;
  outline: 1px solid rgba(39,121,212,0.5);
}
.cal-has-tasks .cal-day-num { font-weight: 700; }
.cal-dots {
  display: flex; gap: 2px; margin-top: 3px; flex-wrap: wrap;
  justify-content: center; max-width: 30px;
}
.cal-dot {
  width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0;
}
.maint-cal-legend {
  display: flex; gap: 14px; flex-wrap: wrap;
}
.maint-cal-leg-item {
  display: flex; align-items: center; gap: 4px;
  font-size: 10px; color: var(--silver-d);
}
.maint-cal-leg-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}

/* Calendar right panel */
.maint-cal-right {
  flex: 1; display: flex; flex-direction: column; overflow-y: auto; min-width: 0;
  padding: 20px 20px; gap: 0;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.cal-r-hdr {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--silver-d); display: flex; align-items: center; gap: 8px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border-l); margin-bottom: 10px;
}
.cal-r-count {
  font-size: 9px; font-weight: 700; padding: 1px 7px; border-radius: 9px;
  background: rgba(255,255,255,0.08); color: var(--silver-d);
}
.cal-r-sec {
  font-size: 10px; font-weight: 700; color: #D94F3D; padding: 6px 0 4px;
  text-transform: uppercase; letter-spacing: .05em;
}
.cal-r-empty {
  font-size: 12px; color: var(--silver-d); font-style: italic;
  text-align: center; padding: 32px 0; opacity: .5;
}
.cal-task-card {
  padding: 11px 14px; border-radius: 9px; margin-bottom: 8px;
  background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.07);
  cursor: pointer; transition: background .13s, border-color .13s;
}
.cal-task-card:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.12); }
.cal-task-retard { border-left: 3px solid #D94F3D; }
.cal-task-type {
  display: flex; align-items: center; gap: 6px;
  font-size: 10px; color: var(--silver-d); margin-bottom: 5px;
}
.cal-task-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.cal-task-titre {
  font-size: 13px; font-weight: 700; color: var(--white);
  line-height: 1.3; margin-bottom: 7px;
}
.cal-task-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 10.5px;
}
.cal-task-equip { color: var(--silver-d); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-task-date  { color: #2779D4; font-weight: 600; flex-shrink: 0; }

/* ─── Planning view ─── */
.maint-planning {
  flex: 1; overflow: hidden; display: flex; flex-direction: column; min-height: 0;
}
.maint-planning-body {
  flex: 1; overflow-y: auto; padding: 16px 20px;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.plan-month-hdr {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; margin: 16px 0 4px;
  background: rgba(255,255,255,0.03); border-left: 3px solid var(--mcolor, #5A6E8A);
  border-radius: 0 5px 5px 0;
}
.plan-month-hdr:first-child { margin-top: 0; }
.plan-hdr-retard { --mcolor: #D94F3D; background: rgba(217,79,61,0.07); }
.plan-month-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--mcolor, #90A0B4); flex: 1;
}
.plan-month-count {
  font-size: 9px; font-weight: 700; padding: 1px 7px; border-radius: 9px;
  background: rgba(255,255,255,0.08); color: var(--silver-d);
}
.plan-month-tasks { display: flex; flex-direction: column; gap: 2px; margin-bottom: 4px; }
.plan-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 6px; cursor: pointer;
  transition: background .12s; border: 1px solid transparent;
}
.plan-row:hover { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.07); }
.plan-row-retard { border-left: 2px solid rgba(217,79,61,0.5); }
.plan-row-done   { opacity: .45; }
.plan-row-date   { font-size: 10px; font-weight: 700; color: #6B8099; width: 54px; flex-shrink: 0; font-family: 'JetBrains Mono', monospace; }
.plan-row-titre  { flex: 1; font-size: 12px; font-weight: 600; color: var(--white); }
.plan-row-equip  { font-size: 10px; color: var(--silver-d); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-row-regl   { font-size: 11px; opacity: .7; flex-shrink: 0; }
.plan-row-dot    { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.plan-row-done-btn {
  padding: 2px 6px; border-radius: 4px; font-size: 10px;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  color: var(--silver-d); cursor: pointer; flex-shrink: 0; transition: background .12s;
}
.plan-row-done-btn:hover { background: rgba(20,196,168,0.2); color: #14C4A8; }
.plan-empty {
  text-align: center; color: var(--silver-d); font-size: 13px;
  padding: 48px 0; font-style: italic; opacity: .5;
}

/* ─── Liste view ─── */
.maint-liste {
  flex: 1; overflow: hidden; display: flex; flex-direction: column; min-height: 0;
}
.maint-liste-body {
  flex: 1; overflow-y: auto; padding: 12px 16px;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.liste-header {
  display: grid;
  grid-template-columns: 110px 22px 1fr 160px 18px 90px 36px;
  gap: 8px; align-items: center;
  padding: 5px 10px 7px; border-bottom: 1px solid var(--border-l);
  margin-bottom: 4px;
}
.liste-header > span {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: var(--silver-d);
}
.liste-row {
  display: grid;
  grid-template-columns: 110px 22px 1fr 160px 18px 90px 36px;
  gap: 8px; align-items: center;
  padding: 7px 10px; border-radius: 6px; cursor: pointer;
  transition: background .12s; border: 1px solid transparent;
}
.liste-row:hover      { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.07); }
.liste-row-retard     { border-left: 2px solid rgba(217,79,61,0.5); }
.liste-row-done       { opacity: .45; }
.liste-row-date       { font-size: 11px; font-weight: 600; color: #6B8099; font-family: 'JetBrains Mono', monospace; }
.liste-row-titre      { font-size: 12px; font-weight: 600; color: var(--white); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.liste-row-equip      { font-size: 10.5px; color: var(--silver-d); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.liste-regl           { font-size: 11px; opacity: .7; }
.liste-row-status     { font-size: 10px; font-weight: 600; }
.liste-row-done-btn   {
  padding: 2px 6px; border-radius: 4px; font-size: 10px;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  color: var(--silver-d); cursor: pointer; transition: background .12s; justify-self: end;
}
.liste-row-done-btn:hover { background: rgba(20,196,168,0.2); color: #14C4A8; }
.liste-empty {
  text-align: center; color: var(--silver-d); font-size: 13px;
  padding: 48px 0; font-style: italic; opacity: .5;
}

/* Task card */
.task-card {
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.task-card:hover     { background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.12); }
.task-card.task-done { opacity: .5; }
.task-card.task-overdue { border-left: 3px solid #D94F3D; }

.task-card-top { display: flex; align-items: flex-start; gap: 7px; }
.task-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; border-radius: 4px;
  font-size: 10px; font-weight: 700; flex-shrink: 0; margin-top: 1px;
}
.task-badge.badge-p { background: rgba(20,196,168,0.25); color: #14C4A8; }
.task-badge.badge-c { background: rgba(245,166,35,0.25); color: #F5A623; }
.task-titre { flex: 1; font-size: 12px; font-weight: 600; color: var(--white); line-height: 1.35; }
.task-done-btn {
  padding: 2px 6px; border-radius: 5px; font-size: 11px;
  background: rgba(20,196,168,0.15); border: 1px solid rgba(20,196,168,0.3);
  color: #14C4A8; cursor: pointer; flex-shrink: 0;
  transition: background .15s;
}
.task-done-btn:hover { background: rgba(20,196,168,0.3); }
.task-equip { font-size: 11px; color: var(--silver-d); padding-left: 24px; margin-top: 2px; }
.task-meta  { display: flex; align-items: center; gap: 8px; padding-left: 24px; margin-top: 4px; font-size: 10px; color: #6B8099; }
.task-status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.task-regl-tag { background: rgba(20,196,168,0.12); border: 1px solid rgba(20,196,168,0.2); border-radius: 4px; padding: 0 5px; font-size: 9px; color: #14C4A8; }

/* Modal */
.maint-modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  z-index: 1200; display: flex; align-items: center; justify-content: center;
}
.maint-modal-panel {
  background: var(--navy-mid, #0F2340); border: 1px solid var(--border); border-radius: 14px;
  width: 100%; max-width: 600px; max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden;
}
.maint-modal-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  font-size: 14px; font-weight: 700; color: var(--white); flex-shrink: 0;
}
.maint-modal-body { overflow-y: auto; padding: 16px 20px; flex: 1; }
.maint-modal-ftr  {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; border-top: 1px solid var(--border); flex-shrink: 0;
}
.maint-modal-close-btn { background: none; border: none; color: var(--silver-d); font-size: 16px; cursor: pointer; padding: 4px; }

/* Modal fields — shared with other modules */
.modal-section {
  padding-bottom: 16px; margin-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.modal-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.modal-sec-title {
  font-size: 11px; font-weight: 700; color: var(--silver-d);
  text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 10px;
}
.modal-row { display: flex; gap: 12px; margin-bottom: 10px; }
.modal-row:last-child { margin-bottom: 0; }
.modal-row-2 > .modal-field { flex: 1; }
.modal-row-3 > .modal-field { flex: 1; }
.modal-field { display: flex; flex-direction: column; gap: 4px; }
.modal-lbl { font-size: 11px; font-weight: 600; color: var(--silver-d); }
.modal-required { color: #D94F3D; }
.modal-inp {
  padding: 7px 10px; border-radius: 6px; font-size: 13px;
  background: rgba(255,255,255,0.05); color: var(--white);
  border: 1px solid var(--border); outline: none;
  font-family: 'Inter', sans-serif;
}
.modal-inp:focus { border-color: #2779D4; }
.modal-sel { cursor: pointer; }
.modal-sel option { background: #0D2340; color: #EEF2F7; }
.modal-ta  { resize: vertical; min-height: 60px; }

.modal-section-regl { display: flex; flex-direction: column; }
.modal-regl-toggle  { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.modal-regl-toggle input { accent-color: #2779D4; width: 15px; height: 15px; cursor: pointer; }
.modal-regl-lbl { font-size: 13px; color: var(--silver); }

/* ── Multi-select équipements (modal tâche) ───────────────── */
.mt-msel {
  border: 1px solid var(--border); border-radius: 8px;
  background: rgba(255,255,255,0.03); overflow: hidden;
}
.mt-msel-tout-row {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; cursor: pointer;
  background: rgba(39,121,212,0.08);
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.mt-msel-tout-row:hover { background: rgba(39,121,212,0.15); }
.mt-msel-tout-row input[type=checkbox] {
  accent-color: #2779D4; width: 14px; height: 14px; cursor: pointer; flex-shrink: 0;
}
.mt-msel-tout-label { font-size: 13px; font-weight: 600; color: var(--white); }
.mt-msel-tout-sub   { font-size: 11px; color: var(--silver-d); margin-left: auto; }
.mt-msel-search {
  display: block; width: 100%; box-sizing: border-box;
  padding: 7px 12px 7px 32px; font-size: 12px;
  background: rgba(255,255,255,0.04); color: var(--silver);
  border: none; border-bottom: 1px solid var(--border);
  border-radius: 0; outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236B8099' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 10px center;
}
.mt-msel-search::placeholder { color: var(--silver-d); }
.mt-msel-search:focus { background-color: rgba(39,121,212,0.06); color: var(--white); }
.mt-msel-list {
  max-height: 220px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.mt-msel-list::-webkit-scrollbar { width: 4px; }
.mt-msel-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }
.mt-msel-group { padding-bottom: 4px; }
.mt-msel-group-hdr {
  padding: 5px 12px 3px; font-size: 10px; font-weight: 700;
  color: var(--silver-d); letter-spacing: .5px; text-transform: uppercase;
  background: rgba(255,255,255,0.025); border-bottom: 1px solid rgba(255,255,255,0.04);
  position: sticky; top: 0; z-index: 1;
}
.mt-msel-item-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; cursor: pointer;
  transition: background .1s;
}
.mt-msel-item-row:hover { background: rgba(255,255,255,0.05); }
.mt-msel-item-row input[type=checkbox] {
  accent-color: #2779D4; width: 13px; height: 13px; cursor: pointer; flex-shrink: 0;
}
.mt-msel-item-name { font-size: 12px; color: var(--silver); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt-msel-item-sub  { font-size: 10px; color: var(--silver-d); flex-shrink: 0; }
.mt-msel-empty     { padding: 16px 12px; font-size: 12px; color: var(--silver-d); text-align: center; line-height: 1.5; }
.mt-msel-count {
  padding: 5px 12px; font-size: 11px; color: var(--silver-d);
  border-top: 1px solid var(--border); background: rgba(255,255,255,0.02);
  min-height: 24px;
}
.mt-msel-count.has-sel { color: #2779D4; font-weight: 600; }

/* ── Modal techniciens ──────────────────────────────────────── */
.tech-modal-panel   { max-width: 800px !important; }
.tech-modal-grid    { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.tech-modal-sec-ttl { font-size: 10px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase;
                      color: var(--silver-d); margin-bottom: 10px; }
/* ─ Liste */
.tech-list       { display: flex; flex-direction: column; gap: 6px; max-height: 380px; overflow-y: auto;
                   scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.08) transparent; }
.tech-list::-webkit-scrollbar { width: 4px; }
.tech-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }
.tech-list-empty { padding: 24px 16px; text-align: center; color: var(--silver-d); font-size: 12px;
                   line-height: 1.7; background: rgba(255,255,255,0.02);
                   border: 1px dashed var(--border); border-radius: 8px; }
.tech-card       { display: flex; align-items: center; gap: 10px; padding: 10px 12px;
                   background: rgba(255,255,255,0.03); border: 1px solid var(--border);
                   border-radius: 8px; transition: background .15s; }
.tech-card:hover { background: rgba(255,255,255,0.06); }
.tech-card-active { border-color: #2779D4 !important; background: rgba(39,121,212,0.08) !important; }
.tech-card-info  { flex: 1; min-width: 0; }
.tech-card-name  { font-size: 13px; font-weight: 600; color: var(--white); }
.tech-card-role  { font-size: 11px; color: var(--silver-d); margin-top: 2px; }
.tech-card-dates { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.tech-badge      { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 4px; }
.tech-badge-rda  { background: rgba(39,121,212,0.15); color: #7BAAED; }
.tech-badge-rcg  { background: rgba(20,196,168,0.15); color: #14C4A8; }
.tech-card-btns  { display: flex; gap: 5px; flex-shrink: 0; }
.tech-btn        { padding: 5px 9px; border: 1px solid var(--border); border-radius: 5px;
                   background: rgba(255,255,255,0.04); color: var(--silver); cursor: pointer;
                   font-size: 13px; transition: background .15s, color .15s; }
.tech-btn:hover         { background: rgba(255,255,255,0.1); color: var(--white); }
.tech-btn-danger:hover  { background: rgba(217,79,61,0.12); color: #D94F3D; border-color: rgba(217,79,61,0.3); }
/* ─ Formulaire */
.tech-form       { display: flex; flex-direction: column; gap: 12px; }
.tech-date-block { padding: 10px 12px; background: rgba(255,255,255,0.025);
                   border: 1px solid var(--border); border-radius: 8px;
                   display: flex; flex-direction: column; gap: 8px; }
.tech-date-chk-row { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.tech-date-chk-row input[type=checkbox] { accent-color: #2779D4; width: 14px; height: 14px; cursor: pointer; }
.tech-date-lbl   { font-size: 12px; font-weight: 600; color: var(--silver); }
.tech-date-inp   { transition: opacity .2s; }
.tech-form-btns  { display: flex; gap: 8px; justify-content: flex-end; }

/* Periodicity table */
.period-table-wrap { overflow-x: auto; }
.period-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.period-table th { padding: 7px 10px; background: rgba(255,255,255,0.04); border-bottom: 1px solid var(--border); font-size: 10px; font-weight: 700; color: var(--silver-d); text-align: left; white-space: nowrap; }
.period-table td { padding: 6px 8px; border-bottom: 1px solid rgba(255,255,255,0.04); vertical-align: middle; }
.period-td-lbl  { font-weight: 600; color: var(--white-d); white-space: nowrap; }
.period-td-int  { display: flex; gap: 4px; align-items: center; }
.period-row-disabled td { opacity: .45; }
.period-table .modal-inp { padding: 4px 6px; font-size: 11px; }

/* ═══════════════════════════════════════════════════════════
   SVG PIPE GROUP & LABEL
   ═══════════════════════════════════════════════════════════ */

.pipe-group { cursor: pointer; }
.pipe-group .pipe-line {
  stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round;
  transition: stroke-width .12s;
}
.pipe-group.selected .pipe-line { stroke-width: 5.5; filter: drop-shadow(0 0 4px currentColor); }
.pipe-group:hover .pipe-line    { stroke-width: 5; }
.pipe-hit   { cursor: pointer; }

/* Anomaly marker */
.pipe-anom-marker { cursor: grab; }
.pipe-anom-marker:active { cursor: grabbing; }
.pipe-anom-marker .anom-marker-dot {
  filter: drop-shadow(0 1px 4px rgba(0,0,0,.6));
}
.anom-anchor-dot { transition: r 0.1s ease; }
.anom-anchor-handle:hover .anom-anchor-dot { r: 6; }
.anom-leader { pointer-events: none; }
.anom-btn { cursor: grab; }
.anom-btn:active { cursor: grabbing; }

/* Souterrain = dashed line */
.pipe-souterrain .pipe-line { stroke-dasharray: 10 6; }

/* ═══════════════════════════════════════════════════════════
   PIPE FICHE PANEL
   ═══════════════════════════════════════════════════════════ */

.pipe-fiche-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 340px; background: var(--navy-mid);
  border-left: 1px solid var(--border-l);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .22s ease;
  z-index: 20; overflow: hidden;
}
.pipe-fiche-panel.open { transform: translateX(0); }

.pipe-fiche-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,0.08);
  background: var(--navy-light); flex-shrink: 0; gap: 8px;
}
.pipe-fiche-header-left  { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pipe-fiche-icon  { font-size: 22px; flex-shrink: 0; }
.pipe-fiche-title { font-size: 15px; font-weight: 700; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pipe-fiche-sub   { font-size: 11px; color: var(--silver); margin-top: 2px; }
.pipe-fiche-header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.pipe-statut-badge { font-size: 11px; font-weight: 700; }

.pipe-fiche-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 12px 16px;
  display: flex; flex-direction: column; gap: 0;
}
.pipe-fiche-body::-webkit-scrollbar { width: 5px; }
.pipe-fiche-body::-webkit-scrollbar-track { background: rgba(0,0,0,0.1); }
.pipe-fiche-body::-webkit-scrollbar-thumb { background: var(--border-l); border-radius: 3px; }
.pipe-fiche-body::-webkit-scrollbar-thumb:hover { background: var(--silver-d); }

.pf-section {
  padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.05);
}
.pf-section:last-child { border-bottom: none; }
.pf-sec-body { display: flex; flex-direction: column; gap: 10px; padding-top: 6px; }

.pf-section-title {
  font-size: 10px; font-weight: 700; color: var(--silver-d);
  text-transform: uppercase; letter-spacing: .6px;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; user-select: none;
  transition: color var(--transition);
}
.pf-section-title:hover { color: var(--white-d); }
.pf-section-title-row {
  display: flex; align-items: center; justify-content: space-between;
}
.pf-add-anom-btn {
  font-size: 11px; padding: 3px 10px; border-radius: 5px; cursor: pointer;
  background: rgba(39,121,212,0.2); color: var(--cobalt-xl);
  border: 1px solid rgba(39,121,212,0.3); transition: background .15s;
}
.pf-add-anom-btn:hover { background: rgba(39,121,212,0.35); }

/* ─── RELEVÉS DE MESURES — liste dans fiche ───────────────────────────────── */
.ms-empty { color: var(--silver); font-size: 11px; padding: 6px 0; text-align: center; }

.ms-item {
  background: rgba(9,18,32,0.55);
  border: 1px solid var(--border-l);
  border-radius: 7px;
  padding: 8px 10px;
  margin-bottom: 7px;
}
.ms-item:last-child { margin-bottom: 0; }
.ms-item-hd {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 5px;
}
.ms-date { font-size: 10.5px; font-weight: 600; color: var(--white); font-family: 'JetBrains Mono', monospace; }
.ms-op   { font-size: 10px; color: var(--silver); flex: 1; }
.ms-edit-btn {
  font-size: 12px; cursor: pointer; padding: 2px 7px;
  background: rgba(39,121,212,0.15); border: 1px solid rgba(39,121,212,0.25);
  color: #7DB4FF; border-radius: 4px; transition: background .12s;
}
.ms-edit-btn:hover { background: rgba(39,121,212,0.3); }

.ms-row {
  display: flex; align-items: baseline; gap: 6px;
  font-size: 10.5px; padding: 2px 0;
  border-top: 1px solid rgba(255,255,255,0.04);
}
.ms-row:first-of-type { border-top: none; }
.ms-lbl  { color: var(--silver); min-width: 120px; flex-shrink: 0; }
.ms-val  { font-weight: 700; color: var(--white); font-family: 'JetBrains Mono', monospace; font-size: 11px; }
.ms-delta-wrap { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.ms-theo { color: var(--silver-d); font-size: 9.5px; }
.ms-notes { font-size: 10px; color: var(--silver); margin-top: 5px; font-style: italic; }

/* Couleurs delta */
.ms-delta-ok   { color: #14C4A8; font-size: 10px; font-weight: 600; }
.ms-delta-warn { color: #F5A623; font-size: 10px; font-weight: 600; }
.ms-delta-bad  { color: #D94F3D; font-size: 10px; font-weight: 600; }

/* ─── MODAL RELEVÉ DE MESURES ─────────────────────────────────────────────── */
.ms-modal-bg {
  position: fixed; inset: 0; z-index: 3100;
  background: rgba(0,0,0,0.65);
  display: flex; align-items: center; justify-content: center;
}
.ms-modal {
  background: var(--navy-card);
  border: 1px solid var(--border-l);
  border-radius: 14px;
  width: 480px; max-width: 95vw;
  max-height: 88vh; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  overflow: hidden;
}
.ms-modal-hd {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border-l);
  flex-shrink: 0;
}
.ms-modal-hd-icon { font-size: 22px; }
.ms-modal-title { font-size: 15px; font-weight: 700; color: var(--white); }
.ms-modal-sub   { font-size: 11px; color: var(--silver); margin-top: 1px; }
.ms-modal-body  { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.ms-modal-ft    {
  display: flex; align-items: center; gap: 8px; justify-content: flex-end;
  padding: 12px 20px; border-top: 1px solid var(--border-l); flex-shrink: 0;
}
.ms-modal-ft .btn-danger { margin-right: auto; }

.ms-modal-section {}
.ms-modal-sec-title {
  font-size: 9.5px; font-weight: 700; color: var(--silver);
  text-transform: uppercase; letter-spacing: .6px;
  margin-bottom: 8px; padding-bottom: 4px;
  border-bottom: 1px solid var(--border-l);
}
.ms-modal-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ms-modal-fields-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ms-modal-field { display: flex; flex-direction: column; gap: 4px; }
.ms-modal-lbl { font-size: 10px; color: var(--silver); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.ms-modal-input-wrap { display: flex; align-items: center; gap: 0; }
.ms-modal-inp {
  background: var(--navy); color: var(--white);
  border: 1px solid var(--border-l); border-radius: 5px 0 0 5px;
  padding: 6px 8px; font-size: 12px; font-family: inherit;
  width: 100%; transition: border-color .15s;
}
.ms-modal-inp:focus { outline: none; border-color: var(--cobalt-l); }
.ms-modal-sel { border-radius: 5px; }
.ms-modal-unit {
  background: rgba(39,121,212,0.1); border: 1px solid var(--border-l); border-left: none;
  border-radius: 0 5px 5px 0; padding: 6px 8px;
  font-size: 10px; color: var(--silver); white-space: nowrap; flex-shrink: 0;
}
.ms-theo-hint { font-size: 9.5px; color: var(--silver-d); }
.ms-modal-textarea {
  background: var(--navy); color: var(--white);
  border: 1px solid var(--border-l); border-radius: 5px;
  padding: 8px; font-size: 12px; font-family: inherit;
  width: 100%; resize: vertical; transition: border-color .15s;
}
.ms-modal-textarea:focus { outline: none; border-color: var(--cobalt-l); }

.pf-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pf-row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.pf-row-longueur { display: grid; grid-template-columns: 90px 1fr; gap: 10px; }
.pf-field { display: flex; flex-direction: column; gap: 4px; }
.pf-field label { font-size: 10px; color: var(--silver); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }

/* Wrapper champ pression de service */
.pf-pression-wrap {
  display: flex; align-items: center; gap: 4px;
}
.pf-pression-wrap .pf-input { flex: 1; }
.pf-pression-reset-btn {
  flex-shrink: 0;
  background: rgba(39,121,212,0.12);
  border: 1px solid rgba(39,121,212,0.3);
  color: #7DB4FF;
  border-radius: 5px;
  width: 28px; height: 28px;
  font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.pf-pression-reset-btn:hover {
  background: rgba(39,121,212,0.25);
  color: #acd4ff;
}
/* Indicateur sous le champ pression */
.pf-pression-status {
  font-size: 9.5px; margin-top: 2px; display: flex; align-items: center; gap: 4px;
}
.pf-ps-auto { color: #14C4A8; }   /* vert = sync réseau */
.pf-ps-override { color: #9BAABF; } /* gris = valeur manuelle */
.pf-input.pf-auto-mode { border-color: rgba(20,196,168,0.35); }

/* Bandeau pression réseau théorique — référence (mode override) */
.pf-network-pressure-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; margin: 6px 0 2px;
  background: rgba(20,196,168,0.07);
  border: 1px solid rgba(20,196,168,0.2);
  border-radius: 6px;
}
.pf-np-label { font-size: 10px; font-weight: 600; color: var(--silver); text-transform: uppercase; letter-spacing: .4px; flex: 1; }
.pf-np-value { font-size: 13px; font-weight: 700; color: #14C4A8; font-family: 'JetBrains Mono', monospace; }

.pf-input, .pf-select, .pf-textarea {
  background: var(--navy-card); color: var(--white);
  border: 1px solid var(--border-l); border-radius: 5px;
  padding: 6px 8px; font-size: 12px; font-family: inherit;
  transition: border-color .15s;
}
.pf-input:focus, .pf-select:focus, .pf-textarea:focus { outline: none; border-color: var(--cobalt-l); }
.pf-select option { background: var(--navy-card); color: var(--white); }
.pf-textarea { resize: vertical; }

/* Anomalies list */
.pf-anom-empty { font-size: 12px; color: var(--silver-d); text-align: center; padding: 16px 0; }
.pf-anom-item {
  padding: 9px 10px; border-radius: 7px; margin-bottom: 7px;
  border: 1px solid rgba(255,255,255,0.06); background: rgba(255,255,255,0.03);
}
.pf-anom-item.anom-ouvert   { border-left: 3px solid #D94F3D; }
.pf-anom-item.anom-en-cours { border-left: 3px solid #F5A623; }
.pf-anom-item.anom-clos     { border-left: 3px solid #5A6E8A; opacity: .7; }
.pf-anom-top {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.pf-anom-type   { font-size: 11px; font-weight: 600; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.pf-anom-fam    { font-size: 9px; font-weight: 400; opacity: 0.65; letter-spacing: 0.5px; text-transform: uppercase; }
.pf-anom-date   { font-size: 10px; color: var(--silver); }
.pf-anom-statut { font-size: 10px; color: var(--silver-d); padding: 2px 6px; background: rgba(255,255,255,0.06); border-radius: 10px; }
.pf-anom-del    { background: none; border: none; color: var(--silver-d); cursor: pointer; font-size: 12px; padding: 0 2px; }
.pf-anom-del:hover { color: #D94F3D; }
.pf-anom-desc   { font-size: 11px; color: var(--white-d); margin-top: 5px; line-height: 1.4; }

/* Clickable anomaly list row */
.pf-anom-clickable { cursor: pointer; transition: background .13s; }
.pf-anom-clickable:hover { background: rgba(255,255,255,0.05); }
.pf-anom-chevron { margin-left: auto; color: var(--silver-d); font-size: 14px; opacity: .6; }
.pf-anom-ref    { font-size: 10px; font-weight: 700; color: var(--silver-d); letter-spacing: .4px; flex-shrink: 0; }
.pf-anom-danger         { font-size: 10px; font-weight: 700; flex-shrink: 0; }
.pf-anom-quadrant-badge { font-size: 9px; font-weight: 700; letter-spacing: .4px; flex-shrink: 0;
                          padding: 1px 5px; border-radius: 4px; background: rgba(255,255,255,0.06); }

/* Anomaly detail modal */
.anom-detail-panel {
  background: #0D2340;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  width: 620px;
  max-width: 96vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,0.55);
  animation: secModalIn .18s ease;
}
.anom-detail-body { overflow-y: auto; }
.anom-detail-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.anom-detail-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; font-weight: 700; color: var(--white-d);
}
.anom-detail-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.anom-detail-body {
  padding: 20px; display: flex; flex-direction: column; gap: 16px;
}
.anom-detail-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.anom-detail-del-btn {
  background: rgba(217,79,61,.12);
  border: 1px solid rgba(217,79,61,.3);
  color: #D94F3D; padding: 7px 14px; border-radius: 6px;
  font-size: 12px; cursor: pointer; transition: background .15s;
}
.anom-detail-del-btn:hover { background: rgba(217,79,61,.25); }

/* ── Photo upload — grid + focus ── */
.anom-photos-header {
  display: flex; align-items: center; justify-content: space-between;
}
.anom-count-badge {
  font-weight: 400; color: #5E728A; margin-left: 4px;
}
.anom-add-photo-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 6px; cursor: pointer;
  background: rgba(99,179,237,0.12); border: 1px solid rgba(99,179,237,0.3);
  color: #63B3ED; font-size: 12px; font-weight: 600;
  transition: background .15s;
}
.anom-add-photo-btn:hover { background: rgba(99,179,237,0.22); }
.anom-photos-grid {
  display: flex; flex-wrap: wrap; gap: 8px; min-height: 66px;
}
.anom-grid-thumb {
  position: relative; width: 88px; height: 66px;
  border-radius: 6px; overflow: hidden;
  background: rgba(8,17,30,0.5);
  border: 1px solid rgba(255,255,255,0.08);
}
.anom-grid-img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.anom-grid-del {
  position: absolute; top: 3px; right: 3px;
  width: 17px; height: 17px; border-radius: 50%;
  background: rgba(217,79,61,0.88); border: none;
  color: #fff; font-size: 8px; cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s;
}
.anom-grid-thumb:hover .anom-grid-del { opacity: 1; }

/* Focus row */
.anom-focus-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.07);
}
.anom-focus-slot { display: flex; flex-direction: column; gap: 6px; }
.anom-focus-hd {
  display: flex; align-items: center; justify-content: space-between;
}
.anom-focus-btns { display: flex; align-items: center; gap: 5px; }
.anom-focus-btn {
  padding: 3px 8px; border-radius: 5px; font-size: 11px; font-weight: 500;
  cursor: pointer; border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06); color: #9BAABF;
  transition: background .13s, color .13s;
}
.anom-focus-btn:hover { background: rgba(255,255,255,0.12); color: #EEF2F7; }
.anom-focus-btn.danger { border-color: rgba(217,79,61,.3); color: #D94F3D; background: rgba(217,79,61,.08); }
.anom-focus-btn.danger:hover { background: rgba(217,79,61,.2); }
.anom-focus-canvas-area {
  position: relative; width: 100%;
  aspect-ratio: 4/3;
  border: 1.5px dashed rgba(94,114,138,0.4);
  border-radius: 7px; overflow: hidden;
  background: rgba(8,17,30,0.55);
}
.anom-focus-canvas {
  width: 100%; height: 100%;
  display: block; cursor: crosshair;
}
.anom-focus-empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px; cursor: pointer;
  color: #5E728A; transition: color .15s, background .15s;
}
.anom-focus-empty:hover { color: #9BAABF; background: rgba(255,255,255,0.03); }
.anom-photo-plus { font-size: 22px; line-height: 1; }
.anom-photo-hint { font-size: 10px; font-weight: 500; }
.anom-focus-tip {
  font-size: 10px; color: #5E728A; text-align: center;
  font-style: italic;
}

/* ─── SONDAGE (trous de sondage pour fuite souterraine) ─────────────────────── */
#adm-sondage-section {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 14px;
  background: rgba(39,121,212,0.06);
  border: 1px solid rgba(39,121,212,0.18);
  border-radius: 8px;
}
.adm-sondage-cb-row {
  display: flex; align-items: center; gap: 9px;
  font-size: 12px; font-weight: 600; color: #9BAABF;
  cursor: pointer; user-select: none;
}
.adm-sondage-cb-row input[type="checkbox"] {
  width: 15px; height: 15px; cursor: pointer; accent-color: #2779D4;
}
#adm-sondage-panel {
  display: flex; flex-direction: column; gap: 10px; margin-top: 4px;
}
.adm-sondage-add-trou {
  align-self: flex-start;
  padding: 5px 12px; border-radius: 6px; font-size: 11px; font-weight: 600;
  background: rgba(39,121,212,0.14); border: 1px solid rgba(39,121,212,0.3);
  color: #63B3ED; cursor: pointer; transition: background .15s;
}
.adm-sondage-add-trou:hover { background: rgba(39,121,212,0.25); }
.adm-sondage-empty {
  font-size: 11px; color: #5E728A; font-style: italic; margin: 0; padding: 4px 0;
}
.adm-trou-block {
  background: rgba(8,17,30,0.5);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 7px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 7px;
}
.adm-trou-header {
  display: flex; align-items: center; justify-content: space-between;
}
.adm-trou-label {
  font-size: 12px; font-weight: 700; color: #63B3ED; letter-spacing: 0.5px;
}
.adm-trou-del {
  background: none; border: none; color: #5E728A; cursor: pointer;
  font-size: 12px; padding: 0 4px; line-height: 1;
  transition: color .15s;
}
.adm-trou-del:hover { color: #D94F3D; }
.adm-ctl-head-row {
  display: grid; grid-template-columns: 80px 1fr 110px 82px 28px;
  gap: 6px; align-items: center;
  font-size: 9px; font-weight: 700; color: #5E728A;
  text-transform: uppercase; letter-spacing: .5px;
  padding: 0 2px;
}
.adm-ctl-row {
  display: grid; grid-template-columns: 80px 1fr 110px 82px 28px;
  gap: 6px; align-items: center;
}
.adm-ctl-date { width: 100%; font-size: 12px; }
.adm-ctl-num {
  font-size: 11px; font-weight: 700; color: #9BAABF;
  white-space: nowrap;
}
.adm-ctl-indice { width: 100%; }
.adm-ctl-horaire { width: 100%; font-size: 12px; }
.adm-ctl-del {
  background: none; border: none; color: #5E728A; cursor: pointer;
  font-size: 11px; padding: 0; justify-self: center; line-height: 1;
  transition: color .15s;
}
.adm-ctl-del:hover { color: #D94F3D; }
.adm-sondage-add-ctl {
  align-self: flex-start; margin-top: 2px;
  padding: 3px 10px; border-radius: 5px; font-size: 10px; font-weight: 600;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  color: #9BAABF; cursor: pointer; transition: background .15s;
}
.adm-sondage-add-ctl:hover { background: rgba(255,255,255,0.1); color: #EEF2F7; }

/* ─── RISK MATRIX (anomalie fuite) ──────────────────────────────────────────── */
#adm-risk-matrix {
  display: flex; flex-direction: column; gap: 6px;
  padding: 12px 14px;
  background: rgba(217,79,61,0.05);
  border: 1px solid rgba(217,79,61,0.15);
  border-radius: 8px;
}
.adm-risk-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
}
.adm-risk-table thead th {
  padding: 6px 12px; font-size: 10px; font-weight: 700;
  color: #5E728A; text-transform: uppercase; letter-spacing: .5px;
  text-align: center; border-bottom: 1px solid rgba(255,255,255,0.08);
}
.adm-risk-table thead th:first-child { text-align: left; }
.adm-risk-table tbody tr { border-bottom: 1px solid rgba(255,255,255,0.05); }
.adm-risk-table tbody tr:last-child { border-bottom: none; }
.adm-risk-table tbody td {
  padding: 8px 12px; font-size: 12px; color: #9BAABF; vertical-align: middle;
}
.adm-risk-table tbody td:first-child {
  color: #C4CEDB; font-weight: 500; width: 55%;
}
.adm-risk-table tbody td:not(:first-child) { text-align: center; width: 15%; }
.adm-risk-table input[type="radio"] {
  width: 15px; height: 15px; cursor: pointer; accent-color: #E8631A;
  vertical-align: middle;
}
.adm-risk-table tbody tr:hover td { background: rgba(255,255,255,0.02); }

/* Trace type toggle in pipe fiche */
.pf-trace-toggle { display: flex; gap: 0; border-radius: 6px; overflow: hidden; border: 1px solid rgba(255,255,255,0.12); }
.pf-trace-btn {
  flex: 1; padding: 6px 0; font-size: 11px; font-weight: 600; cursor: pointer;
  background: rgba(255,255,255,0.04); border: none; color: var(--silver-d);
  transition: background .15s, color .15s;
}
.pf-trace-btn + .pf-trace-btn { border-left: 1px solid rgba(255,255,255,0.1); }
.pf-trace-btn.active { background: rgba(99,179,237,0.18); color: #63B3ED; }
.pf-trace-btn:hover:not(.active) { background: rgba(255,255,255,0.08); color: var(--white-d); }

.pipe-fiche-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 16px; border-top: 1px solid rgba(255,255,255,0.08); flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   MODULE SÉCURITÉ
   ═══════════════════════════════════════════════════════════ */

/* ── Top stats bar ── */
.sec-topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; background: var(--navy-mid);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.sec-stat-block {
  display: flex; flex-direction: column; align-items: center;
  min-width: 110px; padding: 8px 16px; border-radius: 8px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  transition: border-color .2s;
}
.sec-stat-block.alert { border-color: rgba(217,79,61,.5); background: rgba(217,79,61,.08); }
.sec-stat-block.warn  { border-color: rgba(245,166,35,.5); background: rgba(245,166,35,.08); }
.sec-stat-val { font-size: 26px; font-weight: 700; color: var(--white); line-height: 1; }
.sec-stat-lbl { font-size: 11px; color: var(--silver); margin-top: 3px; text-align: center; }
.sec-stat-block.alert .sec-stat-val { color: #D94F3D; }
.sec-stat-block.warn  .sec-stat-val { color: #F5A623; }

/* ── Sub-navigation ── */
.sec-subnav {
  display: flex; gap: 0; border-bottom: 1px solid var(--border);
  background: var(--navy-mid); flex-shrink: 0; padding: 0 16px;
}
.sec-subtab {
  padding: 10px 18px; background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--silver); font-size: 13px; cursor: pointer; transition: all .18s; white-space: nowrap;
}
.sec-subtab:hover  { color: var(--white); }
.sec-subtab.active { color: var(--cobalt-xl); border-bottom-color: var(--cobalt-xl); }

/* ── Panes ── */
.sec-pane {
  display: flex; flex-direction: column; flex: 1; overflow: hidden;
}

/* ── Filter bar ── */
.sec-filters-bar {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid var(--border); flex-shrink: 0; flex-wrap: wrap;
}
.sec-sel {
  height: 34px; padding: 0 10px; border-radius: 6px;
  background: #0D2340; color: var(--white);
  border: 1px solid var(--border-l); font-size: 13px; cursor: pointer;
}
.sec-sel option { background: #0D2340; color: var(--white); }
.sec-search-inp {
  height: 34px; padding: 0 12px; border-radius: 6px;
  background: #0D2340; color: var(--white);
  border: 1px solid var(--border-l); font-size: 13px; min-width: 200px;
}
.sec-search-inp::placeholder { color: var(--silver-d); }
.sec-btn-primary {
  height: 34px; padding: 0 16px; border-radius: 6px; border: none; cursor: pointer;
  background: var(--cobalt-l); color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap;
  transition: background .15s;
}
.sec-btn-primary:hover { background: var(--cobalt-xl); }
.sec-btn-secondary {
  height: 34px; padding: 0 14px; border-radius: 6px; cursor: pointer;
  background: rgba(255,255,255,0.07); color: var(--white-d);
  border: 1px solid rgba(255,255,255,0.1); font-size: 13px; transition: background .15s;
}
.sec-btn-secondary:hover { background: rgba(255,255,255,0.12); }

/* ── Table ── */
.sec-table-wrap { flex: 1; overflow-y: auto; }
.sec-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sec-table thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--navy-mid); padding: 9px 14px;
  text-align: left; color: var(--silver); font-weight: 600;
  border-bottom: 1px solid var(--border); font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
}
.sec-row td { padding: 10px 14px; border-bottom: 1px solid rgba(255,255,255,0.04); vertical-align: middle; }
.sec-row:hover td { background: rgba(255,255,255,0.03); }
.sec-row.row-expired td { background: rgba(217,79,61,0.05); }
.sec-row.row-grave td   { background: rgba(217,79,61,0.04); }
.sec-table-empty { text-align: center; color: var(--silver-d); padding: 40px; font-size: 14px; }
.td-main { font-weight: 500; color: var(--white); }
.td-sub  { font-size: 11px; color: var(--silver); margin-top: 2px; }
.td-expired { color: #D94F3D; }
.td-actions { display: flex; gap: 6px; }

/* ── Status / type badges ── */
.sec-status-badge {
  display: inline-block; padding: 3px 9px; border-radius: 12px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.perm-type-badge, .inc-type-badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px;
  border-radius: 6px; font-size: 11px; font-weight: 600; white-space: nowrap;
}
.grav-badge {
  display: inline-block; padding: 3px 9px; border-radius: 6px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
}

/* ── Risques grid ── */
.risques-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px; padding: 16px; overflow-y: auto; flex: 1; align-content: start;
}
.risques-empty { grid-column: 1/-1; text-align: center; color: var(--silver-d); padding: 60px; font-size: 14px; }
.risque-card {
  background: var(--navy-card); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.risque-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.risque-card-title  { font-weight: 600; color: var(--white); font-size: 14px; }
.risque-card-meta   { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--silver); }
.risque-card-stats  { display: flex; gap: 16px; }
.risque-stat        { display: flex; flex-direction: column; }
.risque-stat-val    { font-size: 22px; font-weight: 700; color: var(--white); line-height: 1; }
.risque-stat-lbl    { font-size: 11px; color: var(--silver); margin-top: 2px; }
.risque-card-actions { display: flex; gap: 8px; align-items: center; }

/* ── Procédures grid ── */
.procedures-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px; padding: 16px; overflow-y: auto; flex: 1; align-content: start;
}
.proc-card {
  background: var(--navy-card); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden; display: flex; flex-direction: column;
}
.proc-card.proc-urgence { border-color: rgba(217,79,61,0.35); }
.proc-card-header {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  background: rgba(255,255,255,0.03);
}
.proc-icon  { font-size: 22px; flex-shrink: 0; }
.proc-titles { display: flex; flex-direction: column; gap: 4px; }
.proc-title { font-weight: 700; color: var(--white); font-size: 14px; }
.proc-urgence-badge {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  background: rgba(217,79,61,0.2); color: #D94F3D; font-size: 10px; font-weight: 700;
}
.proc-steps {
  margin: 0; padding: 14px 16px 14px 32px; display: flex; flex-direction: column;
  gap: 6px; font-size: 12px; color: var(--white-d); line-height: 1.5; flex: 1;
}
.proc-steps li { padding-left: 4px; }
.proc-contacts { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,0.06); }
.proc-contacts-title { font-size: 10px; font-weight: 700; color: var(--silver-d); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.proc-contacts-grid { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; font-size: 12px; }
.proc-contact-label { color: var(--silver); }
.proc-contact-num   { color: var(--white); font-weight: 600; font-family: monospace; font-size: 13px; }

/* ═══════════════════════════════════════════════════════════
   MODALS SÉCURITÉ
   ═══════════════════════════════════════════════════════════ */

.sec-modal-bg {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.sec-modal-panel {
  background: var(--navy-mid); border: 1px solid var(--border-l);
  border-radius: 12px; width: 100%; max-width: 680px; max-height: 90vh;
  display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.sec-modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 15px; font-weight: 700; color: var(--white); flex-shrink: 0;
}
.sec-modal-close {
  background: none; border: none; color: var(--silver); font-size: 18px;
  cursor: pointer; padding: 2px 6px; border-radius: 4px; line-height: 1;
}
.sec-modal-close:hover { color: var(--white); background: rgba(255,255,255,0.08); }
.sec-modal-body { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 0; }
.sec-modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 20px; border-top: 1px solid rgba(255,255,255,0.08); flex-shrink: 0;
}
.sec-modal-section { padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.05); display: flex; flex-direction: column; gap: 10px; }
.sec-modal-section:last-child { border-bottom: none; }
.sec-modal-label { font-size: 10px; font-weight: 700; color: var(--silver-d); text-transform: uppercase; letter-spacing: .6px; }
.sec-modal-label-row { display: flex; align-items: center; justify-content: space-between; }
.sec-modal-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sec-modal-row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.modal-field    { display: flex; flex-direction: column; gap: 5px; }

/* ── Permis type selector ── */
.permis-type-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.permis-type-btn {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 10px 6px; border-radius: 8px; cursor: pointer; transition: all .15s;
  background: rgba(255,255,255,0.04); border: 1.5px solid rgba(255,255,255,0.08);
  color: var(--silver);
}
.permis-type-btn:hover { border-color: var(--pcolor, #2779D4); color: var(--white); }
.permis-type-btn.active { border-color: var(--pcolor, #2779D4); background: color-mix(in srgb, var(--pcolor, #2779D4) 15%, transparent); color: var(--white); }
.ptype-icon { font-size: 18px; }
.ptype-name { font-size: 11px; font-weight: 600; text-align: center; }

/* ── EPI checkboxes ── */
.epi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.epi-check { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--white-d); cursor: pointer; padding: 4px 0; }
.epi-check input[type=checkbox] { accent-color: var(--cobalt-l); width: 14px; height: 14px; cursor: pointer; }

/* ── Incident type selector ── */
.inc-type-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.inc-type-btn {
  padding: 6px 14px; border-radius: 20px; cursor: pointer; font-size: 12px; font-weight: 600;
  background: rgba(255,255,255,0.04); border: 1.5px solid rgba(255,255,255,0.08);
  color: var(--silver); transition: all .15s;
}
.inc-type-btn:hover { border-color: var(--icolor, #F5A623); color: var(--white); }
.inc-type-btn.active { border-color: var(--icolor, #F5A623); background: color-mix(in srgb, var(--icolor, #F5A623) 15%, transparent); color: var(--white); }

/* ── Gravité selector ── */
.grav-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.grav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 14px; border-radius: 8px; cursor: pointer; transition: all .15s;
  background: rgba(255,255,255,0.04); border: 1.5px solid rgba(255,255,255,0.08);
  color: var(--silver); min-width: 76px;
}
.grav-btn:hover { border-color: var(--gcolor, #F5A623); color: var(--white); }
.grav-btn.active { border-color: var(--gcolor, #F5A623); background: color-mix(in srgb, var(--gcolor, #F5A623) 15%, transparent); color: var(--white); }
.grav-val { font-size: 16px; font-weight: 700; }
.grav-lbl { font-size: 10px; }

/* ── Risk matrix ── */
.risque-matrix-wrap { overflow-x: auto; border-radius: 6px; border: 1px solid var(--border); }
.risque-matrix-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.risque-matrix-table thead th {
  background: rgba(255,255,255,0.05); padding: 8px 10px;
  color: var(--silver); font-weight: 600; font-size: 11px;
  text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.risque-matrix-row td { padding: 6px 8px; border-bottom: 1px solid rgba(255,255,255,0.04); }
.risque-matrix-row:last-child td { border-bottom: none; }
.matrix-inp {
  width: 100%; background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  border-radius: 4px; color: var(--white); padding: 4px 7px; font-size: 12px;
  min-width: 100px;
}
.matrix-inp:focus { outline: none; border-color: var(--cobalt-l); }
.matrix-sel {
  background: #0D2340; color: var(--white); border: 1px solid var(--border);
  border-radius: 4px; padding: 4px 6px; font-size: 12px; cursor: pointer; width: 100%;
}
.matrix-sel option { background: #0D2340; }
.crit-badge { padding: 3px 8px; border-radius: 4px; font-size: 13px; font-weight: 700; }
.risque-matrix-legend { font-size: 11px; color: var(--silver-d); display: flex; gap: 12px; flex-wrap: wrap; padding-top: 6px; }

/* textarea & input shared */
.modal-textarea {
  width: 100%; background: #0D2340; color: var(--white);
  border: 1px solid var(--border-l); border-radius: 6px;
  padding: 8px 10px; font-size: 13px; resize: vertical; font-family: inherit;
}
.modal-textarea:focus { outline: none; border-color: var(--cobalt-l); }

/* ─── NAV SEARCH BUTTON ──────────────────── */
.nav-search-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 6px;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  color: var(--silver); font-size: 12px; font-weight: 500; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  font-family: inherit;
}
.nav-search-btn:hover { background: rgba(39,121,212,0.15); border-color: var(--border-l); color: var(--white); }
.nav-search-btn kbd {
  display: inline-flex; align-items: center;
  padding: 1px 4px; border-radius: 3px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12);
  font-size: 10px; font-family: 'JetBrains Mono', monospace;
  color: var(--silver-d); line-height: 1.4;
}

/* ─── FICHE FOOTER ACTIONS ───────────────── */
.fiche-footer { justify-content: space-between; }
.fiche-footer-actions { display: flex; gap: 6px; align-items: center; flex: 1; justify-content: center; }
.btn-icon-outline {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 10px; border-radius: 6px; font-size: 11px; font-weight: 500;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.12);
  color: var(--silver); cursor: pointer; transition: background 0.15s, color 0.15s, border-color 0.15s;
  font-family: inherit;
}
.btn-icon-outline:hover { background: rgba(39,121,212,0.18); border-color: var(--cobalt-l); color: var(--white); }

/* ─── EQUIPMENT SEARCH OVERLAY ───────────── */
.equip-search-overlay {
  position: fixed; inset: 0; z-index: 8000;
  background: rgba(6, 15, 28, 0.65);
  backdrop-filter: blur(4px);
  display: none; align-items: flex-start; justify-content: center;
  padding-top: 80px;
}
.equip-search-overlay.open { display: flex; }
.equip-search-panel {
  width: 560px; max-width: 94vw;
  background: var(--navy-card);
  border: 1px solid var(--border-l);
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.55);
  overflow: hidden;
  animation: search-drop 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes search-drop {
  from { opacity: 0; transform: translateY(-12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}
.equip-search-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.equip-search-icon { color: var(--silver); flex-shrink: 0; }
.equip-search-input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--white); font-size: 15px; font-family: inherit;
  placeholder-color: var(--silver-d);
}
.equip-search-input::placeholder { color: var(--silver-d); }
.equip-search-close {
  background: none; border: none; color: var(--silver-d); font-size: 14px;
  cursor: pointer; padding: 4px 6px; border-radius: 4px; line-height: 1;
  transition: color 0.15s, background 0.15s;
}
.equip-search-close:hover { color: var(--white); background: rgba(255,255,255,0.08); }
.equip-search-results {
  max-height: 340px; overflow-y: auto;
  padding: 6px;
}
.equip-search-empty {
  padding: 28px 16px; text-align: center;
  color: var(--silver-d); font-size: 13px;
}
.equip-search-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px; cursor: pointer;
  transition: background 0.12s;
}
.equip-search-item:hover, .equip-search-item.focused {
  background: rgba(39,121,212,0.14);
}
.equip-search-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.equip-search-info { flex: 1; min-width: 0; }
.equip-search-name {
  font-size: 13px; font-weight: 600; color: var(--white);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.equip-search-name mark {
  background: rgba(74,158,240,0.3); color: var(--cobalt-xl);
  border-radius: 2px; padding: 0 1px;
}
.equip-search-sub {
  font-size: 11px; color: var(--silver-d); margin-top: 1px;
}
.equip-search-acc {
  font-size: 10px; color: #63B3ED; margin-top: 3px;
  font-style: italic;
}
.equip-search-ref {
  font-size: 11px; color: var(--silver-d);
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}
.equip-search-footer {
  display: flex; gap: 16px; align-items: center;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.15);
}
.equip-search-footer span { font-size: 11px; color: var(--silver-d); display: flex; align-items: center; gap: 4px; }
.equip-search-footer kbd {
  display: inline-flex; align-items: center;
  padding: 1px 5px; border-radius: 3px;
  background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.1);
  font-size: 10px; font-family: 'JetBrains Mono', monospace;
  color: var(--silver-d);
}

/* ═══════════════════════════════════════════════════════════
   CAMPAGNES RSF
   ═══════════════════════════════════════════════════════════ */

/* ─── Active campaign badge in navbar ─── */
.camp-nav-badge {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 20px;
  background: rgba(232,99,26,0.15); border: 1px solid rgba(232,99,26,0.35);
  cursor: pointer; transition: background .15s;
  font-size: 12px; font-weight: 600; color: #E8631A;
  max-width: 200px; overflow: hidden;
}
.camp-nav-badge:hover { background: rgba(232,99,26,0.25); }
.camp-nav-badge #active-camp-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.camp-nav-dot { font-size: 8px; flex-shrink: 0; animation: camp-pulse 2s infinite; }
@keyframes camp-pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ─── Sidebar section ─── */
.camp-sidebar-empty {
  font-size: 11px; color: var(--silver-d); font-style: italic;
  padding: 8px 4px;
}
.camp-sidebar-item {
  padding: 8px 10px; border-radius: 6px; cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s;
  margin-bottom: 4px;
}
.camp-sidebar-item:hover { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.08); }
.camp-sidebar-item.active   { background: rgba(232,99,26,0.1); border-color: rgba(232,99,26,0.3); }
.camp-sidebar-item.terminee { opacity: .72; }
.camp-sidebar-item-top { display: flex; align-items: center; gap: 6px; }
.camp-sidebar-name { font-size: 12px; font-weight: 600; color: var(--white); flex: 1; }
.camp-active-dot  { font-size: 8px; color: #E8631A; }
.camp-cloture-dot { font-size: 11px; opacity: .65; }
.camp-sidebar-meta { font-size: 10px; color: var(--silver-d); margin-top: 2px; }
.camp-sidebar-status {
  display: inline-block; font-size: 10px; font-weight: 600;
  margin-top: 3px; padding: 1px 7px; border-radius: 10px;
}
.camp-sidebar-status.en-cours { background: rgba(39,121,212,0.2);  color: #63B3ED; }
.camp-sidebar-status.terminee { background: rgba(94,143,94,0.15);  color: #68D391; }

/* ─── Create / Edit modal ─── */
.camp-modal-bg {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(0,0,0,0.65); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.camp-create-modal {
  background: var(--navy-mid); border: 1px solid var(--border);
  border-radius: 14px; width: 680px; max-width: 96vw; max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}
.camp-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.camp-modal-title { font-size: 15px; font-weight: 700; color: var(--white); }
.camp-modal-body {
  flex: 1; overflow-y: auto; padding: 18px 20px;
  display: flex; flex-direction: column; gap: 14px;
}
.camp-modal-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 12px 20px; border-top: 1px solid var(--border); flex-shrink: 0;
}
.camp-section-title {
  font-size: 10px; font-weight: 700; color: var(--silver-d);
  letter-spacing: .08em; text-transform: uppercase;
  padding-bottom: 6px; border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}
.camp-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.camp-row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.camp-field { display: flex; flex-direction: column; gap: 4px; }
.camp-label { font-size: 10px; font-weight: 700; color: var(--silver-d); letter-spacing: .06em; text-transform: uppercase; }
.camp-inp, .camp-sel, .camp-ta {
  background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  border-radius: 6px; color: var(--white); font-size: 12px;
  padding: 6px 10px; font-family: inherit;
  transition: border-color .15s;
}
.camp-inp:focus, .camp-sel:focus, .camp-ta:focus {
  outline: none; border-color: var(--cobalt-l);
}
.camp-ta { resize: vertical; min-height: 56px; }
.camp-checkboxes { display: flex; flex-direction: column; gap: 6px; }
.camp-checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--white-d); cursor: pointer; }
.camp-checkbox-row input[type="checkbox"] { accent-color: #E8631A; width: 14px; height: 14px; }

/* ─── Detail panel ─── */
.camp-detail-bg {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(0,0,0,0.65); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.camp-detail-panel {
  background: var(--navy-mid); border: 1px solid var(--border);
  border-radius: 14px; width: 860px; max-width: 97vw; max-height: 92vh;
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}
.camp-detail-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.camp-detail-title { font-size: 15px; font-weight: 700; color: var(--white); }
.camp-detail-body { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 16px; }
.camp-detail-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; border-top: 1px solid var(--border); flex-shrink: 0;
}

/* ─── Info cards ─── */
.camp-info-cards { display: grid; grid-template-columns: repeat(auto-fill,minmax(180px,1fr)); gap: 8px; }
.camp-info-card {
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px;
}
.camp-info-card-label { font-size: 10px; font-weight: 700; color: var(--silver-d); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 3px; }
.camp-info-card-value { font-size: 12px; color: var(--white); }

/* ─── Stats bar ─── */
.camp-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.camp-stat {
  padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; gap: 6px;
}
.camp-stat.nq  { background: rgba(91,107,130,0.2); color: #9BAABF; }
.camp-stat.lv1 { background: rgba(245,166,35,0.15); color: #F5A623; }
.camp-stat.lv2 { background: rgba(232,99,26,0.15); color: #E8631A; }
.camp-stat.lv3 { background: rgba(217,79,61,0.2); color: #D94F3D; }
.camp-stat.dgi { background: rgba(217,79,61,0.3); color: #FF6B6B; border: 1px solid rgba(217,79,61,0.5); }
.camp-stat-sym { font-family: 'JetBrains Mono', monospace; font-size: 10px; letter-spacing: -.02em; }

/* ─── Anomaly table ─── */
.camp-anom-table {
  width: 100%; border-collapse: collapse;
  font-size: 12px;
}
.camp-anom-table th {
  text-align: left; padding: 6px 8px;
  font-size: 10px; font-weight: 700; color: var(--silver-d);
  text-transform: uppercase; letter-spacing: .06em;
  border-bottom: 1px solid var(--border);
}
.camp-anom-table td {
  padding: 7px 8px; border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--white-d); vertical-align: top;
}
.camp-anom-table tr:hover td { background: rgba(255,255,255,0.03); cursor: pointer; }
.camp-anom-ref { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--cobalt-xl); white-space: nowrap; }
.camp-anom-sym { font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: -.02em; }
.camp-anom-empty { text-align: center; padding: 24px; font-size: 12px; color: var(--silver-d); font-style: italic; }

/* ─── Danger color classes ─── */
.camp-d-NQ  { color: #9BAABF; }
.camp-d-1   { color: #F5A623; }
.camp-d-2   { color: #E8631A; }
.camp-d-3   { color: #D94F3D; }
.camp-d-DGI { color: #FF6B6B; font-weight: 700; }

/* ─── Form helpers ─── */
.camp-form-section {
  font-size: 10px; font-weight: 700; color: var(--silver-d);
  letter-spacing: .08em; text-transform: uppercase;
  padding: 6px 0 4px; border-bottom: 1px solid var(--border);
  margin-top: 4px;
}
.camp-form-grid4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; }
.camp-form-grid3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.camp-obj-list   { display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.camp-del-btn {
  background: rgba(217,79,61,0.15); border: 1px solid rgba(217,79,61,0.3);
  color: #D94F3D; border-radius: 7px; padding: 7px 14px;
  font-size: 12px; font-weight: 600; cursor: pointer; transition: background .15s;
}
.camp-del-btn:hover { background: rgba(217,79,61,0.25); }

/* ─── Detail section titles ─── */
.camp-detail-section { font-size: 12px; font-weight: 700; color: var(--white); margin-bottom: 6px; }
.camp-detail-sub     { font-size: 10px; font-weight: 700; color: var(--silver-d); text-transform: uppercase; letter-spacing: .06em; margin: 10px 0 6px; }

/* ─── Detail header ─── */
.camp-detail-hd {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.camp-detail-hd-left { flex: 1; min-width: 0; }
.camp-detail-title   { font-size: 16px; font-weight: 700; color: var(--white); margin-bottom: 4px; }
.camp-detail-sub     { font-size: 12px; color: var(--silver-d); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.camp-detail-hd-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.camp-status-badge {
  display: inline-block; font-size: 10px; font-weight: 700;
  padding: 2px 9px; border-radius: 10px;
}
.camp-status-badge.en-cours { background: rgba(39,121,212,0.2); color: #63B3ED; }
.camp-status-badge.terminee { background: rgba(94,143,94,0.2); color: #68D391; }

.camp-activate-btn {
  padding: 6px 14px; border-radius: 7px; font-size: 12px; font-weight: 600;
  background: rgba(255,255,255,0.06); border: 1px solid var(--border);
  color: var(--white-d); cursor: pointer; transition: background .15s, border-color .15s;
}
.camp-activate-btn:hover:not([disabled]) { background: rgba(255,255,255,0.1); }
.camp-activate-btn.active { background: rgba(94,143,94,0.2); border-color: rgba(94,143,94,0.4); color: #68D391; }

/* ─── Stop / Reprendre ─── */
.camp-stop-btn {
  padding: 6px 14px; border-radius: 7px; font-size: 12px; font-weight: 600;
  background: rgba(217,79,61,0.12); border: 1px solid rgba(217,79,61,0.35);
  color: #E08070; cursor: pointer; transition: background .15s, border-color .15s;
}
.camp-stop-btn:hover { background: rgba(217,79,61,0.22); border-color: rgba(217,79,61,0.55); }

.camp-resume-btn {
  padding: 6px 14px; border-radius: 7px; font-size: 12px; font-weight: 600;
  background: rgba(20,196,168,0.12); border: 1px solid rgba(20,196,168,0.35);
  color: #14C4A8; cursor: pointer; transition: background .15s, border-color .15s;
}
.camp-resume-btn:hover { background: rgba(20,196,168,0.22); border-color: rgba(20,196,168,0.55); }

/* ─── Bannière de clôture ─── */
.camp-cloture-banner {
  display: flex; align-items: flex-start; gap: 12px;
  margin: 0 20px 0; padding: 12px 16px; border-radius: 8px;
  background: rgba(94,143,94,0.1); border: 1px solid rgba(94,143,94,0.25);
  font-size: 12px; color: #68D391; line-height: 1.5;
}
.camp-cloture-banner strong { color: #7EE89E; }
.camp-cloture-banner small  { color: rgba(104,211,145,0.7); }
.camp-cloture-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }

/* ─── Info cards in detail ─── */
.camp-info-card-lbl { font-size: 10px; font-weight: 700; color: var(--silver-d); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 3px; }
.camp-info-card-val { font-size: 12px; color: var(--white); font-weight: 600; }
.camp-info-card-sub { font-size: 11px; color: var(--silver-d); margin-top: 2px; }

/* ─── Section labels & tags ─── */
.camp-section-lbl {
  font-size: 11px; font-weight: 700; color: var(--silver-d);
  text-transform: uppercase; letter-spacing: .06em;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.camp-stats-inline { display: flex; gap: 6px; flex-wrap: wrap; }
.camp-obj-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.camp-obj-tag {
  padding: 3px 10px; border-radius: 12px; font-size: 11px;
  background: rgba(39,121,212,0.15); border: 1px solid rgba(39,121,212,0.3);
  color: #63B3ED;
}

/* ─── Anomaly table (detail) ─── */
.camp-anom-table-wrap { overflow-x: auto; border-radius: 8px; border: 1px solid var(--border); }
.camp-td { padding: 7px 10px; font-size: 12px; color: var(--white-d); vertical-align: middle; border-bottom: 1px solid rgba(255,255,255,0.04); }
.camp-td-ref { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--cobalt-xl); white-space: nowrap; }
.camp-td-dt  { font-size: 11px; white-space: nowrap; }
.camp-td-risk { font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: -.02em; }
.camp-anom-row:hover .camp-td { background: rgba(255,255,255,0.03); }
.camp-anom-open {
  background: rgba(39,121,212,0.15); border: 1px solid rgba(39,121,212,0.3);
  color: #63B3ED; border-radius: 5px; padding: 2px 8px;
  font-size: 12px; cursor: pointer; transition: background .15s;
}
.camp-anom-open:hover { background: rgba(39,121,212,0.3); }

/* ─── Stats (r1/r2/r3/rnq variants) ─── */
.camp-stat.r1  { background: rgba(245,166,35,0.15); color: #F5A623; }
.camp-stat.r2  { background: rgba(232,99,26,0.15); color: #E8631A; }
.camp-stat.r3  { background: rgba(217,79,61,0.2); color: #D94F3D; }
.camp-stat.rnq { background: rgba(91,107,130,0.2); color: #9BAABF; }

/* ─── Template zone ─── */
.camp-tmpl-zone {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; background: rgba(255,255,255,0.02);
}
.camp-tmpl-status { margin: 6px 0 10px; font-size: 12px; }
.camp-tmpl-loaded { color: #68D391; display: flex; align-items: center; gap: 6px; }
.camp-tmpl-empty  { color: var(--silver-d); font-style: italic; }
.camp-tmpl-btns   { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.camp-tmpl-upload-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 7px; font-size: 12px; font-weight: 600;
  background: rgba(39,121,212,0.15); border: 1px solid rgba(39,121,212,0.35);
  color: #63B3ED; cursor: pointer; transition: background .15s;
}
.camp-tmpl-upload-btn:hover { background: rgba(39,121,212,0.25); }
.camp-tmpl-clear-btn {
  padding: 6px 12px; border-radius: 7px; font-size: 12px; font-weight: 600;
  background: rgba(217,79,61,0.12); border: 1px solid rgba(217,79,61,0.25);
  color: #D94F3D; cursor: pointer; transition: background .15s;
}
.camp-tmpl-clear-btn:hover { background: rgba(217,79,61,0.22); }
.camp-tmpl-report-btn {
  padding: 7px 14px; border-radius: 7px; font-size: 12px; font-weight: 600;
  background: var(--cobalt-l); border: none; color: #fff; cursor: pointer;
  transition: background .15s;
}
.camp-tmpl-report-btn:hover { background: var(--cobalt-xl); }
.camp-tmpl-help { margin-top: 4px; }
.camp-tmpl-help summary {
  font-size: 11px; color: var(--silver-d); cursor: pointer;
  user-select: none; padding: 4px 0;
}
.camp-tmpl-help summary:hover { color: var(--white-d); }
.camp-tmpl-tags-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px;
  margin-top: 10px; padding: 12px;
  background: rgba(0,0,0,0.2); border-radius: 8px;
  font-size: 11px; line-height: 1.7; color: var(--white-d);
}
.camp-tmpl-tags-grid strong { display: block; color: var(--cobalt-xl); margin-bottom: 4px; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.camp-tmpl-tags-grid code {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  background: rgba(39,121,212,0.15); color: #63B3ED;
  padding: 1px 5px; border-radius: 3px; margin-right: 4px;
  display: inline-block;
}

/* ═══════════════════════════════════════════════════════════
   DATA I/O — Modal Sauvegarde / Chargement réseau
   ═══════════════════════════════════════════════════════════ */

/* ── Boutons toolbar ── */
.io-save-btn {
  border-color: rgba(39,121,212,0.5) !important;
  color: #7DB4FF !important;
}
.io-save-btn:hover { background: rgba(39,121,212,0.15) !important; }

.io-load-btn {
  cursor: pointer;
  border-color: rgba(20,196,168,0.5) !important;
  color: #14C4A8 !important;
  display: inline-flex !important;
  align-items: center !important;
}
.io-load-btn:hover { background: rgba(20,196,168,0.12) !important; }

/* ── Modal overlay ── */
.dio-modal-bg {
  position: fixed; inset: 0; z-index: 3500;
  background: rgba(5,14,28,0.85);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(5px);
}

.dio-modal {
  background: #0D2340;
  border: 1px solid rgba(39,121,212,0.28);
  border-radius: 16px;
  width: min(540px, 95vw);
  box-shadow: 0 32px 100px rgba(0,0,0,0.65), 0 0 0 1px rgba(255,255,255,0.04);
  overflow: hidden;
  animation: dioFadeIn .18s ease;
}
@keyframes dioFadeIn {
  from { opacity:0; transform: scale(.96) translateY(8px); }
  to   { opacity:1; transform: scale(1)   translateY(0);   }
}

/* ── Header ── */
.dio-modal-hd {
  display: flex; align-items: center; gap: 14px;
  padding: 20px 22px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.dio-modal-hd-icon {
  font-size: 26px;
  width: 50px; height: 50px; border-radius: 13px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.dio-modal-hd-icon.save { background: rgba(39,121,212,0.18); }
.dio-modal-hd-icon.load { background: rgba(20,196,168,0.15); }
.dio-modal-hd .sec-modal-close { margin-left: auto; }
.dio-modal-title {
  font-size: 15px; font-weight: 700; color: #EEF2F7; letter-spacing: .01em;
}
.dio-modal-sub {
  font-size: 11px; color: var(--silver-d); margin-top: 3px;
}

/* ── Body ── */
.dio-modal-body { padding: 20px 22px 4px; }

.dio-section-lbl {
  font-size: 10px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
  color: var(--silver-d); margin-bottom: 12px;
}

/* Stats grid 3 colonnes */
.dio-stats-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px;
  margin-bottom: 13px;
}
.dio-stat-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 11px;
  padding: 13px 10px 11px;
  text-align: center;
  transition: border-color .15s;
}
.dio-stat-card.warn {
  border-color: rgba(245,166,35,0.35);
  background: rgba(245,166,35,0.05);
}
.dio-stat-icon { font-size: 17px; margin-bottom: 5px; }
.dio-stat-val {
  font-size: 24px; font-weight: 800; color: #EEF2F7; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.dio-stat-lbl {
  font-size: 10px; color: var(--silver-d); margin-top: 4px; letter-spacing: .02em;
}

/* Checks (plan, satellite, modèle) */
.dio-checks {
  display: flex; flex-direction: column; gap: 7px;
  margin-bottom: 16px;
}
.dio-check-row {
  display: flex; align-items: center; gap: 9px;
  font-size: 12px; color: var(--silver);
}
.dio-check-dot {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
}
.dio-check-dot.ok  { background: rgba(20,196,168,0.18); color: #14C4A8; }
.dio-check-dot.off { background: rgba(155,170,191,0.1); color: var(--silver-d); }
.dio-check-name { flex: 1; }
.dio-check-sub  { font-size: 10px; color: var(--silver-d); font-style: italic; }

/* Info / Warning boxes */
.dio-info-box, .dio-warn-box {
  border-radius: 9px; padding: 12px 15px;
  font-size: 11.5px; line-height: 1.65; color: var(--silver);
  margin-bottom: 20px;
}
.dio-info-box {
  background: rgba(39,121,212,0.07);
  border: 1px solid rgba(39,121,212,0.22);
}
.dio-info-box code {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  background: rgba(39,121,212,0.18); color: #7DB4FF;
  padding: 1px 6px; border-radius: 4px;
}
.dio-warn-box {
  background: rgba(245,166,35,0.06);
  border: 1px solid rgba(245,166,35,0.25);
}
.dio-warn-box strong { color: #F5C842; }

/* ── Footer ── */
.dio-modal-ft {
  display: flex; justify-content: flex-end; align-items: center; gap: 10px;
  padding: 15px 22px 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.dio-export-btn, .dio-import-btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 600; border: none; border-radius: 9px;
  padding: 9px 20px; cursor: pointer; transition: opacity .15s, transform .1s;
  letter-spacing: .01em;
}
.dio-export-btn { background: linear-gradient(135deg, #2779D4, #0e4a8a); color: #fff; }
.dio-import-btn { background: linear-gradient(135deg, #14C4A8, #0A8A73); color: #fff; }
.dio-export-btn:hover, .dio-import-btn:hover { opacity: .88; transform: translateY(-1px); }

/* ─── QR CODE MODAL ──────────────────────── */
.qr-modal-overlay {
  position: fixed; inset: 0; z-index: 8000;
  background: rgba(6, 15, 28, 0.7);
  backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
}
.qr-modal-overlay.open { display: flex; }
.qr-modal-panel {
  width: 380px; max-width: 94vw;
  background: var(--navy-card);
  border: 1px solid var(--border-l);
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.55);
  overflow: hidden;
  animation: search-drop 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}
.qr-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px; font-weight: 600; color: var(--white);
}
.qr-modal-body { padding: 20px 16px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.qr-code-container {
  padding: 12px; background: #fff; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.qr-equip-info { font-size: 13px; font-weight: 600; color: var(--white); text-align: center; }
.qr-url-box {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 10px;
  background: rgba(0,0,0,0.25); border: 1px solid var(--border);
  border-radius: 6px;
}
.qr-url-text {
  flex: 1; font-size: 10px; color: var(--silver-d);
  font-family: 'JetBrains Mono', monospace;
  word-break: break-all;
}
.qr-copy-btn {
  flex-shrink: 0; padding: 4px 10px; border-radius: 4px; font-size: 11px;
  background: rgba(39,121,212,0.2); border: 1px solid var(--border-l);
  color: var(--cobalt-xl); cursor: pointer; font-family: inherit;
  transition: background 0.15s;
}
.qr-copy-btn:hover { background: rgba(39,121,212,0.35); }
.qr-hint { font-size: 11px; color: var(--silver-d); text-align: center; line-height: 1.5; }

/* ─── EXPORT PLAN BUTTON ─────────────────── */
.export-plan-btn {
  background: rgba(39,121,212,0.12);
  border-color: rgba(39,121,212,0.35);
  color: var(--cobalt-xl);
  font-weight: 500;
}
.export-plan-btn:hover {
  background: rgba(39,121,212,0.22);
  border-color: var(--cobalt-l);
  color: var(--white);
}

/* ─── EXPORT MODAL ───────────────────────── */
.export-modal-overlay {
  position: fixed; inset: 0; z-index: 8100;
  background: rgba(6, 15, 28, 0.72);
  backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center;
}
.export-modal-overlay.open { display: flex; }

.export-modal-panel {
  width: 400px; max-width: 96vw;
  background: var(--navy-card);
  border: 1px solid var(--border-l);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  overflow: hidden;
  animation: search-drop 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.export-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--border);
}
.export-modal-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 600; color: var(--white);
}
.export-modal-icon {
  width: 28px; height: 28px;
  background: rgba(39,121,212,0.18);
  border: 1px solid rgba(39,121,212,0.35);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--cobalt-xl); font-weight: 700;
}
.export-modal-body { padding: 16px 18px 20px; display: flex; flex-direction: column; gap: 18px; }

.export-section { display: flex; flex-direction: column; gap: 8px; }
.export-section-label {
  font-size: 9px; font-weight: 700; letter-spacing: 1.8px;
  color: var(--silver-d); text-transform: uppercase;
}

/* Scope toggle */
.export-scope-btns { display: flex; gap: 6px; }
.export-scope-btn {
  flex: 1; padding: 8px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--silver); font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all 0.15s; font-family: inherit;
}
.export-scope-btn:hover { color: var(--white); border-color: var(--border-l); background: rgba(255,255,255,0.07); }
.export-scope-btn.active {
  background: rgba(39,121,212,0.18);
  border-color: var(--cobalt-l);
  color: var(--cobalt-xl);
}
.export-scope-hint { font-size: 11px; color: var(--silver-d); line-height: 1.4; margin-top: 2px; }

/* Format cards */
.export-format-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.export-format-btn {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 16px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer; transition: all 0.18s; font-family: inherit;
  text-align: center;
}
.export-format-btn:hover:not(:disabled) {
  background: rgba(39,121,212,0.14);
  border-color: var(--cobalt-l);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(39,121,212,0.2);
}
.export-format-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.export-format-icon { font-size: 26px; line-height: 1; margin-bottom: 2px; }
.export-format-btn strong { font-size: 13px; font-weight: 700; color: var(--white); }
.export-format-btn span { font-size: 10px; color: var(--silver-d); line-height: 1.3; }

/* Progress indicator */
.export-progress {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: rgba(39,121,212,0.08);
  border: 1px solid rgba(39,121,212,0.25);
  border-radius: 8px;
  font-size: 13px; color: var(--cobalt-xl);
}
.export-spinner {
  width: 18px; height: 18px; flex-shrink: 0;
  border: 2px solid rgba(39,121,212,0.25);
  border-top-color: var(--cobalt-xl);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE + UX — GLOBAL IMPROVEMENTS
   ═══════════════════════════════════════════════════════════ */

/* ─── FOCUS ACCESSIBILITY ─────────────────── */
:focus-visible {
  outline: 2px solid var(--cobalt-l);
  outline-offset: 2px;
  border-radius: 4px;
}
button:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible),
textarea:focus:not(:focus-visible) { outline: none; }

/* ─── EQUIPMENT LIBRARY — ouvrages ────────── */
.equip-item-ouvrage {
  border-color: var(--border-l);
  background: rgba(245,166,35,0.06);
}
.equip-item-ouvrage .equip-item-icon { width: 30px; height: 30px; border-radius: 8px; }
.equip-item-ouvrage .equip-item-name { font-weight: 600; color: var(--white); }

/* ─── COMPOSITION D'OUVRAGE — drag & drop ────── */
.comp-list {
  display: flex; flex-direction: column; gap: 4px;
  min-height: 88px; border-radius: 6px;
  padding-bottom: 21px;
  transition: background 0.15s, outline-color 0.15s;
  outline: 1.5px dashed transparent;
}
.comp-list.drag-over {
  background: rgba(39,121,212,0.07);
  outline-color: rgba(39,121,212,0.45);
}
/* Zone de drop visible en bas de liste quand des items sont présents */
.comp-list::after {
  content: '⬇  Glisser ici';
  display: flex; align-items: center; justify-content: center;
  gap: 6px; flex: 1; min-height: 52px;
  color: var(--silver-d); font-size: 11px; opacity: 0;
  border: 1.5px dashed transparent; border-radius: 6px;
  transition: opacity 0.15s, border-color 0.15s;
  pointer-events: none;
}
.comp-list.drag-over::after {
  opacity: 0.6;
  border-color: rgba(39,121,212,0.35);
}
.comp-empty-hint {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 18px 12px;
  color: var(--silver-d); font-size: 11px; text-align: center;
  border: 1.5px dashed rgba(155,170,191,0.18); border-radius: 6px;
  pointer-events: none;
}
.comp-empty-icon { font-size: 20px; opacity: 0.35; }

/* Card */
.comp-card {
  background: rgba(22,46,82,0.45); border: 1px solid rgba(255,255,255,0.07);
  border-radius: 6px; overflow: hidden; cursor: grab; user-select: none;
  transition: border-color 0.15s;
}
.comp-card:hover { border-color: rgba(255,255,255,0.14); }
.comp-card:active { cursor: grabbing; }
.comp-card-main {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 8px;
}
.comp-drag-handle {
  color: rgba(155,170,191,0.35); font-size: 14px; cursor: grab; flex-shrink: 0; line-height: 1;
}
.comp-badge {
  width: 30px; height: 20px; border-radius: 4px; border: 1px solid;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  font-size: 9px; font-weight: 800; font-family: monospace;
}
.comp-card-name {
  flex: 1; font-size: 12px; color: var(--white-d);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.comp-qty-ctrl {
  display: flex; align-items: center; gap: 3px;
  background: rgba(255,255,255,0.05); border-radius: 4px; padding: 2px 5px;
}
.comp-qty-ctrl button {
  background: none; border: none; color: var(--silver-d);
  cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px;
}
.comp-qty-ctrl button:hover { color: var(--white-d); }
.comp-qty-val { font-size: 11px; color: var(--white-d); min-width: 16px; text-align: center; }
.comp-vs-rows {
  display: flex; flex-direction: column; gap: 4px;
  padding: 2px 8px 6px 42px;
  font-size: 12px;
}
.comp-vs-row {
  display: flex; align-items: center; gap: 12px;
}
.comp-vs-field { display: flex; align-items: center; gap: 5px; }
.comp-vs-label { color: var(--silver-d); white-space: nowrap; font-size: 11px; }
.comp-vs-input {
  width: 54px; padding: 3px 5px;
  background: var(--navy-deep); border: 1px solid var(--border);
  border-radius: 4px; color: var(--text-main); font-size: 12px;
  text-align: right;
}
.comp-vs-input:focus { outline: none; border-color: #D94F3D; }
.comp-vs-unit { color: var(--silver-d); font-size: 11px; }

.comp-de-pression {
  display: flex; align-items: center; gap: 8px;
  padding: 2px 8px 6px 42px;
  font-size: 12px;
}
.comp-dep-label { color: var(--silver-d); white-space: nowrap; }
.comp-dep-input {
  width: 64px; padding: 3px 6px;
  background: var(--navy-deep); border: 1px solid var(--border);
  border-radius: 4px; color: var(--text-main); font-size: 12px;
  text-align: right;
}
.comp-dep-input:focus { outline: none; border-color: var(--cyan-d); }
.comp-dep-unit { color: var(--silver-d); font-size: 11px; }

.comp-edit-btn, .comp-del-btn {
  background: none; border: none; cursor: pointer;
  font-size: 11px; padding: 3px 6px; border-radius: 4px;
  transition: background 0.12s, color 0.12s; flex-shrink: 0;
}
.comp-edit-btn { color: var(--silver-d); }
.comp-edit-btn:hover { color: var(--cyan-d); background: rgba(15,163,194,0.12); }
.comp-del-btn { color: var(--silver-d); }
.comp-del-btn:hover { color: var(--danger); background: rgba(217,79,61,0.12); }

/* Sous-fiche inline */
.comp-sub-fiche {
  padding: 10px;
  border-top: 1px solid rgba(255,255,255,0.07);
  background: rgba(8,18,36,0.5);
}

.comp-sf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.comp-sf-field { display: flex; flex-direction: column; gap: 3px; }
.comp-sf-notes { margin-top: 6px; }
.comp-sf-field label {
  font-size: 9px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--silver-d);
}
.comp-sf-field input {
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px; color: var(--white-d); font-size: 11px;
  padding: 4px 7px; font-family: inherit;
}
.comp-sf-field input:focus { outline: none; border-color: var(--cyan-d); }

/* ─── NŒUDS RÉSEAU SVG ────── */
.node-group { cursor: pointer; }
.node-group:hover circle { opacity: 0.85; }
.node-cap { cursor: grab; }
.node-cap:active { cursor: grabbing; }

/* ─── NODE PANEL ────── */
.node-panel {
  position: absolute; top: 0; right: 0; height: 100%;
  width: 280px;
  background: var(--navy-mid);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.22s cubic-bezier(0.4,0,0.2,1);
  z-index: 50;
  overflow: hidden;
}
.node-panel.open { transform: translateX(0); }
.node-panel-header {
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.node-panel-title-row { display: flex; align-items: center; }
.np-type-badge {
  font-size: 11px; font-weight: 700; padding: 3px 9px;
  border-radius: 20px; letter-spacing: 0.03em;
}
.np-type-source   { background: rgba(20,196,168,0.15); color: #14C4A8; border: 1px solid rgba(20,196,168,0.3); }
.np-type-junction { background: rgba(245,166,35,0.15);  color: #F5A623; border: 1px solid rgba(245,166,35,0.3); }
.np-type-cap      { background: rgba(155,170,191,0.12); color: #9BAABF; border: 1px solid rgba(155,170,191,0.25); }
.node-panel-body {
  flex: 1; overflow-y: auto; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.node-panel-footer {
  padding: 10px 14px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; flex-shrink: 0;
}
.np-info-row {
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(255,255,255,0.04); border-radius: 6px;
  padding: 6px 10px;
}
.np-label { font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--silver-d); }
.np-value { font-size: 12px; font-weight: 700; color: #F5A623; }
.np-field { display: flex; flex-direction: column; gap: 4px; }
.np-input {
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px; color: var(--white-d); font-size: 12px;
  padding: 6px 9px; font-family: inherit; width: 100%;
}
.np-input:focus { outline: none; border-color: var(--cyan-d); }
.np-section-title {
  border-top: 1px solid rgba(255,255,255,0.07); padding-top: 10px;
  font-size: 11px; color: var(--white-d);
}
.np-toggle-label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.np-toggle-label input[type="checkbox"] { width: 14px; height: 14px; accent-color: #F5A623; }
.np-reducer-fields { display: flex; flex-direction: column; gap: 8px; padding-left: 2px; }

/* ─── TOUCH TARGETS (global min 44px) ────── */
button, [role="button"], .nav-tab, .layer-row, .gas-env-row, .equip-item,
.mob-tab, .tool-btn, .zoom-btn {
  touch-action: manipulation;
}

/* ─── SMOOTH SCROLL EVERYWHERE ───────────── */
html { scroll-behavior: smooth; }

/* ─── IMPROVED BUTTON ACTIVE STATE ───────── */
.tool-btn:active, .btn-primary:active, .btn-secondary:active,
.btn-danger:active, .zoom-btn:active, .upload-btn:active {
  transform: scale(0.97);
  transition: transform 0.08s;
}

/* ─── INPUT FOCUS GLOW ────────────────────── */
.fiche-input:focus, .pf-input:focus, .pf-select:focus {
  border-color: var(--cobalt-l);
  box-shadow: 0 0 0 3px rgba(39,121,212,0.15);
}

/* ─── HAMBURGER BUTTON (desktop: hidden) ──── */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 36px; height: 36px;
  padding: 6px;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 8px;
  margin-right: 4px;
  transition: background var(--transition);
  flex-shrink: 0;
}
.hamburger-btn:hover { background: rgba(255,255,255,0.08); }
.hamburger-btn span {
  display: block;
  height: 2px;
  border-radius: 1px;
  background: var(--silver);
  transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
  transform-origin: center;
}
.hamburger-btn.active span:nth-child(1) { transform: translateY(6px) rotate(45deg); background: var(--white); }
.hamburger-btn.active span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger-btn.active span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); background: var(--white); }

/* ─── SIDEBAR OVERLAY (mobile) ────────────── */
#sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(6,15,28,0.65);
  backdrop-filter: blur(2px);
  z-index: 299;
  opacity: 0;
  transition: opacity 0.25s ease;
}
#sidebar-overlay.visible {
  display: block;
  opacity: 1;
}

/* ─── MOBILE BOTTOM NAV (hidden on desktop) ── */
#mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 58px;
  background: var(--navy-mid);
  border-top: 1px solid var(--border);
  z-index: 280;
  padding: 0 env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.35);
}
.mob-tab {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
  background: none; border: none;
  color: var(--silver-d); cursor: pointer;
  padding: 6px 4px;
  transition: color var(--transition);
  font-family: inherit;
  position: relative;
}
.mob-tab::before {
  content: '';
  position: absolute;
  top: 0; left: 25%; right: 25%;
  height: 2px;
  background: var(--amber);
  border-radius: 0 0 2px 2px;
  transform: scaleX(0);
  transition: transform var(--transition);
}
.mob-tab.active { color: var(--white); }
.mob-tab.active::before { transform: scaleX(1); }
.mob-tab:active { color: var(--white-d); }
.mob-tab-icon { font-size: 18px; line-height: 1; }
.mob-tab-label { font-size: 9px; font-weight: 600; letter-spacing: 0.3px; white-space: nowrap; }

/* ══════════════════════════════════════════
   TABLET  768px – 1199px
══════════════════════════════════════════ */
@media (max-width: 1199px) {
  :root {
    --sidebar-w: 220px;
  }

  .nav-tab {
    padding: 0 12px;
    font-size: 12px;
  }
  .nav-tab .tab-icon { display: none; }

  #fiche-panel { width: 320px; }

  .nav-logo-text { font-size: 14px; }
  .nav-badge span { display: none; }
  .nav-badge { padding: 4px 8px; }

  .nav-search-btn kbd { display: none; }
  .nav-search-btn span:last-child { display: none; }
}

/* ══════════════════════════════════════════
   MOBILE  ≤ 767px
══════════════════════════════════════════ */
@media (max-width: 767px) {
  :root {
    --navbar-h: 52px;
    --toolbar-h: 48px;
    --statusbar-h: 0px;
  }

  /* ── Navbar ── */
  .hamburger-btn { display: flex; }

  .nav-tabs { display: none; }

  .nav-logo-text { display: none; }

  .nav-badge { display: none; }

  .nav-search-btn {
    padding: 6px 8px;
    min-width: 36px;
  }
  .nav-search-btn svg ~ * { display: none; }

  #navbar {
    padding: 0 10px;
    gap: 6px;
  }

  /* ── Sidebar as drawer ── */
  #sidebar {
    position: fixed;
    top: var(--navbar-h); bottom: 58px;
    left: 0;
    z-index: 300;
    width: min(80vw, 280px);
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  }
  #sidebar.mobile-open { transform: translateX(0); }

  /* ── Main content gets bottom padding for mobile nav ── */
  #content { padding-bottom: 0; }

  #main-area, [id^="main-area-"] {
    padding-bottom: 58px;
  }

  /* ── Toolbar: scrollable, icon-focused ── */
  #toolbar {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 5px;
    padding: 0 10px;
  }
  #toolbar::-webkit-scrollbar { display: none; }

  .tool-btn {
    height: 36px;
    padding: 0 10px;
    font-size: 11px;
    flex-shrink: 0;
  }

  .zoom-group { flex-shrink: 0; }

  /* ── Fiche panel: full-height sheet depuis sous la navbar ── */
  #fiche-panel {
    position: fixed;
    top: var(--navbar-h);   /* commence pile sous la navbar, pas derrière */
    bottom: 58px;           /* au-dessus de la mobile nav */
    left: 0; right: 0;
    width: 100%;
    height: auto;           /* défini par top + bottom, pas de hauteur fixe */
    border-left: none;
    border-top: 1px solid var(--border-l);
    border-radius: 0;
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.4,0,0.2,1);
    box-shadow: 0 -8px 40px rgba(0,0,0,0.5);
    /* Capture tous les événements touch pour ne pas laisser passer au canvas */
    touch-action: pan-y;
    pointer-events: auto;
  }
  #fiche-panel.open { transform: translateY(0); }

  /* Pas de drag handle (header est accessible directement) */
  #fiche-panel::before { display: none; }
  .fiche-header { padding-top: 14px; }

  /* ── Pipe fiche panel: même traitement ── */
  .pipe-fiche-panel {
    position: fixed !important;
    top: var(--navbar-h) !important;
    bottom: 58px !important;
    left: 0 !important; right: 0 !important;
    width: 100% !important;
    height: auto !important;
    border-left: none !important;
    border-top: 1px solid var(--border-l) !important;
    border-radius: 0 !important;
    transform: translateY(100%) !important;
    transition: transform 0.32s cubic-bezier(0.4,0,0.2,1) !important;
    box-shadow: 0 -8px 40px rgba(0,0,0,0.5) !important;
    touch-action: pan-y !important;
    pointer-events: auto !important;
  }
  .pipe-fiche-panel.open { transform: translateY(0) !important; }
  .pipe-fiche-panel::before {
    content: '';
    display: block;
    width: 40px; height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,0.15);
    margin: 10px auto 0;
  }

  /* ── Status bar: hidden ── */
  #status-bar { display: none; }

  /* ── Legend bar: compact ── */
  #legend-bar {
    bottom: 0;
    overflow-x: auto;
    white-space: nowrap;
    gap: 12px;
    font-size: 10px;
    padding: 0 10px;
    flex-wrap: nowrap;
  }
  #legend-bar::-webkit-scrollbar { display: none; }

  /* ── Mobile bottom nav: visible ── */
  #mobile-nav {
    display: flex;
  }

  /* ── Fiche grid: single column ── */
  .fiche-grid-2 { grid-template-columns: 1fr; }

  /* ── Touch targets: bigger ── */
  .fiche-close { width: 36px; height: 36px; }

  /* ── Footer buttons: taller ── */
  .btn-primary, .btn-secondary, .btn-danger { height: 42px; font-size: 13px; }
  .btn-icon-outline { height: 42px; padding: 0 14px; font-size: 12px; }

  /* ── Fiche footer: stack on small ── */
  .fiche-footer {
    flex-wrap: wrap;
    padding: 10px 14px;
  }
  .fiche-footer-actions { order: 3; width: 100%; justify-content: center; }

  /* ── Equip search panel: full width ── */
  .equip-search-panel {
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    position: fixed;
    top: var(--navbar-h);
    left: 0; right: 0;
    animation: search-drop-mobile 0.2s cubic-bezier(0.4,0,0.2,1);
  }
  @keyframes search-drop-mobile {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  .equip-search-overlay { padding-top: 0; align-items: flex-start; }

  /* ── QR modal: full screen ── */
  .qr-modal-panel {
    width: 100%;
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    position: fixed;
    bottom: 58px;
    left: 0; right: 0;
  }
  .qr-modal-overlay { align-items: flex-end; }

  /* ── Maintenance module: compact ── */
  .maint-topbar { flex-direction: column; gap: 10px; padding: 12px 14px; }
  .maint-stats-row { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .maint-stat { min-width: 80px; padding: 8px 12px; }

  .maint-subnav { overflow-x: auto; }
  .maint-subtab { padding: 10px 14px; white-space: nowrap; flex-shrink: 0; }

  /* ── Anomaly modal: full height ── */
  .anom-modal-overlay { align-items: flex-end; padding: 0; }
  .anom-modal {
    border-radius: 20px 20px 0 0;
    max-height: 92vh;
    width: 100%;
    max-width: 100%;
  }

  /* ── Pipe fiche 2-col grids: 1-col ── */
  .pf-row2 { grid-template-columns: 1fr !important; }
  .pf-row3 { grid-template-columns: 1fr !important; }
  .pf-row-longueur { grid-template-columns: 1fr !important; }

  /* ── Anom focus row: 1 col on very small ── */
  .anom-focus-row { grid-template-columns: 1fr; }

  /* Notifications: above mobile nav */
  #notifications { bottom: 70px; }

  /* Prevent iOS auto-zoom on input focus */
  input, select, textarea { font-size: 16px !important; }
}

/* ══════════════════════════════════════════
   VERY SMALL  ≤ 360px
══════════════════════════════════════════ */
@media (max-width: 360px) {
  .mob-tab-label { display: none; }
  .mob-tab { justify-content: center; }
  #mobile-nav { height: 50px; }
  #sidebar { bottom: 50px; }
  #fiche-panel { bottom: 50px !important; }
  .pipe-fiche-panel { bottom: 50px !important; }
}

/* ══════════════════════════════════════════
   LARGE SCREENS  ≥ 1400px
══════════════════════════════════════════ */
@media (min-width: 1400px) {
  :root { --sidebar-w: 280px; }
  #fiche-panel { width: 380px; }
}

/* ─── SAFE AREA INSETS (notch / home bar) ─ */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  #mobile-nav {
    padding-bottom: env(safe-area-inset-bottom);
    height: calc(58px + env(safe-area-inset-bottom));
  }
  @media (max-width: 767px) {
    #fiche-panel { bottom: calc(58px + env(safe-area-inset-bottom)); }
    .pipe-fiche-panel { bottom: calc(58px + env(safe-area-inset-bottom)) !important; }
    #sidebar { bottom: calc(58px + env(safe-area-inset-bottom)); }
  }
}

/* ─── PRINT: hide chrome, show content ─── */
@media print {
  #navbar, #sidebar, #toolbar, #status-bar, #legend-bar,
  #mobile-nav, .fiche-footer, #context-menu { display: none !important; }
  #content { padding: 0; }
  #canvas-wrap { overflow: visible; }
}
