/* Carte de gestion – charte « vert sapin » (validée le 25/11/2026) */

/* Polices de l'interface, servies par le site (sous-ensemble latin, licence OFL : polices/OFL.txt) */
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('polices/barlow-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('polices/barlow-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('polices/barlow-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('polices/barlow-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('polices/barlow-condensed-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('polices/barlow-condensed-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('polices/barlow-condensed-latin-700-normal.woff2') format('woff2'); }

:root {
  --sapin: #22372B;
  --sapin-clair: #2f4a3a;
  --parchemin: #EEEADF;
  --laiton-clair: #C6AA76;
  --laiton-fonce: #816040;
  --fond: #EEF1EC;
  --carte-fond: #1d2f24;
  --blanc: #ffffff;
  --texte: #1c241f;
  --texte-doux: #46504a; /* contraste renforcé pour la lecture en plein soleil */
  --bordure: #d6dbd3; /* séparateurs (décoratifs) */
  --bordure-controle: #7b857d; /* contour des champs et boutons : contraste ≥ 3:1 sur blanc et sur le fond (WCAG 1.4.11) */
  --gris-chaud: #e7e3d8;
  --rayon: 10px;
  --ombre: 0 1px 2px rgba(20, 35, 27, .08), 0 4px 16px rgba(20, 35, 27, .06);
  --cible: 44px; /* taille minimale des cibles tactiles */

  --police: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --police-titre: 'Barlow Condensed', 'Barlow', system-ui, sans-serif;
}

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

/* Tailles de texte en rem : elles suivent la taille de police choisie dans le navigateur ou le téléphone */
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: var(--police);
  font-size: 1rem;
  line-height: 1.45;
}

button, select { font: inherit; color: inherit; }

[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--laiton-fonce); outline-offset: 2px; }
/* Sur fond vert sapin, le laiton foncé ne ressort pas (2,2:1) : laiton clair (5,7:1) */
.entete :focus-visible, .bandeau :focus-visible, .bandeau-position :focus-visible, .mise-a-jour :focus-visible {
  outline-color: var(--laiton-clair);
}
.fiche__titre:focus { outline: none; } /* focus posé par le script, pas au clavier */

/* Texte lu par les lecteurs d'écran, invisible à l'écran */
.visuellement-masque {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Liens d'évitement : hors écran, ils apparaissent en haut à gauche quand ils reçoivent le focus */
.evitement a {
  position: absolute;
  left: 8px;
  top: -100px;
  z-index: 3000;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--blanc);
  color: var(--sapin);
  font-weight: 700;
}
.evitement a:focus { top: 8px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

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

.entete {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 10px 28px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--sapin);
  color: var(--parchemin);
}

.entete__logo { display: block; flex: none; line-height: 0; }
.entete__logo img { display: block; height: 80px; width: auto; }

.entete__titre h1 {
  margin: 0;
  font-family: var(--police-titre);
  font-weight: 600;
  font-size: 1.625rem;
  line-height: 1.1;
  letter-spacing: .01em;
}
.entete__titre p {
  margin: 2px 0 0;
  font-family: var(--police-titre);
  font-weight: 600;
  font-size: 1.125rem;
  color: var(--laiton-clair);
}

