/*
 * La coquille de Pilotage (refonte simplicite, API.md du suivi, 11.9, 11.10 et 11.18) :
 * - la barre laterale (22/10/2026) : la marque, « + Nouveau », les sections de la
 *   navigation et le compte ; sous 700 px, un tiroir que le bouton ☰ ouvre, avec son
 *   voile ; et l'ecran Plus, garde pour les anciens liens ;
 * - le bouton rond « + » du telephone ;
 * - le panneau de creation (web/suivi/creer.js) : a droite sur ordinateur, feuille du
 *   bas sur telephone, et son message apres une creation ;
 * - les confirmations en ligne (web/commun/confirmation.js) ;
 * - le panneau du mot de passe et la zone des messages du noyau ;
 * - « Voir comme » : le panneau du choix de la personne et le bandeau de la vue ;
 * - ce que l'ecran Equipe (web/direction/equipe.js) n'ecrit plus en ligne.
 *
 * Prefixe c- partout, sauf pour habiller ce que index.html pose deja (#navigation,
 * #bloc-membre, #messages). Couleurs : API.md 11.10, la palette de commun/style.css (rouge et
 * orange par ses variables seulement) ; une erreur est en rouge, avec un filet a gauche.
 * Telephone : cibles de 44 px sous 700 px, aucun defilement horizontal a 375 px.
 */

:root {
  --c-voile: rgba(15, 23, 42, .4);
  --c-sur-accent: #ffffff;
  /* La largeur de la barre laterale (ordinateur) ; le tiroir du telephone est un peu plus large. */
  --c-laterale: 232px;
}

/* ---------- les messages du noyau ---------- */

#messages .message {
  background: var(--carte); color: var(--texte);
  border: 0; border-left: 3px solid var(--bord-haut); border-radius: 0 6px 6px 0;
}
#messages .message.erreur { background: var(--alerte-voile); border-left-color: var(--alerte); color: var(--alerte-texte); font-weight: 650; }
#messages .message.info { background: var(--info-voile); border-left-color: var(--info); color: var(--info-texte); }

/* ---------- la barre laterale ---------- */

/* Collee a gauche, de haut en bas ; son pied (le compte) descend tout en bas. */
.c-laterale {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 20;
  width: var(--c-laterale); overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 12px;
  padding: 18px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--carte); border-right: 1px solid var(--bord);
}
.c-marque { margin: 0 0 0 10px; color: var(--texte); font-size: 19px; font-weight: 700; }
#bloc-nouveau:empty { display: none; }
.c-laterale .c-nouveau { width: 100%; }
#navigation { display: flex; flex-direction: column; gap: 12px; }
.c-section { display: flex; flex-direction: column; gap: 2px; }
.c-section-titre {
  margin: 0 0 4px 10px; color: var(--doux);
  font-size: 11px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase;
}
.c-lien {
  display: flex; align-items: center; width: 100%; min-height: 34px; padding: 6px 10px;
  background: none; border: 0; border-radius: 8px; text-align: left;
  color: var(--doux); font-size: 14px;
}
.c-lien:hover:not(:disabled) { background: var(--carte-haut); color: var(--texte); border: 0; }
/* L'entree ouverte : au contraste, et un filet vert a gauche. */
.c-lien.actif { background: var(--accent-voile); color: var(--accent); font-weight: 650; box-shadow: inset 3px 0 0 var(--accent); }
.c-lien:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* Le compte, en pied : l'initiale et le nom ; ils ouvrent un petit menu au-dessus. */
#bloc-membre { position: relative; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--bord); }
#bloc-membre:empty { display: none; }
.c-compte {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 6px 8px;
  background: none; border: 0; border-radius: 8px; text-align: left; color: var(--texte);
}
.c-compte:hover:not(:disabled) { background: var(--carte-haut); border: 0; }
.c-compte:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.c-initiale {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--carte-haut); border: 1px solid var(--bord-haut); font-size: 13px; font-weight: 650;
}
.c-compte .meta { min-width: 0; color: var(--doux); font-size: 12.5px; overflow-wrap: anywhere; }
.c-compte-menu {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 2;
  display: flex; flex-direction: column; gap: 6px; padding: 10px;
  background: var(--carte-haut); border: 1px solid var(--bord-haut); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .16);
}
.c-compte-menu[hidden] { display: none; }
.c-compte-menu .mini { text-align: left; }

