/* =========================================================================
   Périmètre Scolaire Protégé — feuille de style principale
   Palette (§15.1) : principal 1F3864, secondaire 2E5B9A, vert 2E7D32,
   orange E65100, rouge C62828, gris F2F2F2.
   ========================================================================= */

:root {
    --bleu: #1F3864;
    --bleu-2: #2E5B9A;
    --vert: #2E7D32;
    --orange: #E65100;
    --rouge: #C62828;
    --gris: #F2F2F2;
    --gris-bord: #D9DEE8;
    --texte: #1c2333;
    --texte-doux: #5a6577;
    --blanc: #ffffff;
    --ombre: 0 1px 3px rgba(16, 24, 40, .1), 0 1px 2px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 15px;
    color: var(--texte);
    background: var(--gris);
    line-height: 1.5;
}

a { color: var(--bleu-2); }

/* --- Authentification ---------------------------------------------------- */
.page-auth {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, var(--bleu) 0%, var(--bleu-2) 100%);
}
.carte-auth {
    background: var(--blanc);
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: var(--ombre);
}
.carte-auth__entete { text-align: center; margin-bottom: 1.5rem; }
.carte-auth__entete h1 { font-size: 1.15rem; color: var(--bleu); margin: .5rem 0 0; }
.carte-auth__titre { font-size: 1.1rem; color: var(--texte); margin: 0 0 1rem; }
.logo, .bandeau__logo { max-height: 56px; }
.pied-auth { color: rgba(255, 255, 255, .85); font-size: .8rem; margin-top: 1.5rem; text-align: center; padding: 0 1rem; }

/* --- Application (bandeau + menu + contenu) ------------------------------ */
.page-app { background: var(--gris); min-height: 100vh; }
.bandeau {
    background: var(--bleu);
    color: var(--blanc);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .6rem 1.25rem;
    position: sticky;
    top: 0;
    z-index: 10;
}
.bandeau__gauche { display: flex; align-items: center; gap: .75rem; }
.bandeau__titre { font-weight: 600; }
.bandeau__droite { display: flex; align-items: center; gap: 1rem; }
.bandeau__user { text-align: right; line-height: 1.2; display: flex; flex-direction: column; }
.bandeau__role { font-size: .78rem; color: rgba(255, 255, 255, .75); }

