/* RELIQUIUM — interface mobile, selon la charte graphique v1.0 du 24/10/2026 : vert profond, ivoire parchemin, or
   patiné ; Source Serif 4 pour les titres, Manrope pour le reste ; grille de 8 px, cibles tactiles de 48 px, angles de
   12 à 16 px, animations de 180 à 240 ms. Texte essentiel opaque ; un état n'est jamais porté par la seule couleur
   (mot, forme ou symbole). L'or sert à la sélection et aux détails, jamais seul pour un texte ou une icône utile. */

/* Polices de la charte, servies par l'application (hors ligne, sans appel à un tiers). Licence OFL : fonts/OFL-*.txt. */
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("../fonts/manrope-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("../fonts/manrope-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/source-serif-4-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/source-serif-4-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  /* Les trois couleurs de la marque. */
  --vert: #173f35;
  --ivoire: #f5f0e5;
  --or: #c9a45c;
  /* Mode clair : 70 % ivoire, 20 % vert, 10 % or. Contrastes calculés (luminance sRGB) dans les tests. */
  --fond: var(--ivoire);
  --surface: #fbf8f1;
  --surface-2: #eee7d8;
  --surface-3: #e2d8c3;
  --encre: var(--vert);
  --encre-2: #365449;
  --encre-3: #4a665d;
  --ligne: #d2c9b5;
  --ligne-champ: #74857c;
  --contour: var(--vert);
  --accent: var(--vert);
  --accent-2: #0f2e26;
  --accent-encre: var(--ivoire);
  --focus: var(--vert);
  --lien: var(--vert);
  --ok: #2d6a37;
  --alerte: #8a4b00;
  --danger: #a1232a;
  --info: #285a8a;
  --ombre: 0 6px 24px rgba(15, 46, 38, 0.18);
  --ombre-legere: 0 2px 8px rgba(15, 46, 38, 0.14);
  --rayon: 14px;
  --serif: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --haut-entete: 116px;
  --haut-nav: 64px;
  --vh-visible: 100vh;
  /* Taille du texte choisie dans Données (100 %, 115 %, 130 %) : agrandit le contenu des vues, fiches et panneaux. */
  --echelle-texte: 1;
  /* Mouvement : court (180 à 240 ms), pensé pour le terrain. Les entrées décélèrent, les sorties accélèrent et sont
     plus brèves. Seuls transform, translate, scale et opacity se déplacent. ui.js lit ces jetons. */
  --duree-courte: 180ms;
  --duree: 220ms;
  --duree-longue: 240ms;
  --duree-sortie: 160ms;
  --duree-longue-sortie: 180ms;
  --courbe-entree: cubic-bezier(.2, .8, .2, 1);
  --courbe-sortie: cubic-bezier(.4, 0, 1, 1);
  --courbe-deplacement: cubic-bezier(.4, 0, .2, 1);
  color-scheme: light;
}
@supports (height: 100dvh) { :root { --vh-visible: 100dvh; } }

