/* =============================================================================
   app.css — Style sobre et industriel (section 9 : fond clair, une couleur
   d'accent, couleurs de secteur discrètes, zones cliquables ≥ 40 px).
   Polices système uniquement (aucun chargement externe).
   ============================================================================= */

:root {
  --fond: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --bordure: #d6dae0;
  --texte: #1f2933;
  --texte-discret: #5f6b7a;
  --accent: #0b6e8a;
  --accent-fonce: #08566c;
  --accent-clair: #e3f2f6;
  --danger: #b42318;
  --danger-clair: #fdecea;
  --avertissement: #b45309;
  --avertissement-clair: #fff4e0;
  --succes: #2e7d32;
  --succes-clair: #e8f5e9;
  --neutre: #64748b;

  --rayon: 6px;
  --ombre: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 1px rgba(15, 23, 42, 0.04);
  --ombre-haute: 0 10px 30px rgba(15, 23, 42, 0.18);
  --hauteur-cible: 40px;
  --police: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --police-mono: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
}

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

/* L'attribut hidden l'emporte toujours sur les display des composants. */
[hidden] { display: none !important; }

html { font-size: 15px; }

body {
  margin: 0;
  font-family: var(--police);
  color: var(--texte);
  background: var(--fond);
  line-height: 1.45;
  min-width: 320px;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.6em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; margin-top: 1.2em; }
p { margin: 0 0 0.8em; }
a { color: var(--accent); }
code { font-family: var(--police-mono); font-size: 0.9em; background: var(--surface-2); padding: 2px 5px; border-radius: 4px; border: 1px solid var(--bordure); word-break: break-all; }

.lien-evitement { position: absolute; left: -9999px; }
.lien-evitement:focus { left: 8px; top: 8px; z-index: 100; background: var(--surface); padding: 8px; }

:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

/* ----- En-tête ------------------------------------------------------------ */

.entete {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  min-height: 56px;
  background: #1f2933;
  color: #fff;
}

.marque {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
}

.marque-logo {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 5px solid var(--accent);
  background: #fff;
}

.menu { display: flex; flex-wrap: wrap; gap: 2px; min-width: 0; }