/* Connecte, sur ordinateur : le contenu a droite de la barre, et la marque dans la barre. */
body.c-connecte { padding-left: calc(var(--c-laterale) + 32px); }
body.c-connecte .tete-app { display: none; }

/* Le bouton ☰ et le voile du tiroir ne servent qu'au telephone. */
.c-menu { display: none; }
.c-voile-menu { display: none; }

/* ---------- l'ecran Plus ---------- */

.c-plus { max-width: 720px; }
.c-plus-titre { margin: 0 0 4px; font-size: 20px; text-transform: none; letter-spacing: 0; color: var(--texte); }
.c-plus-aide { margin: 0 0 14px; color: var(--doux); font-size: 13px; }
.c-rangees { display: flex; flex-direction: column; gap: 6px; }
.c-rangee {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  min-height: 56px; padding: 11px 14px;
  background: var(--carte); border: 1px solid var(--bord); border-radius: 10px;
  color: var(--texte); text-decoration: none;
}
.c-rangee:hover { border-color: var(--bord-haut); }
.c-rangee:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.c-rangee-texte { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.c-rangee-texte small { color: var(--doux); font-size: 13px; }
.c-rangee-fleche { flex: 0 0 auto; color: var(--doux); font-size: 22px; line-height: 1; }

/* ---------- le bouton « + » ---------- */

.c-nouveau { white-space: nowrap; }

/* Le bouton rond du telephone : cache sur ordinateur, ou « + Nouveau » est dans la barre laterale. */
.c-rond {
  display: none; position: fixed; z-index: 31;
  right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  width: 56px; height: 56px; padding: 0; border: 0; border-radius: 50%;
  align-items: center; justify-content: center;
  background: var(--accent); color: var(--c-sur-accent);
  font-size: 30px; font-weight: 400; line-height: 1;
  box-shadow: 0 6px 18px rgba(37, 99, 235, .35);
}
.c-rond:hover:not(:disabled) { border: 0; }

/* ---------- le mot de passe (sous l'en-tete) ---------- */

.c-motdepasse {
  margin: 0 0 16px auto; max-width: 380px; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 12px;
  background: var(--carte); border: 1px solid var(--bord-haut); border-radius: 10px;
}
.c-motdepasse-titre { margin: 0; font-weight: 650; color: var(--texte); }

/* ---------- « Voir comme » : le bandeau de la vue et le choix de la personne ---------- */

/* Le bandeau reste en haut de l'ecran pendant toute la vue : une ligne claire a filet
   gauche, lue au contraste comme les messages, jamais en couleur d'alerte. */
.c-vue {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 45;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  margin: 0 0 12px; padding: 10px 14px;
  background: var(--carte-haut); color: var(--texte);
  border: 1px solid var(--bord-haut); border-left: 3px solid var(--texte); border-radius: 0 8px 8px 0;
  font-size: 14px;
}
.c-vue b { font-weight: 650; }
.c-voir-comme-liste { display: flex; flex-wrap: wrap; gap: 8px; }
.c-voir-comme-liste button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-height: 44px; padding: 8px 12px; text-align: left;
  background: var(--fond); color: var(--texte); border: 1px solid var(--bord-haut); border-radius: 8px;
}
.c-voir-comme-liste button:hover { border-color: var(--texte); }
.c-voir-comme-liste button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.c-voir-comme-liste small { color: var(--doux); font-size: 12px; }

/* ---------- formulaires de la coquille ---------- */