.entete__chiffres {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 22px;
  margin: 0 0 0 auto;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
}
.entete__chiffres strong { font-weight: 700; }
.entete__lecture { color: var(--parchemin); }
.entete__lecture { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.entete__lecture.erreur { color: #ffd0b8; }
.bouton-relire {
  min-height: var(--cible);
  padding: 0 12px;
  border: 1px solid rgba(238, 234, 223, .45);
  border-radius: 8px;
  background: transparent;
  color: var(--parchemin);
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
}
.bouton-relire:hover { border-color: var(--laiton-clair); }
.bouton-relire:disabled { opacity: .5; cursor: progress; }
.bouton-controles {
  min-height: var(--cible);
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: #ffd0b8;
  color: #5a1f05;
  font-weight: 700;
  font-size: 0.9375rem;
  cursor: pointer;
}

/* Fenêtre des points à vérifier */
.controles {
  width: min(560px, calc(100vw - 24px));
  max-height: 80vh;
  padding: 20px;
  border: 0;
  border-radius: var(--rayon);
  box-shadow: 0 8px 32px rgba(0, 0, 0, .35);
  color: var(--texte);
}
.controles::backdrop { background: rgba(20, 35, 27, .55); }
.controles h2 { margin: 0 0 8px; font-family: var(--police-titre); font-weight: 600; font-size: 1.625rem; }
.controles__resume { margin: 0 0 12px; color: var(--texte-doux); }
.controles__liste { margin: 0 0 16px; padding: 0; list-style: none; }
.controles__liste li { padding: 8px 0; border-top: 1px solid #eceae3; }
.controles__liste span { display: block; color: var(--texte-doux); font-size: 0.9375rem; overflow-wrap: anywhere; }
.controles .bouton { width: 100%; border: 0; cursor: pointer; }

/* ---------- Page ---------- */

.page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: start;
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px 28px 32px;
}

/* ---------- Barre d'outils ---------- */

.barre-outils {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin-bottom: 12px;
}

.segment {
  display: inline-flex;
  padding: 3px;
  border-radius: 8px;
  background: var(--gris-chaud);
}
.segment__choix {
  min-height: var(--cible);
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
}
.segment__choix[aria-pressed="true"] { background: var(--sapin); color: var(--blanc); }

.bouton-outil {
  min-height: var(--cible);
  padding: 0 14px;
  border: 1px solid var(--bordure-controle);
  border-radius: 8px;
  background: var(--blanc);
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
}
.bouton-outil[aria-pressed="true"] { background: var(--sapin); border-color: var(--sapin); color: var(--blanc); }

.filtre-annees {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 320px;
}
.filtre-annees__libelle { flex: none; color: var(--texte-doux); font-size: 0.9375rem; }
.filtre-annees__liste {
  display: flex;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none; /* la puce coupée au bord suffit à signaler le défilement */
  padding: 2px;
}
.filtre-annees__liste::-webkit-scrollbar { display: none; }
.puce-annee {
  flex: none;
  min-height: var(--cible);
  min-width: 56px;
  padding: 0 14px;
  border: 1px solid var(--bordure-controle);
  border-radius: 999px;
  background: var(--blanc);
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
}
.puce-annee[aria-pressed="true"] { background: var(--sapin); border-color: var(--sapin); color: var(--blanc); }

.resume-annee {
  margin: 0 0 12px;
  padding: 10px 14px 12px;
  border-left: 5px solid var(--sapin);
  border-radius: 8px;
  background: var(--blanc);
  box-shadow: var(--ombre);
  font-size: 0.9375rem;
}
.resume-annee p { margin: 0; }
.resume-annee__titre { font-size: 1.0625rem; }
.resume-annee__titre strong { font-family: var(--police-titre); font-size: 1.375rem; }
.resume-annee__types { margin-left: 6px; color: var(--texte-doux); font-size: 0.9375rem; }
.resume-annee__alerte {
  margin-top: 8px !important;
  padding: 6px 10px;
  border-left: 4px solid var(--laiton-fonce);
  border-radius: 4px;
  background: #f5eedf;
}
.resume-annee__liste {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}
.resume-annee__liste button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--cible);
  padding: 0 12px;
  border: 1px solid var(--bordure-controle);
  border-radius: 8px;
  background: #faf9f5;
  font-weight: 700;
  cursor: pointer;
}
.resume-annee__liste button:hover { border-color: var(--sapin); }
.resume-annee__liste small { font-weight: 500; color: var(--texte-doux); font-size: 0.9375rem; }