.menu-lien {
  display: inline-flex;
  align-items: center;
  min-height: var(--hauteur-cible);
  padding: 0 9px;
  border-radius: var(--rayon);
  font-size: 0.93rem;
  color: #d5dbe3;
  text-decoration: none;
  white-space: nowrap;
}
.menu-lien:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.menu-lien.actif { background: var(--accent); color: #fff; }

.entete-droite { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.entete .recherche {
  width: 170px;
  min-height: 36px;
  border-radius: var(--rayon);
  border: 1px solid #3e4c59;
  background: #2b3743;
  color: #fff;
  padding: 0 10px;
  font: inherit;
}
.recherche:disabled { opacity: 0.6; }

.indicateur {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}
.indicateur::before { content: "●"; margin-right: 6px; }
.indicateur-ok { background: #24412a; color: #b9e4bf; }
.indicateur-attente { background: #4a3a18; color: #ffd98a; }
.indicateur-erreur { background: #5c1e19; color: #ffb4ab; border-color: #ffb4ab; }
.indicateur-avertissement { background: #4a3a18; color: #ffd98a; }

/* Écran de démarrage : on masque la navigation tant qu'aucune donnée n'est chargée. */
.mode-demarrage .menu,
.mode-demarrage .entete-droite,
.mode-demarrage .fil-ariane { display: none; }

/* ----- Bandeaux, fil d'Ariane, contenu ------------------------------------ */

.bandeau {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--bordure);
}
.bandeau-info { background: var(--accent-clair); }
.bandeau-avertissement { background: var(--avertissement-clair); color: #6b3a06; }

.fil-ariane {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 24px;
  font-size: 0.9rem;
  color: var(--texte-discret);
  min-height: 40px;
}
.fil-ariane a { text-decoration: none; }
.fil-ariane a:hover { text-decoration: underline; }
.fil-ariane [aria-current] { color: var(--texte); font-weight: 600; }
.fil-separateur { color: #a0a8b3; }

.contenu { padding: 8px 24px 48px; max-width: 1400px; margin: 0 auto; outline: none; }

.page-entete { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.page-entete h1 { margin: 0; }

/* ----- Cartes et grilles -------------------------------------------------- */

.carte {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  padding: 18px 20px;
  margin-bottom: 16px;
}

.grille-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.grille-2 > .carte { margin-bottom: 0; }
.colonne > .carte + .carte { margin-top: 16px; }
.grille-cartes { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }

.carte-lien { display: block; color: inherit; text-decoration: none; transition: border-color 0.15s, box-shadow 0.15s; }
.carte-lien:hover { border-color: var(--accent); box-shadow: var(--ombre-haute); }
.carte-ligne { border-left: 6px solid var(--accent-ligne, var(--neutre)); }
.carte-ligne-titre { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; font-size: 1.1rem; }

.code { font-family: var(--police-mono); font-size: 0.85rem; color: var(--texte-discret); }

.pastille {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px 2px 8px;
  margin: 2px 6px 2px 0;
  border-radius: 999px;
  font-size: 0.85rem;
  background: color-mix(in srgb, var(--pastille) 12%, #fff);
  color: color-mix(in srgb, var(--pastille) 75%, #000);
  border: 1px solid color-mix(in srgb, var(--pastille) 35%, #fff);
}
.pastille::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--pastille); }

.liste-liens { list-style: none; margin: 0; padding: 0; }
.liste-liens li { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: var(--hauteur-cible); border-bottom: 1px solid var(--surface-2); }

dl.resume { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 12px; }
dl.resume dt { color: var(--texte-discret); }
dl.resume dd { margin: 0; }
dl.resume ul { margin: 0; padding-left: 18px; }

.texte-discret { color: var(--texte-discret); }
.petit { font-size: 0.85rem; }

/* ----- Boutons ------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--hauteur-cible);
  padding: 0 16px;
  border-radius: var(--rayon);
  border: 1px solid var(--bordure);
  background: var(--surface);
  color: var(--texte);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { border-color: #a9b2bd; background: var(--surface-2); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-principal { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-principal:hover { background: var(--accent-fonce); border-color: var(--accent-fonce); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #8f1c13; border-color: #8f1c13; }
.btn-discret { border-color: transparent; background: transparent; color: var(--texte-discret); }
.btn-discret:hover { background: rgba(15, 23, 42, 0.06); }
.btn-grand { min-height: 48px; font-size: 1.05rem; width: 100%; }
.btn-petit { min-height: 32px; padding: 0 10px; font-size: 0.9rem; }

.barre-boutons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

/* ----- Formulaires -------------------------------------------------------- */

.champ { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; min-width: 0; }
.champ-libelle { font-size: 0.85rem; font-weight: 600; color: var(--texte-discret); }
.champ-aide { font-size: 0.8rem; color: var(--texte-discret); }

input[type="text"], input[type="search"], input[type="number"], input[type="date"], select, textarea {
  min-height: var(--hauteur-cible);
  padding: 0 10px;
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  background: var(--surface);
  color: var(--texte);
  font: inherit;
  width: 100%;
}
input[type="color"] { width: 56px; height: var(--hauteur-cible); padding: 2px; border: 1px solid var(--bordure); border-radius: var(--rayon); background: var(--surface); }
input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }
.champ-court { max-width: 110px; }
.valeur-fixe { display: inline-flex; align-items: center; min-height: var(--hauteur-cible); color: var(--texte-discret); }

.ligne-formulaire { display: flex; align-items: flex-end; gap: 10px; }
.ligne-formulaire .champ { flex: 1; margin-bottom: 0; }

fieldset.cases { border: 1px solid var(--bordure); border-radius: var(--rayon); padding: 10px 14px; margin: 0 0 12px; }
fieldset.cases legend { font-size: 0.85rem; font-weight: 600; color: var(--texte-discret); padding: 0 6px; }
.case { display: flex; align-items: center; gap: 10px; min-height: var(--hauteur-cible); cursor: pointer; }

.ligne-copie { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }

/* ----- Messages ----------------------------------------------------------- */

.message { padding: 10px 14px; border-radius: var(--rayon); border-left: 4px solid; }
.message-info { background: var(--accent-clair); border-color: var(--accent); }
.message-avertissement { background: var(--avertissement-clair); border-color: var(--avertissement); }
.message-erreur { background: var(--danger-clair); border-color: var(--danger); color: #7a1a12; }

/* ----- Tableaux ----------------------------------------------------------- */

.tableau { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.tableau th, .tableau td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--bordure); }
.tableau th { font-size: 0.85rem; color: var(--texte-discret); font-weight: 600; background: var(--surface-2); }
.tableau .nombre { text-align: right; font-variant-numeric: tabular-nums; }
.tableau-compact th, .tableau-compact td { padding: 5px 10px; }
.tableau tr.difference td { background: var(--avertissement-clair); }

/* ----- Écran de démarrage ------------------------------------------------- */

.demarrage { display: flex; justify-content: center; padding-top: 8vh; }
.demarrage-carte {
  width: min(460px, 100%);
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: 10px;
  box-shadow: var(--ombre-haute);
  padding: 32px;
  text-align: center;
}
.demarrage-actions { display: flex; flex-direction: column; gap: 10px; margin: 24px 0; }

/* ----- Assistant ---------------------------------------------------------- */

.assistant { max-width: 820px; margin: 0 auto; }
.assistant-etapes { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0 0 20px; }
.assistant-etapes li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--texte-discret);
  font-size: 0.9rem;
}
.assistant-etapes .numero {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bordure);
  color: var(--texte);
  font-weight: 700;
  font-size: 0.8rem;
}
.assistant-etapes li.en-cours { background: var(--accent-clair); color: var(--texte); font-weight: 600; }
.assistant-etapes li.en-cours .numero { background: var(--accent); color: #fff; }
.assistant-etapes li.faite .numero { background: var(--succes); color: #fff; }
.assistant-pied { display: flex; justify-content: space-between; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--bordure); }
.assistant-alternatives { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 24px; padding-top: 16px; border-top: 1px dashed var(--bordure); }
.assistant-alternatives p { margin: 0; }

.liste-saisie { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.ligne-saisie { display: flex; align-items: flex-end; gap: 12px; }
.ligne-saisie .champ { margin-bottom: 4px; }
.ligne-saisie .champ:first-child { flex: 1; }
.ligne-saisie .btn { margin-bottom: 4px; }

/* ----- Modales ------------------------------------------------------------ */

dialog.modale {
  width: min(600px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  padding: 0;
  border: none;
  border-radius: 10px;
  box-shadow: var(--ombre-haute);
  color: var(--texte);
}
dialog.modale::backdrop { background: rgba(15, 23, 42, 0.45); }
.modale-titre { padding: 18px 20px 0; margin: 0; }
.modale-corps { padding: 14px 20px; overflow: auto; }
.modale-pied { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 12px 20px 18px; border-top: 1px solid var(--bordure); }

/* ----- Notifications ------------------------------------------------------ */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 1000;
  pointer-events: none;
}
.toast {
  min-width: 240px;
  max-width: min(560px, calc(100vw - 32px));
  padding: 10px 16px;
  border-radius: var(--rayon);
  background: #1f2933;
  color: #fff;
  box-shadow: var(--ombre-haute);
  border-left: 5px solid var(--succes);
  animation: toast-entree 0.2s ease-out;
  transition: opacity 0.3s, transform 0.3s;
}
.toast-info { border-left-color: var(--accent); }
.toast-avertissement { border-left-color: #f9a825; }
.toast-erreur { border-left-color: #ff6b5b; }
.toast-sortie { opacity: 0; transform: translateY(8px); }
@keyframes toast-entree { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ----- Tablette et petits écrans ------------------------------------------ */

@media (max-width: 1100px) {
  .entete { flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
  .entete-droite { margin-left: 0; width: 100%; }
  .recherche { flex: 1; }
}

@media (max-width: 800px) {
  .grille-2 { grid-template-columns: 1fr; }
  .contenu { padding: 8px 12px 48px; }
  .ligne-saisie { flex-wrap: wrap; }
}

/* ----- Impression (les fiches PDF arrivent à l'étape 7) -------------------- */

/* Impression : voir la section « Étape 7 — Exports PDF » en fin de fichier. */

/* =============================================================================
   Étape 2 — Référentiel : onglets, filtres, tableaux, formulaires, matrice
   ============================================================================= */

.page-entete-actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; }
.carte-entete { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.carte-entete h2 { margin: 0; }

.onglets { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 2px solid var(--bordure); margin-bottom: 14px; }
.onglets a {
  display: inline-flex; align-items: center; min-height: var(--hauteur-cible);
  padding: 0 16px; margin-bottom: -2px; border-bottom: 3px solid transparent;
  color: var(--texte-discret); text-decoration: none; font-weight: 500;
}
.onglets a:hover { color: var(--texte); }
.onglets a.actif { color: var(--accent); border-bottom-color: var(--accent); }

.barre-filtres { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.barre-filtres input[type="search"] { width: 240px; }
.barre-filtres select { width: auto; min-width: 160px; }
.barre-filtres .case { min-height: var(--hauteur-cible); }
.barre-filtres p { margin: 0; }
.pousser-droite { margin-left: auto; }

.tableau-defilant { overflow-x: auto; background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon); }
.tableau-defilant .tableau { margin: 0; }
.tableau td { vertical-align: middle; }
.tableau tr.ligne-cliquable { cursor: pointer; }
.tableau tr.ligne-cliquable:hover td { background: var(--accent-clair); }
.tableau tr.archive td { color: var(--texte-discret); background: repeating-linear-gradient(-45deg, transparent 0 8px, rgba(15, 23, 42, 0.025) 8px 16px); }
.tableau .col-actions { width: 1%; white-space: nowrap; text-align: right; }
.tableau-vide { padding: 16px; background: var(--surface); border: 1px dashed var(--bordure); border-radius: var(--rayon); }
.actions-ligne { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }

.nuancier { display: inline-block; width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(0, 0, 0, 0.15); flex: none; }
.nom-couleur { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }

/* Formulaires en fenêtre */
dialog.modale.modale-large { width: min(820px, calc(100vw - 32px)); }
.modale-formulaire { display: flex; flex-direction: column; max-height: calc(100vh - 64px); }
.modale-corps { flex: 1; }
.modale-erreur { margin-top: 8px; }
.grille-formulaire { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.ligne-champ { display: flex; gap: 6px; align-items: center; }
.ligne-champ input { flex: 1; }
.champ-moyen { max-width: 220px; }
textarea { padding: 8px 10px; min-height: 72px; resize: vertical; }
.cases-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 16px; }

/* Matrice formats × lignes */
.matrice th[scope="row"] { font-weight: 500; background: var(--surface); white-space: nowrap; }
.matrice .centre { text-align: center; }
.case-matrice { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 40px; cursor: pointer; border-radius: var(--rayon); }
.case-matrice:hover { background: var(--accent-clair); }

/* Complétude d'un format */
.completude { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.completude-barre { flex: 1; height: 8px; background: var(--surface-2); border: 1px solid var(--bordure); border-radius: 999px; overflow: hidden; }
.completude-remplie { height: 100%; background: var(--avertissement); }
.completude-remplie.complete { background: var(--succes); }
.completude-texte { font-variant-numeric: tabular-nums; font-size: 0.9rem; white-space: nowrap; }

@media (max-width: 800px) {
  .grille-formulaire { grid-template-columns: 1fr; }
  .barre-filtres input[type="search"], .barre-filtres select { width: 100%; }
  .pousser-droite { margin-left: 0; }
}

/* =============================================================================
   Étape 3 — Plan de l'usine et vue Ligne
   ============================================================================= */

.page-entete-aide { margin: 0 0 0 auto; max-width: 520px; text-align: right; }

.barre-plan { background: var(--surface); border: 1px solid var(--bordure); border-bottom: none; border-radius: var(--rayon) var(--rayon) 0 0; padding: 8px 10px; }
.barre-plan-principale { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.barre-plan-principale select { width: auto; min-width: 150px; }
.barre-plan-droite { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.plan-zoom-valeur { min-width: 48px; text-align: center; font-variant-numeric: tabular-nums; font-size: 0.85rem; color: var(--texte-discret); }
.barre-plan-edition { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-top: 8px; margin-top: 8px; border-top: 1px dashed var(--bordure); }
.barre-plan-edition .separateur { width: 1px; height: 24px; background: var(--bordure); margin: 0 4px; }

.plan { position: relative; border: 1px solid var(--bordure); border-radius: 0 0 var(--rayon) var(--rayon); background: #fbfcfd; overflow: hidden; }
.plan-svg { display: block; width: 100%; height: calc(100vh - 290px); min-height: 420px; touch-action: none; cursor: grab; user-select: none; outline: none; }
.plan-svg:active { cursor: grabbing; }
.plan-grille-fine { fill: none; stroke: #eef1f4; stroke-width: 0.6; }
.plan-grille { fill: none; stroke: #e1e6eb; stroke-width: 1; }
.plan-bandeau-edition { display: none; padding: 6px 12px; background: var(--avertissement); color: #fff; font-size: 0.85rem; font-weight: 500; }
.plan.en-edition { border-color: var(--avertissement); box-shadow: 0 0 0 2px color-mix(in srgb, var(--avertissement) 35%, transparent); }
.plan.en-edition .plan-bandeau-edition { display: block; }
.plan.en-edition .plan-svg { cursor: default; }

/* Blocs */
.plan-bloc { cursor: pointer; }
.plan-bloc-fond { fill: #fff; stroke: #b9c2cc; stroke-width: 1.2; filter: drop-shadow(0 1px 1.5px rgba(15, 23, 42, 0.12)); }
.plan-bloc:hover .plan-bloc-fond { stroke: var(--accent); stroke-width: 2; }
.plan-bloc.selectionne .plan-bloc-fond { stroke: var(--avertissement); stroke-width: 2.5; }
.plan-bloc.grise { opacity: 0.28; }
.plan-bloc-secondaire .plan-bloc-fond { stroke-dasharray: 6 4; fill: #f8fafc; }
.plan-bloc-mobile .plan-bloc-fond { fill: #f8fafc; }
.plan.en-edition .plan-bloc { cursor: move; }
.plan-titre { font-size: 15px; font-weight: 700; fill: var(--texte); }
.plan-code { font-family: var(--police-mono); font-size: 12px; fill: var(--texte-discret); }
.plan-texte-discret { font-size: 12px; fill: var(--texte-discret); }
.plan-incomplet { fill: var(--avertissement); }
.plan-rang { fill: var(--surface-2); stroke: var(--bordure); }
.plan-rang-texte { font-size: 12px; font-weight: 700; fill: var(--texte); }

/* Puces machines dans un bloc de ligne */
.plan-puce rect { fill: var(--accent-clair); stroke: color-mix(in srgb, var(--accent) 35%, #fff); }
.plan-puce text { font-size: 12px; fill: #0f4a5c; }
.plan-puce:hover rect { fill: var(--accent); }
.plan-puce:hover text { fill: #fff; }
.plan-puce.secondaire rect { fill: #fff; stroke-dasharray: 4 3; }
.plan-puce.grise { opacity: 0.3; }
.plan.en-edition .plan-puce { pointer-events: none; }

/* Flèches de flux et formes */
.plan-flux line { stroke: #7b8794; }
.plan-flux polygon { fill: #7b8794; }
.plan-forme { pointer-events: none; }
.plan.en-edition .plan-forme { pointer-events: auto; cursor: move; }
.plan-forme.selectionne { filter: drop-shadow(0 0 3px var(--avertissement)); }
.plan-zone-clic { stroke: transparent; stroke-width: 16; }
.plan-forme-libelle { font-size: 13px; font-weight: 600; }
.plan-forme-texte { font-size: 16px; font-weight: 600; }
.plan-poignee { fill: #fff; stroke: var(--avertissement); stroke-width: 1.5; vector-effect: non-scaling-stroke; }

.plan-proprietes {
  position: absolute; top: 40px; right: 10px; width: 220px;
  background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon);
  box-shadow: var(--ombre-haute); padding: 12px; display: flex; flex-direction: column; gap: 4px;
}
.plan-proprietes .champ { margin-bottom: 6px; }

/* Vue Ligne : plan + panneau latéral */
.vue-ligne { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.panneau-ligne .carte { margin-bottom: 12px; }
.carte-compacte { padding: 14px 16px; }
.carte-compacte h2 { font-size: 1.05rem; }

.liste-ordre { list-style: none; margin: 0; padding: 0; }
.liste-ordre li {
  display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 2px 4px;
  border-bottom: 1px solid var(--surface-2); background: var(--surface); border-radius: 4px;
}
.liste-ordre li.secondaire { background: repeating-linear-gradient(-45deg, transparent 0 6px, rgba(15, 23, 42, 0.03) 6px 12px); }
.liste-ordre li.survol { outline: 2px dashed var(--accent); }
.poignee-glisser { cursor: grab; color: #a0a8b3; letter-spacing: -2px; padding: 0 2px; }
.liste-ordre-rang { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--bordure); font-size: 0.75rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.liste-ordre-nom { flex: 1; min-width: 0; display: flex; flex-direction: column; text-decoration: none; color: var(--texte); line-height: 1.2; }
.liste-ordre-nom:hover { color: var(--accent); }
.liste-ordre-boutons { display: flex; }
.liste-ordre-boutons .btn { min-height: 32px; padding: 0 8px; }

.tableau tr.groupe th { background: var(--surface-2); text-align: left; font-size: 0.9rem; color: var(--texte); padding: 8px 10px; border-top: 2px solid var(--bordure); }

@media (max-width: 1100px) {
  .vue-ligne { grid-template-columns: 1fr; }
  .page-entete-aide { display: none; }
}

/* =============================================================================
   Étape 4 — Paramètres, modification avec motif, comparaison, historique
   ============================================================================= */

:root { --orange-tolerance: #ea7a0c; }

/* Fiche machine : onglets + format affiché */
.barre-onglets { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-bottom: 2px solid var(--bordure); margin-bottom: 14px; }
.barre-onglets .onglets { border-bottom: none; margin-bottom: 0; }
.selecteur-format { display: flex; align-items: center; gap: 8px; padding-bottom: 6px; font-size: 0.85rem; font-weight: 600; color: var(--texte-discret); }
.selecteur-format select { width: auto; min-width: 240px; }

/* Tableau des paramètres */
.tableau-parametres .nom-parametre { font-weight: 600; }
.valeur-cellule {
  display: inline-flex; align-items: baseline; gap: 6px; min-height: var(--hauteur-cible); min-width: 110px;
  padding: 0 12px; border: 1px solid var(--bordure); border-radius: var(--rayon); background: var(--surface);
  font: inherit; font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer; text-align: left;
}
.valeur-cellule:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-clair); }
.valeur-cellule.vide { color: var(--texte-discret); font-weight: 400; }
.valeur-cellule .unite { font-weight: 400; color: var(--texte-discret); font-size: 0.85rem; }
.hors-tolerance { outline: 2px solid var(--orange-tolerance); outline-offset: -2px; background: #fff3e6 !important; }
.badge-commun { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--texte-discret); border: 1px solid var(--bordure); border-radius: 4px; padding: 0 4px; }
.tableau tr.mise-en-evidence td { animation: clignoter 1.2s ease-in-out 3; }
@keyframes clignoter { 0%, 100% { background: transparent; } 50% { background: #fff2b3; } }

/* Fenêtre de modification d'une valeur */
.comparaison-valeurs { display: grid; grid-template-columns: 1fr auto 1.4fr; gap: 16px; align-items: start; margin: 8px 0 12px; }
.valeur-ancienne { font-size: 1.4rem; font-weight: 700; padding: 6px 10px; border-radius: var(--rayon); background: var(--surface-2); font-variant-numeric: tabular-nums; display: inline-block; min-width: 80px; }
.fleche-valeurs { font-size: 1.6rem; color: var(--texte-discret); padding-top: 26px; }
.champ-nombre { font-size: 1.2rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.unite { color: var(--texte-discret); white-space: nowrap; }
.segments { display: inline-flex; gap: 0; }
.segments .segment { border-radius: 0; min-width: 90px; }
.segments .segment:first-child { border-radius: var(--rayon) 0 0 var(--rayon); }
.segments .segment:last-child { border-radius: 0 var(--rayon) var(--rayon) 0; border-left: none; }
.segments .segment.actif { background: var(--accent); border-color: var(--accent); color: #fff; }
.grille-4 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.case-champ { align-self: end; margin-bottom: 12px; }

/* Frise des valeurs */
.frise { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 3px solid var(--bordure); }
.frise-entree { position: relative; padding: 4px 0 14px 12px; }
.frise-entree::before { content: ""; position: absolute; left: -26px; top: 9px; width: 13px; height: 13px; border-radius: 50%; background: var(--surface); border: 3px solid var(--accent); }
.frise-entree.type-creation::before { border-color: var(--succes); }
.frise-entree.type-ecart_constate::before { border-color: #c62828; }
.frise-entree.type-ecart_adopte::before { border-color: #ef6c00; }
.frise-valeur { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 1.1rem; }
.frise-valeur strong.hors-tolerance { padding: 0 6px; border-radius: 4px; }
.frise-motif { margin-top: 2px; }

/* Comparaison formats */
.matrice-comparaison th[scope="row"] { font-weight: 500; white-space: nowrap; background: var(--surface); }
.matrice-comparaison td { padding: 4px 6px; }
.matrice-comparaison .valeur-cellule { min-width: 90px; justify-content: center; font-weight: 500; }
.matrice-comparaison td.differente .valeur-cellule { background: #e8f1ff; border-color: #6a8fd8; font-weight: 700; }
.matrice-comparaison td.manquante .valeur-cellule { background: repeating-linear-gradient(-45deg, #fff 0 6px, #f1f3f5 6px 12px); color: var(--texte-discret); }
.matrice-comparaison td.modifiee { background: #fff8d6; }
.matrice-comparaison td input, .matrice-comparaison td select { min-width: 90px; text-align: center; }
.cellule-commune { color: var(--texte-discret); }
.legende { display: inline-block; padding: 1px 8px; border-radius: 4px; border: 1px solid var(--bordure); margin-right: 6px; }
.legende.differente { background: #e8f1ff; border-color: #6a8fd8; }
.legende.manquante { background: repeating-linear-gradient(-45deg, #fff 0 6px, #f1f3f5 6px 12px); }
.legende.hors-tolerance { outline-offset: -2px; }
.pied-masse {
  position: sticky; bottom: 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 12px; padding: 12px 14px; background: var(--surface); border: 2px solid var(--avertissement); border-radius: var(--rayon); box-shadow: var(--ombre-haute);
}
.champ-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 600; color: var(--texte-discret); }
.champ-inline input { width: auto; }
.champ-motif { flex: 1; }
.champ-motif input { flex: 1; min-width: 260px; }

/* Historique */
.filtres-historique { align-items: flex-start; }
.filtre-multiple { position: relative; }
.filtre-multiple > summary { list-style: none; white-space: nowrap; }
.filtre-multiple > summary::-webkit-details-marker { display: none; }
.filtre-multiple > summary::after { content: " ▾"; color: var(--texte-discret); }
.filtre-multiple.actif > summary { border-color: var(--accent); background: var(--accent-clair); color: var(--accent-fonce); }
.filtre-multiple-panneau {
  position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; width: 300px; max-height: 360px;
  display: flex; flex-direction: column; gap: 6px; padding: 10px; background: var(--surface);
  border: 1px solid var(--bordure); border-radius: var(--rayon); box-shadow: var(--ombre-haute);
}
.filtre-multiple-liste { overflow: auto; flex: 1; }
.filtre-multiple-liste .case { min-height: 34px; }
.filtres-historique input[type="date"] { width: auto; }
.tableau-historique { font-size: 0.9rem; }
.tableau-historique td { vertical-align: top; }
.tableau-historique .motif { display: block; min-width: 220px; }
.tableau-historique .tri { all: unset; cursor: pointer; font-weight: 600; white-space: nowrap; }
.tableau-historique .tri:focus-visible { outline: 2px solid var(--accent); }
.tableau-historique tr.type-structure td { color: var(--texte-discret); }
.code.bloc { display: block; font-size: 0.75rem; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 10px; }

@media (max-width: 800px) {
  .comparaison-valeurs { grid-template-columns: 1fr; }
  .fleche-valeurs { display: none; }
  .grille-4 { grid-template-columns: 1fr 1fr; }
}
.sans-coupure { white-space: nowrap; }

/* =============================================================================
   Étape 5 — Écrans HMI : rendu, simulateur, éditeur
   ============================================================================= */

/* Rendu commun */
.hmi-cadre { position: relative; overflow: hidden; border-radius: 6px; box-shadow: 0 6px 24px rgba(15, 23, 42, 0.35); }
.hmi-ecran { position: relative; overflow: hidden; font-family: system-ui, "Segoe UI", Roboto, Arial, sans-serif; user-select: none; }
.hmi-el { position: absolute; box-sizing: border-box; transform-origin: 50% 50%; }
.hmi-bouton { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 10px; text-align: center; line-height: 1.1; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25); }
.hmi-icone { font-size: 1.1em; }
.hmi-champ { display: flex; align-items: center; gap: 10px; padding: 0 10px; font-variant-numeric: tabular-nums; }
.hmi-libelle { font-size: 0.6em; flex: 0 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hmi-valeur { flex: 1; display: flex; align-items: baseline; gap: 6px; font-weight: 700; white-space: nowrap; }
.hmi-unite { font-size: 0.6em; font-weight: 400; opacity: 0.8; }
.hmi-afficheur { display: flex; align-items: center; justify-content: center; overflow: hidden; font-variant-numeric: tabular-nums; }
.hmi-valeur-afficheur { justify-content: center; font-family: ui-monospace, Consolas, monospace; }
.hmi-afficheur-jauge { justify-content: flex-start; }
.hmi-jauge-remplie { position: absolute; left: 0; top: 0; bottom: 0; transition: width 0.3s; }
.hmi-jauge-texte { position: relative; padding: 0 10px; font-weight: 700; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.hmi-texte { display: flex; align-items: center; white-space: pre-wrap; line-height: 1.2; overflow: hidden; }
.hmi-ligne-svg { display: block; overflow: visible; }
.hmi-non-lie { opacity: 0.75; border-style: dashed !important; }
.hmi-hors-tolerance { outline: 3px solid var(--orange-tolerance); outline-offset: 1px; }
.hmi-lien-manquant { outline: 2px dashed #f59e0b; outline-offset: 2px; }

/* Simulateur (consultation) */
.hmi-barre-consultation { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.hmi-barre-consultation select { width: auto; min-width: 200px; }
.hmi-scene-consultation { display: flex; justify-content: center; padding: 10px 0 20px; }
.hmi-mode-consultation .hmi-bouton { cursor: pointer; }
.hmi-mode-consultation .hmi-bouton:hover { filter: brightness(1.2); }
.hmi-mode-consultation .hmi-bouton:active { transform: translateY(1px); filter: brightness(0.9); }
.hmi-cliquable { cursor: pointer; }
.hmi-cliquable:hover { box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.45); }
.hmi-horloge { position: absolute; top: -10px; right: -10px; width: 26px; height: 26px; border-radius: 50%; border: 1px solid #475569; background: #f8fafc; font-size: 13px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity 0.15s; padding: 0; }
.hmi-champ:hover .hmi-horloge, .hmi-champ:focus-within .hmi-horloge { opacity: 1; }
.hmi-clignote { animation: hmi-clignote 0.6s ease-in-out 6; }
@keyframes hmi-clignote { 0%, 100% { box-shadow: 0 0 0 0 rgba(250, 204, 21, 0); } 50% { box-shadow: 0 0 0 8px rgba(250, 204, 21, 0.9); } }
.hmi-vide { text-align: center; padding: 40px 20px; }

/* Éditeur */
.hmi-editeur { border: 2px solid var(--avertissement); border-radius: var(--rayon); background: var(--surface); }
.hmi-bandeau-edition { background: var(--avertissement); color: #fff; padding: 6px 12px; font-weight: 600; font-size: 0.9rem; }
.hmi-barre-edition { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--bordure); background: var(--surface-2); }
.hmi-barre-edition .separateur { width: 1px; height: 24px; background: var(--bordure); margin: 0 4px; }
.case-compacte { min-height: 32px; font-size: 0.9rem; gap: 6px; }
.select-compact { width: auto; min-height: 32px; font-size: 0.9rem; }
.hmi-corps { display: grid; grid-template-columns: 190px minmax(0, 1fr) 280px; min-height: 560px; }
.hmi-palette { border-right: 1px solid var(--bordure); padding: 10px; overflow-y: auto; max-height: calc(100vh - 240px); }
.hmi-palette h3, .hmi-proprietes h3 { font-size: 0.95rem; margin: 4px 0 6px; }
.hmi-palette-liste { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.hmi-palette-element { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 8px; border: 1px solid var(--bordure); border-radius: var(--rayon); background: var(--surface); font: inherit; font-size: 0.9rem; cursor: grab; text-align: left; }
.hmi-palette-element:hover { border-color: var(--accent); background: var(--accent-clair); }
.hmi-palette-icone { width: 34px; text-align: center; font-weight: 700; color: var(--accent); font-size: 0.85rem; }
.hmi-ecrans { list-style: none; margin: 0 0 8px; padding: 0; }
.hmi-ecrans li { display: flex; align-items: center; gap: 2px; border-radius: 4px; }
.hmi-ecrans li.actif { background: var(--accent-clair); }
.hmi-ecran-nom { flex: 1; min-width: 0; text-align: left; border: none; background: none; font: inherit; font-size: 0.9rem; padding: 8px 6px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--texte); }
.hmi-ecrans li.actif .hmi-ecran-nom { font-weight: 700; color: var(--accent-fonce); }
.hmi-ecran-actions { display: flex; }
.btn-icone { border: none; background: none; cursor: pointer; width: 26px; height: 32px; color: var(--texte-discret); font-size: 0.9rem; }
.btn-icone:disabled { opacity: 0.3; cursor: default; }
.hmi-ecrans-boutons { display: flex; flex-wrap: wrap; gap: 4px; }
.hmi-scene { overflow: auto; padding: 20px; background: #e5e7eb; outline: none; max-height: calc(100vh - 240px); }
.hmi-scene .hmi-cadre { margin: 0 auto; }
.hmi-mode-edition .hmi-el { cursor: move; }
.hmi-grille { position: absolute; inset: 0; z-index: 0; pointer-events: none; background-image: linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px); background-size: 10px 10px; }
.hmi-overlay { position: absolute; inset: 0; z-index: 100000; pointer-events: none; }
.hmi-selection { position: absolute; box-sizing: border-box; border: 1.5px solid #38bdf8; box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.5); transform-origin: 50% 50%; }
.hmi-selection-groupe { border-style: dashed; }
.hmi-poignee { position: absolute; background: #fff; border: 1px solid #0284c7; pointer-events: auto; box-sizing: border-box; }
.hmi-poignee-rotation { border-radius: 50%; background: #38bdf8; cursor: grab; }
.hmi-tige { position: absolute; background: #38bdf8; }
.hmi-guide { position: absolute; background: #f43f5e; }
.hmi-cadre-selection { position: absolute; border: 1px dashed #38bdf8; background: rgba(56, 189, 248, 0.12); }

.hmi-proprietes { border-left: 1px solid var(--bordure); padding: 10px 12px; overflow-y: auto; max-height: calc(100vh - 240px); font-size: 0.9rem; }
.hmi-prop-section { border-top: 1px solid var(--bordure); padding-top: 8px; margin-top: 8px; }
.hmi-prop-section h4 { margin: 0 0 6px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--texte-discret); }
.hmi-prop { display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; min-width: 0; flex: 1; }
.hmi-prop > span { font-size: 0.78rem; font-weight: 600; color: var(--texte-discret); }
.hmi-prop input[type="text"], .hmi-prop select, .hmi-prop textarea, .hmi-prop .entree-nombre { min-height: 34px; font-size: 0.9rem; }
.entree-nombre { width: 100%; min-height: 34px; padding: 0 6px; border: 1px solid var(--bordure); border-radius: var(--rayon); font: inherit; }
.hmi-prop input[type="color"] { width: 100%; height: 34px; }
.hmi-prop-ligne { display: flex; gap: 6px; align-items: flex-end; flex-wrap: wrap; }
.hmi-grille-boutons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.hmi-grille-boutons .btn { padding: 0 4px; font-size: 0.8rem; }
.hmi-aide { margin-top: 12px; padding: 8px 10px; background: var(--surface-2); border-radius: var(--rayon); font-size: 0.8rem; }
.hmi-aide ul { margin: 4px 0 0; padding-left: 16px; }

/* Arborescence des menus */
.arbre-ecrans { list-style: none; margin: 0 0 12px; padding: 0; }
.arbre-ecrans li { padding: 6px 0; border-bottom: 1px solid var(--surface-2); }
.arbre-niveau { color: var(--texte-discret); }
.arbre-liens { margin-left: 22px; }
.lien-bouton { border: none; background: none; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }

@media (max-width: 1200px) {
  .hmi-corps { grid-template-columns: 160px minmax(0, 1fr) 240px; }
}

/* =============================================================================
   Étape 6 — Relevés terrain et pièces de format
   ============================================================================= */

.grille-releve { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 10px; }
.choix-ecarts { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.choix-ecart { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px; border: 1px solid var(--bordure); border-radius: var(--rayon); background: var(--surface); cursor: pointer; font-size: 0.88rem; }
.choix-ecart.actif { border-color: var(--accent); background: var(--accent-clair); font-weight: 600; }
.compteur-releve { font-weight: 600; color: var(--avertissement); }
.compteur-releve.complet { color: var(--succes); }
.carte-releve h2 { margin-bottom: 10px; }
.tableau-releve th[scope="row"] { font-weight: 500; background: var(--surface); min-width: 180px; }
.tableau-releve td input[type="text"], .tableau-releve td select { min-width: 120px; }
.tableau-releve .cellule-ecart { min-width: 320px; }
.tableau-releve tr.releve-conforme td, .tableau-releve tr.releve-conforme th { background: #f1f8f2; }
.tableau-releve tr.releve-ecart td, .tableau-releve tr.releve-ecart th { background: #fff4e6; }
.tableau-releve tr.releve-invalide td { background: var(--danger-clair); }
.texte-ecart { color: #b45309; font-weight: 600; }
.texte-erreur { color: var(--danger); font-size: 0.85rem; }
.pastille-orange { color: var(--orange-tolerance); font-weight: 600; }
.motif-ecart { width: 100%; }
.pied-releve { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 10px; padding: 12px 0; background: var(--fond); border-top: 1px solid var(--bordure); }
.tableau tr.releve-ecart td { background: #fff4e6; }
.carte-alerte { border-left: 5px solid #c62828; }
.bloc { display: block; }
.bloc-plein { width: 100%; margin: 6px 0 4px; }
.etiquette-format { display: inline-block; font-family: var(--police-mono); font-size: 0.78rem; padding: 1px 6px; margin: 1px 4px 1px 0; border: 1px solid var(--bordure); border-radius: 4px; background: var(--surface-2); }

@media (max-width: 1000px) { .grille-releve { grid-template-columns: 1fr 1fr; } }

/* =============================================================================
   Étape 7 — Recherche globale
   ============================================================================= */

.recherche-panneau {
  position: fixed; z-index: 2000; max-height: min(70vh, 640px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--bordure); border-radius: 8px; box-shadow: var(--ombre-haute); padding: 6px;
}
.recherche-groupe h3 { margin: 8px 8px 4px; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--texte-discret); }
.recherche-total { font-weight: 400; }
.recherche-resultat {
  display: flex; align-items: flex-start; gap: 10px; width: 100%; min-height: 44px; padding: 6px 10px;
  border: none; border-radius: 6px; background: none; font: inherit; color: var(--texte); text-align: left; cursor: pointer;
}
.recherche-resultat:hover, .recherche-resultat.actif { background: var(--accent-clair); }
.recherche-icone { width: 22px; flex: none; text-align: center; color: var(--accent); padding-top: 1px; }
.recherche-texte { display: flex; flex-direction: column; min-width: 0; }
.recherche-titre { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.recherche-detail { font-weight: 400; color: var(--texte-discret); }
.recherche-chemin { font-size: 0.82rem; color: var(--texte-discret); }
.recherche-resultat mark { background: #fde68a; color: inherit; border-radius: 2px; padding: 0 1px; }
.recherche-vide, .recherche-aide { margin: 8px 10px; color: var(--texte-discret); font-size: 0.85rem; }
.recherche-aide { border-top: 1px solid var(--surface-2); padding-top: 6px; }
.entete .recherche:focus { width: 260px; background: #fff; color: var(--texte); outline: none; }
.entete .recherche { transition: width 0.15s; }

/* =============================================================================
   Étape 7 — Exports PDF (mise en page d'impression)
   ============================================================================= */

#zone-impression { display: none; }

@media print {
  body.mode-impression { background: #fff; min-width: 0; }
  body.mode-impression > *:not(#zone-impression) { display: none !important; }
  body.mode-impression #zone-impression { display: block; }
  /* Impression directe d'un écran (Ctrl+P) sans export : on retire la navigation. */
  body:not(.mode-impression) .entete, body:not(.mode-impression) .bandeaux, body:not(.mode-impression) .toasts,
  body:not(.mode-impression) .btn, body:not(.mode-impression) .fil-ariane { display: none !important; }
}

#zone-impression, #zone-impression * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.imp-document { font: 9pt/1.3 system-ui, "Segoe UI", Arial, sans-serif; color: #111; }
.imp-entete { border-bottom: 2px solid #111; padding-bottom: 6px; margin-bottom: 10px; }
.imp-titre { display: flex; justify-content: space-between; align-items: baseline; }
.imp-titre h1 { font-size: 15pt; margin: 0; }
.imp-marque { font-size: 8pt; color: #555; }
.imp-infos { display: grid; grid-template-columns: max-content 1fr max-content 1fr; gap: 1px 10px; margin: 6px 0 0; }
.imp-infos dt { color: #555; }
.imp-infos dd { margin: 0; font-weight: 600; }
.imp-document h2 { font-size: 11pt; margin: 10px 0 4px; }
.imp-document h3 { font-size: 9.5pt; margin: 8px 0 3px; }
.imp-tableau { width: 100%; border-collapse: collapse; margin-bottom: 4px; }
.imp-tableau th, .imp-tableau td { border: 0.5pt solid #999; padding: 2px 5px; text-align: left; vertical-align: top; }
.imp-tableau thead th { background: #e5e7eb; font-size: 8pt; }
.imp-tableau thead { display: table-header-group; }
.imp-tableau tr { break-inside: avoid; }
.imp-groupe th { background: #f3f4f6; font-size: 8.5pt; }
.imp-valeur { font-weight: 700; white-space: nowrap; }
.imp-hors td { background: #fff1e0; }
.imp-hors .imp-valeur { outline: 1pt solid #ea7a0c; }
.imp-coche { text-align: center !important; width: 34px; }
.imp-discret { color: #666; font-size: 8pt; }
.imp-commun { color: #666; font-weight: 400; font-size: 8pt; }
.imp-code { font-family: ui-monospace, Consolas, monospace; font-size: 8pt; }
.imp-bloc { display: block; }
.imp-nowrap { white-space: nowrap; }
.imp-vide { color: #666; font-style: italic; }
.imp-observations { margin-top: 10px; border: 0.5pt solid #999; min-height: 50px; padding: 4px 6px; }
.imp-bloc-machine { display: flex; gap: 6px; break-inside: avoid; border-top: 1pt solid #bbb; padding-top: 4px; margin-top: 6px; }
.imp-rang { font-weight: 700; font-size: 11pt; padding-top: 9px; }
.imp-bloc-machine .imp-machine { flex: 1; }
.imp-historique { font-size: 7.5pt; }
.imp-capture { break-after: page; }
.imp-capture:last-child { break-after: auto; }
.imp-capture-titre { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; font-size: 9pt; }
.imp-capture-cadre { position: relative; overflow: hidden; border: 0.5pt solid #333; }

/* Aide des raccourcis */
.raccourcis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 24px; }
.raccourcis h3 { font-size: 0.9rem; margin: 10px 0 4px; color: var(--accent-fonce); }
.raccourcis dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0; font-size: 0.88rem; }
.raccourcis dd { margin: 0; color: var(--texte-discret); }
kbd { display: inline-block; min-width: 22px; padding: 1px 6px; border: 1px solid var(--bordure); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-2); font: 600 0.8rem var(--police-mono); text-align: center; }
@media (max-width: 800px) { .raccourcis { grid-template-columns: 1fr; } }

/* =============================================================================
   Organigramme (vue macro)
   ============================================================================= */

.orga-tete .plan-bloc-fond { fill: transparent; stroke: none; }
.orga-tete-fond { filter: drop-shadow(0 1px 2px rgba(15, 23, 42, 0.25)); }
.orga-tete-titre { font-size: 16px; font-weight: 700; fill: #fff; }
.orga-tete-code { font-family: var(--police-mono); font-size: 12px; fill: rgba(255, 255, 255, 0.85); }
.orga-tete-detail { font-size: 12px; fill: rgba(255, 255, 255, 0.9); }
.orga-commune .plan-bloc-fond { stroke: #7c3aed; stroke-width: 2; stroke-dasharray: 5 3; }
.orga-badge-commune { font-size: 10px; font-weight: 700; fill: #7c3aed; text-transform: uppercase; letter-spacing: 0.04em; }
.orga-pastille { font-size: 10px; font-weight: 700; font-family: var(--police-mono); }
.plan-bloc.depart-liaison .plan-bloc-fond { stroke: #7c3aed; stroke-width: 3; }
.plan.en-liaison .plan-bloc { cursor: crosshair; }
.plan.en-liaison .plan-bloc:hover .plan-bloc-fond { stroke: #7c3aed; stroke-width: 3; }

.plan-lien.grise, .plan-flux.grise { opacity: 0.12; }
.plan-lien.selectionnable { cursor: pointer; }
.plan.en-edition .plan-lien.selectionnable:hover line:not(.plan-zone-clic) { stroke-width: 4; }
.plan-lien.selectionne { filter: drop-shadow(0 0 3px #f59e0b) drop-shadow(0 0 2px #f59e0b); }
.plan-lien-texte { font-size: 12px; font-weight: 700; paint-order: stroke; stroke: #fff; stroke-width: 4px; stroke-linejoin: round; }
.plan:not(.en-edition) .plan-lien .plan-zone-clic { pointer-events: none; }
.plan-bandeau-liaison { display: flex; align-items: center; gap: 12px; padding: 6px 12px; background: #7c3aed; color: #fff; font-weight: 600; font-size: 0.9rem; }

.orga-legende { display: flex; flex-wrap: wrap; gap: 6px 22px; padding: 10px 2px; font-size: 0.85rem; color: var(--texte-discret); }
.orga-legende > span { display: inline-flex; align-items: center; gap: 8px; }
.orga-ex { display: inline-block; width: 34px; height: 0; border-top: 3px solid #0b6e8a; }
.orga-ex-commune { border-top-style: dashed; border-top-color: #1d4ed8; }
.orga-ex-manuelle { border-top-color: #7c3aed; border-top-width: 4px; }

.choix-liaisons { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.choix-liaison { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--bordure); border-radius: var(--rayon); cursor: pointer; }
.choix-liaison:has(input:checked) { border-color: var(--accent); background: var(--accent-clair); }
.choix-liaison input { margin-top: 3px; }

/* Impression de l'organigramme */
.imp-organigramme .plan-export { display: block; width: 100%; height: 148mm; border: 0.5pt solid #bbb; }
.imp-organigramme .orga-legende { font-size: 8pt; color: #333; }
.plan-elastique { pointer-events: none; }

/* ----- Application installée (programme local) ----- */
a.btn { text-decoration: none; }
.chemin-fichier { display: inline-block; max-width: 100%; }
.liste-copies { list-style: none; margin: 0 0 12px; padding: 0; max-height: 220px; overflow: auto; }
.liste-copies li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 0; border-bottom: 1px solid var(--bordure); }
.formulaire-connexion { text-align: left; }