/* Mode sombre : les fonds et les textes échangent leur rôle ; le vert reste l'ancrage, l'or souligne la sélection.
   Réglage Système, Clair ou Sombre dans Données (attribut data-theme). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fond: var(--vert);
    --surface: #1e4a3f;
    --surface-2: #245246;
    --surface-3: #2d5d50;
    --encre: var(--ivoire);
    --encre-2: #dcd6c8;
    --encre-3: #c6c2b4;
    --ligne: #3e6a5d;
    --ligne-champ: #8fa89f;
    --contour: var(--ivoire);
    --accent: var(--or);
    --accent-2: #d9b978;
    --accent-encre: var(--vert);
    --focus: var(--ivoire);
    --lien: var(--ivoire);
    --ok: #9ad5a6;
    --alerte: #edbe72;
    --danger: #f5abab;
    --info: #abcdec;
    --ombre: 0 6px 24px rgba(0, 0, 0, 0.45);
    --ombre-legere: 0 2px 8px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --fond: var(--vert);
  --surface: #1e4a3f;
  --surface-2: #245246;
  --surface-3: #2d5d50;
  --encre: var(--ivoire);
  --encre-2: #dcd6c8;
  --encre-3: #c6c2b4;
  --ligne: #3e6a5d;
  --ligne-champ: #8fa89f;
  --contour: var(--ivoire);
  --accent: var(--or);
  --accent-2: #d9b978;
  --accent-encre: var(--vert);
  --focus: var(--ivoire);
  --lien: var(--ivoire);
  --ok: #9ad5a6;
  --alerte: #edbe72;
  --danger: #f5abab;
  --info: #abcdec;
  --ombre: 0 6px 24px rgba(0, 0, 0, 0.45);
  --ombre-legere: 0 2px 8px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--fond);
  color: var(--encre);
  font: 400 16px/1.5 var(--sans);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--lien); text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.vue-contenu, .fiche-entete, .fiche-corps, .panneau > *, .modale > *, .guidage > * { zoom: var(--echelle-texte); }
.visuellement-cache { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- en-tête */
.entete {
  position: fixed; inset: 0 0 auto 0; z-index: 1000;
  padding: calc(env(safe-area-inset-top) + 8px) max(12px, env(safe-area-inset-right)) 6px max(12px, env(safe-area-inset-left));
  background: linear-gradient(var(--fond) 70%, color-mix(in srgb, var(--fond) 0%, transparent));
  pointer-events: none;
}
.entete > * { pointer-events: auto; }
.barre { display: flex; gap: 8px; align-items: center; }
/* Logo : la boussole ivoire et or sur fond vert, dans les deux modes (cerné d'un filet en mode sombre). */
.logo {
  flex: none; width: 48px; height: 48px; border-radius: 14px; border: 1px solid var(--ligne);
  background: var(--vert); color: var(--ivoire);
  display: grid; place-items: center; box-shadow: var(--ombre-legere); cursor: pointer;
}
.logo svg { width: 30px; height: 30px; }
.recherche { position: relative; flex: 1; min-width: 0; }
.recherche input {
  width: 100%; height: 48px; border-radius: 24px; border: 1px solid var(--ligne-champ);
  background: var(--surface); padding: 0 48px 0 44px; box-shadow: var(--ombre-legere);
}
.recherche input::placeholder { color: var(--encre-3); }
.recherche input::-webkit-search-cancel-button { display: none; }
.recherche .loupe { position: absolute; left: 14px; top: 14px; width: 20px; height: 20px; color: var(--encre-3); pointer-events: none; }
.recherche .effacer { position: absolute; right: 0; top: 0; width: 48px; height: 48px; border: 0; background: none; border-radius: 50%; cursor: pointer; color: var(--encre-2); }
.bouton-rond {
  flex: none; width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--ligne-champ);
  background: var(--surface); display: grid; place-items: center; box-shadow: var(--ombre-legere); cursor: pointer;
}
.bouton-rond svg { width: 24px; height: 24px; }
.bouton-rond[aria-pressed="true"] { background: var(--accent); color: var(--accent-encre); border-color: var(--accent); }

.suggestions {
  position: absolute; top: 50px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--ligne);
  border-radius: var(--rayon); box-shadow: var(--ombre); max-height: 60vh; overflow: auto; z-index: 5; padding: 4px;
  transform-origin: top center; animation: descente var(--duree) var(--courbe-entree);
}
.suggestions button {
  display: flex; width: 100%; gap: 10px; align-items: center; text-align: left; border: 0; background: none;
  padding: 10px; border-radius: 10px; cursor: pointer; min-height: 48px;
}
.suggestions button:hover, .suggestions button:focus-visible { background: var(--surface-2); }
.suggestions .vide { padding: 12px; color: var(--encre-2); }

/* frise des périodes */
.frise { display: flex; gap: 6px; overflow-x: auto; padding: 8px 2px 6px; scrollbar-width: none; scroll-snap-type: x proximity; }
.frise::-webkit-scrollbar { display: none; }
.puce {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px;
  border-radius: 18px; border: 1px solid var(--contour); background: var(--surface); cursor: pointer;
  box-shadow: var(--ombre-legere); white-space: nowrap; scroll-snap-align: start; font-size: 14px; font-weight: 600; position: relative;
}
/* Visuel de 36 px, cible tactile de 48 px. */
.puce::after { content: ""; position: absolute; inset: -6px 0; }
.puce .pastille { width: 10px; height: 10px; border-radius: 50%; flex: none; }
/* Sélection : l'or de la découverte, cerné de vert, texte vert (4,97:1). */
.puce[aria-pressed="true"] { background: var(--or); color: var(--vert); border-color: var(--vert); }
.puce .compte { font-size: 12px; color: var(--encre-2); font-variant-numeric: tabular-nums; }
.puce[aria-pressed="true"] .compte { color: var(--vert); }