/* Recherche d'une UG */
.recherche { position: relative; display: flex; align-items: center; gap: 6px; flex: none; }
.recherche--ouverte { flex: 1 1 260px; max-width: 380px; }
.recherche__zone { position: relative; flex: 1; min-width: 0; }
.recherche__ouvrir {
  display: grid;
  place-items: center;
  flex: none;
  width: var(--cible);
  height: var(--cible);
  border: 1px solid var(--bordure-controle);
  border-radius: 8px;
  background: var(--blanc);
  color: var(--sapin);
  cursor: pointer;
}
.recherche__ouvrir[aria-expanded="true"] { background: var(--sapin); border-color: var(--sapin); color: var(--blanc); }
.recherche__champ {
  width: 100%;
  min-height: var(--cible);
  padding: 0 14px;
  border: 1px solid var(--bordure-controle);
  border-radius: 8px;
  background: var(--blanc);
  color: var(--texte);
  font: inherit;
  font-size: 1rem; /* 16 px : pas de zoom automatique à la saisie sur iPhone */
}
.recherche__champ::placeholder { color: #5d665f; }
.recherche__suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 1600;
  max-height: 60vh;
  overflow-y: auto;
  margin: 0;
  padding: 4px;
  border-radius: 8px;
  background: var(--blanc);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
  list-style: none;
}
.recherche__suggestions button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: var(--cible);
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  text-align: left;
  cursor: pointer;
}
.recherche__suggestions button:hover, .recherche__suggestions button:focus-visible { background: #f2efe7; }
.recherche__suggestions strong { min-width: 34px; font-weight: 700; }
.recherche__suggestions span { color: var(--texte-doux); }
.recherche__aucune { padding: 10px; color: var(--texte-doux); }



/* ---------- Carte ---------- */

.carte {
  position: relative;
  height: min(72vh, 760px);
  min-height: 420px;
  border-radius: var(--rayon);
  overflow: hidden;
  background: var(--carte-fond);
  box-shadow: var(--ombre);
}
.carte__attente {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  color: var(--parchemin);
}

/* Étiquettes des UG */
.etiquette-ug {
  pointer-events: none;
  white-space: nowrap;
}
.etiquette-ug span {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  transform: translate(-50%, -50%);
  font-family: var(--police-titre);
  font-weight: 700;
  font-size: 0.9375rem;
  line-height: 1;
  color: #fff;
  text-shadow: 0 0 3px rgba(0, 0, 0, .9), 0 0 1px #000, 0 1px 2px rgba(0, 0, 0, .8);
}
.etiquette-ug b { font-weight: 700; }
.etiquette-ug small { margin-top: 2px; font-family: var(--police); font-weight: 600; font-size: 0.75rem; letter-spacing: .02em; }
.etiquette-ug small[hidden], .etiquette-ug small:empty { display: none; }
.etiquette-ug--choisie span { font-size: 1.125rem; }
.etiquette-ug--choisie small { font-size: 0.875rem; }

/* Contrôles Leaflet agrandis (cibles tactiles ≥ 44 px) */
.leaflet-touch .leaflet-bar,
.leaflet-bar { border: 0; border-radius: 8px; box-shadow: 0 1px 4px rgba(0, 0, 0, .3); }
.leaflet-bar a,
.leaflet-touch .leaflet-bar a {
  width: 44px;
  height: 44px;
  line-height: 44px;
  font-size: 1.375rem;
  color: var(--sapin);
}
.leaflet-bar a:first-child { border-top-left-radius: 8px; border-top-right-radius: 8px; }
.leaflet-bar a:last-child { border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; }
.leaflet-right .leaflet-control { margin-right: 12px; }
.leaflet-top .leaflet-control { margin-top: 12px; }
.bouton-localiser { display: grid !important; place-items: center; }
.bouton-localiser.actif { color: #1a73e8; background: #e8f1fd; }
.bouton-localiser.en-cours { color: #1a73e8; animation: pulsation 1s infinite alternate; }

/* Bandeau « Vous êtes dans l'UG … » (suivi de position) */
.bandeau-position {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  max-width: min(420px, calc(100vw - 110px));
  padding: 8px 8px 8px 14px;
  border-radius: 8px;
  background: var(--sapin);
  color: var(--parchemin);
  font-size: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
}
.bandeau-position__texte { margin: 0; flex: 1 1 160px; }
.bandeau-position__texte strong { color: #fff; }
.bandeau-position__precision { display: block; color: var(--laiton-clair); font-size: 0.875rem; }
.bandeau-position__fiche {
  min-height: var(--cible);
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: var(--laiton-clair);
  color: var(--sapin);
  font-weight: 700;
  cursor: pointer;
}
.leaflet-left .leaflet-control.bandeau-position { margin-left: 12px; margin-top: 12px; }

/* Message temporaire sur la carte */
.message-carte {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 28px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 520px;
  margin: 0 auto;
  padding: 6px 6px 6px 14px;
  border-radius: 8px;
  background: #fff;
  color: var(--texte);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
}
.message-carte p { margin: 0; flex: 1; }
.message-carte button {
  flex: none;
  width: var(--cible);
  height: var(--cible);
  border: 0;
  background: none;
  font-size: 1.625rem;
  line-height: 1;
  cursor: pointer;
}
@keyframes pulsation { to { opacity: .4; } }
.leaflet-container { font-family: var(--police); background: var(--carte-fond); }
.leaflet-container .leaflet-control-attribution { font-size: 0.6875rem; }

/* Fiche : en-tête de l'UG */
.fiche__titre {
  margin: 0;
  font-family: var(--police-titre);
  font-weight: 600;
  font-size: 2.125rem;
  line-height: 1.1;
}
.fiche__essence { display: flex; align-items: center; gap: 8px; margin: 6px 0 14px; font-size: 1.125rem; }
.fiche__essence .legende__pastille { width: 24px; height: 18px; }

.fiche__section {
  margin: 22px 0 10px;
  font-family: var(--police);
  font-weight: 700;
  font-size: 1rem;
}
.fiche__pied { margin: 14px 0 0; color: var(--texte-doux); font-size: 0.875rem; }

/* Bandeau « Prochaine intervention » */
.bandeau {
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--sapin);
  color: var(--parchemin);
}
.bandeau p { margin: 0; }
.bandeau__surtitre { color: var(--laiton-clair); font-size: 0.9375rem; }
.bandeau__titre {
  overflow-wrap: anywhere;
  margin-top: 2px !important;
  font-family: var(--police-titre);
  font-weight: 600;
  font-size: 1.875rem;
  line-height: 1.1;
  color: #fff;
}
.bandeau__detail { margin-top: 4px !important; font-size: 1rem; }
.bandeau--calme .bandeau__titre { font-size: 1.5rem; }
.bandeau__alerte, .detail__alerte {
  margin-top: 10px !important;
  padding: 8px 10px;
  border-left: 4px solid var(--laiton-clair);
  border-radius: 4px;
  background: rgba(198, 170, 118, .16);
  font-size: 0.9375rem;
}
.detail__alerte { border-left-color: var(--laiton-fonce); background: #f5eedf; color: var(--texte); }

/* Chiffres clés */
.chiffres {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(5.5em, 1fr)); /* passe à la ligne si le texte est agrandi */
  gap: 8px;
  margin: 14px 0 0;
}
.chiffres div { padding: 10px; border-radius: 8px; background: #f2efe7; }
.chiffres dt { color: var(--texte-doux); font-size: 0.9375rem; }
.chiffres dd { margin: 2px 0 0; font-weight: 700; font-size: 1.1875rem; line-height: 1.2; }
.chiffres .chiffres__texte { font-size: 0.9375rem; }

/* Frise 2027-2037 */
.frise {
  display: grid;
  grid-template-columns: repeat(11, minmax(0, 1fr));
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: center;
  font-size: 0.875rem;
  color: var(--texte-doux);
}
.frise li { display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
.frise__case {
  display: grid;
  place-items: center;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: #eeeadf;
}
.frise__case--prevue {
  background: var(--couleur);
  color: #fff;
  font-weight: 700;
  font-size: 0.8125rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .45);
  cursor: pointer;
}
.frise__case--fonce { color: #1c241f; text-shadow: none; } /* couleurs claires : texte foncé (contraste) */
.frise__case--prevue[aria-pressed="true"] { outline: 3px solid var(--sapin); outline-offset: 1px; }

/* Détail de l'intervention choisie */
.detail {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--bordure);
  border-radius: 8px;
}
.detail p { margin: 0; }
.detail__titre { font-size: 1.0625rem; }
.detail__titre strong { font-family: var(--police-titre); font-size: 1.375rem; margin-right: 6px; }
.detail__ug { color: var(--texte-doux); margin-top: 2px !important; }
.detail__regle { margin-top: 8px !important; }
.detail__note { margin-top: 8px !important; color: var(--texte-doux); font-size: 0.9375rem; }

/* Description dépliable */
/* Description du peuplement : ligne-bouton encadrée, aperçu en fondu, « Lire la suite » / « Réduire » */
.depliant { margin-top: 18px; }
.depliant__bouton {
  display: block;
  min-height: var(--cible);
  padding: 10px 12px;
  border: 1px solid var(--bordure-controle);
  border-radius: 8px;
  background: var(--blanc);
  cursor: pointer;
  list-style: none;
}
.depliant__bouton::-webkit-details-marker { display: none; }
.depliant__bouton:hover { background: #f5f2ea; }
.depliant[open] .depliant__bouton { border-bottom-left-radius: 0; border-bottom-right-radius: 0; background: #f5f2ea; }
.depliant__tete { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.depliant__libelle { font-weight: 700; }
.depliant__action {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--laiton-fonce);
  font-weight: 700;
  font-size: 0.9375rem;
}
.depliant__fleche { font-size: 1.5rem; line-height: 1; transition: transform .15s; }
.depliant[open] .depliant__fleche { transform: rotate(180deg); }
.depliant__reduire, .depliant[open] .depliant__lire { display: none; }
.depliant[open] .depliant__reduire { display: inline; }
/* Aperçu : deux lignes du texte en gris, qui s'effacent vers le bas */
.depliant__apercu {
  display: -webkit-box;
  margin-top: 6px;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: var(--texte-doux);
  font-size: 0.9375rem;
  -webkit-mask-image: linear-gradient(to bottom, #000 40%, transparent);
  mask-image: linear-gradient(to bottom, #000 40%, transparent);
}
.depliant[open] .depliant__apercu { display: none; }
.depliant[open] > :not(summary) { margin-left: 0; }
.depliant[open] > p, .depliant[open] > dl {
  padding: 0 12px;
}
.depliant[open] > p { padding-top: 10px; }
.depliant[open] { border-radius: 8px; box-shadow: inset 0 0 0 1px var(--bordure-controle); padding-bottom: 8px; }
.depliant p { margin: 0 0 10px; }
.depliant__infos { margin: 0; font-size: 0.9375rem; }
.depliant__infos div { display: flex; gap: 8px; padding: 4px 0; border-top: 1px solid #eceae3; }
.depliant__infos dt { flex: none; width: 128px; color: var(--texte-doux); }
.depliant__infos dd { margin: 0; }

/* À faire */
.a-faire { margin: 0; padding: 0; list-style: none; }
.a-faire li { padding: 10px 0; border-top: 1px solid #eceae3; }
.a-faire li:first-child { border-top: 0; padding-top: 0; }
.a-faire__tete { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.a-faire__echeance { font-weight: 700; }
.a-faire__action { margin: 4px 0 0; }
.a-faire__remarque { margin: 4px 0 0; color: var(--texte-doux); font-size: 0.9375rem; }
.statut {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  background: #ece9e1;
  color: #4a4f4b;
}
.statut--a-faire { background: #f3e6cc; color: #6b4b1f; }
.statut--en-cours { background: #dde9f7; color: #1e4a7a; }
.statut--fait { background: #dcefdc; color: #1f5a2a; }
.statut--verifier { background: #f7dede; color: #7a2020; }
.avec { color: var(--texte-doux); font-size: 0.9375rem; }

/* Journal */
.journal { margin: 0; padding: 0; list-style: none; }
.journal li {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 10px;
  padding: 8px 0 8px 10px;
  border-left: 3px solid #e2ded3;
}
.journal li + li { margin-top: 6px; }
.journal p { margin: 0; color: var(--texte-doux); }
.journal .journal__titre { color: var(--texte); }
.journal__date { font-weight: 700; }
.journal__chiffres { font-size: 0.9375rem; }

.lien-bouton {
  min-height: var(--cible);
  padding: 0;
  border: 0;
  background: none;
  color: var(--laiton-fonce);
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

/* Commentaires de l'UG */
.commentaires__liste { margin: 0; padding: 0; list-style: none; }
.commentaires__liste li {
  padding: 8px 0 8px 10px;
  border-left: 3px solid var(--laiton-clair);
}
.commentaires__liste li + li { margin-top: 6px; }
.commentaires__liste li[data-local] { border-left-style: dashed; }
.commentaires__tete {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px;
  margin: 0; color: var(--texte-doux); font-size: 0.9375rem;
}
.commentaires__tete strong { color: var(--texte); }
.commentaires__texte { margin: 4px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.commentaires__erreur { margin: 4px 0 0; color: #7a2020; font-size: 0.9375rem; }
.commentaires__saisie { display: grid; gap: 6px; margin-top: 14px; }
.commentaires__saisie label { font-weight: 600; }
.commentaires__saisie textarea {
  width: 100%;
  min-height: 88px;
  padding: 10px 12px;
  border: 1px solid var(--bordure-controle);
  border-radius: 8px;
  background: var(--blanc);
  color: var(--texte);
  font: inherit;
  font-size: 1rem; /* 16 px : pas de zoom automatique à la saisie sur iPhone */
  resize: vertical;
}
.commentaires__saisie textarea:focus-visible { outline: 3px solid var(--laiton-fonce); outline-offset: 1px; }
.commentaires__pied { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.commentaires__etat { flex: 1 1 200px; margin: 0; color: var(--texte-doux); font-size: 0.875rem; }
.commentaires__pied .bouton { min-width: 120px; }
button.bouton { border: 0; font-family: inherit; cursor: pointer; }
a.bouton-relire { display: inline-flex; align-items: center; text-decoration: none; }
a.bouton-relire[hidden] { display: none; }

/* Boutons vers le Registre */
.actions { display: grid; gap: 10px; margin-top: 20px; }
.bouton {
  display: grid;
  place-items: center;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
}
.bouton--plein { background: var(--sapin); color: #fff; }
.bouton--plein:hover { background: var(--sapin-clair); }
.bouton--contour { border: 2px solid var(--sapin); color: var(--sapin); background: var(--blanc); }

/* Annonce d'une nouvelle version publiée */
.mise-a-jour {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 2000;
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: calc(100vw - 24px);
  padding: 8px 8px 8px 16px;
  border-radius: 10px;
  background: var(--sapin);
  color: var(--parchemin);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .35);
  transform: translateX(-50%);
}
.mise-a-jour p { margin: 0; }
.mise-a-jour button {
  min-height: var(--cible);
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  background: var(--laiton-clair);
  color: var(--sapin);
  font-weight: 700;
  cursor: pointer;
}

/* Légende : bouton sur la carte + panneau posé sur la carte */
.bouton-legende {
  display: block;
  min-width: 44px;
  height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: var(--blanc);
  color: var(--sapin);
  font-weight: 700;
  font-size: 0.9375rem;
  cursor: pointer;
}
.bouton-legende:hover { background: #f4f4f4; }
.bouton-legende.actif { background: var(--sapin); color: var(--blanc); }
.legende {
  position: absolute;
  top: 12px;
  right: 68px; /* à gauche de la colonne de boutons (ajusté à l'ouverture) */
  z-index: 1001;
  width: min(400px, calc(100% - 80px));
  max-height: calc(100% - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: var(--rayon);
  background: var(--blanc);
  color: var(--texte);
  box-shadow: 0 4px 20px rgba(0, 0, 0, .35);
  font-family: var(--police);
  font-size: 1rem;
  line-height: 1.45;
  cursor: auto;
}
.legende:focus { outline: none; } /* focus posé par le script à l'ouverture */
.legende__tete {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 4px 16px;
  background: var(--blanc);
  border-bottom: 1px solid var(--bordure);
}
.legende__tete h2 { margin: 0; font-family: var(--police-titre); font-weight: 600; font-size: 1.375rem; }
.legende__fermer {
  display: grid;
  place-items: center;
  width: var(--cible);
  height: var(--cible);
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--texte);
  cursor: pointer;
}
.legende__fermer:hover { background: #f2efe7; }
.legende__corps { display: grid; gap: 14px; padding: 12px 16px 16px; }
.legende__titre { margin: 4px 0 6px; font-size: 0.9375rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--texte-doux); }
.legende__aide { margin: 6px 0 0; color: var(--texte-doux); font-size: 0.875rem; }
.legende__essences {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 6px 14px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
}
.legende__essences li, .legende__traits li { display: flex; align-items: center; gap: 8px; }
.legende__abrege {
  margin-left: 4px;
  padding: 1px 5px 2px;
  border-radius: 4px;
  background: #1c241f; /* comme les étiquettes de la carte */
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.legende__essences .legende__pastille { width: 30px; height: 22px; }
.legende__sigles { display: grid; gap: 4px; margin: 0; font-size: 0.9375rem; }
.legende__sigles div { display: flex; gap: 10px; }
.legende__sigles dt { width: 40px; font-weight: 700; }
.legende__sigles dd { margin: 0; }
.legende__traits { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: 0.9375rem; }
.trait { flex: none; width: 30px; height: 22px; border-radius: 3px; background: #4b6b48; }
.trait--choisie { border: 4px solid #fff; box-shadow: 0 0 0 3px #10180f; }
.trait--filtre { border: 3px solid rgba(255, 255, 255, .9); box-shadow: 0 0 0 1px #10180f; }
.trait--estompee { opacity: .35; border: 1px solid #10180f; }

/* Pastille d'essence : motif + couleur (svg) */
.legende__pastille {
  display: inline-block;
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25);
  vertical-align: middle;
}
/* Définitions des motifs : présentes dans la page mais sans place à l'écran */
.motifs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- Fiche ---------- */

.fiche {
  position: sticky;
  top: 20px;
  padding: 18px 20px 20px;
  border-radius: var(--rayon);
  background: var(--blanc);
  box-shadow: var(--ombre);
}

.fiche__choix { display: block; }
.fiche__choix span { display: block; margin-bottom: 6px; color: var(--texte-doux); font-size: 0.9375rem; }
.fiche__choix select {
  width: 100%;
  min-height: var(--cible);
  padding: 0 12px;
  border: 1px solid var(--bordure-controle);
  border-radius: 8px;
  background: #faf9f5;
  font-size: 1.0625rem;
}

.fiche__contenu { margin-top: 16px; }
.fiche__version { margin: 18px 0 0; color: var(--texte-doux); font-size: 0.8125rem; }
.fiche__vide { margin: 0; color: var(--texte-doux); }

/* ---------- Téléphone et tablette ---------- */

.entete__titre h1, .entete__titre p { white-space: nowrap; }

@media (max-width: 899px) {
  .entete { flex-wrap: wrap; gap: 6px 24px; }
  .entete__chiffres { margin-left: 0; width: 100%; }
  .page {
    grid-template-columns: minmax(0, 1fr);
    padding: 16px 16px 28px;
  }
  .carte { height: 62vh; height: 62dvh; min-height: 340px; } /* dvh : hauteur visible, barre d'adresse déduite */
}

/* Barre de la fiche (poignée, fermer) : seulement sur téléphone */
.fiche__barre { display: none; }
/* Grand écran : seule la croix, en haut à droite de la fiche, quand une UG est choisie */
.fiche:not(.fiche--glissante).fiche--avec-ug .fiche__barre {
  display: block;
  position: absolute;
  top: 8px;
  right: 8px;
}
.fiche:not(.fiche--glissante) .fiche__poignee { display: none; }
.fiche:not(.fiche--glissante) .fiche__fermer {
  width: var(--cible);
  height: var(--cible);
  border: 0;
  border-radius: 8px;
}
.fiche:not(.fiche--glissante) .fiche__fermer:hover { background: #f2efe7; }
.fiche--avec-ug:not(.fiche--glissante) .fiche__choix span { margin-right: 48px; }

/* ---------- Téléphone : fiche glissante depuis le bas ---------- */
.fiche--glissante {
  position: fixed;
  top: auto;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1500;
  display: flex;
  flex-direction: column;
  height: calc(200px + env(safe-area-inset-bottom));
  max-height: 92vh;
  max-height: 92dvh;
  padding: 0;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, .3);
  transition: height .25s ease, transform .25s ease;
}
.fiche--glissante[data-etat="ouvert"] { height: 88vh; height: 88dvh; }
.fiche--glissante[data-etat="ferme"] { transform: translateY(105%); visibility: hidden; }
.fiche--glisse { transition: none; }
.fiche--glissante .fiche__barre {
  display: flex;
  align-items: stretch;
  flex: none;
  touch-action: none; /* le glissement de la poignée ne fait pas défiler la page */
  border-bottom: 1px solid var(--bordure);
}
.fiche__poignee {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 48px;
  padding: 6px 0 4px;
  border: 0;
  background: none;
  color: var(--texte-doux);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: grab;
}
.fiche__trait { width: 48px; height: 5px; border-radius: 3px; background: #8b948d; }
.fiche__fermer {
  flex: none;
  display: grid;
  place-items: center;
  width: 52px;
  border: 0;
  border-left: 1px solid var(--bordure);
  background: none;
  color: var(--texte);
  cursor: pointer;
}
.fiche--glissante .fiche__defile {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 16px calc(20px + env(safe-area-inset-bottom));
}
.fiche--glissante[data-etat="reduit"] .fiche__defile { overflow: hidden; cursor: pointer; }
.fiche--glissante[data-etat="reduit"] .fiche__choix { display: none; }
.fiche--glissante .fiche__contenu { margin-top: 0; }
.fiche--glissante[data-etat="ouvert"] .fiche__contenu { margin-top: 16px; }
.fiche--glissante .fiche__titre { font-size: 1.875rem; }
.fiche--glissante .fiche__essence { margin: 2px 0 10px; }
/* Place gardée sous la page pour la fiche réduite : la légende reste accessible */
.fiche-visible .page { padding-bottom: calc(216px + env(safe-area-inset-bottom)); }

@media (max-width: 599px) {
  .entete {
    flex-wrap: wrap;
    gap: 6px 16px;
    padding: 10px 16px 14px;
    padding-top: max(10px, env(safe-area-inset-top));
  }
  .entete__logo img { height: 56px; }
  .entete__titre h1 { font-size: 1.375rem; }
  .entete__titre p { font-size: 1rem; }
  .entete__chiffres { margin: 0; width: 100%; gap: 4px 18px; font-size: 0.875rem; }
  .entete__total { display: none; } /* 45 UG · 55,74 ha : déjà dans la fiche ; place gagnée pour la carte */
  .barre-outils { gap: 10px; }
  .filtre-annees { flex-basis: 100%; }
  .recherche--ouverte { flex-basis: 100%; max-width: none; }
  /* Frise sur deux lignes (2027-2032, 2033-2037) : cases d'au moins 44 px de large */
  .frise { grid-template-columns: repeat(6, minmax(0, 1fr)); row-gap: 8px; }
  .libelle-long { display: none; }
  .segment__choix, .bouton-outil { padding: 0 12px; }
}

/* Téléphone : la fiche est repliée en bas, le lien d'évitement vers elle n'a pas de sens */
@media (max-width: 899px) { .evitement a[href="#choix-ug"] { display: none; } }