.conteneur-app { display: flex; max-width: 1200px; margin: 0 auto; }
.menu {
    width: 240px;
    flex: 0 0 240px;
    background: var(--blanc);
    min-height: calc(100vh - 56px);
    border-right: 1px solid var(--gris-bord);
    padding: 1rem 0;
}
.menu ul { list-style: none; margin: 0; padding: 0; }
.menu__lien {
    display: block;
    padding: .55rem 1.25rem;
    color: var(--texte);
    text-decoration: none;
    border-left: 3px solid transparent;
    font-size: .92rem;
}
.menu__lien:hover { background: var(--gris); }
.menu__lien--actif { border-left-color: var(--bleu-2); background: #eef2fa; color: var(--bleu); font-weight: 600; }

.contenu { flex: 1; padding: 1.5rem; min-width: 0; }
.contenu h1 { font-size: 1.4rem; color: var(--bleu); margin-top: 0; }

.pied { text-align: center; color: var(--texte-doux); font-size: .8rem; padding: 1rem; }

/* --- Cartes -------------------------------------------------------------- */
.carte {
    background: var(--blanc);
    border: 1px solid var(--gris-bord);
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: var(--ombre);
    margin-bottom: 1rem;
}

/* --- Formulaires --------------------------------------------------------- */
.form { display: flex; flex-direction: column; gap: 1rem; }
.form-inline { display: inline; margin: 0; }
.champ { display: flex; flex-direction: column; gap: .3rem; }
.champ label { font-weight: 600; font-size: .88rem; }
.champ input, .champ select, .champ textarea {
    padding: .55rem .65rem;
    border: 1px solid var(--gris-bord);
    border-radius: 6px;
    font-size: .95rem;
    font-family: inherit;
}
.champ input:focus, .champ select:focus, .champ textarea:focus {
    outline: 2px solid var(--bleu-2);
    outline-offset: 1px;
    border-color: var(--bleu-2);
}
.aide { font-size: .8rem; color: var(--texte-doux); margin: 0; }
.note { color: var(--texte-doux); }

/* --- Boutons ------------------------------------------------------------- */
.btn {
    display: inline-block;
    padding: .55rem 1rem;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: .92rem;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}
.btn--principal { background: var(--bleu); color: var(--blanc); }
.btn--principal:hover { background: var(--bleu-2); }
.btn--bloc { width: 100%; }
.btn--fantome { background: transparent; color: var(--blanc); border-color: rgba(255, 255, 255, .5); }
.btn--fantome:hover { background: rgba(255, 255, 255, .12); }
.btn--succes { background: var(--vert); color: var(--blanc); }
.btn--danger { background: var(--rouge); color: var(--blanc); }

/* --- Messages flash ------------------------------------------------------ */
.flash {
    padding: .7rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: .9rem;
    border: 1px solid transparent;
}
.flash--succes { background: #e6f4ea; color: var(--vert); border-color: #b7e0c1; }
.flash--erreur { background: #fdecea; color: var(--rouge); border-color: #f5c2bd; }
.flash--avertissement { background: #fff4e5; color: var(--orange); border-color: #ffd8a8; }

/* --- Tableaux ------------------------------------------------------------ */
.tableau { width: 100%; border-collapse: collapse; background: var(--blanc); }
.tableau th, .tableau td { padding: .55rem .65rem; border-bottom: 1px solid var(--gris-bord); text-align: left; font-size: .9rem; }
.tableau th { background: var(--gris); color: var(--texte); font-weight: 600; }

/* --- Erreur -------------------------------------------------------------- */
.erreur-page { text-align: center; }
.erreur-page__code { font-size: 3rem; font-weight: 700; color: var(--bleu-2); margin: 0; }

/* --- Pastilles d'indicateurs --------------------------------------------- */
.grille-pastilles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem; }
.pastille { border-radius: 8px; padding: .75rem .9rem; border: 1px solid var(--gris-bord); }
.pastille__entete { display: flex; justify-content: space-between; align-items: center; }
.pastille__code { font-weight: 700; font-size: .8rem; color: var(--texte-doux); }
.pastille__symbole { font-size: 1.1rem; }
.pastille__nom { font-size: .85rem; margin: .2rem 0; min-height: 2.2em; }
.pastille__valeur { font-size: 1.35rem; font-weight: 700; }
.pastille__meta { font-size: .74rem; color: var(--texte-doux); margin-top: .35rem; line-height: 1.35; }

/* --- Critères de généralisation ------------------------------------------ */
.criteres { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .75rem; }
.critere { border-radius: 8px; padding: .9rem; color: #fff; }
.critere--ok { background: var(--vert); }
.critere--ko { background: var(--rouge); }
.critere__titre { font-weight: 700; }
.critere__etat { font-size: 1.05rem; margin: .3rem 0; }
.critere__cond { font-size: .8rem; opacity: .95; }
.critere__detail { font-size: .78rem; opacity: .9; margin-top: .35rem; }

/* --- Badges d'indicateur (tableau SC4) ----------------------------------- */
.badge-ind { display: inline-block; color: #fff; padding: .1rem .4rem; border-radius: 4px; font-size: .78rem; white-space: nowrap; }

/* --- Statuts de site ----------------------------------------------------- */
.statut { font-size: .78rem; padding: .12rem .45rem; border-radius: 10px; white-space: nowrap; }
.statut--a_jour { background: #e6f4ea; color: var(--vert); }
.statut--en_retard_depot { background: #fdecea; color: var(--rouge); }
.statut--en_attente_validation { background: #fff4e5; color: var(--orange); }
.statut--referentiel_incomplet { background: #eceff3; color: var(--texte-doux); }

/* --- Vignettes de sites (ministre) --------------------------------------- */
.grille-sites { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.site-vignette { border: 2px solid var(--gris-bord); border-radius: 8px; padding: .6rem; text-align: center; background: #fff; }
.site-vignette__sym { font-size: 1.4rem; font-weight: 700; }
.site-vignette__code { font-weight: 700; }
.site-vignette__nom { font-size: .78rem; color: var(--texte-doux); min-height: 2.2em; }
.site-vignette--vert   { background: #e6f4ea; border-color: var(--vert); }
.site-vignette--orange { background: #fff4e5; border-color: var(--orange); }
.site-vignette--rouge  { background: #fdecea; border-color: var(--rouge); }
.site-vignette--gris   { background: #eef0f3; border-color: #9aa4b2; }
.site-vignette--vert .site-vignette__sym   { color: var(--vert); }
.site-vignette--orange .site-vignette__sym { color: var(--orange); }
.site-vignette--rouge .site-vignette__sym  { color: var(--rouge); }
.site-vignette--gris .site-vignette__sym   { color: #9aa4b2; }

/* --- Responsive ---------------------------------------------------------- */
@media (max-width: 820px) {
    .conteneur-app { flex-direction: column; }
    .menu { width: 100%; flex-basis: auto; min-height: auto; border-right: none; border-bottom: 1px solid var(--gris-bord); }
    .contenu > div[style*="grid-template-columns"] { display: block !important; }
}