/* ---------------------------------------------------------------- carte */
#carte { position: fixed; inset: 0; z-index: 1; background: var(--surface-2); }
.leaflet-container { font: inherit; background: var(--surface-2); }
.leaflet-control-attribution { font-size: 12px; line-height: 1.35; background: color-mix(in srgb, var(--surface) 80%, transparent) !important; color: var(--encre-2); }
.leaflet-control-attribution a { color: var(--lien); }
.leaflet-bottom { bottom: calc(var(--haut-nav) + env(safe-area-inset-bottom)); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--encre); }
.leaflet-popup-content { margin: 12px 14px; font-size: 14px; }
.leaflet-control-zoom a { background: var(--surface); color: var(--encre); border-color: var(--ligne) !important; }
@media (pointer: coarse) { .leaflet-control-zoom { display: none; } }

.flottants {
  position: fixed; right: max(12px, env(safe-area-inset-right)); z-index: 900; display: flex; flex-direction: column; gap: 12px;
  bottom: calc(var(--haut-nav) + env(safe-area-inset-bottom) + 28px);
}
/* Téléphone en paysage : peu de hauteur, les boutons ronds se rangent en ligne au lieu de remonter sous l'en-tête. */
@media (max-height: 480px) { .flottants { flex-direction: row; } }
.legende-bouton { position: fixed; left: max(12px, env(safe-area-inset-left)); z-index: 900; bottom: calc(var(--haut-nav) + env(safe-area-inset-bottom) + 28px); }
.bouton-pilule {
  display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 24px;
  border: 1px solid var(--ligne-champ); background: var(--surface); box-shadow: var(--ombre-legere); cursor: pointer; font-size: 15px; font-weight: 600;
}
.bouton-pilule svg { width: 20px; height: 20px; }

/* Sélection en cours (charte) : anneau d'or entouré d'un contour vert contrasté, puis trois ondes qui s'arrêtent.
   Leaflet positionne le conteneur par transform ; seuls cet élément intérieur et son pseudo-élément sont animés. */
.marqueur-selection {
  position: relative; width: 36px; height: 36px; margin: -18px 0 0 -18px; border-radius: 50%;
  border: 4px solid var(--or); box-shadow: 0 0 0 2px var(--vert), inset 0 0 0 2px var(--vert);
  animation: pose-selection var(--duree) var(--courbe-entree);
}
.marqueur-selection::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--or); opacity: 0;
  animation: onde-selection 1.6s ease-out var(--duree) 3;
}
@keyframes pose-selection { from { scale: 0.5; opacity: 0; } }
@keyframes onde-selection { 0% { scale: 1; opacity: 0.7; } 100% { scale: 2.2; opacity: 0; } }
/* Ressources et découvertes : pictogramme de la couche dans une forme qui dit la précision, lisible sans la couleur
   (disque plein : relevé ; anneau : lieu-dit ; bord pointillé : commune ou zone, avec la zone hachurée sur la carte).
   Couleurs de carte, identiques en clair et en sombre ; l'or n'y est jamais seul (pictogramme vert). */
