/* =====================================================================
   SUIVI ENGINS — feuille de style
   ---------------------------------------------------------------------
   Toute l'apparence de l'application est ici. Le moteur (Apps Script)
   et la logique (app.js) n'en dépendent pas : on peut refaire le visuel
   entier sans toucher aux données.
   Les couleurs, polices et arrondis se règlent dans les variables
   ci-dessous.
   ===================================================================== */

@font-face { font-family: 'Barlow'; font-weight: 400; font-display: swap; src: url(polices/barlow-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 500; font-display: swap; src: url(polices/barlow-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 600; font-display: swap; src: url(polices/barlow-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 700; font-display: swap; src: url(polices/barlow-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 500; font-display: swap; src: url(polices/barlow-condensed-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 600; font-display: swap; src: url(polices/barlow-condensed-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 700; font-display: swap; src: url(polices/barlow-condensed-latin-700-normal.woff2) format('woff2'); }

:root {
  --encre: #14202B;
  --encre-2: #4B5B6B;
  --encre-3: #7C8997;
  --fond: #EEF1F4;
  --carte: #FFFFFF;
  --trait: #DCE2E8;
  --trait-2: #C2CCD6;
  --marine: #1F4E79;
  --marine-fonce: #142F49;
  --marine-pale: #E6EEF6;
  --signal: #F2B705;
  --signal-pale: #FFF5D1;
  --rouge: #B3261E;
  --rouge-pale: #FCE8E6;
  --ambre: #8A5A00;
  --ambre-pale: #FFF2D4;
  --vert: #1B7F4C;
  --vert-pale: #E2F3E9;
  --info: #2E6DA4;
  --police: 'Barlow', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --police-titre: 'Barlow Condensed', 'Barlow', 'Arial Narrow', sans-serif;
  --r-carte: 12px;
  --r: 8px;
  --ombre: 0 1px 2px rgba(20, 32, 43, .05), 0 6px 18px rgba(20, 32, 43, .06);
  --ombre-forte: 0 18px 50px rgba(20, 32, 43, .22);
  --largeur-nav: 232px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 15px/1.5 var(--police); color: var(--encre); background: var(--fond);
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--marine); }
h1, h2, h3 { font-family: var(--police-titre); font-weight: 600; margin: 0; letter-spacing: .01em; }
h1 { font-size: 28px; line-height: 1.15; }
h2 { font-size: 21px; line-height: 1.2; }
h3 { font-size: 17px; line-height: 1.25; }
.discret { color: var(--encre-2); }
.tres-discret { color: var(--encre-3); font-size: 13px; }
.cache { display: none !important; }
:focus-visible { outline: 2px solid var(--marine); outline-offset: 2px; }

/* ------------------------------------------------------------ la plaque
   Le code engin est affiché comme le numéro de parc peint sur l'engin.
   C'est l'élément signature de l'application. */
.plaque {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: var(--police-titre); font-weight: 700; font-size: 14px; letter-spacing: .05em; line-height: 1;
  color: var(--encre); background: var(--signal); border: 1.5px solid var(--encre);
  border-radius: 4px; padding: 4px 8px 3px; white-space: nowrap; position: relative;
}
.plaque.grande { font-size: 24px; padding: 7px 14px 6px; border-width: 2px; border-radius: 5px; }
.plaque.grande::before, .plaque.grande::after {
  content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--encre); opacity: .8;
}
.plaque.archive { background: #E3E6E9; color: var(--encre-2); border-color: var(--encre-3); }

/* ------------------------------------------------------------ structure */
.appli { display: grid; grid-template-columns: var(--largeur-nav) 1fr; min-height: 100vh; }
.nav {
  background: var(--marine-fonce); color: #DCE6F0; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; padding: 18px 12px; gap: 4px; z-index: 40;
}
.nav .marque { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; color: #fff; }
.nav .marque img { width: 38px; height: 38px; border-radius: 9px; }
.nav .marque .nom { font-family: var(--police-titre); font-weight: 700; font-size: 20px; line-height: 1; letter-spacing: .02em; }
.nav .marque .client { font-size: 12px; color: #9FB3C7; margin-top: 3px; }
.nav a.lien-nav {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px; color: #DCE6F0;
  text-decoration: none; font-weight: 500; position: relative;
}
.nav a.lien-nav svg { width: 20px; height: 20px; flex: none; opacity: .85; }
.nav a.lien-nav:hover { background: rgba(255, 255, 255, .07); }
.nav a.lien-nav.actif { background: rgba(255, 255, 255, .11); color: #fff; }
.nav a.lien-nav.actif::before {
  content: ''; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 3px 3px 0;
  background: var(--signal);
}
.nav .compteur-nav {
  margin-left: auto; font-size: 12px; font-weight: 600; background: var(--rouge); color: #fff; border-radius: 999px;
  padding: 1px 7px;
}
.nav .pied-nav { margin-top: auto; padding: 12px 8px 4px; border-top: 1px solid rgba(255, 255, 255, .1); font-size: 13px; }
.nav .pied-nav .qui { color: #fff; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav .pied-nav .role { color: #9FB3C7; font-size: 12px; }
.nav .pied-nav button { margin-top: 10px; background: transparent; border: 1px solid rgba(255, 255, 255, .25); color: #DCE6F0;
  padding: 5px 10px; border-radius: 7px; cursor: pointer; font-size: 13px; }

.principal { min-width: 0; display: flex; flex-direction: column; }
.barre {
  position: sticky; top: 0; z-index: 30; background: rgba(238, 241, 244, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--trait); display: flex; align-items: center; gap: 12px; padding: 12px 28px;
}
.recherche-globale { position: relative; flex: 1; max-width: 520px; }
.recherche-globale input[type=search] {
  width: 100%; padding: 9px 12px 9px 38px; border: 1px solid var(--trait-2); border-radius: 10px; background: #fff;
}
.recherche-globale svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--encre-3); }
.suggestions {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--trait);
  border-radius: 10px; box-shadow: var(--ombre-forte); max-height: 360px; overflow: auto; z-index: 50;
}
.suggestions button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 9px 12px; border: 0;
  background: none; text-align: left; cursor: pointer; }
.suggestions button:hover, .suggestions button.sel { background: var(--marine-pale); }
.barre .espace { flex: 1; }
.cloche { position: relative; }
.bouton-icone {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--trait-2); background: #fff;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--encre-2);
}
.bouton-icone svg { width: 20px; height: 20px; }
.bouton-icone:hover { border-color: var(--encre-3); color: var(--encre); }
.badge-cloche {
  position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; border-radius: 999px; background: var(--rouge);
  color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 5px;
  border: 2px solid var(--fond);
}
.panneau-alertes {
  position: absolute; right: 0; top: calc(100% + 8px); width: min(420px, 92vw); background: #fff; border: 1px solid var(--trait);
  border-radius: 12px; box-shadow: var(--ombre-forte); z-index: 60; overflow: hidden;
}
.panneau-alertes header { padding: 12px 16px; border-bottom: 1px solid var(--trait); display: flex; align-items: center; gap: 8px; }
.panneau-alertes .liste { max-height: 60vh; overflow: auto; }
.contenu { padding: 24px 28px 60px; max-width: 1480px; width: 100%; }

/* ------------------------------------------------------------ boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer;
  border: 1px solid var(--trait-2); background: #fff; color: var(--encre); padding: 8px 14px; border-radius: var(--r);
  font-weight: 500; transition: background .12s, border-color .12s; white-space: nowrap; text-decoration: none;
}
.btn svg { width: 17px; height: 17px; }
.btn:hover { border-color: var(--encre-3); background: #FAFBFC; }
.btn.principal-btn { background: var(--marine); border-color: var(--marine); color: #fff; }
.btn.principal-btn:hover { background: var(--marine-fonce); }
.btn.valider { background: var(--vert); border-color: var(--vert); color: #fff; }
.btn.valider:hover { background: #136039; }
.btn.danger { color: var(--rouge); border-color: #E9C1BD; }
.btn.danger:hover { background: var(--rouge-pale); }
.btn.mini { padding: 5px 10px; font-size: 13px; }
.btn.lien { border: 0; background: none; color: var(--marine); padding: 4px 6px; text-decoration: underline; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.occupe { position: relative; color: transparent !important; pointer-events: none; }
.btn.occupe::after { content: ''; position: absolute; width: 16px; height: 16px; border: 2px solid currentColor;
  border-color: var(--encre-3) transparent var(--encre-3) transparent; border-radius: 50%; animation: tourne .8s linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }
.groupe-btn { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ------------------------------------------------------------ champs */
input[type=text], input[type=email], input[type=date], input[type=number], input[type=search], select, textarea {
  padding: 8px 10px; border: 1px solid var(--trait-2); border-radius: var(--r); background: #fff; max-width: 100%; min-height: 38px;
}
textarea { min-height: 76px; resize: vertical; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--marine); outline-offset: -1px; border-color: var(--marine); }
label.champ { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--encre-2); }
label.champ > span .requis { color: var(--rouge); }
label.champ input, label.champ select, label.champ textarea { font-size: 15px; color: var(--encre); }
.interrupteur { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: 14px; }
.interrupteur input { appearance: none; width: 38px; height: 22px; border-radius: 999px; background: var(--trait-2); position: relative;
  cursor: pointer; transition: background .15s; margin: 0; flex: none; }
.interrupteur input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.interrupteur input:checked { background: var(--vert); }
.interrupteur input:checked::after { transform: translateX(16px); }

/* ------------------------------------------------------------ cartes */
.carte { background: var(--carte); border: 1px solid var(--trait); border-radius: var(--r-carte); box-shadow: var(--ombre); }
.carte > header { padding: 14px 18px; border-bottom: 1px solid var(--trait); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.carte > header h2, .carte > header h3 { flex: 1; }
.carte .corps, .carte.corps { padding: 16px 18px; }
.carte-carte { display: flex; flex-direction: column; }
.carte-carte #carteEngins { flex: 1; }
.grille { display: grid; gap: 18px; }
.g-2 { grid-template-columns: 1fr 1fr; }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-carte { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.entete-page { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.entete-page .titres { flex: 1; min-width: 240px; }
.entete-page .titres p { margin: 4px 0 0; color: var(--encre-2); }

/* ------------------------------------------------------------ puces */
.puce { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12.5px;
  font-weight: 600; white-space: nowrap; line-height: 1.6; }
.puce::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .85; }
.puce.sans-point::before { display: none; }
.puce.dispo { background: var(--vert-pale); color: var(--vert); }
.puce.location { background: var(--marine-pale); color: var(--marine); }
.puce.panne { background: var(--rouge-pale); color: var(--rouge); }
.puce.maintenance { background: var(--ambre-pale); color: var(--ambre); }
.puce.neutre { background: #EDEFF2; color: var(--encre-2); }
.puce.critique { background: var(--rouge-pale); color: var(--rouge); }
.puce.attention { background: var(--ambre-pale); color: var(--ambre); }
.puce.info { background: var(--marine-pale); color: var(--info); }
.puce.verifier { background: var(--signal-pale); color: #7A5B00; }

/* ------------------------------------------------------------ échéancier (accueil) */
.echeancier { padding: 18px 18px 10px; }
.frise { display: grid; grid-template-columns: 150px 1fr; gap: 16px; align-items: stretch; }
.depassees {
  border-radius: 10px; background: var(--rouge-pale); color: var(--rouge); padding: 12px 14px; display: flex; flex-direction: column;
  justify-content: center; cursor: pointer; border: 1px solid #F1C6C1;
}
.depassees .nb { font-family: var(--police-titre); font-weight: 700; font-size: 40px; line-height: 1; }
.depassees .lib { font-size: 13px; font-weight: 600; }
.axe { position: relative; height: 128px; border-radius: 10px; background:
  linear-gradient(90deg, rgba(179, 38, 30, .07), rgba(138, 90, 0, .05) 30%, rgba(31, 78, 121, .03)); }
.axe .ligne { position: absolute; left: 0; right: 0; bottom: 30px; height: 2px; background: var(--trait-2); }
.axe .graduation { position: absolute; bottom: 8px; transform: translateX(-50%); font-size: 12px; color: var(--encre-3); white-space: nowrap; }
.axe .graduation::before { content: ''; position: absolute; left: 50%; bottom: 18px; width: 1px; height: 8px; background: var(--trait-2); }
.axe .aujourdhui { position: absolute; left: 0; top: 8px; bottom: 30px; width: 2px; background: var(--encre); }
.axe .aujourdhui span { position: absolute; top: -2px; left: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.jalon {
  position: absolute; transform: translateX(-50%); width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(20, 32, 43, .25); cursor: pointer; padding: 0;
}
.jalon:hover, .jalon:focus-visible { transform: translateX(-50%) scale(1.35); z-index: 3; }
.jalon.vgp { background: var(--marine); }
.jalon.assurance { background: #7B4FB3; }
.jalon.vt { background: #2C8C8C; }
.jalon.traite { background: var(--signal); box-shadow: 0 0 0 1px var(--encre); }
.legende { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--encre-2); }
.legende i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.colonnes-echeances { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border-top: 1px solid var(--trait); margin-top: 14px; }
.colonnes-echeances > div { padding: 12px 14px; border-right: 1px solid var(--trait); min-width: 0; }
.colonnes-echeances > div:last-child { border-right: 0; }
.colonnes-echeances h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.colonnes-echeances h3 .nb { font-family: var(--police); font-size: 12px; font-weight: 600; color: var(--encre-2);
  background: #EDEFF2; border-radius: 999px; padding: 0 8px; }
.ligne-echeance { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-radius: 7px; cursor: pointer; border: 0;
  background: none; width: 100%; text-align: left; }
.ligne-echeance:hover { background: var(--fond); }
.ligne-echeance .txt { min-width: 0; flex: 1; }
.ligne-echeance .txt b { display: block; font-weight: 500; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ligne-echeance .txt span { font-size: 12.5px; color: var(--encre-2); }
.voir-plus { font-size: 13px; }

/* ------------------------------------------------------------ carte géographique */
#carteEngins { min-height: 380px; border-radius: 0 0 var(--r-carte) var(--r-carte); z-index: 1; }
.marqueur-chantier {
  background: var(--marine); color: #fff; border: 2px solid #fff; border-radius: 999px; box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
  font: 700 13px/1 var(--police-titre); display: flex; align-items: center; justify-content: center;
}
.marqueur-chantier.critique { background: var(--rouge); }
.marqueur-chantier.attention { background: #B07800; }
.leaflet-popup-content { font: 14px/1.45 var(--police); }
.leaflet-popup-content .plaque { font-size: 12px; padding: 3px 6px 2px; }

/* ------------------------------------------------------------ barres de répartition */
.repartition { display: flex; flex-direction: column; gap: 10px; }
.barre-rep { display: grid; grid-template-columns: 130px 1fr 40px; gap: 10px; align-items: center; font-size: 14px; cursor: pointer;
  border-radius: 6px; padding: 2px 4px; border: 0; background: none; text-align: left; }
.barre-rep:hover { background: var(--fond); }
.barre-rep .jauge { height: 12px; border-radius: 999px; background: #EDF0F3; overflow: hidden; }
.barre-rep .jauge i { display: block; height: 100%; border-radius: 999px; background: var(--marine); }
.barre-rep .val { text-align: right; font-weight: 600; }
.barre-rep .nom { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ------------------------------------------------------------ parc : filtres et liste */
.filtres { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--trait); }
.filtres input[type=search] { flex: 1; min-width: 200px; }
.filtres select { max-width: 200px; }
.filtres-avances { display: contents; }
.bouton-filtres { display: none !important; }
.jeton-filtre { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--trait-2);
  background: #fff; cursor: pointer; font-size: 13.5px; font-weight: 500; }
.jeton-filtre.actif { background: var(--marine); border-color: var(--marine); color: #fff; }
.jeton-filtre .n { font-size: 12px; opacity: .8; }
.barre-liste { display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-bottom: 1px solid var(--trait); font-size: 14px;
  color: var(--encre-2); flex-wrap: wrap; }
.barre-liste .espace { flex: 1; }
.tableau-defile { overflow-x: auto; }
table.liste { width: 100%; border-collapse: collapse; }
table.liste th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--encre-2); padding: 10px 12px; background: #F7F9FA;
  border-bottom: 1px solid var(--trait); white-space: nowrap; cursor: pointer; user-select: none; position: sticky; top: 0; }
table.liste th.tri::after { content: ' ▾'; color: var(--encre-3); }
table.liste th.tri.asc::after { content: ' ▴'; }
table.liste td { padding: 10px 12px; border-bottom: 1px solid #EDF0F3; vertical-align: middle; font-size: 14px; }
table.liste tbody tr { cursor: pointer; }
table.liste tbody tr:hover { background: #F6F9FC; }
table.liste tr.archive td { color: var(--encre-3); }
table.liste .designation { font-weight: 500; }
table.liste .sous { display: block; font-size: 12.5px; color: var(--encre-3); }
.indic-alerte { display: inline-flex; gap: 4px; }
.indic-alerte i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.indic-alerte i.critique { background: var(--rouge); }
.indic-alerte i.attention { background: #D89A00; }
.vide { padding: 40px 20px; text-align: center; color: var(--encre-2); }
.vide strong { display: block; font-size: 17px; color: var(--encre); margin-bottom: 6px; }
.cartes-mobile { display: none; }

/* ------------------------------------------------------------ fiche engin (panneau latéral) */
.voile { position: fixed; inset: 0; background: rgba(20, 32, 43, .38); z-index: 80; opacity: 0; transition: opacity .2s; }
.voile.ouvert { opacity: 1; }
.fiche {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(920px, 100vw); background: var(--fond); z-index: 90;
  box-shadow: var(--ombre-forte); display: flex; flex-direction: column; transform: translateX(100%); transition: transform .24s ease;
}
.fiche.ouverte { transform: none; }
@media (prefers-reduced-motion: reduce) { .fiche, .voile { transition: none; } }
.fiche-tete { background: #fff; border-bottom: 1px solid var(--trait); padding: 18px 24px 0; }
.fiche-tete .ligne1 { display: flex; align-items: flex-start; gap: 16px; }
.fiche-tete .ident { flex: 1; min-width: 0; }
.fiche-tete .ident h1 { font-size: 26px; margin-top: 10px; }
.fiche-tete .ident .meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 6px; color: var(--encre-2); font-size: 14px; }
.fiche-tete .alertes-fiche { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.onglets { display: flex; gap: 2px; margin-top: 16px; overflow-x: auto; }
.onglets button { border: 0; background: none; padding: 10px 14px; font-weight: 500; color: var(--encre-2); cursor: pointer;
  border-bottom: 3px solid transparent; white-space: nowrap; }
.onglets button.actif { color: var(--encre); border-bottom-color: var(--marine); }
.onglets button .n { font-size: 12px; background: #EDEFF2; border-radius: 999px; padding: 0 7px; margin-left: 4px; }
.fiche-corps { flex: 1; overflow: auto; padding: 20px 24px 40px; }
.fiche-pied { background: #fff; border-top: 1px solid var(--trait); padding: 12px 24px; display: flex; gap: 10px; justify-content: flex-end;
  align-items: center; }
.fiche-pied .msg { margin-right: auto; font-size: 13.5px; color: var(--encre-2); }
.bandeau-verif { background: var(--signal-pale); border: 1px solid #F0D98A; border-radius: 10px; padding: 12px 14px; margin-bottom: 16px;
  font-size: 14px; color: #5E4700; }
.bandeau-verif b { display: block; margin-bottom: 4px; color: #4A3800; }
.groupe-champs { margin-bottom: 16px; }
.groupe-champs > header { padding: 12px 18px; }
.groupe-champs .champs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 22px; padding: 16px 18px; }
.groupe-champs .champ-lecture .lib { font-size: 12.5px; color: var(--encre-3); }
.groupe-champs .champ-lecture .val { font-size: 15px; font-weight: 500; overflow-wrap: anywhere; min-height: 22px; }
.groupe-champs .champ-lecture .val.vide-val { color: var(--encre-3); font-weight: 400; }
.groupe-champs .large { grid-column: 1 / -1; }
.groupe-champs label.champ input, .groupe-champs label.champ select { width: 100%; }
.champ-modifie input, .champ-modifie select, .champ-modifie textarea { background: #FFFBEA; border-color: #E2C25A; }
.traite-jauge { grid-column: 1 / -1; background: var(--fond); border-radius: 10px; padding: 12px 14px; }
.traite-jauge .piste { height: 10px; background: #DDE3E9; border-radius: 999px; overflow: hidden; margin: 8px 0 6px; }
.traite-jauge .piste i { display: block; height: 100%; background: var(--signal); border-right: 2px solid var(--encre); }
.traite-jauge .chiffres { display: flex; gap: 20px; flex-wrap: wrap; font-size: 14px; }
.traite-jauge .chiffres b { font-family: var(--police-titre); font-size: 20px; display: block; }

.doc-ligne { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid #EDF0F3; }
.doc-ligne:last-child { border-bottom: 0; }
.doc-ligne .ico { width: 36px; height: 36px; border-radius: 8px; background: var(--marine-pale); color: var(--marine); display: flex;
  align-items: center; justify-content: center; flex: none; }
.doc-ligne .ico svg { width: 18px; height: 18px; }
.doc-ligne .txt { flex: 1; min-width: 0; }
.doc-ligne .txt b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-ligne .txt span { font-size: 13px; color: var(--encre-2); }
.doc-ligne.archive { opacity: .55; }
.zone-depot { border: 2px dashed var(--trait-2); border-radius: 12px; padding: 22px; text-align: center; color: var(--encre-2);
  cursor: pointer; background: #FAFBFC; }
.zone-depot.survol { border-color: var(--marine); background: var(--marine-pale); }
.zone-depot b { color: var(--encre); }
.docs-manquants { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }

.histo { position: relative; padding-left: 22px; }
.histo::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--trait); }
.histo .evt { position: relative; padding: 4px 0 14px; }
.histo .evt::before { content: ''; position: absolute; left: -21px; top: 9px; width: 10px; height: 10px; border-radius: 50%;
  background: #fff; border: 2px solid var(--marine); }
.histo .evt.CREATION::before { background: var(--vert); border-color: var(--vert); }
.histo .evt.ARCHIVAGE::before { background: var(--rouge); border-color: var(--rouge); }
.histo .evt .quand { font-size: 12.5px; color: var(--encre-3); }
.histo .evt .quoi { font-size: 14.5px; }
.histo .evt .diff { font-size: 13.5px; color: var(--encre-2); }
.histo .evt .diff del { color: var(--rouge); text-decoration: line-through; }
.histo .evt .diff ins { color: var(--vert); text-decoration: none; font-weight: 500; }

/* ------------------------------------------------------------ affectations */
.matrice td.cellule { text-align: center; }
.etat-base { display: inline-flex; align-items: center; justify-content: center; min-width: 74px; padding: 4px 8px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; border: 1px solid transparent; cursor: default; background: none; }
.etat-base.ACTIF { background: var(--vert-pale); color: var(--vert); }
.etat-base.INACTIF { background: #EDEFF2; color: var(--encre-3); }
.etat-base.absent { color: var(--trait-2); }
button.etat-base { cursor: pointer; }
button.etat-base:hover { border-color: currentColor; }
.carte-base { display: flex; flex-direction: column; gap: 8px; }
.carte-base .chiffre { font-family: var(--police-titre); font-size: 30px; font-weight: 700; line-height: 1; }
.plan-section { margin-bottom: 16px; }
.plan-section h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.plan-section ul { margin: 0; padding-left: 18px; font-size: 14px; }
.plan-section li { margin-bottom: 4px; }
.alerte-bloc { border-radius: 10px; padding: 12px 14px; font-size: 14px; margin-bottom: 14px; }
.alerte-bloc.rouge { background: var(--rouge-pale); color: #7D1A14; }
.alerte-bloc.ambre { background: var(--ambre-pale); color: #5C3C00; }
.alerte-bloc.bleu { background: var(--marine-pale); color: var(--marine-fonce); }

/* ------------------------------------------------------------ paramétrage */
.sous-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.sous-nav button { border: 1px solid var(--trait-2); background: #fff; padding: 7px 14px; border-radius: 999px; cursor: pointer; font-weight: 500; }
.sous-nav button.actif { background: var(--encre); color: #fff; border-color: var(--encre); }
.formulaire-ligne { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.formulaire-ligne label.champ { min-width: 160px; }
table.simple { width: 100%; border-collapse: collapse; }
table.simple th { text-align: left; font-size: 12.5px; color: var(--encre-2); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--trait); }
table.simple td { padding: 9px 10px; border-bottom: 1px solid #EDF0F3; font-size: 14px; vertical-align: middle; }
.cadenas { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--encre-2); }
.cadenas svg { width: 14px; height: 14px; }
.apercu-mail { border: 1px solid var(--trait); border-radius: 10px; padding: 14px; background: #fff; max-height: 420px; overflow: auto; }

/* ------------------------------------------------------------ fenêtres, messages */
.modale-fond { position: fixed; inset: 0; background: rgba(20, 32, 43, .45); z-index: 120; display: flex; align-items: center;
  justify-content: center; padding: 16px; }
.modale { background: #fff; border-radius: 14px; box-shadow: var(--ombre-forte); width: min(560px, 100%); max-height: 92vh; display: flex;
  flex-direction: column; }
.modale.large { width: min(980px, 100%); }
.modale > header { padding: 16px 20px; border-bottom: 1px solid var(--trait); display: flex; align-items: center; gap: 10px; }
.modale > header h2 { flex: 1; font-size: 20px; }
.modale .corps { padding: 18px 20px; overflow: auto; }
.modale > footer { padding: 12px 20px; border-top: 1px solid var(--trait); display: flex; gap: 10px; justify-content: flex-end; }
.visionneuse { width: 100%; height: 72vh; border: 0; border-radius: 8px; background: #F4F6F8; }
.visionneuse-img { max-width: 100%; max-height: 72vh; display: block; margin: 0 auto; border-radius: 8px; }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column;
  gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--encre); color: #fff; padding: 10px 18px; border-radius: 10px; box-shadow: var(--ombre-forte); font-size: 14.5px;
  pointer-events: auto; max-width: min(560px, 92vw); }
.toast.erreur { background: var(--rouge); }
.toast.ok { background: var(--vert); }
.chargement-plein { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 14px;
  background: var(--fond); z-index: 150; color: var(--encre-2); }
.chargement-plein .roue { width: 34px; height: 34px; border: 3px solid var(--trait-2); border-top-color: var(--marine); border-radius: 50%;
  animation: tourne .8s linear infinite; }

/* écran de connexion */
#ecranConnexion { position: fixed; inset: 0; z-index: 300; display: none; align-items: center; justify-content: center; padding: 20px;
  background: var(--marine-fonce) url(img/banniere.jpg) right center / cover no-repeat; }
#ecranConnexion .boite { background: #fff; border-radius: 18px; padding: 32px 30px 24px; width: min(400px, 100%); box-shadow: var(--ombre-forte); }
#ecranConnexion .boite .marque-connexion { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
#ecranConnexion .boite img { width: 52px; height: 52px; border-radius: 12px; }
#ecranConnexion h1 { font-size: 26px; }
#ecranConnexion p { color: var(--encre-2); margin: 0 0 18px; }
#ecranConnexion .pied { font-size: 12.5px; color: var(--encre-3); margin-top: 18px; border-top: 1px solid var(--trait); padding-top: 12px; }

/* ------------------------------------------------------------ téléphone et tablette */
.nav-mobile { display: none; }
@media (max-width: 1100px) {
  .g-carte, .g-2, .g-3 { grid-template-columns: 1fr; }
  .colonnes-echeances { grid-template-columns: 1fr 1fr; }
  .colonnes-echeances > div:nth-child(2) { border-right: 0; }
  .colonnes-echeances > div:nth-child(-n+2) { border-bottom: 1px solid var(--trait); }
}
@media (max-width: 820px) {
  .appli { grid-template-columns: 1fr; }
  .nav { display: none; }
  .nav-mobile { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 70; background: var(--marine-fonce);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .nav-mobile a { color: #C7D4E2; text-decoration: none; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11.5px;
    padding: 4px 8px; border-radius: 8px; position: relative; }
  .nav-mobile a svg { width: 22px; height: 22px; }
  .nav-mobile a.actif { color: #fff; }
  .nav-mobile a.actif::after { content: ''; position: absolute; top: -6px; left: 30%; right: 30%; height: 3px; background: var(--signal); border-radius: 0 0 3px 3px; }
  .barre { padding: 10px 14px; }
  .barre .espace { display: none; }
  .recherche-globale { max-width: none; }
  .filtres-avances { display: none !important; }
  .filtres-ouverts .filtres-avances { display: flex !important; }
  .bouton-filtres { display: inline-flex !important; }
  .fiche-tete .ligne1 { flex-direction: column-reverse; gap: 6px; }
  .fiche-tete .ligne1 .groupe-btn { width: 100%; justify-content: flex-end; }
  .fiche-tete .ident h1 { font-size: 22px; margin-top: 8px; }
  .contenu { padding: 16px 14px 96px; }
  h1 { font-size: 24px; }
  .frise { grid-template-columns: 1fr; }
  .depassees { flex-direction: row; align-items: center; gap: 12px; }
  .colonnes-echeances { grid-template-columns: 1fr; }
  .colonnes-echeances > div { border-right: 0; border-bottom: 1px solid var(--trait); }
  .tableau-defile.parc { display: none; }
  .cartes-mobile { display: flex; flex-direction: column; }
  .carte-engin-mobile { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid #EDF0F3; align-items: flex-start; cursor: pointer; }
  .carte-engin-mobile .txt { flex: 1; min-width: 0; }
  .carte-engin-mobile .txt b { display: block; font-weight: 500; }
  .carte-engin-mobile .txt span { font-size: 13px; color: var(--encre-2); }
  .groupe-champs .champs { grid-template-columns: 1fr; }
  .fiche-tete { padding: 14px 16px 0; }
  .fiche-corps { padding: 14px 14px 30px; }
  .fiche-pied { padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
  .filtres select { max-width: none; flex: 1 1 140px; }
  #carteEngins { min-height: 300px; }
  .barre-rep { grid-template-columns: 100px 1fr 34px; }
}
