/* ===========================================================================
   CHARTE GRAPHIQUE — Outil de gestion des opérations subventionnées (CD62)

   POUR MODIFIER LES COULEURS : tout se règle dans le bloc :root ci-dessous.
   Changez une valeur hexadécimale, elle se répercute sur tout le site.

   Charte demandée : fond gris argenté, boutons bleus, texte bleu et noir.
   =========================================================================== */

:root {
    /* --- Couleurs de base --- */
    --argent-clair:  #f2f4f6;  /* fond général de la page (gris argenté clair) */
    --argent:        #dfe3e8;  /* panneaux, bandeaux secondaires */
    --argent-bord:   #c2c9d2;  /* bordures, filets de séparation */
    --blanc:         #ffffff;  /* fond des cartes et du tableau */

    /* --- Bleus (boutons, titres, liens) --- */
    --bleu:          #14589c;  /* bleu principal : boutons, titres, liens */
    --bleu-fonce:    #0f4178;  /* survol des boutons et liens */
    --bleu-clair:    #e8f0f9;  /* fonds bleutés légers (entête de tableau) */

    /* --- Texte --- */
    --noir:          #1c1f23;  /* texte courant (presque noir) */
    --gris-texte:    #5a6470;  /* texte secondaire, libellés discrets */

    /* --- Mesures --- */
    --rayon:         6px;      /* arrondi des coins */
    --ombre:         0 1px 3px rgba(0, 0, 0, .12);
}

/* --- Réinitialisation légère --- */
* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
    font-size: 14px;
    color: var(--noir);                 /* texte courant en noir */
    background-color: var(--argent-clair);
}

/* ===========================  EN-TÊTE / NAVIGATION  ======================= */

.site-entete {
    background-color: var(--blanc);
    border-bottom: 3px solid var(--bleu);
    box-shadow: var(--ombre);
}

.site-entete .bandeau {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-titre {
    margin: 0;
    font-size: 18px;
    color: var(--bleu);                 /* titre en bleu */
    font-weight: bold;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 18px;
}
.site-nav a {
    text-decoration: none;
    color: var(--bleu);
    font-weight: bold;
    white-space: nowrap;
}
.site-nav a:hover { color: var(--bleu-fonce); text-decoration: underline; }

/* Déconnexion poussé à droite */
.site-nav .nav-logout {
    margin-left: auto;
    font-weight: normal;
    font-size: 13px;
    color: var(--gris-texte);
}
.site-nav .nav-logout:hover { color: var(--bleu-fonce); }

/* ==============================  CONTENU  ================================= */

/* Paragraphe d'introduction discret (sous les titres H1) */
.intro-grise { color: var(--gris-texte); font-size: 13px; margin-top: -8px; }

/* Sous-titre discret dans un h2 (ex : compteur "X en base") */
.sous-titre { font-weight: normal; font-size: 13px; color: var(--gris-texte); }

.contenu {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
}

h1, h2, h3 { color: var(--bleu); }      /* titres en bleu */
h1 { font-size: 22px; margin: 0 0 16px; }
h1 .h1-mo { font-size: 14px; font-weight: 400; color: var(--gris-texte); display: block; margin-bottom: 2px; }
h2 { font-size: 17px; margin: 24px 0 10px; }

a { color: var(--bleu); }
a:hover { color: var(--bleu-fonce); }

/* --- Carte / panneau blanc --- */
.carte {
    background-color: var(--blanc);
    border: 1px solid var(--argent-bord);
    border-radius: var(--rayon);
    box-shadow: var(--ombre);
    padding: 16px 18px;
    margin-bottom: 18px;
}
.carte > h2:first-child { margin-top: 0; }

/* ==============================  BOUTONS  ================================= */

.bouton {
    display: inline-block;
    padding: 8px 16px;
    border: none;
    border-radius: var(--rayon);
    background-color: var(--bleu);      /* boutons bleus */
    color: var(--blanc);
    font-size: 14px;
    font-weight: bold;
    text-decoration: none;
    cursor: pointer;
}
.bouton:hover { background-color: var(--bleu-fonce); color: var(--blanc); }

/* Bouton secondaire (contour, fond argenté) */
.bouton-secondaire {
    background-color: var(--argent);
    color: var(--bleu);
    border: 1px solid var(--argent-bord);
}
.bouton-secondaire:hover { background-color: var(--argent-bord); color: var(--bleu-fonce); }

/* ============================  FORMULAIRE / FILTRES  ====================== */

.filtres {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}
.champ { display: flex; flex-direction: column; }
.champ label {
    font-size: 12px;
    color: var(--gris-texte);
    margin-bottom: 4px;
}
.champ select,
.champ input[type="text"] {
    padding: 7px 9px;
    border: 1px solid var(--argent-bord);
    border-radius: var(--rayon);
    background-color: var(--blanc);
    font-size: 14px;
    color: var(--noir);
    min-width: 170px;
}

/* ==============================  TABLEAU  ================================= */

table.liste {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--blanc);
    border: 1px solid var(--argent-bord);
    border-radius: var(--rayon);
    overflow: hidden;
}
table.liste thead th {
    background-color: var(--bleu-clair); /* entête de tableau bleuté */
    color: var(--bleu);
    text-align: left;
    padding: 10px 12px;
    font-size: 13px;
    border-bottom: 2px solid var(--bleu);
}
table.liste tbody td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--argent-bord);
}
table.liste tbody tr:nth-child(even) { background-color: var(--argent-clair); }
table.liste tbody tr:hover { background-color: var(--bleu-clair); }