.res-marqueur {
  --res-fond: #c9a45c; --res-encre: #173f35; --res-trait: #173f35;
  box-sizing: border-box; width: 36px; height: 36px; margin: 4px; border-radius: 50%; display: grid; place-items: center;
  box-shadow: 0 1px 4px rgba(15, 46, 38, 0.35);
}
.res-marqueur svg { display: block; }
.res-or { --res-fond: #c9a45c; --res-encre: #173f35; --res-trait: #173f35; }
.res-terres-rares { --res-fond: #5b4b8a; --res-encre: #f5f0e5; --res-trait: #5b4b8a; }
.res-gemmes { --res-fond: #1f6f8b; --res-encre: #f5f0e5; --res-trait: #1f6f8b; }
.res-depots-epaves { --res-fond: #8a5a2b; --res-encre: #f5f0e5; --res-trait: #8a5a2b; }
.res-recits { --res-fond: #5b5348; --res-encre: #f5f0e5; --res-trait: #5b5348; }
.res-plein { background: var(--res-fond); color: var(--res-encre); border: 2px solid #173f35; }
.res-anneau { background: #f5f0e5; color: var(--res-trait); border: 4px solid var(--res-fond); }
.res-zone { background: #f5f0e5; color: var(--res-trait); border: 3px dashed var(--res-fond); }
.leaflet-marker-icon:focus-visible > .res-marqueur { outline: 3px solid var(--focus); outline-offset: 2px; }
.legende-ligne .res-marqueur { width: 30px; height: 30px; margin: 0; }
.legende-ligne .res-marqueur svg { width: 16px; height: 16px; }

/* Ma position (charte) : triangle vert cerné d'ivoire ; le halo de précision GPS est un cercle de la carte. */
.marqueur-moi { display: block; width: 26px; height: 26px; margin: -13px 0 0 -13px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35)); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* comparaison avant / après */
.comparateur { position: fixed; top: 0; bottom: 0; width: 0; z-index: 800; left: 50%; pointer-events: none; }
.comparateur::before { content: ""; position: absolute; top: 0; bottom: 0; left: -2px; width: 4px; background: var(--vert); box-shadow: 0 0 0 1px var(--ivoire), 0 0 6px rgba(0, 0, 0, 0.4); }
.comparateur .poignee {
  position: absolute; top: 50%; left: -24px; width: 48px; height: 48px; margin-top: -24px; border-radius: 50%;
  background: var(--vert); color: var(--ivoire); display: grid; place-items: center; pointer-events: auto;
  touch-action: none; cursor: ew-resize; box-shadow: var(--ombre); border: 2px solid var(--ivoire); font-weight: 700;
}
.comparateur .etiquette { position: absolute; top: calc(var(--haut-entete) + 10px); padding: 4px 8px; border-radius: 8px; background: var(--encre); color: var(--fond); font-size: 12px; white-space: nowrap; }
.comparateur .etiquette.g { right: 10px; }
.comparateur .etiquette.d { left: 10px; }

/* ---------------------------------------------------------------- navigation */
.onglets {
  position: fixed; inset: auto 0 0 0; z-index: 1100; display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--haut-nav) + env(safe-area-inset-bottom)); padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: var(--surface); border-top: 1px solid var(--ligne);
}
.onglets button {
  position: relative; border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 13px; font-weight: 600; color: var(--encre-2); cursor: pointer;
}
.onglets svg { position: relative; width: 24px; height: 24px; }
/* Onglet actif : pastille d'or sous l'icône (vert sur or, 4,97:1) et libellé à l'encre pleine. */
.onglets button[aria-current="page"] { color: var(--encre); font-weight: 700; }
.onglets button[aria-current="page"] svg { color: var(--vert); }
.onglets button[aria-current="page"]::before {
  content: ""; position: absolute; top: 7px; left: 50%; width: 56px; height: 30px; margin-left: -28px; border-radius: 15px;
  background: var(--or); animation: approche var(--duree) var(--courbe-entree);
}
.onglets .badge { position: absolute; top: 4px; left: calc(50% + 10px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: var(--surface); font-size: 12px; font-weight: 700; line-height: 18px; }

/* ---------------------------------------------------------------- vues pleine page */
.vue {
  position: fixed; inset: 0 0 calc(var(--haut-nav) + env(safe-area-inset-bottom)) 0; z-index: 1050;
  background: var(--fond); overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: calc(env(safe-area-inset-top) + 16px) 16px 32px;
}
/* Le fond de la vue apparaît d'un coup (pas de carte entrevue entre deux onglets), seul le contenu glisse. */
.vue-contenu { max-width: 760px; margin: 0 auto; animation: montee var(--duree) var(--courbe-entree); }
.vue h1 { font: 600 30px/1.15 var(--serif); margin: 4px 0 4px; }
.vue h2 { font: 600 20px/1.2 var(--serif); margin: 26px 0 10px; }
.vue h3 { font-size: 16px; margin: 18px 0 8px; }
.chapo { color: var(--encre-2); margin: 0 0 14px; }

.carte-bloc { background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--rayon); padding: 14px; margin: 10px 0; }
.carte-bloc.discret { background: var(--surface-2); }
.rangee { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.rangee.entre { justify-content: space-between; }
.pile > * + * { margin-top: 8px; }
.petit { font-size: 13px; color: var(--encre-2); }
.tres-petit { font-size: 12px; color: var(--encre-3); }
.manque { color: var(--encre-3); font-style: italic; }
.credits { padding-left: 18px; }
.credits li { margin: 6px 0; }

.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 16px;
  border-radius: 12px; border: 1.5px solid var(--contour); background: var(--surface); cursor: pointer; font-weight: 600; text-decoration: none; color: var(--encre);
}
.bouton.principal { background: var(--accent); color: var(--accent-encre); border-color: var(--accent); }
.bouton.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--ligne)); }
.bouton.plein { width: 100%; }
.bouton svg { width: 20px; height: 20px; }
.bouton:disabled { opacity: 0.5; cursor: default; }

.champ { display: block; margin: 10px 0; }
.champ > span { display: block; font-size: 14px; font-weight: 600; color: var(--encre-2); margin-bottom: 4px; }
.champ input, .champ select, .champ textarea {
  width: 100%; min-height: 48px; border-radius: 12px; border: 1px solid var(--ligne-champ); background: var(--surface); padding: 10px 12px;
}
.champ textarea { min-height: 96px; resize: vertical; }
.interrupteur { display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; cursor: pointer; }
.interrupteur input { width: 22px; height: 22px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }

.liste { list-style: none; margin: 0; padding: 0; }
.element {
  display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; padding: 12px; border: 0;
  border-bottom: 1px solid var(--ligne); background: none; cursor: pointer; min-height: 60px;
}
.element:hover { background: var(--surface-2); }
.element .pastille { width: 14px; height: 14px; border-radius: 50%; flex: none; margin-top: 4px; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--ligne); }
.element .titre { font-weight: 600; }
.element .meta { font-size: 13px; color: var(--encre-2); }
.element .droite { margin-left: auto; text-align: right; flex: none; font-size: 13px; color: var(--encre-2); font-variant-numeric: tabular-nums; }

.filtres { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.filtres .puce { box-shadow: none; }
.filtres.defilant { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: -16px; margin-right: -16px; padding: 0 16px; }
.filtres.defilant::-webkit-scrollbar { display: none; }
.options { margin: 6px 0; }
details.region { border-bottom: 1px solid var(--ligne); }
details.region > summary { cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 48px; padding: 6px 2px; }
details.region > summary .titre { font-weight: 600; }
details.region > summary .meta { color: var(--encre-2); font-size: 13px; }
details.region[open] > .bouton { margin: 4px 0 8px; }
.contacts { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 10px; }
.contacts li { padding: 10px 12px; border: 1px solid var(--ligne); border-radius: 10px; background: var(--surface-2); }
.options > summary { cursor: pointer; color: var(--encre-2); font-size: 14px; font-weight: 600; padding: 12px 0; min-height: 48px; }

/* ---------------------------------------------------------------- fiche (panneau glissant) */
/* Sous les vues pleine page (1050) : la fiche reste ouverte mais n'empiète pas sur Explorer, Journal, Données. */
/* Hauteur fixe ; les trois états ne diffèrent que par transform (aucune mise en page par image).
   Mi-ouverte : la fiche descend de --decalage-mi et sa barre d'actions remonte d'autant, pour rester visible. */
.fiche {
  --decalage-mi: calc((var(--vh-visible) - var(--haut-nav) - env(safe-area-inset-bottom)) / 2 - env(safe-area-inset-top) - 8px);
  position: fixed; left: 0; right: 0; z-index: 1040; background: var(--surface); color: var(--encre);
  bottom: calc(var(--haut-nav) + env(safe-area-inset-bottom)); height: calc(var(--vh-visible) - var(--haut-nav) - env(safe-area-inset-bottom) - env(safe-area-inset-top) - 8px);
  border-radius: 20px 20px 0 0; box-shadow: var(--ombre); display: flex; flex-direction: column;
  transform: translateY(110%); transition: transform var(--duree-longue) var(--courbe-deplacement);
}
.fiche[data-etat="mi"] { transform: translateY(var(--decalage-mi)); }
.fiche[data-etat="plein"] { transform: none; }
.fiche[data-etat="ferme"], .fiche[data-etat="ferme"] .fiche-actions { transition-duration: var(--duree-longue-sortie); transition-timing-function: var(--courbe-sortie); }
.fiche[data-etat="mi"] .fiche-actions { transform: translateY(calc(-1 * var(--decalage-mi))); }
.fiche[data-etat="mi"] .fiche-corps { padding-bottom: calc(var(--decalage-mi) + 24px); }
/* Pendant le glissement au doigt, fiche.js pilote transform directement. */
.fiche.glisse, .fiche.glisse .fiche-actions { transition: none; }
.fiche-poignee { flex: none; padding: 14px 0 12px; display: grid; place-items: center; cursor: grab; touch-action: none; border: 0; background: none; width: 100%; position: relative; }
/* Zone de saisie de 48 px, prolongée au-dessus du bord de la fiche. */
.fiche-poignee::before { content: ""; position: absolute; inset: -17px 0 0; }
.fiche-poignee span { width: 44px; height: 5px; border-radius: 3px; background: var(--ligne); }
.fiche-entete { flex: none; padding: 0 16px 10px; display: flex; gap: 10px; align-items: flex-start; }
.fiche-entete h2 { font: 600 22px/1.2 var(--serif); margin: 0; }
.fiche-entete .sous-titre { font-size: 14px; color: var(--encre-2); margin-top: 2px; }
.fiche-entete .fermer { margin-left: auto; flex: none; }
.fiche-corps { flex: 1; overflow-y: auto; padding: 0 16px 24px; overscroll-behavior: contain; }
.fiche-actions { flex: none; display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--ligne); background: var(--surface); transition: transform var(--duree-longue) var(--courbe-deplacement); }
.fiche-actions .bouton { padding: 0 8px; font-size: 14px; flex-direction: column; gap: 2px; min-height: 52px; }

.dimensions { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 6px 0 12px; }
.dimension { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; border: 1px solid var(--ligne); text-align: left; cursor: pointer; }
.dimension .etiquette { font-size: 12px; font-weight: 600; color: var(--encre-2); text-transform: uppercase; letter-spacing: 0.04em; }
.dimension .valeur { font-weight: 650; font-size: 15px; margin-top: 2px; display: flex; gap: 6px; align-items: center; font-variant-numeric: tabular-nums; }
.dimension.juridique { border-style: dashed; }

.jauge { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; margin-top: 6px; }
.jauge > span { display: block; height: 100%; background: var(--accent); }

.section { border-top: 1px solid var(--ligne); padding: 12px 0 4px; }
.section > h3 { margin: 0 0 8px; font: 600 17px/1.25 var(--serif); }
.section .question { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--encre-3); margin-bottom: 2px; }