.c-form { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.c-champ { display: flex; flex-direction: column; gap: 5px; margin: 0; font-size: 13px; color: var(--doux); }
/* style.css n'habille que les textes, mots de passe, listes et zones de texte. */
.c-form input[type=date], .c-form input[type=time], .c-form input[type=number] {
  width: 100%; min-width: 0; padding: 9px 11px;
  background: var(--fond); color: var(--texte);
  border: 1px solid var(--bord-haut); border-radius: 6px;
  font: inherit; font-size: 14px;
}
.c-form input[type=date]:focus, .c-form input[type=time]:focus, .c-form input[type=number]:focus {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.c-form textarea { font-family: inherit; font-size: 14px; }
.c-deux { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.c-deux > * { min-width: 0; }
.c-note { margin: -4px 0 0; color: var(--doux); font-size: 12.5px; }
.c-interrupteur {
  display: flex; align-items: center; gap: 10px; margin: 0;
  color: var(--texte); font-size: 14px; cursor: pointer; width: max-content; max-width: 100%;
}
.c-interrupteur input, .c-cases input { width: 20px; height: 20px; margin: 0; flex: 0 0 auto; accent-color: var(--accent); }
.c-cases { display: flex; flex-wrap: wrap; gap: 6px 18px; min-width: 0; margin: 0; padding: 0; border: 0; }
.c-cases legend { padding: 0; margin-bottom: 6px; font-size: 13px; color: var(--doux); }
.c-cases label { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--texte); font-size: 14px; cursor: pointer; }
.c-options > summary { cursor: pointer; width: max-content; max-width: 100%; padding: 4px 0; color: var(--doux); font-size: 13px; }
.c-options > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.c-options[open] > summary { margin-bottom: 10px; }
.c-options-corps { display: flex; flex-direction: column; gap: 12px; }
/* Une erreur : texte clair et gras, un filet a gauche (API.md 11.10). */
.c-erreur {
  margin: 0; padding-left: 10px; border-left: 3px solid var(--alerte);
  color: var(--alerte-texte); font-weight: 650; font-size: 13.5px; overflow-wrap: anywhere;
}
.c-erreur[hidden] { display: none; }
.c-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ---------- le panneau de creation (web/suivi/creer.js) ---------- */

body.c-fige { overflow: hidden; }
.c-voile {
  position: fixed; inset: 0; z-index: 40;
  display: flex; justify-content: flex-end; align-items: stretch;
  background: var(--c-voile);
}
.c-feuille {
  width: min(420px, 100%); height: 100%; overflow: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 14px; padding: 16px 18px 24px;
  background: var(--carte); border-left: 1px solid var(--bord-haut);
}
.c-feuille:focus { outline: none; }
.c-feuille-tete { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.c-feuille-titre { margin: 0; font-size: 17px; text-transform: none; letter-spacing: 0; color: var(--texte); }
.c-chargement { margin: 0; color: var(--doux); font-size: 14px; }
.c-choix { display: flex; flex-direction: column; gap: 8px; }
.c-choix button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-height: 56px; padding: 12px 14px; text-align: left;
  background: var(--fond); border: 1px solid var(--bord-haut); border-radius: 10px; color: var(--texte);
}
.c-choix button b { font-weight: 650; }
.c-choix button small { color: var(--doux); font-size: 13px; }

/* Le message apres une creation, en bas de l'ecran. */
.c-annonce {
  position: fixed; left: 50%; bottom: 18px; z-index: 45; transform: translateX(-50%);
  width: max-content; max-width: min(92vw, 520px); padding: 10px 14px;
  background: var(--carte-haut); color: var(--texte); font-size: 14px;
  border: 1px solid var(--bord-haut); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .16); cursor: pointer;
}
.c-annonce[hidden] { display: none; }

/* ---------- confirmations en ligne (web/commun/confirmation.js) ---------- */

.c-confirmation {
  flex-basis: 100%; width: 100%; max-width: 560px; margin: 8px 0; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--fond); border: 1px solid var(--bord-haut); border-radius: 8px;
}
.c-confirmation.c-danger { border-color: var(--alerte); }
.c-confirmation-texte { margin: 0; color: var(--texte); font-size: 14px; }
/* L'action lourde (retirer, supprimer) : en rouge, en gras. */
button.c-fort { background: var(--alerte); color: var(--sur-accent); border-color: var(--alerte); font-weight: 650; }
button.c-fort:hover:not(:disabled) { background: var(--alerte-texte); border-color: var(--alerte-texte); }