/* Cellules de montants alignées à droite */
td.montant, th.montant { text-align: right; white-space: nowrap; }

/* Pastille d'état */
.etat {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    background-color: var(--argent);
    color: var(--noir);
}

/* ==============================  PIED DE PAGE  =========================== */

.site-pied {
    max-width: 1200px;
    margin: 30px auto 16px;
    padding: 12px 20px;
    color: var(--gris-texte);
    font-size: 12px;
    border-top: 1px solid var(--argent-bord);
}

/* ===========================  ONGLETS PAR DISPOSITIF  ==================== */

.onglets {
    display: flex;
    gap: 4px;
    margin: 0 0 18px;
    border-bottom: 2px solid var(--bleu);
    flex-wrap: wrap;
}
.onglets a {
    padding: 9px 18px;
    text-decoration: none;
    color: var(--bleu);
    background-color: var(--argent);
    border: 1px solid var(--argent-bord);
    border-bottom: none;
    border-radius: var(--rayon) var(--rayon) 0 0;
    font-weight: bold;
    font-size: 14px;
}
.onglets a:hover { background-color: var(--bleu-clair); }
.onglets a.actif {                      /* onglet sélectionné */
    background-color: var(--bleu);
    color: var(--blanc);
    border-color: var(--bleu);
}

/* ==============================  FICHE / FORMULAIRE  ===================== */

.grille-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 22px;
}
.grille-form .pleine-largeur { grid-column: 1 / -1; }

.champ-form { display: flex; flex-direction: column; }
.champ-form label {
    font-size: 12px;
    color: var(--gris-texte);
    margin-bottom: 4px;
    font-weight: bold;
}
.champ-form input[type="text"],
.champ-form input[type="password"],
.champ-form input[type="number"],
.champ-form input[type="date"],
.champ-form select,
.champ-form textarea {
    padding: 8px 10px;
    border: 1px solid var(--argent-bord);
    border-radius: var(--rayon);
    background-color: var(--blanc);
    font-size: 14px;
    color: var(--noir);
    font-family: inherit;
    width: 100%;
}
.champ-form textarea { min-height: 70px; resize: vertical; }

.actions-form { margin-top: 18px; display: flex; gap: 10px; }

/* Plan de financement (operation.php) */
.pf-table { width: 100%; }
.pf-table td { vertical-align: top; }
.pf-table .pf-groupe-dep { background: #f0f4fb; color: var(--bleu);
    text-align: center; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; padding: 6px 8px; }
.pf-table .pf-groupe-rec { background: #f0fbf5; color: #1a7a4a;
    text-align: center; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; padding: 6px 8px; }