.preuve { padding: 10px 0; border-bottom: 1px dashed var(--ligne); }
.preuve:last-child { border-bottom: 0; }
.preuve .texte { margin: 0 0 4px; }
.preuve .meta { font-size: 13px; color: var(--encre-2); display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }

.etiquette-statut {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 10px;
  border: 1px solid currentColor; white-space: nowrap; line-height: 1.5;
}
.s-verifie, .s-autorise-documente, .s-verifiee { color: var(--ok); }
.s-a-verifier, .s-importee, .s-partielle, .s-indetermine, .s-regime-distinct { color: var(--alerte); }
.s-autorisation-requise, .s-interdit, .s-contestee, .s-insuffisante { color: var(--danger); }
.s-obligation, .s-info { color: var(--info); }
.s-tradition { color: var(--encre-3); }

.activite { border: 1px solid var(--ligne); border-radius: 12px; margin: 8px 0; background: var(--surface); }
.activite > summary { list-style: none; display: flex; gap: 10px; align-items: center; padding: 12px; cursor: pointer; min-height: 52px; }
.activite > summary::-webkit-details-marker { display: none; }
.activite .icone { width: 28px; height: 24px; display: grid; place-items: center; flex: none; color: var(--encre); }
.activite .icone svg { width: 24px; height: 24px; }
.activite .nom { font-weight: 600; flex: 1; }
.activite .symbole { font-weight: 800; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 2px solid currentColor; flex: none; }
.activite .corps { padding: 0 12px 12px 50px; font-size: 14px; }
.activite .corps p { margin: 6px 0; }
.requis { list-style: none; padding: 0; margin: 6px 0; }
.requis li { margin: 4px 0; }