/* ---------- l'ecran Equipe (web/direction/equipe.js) ---------- */

.c-equipe-liste { margin-bottom: 24px; }
.c-ligne-membre { cursor: default; }
.c-identifiants {
  margin: 0 0 16px; padding: 14px 16px; max-width: 640px;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--carte); border: 1px solid var(--bord-haut); border-radius: 10px;
}
.c-identifiants p { margin: 0; }
/* Le temps d'une copie de repli, hors de l'ecran : un mot de passe ne s'affiche jamais. */
.c-hors-ecran { position: fixed; top: 0; left: -10000px; width: 1px; height: 1px; opacity: 0; }

/* ---------- telephone ---------- */

@media (max-width: 700px) {
  /* La barre du haut : ☰ et le titre de l'ecran, collee en haut pendant le defilement. */
  .tete-app { flex-wrap: nowrap; margin-bottom: 10px; }
  .tete-app h1 { font-size: 19px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body.c-connecte { padding-left: 18px; }
  body.c-connecte .tete-app {
    display: flex; position: sticky; top: 0; z-index: 25;
    margin: -18px -18px 12px; padding: 8px 18px;
    background: var(--fond); border-bottom: 1px solid var(--bord);
  }
  body.c-connecte .c-menu {
    display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
    width: 44px; height: 44px; padding: 0; border-radius: 10px; font-size: 22px; line-height: 1;
  }
  /* Le bandeau de « Voir comme » reste en tete de page : la barre du haut est collee a sa place. */
  .c-vue { position: static; }

  /* La barre laterale devient un tiroir, ferme par defaut (hors du clavier quand il est ferme). */
  .c-laterale {
    z-index: 50; width: min(300px, 86vw);
    transform: translateX(-100%); visibility: hidden;
    transition: transform .2s ease, visibility 0s linear .2s;
    box-shadow: 8px 0 24px rgba(15, 23, 42, .18);
  }
  body.c-menu-ouvert { overflow: hidden; }
  body.c-menu-ouvert .c-laterale { transform: none; visibility: visible; transition: transform .2s ease; }
  body.c-menu-ouvert .c-voile-menu { display: block; position: fixed; inset: 0; z-index: 49; background: var(--c-voile); }
  .c-lien { min-height: 44px; }
  .c-compte-menu .mini { min-height: 44px; }
  /* La fin de la page passe au-dessus du bouton rond. */
  body { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }

  .c-rond { display: flex; }
  body.c-dans-photo .c-rond { display: none; }
  .c-annonce { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }

  .c-rangee { min-height: 60px; }
  .c-motdepasse { margin-left: 0; max-width: none; }

  /* Le panneau de creation devient une feuille du bas. */
  .c-voile { align-items: flex-end; }
  .c-feuille {
    height: auto; max-height: 88%; max-height: 88dvh;
    border-left: 0; border-top: 1px solid var(--bord-haut); border-radius: 18px 18px 0 0;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  }
  .c-deux { grid-template-columns: 1fr; }
  .c-form input[type=date], .c-form input[type=time], .c-form input[type=number] { min-height: 44px; }
  .c-interrupteur, .c-cases label { min-height: 44px; }
  .c-options > summary { min-height: 44px; padding: 12px 0; }
  .c-actions > button { flex: 1 1 auto; }
}

/* Les ecrans de la refonte portent leur titre : la ligne d'en-tete vide ne prend pas de place. */
#entete:empty { display: none; }

/* Le tiroir s'ouvre sans glisser pour qui a demande moins d'animations. */
@media (prefers-reduced-motion: reduce) {
  .c-laterale { transition: none !important; }
}