.pf-table input.pf-input  { width: 100%; box-sizing: border-box;
    border: 1px solid var(--argent-bord); border-radius: 4px; padding: 4px 6px; font-size: 13px; }
.pf-table input.pf-montant { width: 110px; text-align: right; flex-shrink: 0;
    border: 1px solid var(--argent-bord); border-radius: 4px; padding: 4px 6px; font-size: 13px; }
.pf-auto-rec { background: var(--bleu-clair); font-size: 13px; }
/* Ligne recette : libellé + montant sur la même ligne, checkbox + select en dessous */
.pf-rec-top { display: flex; gap: 6px; align-items: center; }
.pf-rec-top input.pf-input { flex: 1; min-width: 80px; }

/* Checkbox + select programme CD62 dans les lignes recette */
.pf-fin-dep-label {
    display: block; margin-top: 4px; font-size: 11px;
    color: var(--gris-texte); cursor: pointer; user-select: none;
}
.pf-politique-dc {
    display: block; width: 100%; margin-top: 3px;
    font-size: 11px; color: var(--gris-texte);
    border: 1px solid var(--argent-bord); border-radius: 4px;
    padding: 2px 4px; background: var(--blanc);
}

/* Communication (operation.php) */
.com-event { padding: 10px 0; }
.com-event-label { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.com-event-detail { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-top: 10px; padding-left: 24px; }
.com-fichier { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.com-sep { border: none; border-top: 1px solid var(--argent-bord); margin: 4px 0; }
.com-section { padding: 10px 0; }
.com-section h3 { font-size: 14px; font-weight: 600; color: var(--bleu); margin: 0 0 10px; }
.com-add-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap;
    background: var(--fond-page); border: 1px solid var(--argent-bord);
    border-radius: 6px; padding: 12px; margin-bottom: 10px; }

/* Commentaires horodatés (operation.php) */
.commentaires-liste { margin-bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.commentaire-item { border-left: 3px solid var(--bleu); padding: 8px 12px;
    background: var(--fond-page); border-radius: 0 4px 4px 0; }
.commentaire-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.commentaire-date { font-size: 12px; font-weight: 600; color: var(--bleu); }
.commentaire-texte { margin: 0; font-size: 13px; line-height: 1.5; white-space: pre-wrap; }
.commentaire-form textarea { width: 100%; box-sizing: border-box;
    border: 1px solid var(--argent-bord); border-radius: 4px; padding: 8px; font-size: 13px; resize: vertical; }

/* Toast auto-save (operation.php) */
.save-toast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    padding: 9px 18px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    pointer-events: none;
    opacity: 0;
    transition: opacity .25s ease;
    z-index: 200;
}
.save-toast.attente {
    opacity: 1;
    background: var(--argent);
    color: var(--gris-texte);
    border: 1px solid var(--argent-bord);
}
.save-toast.ok {
    opacity: 1;
    background: #e6f4ea;
    color: #1a7431;
    border: 1px solid #a8d5b5;
}
.save-toast.erreur {
    opacity: 1;
    background: #fce8e6;
    color: #b00020;
    border: 1px solid #f4b8b8;
}

/* Ligne d'information (lecture seule) dans la fiche */
.info-ligne { display: flex; justify-content: space-between;
    padding: 6px 0; border-bottom: 1px solid var(--argent-bord); }
.info-ligne .etiquette { color: var(--gris-texte); }
.info-ligne .valeur { font-weight: bold; }

/* =========================  TABLEAU DE BORD / DIAGRAMMES  =============== */

.kpi-rangee { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 8px; }
.kpi {
    flex: 1 1 160px;
    background-color: var(--blanc);
    border: 1px solid var(--argent-bord);
    border-top: 3px solid var(--bleu);
    border-radius: var(--rayon);
    box-shadow: var(--ombre);
    padding: 14px 16px;
}
.kpi .valeur { font-size: 22px; font-weight: bold; color: var(--bleu); }
.kpi .libelle { font-size: 12px; color: var(--gris-texte); margin-top: 4px; }

/* Diagramme en barres horizontales (pur CSS, sans librairie externe) */
.barres { margin-top: 6px; }
.barre-ligne { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.barre-titre { width: 180px; font-size: 13px; flex-shrink: 0; }
.barre-piste {
    flex: 1; background-color: var(--argent);
    border-radius: var(--rayon); overflow: hidden; height: 20px;
}
.barre-remplissage {
    height: 100%; background-color: var(--bleu);
}
.barre-valeur { width: 120px; text-align: right; font-size: 13px;
    white-space: nowrap; flex-shrink: 0; }

/* =====================  PAGE D'ACCUEIL : CARTES DISPOSITIF  ============== */

.cartes-dispositif {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.carte-dispositif {
    background-color: var(--blanc);
    border: 1px solid var(--argent-bord);
    border-top: 4px solid var(--bleu);
    border-radius: var(--rayon);
    box-shadow: var(--ombre);
    padding: 16px 18px;
}
.carte-dispositif h2 {
    margin: 0 0 4px;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}
.carte-dispositif .nb-ops { font-size: 13px; color: var(--gris-texte); font-weight: normal; }
.carte-dispositif .lien-detail { font-size: 13px; }

/* Jauge de consommation (consommé / ouvert) */
.jauge { margin: 12px 0; }
.jauge .jauge-entete {
    display: flex; justify-content: space-between;
    font-size: 12px; color: var(--gris-texte); margin-bottom: 3px;
}
.jauge .jauge-piste {
    height: 14px; background-color: var(--argent);
    border-radius: 7px; overflow: hidden;
}
.jauge .jauge-remplissage {
    height: 100%; background-color: var(--bleu); border-radius: 7px;
}
.jauge .jauge-remplissage.alerte { background-color: #c0392b; } /* >100 % */
.jauge .jauge-valeur { font-size: 12px; margin-top: 2px; color: var(--noir); }
.jauge .jauge-reste { font-size: 11px; color: var(--gris-texte); }

/* ── Étiquette millésime archivé (parametres.php) ── */
.etiquette-archive {
    font-size: 11px; font-weight: bold; padding: 2px 7px;
    background: var(--argent); border: 1px solid var(--argent-bord);
    border-radius: 3px; color: var(--gris-texte);
}

/* ── Générations précédentes (accueil.php) ── */
.carte-anciennes {
    margin-top: 14px; padding-top: 12px;
    border-top: 1px dashed var(--argent-bord);
}
.carte-anciennes-titre {
    font-size: 11px; font-weight: bold; color: var(--gris-texte);
    text-transform: uppercase; letter-spacing: .04em; margin: 0 0 7px;
}
.anc-ligne {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; margin-bottom: 5px;
}
.anc-code { font-weight: bold; flex-shrink: 0; }
.anc-periode { font-weight: normal; color: var(--gris-texte); }
.anc-jauge-wrap {
    flex: 1; height: 7px; background: var(--argent);
    border-radius: 4px; overflow: hidden;
}
.anc-jauge { height: 100%; background: var(--bleu); border-radius: 4px; }
.anc-montants { flex-shrink: 0; color: var(--gris-texte); white-space: nowrap; }
.anc-reste { flex-shrink: 0; color: var(--noir); white-space: nowrap; }

/* ==================  ÉCRAN DISPOSITIF : BULLES KPI  ===================== */

.bulles { display: flex; flex-wrap: wrap; gap: 14px; margin: 4px 0 18px; }
.bulle {
    flex: 1 1 150px;
    background-color: var(--blanc);
    border: 1px solid var(--argent-bord);
    border-left: 4px solid var(--bleu);
    border-radius: var(--rayon);
    box-shadow: var(--ombre);
    padding: 12px 14px;
}
.bulle .b-titre { font-size: 12px; color: var(--gris-texte); }
.bulle .b-valeur { font-size: 19px; font-weight: bold; color: var(--bleu); margin-top: 4px; }
.bulle .b-detail { font-size: 12px; color: var(--noir); margin-top: 2px; }
/* Bulle en état d'alerte (ex : AE restant à ventiler négatif) */
.bulle.bulle-alerte { border-left-color: #c0392b; }
.bulle.bulle-alerte .b-valeur { color: #c0392b; }

/* Sélecteur de millésime / génération */
.selecteur-millesime { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.selecteur-millesime a {
    padding: 6px 13px; border-radius: var(--rayon);
    border: 1px solid var(--argent-bord); background-color: var(--blanc);
    color: var(--bleu); text-decoration: none; font-size: 13px; font-weight: bold;
}
.selecteur-millesime a.actif { background-color: var(--bleu); color: var(--blanc); border-color: var(--bleu); }
.selecteur-millesime a:hover { background-color: var(--bleu-clair); }
.selecteur-millesime a.actif:hover { background-color: var(--bleu-fonce); }

/* ==========================  MODULE BILAN  =============================== */

/* Formulaire de sélection génération / options bilan */
.bilan-selec {
    display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
    background: var(--blanc); border: 1px solid var(--argent-bord);
    border-radius: var(--rayon); padding: 16px; margin-bottom: 20px;
    box-shadow: var(--ombre);
}
.bilan-selec .champ-form { margin: 0; }

/* Palette de couleurs des six postes bilan */
.pbilan-A     { background-color: #14589c; } /* Aménagement — bleu CD62 */
.pbilan-SPORT { background-color: #1a7a4a; } /* Sport — vert */
.pbilan-C     { background-color: #c05c00; } /* Culture — orange */
.pbilan-T     { background-color: #2e7d9e; } /* Tourisme-Patrimoine — bleu-vert */
.pbilan-SP    { background-color: #6d28a0; } /* Services publics — violet */
.pbilan-CS    { background-color: #a01729; } /* Cohésion sociale — rouge */
.pbilan-null  { background-color: #9aa4b0; } /* Non classé — gris */

/* Camembert CSS (conic-gradient injecté en style inline) */
.bilan-camembert {
    width: 180px; height: 180px; border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.bilan-legende { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.bilan-legende-item { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.bilan-legende-puce { width: 12px; height: 12px; border-radius: 2px; flex-shrink: 0; }
.bilan-legende-libelle { flex: 1; }
.bilan-legende-val { font-weight: 600; color: var(--bleu); }

/* Conteneur mixte camembert à gauche + tableau à droite */
.bilan-2col { display: flex; gap: 28px; align-items: flex-start; flex-wrap: wrap; }
.bilan-camembert-wrap { flex-shrink: 0; }

/* Tableau de synthèse interne au bilan */
.bilan-table { flex: 1; min-width: 300px; width: 100%; border-collapse: collapse; }
.bilan-table th {
    background: var(--bleu-clair); color: var(--bleu);
    font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
    padding: 7px 10px; text-align: left;
}
.bilan-table th.montant,
.bilan-table td.montant { text-align: right; }
.bilan-table td {
    padding: 7px 10px; font-size: 13px;
    border-bottom: 1px solid var(--argent-bord); vertical-align: middle;
}
.bilan-table tr.bilan-total td { font-weight: 600; background: var(--argent-clair); }
.bilan-puce {
    display: inline-block; width: 10px; height: 10px;
    border-radius: 2px; margin-right: 6px; vertical-align: middle;
}

/* Barres horizontales par territoire */
.bilan-barre-ligne {
    display: flex; align-items: center; gap: 10px; margin: 7px 0;
}
.bilan-barre-titre { width: 150px; font-size: 13px; flex-shrink: 0; }
.bilan-barre-piste {
    flex: 1; background-color: var(--argent);
    border-radius: var(--rayon); overflow: hidden; height: 20px;
}
.bilan-barre-fill { height: 100%; background-color: var(--bleu); }
.bilan-barre-val {
    width: 140px; text-align: right; font-size: 13px;
    white-space: nowrap; flex-shrink: 0;
}

/* Titre de section discret dans une carte bilan */
.bilan-section-titre {
    font-size: 12px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .06em; color: var(--gris-texte); margin: 0 0 16px;
}

/* ====================  RÉFÉRENTIELS : ACCORDÉON  ========================= */

/* Conteneur unique — une seule boîte bordée, comme un tableau */
.accordeon {
    border: 1px solid var(--argent-bord);
    border-radius: var(--rayon);
    box-shadow: var(--ombre);
    overflow: hidden;
    margin-bottom: 20px;
}

/* Séparateur entre items (sauf le premier) */
.acc-item + .acc-item { border-top: 1px solid var(--argent-bord); }

/* Bouton titre — pleine largeur, fond gris argenté */
.acc-titre {
    display: flex;
    width: 100%;
    align-items: center;
    padding: 13px 20px;
    background-color: var(--argent);
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 15px;
    font-weight: bold;
    color: var(--bleu);
    text-align: left;
    user-select: none;
    gap: 10px;
}
.acc-titre:hover { background-color: var(--bleu-clair); }

/* Titre actif : fond bleu, texte blanc (comme l'onglet actif) */
.acc-item.acc-ouvert > .acc-titre {
    background-color: var(--bleu);
    color: var(--blanc);
}

/* Compteur discret à droite du libellé */
.acc-info {
    font-size: 12px;
    font-weight: normal;
    color: var(--gris-texte);
    margin-left: 4px;
}
.acc-item.acc-ouvert > .acc-titre .acc-info { color: rgba(255,255,255,.65); }

/* Chevron CSS (currentColor : bleu quand fermé, blanc quand ouvert) */
.acc-fleche {
    display: inline-block;
    flex-shrink: 0;
    margin-left: auto;
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    transition: transform .18s;
}
.acc-item.acc-ouvert > .acc-titre .acc-fleche { transform: rotate(45deg); }

/* Corps dépliable */
.acc-corps {
    padding: 18px 20px;
    background-color: var(--blanc);
    border-top: 1px solid var(--argent-bord);
}

/* Barre outil : champ filtre + bouton Ajouter côte à côte */
.acc-barre {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 14px;
}
.acc-filtre {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--argent-bord);
    border-radius: var(--rayon);
    font-size: 14px;
    color: var(--noir);
    background-color: var(--blanc);
}
.acc-filtre:focus {
    outline: none;
    border-color: var(--bleu);
    box-shadow: 0 0 0 2px rgba(20,88,156,.15);
}

/* Formulaire d'ajout (fond gris clair, affiché/masqué en JS) */
.acc-form-ajout {
    background-color: var(--argent-clair);
    border: 1px solid var(--argent-bord);
    border-radius: var(--rayon);
    padding: 14px 16px;
    margin-bottom: 16px;
}

/* ===========  ACCORDÉON NIVEAU 2 (programmes dans un dispositif)  ========= */

.acc2 {
    border: 1px solid var(--argent-bord);
    border-radius: var(--rayon);
    overflow: hidden;
    margin-bottom: 14px;
}
.acc2-item + .acc2-item { border-top: 1px solid var(--argent-bord); }

/* Titre programme : fond bleu-clair, texte bleu */
.acc2-titre {
    display: flex;
    width: 100%;
    align-items: center;
    padding: 10px 16px;
    background-color: var(--bleu-clair);
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: bold;
    color: var(--bleu);
    text-align: left;
    gap: 8px;
    user-select: none;
}
.acc2-titre:hover { filter: brightness(.95); }

/* Titre programme ouvert : fond bleu, texte blanc */
.acc2-item.acc2-ouvert > .acc2-titre {
    background-color: var(--bleu);
    color: var(--blanc);
}

.acc2-libelle { font-weight: normal; }

.acc2-info {
    font-size: 11px;
    font-weight: normal;
    color: var(--gris-texte);
    margin-left: 4px;
}
.acc2-item.acc2-ouvert > .acc2-titre .acc2-info { color: rgba(255,255,255,.6); }

.acc2-fleche {
    display: inline-block;
    flex-shrink: 0;
    margin-left: auto;
    width: 7px;
    height: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    transition: transform .15s;
}
.acc2-item.acc2-ouvert > .acc2-titre .acc2-fleche { transform: rotate(45deg); }

/* Corps programme */
.acc2-corps {
    padding: 14px 16px;
    background-color: var(--blanc);
    border-top: 1px solid var(--argent-bord);
}

/* Barre statut + référence délibération */
.acc2-barre {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.etiquette-actif {
    display: inline-block;
    padding: 4px 10px;
    background-color: var(--bleu-clair);
    color: var(--bleu);
    border: 1px solid var(--bleu);
    border-radius: var(--rayon);
    font-size: 12px;
    font-weight: bold;
}
.acc2-delib {
    font-size: 12px;
    color: var(--gris-texte);
}

/* Résumé AE pluriannuelle / ventilation */
.acc2-recap {
    background-color: var(--argent-clair);
    border: 1px solid var(--argent-bord);
    border-radius: var(--rayon);
    padding: 8px 12px;
    font-size: 13px;
    margin-bottom: 12px;
}
.montant-alerte { color: #c0392b; font-weight: bold; }

/* Zone bouton "+ Ajouter un millésime" en bas du corps dispositif */
.acc2-ajouter { padding-top: 4px; }

/* =============================================================================
   AUTHENTIFICATION — page de connexion et gestion des accès
   ============================================================================= */

/* Page de connexion : corps centré verticalement */
body.page-login {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--argent-clair);
    margin: 0;
}
.login-wrap   { width: 100%; max-width: 400px; padding: 0 16px; }
.login-logo   { text-align: center; margin-bottom: 24px; }
.login-titre  { font-size: 17px; font-weight: 700; color: var(--bleu); margin: 0 0 4px; }
.login-sous-titre { font-size: 13px; color: var(--gris-texte); margin: 0; }
.login-form   { display: flex; flex-direction: column; gap: 14px; }
.login-aide   { text-align: center; font-size: 12px; color: var(--gris-texte); margin-top: 12px; }
.login-aide a { color: var(--bleu); }

/* Bouton pleine largeur */
.bouton-large { display: block; width: 100%; text-align: center; padding: 10px; font-size: 15px; }

/* Alertes (succès / erreur) — utilisées sur toutes les pages */
.alerte {
    padding: 10px 14px;
    border-radius: var(--rayon);
    margin-bottom: 14px;
    font-size: 14px;
    border: 1px solid transparent;
}
.alerte-succes { background: #eaf5ec; color: #235c2e; border-color: #b3dfc0; }
.alerte-erreur { background: #fdecea; color: #8b2020; border-color: #f5c6c6; }

/* Badge rôle dans la nav et dans les tableaux */
.badge-role {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    vertical-align: middle;
    margin-right: 2px;
}
.badge-admin       { background: var(--bleu);    color: #fff; }
.badge-instructeur { background: var(--argent);  color: var(--gris-texte); border: 1px solid var(--argent-bord); }

/* Utilisateur connecté dans la nav */
.nav-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: rgba(255,255,255,.75);
    margin-left: 16px;
}
.nav-logout {
    font-size: 12px;
    color: rgba(255,255,255,.6);
    text-decoration: none;
    padding: 2px 8px;
    border: 1px solid rgba(255,255,255,.3);
    border-radius: var(--rayon);
}
.nav-logout:hover { background: rgba(255,255,255,.15); color: #fff; }

/* Formulaire vertical (gestion accès) */
.form-vertical { display: flex; flex-direction: column; gap: 8px; }

/* ==========================================================================
   Panneau filtres escamotable (details/summary) */
details.carte > summary {
    list-style: none;
    padding: 2px 0;
}
details.carte > summary::-webkit-details-marker { display: none; }
details.carte > summary::before {
    content: '▶ ';
    font-size: 10px;
    color: var(--gris-texte);
    transition: transform .15s;
}
details.carte[open] > summary::before { content: '▼ '; }

/* ==============================  MODALE  ================================== */

.modal-fond {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal-fond.ouvert { display: flex; }

.modal-boite {
    background: var(--blanc);
    border-radius: var(--rayon);
    box-shadow: 0 4px 24px rgba(0, 0, 0, .25);
    padding: 28px 32px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-titre {
    margin: 0 0 20px;
    font-size: 17px;
    color: var(--bleu);
}

.modal-fermer {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: var(--gris-texte);
}
.modal-fermer:hover { color: var(--noir); }

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}