.avertissement { border: 1px solid color-mix(in srgb, var(--alerte) 35%, var(--ligne)); background: color-mix(in srgb, var(--alerte) 10%, var(--surface)); padding: 10px 12px; border-radius: 10px; font-size: 14px; margin: 10px 0; }
.avertissement.info { border-color: color-mix(in srgb, var(--info) 35%, var(--ligne)); background: color-mix(in srgb, var(--info) 10%, var(--surface)); }
.avertissement.danger { border-color: color-mix(in srgb, var(--danger) 35%, var(--ligne)); background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }

/* ---------------------------------------------------------------- panneaux (couches, légende) */
.panneau {
  position: fixed; z-index: 1200; left: 8px; right: 8px; top: calc(env(safe-area-inset-top) + 60px);
  max-height: calc(100% - 140px - env(safe-area-inset-top)); overflow-y: auto; background: var(--surface);
  border: 1px solid var(--ligne); border-radius: 18px; box-shadow: var(--ombre); padding: 14px 16px;
  animation: descente var(--duree) var(--courbe-entree);
}
/* Chaque panneau se déploie depuis le côté de son bouton. */
#panneau-couches { transform-origin: top right; }
#panneau-legende { transform-origin: top left; }
.panneau h2 { font: 600 19px/1.2 var(--serif); margin: 0; }
.panneau h3 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--encre-3); margin: 16px 0 6px; }
.choix-fonds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.choix-fonds label { border: 2px solid var(--ligne); border-radius: 12px; padding: 10px 6px; text-align: center; cursor: pointer; font-size: 13px; min-height: 52px; display: grid; place-items: center; transition: border-color var(--duree-courte), background-color var(--duree-courte); }
.choix-fonds input { position: absolute; opacity: 0; }
/* Le bouton radio est masqué : son focus clavier se voit sur l'étiquette. */
.choix-fonds label:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
/* Choix en cours : or de la sélection, cerné de vert. */
.choix-fonds label:has(input:checked) { border-color: var(--contour); background: color-mix(in srgb, var(--or) 35%, var(--surface)); font-weight: 600; }
.choix-affichage { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
.choix-affichage legend { font-weight: 600; font-size: 14px; padding: 0; margin-bottom: 6px; }
.choix-affichage label { gap: 2px; align-content: center; }
.choix-ancien label { display: flex; gap: 10px; align-items: center; padding: 8px 4px; min-height: 48px; cursor: pointer; border-radius: 8px; }
.choix-ancien input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.choix-ancien .date { margin-left: auto; font-size: 13px; color: var(--encre-2); }
input[type="range"] { width: 100%; accent-color: var(--accent); height: 32px; }

.legende-ligne { display: flex; gap: 10px; align-items: center; margin: 6px 0; font-size: 14px; }
.legende-ligne .ech { width: 28px; flex: none; display: grid; place-items: center; }

/* ---------------------------------------------------------------- guidage */
.guidage {
  position: fixed; z-index: 1150; left: 8px; right: 8px; top: calc(env(safe-area-inset-top) + 8px);
  background: var(--surface); border: 1px solid var(--ligne); border-radius: 18px; box-shadow: var(--ombre); padding: 12px 14px;
  animation: descente var(--duree) var(--courbe-entree);
}
.guidage .haut { display: flex; gap: 12px; align-items: center; }
.boussole { width: 84px; height: 84px; flex: none; border-radius: 50%; background: var(--surface-2); border: 2px solid var(--ligne); position: relative; }
.boussole .fleche { position: absolute; inset: 8px; transition: transform var(--duree) ease-out; }
.boussole .fleche path { fill: var(--accent); stroke: var(--surface-2); stroke-width: 1; }
.boussole .nord { position: absolute; top: 2px; left: 50%; transform: translateX(-50%); font-size: 12px; font-weight: 700; color: var(--danger); }
.guidage .distance { font: 700 30px/1 var(--sans); font-variant-numeric: tabular-nums; }
.guidage .details { font-size: 13px; color: var(--encre-2); margin-top: 4px; }
.guidage .etat { margin-top: 8px; font-size: 14px; }
.guidage .actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.guidage .actions .bouton { flex: 1; min-width: 120px; font-size: 14px; }

/* ---------------------------------------------------------------- fenêtres modales et toasts */
.modale-fond { position: fixed; inset: 0; z-index: 1300; background: rgba(15, 46, 38, 0.5); display: grid; place-items: end center; animation: fondu var(--duree) var(--courbe-entree); }
.modale {
  width: 100%; max-width: 640px; max-height: 92%; overflow-y: auto; background: var(--surface); border-radius: 20px 20px 0 0;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); box-shadow: var(--ombre);
  animation: montee-feuille var(--duree-longue) var(--courbe-entree);
}
.modale h2 { font: 600 22px/1.2 var(--serif); margin: 0 0 8px; }
.etapes { counter-reset: etape; list-style: none; padding: 0; }
.etapes li { counter-increment: etape; position: relative; padding: 8px 0 8px 44px; }
.etapes li::before { content: counter(etape); position: absolute; left: 0; top: 6px; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-encre); display: grid; place-items: center; font-weight: 700; }

