/* GUIDEX-BF — code couleur de la signalisation de sécurité (ISO 7010) appliqué à l'interface.
   Rouge : interdiction, blocage.   Jaune et noir : avertissement, délai.
   Vert : situation sûre, étape faite.   Bleu : action obligatoire de l'administration.
   Orange haute visibilité : urgence.   Anthracite : structure (engins, roche).
   Couleur d'identité par ministère : latérite (Mines), bleu nuit (Sécurité), jaune (exploitants). */

@font-face {
  font-family: "Source Sans 3";
  src: url("../fonts/SourceSans3-latin.woff") format("woff");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --anthracite: #1e2124;
  --anthracite-2: #2b3035;
  --anthracite-3: #3a4047;
  --jaune: #f5b800;          /* fond uniquement, jamais en texte sur blanc */
  --jaune-fonce: #dba400;
  --jaune-clair: #fff4cc;
  --hivis: #ff6a13;          /* graphisme et texte sur anthracite seulement */
  --hivis-texte: #a84300;    /* le même orange, lisible sur fond clair */
  --hivis-clair: #ffece0;
  --rouge: #c8102e;
  --rouge-clair: #fbe7ea;
  --vert: #1e7a46;
  --vert-clair: #e2f2e8;
  --bleu: #1f4e8c;
  --bleu-clair: #e5eef8;
  --brun: #7a5a00;           /* texte sur jaune clair */
  --laterite: #a4472b;
  --nuit: #1f3a5f;

  --sol: #eeefec;            /* béton */
  --papier: #ffffff;
  --encre: #1e2124;
  --encre-douce: #5a6066;
  --trait: #d6d9db;
  --trait-fort: #b9bec2;

  --accent: var(--jaune);    /* identité du ministère connecté, surchargée par le thème */
  --accent-texte: var(--anthracite);

  --rayures: repeating-linear-gradient(-45deg, var(--jaune) 0 10px, var(--anthracite) 10px 20px);
  --rayures-fines: repeating-linear-gradient(-45deg, var(--jaune) 0 6px, var(--anthracite) 6px 12px);

  --titre: "Bahnschrift", "DIN Alternate", "Source Sans 3", system-ui, sans-serif;
  --texte: "Source Sans 3", "Segoe UI", system-ui, -apple-system, sans-serif;
  --r: 4px;
  --barre: 16rem;
}
.theme-mines { --accent: var(--laterite); --accent-texte: #fff; }
.theme-securite { --accent: var(--nuit); --accent-texte: #fff; }
.theme-controle { --accent: var(--bleu); --accent-texte: #fff; }

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--texte); font-size: 1rem; line-height: 1.5;
  color: var(--encre); background: var(--sol); font-variant-numeric: tabular-nums;
}
a { color: var(--bleu); text-underline-offset: 2px; }
a:hover { color: var(--anthracite); }
:focus-visible { outline: 3px solid var(--bleu); outline-offset: 2px; border-radius: 2px; }
.barre :focus-visible, .porte-identite :focus-visible, .indicateurs :focus-visible { outline-color: var(--jaune); }
h1, h2, h3 { font-family: var(--titre); color: var(--encre); margin: 0; line-height: 1.2; }
h1 { font-size: 1.8rem; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.12rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0 0 .75rem; }
small, .discret { color: var(--encre-douce); font-size: .87rem; }
code { font-size: .9em; background: var(--sol); padding: .05em .35em; border-radius: 3px; overflow-wrap: anywhere; }
.manque { color: var(--rouge); font-weight: 600; }

/* ---------------------------------------------------------------- coque */

.app { display: grid; grid-template-columns: var(--barre) 1fr; min-height: 100vh; }

.barre { background: var(--anthracite); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.barre::before { content: ""; display: block; height: 8px; background: var(--rayures-fines); flex: none; }
.marque { padding: 1.1rem 1.25rem 1rem; }
.marque-nom { font-family: var(--titre); font-weight: 700; font-size: 1.45rem; letter-spacing: .03em; color: #fff; text-decoration: none; display: flex; align-items: center; gap: .55rem; }
.marque-nom::before { /* losange de signalisation */
  content: ""; width: 1.1rem; height: 1.1rem; background: var(--jaune); border: 2px solid #fff; transform: rotate(45deg); flex: none;
}
.marque-sous { font-size: .82rem; color: rgba(255,255,255,.65); line-height: 1.3; margin-top: .3rem; }
.role-chip { margin: 0 1.25rem .5rem; padding: .45rem .7rem; border-radius: var(--r); background: var(--accent); color: var(--accent-texte); font-size: .85rem; font-weight: 600; line-height: 1.25; }
.role-chip span { display: block; font-weight: 400; opacity: .85; font-size: .8rem; }

.nav-bureau { display: flex; flex-direction: column; flex: 1; }
.nav { padding: .5rem 0 1rem; flex: 1; }
.nav-groupe { padding: .9rem 1.25rem .3rem; font-size: .8rem; color: rgba(255,255,255,.5); font-weight: 600; }
.nav a {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .5rem 1.25rem .5rem 1.05rem; color: rgba(255,255,255,.88); text-decoration: none;
  border-left: 4px solid transparent; font-weight: 500;
}
.nav a:hover { background: var(--anthracite-2); color: #fff; }
.nav a[aria-current="page"] { border-left-color: var(--jaune); background: var(--anthracite-3); color: #fff; font-weight: 600; }
.compte {
  min-width: 1.55rem; padding: 0 .4rem; border-radius: 999px; background: var(--hivis); color: var(--anthracite);
  font-size: .78rem; font-weight: 800; text-align: center; line-height: 1.4rem; transition: transform .2s;
}
.panneau-tete h2 .compte { display: inline-block; margin-left: .45rem; vertical-align: 2px; }
.compte.bouge { animation: pouls .6s ease-out 2; }
@keyframes pouls { 50% { transform: scale(1.3); } }

.qui { padding: 1rem 1.25rem; border-top: 1px solid var(--anthracite-3); font-size: .87rem; }
.qui strong { display: block; color: #fff; font-weight: 600; }
.qui span { color: rgba(255,255,255,.65); display: block; }
.qui form { margin-top: .6rem; }
.qui button { background: transparent; border: 1px solid rgba(255,255,255,.35); color: #fff; padding: .3rem .7rem; border-radius: var(--r); font: inherit; cursor: pointer; }
.qui button:hover { background: var(--anthracite-3); }

.contenu { min-width: 0; padding: 1.75rem 2.25rem 3rem; max-width: 80rem; }

.menu-mobile { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .barre { position: static; height: auto; }
  .nav-bureau { display: none; }
  .role-chip { margin-bottom: .75rem; }
  .menu-mobile { display: block; border-top: 1px solid var(--anthracite-3); }
  .menu-mobile summary { padding: .75rem 1.25rem; cursor: pointer; font-weight: 600; list-style: none; }
  .menu-mobile summary::-webkit-details-marker { display: none; }
  .contenu { padding: 1.25rem 1rem 2.5rem; }
}

/* ---------------------------------------------------------------- en-tête de page */

.tete { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.tete p { margin: .35rem 0 0; color: var(--encre-douce); max-width: 62ch; }
.tete-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.fil { font-size: .87rem; margin-bottom: .4rem; }
.fil a { color: var(--encre-douce); }
.horloge { font-size: .87rem; color: var(--encre-douce); display: flex; align-items: center; gap: .45rem; }
.horloge::before { content: ""; width: .55rem; height: .55rem; border-radius: 50%; background: var(--vert); box-shadow: 0 0 0 3px var(--vert-clair); }
.horloge.hors-ligne::before { background: var(--trait-fort); box-shadow: none; }

/* ---------------------------------------------------------------- panneaux */

.panneau { background: var(--papier); border: 1px solid var(--trait); border-radius: var(--r); margin-bottom: 1.25rem; }
.panneau > h2, .panneau-tete { padding: .9rem 1.15rem; border-bottom: 1px solid var(--trait); display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.panneau-corps { padding: 1rem 1.15rem; }
.panneau-corps > :last-child { margin-bottom: 0; }
.panneau.alerte { border-color: var(--rouge); box-shadow: inset 4px 0 0 var(--rouge); }
.panneau.confidentiel { border-color: var(--nuit); box-shadow: inset 4px 0 0 var(--nuit); }
.panneau.confidentiel > h2::after { content: "Diffusion restreinte"; font-family: var(--texte); font-size: .78rem; font-weight: 700; color: #fff; background: var(--nuit); padding: .1rem .5rem; border-radius: 3px; }

.colonnes { display: grid; grid-template-columns: minmax(0, 1fr) 22rem; gap: 1.25rem; align-items: start; }
.colonnes > * { min-width: 0; }
.colonnes > aside { position: sticky; top: 1rem; }
@media (max-width: 1100px) { .colonnes { grid-template-columns: minmax(0, 1fr); } .colonnes > aside { position: static; order: -1; } .colonnes.file-d-abord > aside { order: 0; } }
.deux-panneaux { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
@media (max-width: 1100px) { .deux-panneaux { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- indicateurs : tableau de commande */

.indicateurs { display: flex; background: var(--anthracite); border-radius: var(--r); margin-bottom: 1.25rem; overflow: hidden; position: relative; }
.indicateurs::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--rayures-fines); }
.indicateurs > div { flex: 1 0 9rem; padding: 1.05rem 1.15rem .85rem; border-right: 1px solid var(--anthracite-3); }
.indicateurs > div:last-child { border-right: 0; }
.indicateurs b { display: block; font-family: var(--titre); font-size: 2rem; font-weight: 700; line-height: 1.05; color: #fff; }
.indicateurs span { font-size: .87rem; color: rgba(255,255,255,.72); }
.indicateurs .chaud b { color: var(--hivis); }
.indicateurs .sur b { color: var(--jaune); }
@media (max-width: 700px) {
  .indicateurs { flex-wrap: wrap; }
  .indicateurs > div { flex: 1 0 50%; border-bottom: 1px solid var(--anthracite-3); }
  .indicateurs > div:nth-child(2n) { border-right: 0; }
}

/* ---------------------------------------------------------------- circuit : où en sont les dossiers */

.circuit { list-style: none; margin: 0; padding: .9rem 1.15rem 1rem; display: grid; gap: .45rem; }
.circuit li { display: grid; grid-template-columns: 11rem minmax(0, 1fr) 2.5rem; align-items: center; gap: .75rem; }
.circuit a { color: var(--encre); text-decoration: none; font-size: .93rem; }
.circuit a:hover { color: var(--bleu); text-decoration: underline; }
.circuit .barre-etape { height: 1.25rem; background: var(--sol); border-radius: 2px; overflow: hidden; }
.circuit .barre-etape span { display: block; height: 100%; width: calc(var(--p) * 1%); background: var(--anthracite-3); border-radius: 2px; transition: width .9s cubic-bezier(.2,.8,.2,1); }
.circuit li.vous .barre-etape span { background: var(--jaune); }
.circuit li.vous a { font-weight: 600; }
.circuit li.retard .barre-etape span { background: var(--rayures-fines); }
.circuit b { font-family: var(--titre); font-size: 1.1rem; text-align: right; }
.circuit-legende { padding: 0 1.15rem .9rem; font-size: .85rem; color: var(--encre-douce); display: flex; gap: 1.25rem; flex-wrap: wrap; }
.circuit-legende i { display: inline-block; width: .9rem; height: .7rem; margin-right: .35rem; vertical-align: -1px; border-radius: 2px; }
.anime .circuit .barre-etape span { width: 0; }
@media (max-width: 600px) { .circuit li { grid-template-columns: 7.5rem minmax(0, 1fr) 2rem; } }

/* ---------------------------------------------------------------- file « À traiter » */

.file { list-style: none; margin: 0; padding: 0; }
.file li { display: grid; grid-template-columns: minmax(0, 1fr) 15rem; gap: .5rem 1.5rem; align-items: center; padding: .9rem 1.15rem; border-top: 1px solid var(--trait); position: relative; }
.file li:first-child { border-top: 0; }
.file li.depasse::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--rayures-fines); }
.file a.objet { font-weight: 600; text-decoration: none; color: var(--encre); }
.file a.objet:hover { color: var(--bleu); text-decoration: underline; }
.file .quoi { display: block; color: var(--encre-douce); font-size: .92rem; margin-top: .15rem; }
.file .ref { font-family: var(--titre); font-weight: 600; color: var(--anthracite); margin-right: .5rem; white-space: nowrap; }
.file li.note { grid-template-columns: 1fr; padding: .7rem 1.15rem; font-size: .93rem; }
.file li.note a { color: var(--encre); text-decoration: none; }
.file li.note a:hover { color: var(--bleu); text-decoration: underline; }
.file li.ligne-courte { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .6rem 1.15rem; }
.file li.ligne-courte .ref { color: var(--bleu); text-decoration: none; }
@media (max-width: 700px) { .file li { grid-template-columns: 1fr; } }

.vide { padding: 1.5rem 1.15rem; color: var(--encre-douce); }
.vide strong { display: block; color: var(--encre); margin-bottom: .2rem; }

/* ---------------------------------------------------------------- la mèche (mise à jour en direct) */

.meche { --p: 0; display: grid; gap: .3rem; }
.meche-piste { position: relative; height: 6px; background: var(--trait); border-radius: 3px; }
.meche-piste::before { content: ""; position: absolute; inset: 0 auto 0 0; width: calc(var(--p) * 1%); border-radius: 3px; background: var(--ton); transition: width .9s cubic-bezier(.2,.8,.2,1); }
.meche-piste::after {
  content: ""; position: absolute; top: 50%; left: calc(var(--p) * 1%); width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px;
  border-radius: 50%; background: var(--ton); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ton) 25%, transparent);
  transition: left .9s cubic-bezier(.2,.8,.2,1); animation: etincelle 1.6s ease-in-out infinite;
}
@keyframes etincelle { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--ton) 12%, transparent); } }
.meche-texte { font-size: .85rem; color: var(--encre-douce); display: flex; justify-content: space-between; gap: .5rem; }
.meche-texte b { color: var(--ton-texte); font-weight: 700; }
.meche.calme { --ton: var(--vert); --ton-texte: var(--vert); }
.meche.calme .meche-piste::after { animation: none; }
.meche.tendue { --ton: var(--hivis); --ton-texte: var(--hivis-texte); }
.meche.depassee { --ton: var(--rouge); --ton-texte: var(--rouge); }
.meche.depassee .meche-piste { background: var(--rayures-fines); }
.meche.depassee .meche-piste::after { animation-duration: .9s; }
.anime .meche-piste::before { width: 0; }
.anime .meche-piste::after { left: 0; }
.meche.grande .meche-piste { height: 10px; border-radius: 5px; }
.meche.grande .meche-piste::after { width: 18px; height: 18px; margin: -9px 0 0 -9px; }
.meche.grande .meche-texte { font-size: .95rem; }

/* ---------------------------------------------------------------- statuts (code ISO 7010) */

.statut { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .82rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.statut.admin { background: var(--bleu-clair); color: var(--bleu); }        /* obligation : l'administration doit agir */
.statut.operateur { background: var(--jaune-clair); color: var(--brun); }  /* avertissement : l'exploitant doit agir */
.statut.urgent { background: var(--hivis-clair); color: var(--hivis-texte); border-color: #ffc9a8; }
.statut.fait { background: var(--vert-clair); color: var(--vert); }
.statut.bloque { background: var(--rouge-clair); color: var(--rouge); }
.statut.neutre { background: var(--sol); color: var(--encre-douce); border-color: var(--trait); }

/* ---------------------------------------------------------------- étapes du circuit */

.etapes { list-style: none; margin: 0; padding: 1.1rem 1.15rem; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: .25rem; counter-reset: etape; }
.etapes li { position: relative; padding-top: 1.75rem; font-size: .85rem; color: var(--encre-douce); counter-increment: etape; }
.etapes li::before {
  content: counter(etape); position: absolute; top: 0; left: 0; width: 1.4rem; height: 1.4rem; border-radius: 50%;
  border: 2px solid var(--trait-fort); background: var(--papier); font-size: .72rem; font-weight: 700; display: grid; place-items: center; color: var(--encre-douce); z-index: 1;
}
.etapes li::after { content: ""; position: absolute; top: .62rem; left: 1.6rem; right: .3rem; height: 3px; background: var(--trait); }
.etapes li:last-child::after { display: none; }
.etapes li.fait { color: var(--encre); }
.etapes li.fait::before { content: "✓"; background: var(--vert); border-color: var(--vert); color: #fff; }
.etapes li.fait::after { background: var(--vert); }
.etapes li.encours { color: var(--encre); font-weight: 700; }
.etapes li.encours::before { background: var(--jaune); border-color: var(--anthracite); color: var(--anthracite); box-shadow: 0 0 0 4px var(--jaune-clair); }
.etapes li.encours::after { background: var(--rayures-fines); }
.etapes li.bloque { color: var(--rouge); font-weight: 700; }
.etapes li.bloque::before { content: "✕"; border-color: var(--rouge); background: var(--rouge); color: #fff; }
@media (max-width: 760px) {
  .etapes { grid-auto-flow: row; }
  .etapes li { padding: 0 0 0 2rem; min-height: 1.6rem; }
  .etapes li::after { display: none; }
}

/* ---------------------------------------------------------------- fiches et tableaux */

.fiche { display: grid; grid-template-columns: 11rem minmax(0, 1fr); margin: 0; }
.fiche dt, .fiche dd { padding: .55rem 0; border-top: 1px solid var(--trait); margin: 0; }
.fiche dt { color: var(--encre-douce); font-size: .92rem; padding-right: 1rem; }
.fiche dt:first-of-type, .fiche dt:first-of-type + dd { border-top: 0; }
.fiche.etroite { grid-template-columns: 7rem minmax(0, 1fr); }
@media (max-width: 600px) { .fiche:not(.etroite) { grid-template-columns: 1fr; } .fiche:not(.etroite) dd { border-top: 0; padding-top: 0; } }

.tableau-defile { overflow-x: auto; }
table.donnees { width: 100%; border-collapse: collapse; font-size: .95rem; }
.donnees th { text-align: left; font-weight: 600; color: var(--encre-douce); font-size: .85rem; padding: .6rem 1.15rem; border-bottom: 2px solid var(--anthracite); white-space: nowrap; background: #f7f8f6; }
.donnees td { padding: .65rem 1.15rem; border-bottom: 1px solid var(--trait); vertical-align: top; }
.donnees tr:last-child td { border-bottom: 0; }
.donnees tbody tr:hover td { background: #fafaf8; }
.donnees .nombre { text-align: right; white-space: nowrap; }
.donnees td.manque { color: var(--rouge); font-weight: 600; }
.donnees .ref, .ligne-courte .ref { white-space: nowrap; font-family: var(--titre); font-weight: 600; text-decoration: none; }
.donnees a.ref:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- formulaires et boutons */

.formulaire { display: grid; gap: 1rem; max-width: 44rem; }
.champ { display: grid; gap: .3rem; }
.champ label { font-weight: 600; font-size: .92rem; }
.champ .aide { font-size: .85rem; color: var(--encre-douce); }
.champ .erreur, .erreurs, .erreur { color: var(--rouge); font-size: .87rem; }
.erreurs ul { margin: 0; padding-left: 1.1rem; }
.deux { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .deux { grid-template-columns: 1fr; } }

input[type=text], input[type=password], input[type=number], input[type=date], input[type=datetime-local],
input[type=email], input[type=search], input:not([type]), select, textarea {
  width: 100%; font: inherit; color: var(--encre); padding: .5rem .65rem;
  border: 1px solid var(--trait-fort); border-radius: var(--r); background: var(--papier);
}
input:focus, select:focus, textarea:focus { border-color: var(--anthracite); outline: 3px solid var(--jaune); outline-offset: 0; }
input[type=file] { font: inherit; }
textarea { min-height: 5rem; resize: vertical; }
.radios ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 1.25rem; flex-wrap: wrap; }
.radios label { font-weight: 400; }

.lignes { width: 100%; border-collapse: collapse; }
.lignes th { text-align: left; font-size: .85rem; color: var(--encre-douce); font-weight: 600; padding: 0 .5rem .35rem 0; }
.lignes td { padding: 0 .5rem .5rem 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 700;
  padding: .55rem 1.05rem; border-radius: var(--r); border: 2px solid var(--anthracite);
  background: var(--jaune); color: var(--anthracite); cursor: pointer; text-decoration: none; line-height: 1.25;
  transition: background .15s, transform .1s;
}
.btn:hover { background: var(--jaune-fonce); color: var(--anthracite); }
.btn:active { transform: translateY(1px); }
.btn.second { background: var(--papier); color: var(--anthracite); border-color: var(--trait-fort); font-weight: 600; }
.btn.second:hover { border-color: var(--anthracite); background: var(--papier); }
.btn.danger { background: var(--papier); color: var(--rouge); border-color: var(--rouge); }
.btn.danger:hover { background: var(--rouge); color: #fff; }
.btn.plein { width: 100%; }
.btn.petit { padding: .3rem .7rem; font-size: .9rem; }
.btn:disabled { background: var(--sol); border-color: var(--trait); color: var(--encre-douce); cursor: not-allowed; transform: none; }
.en-ligne { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.en-ligne input, .en-ligne select { width: auto; min-width: 12rem; }
.en-ligne input[type=checkbox], .en-ligne input[type=radio] { min-width: 0; }

/* ---------------------------------------------------------------- panneau d'action */

.action { background: var(--papier); border: 1px solid var(--trait); border-radius: var(--r); padding: 1rem 1.15rem; margin-bottom: 1rem; position: relative; overflow: hidden; }
.action::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--accent); }
.action h2 { margin: .2rem 0 .35rem; }
.action p { color: var(--encre-douce); font-size: .93rem; }
.action form + form { margin-top: .75rem; }
.action.danger::before { background: var(--rouge); }
.action.delai::before { background: var(--rayures-fines); height: 6px; }
.controle { list-style: none; margin: 0 0 1rem; padding: 0; }
.controle li { display: flex; gap: .6rem; padding: .4rem 0; border-top: 1px solid var(--trait); font-size: .93rem; }
.controle li:first-child { border-top: 0; }
.controle li::before { flex: none; width: 1.2rem; height: 1.2rem; border-radius: 50%; display: grid; place-items: center; font-size: .72rem; font-weight: 700; margin-top: .15rem; }
.controle li.ok::before { content: "✓"; background: var(--vert); color: #fff; }
.controle li.manque { color: var(--encre); font-weight: 400; }
.controle li.manque::before { content: "!"; background: var(--jaune); color: var(--anthracite); border: 2px solid var(--anthracite); }

/* ---------------------------------------------------------------- messages et bandeau en direct */

.messages { list-style: none; margin: 0 0 1.25rem; padding: 0; display: grid; gap: .5rem; }
.messages li { padding: .65rem 1rem; border-radius: var(--r); border: 1px solid; border-left-width: 5px; font-size: .95rem; background: var(--papier); }
.messages .success { border-color: var(--vert); color: #165c35; }
.messages .error { border-color: var(--rouge); color: #8e0b21; }
.messages .warning { border-color: var(--hivis); color: var(--hivis-texte); }
.messages .info { border-color: var(--bleu); color: var(--bleu); }

.bandeau-live { position: fixed; left: 50%; bottom: 1.25rem; transform: translate(-50%, 150%); z-index: 20;
  background: var(--anthracite); color: #fff; border-radius: var(--r); padding: .7rem .8rem .7rem 1.1rem;
  display: flex; gap: 1rem; align-items: center; box-shadow: 0 8px 24px rgba(30,33,36,.3); transition: transform .35s cubic-bezier(.2,.8,.2,1);
  border-top: 4px solid var(--jaune); max-width: calc(100vw - 2rem);
}
.bandeau-live.visible { transform: translate(-50%, 0); }
.bandeau-live[hidden], .compte[hidden] { display: none; }
.bandeau-live .btn { padding: .35rem .8rem; }

/* ---------------------------------------------------------------- filtres */

.filtres { display: flex; gap: .35rem; flex-wrap: wrap; padding: .75rem 1.15rem; border-bottom: 1px solid var(--trait); }
.filtres a { padding: .25rem .75rem; border-radius: 999px; border: 1px solid var(--trait-fort); text-decoration: none; color: var(--encre); font-size: .88rem; }
.filtres a:hover { border-color: var(--anthracite); }
.filtres a[aria-current="true"] { background: var(--anthracite); border-color: var(--anthracite); color: #fff; }

/* ---------------------------------------------------------------- jauge d'occupation */

.jauge { display: grid; grid-template-columns: minmax(5rem, 9rem) auto; gap: .6rem; align-items: center; }
.jauge-piste { height: 10px; background: var(--sol); border: 1px solid var(--trait); border-radius: 2px; overflow: hidden; }
.jauge-piste span { display: block; height: 100%; width: calc(var(--p) * 1%); background: var(--vert); transition: width .9s cubic-bezier(.2,.8,.2,1); }
.jauge.haute .jauge-piste span { background: var(--hivis); }
.jauge.pleine .jauge-piste span { background: var(--rayures-fines); }
.anime .jauge-piste span { width: 0; }
.jauge small { white-space: nowrap; }
.depot-tete { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }

/* ---------------------------------------------------------------- connexion */

.porte { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(22rem, 30rem); }
.porte-identite { background: var(--anthracite); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.porte-identite::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 14px; background: var(--rayures); }
.porte-identite::after { /* drapeau national discret en pied */
  content: ""; position: absolute; inset: auto 0 0 0; height: 6px; background: linear-gradient(90deg, var(--rouge) 0 50%, #009e49 50% 100%);
}
.porte-identite .etat { font-size: .95rem; color: rgba(255,255,255,.75); line-height: 1.4; margin-top: .5rem; }
.porte-identite .etat strong { color: #fff; display: block; font-size: 1.05rem; }
.porte-identite h1 { color: #fff; font-size: clamp(2.8rem, 6vw, 4.8rem); font-weight: 700; letter-spacing: .02em; margin: 2rem 0 .5rem; display: flex; align-items: center; gap: 1.2rem; }
.porte-identite h1::before { content: ""; width: .55em; height: .55em; background: var(--jaune); border: .07em solid #fff; transform: rotate(45deg); flex: none; }
.porte-identite .mission { font-size: 1.25rem; max-width: 30ch; line-height: 1.35; color: rgba(255,255,255,.92); }
.porte-identite .avert { font-size: .85rem; color: rgba(255,255,255,.6); max-width: 52ch; margin-bottom: .75rem; }
.porte-form { background: var(--papier); padding: 3rem 2.5rem; display: flex; flex-direction: column; justify-content: center; }
.porte-form h2 { font-size: 1.4rem; margin-bottom: 1.25rem; }
@media (max-width: 800px) { .porte { grid-template-columns: 1fr; } .porte-identite { padding: 2.25rem 1.5rem; } .porte-form { padding: 2rem 1.5rem; } }

.parcours { list-style: none; margin: 2.25rem 0 0; padding: 0; max-width: 34rem; counter-reset: p; }
.parcours li { position: relative; padding: 0 0 1.1rem 2.5rem; color: rgba(255,255,255,.7); font-size: .95rem; line-height: 1.4; counter-increment: p; }
.parcours li::before { content: counter(p); position: absolute; left: 0; top: 0; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--jaune); color: var(--anthracite); display: grid; place-items: center; font-size: .8rem; font-weight: 800; }
.parcours li::after { content: ""; position: absolute; left: .75rem; top: 1.75rem; bottom: .15rem; width: 2px; background: rgba(245,184,0,.35); }
.parcours li:last-child { padding-bottom: 0; }
.parcours li:last-child::after { display: none; }
.parcours b { display: block; color: #fff; font-weight: 600; font-size: 1.02rem; }

/* ---------------------------------------------------------------- double authentification et vérification */

.parcours-clair { list-style: none; margin: 0; padding: 0; counter-reset: p; }
.parcours-clair li { position: relative; padding: 0 0 1.1rem 2.5rem; counter-increment: p; color: var(--encre-douce); }
.parcours-clair li::before { content: counter(p); position: absolute; left: 0; top: 0; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--jaune); color: var(--anthracite); border: 2px solid var(--anthracite); display: grid; place-items: center; font-size: .8rem; font-weight: 800; }
.parcours-clair b { display: block; color: var(--encre); }
.cle { display: block; margin-top: .4rem; font-size: 1.05rem; letter-spacing: .08em; padding: .5rem .7rem; word-break: break-all; }
.code-otp { font-size: 1.5rem; letter-spacing: .4em; text-align: center; }
.qr-otp { display: block; margin: .6rem 0; }
.qr-otp svg { display: block; border: 1px solid var(--trait); border-radius: 4px; background: #fff; max-width: 100%; height: auto; }

.verdict { display: flex; gap: 1rem; align-items: flex-start; padding: 1.15rem; border-radius: var(--r); border: 2px solid; margin-bottom: 1rem; background: var(--papier); }
.verdict.vrai { border-color: var(--vert); box-shadow: inset 6px 0 0 var(--vert); }
.verdict.faux { border-color: var(--rouge); box-shadow: inset 6px 0 0 var(--rouge); }
.verdict .signe { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.verdict.vrai .signe { color: var(--vert); }
.verdict.faux .signe { color: var(--rouge); }
.qr { display: flex; gap: 1rem; align-items: center; margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--trait); }
.qr img { width: 112px; height: 112px; border: 1px solid var(--trait); border-radius: 4px; background: #fff; }

/* ---------------------------------------------------------------- mouvement : un seul moment à l'ouverture */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .anime .meche-piste::before, .anime .circuit .barre-etape span, .anime .jauge-piste span { width: calc(var(--p) * 1%); }
  .anime .meche-piste::after { left: calc(var(--p) * 1%); }
  .bandeau-live { transition: none; }
}

@media (max-width: 700px) {
  h1 { font-size: 1.5rem; }
  .tete-actions, .tete-actions form { width: 100%; }
  .tete-actions input { flex: 1; min-width: 0; }
}

@media print {
  .barre, .tete-actions, aside, .messages, .bandeau-live { display: none !important; }
  .app { display: block; } .contenu { padding: 0; }
  body { background: #fff; }
}

/* ---------------------------------------------------------------- suivi des convois */

.suivi-grille { display: grid; grid-template-columns: minmax(0, 1fr) 24rem; gap: 1.25rem; align-items: start; }
.suivi-grille > * { min-width: 0; }
@media (max-width: 1100px) { .suivi-grille { grid-template-columns: minmax(0, 1fr); } }
.carte { height: min(70vh, 44rem); min-height: 22rem; background: var(--sol); }
.carte-panneau .circuit-legende { padding-top: .75rem; }
.carte-panneau > .carte, .panneau > .carte { border-bottom: 1px solid var(--trait); }
.suivi-grille aside .file li { grid-template-columns: 1fr; gap: .45rem; }
.lien-convoi { all: unset; cursor: pointer; font-weight: 600; color: var(--encre); }
.lien-convoi:hover { color: var(--bleu); text-decoration: underline; }
.lien-convoi:focus-visible { outline: 3px solid var(--bleu); outline-offset: 2px; }
.leaflet-container { font-family: var(--texte); }
#son[aria-pressed="true"] { background: var(--rouge); border-color: var(--rouge); color: #fff; }

/* ---------------------------------------------------------------- performance des délais */

.perf { list-style: none; margin: 0; padding: 0; }
.perf li { padding: 1rem 1.15rem; border-top: 1px solid var(--trait); }
.perf li:first-child { border-top: 0; }
.perf-tete { display: flex; justify-content: space-between; gap: .75rem; flex-wrap: wrap; align-items: baseline; }
.perf-chiffres { display: flex; gap: .4rem; flex-wrap: wrap; }
.perf-barre { position: relative; height: 1.1rem; margin: .65rem 0 .35rem; background: var(--sol); border-radius: 2px; }
.perf-barre .p90, .perf-barre .med { position: absolute; inset: 0 auto 0 0; width: calc(var(--p) * 1%); border-radius: 0 4px 4px 0; transition: width .9s cubic-bezier(.2,.8,.2,1); }
.perf-barre .p90 { background: var(--trait-fort); }
.perf-barre .med { background: var(--anthracite-3); top: 3px; bottom: 3px; }
.perf-barre .limite { position: absolute; top: -4px; bottom: -4px; left: calc(var(--p) * 1%); width: 3px; margin-left: -1.5px; background: var(--rouge); border-radius: 2px; }
.anime .perf-barre .p90, .anime .perf-barre .med { width: 0; }
.perf-legende { margin: 0; font-size: .87rem; color: var(--encre-douce); }
.perf-legende b { color: var(--encre); font-weight: 600; }
.tendances { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1.25rem; padding: 1rem 1.15rem; }
.tendance { margin: 0; }
.tendance figcaption { font-weight: 600; font-size: .92rem; margin-bottom: .5rem; }
.tendance-barres { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 2px; align-items: end; height: 9rem; border-bottom: 1px solid var(--trait-fort); }
.tendance-col { display: grid; grid-template-rows: auto 1fr; height: 100%; align-items: end; position: relative; }
.tendance-col .colonne { display: block; height: calc(var(--p) * 1%); min-height: 2px; background: var(--anthracite-3); border-radius: 4px 4px 0 0; margin: 0 4px; transition: height .9s cubic-bezier(.2,.8,.2,1); }
.tendance-col .colonne.vide { background: transparent; }
.tendance-col:hover .colonne { background: var(--anthracite); }
.tendance-col .valeur { font-size: .72rem; text-align: center; color: var(--encre-douce); white-space: nowrap; align-self: end; }
.tendance-col .mois { position: absolute; bottom: -1.35rem; left: 0; right: 0; text-align: center; font-size: .75rem; color: var(--encre-douce); }
.tendance { padding-bottom: 1.4rem; }
.anime .tendance-col .colonne { height: 0; }
@media (prefers-reduced-motion: reduce) { .anime .perf-barre .p90, .anime .perf-barre .med { width: calc(var(--p) * 1%); } .anime .tendance-col .colonne { height: calc(var(--p) * 1%); } }

/* ---------------------------------------------------------------- signature mobile */

.carte-signature { max-width: 46rem; }
.carte-signature .panneau-tete h2 { font-size: 1.2rem; }
.signature-actions { display: grid; grid-template-columns: 2fr 1fr; gap: .6rem; margin-top: 1rem; }
.btn.grand { padding: .9rem 1rem; font-size: 1.1rem; }
@media (max-width: 600px) { .signature-actions { grid-template-columns: 1fr; } .carte-signature .fiche.etroite { grid-template-columns: 5.5rem minmax(0, 1fr); } }

/* Instance de démonstration */
.bandeau-demo{background:#f6c400;color:#1d1d1b;border-bottom:4px solid #1d1d1b;padding:.45rem 1rem;font-size:.9rem;text-align:center;}
.comptes-demo{border:2px dashed #b58f00;background:#fff8d6;padding:.75rem 1rem;margin:0 0 1rem;font-size:.9rem;}
.comptes-demo p{margin:0 0 .4rem;}
.comptes-demo dl{display:grid;grid-template-columns:auto 1fr;gap:.2rem .75rem;margin:0;}
.comptes-demo dt{font-weight:600;}
.comptes-demo dd{margin:0;font-family:inherit;}

/* Comptes et organisations */
.champ.en-erreur input, .champ.en-erreur select { border-color: var(--rouge); }
.champ small { display: block; margin-top: .2rem; }
.champ .case { display: flex; gap: .5rem; align-items: center; font-weight: 400; }
.champ .case input { width: auto; }
details.panneau-corps > summary { cursor: pointer; font-weight: 600; }
details.panneau-corps[open] > summary { margin-bottom: .75rem; }

/* Messagerie */
.onglets { display: flex; gap: .25rem; padding: .5rem 1rem 0; border-bottom: 1px solid var(--trait); }
.onglets a { padding: .45rem .75rem; color: var(--encre-douce); text-decoration: none; border-bottom: 3px solid transparent; }
.onglets a[aria-current] { color: var(--encre); font-weight: 600; border-bottom-color: var(--accent); }
.fils { list-style: none; margin: 0; padding: 0; }
.fils li + li { border-top: 1px solid var(--trait); }
.fils a { display: grid; gap: .15rem; padding: .8rem 1rem; color: inherit; text-decoration: none; }
.fils a:hover, .fils a:focus-visible { background: var(--sol); }
.fils li.non-lu { box-shadow: inset 4px 0 0 var(--accent); }
.fils li.non-lu .fil-extrait { color: var(--encre); }
.fil-tete { display: flex; gap: .5rem; align-items: baseline; }
.fil-tete strong { flex: 1; }
.fil-tete .compte { position: static; }
.fil-tete time, .fil-qui { color: var(--encre-douce); font-size: .87rem; }
.fil-extrait { color: var(--encre-douce); font-size: .93rem; overflow-wrap: anywhere; }
.discussion { list-style: none; margin: 0; padding: 1rem; display: grid; gap: 1rem; }
.discussion li { max-width: 46rem; }
.discussion li.moi { justify-self: end; }
.bulle-tete { font-size: .87rem; margin-bottom: .25rem; }
.bulle { background: var(--sol); border: 1px solid var(--trait); border-radius: 8px; padding: .65rem .85rem; overflow-wrap: anywhere; }
.discussion li.nous .bulle { background: var(--jaune-clair); }
.discussion li.moi .bulle { background: var(--bleu-clair); border-color: var(--bleu-clair); }
.formulaire.repondre { padding: 1rem; margin-top: .5rem; }
.lien-echanges { margin-left: .5rem; }
.pieces-message { list-style: none; margin: .5rem 0 0; padding: .5rem 0 0; border-top: 1px solid var(--trait); display: grid; gap: .25rem; }
.bulle > .pieces-message:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.pieces-message a { font-weight: 600; overflow-wrap: anywhere; }
.pieces-message a::before { content: "↓ "; color: var(--encre-douce); }

/* Les champs ne débordent jamais de leur colonne (Edge élargit les listes vides et le champ fichier). */
.formulaire, .champ { min-width: 0; }
.champ input, .champ select, .champ textarea, input[type=file] { max-width: 100%; min-width: 0; box-sizing: border-box; }
.champ select[multiple] { width: 100%; }
