:root {
    --topbar-hauteur: 5rem;
    --paper: #EEEBDD;
    --paper-deep: #E4E0CE;
    --ink: #22301E;
    --ink-soft: #5B6350;
    --water: #2C6E7E;
    --water-deep: #1E4C58;
    --soil: #A8622A;
    --good: #4C7A3D;
    --warn: #B8862F;
    --bad: #AA3B2E;
    --line: #C9C4AE;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: 'Segoe UI', Arial, sans-serif;
}

a { color: var(--water-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Barre de navigation */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.75rem 1.5rem;
    background: var(--paper-deep);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 2px 8px rgba(34, 48, 30, 0.1);
}
.topbar-ligne1 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.topbar-brand { font-weight: 600; font-size: 1.1rem; }
.topbar-user { display: flex; align-items: center; gap: 1rem; font-size: 0.9rem; color: var(--ink-soft); }
.topbar-user .btn-lien { margin-left: 1rem; }
.bouton-menu-mobile {
    display: none;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--water-deep);
    border-radius: 4px;
    background: var(--paper);
    color: var(--water-deep);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.bouton-menu-mobile:focus-visible,
.topbar-nav a:focus-visible,
.topbar-nav button:focus-visible { outline: 3px solid var(--water); outline-offset: 2px; }

.topbar-nav { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.topbar-nav[hidden] { display: flex; }
.topbar-nav .mobile-nav-utilitaire { display: none; }
.topbar-nav .bouton-installer { margin-left: 0; }
.topbar-nav a {
    display: inline-block;
    padding: 0.4rem 0.85rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    background: var(--tab-bg);
    color: var(--tab-fg);
    text-decoration: none;
}
.topbar-nav a:hover { filter: brightness(0.94); text-decoration: none; }
.topbar-nav a.actif { background: var(--tab-fg); color: #fff; }

@media (max-width: 760px) {
    .topbar { padding: 0.65rem 0.8rem; gap: 0.55rem; }
    .topbar-ligne1 { flex-wrap: nowrap; gap: 0.75rem; }
    .topbar-brand { flex: 1 1 auto; min-width: 0; font-size: 1rem; }
    .topbar-user { display: none; }
    .bouton-menu-mobile { display: inline-flex; flex: 0 0 auto; }
    .topbar-nav { flex-direction: column; align-items: stretch; gap: 0.35rem; padding-top: 0.55rem; border-top: 1px solid var(--line); }
    .topbar-nav[hidden] { display: none; }
    .topbar-nav:not([hidden]) { display: flex; }
    .topbar-nav:not([hidden]) { max-height: calc(var(--hauteur-visible, 100vh) - 70px); overflow-y: auto; overscroll-behavior: contain; }
    .topbar-nav a { display: block; width: 100%; padding: 0.7rem 0.85rem; font-size: 0.95rem; }
    .topbar-nav .mobile-nav-utilitaire { display: block; }
    .topbar-nav .bouton-installer { width: 100%; box-sizing: border-box; margin: 0; padding: 0.7rem 0.85rem; text-align: left; }
}

/* Palette de 8 teintes qui tourne sur les onglets, pour les distinguer visuellement
   sans recourir à une couleur par module (trop lourd à maintenir). */
.topbar-nav a:nth-child(8n+1) { --tab-bg: #DCEBEE; --tab-fg: #1E4C58; }
.topbar-nav a:nth-child(8n+2) { --tab-bg: #F3E2D3; --tab-fg: #8B4A1E; }
.topbar-nav a:nth-child(8n+3) { --tab-bg: #E3EDDD; --tab-fg: #3B5C2E; }
.topbar-nav a:nth-child(8n+4) { --tab-bg: #F5E9D2; --tab-fg: #8A6210; }
.topbar-nav a:nth-child(8n+5) { --tab-bg: #EFE1EA; --tab-fg: #6B3658; }
.topbar-nav a:nth-child(8n+6) { --tab-bg: #E3E6E9; --tab-fg: #3E4C57; }
.topbar-nav a:nth-child(8n+7) { --tab-bg: #F7E6DE; --tab-fg: #9C4A2E; }
.topbar-nav a:nth-child(8n+0) { --tab-bg: #E7EDE4; --tab-fg: #4A5D3E; }

.conteneur { max-width: 1000px; margin: 0 auto; padding: 2rem 1.5rem; }
body.application-defilement-interne { height: 100vh; overflow: hidden; }
body.application-defilement-interne .conteneur {
    position: fixed;
    top: var(--topbar-hauteur, 5rem);
    right: 0;
    bottom: 0;
    left: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
}
@supports (height: 100dvh) {
    body.application-defilement-interne { height: 100dvh; }
}

.entete-page { margin-bottom: 1.5rem; }
.entete-page h1 { margin: 0 0 0.25rem; font-size: 1.6rem; }
.entete-section { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.sous-titre { color: var(--ink-soft); margin: 0; }

/* Stat cards */
.grille-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1px;
    background: var(--line);
    margin-bottom: 2rem;
}
.carte-stat {
    background: var(--paper);
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    border-left: 3px solid var(--water);
}
.carte-stat.alerte { border-left-color: var(--bad); }
.carte-stat .valeur { font-size: 1.8rem; font-weight: 600; }
.carte-stat .libelle { font-size: 0.85rem; color: var(--ink-soft); margin-top: 0.2rem; }

.section { margin-bottom: 2.5rem; }
.section h2 { font-size: 1.2rem; border-bottom: 1px solid var(--line); padding-bottom: 0.5rem; }
.section h3 { font-size: 1rem; color: var(--water-deep); margin-top: 1.5rem; }

/* Tableaux */
.tableau { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.tableau th, .tableau td { text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid var(--line); }
.tableau th { color: var(--ink-soft); font-weight: 500; }

/* Barres de progression */
.barre-repartition { display: flex; height: 10px; width: 100%; background: var(--line); overflow: hidden; margin-bottom: 0.75rem; }
.legende { display: flex; gap: 1.25rem; list-style: none; padding: 0; font-size: 0.85rem; color: var(--ink-soft); flex-wrap: wrap; }
.legende .puce { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }

.mini-barre { display: inline-block; width: 80px; height: 6px; background: var(--line); vertical-align: middle; margin-right: 6px; }
.mini-barre div { height: 100%; background: var(--water); }

/* Formulaires */
.formulaire { display: flex; flex-direction: column; gap: 1rem; max-width: 480px; }
.formulaire label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.9rem; color: var(--ink-soft); }
.formulaire input, .formulaire select, .formulaire textarea {
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--ink);
    font-size: 0.95rem;
    border-radius: 2px;
}
.ligne-champs { display: flex; gap: 1rem; }
.ligne-champs label { flex: 1; }
.actions-formulaire { display: flex; gap: 1rem; align-items: center; margin-top: 0.5rem; }
@media (max-width: 640px) {
    .formulaire-activite .ligne-champs { flex-direction: column; }
    .activite-filtres { flex-wrap: wrap; }
}

.barre-recherche { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; max-width: 480px; }
.barre-recherche input { flex: 1; padding: 0.5rem 0.65rem; border: 1px solid var(--line); background: var(--paper); }

.champ-filtre {
    display: block;
    width: 100%;
    max-width: 320px;
    padding: 0.5rem 0.7rem;
    margin-bottom: 1.1rem;
    border: 1px solid var(--line);
    background: var(--paper);
    font-size: 0.92rem;
}
.filtre-annee-villages { display:flex;align-items:center;flex-wrap:wrap;gap:.55rem;margin:0 0 1rem; }
.filtre-annee-villages label { color:var(--ink-soft);font-size:.9rem; }
.filtre-annee-villages select { min-width:170px;padding:.5rem .65rem;border:1px solid var(--line);background:var(--paper);color:var(--ink);font-size:.92rem;border-radius:2px; }
.filtre-aucun-resultat { margin-top: 1rem; }

/* Boutons */
.btn {
    background: var(--soil);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 2px;
}
.btn:hover { background: var(--water-deep); }
.btn-lien { color: var(--ink-soft); font-size: 0.9rem; }

.message-erreur { color: var(--bad); background: #F6E3E0; border: 1px solid var(--bad); padding: 0.6rem 0.9rem; font-size: 0.9rem; }

.texte-attenue { color: var(--ink-soft); }

.etiquette-etat {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    font-size: 0.8rem;
    border-radius: 2px;
    border: 1px solid var(--line);
}
.etiquette-etat.bon { color: var(--good); border-color: var(--good); }
.etiquette-etat.mauvais { color: var(--bad); border-color: var(--bad); }
.etiquette-etat.attention { color: var(--warn); border-color: var(--warn); }
.etiquette-etat.neutre { color: var(--ink-soft); border-color: var(--line); }

.liste-definition { display: grid; grid-template-columns: 200px 1fr; gap: 0.5rem 1rem; }
.liste-definition dt { color: var(--ink-soft); }
.liste-definition dd { margin: 0; }

/* Page de connexion */
.page-login { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.carte-login {
    background: var(--paper-deep);
    border: 1px solid var(--line);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 320px;
}
.carte-login h1 { margin: 0; font-size: 1.3rem; }
.carte-login label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.9rem; color: var(--ink-soft); }
.carte-login input { padding: 0.55rem 0.7rem; border: 1px solid var(--line); background: var(--paper); font-size: 0.95rem; }
.champ-mdp { display: flex; align-items: stretch; }
.champ-mdp input { flex: 1; border-right: none; }
.btn-oeil {
    border: 1px solid var(--line);
    border-left: none;
    background: var(--paper-deep);
    color: var(--ink-soft);
    padding: 0 0.7rem;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}
.btn-oeil.actif { color: var(--water-deep); }
.carte-login button {
    background: var(--water);
    color: white;
    border: none;
    padding: 0.6rem;
    font-size: 0.95rem;
    cursor: pointer;
    margin-top: 0.5rem;
}

/* Cases à cocher en liste (missions) */
.liste-cases { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.35rem 1rem; margin-top: 0.4rem; }
.formulaire .liste-cases label { flex-direction: row; align-items: center; gap: 0.5rem; color: var(--ink); }
.formulaire .liste-cases input { width: auto; }

/* Cartographie */
.barre-carte { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: center; margin-bottom: 0.75rem; font-size: 0.9rem; }
.barre-carte label { display: flex; align-items: center; gap: 0.4rem; color: var(--ink-soft); }
.carte-conteneur { height: 68vh; min-height: 380px; border: 1px solid var(--line); }
.legende-carte { display: flex; flex-wrap: wrap; gap: 1.25rem; margin-top: 0.6rem; font-size: 0.85rem; color: var(--ink-soft); }
.legende-carte i { display: inline-block; width: 0.8rem; height: 0.8rem; margin-right: 0.35rem; vertical-align: middle; }

/* Impression des rapports */
@media print {
    .topbar, .no-print { display: none !important; }
    body { background: #fff; height: auto !important; overflow: visible !important; }
    .conteneur { position: static !important; max-width: none; margin: 0; padding: 0; overflow: visible !important; }
    .tableau { font-size: 0.8rem; }
    .section { break-inside: avoid-page; }
}

/* Photos et pièces jointes */
.galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1rem; }
.carte-fichier { margin: 0; border: 1px solid var(--line); background: #fff; }
.carte-fichier img { display: block; width: 100%; height: 150px; object-fit: cover; }
.carte-fichier .icone-fichier { height: 150px; display: flex; align-items: center; justify-content: center; background: var(--paper, #F4F0E4); color: var(--ink-soft); font-weight: 600; font-size: 1.4rem; letter-spacing: 0.05em; }
.carte-fichier figcaption { padding: 0.5rem 0.6rem; font-size: 0.82rem; word-break: break-word; }
.apercu-fichiers { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.apercu-fichiers img { width: 110px; height: 80px; object-fit: cover; border: 1px solid var(--line); display: block; }

/* Galerie des pièces jointes (bloc affiché sur les fiches) */
.galerie figure { margin: 0; border: 1px solid var(--line); background: #fff; }
.galerie figure img { display: block; width: 100%; height: 150px; object-fit: cover; }
.galerie figcaption { padding: 0.5rem 0.6rem; font-size: 0.8rem; color: var(--ink-soft); word-break: break-word; }

/* Enquête de référence */
.formulaire fieldset { border: 1px solid var(--line); border-radius: 6px; margin-bottom: 1.25rem; padding: 1rem 1.25rem; }
.formulaire legend { font-weight: 600; padding: 0 0.5rem; color: var(--ink-soft); }
.tableau-comparaison th, .tableau-comparaison td { text-align: center; }
.tableau-comparaison td:first-child, .tableau-comparaison th:first-child { text-align: left; }
.tableau .ligne-groupe td { background: var(--paper, #F4F0E4); font-weight: 600; text-align: left; }
.tableau-comparaison .ligne-groupe td { background: var(--paper, #F4F0E4); font-weight: 600; text-align: left; }
.bloc-fiche { border: 1px solid var(--line); border-radius: 6px; padding: 0.9rem 1.1rem; margin-bottom: 0.75rem; background: #fff; }
.btn-danger { color: #b3261e; }

/* Checklist mobile de terrain */
.formulaire-checklist fieldset { border: 1px solid var(--line); border-radius: 6px; margin-bottom: 1.25rem; padding: 1rem 1.1rem; }
.formulaire-checklist legend { font-weight: 600; padding: 0 0.5rem; color: var(--ink-soft); }
.point-controle { padding: 0.85rem 0; border-bottom: 1px solid var(--line); }
.point-controle:last-child { border-bottom: none; }
.point-controle-libelle { margin: 0 0 0.5rem; font-weight: 500; }
.point-controle-choix { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.5rem; }
.choix-pill { display: inline-flex; align-items: center; gap: 0.35rem; border: 1px solid var(--line); border-radius: 999px; padding: 0.55rem 0.9rem; font-size: 0.85rem; cursor: pointer; user-select: none; }
.choix-pill input { margin: 0; }
.choix-pill:has(input:checked).choix-ok { background: #E6F4E6; border-color: #1a7a1a; color: #1a7a1a; }
.choix-pill:has(input:checked).choix-alerte { background: #FBEAEA; border-color: #b3261e; color: #b3261e; }
.choix-pill:has(input:checked).choix-neutre { background: #EFEFEF; border-color: #666; color: #444; }
.point-controle input[type="text"] { width: 100%; box-sizing: border-box; margin-bottom: 0.4rem; }
.lien-photo { font-size: 0.85rem; text-decoration: none; }

@media (max-width: 640px) {
    .choix-pill { flex: 1 1 auto; justify-content: center; padding: 0.7rem 0.5rem; }
    .formulaire-checklist .actions-formulaire { flex-direction: column; }
    .formulaire-checklist .actions-formulaire .btn, .formulaire-checklist .actions-formulaire .btn-lien { width: 100%; text-align: center; box-sizing: border-box; }
}

/* ============================================================
   Tableau de bord — mise en page distincte (chiffre héros,
   alertes contextuelles, statistiques secondaires discrètes)
   ============================================================ */
.tableau-bord { font-family: 'Space Grotesk', 'Segoe UI', Arial, sans-serif; }
.tableau-bord h1, .tableau-bord h2 { font-family: 'Source Serif 4', Georgia, serif; }

.tb-entete { margin-bottom: 2rem; }
.tableau-bord h1 { margin: 0; font-size: 2rem; font-weight: 600; color: var(--ink); }
.tb-sous-titre { margin: 0.3rem 0 0; color: var(--ink-soft); font-size: 0.95rem; }
.tb-lien-modifier { font-size: 1rem; text-decoration: none; margin-left: 0.4rem; opacity: 0.55; }
.tb-lien-modifier:hover { opacity: 1; }

/* Hero : l'avancement global, traité comme le point focal de la page */
.tb-hero {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
    padding: 1rem 0 1.25rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: 1.25rem;
}
.tb-hero-chiffre { display: flex; flex-direction: column; flex: 0 0 auto; }
.tb-hero-detail { flex: 1 1 260px; display: flex; flex-direction: column; gap: 0.4rem; }
.tb-hero-valeur {
    font-size: 2.75rem;
    font-weight: 700;
    line-height: 1;
    color: var(--water-deep);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}
.tb-hero-pct { font-size: 1.3rem; font-weight: 500; margin-left: 0.1rem; }
.tb-hero-libelle { margin-top: 0.25rem; font-size: 0.78rem; color: var(--ink-soft); max-width: 16ch; line-height: 1.25; }
.tb-hero-barre { height: 6px; width: 100%; background: var(--line); position: relative; overflow: hidden; }
.tb-hero-barre div { height: 100%; background: var(--water); }
.tb-hero-detail p { margin: 0; color: var(--ink-soft); font-size: 0.85rem; }
.tb-hero-detail p strong { color: var(--ink); font-weight: 600; }

/* Alertes : une ligne compacte, n'apparaît que si elle contient quelque chose */
.tb-alertes { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 1.75rem; }
.tb-alerte {
    display: inline-flex;
    align-items: baseline;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    border: 1px solid var(--warn);
    color: var(--warn);
    font-size: 0.88rem;
    border-radius: 2px;
    text-decoration: none;
}
.tb-alerte:hover { background: var(--warn); color: white; text-decoration: none; }
.tb-alerte strong { font-size: 1rem; }

/* Statistiques secondaires : discrètes, en ligne, séparées par des filets */
.tb-stats-secondaires {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 2.5rem;
}
.tb-stat {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0 1.5rem;
    border-left: 1px solid var(--line);
    flex: 1 1 160px;
}
.tb-stat:first-child { border-left: none; padding-left: 0; }
.tb-stat-valeur { font-size: 1.6rem; font-weight: 600; color: var(--ink); }
.tb-stat-sur { font-size: 1rem; font-weight: 400; color: var(--ink-soft); }
.tb-stat-libelle { font-size: 0.82rem; color: var(--ink-soft); line-height: 1.3; }

.tb-section { margin-bottom: 2.75rem; }
.tableau-bord h2 { font-size: 1.25rem; font-weight: 500; color: var(--ink); margin: 0 0 1rem; }
.tb-section-entete { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.tb-section-entete h2 { margin: 0; }

/* Répartition des tâches */
.tb-repartition-barre { display: flex; height: 14px; width: 100%; background: var(--line); overflow: hidden; margin-bottom: 0.85rem; }
.tb-repartition-legende { display: flex; gap: 1.5rem; list-style: none; padding: 0; margin: 0; font-size: 0.88rem; color: var(--ink-soft); flex-wrap: wrap; }
.tb-repartition-legende strong { color: var(--ink); }
.tb-puce { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 0.4rem; }

/* Tableau des villages */
.tb-tableau { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.tb-tableau th { text-align: left; padding: 0.6rem 0.7rem; font-weight: 500; font-size: 0.82rem; color: var(--ink-soft); border-bottom: 1px solid var(--ink); }
.tb-tableau td { padding: 0.65rem 0.7rem; border-bottom: 1px solid var(--line); }
.tb-tableau tbody tr:hover { background: var(--paper-deep); }
.tb-village-nom { font-weight: 500; }
.tb-col-avancement { display: flex; align-items: center; gap: 0.6rem; white-space: nowrap; }
.tb-mini-barre { display: inline-block; width: 90px; height: 5px; background: var(--line); }
.tb-mini-barre div { height: 100%; background: var(--water); }

@media (max-width: 680px) {
    .tb-hero { gap: 1rem; }
    .tb-stat { flex: 1 1 45%; border-left: none; padding-left: 0; margin-bottom: 1rem; }
}

/* Bouton "Installer l'application" (affiché seulement quand l'installation est possible) */
.bouton-installer {
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    padding: 0.35rem 0.8rem;
    margin-left: 1rem;
    border: 1px solid var(--water-deep);
    border-radius: 3px;
    background: transparent;
    color: var(--water-deep);
    cursor: pointer;
}
.bouton-installer:hover { background: var(--water-deep); color: #fff; }
.carte-login .bouton-installer-login {
    width: 100%;
    margin: 0.75rem 0 0;
    padding: 0.55rem 0.8rem;
    font-size: 0.88rem;
    background: transparent;
    color: var(--water-deep);
    border: 1px solid var(--water-deep);
}
.carte-login .bouton-installer-login:hover { background: var(--water-deep); color: #fff; }

/* Boutons de suppression (formulaires POST) : même aspect qu'un lien */
.form-inline { display: inline; margin: 0; }
.lien-bouton {
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--ink-soft);
}
.lien-bouton:hover { text-decoration: underline; }
.lien-bouton.btn-danger { color: #b3261e; }

/* Mon compte */
.topbar-user .lien-compte { color: inherit; text-decoration: none; }
.topbar-user .lien-compte:hover { text-decoration: underline; }
.message-succes { color: var(--good); background: #E6F0E0; border: 1px solid var(--good); padding: 0.6rem 0.9rem; font-size: 0.9rem; max-width: 520px; }

/* Exécution du budget */
.tableau th.nombre, .tableau td.nombre { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tableau tr.ligne-total td { font-weight: 600; background: var(--paper-deep); }
.tableau tr.ligne-choisie td { background: #EAF1F2; }
.tableau td.negatif { color: var(--bad); }
.tableau td.cellule-exec { white-space: nowrap; }
.barre-exec { display: inline-block; width: 90px; height: 6px; background: var(--line); vertical-align: middle; margin-right: 0.45rem; }
.barre-exec span { display: block; height: 100%; background: var(--water); }
.barre-exec.depasse span { background: var(--bad); }
.exec-pct.depasse { color: var(--bad); font-weight: 600; }
.titre-section { font-size: 1.15rem; margin: 1.75rem 0 0.75rem; }
.aide-lecture { margin: 0 0 1rem; padding: 0.6rem 0.9rem; border: 1px solid var(--line); background: var(--paper-deep); font-size: 0.88rem; max-width: 900px; }
.aide-lecture summary { cursor: pointer; font-weight: 500; }
.aide-lecture ul { margin: 0.6rem 0 0.2rem; padding-left: 1.2rem; color: var(--ink-soft); line-height: 1.5; }
.defilement-x { overflow-x: auto; }
.reboisement-filtre { max-width:360px;margin:0 0 1rem; }
.reboisement-filtre label { display:flex;flex-direction:column;gap:.3rem;color:var(--ink-soft);font-size:.9rem; }
.reboisement-formulaire,.formulaire-edition-comite { max-width:900px; }
.reboisement-info { max-width:900px;margin:0 0 1rem;padding:.8rem 1rem;border:1px solid #b7d7e3;border-radius:8px;background:#e8f5fa;color:var(--ink-soft);font-size:.9rem;line-height:1.5; }
.reboisement-stats .carte-stat { border:1px solid #d9dfd2;border-radius:10px;background:#edf2e9; }
.reboisement-stats .carte-stat:nth-child(2) { background:#eaf4f6;border-color:#d5e7eb; }
.reboisement-stats .carte-stat:nth-child(3) { background:#faf0df;border-color:#eee0c6; }
.reboisement-stats .carte-stat:nth-child(4) { background:#f3edf3;border-color:#e7dce7; }
.reboisement-identite { padding:1rem 1.2rem;border:1px solid #dfe7d7;border-radius:10px;background:#f1f4eb; }
.reboisement-plantation { margin:1rem 0;padding:1rem 1.1rem;border:1px solid #d6e3e9;border-radius:10px;background:#eaf2f5; }
.reboisement-plantation h3 { margin:.2rem 0 .35rem;color:var(--ink); }
.reboisement-plantation .entete-section { align-items:flex-start; }
.reboisement-observations td { background:#f6f4eb;color:var(--ink-soft);font-size:.88rem; }
@media(max-width:640px){.reboisement-plantation{padding:.8rem}.reboisement-plantation .entete-section{flex-direction:column}.reboisement-formulaire .ligne-champs{flex-direction:column}.reboisement-stats{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* Navigation latérale et tableau de bord — direction de la maquette validée */
:root { --menu-largeur: 248px; --topbar-hauteur: 0px; }
body.application-defilement-interne { background:#f4f2e8; }
body.application-defilement-interne .topbar { position:fixed; inset:0 auto 0 0; width:var(--menu-largeur); height:100vh; padding:22px 14px 14px; gap:18px; background:#e9e6d7; border:0; border-right:1px solid #dedac9; box-shadow:none; overflow-y:auto; }
@supports(height:100dvh){body.application-defilement-interne .topbar{height:100dvh}}
body.application-defilement-interne .topbar-ligne1 { align-items:flex-start; flex-direction:column; gap:20px; }
body.application-defilement-interne .topbar-brand { font-size:17px; letter-spacing:-.3px; }
body.application-defilement-interne .topbar-user { display:flex; gap:9px; align-items:center; font-size:12px; }
body.application-defilement-interne .avatar-menu { width:32px;height:32px;border-radius:50%;background:#dce9df;color:#355a43;display:grid;place-items:center;font-weight:700; }
body.application-defilement-interne .topbar-user .lien-compte { color:var(--ink);line-height:1.35 }
body.application-defilement-interne .topbar-user small { display:block;color:var(--ink-soft);font-size:10px }
body.application-defilement-interne .topbar-identite { min-width:0; }
body.application-defilement-interne .deconnexion-menu { display:block;margin-top:4px;font-size:10px;color:#7a655a; }
body.application-defilement-interne .topbar-nav { display:flex; flex-direction:column; gap:17px; }
body.application-defilement-interne .topbar-nav[hidden] { display:flex; }
body.application-defilement-interne .nav-groupe { display:grid; gap:3px; }
body.application-defilement-interne .nav-legende { padding:0 10px 4px;color:#788075;font-size:9px;letter-spacing:1.15px;font-weight:750; }
body.application-defilement-interne .topbar-nav a { display:flex; align-items:center; gap:10px; width:100%; padding:9px 10px;border-radius:9px;background:transparent;color:#536056;font-size:12px;font-weight:550; }
body.application-defilement-interne .topbar-nav a:hover { background:#f4f2e8;filter:none; }
body.application-defilement-interne .topbar-nav a.actif { background:#fffefa;color:var(--water-deep);box-shadow:0 2px 9px #263d3010;font-weight:700; }
body.application-defilement-interne .topbar-nav a:nth-child(n) { --tab-bg:transparent;--tab-fg:var(--water-deep); }
body.application-defilement-interne .topbar-nav .mobile-nav-utilitaire { display:none; }
body.application-defilement-interne .topbar-nav .bouton-installer { margin:0;width:100%;text-align:left; }
/* Les rubriques principales s'ouvrent au survol ou au clavier, une seule à la fois. */
body.application-defilement-interne .topbar-nav .nav-groupe { display:block; margin:0; }
body.application-defilement-interne .nav-groupe-bouton { width:100%;display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:38px;padding:9px 11px;border:1px solid #d0d9ca;border-left:4px solid #66836a;border-radius:9px;background:#e5ebdf;color:#344a38;text-align:left;cursor:pointer;font:inherit;transition:background .15s ease,border-color .15s ease,box-shadow .15s ease; }
body.application-defilement-interne .nav-groupe-bouton:hover { background:#dce7d8; }
body.application-defilement-interne .nav-groupe.est-actif > .nav-groupe-bouton,
body.application-defilement-interne .nav-groupe.est-actif > .nav-groupe-bouton,
body.application-defilement-interne .nav-groupe[open] > .nav-groupe-bouton { background:#d8e4d5;border-color:#bdcdbb;border-left-color:#216979;box-shadow:0 2px 7px #263d3010; }
body.application-defilement-interne .nav-groupe-bouton:focus-visible { outline:3px solid var(--water);outline-offset:2px; }
body.application-defilement-interne .nav-groupe-bouton { list-style:none; }
body.application-defilement-interne .nav-groupe-bouton::-webkit-details-marker { display:none; }
body.application-defilement-interne .nav-groupe-bouton .nav-legende { padding:0;color:inherit;font-size:9px;letter-spacing:1.25px;font-weight:800; }
body.application-defilement-interne .nav-chevron { color:#536d58;font-size:14px;transition:transform .15s ease; }
body.application-defilement-interne .nav-groupe[open] .nav-chevron,
body.application-defilement-interne .nav-groupe:hover .nav-chevron { transform:rotate(180deg); }
body.application-defilement-interne .nav-sous-menu { display:none;gap:3px;margin:3px 0 2px 9px;padding:3px 0 5px 9px;border-left:2px solid #d1dacd; }
body.application-defilement-interne .nav-groupe[open] > .nav-sous-menu,
body.application-defilement-interne .nav-groupe:hover > .nav-sous-menu,
body.application-defilement-interne .nav-groupe:focus-within > .nav-sous-menu { display:grid; }
body.application-defilement-interne .nav-sous-menu a { padding:8px 10px 8px 13px;font-size:11px;line-height:1.35; }
body.application-defilement-interne .nav-sous-menu .bouton-installer { margin:3px 8px;width:calc(100% - 16px); }
body.application-defilement-interne .conteneur { max-width:none; margin:0; padding:32px clamp(20px,3vw,44px); }
body.application-defilement-interne .conteneur { position:fixed;top:0;right:0;bottom:0;left:var(--menu-largeur);overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior-y:contain; }
.tableau-bord { max-width:1260px;margin:0 auto;font-family:'Segoe UI',Arial,sans-serif; }
.tableau-bord h1,.tableau-bord h2 { font-family:'Segoe UI',Arial,sans-serif;letter-spacing:-.035em; }
.tb-entete { margin-bottom:20px; }
.tableau-bord h1 { font-size:27px; }
.tb-sous-titre { font-size:13px; }
.tb-hero { padding:20px 23px;margin-bottom:15px;border:1px solid #e3e1d5;border-radius:15px;background:#fffefa;box-shadow:0 3px 10px #28322608; }
.tb-hero-valeur { font-size:38px;color:#216979; }
.tb-hero-libelle { max-width:none;font-size:12px; }
.tb-hero-barre { height:8px;border-radius:20px;background:#eeeee7; }
.tb-hero-barre div { border-radius:20px;background:#4b7b67; }
.tb-hero-detail p { font-size:12px; }
.tb-alertes { margin-bottom:15px; }
.tb-alerte { border-radius:10px;background:#fff8e9;padding:9px 12px;font-size:12px; }
.tb-stats-secondaires { display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-bottom:16px; }
.tb-stat { border:1px solid #e3e1d5;border-radius:13px;background:#fffefa;padding:15px;gap:6px; }
.tb-stat:first-child { padding-left:15px; }
.tb-stat:nth-child(3n+1) .tb-stat-valeur { color:#216979; }
.tb-stat:nth-child(3n+2) .tb-stat-valeur { color:#476346; }
.tb-stat-valeur { font-size:23px; }
.tb-stat-libelle { font-size:11px; }
.tb-section { padding:18px;background:#fffefa;border:1px solid #e3e1d5;border-radius:14px;margin-bottom:14px; }
.tableau-bord h2 { font-size:15px;margin-bottom:12px; }
.tb-section-entete { margin-bottom:12px; }
.tb-repartition-barre { height:9px;border-radius:12px; }
.tb-repartition-legende { gap:12px;font-size:11px; }
.tb-tableau { font-size:12px; }
.tb-tableau th { border-bottom:1px solid #e3e1d5;font-size:10px; }
.tb-tableau td { padding:9px 8px;border-color:#efeee7; }
.tb-activites-recentes { display:grid;grid-template-columns:minmax(0,1.45fr) minmax(230px,.75fr);gap:14px; }
.tb-activites-recentes .tb-section { min-width:0; }
.tb-activites-recentes .tb-section-entete p { margin:4px 0 0;font-size:11px; }
.tb-liste-activites { display:grid; }
.tb-activite { display:flex;align-items:center;gap:11px;padding:12px 2px;border-bottom:1px solid #efeee7;color:var(--ink);text-decoration:none; }
.tb-activite:last-child { border-bottom:0; }
.tb-activite:hover { background:#faf9f3;text-decoration:none; }
.tb-activite-puce { width:9px;height:9px;flex:none;border-radius:50%;background:#619879; }
.tb-activite-puce.sensibilisation { background:#c69650; }
.tb-activite-texte { min-width:0;flex:1; }
.tb-activite-texte strong { display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px; }
.tb-activite small,.tb-activite-portee small { display:block;margin-top:4px;color:#778177;font-size:10px; }
.tb-activite-portee { flex:none;text-align:right;color:#58675c;font-size:10px; }
.tb-comprehension .texte-attenue { font-size:11px;line-height:1.5; }
.tb-comprehension-chiffre { margin:16px 0 9px;font-size:34px;font-weight:700;letter-spacing:-1px;color:#216979; }
.tb-nouveau .tb-entete { display:flex;align-items:flex-end;justify-content:space-between;gap:16px; }
.tb-nouveau .tb-actions { display:flex;align-items:center;gap:9px; }
.tb-nouveau .tb-actions .btn,.tb-villages .btn { border-radius:9px; }
.tb-hero-carte { display:flex;align-items:center;padding:19px 23px;gap:28px; }
.tb-hero-carte .tb-hero-chiffre { min-width:145px; }
.tb-hero-carte .tb-hero-detail { flex:1; }
.tb-hero-entete { display:flex;justify-content:space-between;align-items:center;gap:12px;font-size:12px; }
.tb-hero-entete span { color:var(--ink-soft);font-size:11px; }
.tb-kpis { display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin:14px 0; }
.tb-kpi { min-width:0;padding:15px 16px;border:1px solid #e3e1d5;border-radius:13px;background:#fffefa;box-shadow:0 3px 10px #28322605; }
.tb-kpi-infrastructure { display:block;color:inherit;text-decoration:none;transition:transform .15s ease,box-shadow .15s ease; }
.tb-kpi-infrastructure:hover,.tb-kpi-infrastructure:focus-visible { color:inherit;text-decoration:none;transform:translateY(-2px);box-shadow:0 5px 14px #28322612; }
.tb-kpi-entete { display:flex;align-items:center;justify-content:space-between;gap:8px;color:#68746a;font-size:11px;font-weight:600; }
.tb-kpi-icone { width:29px;height:29px;border-radius:9px;background:#e1eff0;color:#216979;display:grid;place-items:center;font-size:14px; }
.tb-kpi-icone.vert { background:#e8eee3;color:#476346; }.tb-kpi-icone.ambre{background:#f8edda;color:#a76b1d}.tb-kpi-icone.mauve{background:#f1e8ef;color:#76526d}
.tb-kpi>strong { display:block;margin:8px 0 2px;font-size:25px;line-height:1.15;letter-spacing:-.7px; }
.tb-kpi>small { display:block;color:#778177;font-size:10px;line-height:1.4; }
.tb-grille-principale { display:grid;grid-template-columns:minmax(0,1.35fr) minmax(270px,.85fr);gap:13px; }
.tb-nouveau .tb-section { min-width:0;margin:0 0 13px;padding:17px 18px;border:1px solid #e3e1d5;border-radius:14px;background:#fffefa;box-shadow:0 3px 10px #28322605; }
.tb-nouveau .tb-section-entete { display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin:0 0 12px; }
.tb-nouveau .tb-section-entete h2 { margin:0;font-size:14px;font-weight:650; }
.tb-nouveau .tb-section-entete>a { white-space:nowrap;font-size:10px; }
.tb-aide { margin:4px 0 0;color:#778177;font-size:10px; }
.tb-liste-activites { display:grid; }
.tb-activite { display:flex;align-items:center;gap:10px;min-width:0;padding:11px 1px;border-bottom:1px solid #efeee7;color:var(--ink);text-decoration:none; }
.tb-activite:last-child { border-bottom:0; }.tb-activite:hover{background:#faf9f3;text-decoration:none}
.tb-activite-puce { width:8px;height:8px;flex:none;border-radius:50%;background:#619879; }.tb-activite-puce.sensibilisation{background:#c69650}
.tb-activite-texte { min-width:0;flex:1; }.tb-activite-texte strong{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px}.tb-activite-texte small,.tb-activite-portee small{display:block;margin-top:4px;color:#778177;font-size:9px}
.tb-activite-portee { flex:none;text-align:right;color:#58675c;font-size:10px; }
.tb-progress-ligne { margin:13px 0; }.tb-progress-ligne>div:first-child{display:flex;justify-content:space-between;gap:8px;margin-bottom:6px;color:#58665b;font-size:10px}.tb-progress-ligne strong{color:#394a3e}
.tb-progress { height:7px;overflow:hidden;border-radius:10px;background:#eeeee7; }.tb-progress span{display:block;height:100%;border-radius:inherit}
.tb-resume { display:flex;justify-content:space-between;gap:12px;padding:9px 0;border-top:1px solid #efeee7;color:#626e63;font-size:10px }.tb-resume strong{color:#35483b}
.tb-grille-bas { display:grid;grid-template-columns:1fr 1fr;gap:13px; }
.tb-comprehension-ligne { display:flex;align-items:center;gap:15px;padding:8px 0 2px; }.tb-comprehension-ligne>strong{flex:none;font-size:31px;letter-spacing:-1px;color:#216979}.tb-comprehension-ligne>div{min-width:0;flex:1}.tb-comprehension-ligne small{display:block;margin-top:7px;color:#778177;font-size:10px}
.tb-villages .tb-section-entete { align-items:center; }
.actions-membre { display:flex;align-items:center;gap:10px;white-space:nowrap; }
.actions-membre form { margin:0; }
.formulaire-membre-edition { max-width:850px;padding:14px;border:1px solid var(--line);border-radius:10px;background:#f4f2e8; }
.formulaire-edition-comite { max-width:1000px;padding:14px;border:1px solid var(--line);border-radius:10px;background:#f4f2e8; }
.lien-telephone-comite { white-space:nowrap;font-variant-numeric:tabular-nums; }
/* Fonds différenciés du tableau de bord, à la place des panneaux blancs */
.tb-nouveau .tb-hero-carte { background:#eaf4f6;border-color:#d3e5e8; }
.tb-kpi:nth-child(1) { background:#eaf4f6;border-color:#d5e7eb; }
.tb-kpi:nth-child(2) { background:#edf2e9;border-color:#dce6d7; }
.tb-kpi:nth-child(3) { background:#faf0df;border-color:#eee0c6; }
.tb-kpi:nth-child(4) { background:#f3edf3;border-color:#e7dce7; }
.tb-card-activites { background:#f1f4eb !important;border-color:#dfe7d7 !important; }
.tb-card-avancement { background:#eaf2f5 !important;border-color:#d6e3e9 !important; }
.tb-comprehension { background:#e8f4f8 !important;border-color:#d4e8ee !important; }
.tb-femmes { background:#eef3e8 !important;border-color:#dce7d4 !important; }
.tb-villages { background:#f4efe2 !important;border-color:#e8dfc9 !important; }
/* Champs de formulaire : bleu ciel doux, avec un focus bien visible */
input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]),
select, textarea {
    background-color:#e8f5fa !important;
    border-color:#b7d7e3 !important;
}
input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):focus,
select:focus, textarea:focus {
    outline:2px solid #70b7cc;
    outline-offset:1px;
    border-color:#70b7cc !important;
}
input[type="checkbox"],input[type="radio"] { accent-color:#287f9a; }
@media(max-width:900px){.tb-activites-recentes{grid-template-columns:1fr}.tb-comprehension-chiffre{margin:10px 0}}
@media(max-width:760px){
 body.application-defilement-interne .topbar { inset:0 0 auto;width:100%;height:auto;max-height:100dvh;padding:10px 14px;gap:10px;border-right:0;border-bottom:1px solid #dedac9;box-shadow:0 3px 14px #28322613;overflow:visible;z-index:1000; }
 body.application-defilement-interne .topbar-ligne1 { flex-direction:row;align-items:center;gap:10px; }
 body.application-defilement-interne .topbar-brand { flex:1;font-size:16px; }
 body.application-defilement-interne .topbar-user { display:none; }
 body.application-defilement-interne .bouton-menu-mobile { display:inline-flex;border:1px solid #c9c4ae;border-radius:9px;background:#fffefa;font-size:12px;padding:8px 10px; }
 body.application-defilement-interne .topbar-nav { position:fixed;top:58px;left:0;right:0;max-height:calc(var(--hauteur-visible,100vh) - 58px);overflow-y:auto;padding:12px 14px 18px;background:#e9e6d7;border-top:1px solid #dedac9;box-shadow:0 10px 18px #28322618; }
 body.application-defilement-interne .topbar-nav[hidden] { display:none; }
 body.application-defilement-interne .topbar-nav:not([hidden]) { display:flex; }
 body.application-defilement-interne .topbar-nav .mobile-nav-utilitaire { display:flex; }
 body.application-defilement-interne .topbar-nav .nav-groupe { margin:0 0 4px; }
 body.application-defilement-interne .nav-groupe-bouton { min-height:44px;padding:11px 12px; }
 body.application-defilement-interne .nav-groupe-bouton .nav-legende { font-size:11px; }
 body.application-defilement-interne .nav-sous-menu { margin-left:10px;padding:3px 0 8px 9px; }
 body.application-defilement-interne .nav-sous-menu a { min-height:42px;padding:11px 12px;font-size:14px; }
 body.application-defilement-interne .nav-groupe:hover:not([open]) > .nav-sous-menu { display:none; }
 body.application-defilement-interne .conteneur { top:60px;left:0;padding:20px 14px 24px; }
 .tb-stats-secondaires { grid-template-columns:repeat(2,minmax(0,1fr));gap:9px; }
 .tb-stat { flex:initial;margin:0; }
 .tb-stat-valeur { font-size:21px; }
 .tb-hero { gap:14px;padding:16px; }
 .tb-hero-detail { flex-basis:100%; }
 .tb-section { padding:14px;overflow-x:auto; }
 .tb-nouveau .tb-entete { align-items:flex-start;flex-direction:column; }
 .tb-nouveau .tb-actions { flex-wrap:wrap; }
 .tb-hero-carte { align-items:flex-start;flex-direction:column;gap:14px; }
 .tb-hero-carte .tb-hero-detail { width:100%; }
 .tb-kpis { grid-template-columns:repeat(2,minmax(0,1fr));gap:9px; }
 .tb-kpi { padding:12px; }
 .tb-kpi>strong { font-size:22px; }
 .tb-grille-principale,.tb-grille-bas { grid-template-columns:1fr;gap:0; }
 .tb-nouveau .tb-section { padding:14px; }
 .tb-villages .tb-section-entete { align-items:flex-start; }
}
@media(max-width:420px){.tableau-bord h1{font-size:23px}.tb-stat{padding:12px}.tb-stat:first-child{padding-left:12px}.tb-stat-libelle{font-size:10px}}

/* En-têtes de colonnes : fond distinct pour repérer rapidement les titres. */
table th,
.tb-tableau th { background:#dce7e3;color:#263d32;font-weight:700;border-bottom:2px solid #aebfb4; }

/* Fiche village : résumé des interventions et rubriques repliables */
.village-resume h2 { margin-top:0; }
.village-resume-grille { display:grid;grid-template-columns:repeat(auto-fit,minmax(155px,1fr));gap:12px; }
.village-resume-carte { min-height:100px;display:flex;flex-direction:column;justify-content:center;gap:5px;padding:14px 16px;border:1px solid #d7dfd8;border-radius:13px;background:#e5f0f0;color:var(--ink); }
.village-resume-carte:nth-child(3n+2) { background:#e9eee2;border-color:#dce3d4; }
.village-resume-carte:nth-child(3n) { background:#f4ead9;border-color:#eadcc5; }
.village-resume-carte strong { color:var(--water-deep);font-size:25px;line-height:1.1; }
.village-resume-carte span { font-weight:600; }
.village-resume-lien { color:inherit;text-decoration:none; }
.village-resume-lien:hover,.village-resume-lien:focus-visible { text-decoration:underline;text-underline-offset:3px; }
.village-resume-carte small { color:var(--ink-soft);font-size:12px; }
.village-accordion { overflow:hidden; }
.village-accordion > summary { display:flex;align-items:center;justify-content:space-between;gap:12px;list-style:none;cursor:pointer;font-size:20px;font-weight:700;color:var(--ink); }
.village-accordion > summary::-webkit-details-marker { display:none; }
.village-accordion > summary::after { content:'＋';flex:none;color:var(--water);font-size:19px; }
.village-accordion[open] > summary::after { content:'−'; }
.village-accordion-content { padding-top:14px; }
.village-accordion-content > .entete-section { margin-bottom:12px; }
@media(max-width:600px){.village-resume-grille{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.village-resume-carte{min-height:90px;padding:12px}.village-resume-carte strong{font-size:21px}.village-accordion>summary{font-size:18px}}
