/*
 * TRG — composants
 *
 * Mobile d'abord : les règles de base visent un écran de 390 px ; les
 * media queries élargissent. Ordre de chargement : bootstrap.min.css,
 * fonts.css, tokens.css, puis ce fichier. Toutes les valeurs viennent de tokens.css.
 */

/* ================================================================== */
/* Fondations                                                         */
/* ================================================================== */

html { overflow-x: hidden; scroll-padding-top: 64px; }

body {
  font-family: var(--g-font-texte);
  background: var(--g-bg);
  color: var(--g-ink);
  -webkit-font-smoothing: antialiased;
  /* La navigation basse mobile couvre le bas de page. */
  padding-bottom: calc(var(--g-nav-basse) + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 992px) {
  body { padding-bottom: 0; }
}

h1, h2, h3, .g-titre {
  font-family: var(--g-font-titre);
  font-weight: 700;
  letter-spacing: -.005em;
  line-height: 1;
  color: var(--g-ink);
}

.g-h1 { font-size: 34px; line-height: .98; margin: 0; }
.g-h2 { font-size: 24px; margin: 0; }
.g-lede { color: var(--g-ink-2); font-size: 15px; margin: 8px 0 0; max-width: 52ch; }

@media (min-width: 992px) {
  .g-h1 { font-size: 46px; }
  .g-h2 { font-size: 28px; }
  .g-lede { font-size: 17px; }
}

a { color: var(--g-forest); text-decoration: none; }
a:hover { color: var(--g-forest-dark); }

:focus-visible {
  outline: 3px solid rgba(31, 77, 58, .45);
  outline-offset: 2px;
  border-radius: 4px;
}

.g-muted { color: var(--g-muted); }
.g-muted-2 { color: var(--g-muted); }
.min-w-0 { min-width: 0; }

.g-sur-titre {
  display: inline-block;
  font-family: var(--g-font-titre);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--g-trail);
  margin: 0;
}

.g-section { padding-top: 18px; padding-bottom: 28px; }
@media (min-width: 992px) { .g-section { padding-top: 32px; padding-bottom: 48px; } }

.g-section__tete {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  margin-bottom: 12px;
}
.g-section__tete h2 { font-size: 26px; margin: 0; }
.g-section__tete a { font-weight: 600; font-size: 14px; }

.g-vide {
  background: var(--g-surface); border: 1px dashed var(--g-border); border-radius: var(--g-r-card);
  padding: 22px 16px; color: var(--g-muted); text-align: center; margin: 0;
}

/* ================================================================== */
/* Logo : la balise (deux bandes) + le mot                            */
/* ================================================================== */

.g-logo { display: inline-flex; align-items: center; gap: 8px; color: var(--g-ink); }
.g-logo:hover { color: var(--g-ink); }
.g-logo b {
  font-family: var(--g-font-titre); font-weight: 700; font-size: 24px;
  letter-spacing: .02em; line-height: 1;
}

.g-balise {
  width: 22px; height: 22px; border-radius: 4px; overflow: hidden;
  display: inline-flex; flex-direction: column; border: 1.5px solid var(--g-ink);
  flex: 0 0 auto;
}
.g-balise span:first-child { flex: 1; background: #fff; }
.g-balise span:last-child { flex: 1; background: var(--g-trail); }
.g-balise--grande { width: 34px; height: 34px; border-radius: 6px; display: inline-flex; }

/* ================================================================== */
/* En-tête                                                            */
/* ================================================================== */

.g-header {
  position: sticky; top: 0; z-index: 1020;
  background: var(--g-bg);
  border-bottom: 1px solid var(--g-rule);
  padding-top: env(safe-area-inset-top, 0px);
}

.g-header__inner {
  display: flex; align-items: center; gap: 10px;
  height: 56px;
}

.g-header__titre {
  font-family: var(--g-font-titre); font-weight: 600; font-size: 18px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1;
}

.g-retour {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; margin-left: -8px; border-radius: var(--g-r-btn);
  color: var(--g-ink); flex: 0 0 auto;
}
.g-retour:hover { background: var(--g-surface-2); color: var(--g-ink); }

.g-nav { display: flex; gap: 24px; margin-left: 24px; }
.g-nav a { font-weight: 600; font-size: 15px; color: var(--g-ink-2); padding: 6px 0; border-bottom: 2px solid transparent; }
.g-nav a:hover { color: var(--g-ink); }
.g-nav a[aria-current="page"] { color: var(--g-ink); border-color: var(--g-trail); }

.g-header__droite { margin-left: auto; display: flex; align-items: center; gap: 6px; }

@media (min-width: 992px) {
  .g-header__inner { height: 68px; }
  .g-header__droite { gap: 10px; }
}

/* ================================================================== */
/* Navigation basse (mobile)                                          */
/* ================================================================== */

.g-nav-basse {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
  background: var(--g-surface);
  border-top: 1px solid var(--g-border);
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  min-height: var(--g-nav-basse);
}

.g-nav-basse a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11.5px; font-weight: 600; color: var(--g-muted);
  min-height: 44px; padding: 4px 0;
}
.g-nav-basse a.is-active { color: var(--g-forest); }