.toast {
  position: fixed; z-index: 1400; left: 50%; transform: translateX(-50%); bottom: calc(var(--haut-nav) + env(safe-area-inset-bottom) + 90px);
  background: var(--encre); color: var(--fond); padding: 10px 16px; border-radius: 12px; box-shadow: var(--ombre); max-width: calc(100% - 32px); font-size: 14px;
  animation: montee var(--duree) var(--courbe-entree);
}
.bandeau { position: fixed; z-index: 1001; left: 12px; right: 12px; top: calc(env(safe-area-inset-top) + var(--haut-entete)); animation: descente var(--duree) var(--courbe-entree); }

/* proposition d'installer le département affiché (France entière) */
.proposition {
  position: fixed; z-index: 950; left: 12px; right: 68px; max-width: 440px;
  bottom: calc(var(--haut-nav) + env(safe-area-inset-bottom) + 84px);
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px;
  background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--rayon); box-shadow: var(--ombre);
  animation: montee var(--duree) var(--courbe-entree);
}
.proposition[hidden] { display: none; }
.proposition > span { flex: 1; min-width: 0; line-height: 1.3; }
.proposition .bouton { flex: none; }
.proposition .petit-rond { box-shadow: none; }

.progression { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; margin: 8px 0; }
/* Remplissage en scaleX (reglages.js), pas en largeur : aucune mise en page à chaque étape. */
.progression > span { display: block; height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); transition: transform var(--duree) var(--courbe-deplacement); }

/* ---------------------------------------------------------------- mouvement */
/* Entrées : rejouées chaque fois qu'un élément masqué (hidden) réapparaît. Sorties : masquer() dans ui.js.
   translate et scale sont des propriétés séparées : elles se composent avec les transform existants. */
@keyframes montee { from { opacity: 0; translate: 0 8px; } }
@keyframes descente { from { opacity: 0; translate: 0 -6px; scale: 0.98; } }
@keyframes fondu { from { opacity: 0; } }
@keyframes montee-feuille { from { opacity: 0; translate: 0 48px; } }
@keyframes approche { from { opacity: 0; scale: 0.97; } }

/* Retour tactile : une pression enfonce légèrement le contrôle, sans délai perceptible. */
.bouton, .bouton-rond, .bouton-pilule, .puce, .logo, .dimension {
  transition: scale var(--duree-courte) var(--courbe-deplacement), background-color var(--duree-courte), color var(--duree-courte), border-color var(--duree-courte);
}
.bouton:active:not(:disabled), .bouton-rond:active, .bouton-pilule:active, .puce:active, .logo:active, .dimension:active { scale: 0.96; }
.onglets button { transition: color var(--duree-courte); }
.onglets button svg { transition: scale var(--duree-courte) var(--courbe-deplacement); }
.onglets button:active svg { scale: 0.88; }
.element { transition: background-color var(--duree-courte); }
.element:active { background: var(--surface-2); }

.photo-miniature { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--ligne); }

/* ---------------------------------------------------------------- grand écran */
@media (min-width: 900px) {
  .entete { right: auto; width: 460px; }
  .fiche { left: auto; right: 12px; width: 440px; top: 12px; bottom: calc(var(--haut-nav) + 12px); height: auto; border-radius: 20px; }
  .fiche[data-etat="mi"], .fiche[data-etat="plein"] { transform: none; height: auto; }
  .fiche:not([data-etat="mi"]):not([data-etat="plein"]) { transform: translateX(calc(100% + 24px)); }
  .fiche[data-etat] .fiche-actions { transform: none; }
  .fiche[data-etat="mi"] .fiche-corps { padding-bottom: 24px; }
  .fiche-poignee { display: none; }
  .panneau { left: 12px; right: auto; width: 420px; }
  .guidage { left: 12px; right: auto; width: 460px; }
  .onglets { left: 50%; right: auto; transform: translateX(-50%); width: 480px; border: 1px solid var(--ligne); border-radius: 18px 18px 0 0; }
  .modale-fond { place-items: center; }
  .modale { border-radius: 20px; animation-name: approche; }
}