.g-nav-basse__rond {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--g-trail); color: #fff;
  display: flex; align-items: center; justify-content: center;
  margin-top: -18px; border: 3px solid var(--g-bg);
}
.g-nav-basse__ajouter { color: var(--g-ink-2) !important; }

/* ================================================================== */
/* Boutons                                                            */
/* ================================================================== */

.g-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px;
  border-radius: var(--g-r-btn);
  font-family: var(--g-font-texte); font-weight: 600; font-size: 15px; line-height: 1;
  border: 1.5px solid transparent; white-space: nowrap; cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.g-btn--lg { height: 50px; font-size: 16px; }
.g-btn--sm { height: 36px; padding: 0 12px; font-size: 14px; }
.g-btn--icone { width: 44px; padding: 0; }

.g-btn--trail { background: var(--g-trail); color: #fff; }
.g-btn--trail:hover { background: var(--g-trail-dark); color: #fff; }

.g-btn--forest { background: var(--g-forest); color: #fff; }
.g-btn--forest:hover { background: var(--g-forest-dark); color: #fff; }

.g-btn--ghost { background: transparent; border-color: var(--g-border); color: var(--g-ink); }
.g-btn--ghost:hover { background: var(--g-surface); color: var(--g-ink); }

.g-btn--blanc { background: var(--g-surface); border-color: var(--g-border); color: var(--g-ink); }
.g-btn--blanc:hover { border-color: var(--g-ink-2); color: var(--g-ink); }

.g-btn--danger { background: var(--g-danger); color: #fff; }
.g-btn--danger:hover { background: #7E1E24; color: #fff; }

@media (min-width: 992px) { .w-lg-auto { width: auto !important; } }

/* ================================================================== */
/* Chips d'activité                                                   */
/* ================================================================== */

.g-chips {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding-bottom: 2px; margin: 0 calc(-1 * var(--g-pad)); padding-left: var(--g-pad); padding-right: var(--g-pad);
}
.g-chips::-webkit-scrollbar { display: none; }
@media (min-width: 992px) { .g-chips { flex-wrap: wrap; margin: 0; padding-left: 0; padding-right: 0; } }

.g-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 12px; border-radius: var(--g-r-chip);
  background: var(--g-surface); border: 1.5px solid var(--g-border);
  font-weight: 600; font-size: 14px; color: var(--g-ink-2); white-space: nowrap; flex: 0 0 auto;
}
.g-chip:hover { border-color: var(--g-ink-2); color: var(--g-ink); }
.g-chip.is-active { background: var(--g-forest); border-color: var(--g-forest); color: #fff; }

/* ================================================================== */
/* Badges                                                             */
/* ================================================================== */

.g-badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 8px; border-radius: var(--g-r-chip);
  font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
.g-badge--activite { background: var(--g-trail-light); color: var(--g-trail-dark); }
.g-badge--public { background: var(--g-forest-light); color: var(--g-forest); }
.g-badge--prive { background: var(--g-surface-2); color: var(--g-ink-2); }

/* ================================================================== */
/* Avatar                                                             */
/* ================================================================== */

.g-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--g-forest); color: #fff;
  font-family: var(--g-font-titre); font-weight: 700; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.g-avatar--xs { width: 18px; height: 18px; font-size: 11px; }
.g-avatar--lg { width: 40px; height: 40px; font-size: 18px; }
.g-avatar--xl { width: 64px; height: 64px; font-size: 30px; }

/* ================================================================== */
/* Carte d'un tracé (liste)                                           */
/* ================================================================== */

.g-liste { display: flex; flex-direction: column; gap: 10px; }

@media (min-width: 768px) {
  .g-liste { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}
@media (min-width: 1200px) {
  .g-liste { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.g-trace {
  display: flex; gap: 12px;
  background: var(--g-surface); border: 1px solid var(--g-border); border-radius: var(--g-r-card);
  padding: 12px; color: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.g-trace:hover { color: inherit; border-color: var(--g-ink-2); box-shadow: var(--g-shadow-flottant); }

.g-trace__vignette {
  width: 84px; height: 84px; flex: 0 0 84px; border-radius: 8px; overflow: hidden;
  background: var(--g-carte-fond);
}
.g-trace__vignette svg { display: block; }

.g-trace__corps { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.g-trace__haut { display: flex; align-items: center; justify-content: space-between; gap: 6px; }

.g-trace__titre {
  font-family: var(--g-font-titre); font-weight: 700; font-size: 19px; line-height: 1.05;
  color: var(--g-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.g-trace__lieu { font-size: 13px; color: var(--g-muted); display: flex; align-items: center; gap: 6px; }

.g-stats {
  display: flex; gap: 10px; flex-wrap: wrap;
  font-family: var(--g-font-titre); font-weight: 600; font-size: 15px; color: var(--g-ink-2);
}
.g-stats span { display: inline-flex; align-items: center; gap: 4px; }
.g-stats small { font-size: 11px; font-weight: 600; color: var(--g-muted); letter-spacing: .06em; text-transform: uppercase; }

.g-auteur { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--g-muted); }

/* ================================================================== */
/* Fiche technique                                                    */
/* ================================================================== */

.g-fiche {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px;
  background: var(--g-border); border: 1px solid var(--g-border); border-radius: var(--g-r-card); overflow: hidden;
}
.g-fiche > div { background: var(--g-surface); padding: 12px 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.g-fiche__val { font-family: var(--g-font-titre); font-weight: 700; font-size: 26px; line-height: 1; color: var(--g-ink); }
.g-fiche__val small { font-size: 14px; font-weight: 600; color: var(--g-muted); margin-left: 2px; }
.g-fiche__lib { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--g-muted); }

@media (min-width: 768px) {
  .g-fiche { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .g-fiche--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g-fiche__val { font-size: 30px; }
}

/* ================================================================== */
/* Cartes Leaflet                                                     */
/* ================================================================== */

.g-carte { background: var(--g-carte-fond); width: 100%; }
.g-carte--arrondie { border-radius: var(--g-r-card); overflow: hidden; border: 1px solid var(--g-border); }

.g-carte-accueil { position: relative; }
.g-carte-accueil__etiquette {
  /* En bas : en haut, le zoom est à gauche et le choix du fond de carte à droite. */
  position: absolute; left: 12px; bottom: 12px; z-index: 500;
  background: var(--g-bg); padding: 4px 8px; border-radius: 4px; box-shadow: 0 1px 0 rgba(0, 0, 0, .06);
}

.g-carte-trace { position: relative; }

/* Bouton plein écran : une icône seule, déplacée par carte.js dans les
   contrôles Leaflet (empilée sous le zoom, en haut à gauche). */
.g-carte-trace__plein {
  display: block; width: 26px; height: 26px; line-height: 26px; padding: 0;
  background: #fff; border: 0; border-radius: 4px; color: var(--g-ink); cursor: pointer;
}
.g-carte-trace__plein:hover { background: #f4f4f4; }
.g-carte-trace__plein.is-actif { background: var(--g-trail); color: #fff; }
.leaflet-touch .g-carte-trace__plein { width: 30px; height: 30px; line-height: 30px; border-radius: 2px; }
.g-carte-trace__plein svg { vertical-align: middle; }

@media (min-width: 992px) {
  .g-carte-accueil .g-carte { height: 420px !important; }
  .g-carte-trace .g-carte { height: 480px !important; }
}

/* Après le media query ci-dessus : à spécificité égale (2 classes), la règle la
   plus tardive l'emporte, donc le plein écran doit rester en dernier pour
   passer devant .g-carte-trace .g-carte / .g-carte-accueil .g-carte. */
.g-carte.is-plein-ecran {
  /* !important partout : Leaflet pose position:relative en style inline sur le
     conteneur à l'initialisation, qui l'emporterait sinon sur cette règle. */
  position: fixed !important; inset: 0 !important; z-index: 2000; height: 100vh !important; height: 100dvh !important;
}

.leaflet-container { font-family: var(--g-font-texte); }
.leaflet-popup-content-wrapper { border-radius: 10px; box-shadow: var(--g-shadow-survol); }
.leaflet-popup-content { margin: 12px 14px; font-size: 14px; }
.leaflet-popup-content .g-popup__titre { font-family: var(--g-font-titre); font-weight: 700; font-size: 18px; line-height: 1.05; display: block; color: var(--g-ink); }
.leaflet-popup-content .g-popup__stats { color: var(--g-muted); font-size: 13px; display: block; margin-top: 2px; }
.leaflet-bar a { color: var(--g-ink); }

.g-marqueur-depart, .g-marqueur-arrivee { border-radius: 50%; border: 2.5px solid #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.g-marqueur-depart { background: var(--g-forest); }
.g-marqueur-arrivee { background: var(--g-trail); }
.g-marqueur-position { border-radius: 50%; background: #fff; border: 3px solid var(--g-trail); }

/* Pastille de regroupement (/carte/, trop de tracés pour les dessiner un par un) */
.g-marqueur-cluster {
  /* !important : leaflet.css (chargé après ce fichier) impose display:block
     sur .leaflet-marker-icon, à spécificité égale — sans quoi le chiffre
     reste aligné en haut au lieu d'être centré. */
  display: flex !important; align-items: center; justify-content: center; border-radius: 50%;
  border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); cursor: pointer;
  color: #fff; font-family: var(--g-font-titre); font-weight: 700; line-height: 1;
}
.g-marqueur-cluster--s { background: var(--g-trail); font-size: 13px; }
.g-marqueur-cluster--m { background: var(--g-trail-dark); font-size: 15px; }
.g-marqueur-cluster--l { background: var(--g-trail-dark); font-size: 17px; }

/* ================================================================== */
/* Accueil                                                            */
/* ================================================================== */

.g-hero { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }
.g-hero__chiffres { display: flex; gap: 18px; }
.g-hero__chiffres div { display: flex; flex-direction: column; }
.g-hero__chiffres b { font-family: var(--g-font-titre); font-weight: 700; font-size: 28px; line-height: 1; }
.g-hero__chiffres span { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--g-muted); }

@media (min-width: 992px) {
  .g-hero { flex-direction: row; align-items: flex-end; justify-content: space-between; gap: 40px; margin-bottom: 28px; }
}

.g-encart {
  background: var(--g-forest); color: #fff; border-radius: var(--g-r-card);
  padding: 18px; position: relative; overflow: hidden;
}
.g-encart h2 { color: #fff; font-size: 26px; margin: 0; }
.g-encart p { margin: 6px 0 0; color: #D7E5DC; font-size: 14px; }
.g-encart__contours {
  position: absolute; inset: 0; opacity: .18; pointer-events: none;
  background-image: repeating-radial-gradient(ellipse at 80% 120%, transparent 0 22px, #fff 22px 23px);
}

/* ================================================================== */
/* Page d'un tracé                                                    */
/* ================================================================== */

.g-article { display: flex; flex-direction: column; gap: 22px; }
@media (min-width: 992px) { .g-article { max-width: 860px; gap: 28px; } }

.g-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; color: var(--g-ink-2); margin-top: 8px; }
.g-meta > * { display: inline-flex; align-items: center; gap: 5px; }

/* Hauteur fixe (pas de content-fit) : assets/js/trace.js lit clientWidth et
   clientHeight pour redessiner le SVG à la taille réelle de l'écran plutôt
   que d'étirer un design figé (texte énorme et flou en plein écran, sinon). */
.g-profil { background: var(--g-surface); border: 1px solid var(--g-border); border-radius: var(--g-r-card); padding: 8px 6px 4px; height: 190px; }
.g-profil svg { display: block; width: 100%; height: 100%; }
@media (min-width: 992px) { .g-profil { height: 230px; } }

/* Profil flottant : seul moyen d'y accéder en plein écran, la page en dessous
   de la carte (fixée à tout l'écran, z-index 2000) n'étant plus visible. */
.g-profil--flottant {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 2100;
  margin: 0; height: 24vh; height: 24dvh; min-height: 120px;
  border-radius: 14px 14px 0 0; border-width: 1px 0 0; box-shadow: 0 -4px 16px rgba(20, 32, 26, .25);
  padding-bottom: calc(4px + env(safe-area-inset-bottom, 0px));
}

.g-prose p { margin: 0 0 10px; color: var(--g-ink-2); font-size: 15px; line-height: 1.55; }
.g-prose p:last-child { margin-bottom: 0; }
@media (min-width: 992px) { .g-prose p { font-size: 16px; } }

.g-photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
@media (min-width: 768px) { .g-photos { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; } }
.g-photos__item { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--g-surface-2); display: block; }
.g-photos__item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.g-photos__supprimer {
  position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%;
  background: rgba(20, 32, 26, .75); color: #fff; border: 0; display: flex; align-items: center; justify-content: center;
}

.g-lien-externe {
  display: flex; align-items: center; gap: 10px;
  background: var(--g-surface); border: 1px solid var(--g-border); border-radius: 10px; padding: 12px 14px; color: var(--g-ink);
}
.g-lien-externe span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }

.g-auteur-carte {
  display: flex; align-items: center; gap: 12px;
  background: var(--g-surface); border: 1px solid var(--g-border); border-radius: var(--g-r-card); padding: 12px 14px;
}

/* ================================================================== */
/* Listes pays / départements                                          */
/* ================================================================== */

.g-lignes { display: flex; flex-direction: column; gap: 8px; }
@media (min-width: 768px) { .g-lignes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .g-lignes { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.g-ligne {
  display: flex; align-items: center; gap: 10px;
  background: var(--g-surface); border: 1px solid var(--g-border); border-radius: 10px;
  padding: 12px 14px; min-height: 52px; color: var(--g-ink);
}
.g-ligne:hover { border-color: var(--g-ink-2); color: var(--g-ink); }
.g-ligne b { font-family: var(--g-font-titre); font-weight: 600; font-size: 18px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-ligne__code { font-family: var(--g-font-titre); font-weight: 700; font-size: 14px; color: var(--g-trail); width: 30px; flex: 0 0 auto; }
.g-ligne__nb { font-family: var(--g-font-titre); font-weight: 600; color: var(--g-muted); font-size: 15px; display: inline-flex; align-items: center; gap: 6px; }

.g-pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; }

/* ================================================================== */
/* Profil                                                             */
/* ================================================================== */

.g-profil-tete { display: flex; align-items: center; gap: 14px; }

.g-onglets { display: flex; border-bottom: 1.5px solid var(--g-border); }
.g-onglets a {
  padding: 10px 2px; margin-right: 18px; font-weight: 600; font-size: 15px; color: var(--g-muted);
  border-bottom: 2.5px solid transparent; margin-bottom: -1.5px;
}
.g-onglets a.is-active { color: var(--g-ink); border-color: var(--g-trail); }

/* ================================================================== */
/* Formulaires                                                        */
/* ================================================================== */

.g-carte-blanche { background: var(--g-surface); border: 1px solid var(--g-border); border-radius: var(--g-r-card); padding: 16px; }
@media (min-width: 768px) { .g-carte-blanche { padding: 22px; } }
.g-carte-blanche--danger { border-color: var(--g-danger-light); background: #FDF7F7; }

.form-label { font-weight: 600; font-size: 14px; }
.form-control, .form-select { min-height: 48px; border-width: 1.5px; font-size: 15px; }
.form-control:focus, .form-select:focus { border-color: var(--g-forest); box-shadow: 0 0 0 3px rgba(31, 77, 58, .18); }
.form-text { color: var(--g-muted); font-size: 12.5px; }
.form-check-input:checked { background-color: var(--g-forest); border-color: var(--g-forest); }

.g-depot {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  border: 2px dashed var(--g-border); border-radius: var(--g-r-card); padding: 28px 16px; cursor: pointer;
  color: var(--g-ink-2); background: var(--g-bg); transition: border-color .15s ease, background-color .15s ease;
}
.g-depot:hover, .g-depot.is-survol { border-color: var(--g-forest); background: var(--g-forest-light); }
.g-depot.is-invalid { border-color: var(--g-danger); }
.g-depot__titre { font-family: var(--g-font-titre); font-weight: 700; font-size: 22px; color: var(--g-ink); }
.g-depot__aide { font-size: 13px; color: var(--g-muted); max-width: 34ch; }
.g-depot input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.g-depot.a-fichier .g-depot__titre { color: var(--g-forest); }

.g-activites { display: flex; flex-wrap: wrap; gap: 8px; }
.g-activite { position: relative; }
.g-activite input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.g-activite span {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px;
  border-radius: var(--g-r-chip); background: var(--g-surface); border: 1.5px solid var(--g-border);
  font-weight: 600; font-size: 14px; color: var(--g-ink-2); cursor: pointer;
}
.g-activite input:checked + span { background: var(--g-forest); border-color: var(--g-forest); color: #fff; }
.g-activite input:focus-visible + span { outline: 3px solid rgba(31, 77, 58, .45); outline-offset: 2px; }

.g-visibilite { display: flex; flex-direction: column; gap: 8px; }
@media (min-width: 576px) { .g-visibilite { flex-direction: row; } }
.g-visibilite__choix { flex: 1; position: relative; }
.g-visibilite__choix input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.g-visibilite__choix span {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: center;
  padding: 12px 14px; border: 1.5px solid var(--g-border); border-radius: 10px; background: var(--g-surface); cursor: pointer;
  color: var(--g-ink-2);
}
.g-visibilite__choix span svg { grid-row: span 2; }
.g-visibilite__choix b { color: var(--g-ink); font-size: 15px; }
.g-visibilite__choix small { font-size: 12.5px; color: var(--g-muted); }
.g-visibilite__choix input:checked + span { border-color: var(--g-forest); background: var(--g-forest-light); }
.g-visibilite__choix input:focus-visible + span { outline: 3px solid rgba(31, 77, 58, .45); outline-offset: 2px; }

.alert { border-radius: 10px; font-size: 14.5px; }

/* ================================================================== */
/* Pied de page                                                       */
/* ================================================================== */

.g-footer { background: var(--g-surface-2); border-top: 1px solid var(--g-border); padding: 32px 0 28px; margin-top: 24px; }
.g-footer h3 { font-family: var(--g-font-texte); font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--g-muted); margin-bottom: 10px; }
.g-footer a { color: var(--g-ink-2); font-size: 14px; }
.g-footer a:hover { color: var(--g-ink); }

/* ================================================================== */
/* Dropdown Bootstrap                                                 */
/* ================================================================== */

.dropdown-menu { border-radius: 10px; border-color: var(--g-border); box-shadow: var(--g-shadow-survol); font-size: 14px; }
.dropdown-item { padding: 8px 14px; }
.dropdown-item:active { background: var(--g-forest); }

/* ================================================================== */
/* Éditeur de tracé (/tracer/)                                        */
/* ================================================================== */

.g-page-editeur { padding-bottom: 0; overflow: hidden; }
.g-page-editeur .g-main { height: calc(100vh - 56px - env(safe-area-inset-top, 0px)); height: calc(100dvh - 56px - env(safe-area-inset-top, 0px)); }
@media (min-width: 992px) { .g-page-editeur .g-main { height: calc(100vh - 68px); height: calc(100dvh - 68px); } }

.g-editeur { position: relative; height: 100%; }
.g-editeur__carte { position: absolute; inset: 0; background: var(--g-carte-fond); }

.g-editeur__recherche {
  position: absolute; left: 12px; top: 12px; right: 64px; z-index: 600; max-width: 380px;
  display: flex; background: var(--g-surface); border: 1px solid var(--g-border); border-radius: var(--g-r-btn);
  box-shadow: var(--g-shadow-flottant);
}
.g-editeur__recherche input { flex: 1; min-width: 0; height: 42px; border: 0; background: transparent; padding: 0 12px; font-size: 14px; color: var(--g-ink); outline: none; }
.g-editeur__recherche button { width: 42px; border: 0; background: transparent; color: var(--g-ink); display: flex; align-items: center; justify-content: center; }
.g-editeur__resultats {
  position: absolute; left: -1px; right: -1px; top: 100%; margin: 4px 0 0; padding: 4px; list-style: none; z-index: 700;
  background: var(--g-surface); border: 1px solid var(--g-border); border-radius: var(--g-r-btn); box-shadow: var(--g-shadow-survol);
  max-height: 50vh; overflow-y: auto;
}
.g-editeur__resultats button { width: 100%; text-align: left; border: 0; background: transparent; padding: 10px 10px; font-size: 13.5px; color: var(--g-ink); border-radius: 6px; line-height: 1.3; }
.g-editeur__resultats button:hover { background: var(--g-forest-light); }
.g-editeur__resultats .is-vide { padding: 10px; color: var(--g-muted); font-size: 13.5px; }

.g-editeur__recherche #btn-localiser { border-left: 1px solid var(--g-rule); }

.g-editeur__aide {
  position: absolute; left: 50%; top: 66px; transform: translateX(-50%); z-index: 600; margin: 0;
  background: var(--g-ink); color: #fff; font-size: 13.5px; padding: 8px 12px; border-radius: var(--g-r-btn);
  max-width: calc(100% - 24px); text-align: center; box-shadow: var(--g-shadow-flottant); pointer-events: none;
}

.g-editeur__panneau {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 600;
  background: var(--g-surface); border-top: 1px solid var(--g-border);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: 0 -4px 16px rgba(20, 32, 26, .08);
}
@media (min-width: 992px) {
  .g-editeur__panneau { left: 16px; right: auto; bottom: 16px; width: 420px; border: 1px solid var(--g-border); border-radius: var(--g-r-card); padding: 14px; gap: 10px; box-shadow: var(--g-shadow-survol); }
}

.g-editeur__stats { display: flex; gap: 18px; align-items: center; }
.g-editeur__stats > span { display: flex; flex-direction: column; }
.g-editeur__stats b { font-family: var(--g-font-titre); font-weight: 700; font-size: 22px; line-height: 1; }
.g-editeur__stats small { font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--g-muted); }
.g-editeur__etat { margin-left: auto; font-size: 12.5px; color: var(--g-trail); font-weight: 600; }

.g-editeur__modes { display: flex; gap: 6px; align-items: center; }
.g-editeur__modes label { position: relative; flex: 1; }
.g-editeur__modes input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.g-editeur__modes span {
  display: flex; align-items: center; justify-content: center; gap: 6px; height: 38px;
  border-radius: var(--g-r-chip); border: 1.5px solid var(--g-border); background: var(--g-surface);
  font-weight: 600; font-size: 13.5px; color: var(--g-ink-2); cursor: pointer;
}
.g-editeur__modes input:checked + span { background: var(--g-forest); border-color: var(--g-forest); color: #fff; }
.g-editeur__modes input:focus-visible + span { outline: 3px solid rgba(31, 77, 58, .45); }
.g-editeur__profil { width: auto; min-height: 38px; height: 38px; font-size: 13.5px; font-weight: 600; border-width: 1.5px; }

.g-editeur__actions { display: flex; flex-wrap: wrap; gap: 6px; }
.g-editeur__actions .g-btn { flex: 1 1 auto; padding: 0 10px; }
.g-editeur__actions #btn-enregistrer { flex: 2 1 100%; }
@media (min-width: 400px) { .g-editeur__actions #btn-enregistrer { flex: 1 1 auto; } }

/* Points du tracé */
.g-pt { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2.5px solid var(--g-ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .35); cursor: grab; }
.g-pt--depart { background: var(--g-forest); border-color: #fff; }
.g-pt--arrivee { background: var(--g-trail); border-color: #fff; }
.g-pt.is-selection { box-shadow: 0 0 0 4px rgba(228, 87, 46, .45), 0 1px 3px rgba(0, 0, 0, .35); }
.g-pt--milieu { width: 12px; height: 12px; background: #fff; border: 2px solid var(--g-trail); opacity: .75; }
.g-pt--milieu:hover { opacity: 1; transform: scale(1.25); }
.is-termine .g-pt--milieu { display: none; }

.g-editeur .leaflet-top.leaflet-right { top: 62px; }
@media (min-width: 992px) { .g-editeur .leaflet-top.leaflet-right { top: 12px; } }
.g-editeur .leaflet-control-layers { border-radius: var(--g-r-btn); border: 1px solid var(--g-border); box-shadow: var(--g-shadow-flottant); }
.g-editeur .leaflet-bar { border-radius: var(--g-r-btn); border: 1px solid var(--g-border); box-shadow: var(--g-shadow-flottant); }
.g-editeur .leaflet-bar a { width: 38px; height: 38px; line-height: 38px; }
.g-editeur .leaflet-bottom.leaflet-right { bottom: 168px; }
@media (min-width: 992px) { .g-editeur .leaflet-bottom.leaflet-right { bottom: 0; } }

.modal-content { border-radius: var(--g-r-card); border-color: var(--g-border); }
.modal-header, .modal-footer { border-color: var(--g-rule); }

/* ================================================================== */
/* Éditeur de texte riche (description)                               */
/* ================================================================== */

.g-texte__outils { display: none; }
.g-texte.is-actif .g-texte__outils {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
  padding: 6px; background: var(--g-surface-2); border: 1.5px solid var(--g-border); border-bottom: 0;
  border-radius: var(--g-r-btn) var(--g-r-btn) 0 0;
}
.g-texte__outils button {
  display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0 10px;
  border: 1px solid transparent; border-radius: 6px; background: var(--g-surface); color: var(--g-ink);
  font-family: var(--g-font-titre); font-weight: 700; font-size: 14px;
}
.g-texte__outils button:hover { border-color: var(--g-border); }
.g-texte__aide { margin-left: auto; font-size: 12px; color: var(--g-muted); }
.g-texte__zone { display: none; }
.g-texte.is-actif .g-texte__zone {
  display: block; min-height: 180px; height: auto; border-radius: 0 0 var(--g-r-btn) var(--g-r-btn);
  padding: 12px 14px; font-size: 15px; line-height: 1.5; overflow-y: auto; max-height: 60vh;
}
.g-texte.is-invalid .g-texte__zone, .g-texte.is-invalid .g-texte__outils { border-color: var(--g-danger); }
.g-texte__zone:empty::before { content: attr(data-placeholder); color: var(--g-muted); }
.g-texte__zone p { margin: 0 0 10px; }
.g-texte__zone h2, .g-prose h2 { font-size: 22px; margin: 14px 0 6px; }
.g-texte__zone h3, .g-prose h3 { font-size: 18px; margin: 12px 0 4px; }
.g-texte__zone ul, .g-prose ul { margin: 0 0 10px; padding-left: 22px; }
.g-texte__zone table, .g-prose table { width: 100%; border-collapse: collapse; margin: 0 0 12px; font-size: 14px; }
.g-texte__zone th, .g-texte__zone td, .g-prose th, .g-prose td { border: 1px solid var(--g-border); padding: 6px 8px; text-align: left; vertical-align: top; min-width: 40px; }
.g-texte__zone th, .g-prose th { background: var(--g-surface-2); font-weight: 700; }
.g-prose table { display: block; overflow-x: auto; }

/* ================================================================== */
/* Carte d'exploration (/carte/)                                      */
/* ================================================================== */

.g-explo__filtres { position: absolute; left: 12px; right: 64px; top: 62px; z-index: 600; }
.g-explo__filtres .g-chips { margin: 0; padding: 0; }
.g-explo__filtres .g-chip { box-shadow: var(--g-shadow-flottant); height: 34px; font-size: 13px; }
@media (min-width: 992px) { .g-explo__filtres { right: 64px; top: 62px; left: 392px; } }
.g-explo .g-editeur__aide { top: 108px; }
.g-explo .leaflet-top.leaflet-right { top: 12px; }

.g-explo__panneau {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 600;
  background: var(--g-surface); border-top: 1px solid var(--g-border); border-radius: 14px 14px 0 0;
  box-shadow: 0 -4px 16px rgba(20, 32, 26, .10);
  display: flex; flex-direction: column; max-height: 42px; transition: max-height .25s ease;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.g-explo__panneau.is-ouvert { max-height: 60vh; max-height: 60dvh; }
.g-explo__poignee {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 12px 8px;
  border: 0; background: transparent; font-weight: 600; font-size: 13.5px; color: var(--g-ink-2); width: 100%;
}
.g-explo__barre { width: 40px; height: 4px; border-radius: 2px; background: var(--g-border); }
.g-explo__liste { overflow-y: auto; display: flex; flex-direction: column; border-top: 1px solid var(--g-rule); }
.g-explo__item { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border-bottom: 1px solid var(--g-rule); color: var(--g-ink); }
.g-explo__item:hover, .g-explo__item.is-actif { background: var(--g-trail-light); color: var(--g-ink); }
.g-explo__titre { font-family: var(--g-font-titre); font-weight: 700; font-size: 17px; line-height: 1.05; }
.g-explo__detail { font-size: 12.5px; color: var(--g-muted); }
.g-explo .leaflet-bottom.leaflet-right { bottom: 48px; }

@media (min-width: 992px) {
  .g-explo__carte, .g-explo .g-editeur__carte { left: 380px; }
  .g-explo .g-editeur__recherche { left: 392px; max-width: 360px; }
  .g-explo__panneau {
    left: 0; right: auto; top: 0; bottom: 0; width: 380px; max-height: none; border-radius: 0; border-top: 0; border-right: 1px solid var(--g-border);
    box-shadow: none; transition: none;
  }
  .g-explo__poignee { align-items: flex-start; padding: 14px 16px; font-family: var(--g-font-titre); font-size: 20px; font-weight: 700; color: var(--g-ink); cursor: default; }
  .g-explo__barre { display: none; }
  .g-explo .leaflet-bottom.leaflet-right { bottom: 0; }
}

/* ================================================================== */
/* Documentation de l'API (/api/)                                     */
/* ================================================================== */

.g-api { max-width: 820px; }
.g-api code { font-size: .92em; background: var(--g-surface-2); padding: 1px 5px; border-radius: 4px; color: var(--g-ink); }
.g-api__liste { display: flex; flex-direction: column; gap: 8px; padding: 0; margin: 0; list-style: none; }
.g-api__liste li { color: var(--g-ink-2); font-size: 15px; padding-left: 16px; position: relative; }
.g-api__liste li::before { content: ""; position: absolute; left: 0; top: 9px; width: 6px; height: 6px; border-radius: 50%; background: var(--g-trail); }
.g-api__section { font-size: 20px; margin: 28px 0 10px; padding-bottom: 6px; border-bottom: 1.5px solid var(--g-border); }
.g-api__adresse { background: var(--g-surface); border: 1px solid var(--g-border); border-radius: var(--g-r-card); padding: 14px 16px; margin-bottom: 10px; }
.g-api__ligne { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; flex-wrap: wrap; }
.g-api__ligne code { background: transparent; padding: 0; font-family: var(--g-font-titre); font-weight: 700; font-size: 19px; letter-spacing: .01em; }
.g-api__resume { margin: 0; color: var(--g-ink-2); font-size: 14.5px; }
.g-api__params { width: 100%; border-collapse: collapse; margin: 10px 0 0; font-size: 13.5px; }
.g-api__params th { text-align: left; font-weight: 400; vertical-align: top; padding: 4px 12px 4px 0; white-space: nowrap; width: 1%; }
.g-api__params td { color: var(--g-ink-2); padding: 4px 0; }
.g-api__exemple { background: var(--g-ink); color: #EDEDE5; border-radius: 10px; padding: 12px 14px; margin: 10px 0 0; overflow-x: auto; font-size: 12.5px; line-height: 1.5; }
.g-api__exemple code { background: transparent; color: inherit; padding: 0; }

/* Appareils connectés (profil) */
.g-appareils { display: flex; flex-direction: column; gap: 8px; }
.g-appareil { display: flex; align-items: center; gap: 12px; border: 1px solid var(--g-border); border-radius: 10px; padding: 10px 12px; }
