/* Interface d'administration — charte BNI Chablais.
   Titres en Cal Sans, corps en Raleway, rouge #C32429 en accent. */

@font-face {
  font-family: "Raleway";
  src: url("../../assets/polices/raleway-regular.ttf") format("truetype");
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: "Raleway";
  src: url("../../assets/polices/raleway-bold.ttf") format("truetype");
  font-weight: 700; font-display: swap;
}
@font-face {
  font-family: "Cal Sans";
  src: url("../../assets/polices/calsans-regular.ttf") format("truetype");
  font-weight: 400; font-display: swap;
}

:root {
  --rouge: #c32429;
  --rouge-sombre: #8e1a1e;
  --rouge-pale: #fbeced;
  --encre: #1a1a1a;
  --gris: #6b6b6b;
  --trait: #e2e2e2;
  --fond: #f2f2f2;
  --alerte: #a8620a;
  --titre: "Cal Sans", "Raleway", system-ui, sans-serif;
  --corps: "Raleway", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--corps);
  font-size: 16px;
  line-height: 1.55;
  color: var(--encre);
  background: #fff;
}

a { color: var(--rouge); }
a:hover { color: var(--rouge-sombre); }

/* Liens du contenu (noms des membres, dates des séances, « Lire »…) :
   en noir et en gras, sans soulignement. Le rouge au survol signale
   qu'ils sont cliquables. */
main a:not(.bouton) {
  color: var(--encre); font-weight: 700; text-decoration: none;
}
main a:not(.bouton):hover { color: var(--rouge); }
main a:not(.bouton):focus-visible {
  outline: 2px solid var(--rouge); outline-offset: 2px; border-radius: 2px;
}

/* --- Structure ---------------------------------------------------------- */

.cadre { display: flex; min-height: 100vh; }

nav.laterale {
  width: 248px;
  flex: 0 0 248px;
  border-right: 1px solid var(--trait);
  padding: 28px 0 0;
  background: var(--fond);
  position: relative;
  overflow: hidden;
}

nav.laterale .marque { padding: 0 22px 26px; }
nav.laterale .marque img { width: 152px; height: auto; display: block; }
nav.laterale .marque .sous {
  font-size: 12px; color: var(--gris); margin: 9px 0 0;
  letter-spacing: .04em; text-transform: uppercase;
}

nav.laterale a {
  display: block;
  padding: 10px 22px;
  color: var(--encre);
  text-decoration: none;
  border-left: 3px solid transparent;
  position: relative; z-index: 1;
}
nav.laterale a:hover { background: #fff; }
nav.laterale a.actif {
  border-left-color: var(--rouge);
  font-weight: 700;
  background: #fff;
}

main { flex: 1; padding: 36px 44px 90px; max-width: 1200px; }

h1 {
  font-family: var(--titre);
  font-size: 34px; font-weight: 400;
  margin: 0 0 6px; letter-spacing: -0.01em;
}
h2 { font-family: var(--titre); font-size: 21px; font-weight: 400; margin: 34px 0 12px; }
h3 { font-family: var(--titre); font-size: 17px; font-weight: 400; margin: 22px 0 8px; }
.sous { color: var(--gris); margin: 0 0 26px; }

/* --- Tableaux ----------------------------------------------------------- */

table { width: 100%; border-collapse: collapse; margin-bottom: 18px; }
th {
  text-align: left; font-weight: 700; font-size: 13px;
  letter-spacing: .03em; text-transform: uppercase; color: var(--gris);
  padding: 9px 10px; border-bottom: 2px solid var(--trait);
}
td { padding: 9px 10px; border-bottom: 1px solid var(--trait); vertical-align: middle; }
tr:hover td { background: #faf9f8; }
td.etroit, th.etroit { width: 1%; white-space: nowrap; }

/* --- Formulaires -------------------------------------------------------- */

label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 4px; }
input[type=text], input[type=date], input[type=number], input[type=password],
input[type=email], input[type=tel], input[type=url], input[type=search],
select, textarea {
  width: 100%; padding: 9px 11px; font: inherit; font-size: 15px;
  border: 1px solid var(--trait); border-radius: 5px; background: #fff;
  color: var(--encre);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--rouge); outline-offset: -1px; border-color: var(--rouge);
}
textarea { min-height: 96px; resize: vertical; font-family: var(--corps); }
input[type=file] { font-size: 14px; }

.champ { margin-bottom: 16px; }
.grille { display: grid; gap: 16px; }
.g2 { grid-template-columns: 1fr 1fr; }
.g3 { grid-template-columns: 1fr 1fr 1fr; }
.case { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.case input { width: auto; }
.case label { margin: 0; font-weight: 400; }

button, .bouton {
  display: inline-block; padding: 10px 20px; font: inherit; font-size: 15px;
  font-weight: 700; border: 1px solid var(--trait); border-radius: 5px;
  background: #fff; color: var(--encre); cursor: pointer; text-decoration: none;
}
button:hover, .bouton:hover { background: var(--fond); }
button.principal, .bouton.principal {
  background: var(--rouge); border-color: var(--rouge); color: #fff;
}
button.principal:hover, .bouton.principal:hover {
  background: var(--rouge-sombre); border-color: var(--rouge-sombre); color: #fff;
}
button.discret { border: none; background: none; color: var(--gris); padding: 4px 8px; }
button.discret:hover { color: var(--rouge); background: none; }

.actions { display: flex; gap: 10px; align-items: center; margin-top: 22px; }

/* --- Blocs -------------------------------------------------------------- */

.bloc {
  border: 1px solid var(--trait); border-radius: 8px;
  padding: 22px 24px; margin-bottom: 20px; background: #fff;
}
.bloc h2 { margin-top: 0; }

.avis { padding: 12px 16px; border-radius: 5px; margin-bottom: 12px; font-size: 15px; }
.avis.succes { background: #eef6ee; border: 1px solid #cbe2cb; }
.avis.attention { background: #fdf4e6; border: 1px solid #f0dcbc; color: var(--alerte); }
.avis.erreur { background: var(--rouge-pale); border: 1px solid #f0c9cb; color: var(--rouge-sombre); }
.avis.info { background: var(--fond); border: 1px solid var(--trait); }

.mesures { display: flex; gap: 44px; margin-bottom: 8px; }
.mesure .valeur {
  font-family: var(--titre); font-size: 44px; line-height: 1.05; color: var(--rouge);
}
.mesure .nom { font-size: 14px; color: var(--gris); }

.jeton {
  display: inline-block; padding: 2px 9px; border-radius: 11px;
  font-size: 13px; font-weight: 700; background: var(--fond); color: var(--gris);
}
.jeton.ok { background: #eef6ee; color: #2c6b2c; }
.jeton.manque { background: var(--rouge-pale); color: var(--rouge-sombre); }

/* --- Vignettes ---------------------------------------------------------- */

.vignettes { display: flex; flex-wrap: wrap; gap: 12px; }
.vignette { width: 150px; }
.vignette img {
  width: 150px; height: 100px; object-fit: contain;
  border: 1px solid var(--trait); border-radius: 5px; background: var(--fond);
}
.vignette .legende { font-size: 13px; color: var(--gris); margin-top: 3px; }

.apercu-logo { max-height: 54px; max-width: 190px; }
.apercu-photo { max-height: 96px; border-radius: 5px; }

/* --- Import des invités ------------------------------------------------- */

.import-choix { align-items: start; }
.import-choix .sous { margin-bottom: 12px; font-size: 14px; }
.import-choix .actions { margin-top: 12px; }
.depot {
  border: 2px dashed var(--trait); border-radius: 8px; padding: 16px 18px;
  transition: border-color .15s, background-color .15s;
}
.depot.survol { border-color: var(--rouge); background: var(--rouge-pale); }
.depot.en-cours { opacity: .6; pointer-events: none; }
.avis ul.details { margin: 8px 0 0; padding-left: 20px; font-weight: 400; }
.avis ul.details li { margin-bottom: 3px; }
table.grille-invites td { padding: 6px 5px; vertical-align: top; }
table.grille-invites .jeton { margin-top: 4px; font-size: 12px; }
table.grille-invites tr.absent input[type=text],
table.grille-invites tr.absent select { color: var(--gris); background: var(--fond); }

/* --- Vidéo de la fiche membre ------------------------------------------- */

.video-en-place { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 16px; }
.video-en-place video {
  width: 360px; max-width: 100%; max-height: 240px; border-radius: 6px;
  background: #000;
}
.etat-video { margin-top: 10px; display: flex; gap: 14px; align-items: center; font-size: 14px; }
.etat-video p { margin: 0; color: var(--gris); }
.etat-video img { width: 160px; max-height: 110px; object-fit: contain; border-radius: 5px; background: #000; }
.etat-video.attention p { color: var(--alerte); }
.etat-video.erreur p { color: var(--rouge-sombre); font-weight: 700; }
.etat-video.pret p { color: #2c6b2c; }

.vide { color: var(--gris); padding: 26px 0; }

/* --- Navigation : pastille et pied ------------------------------------- */

.pastille {
  display: inline-block; min-width: 20px; padding: 1px 6px; margin-left: 4px;
  border-radius: 10px; background: var(--rouge); color: #fff;
  font-size: 12px; font-weight: 700; line-height: 18px; text-align: center;
}
nav.laterale .pied-nav {
  margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--trait);
}
nav.laterale .pied-nav a { font-size: 14px; color: var(--gris); }
nav.laterale .pied-nav a:hover { color: var(--encre); }

/* --- Présentations de 10 minutes ------------------------------------------ */

.planning td { vertical-align: top; }
.planning .date { white-space: nowrap; font-weight: 700; }
.planning .date small { display: block; font-weight: 400; color: var(--gris); }
.planning .fichier { font-size: 14px; }
.planning .fichier small { display: block; color: var(--gris); }
.planning form { display: inline; }
.planning .actions-ligne { white-space: nowrap; text-align: right; }
.planning tr.passee td { color: var(--gris); }

.presentation-prevue {
  display: grid; grid-template-columns: 76px 1fr; gap: 16px; align-items: center;
  padding: 14px 16px; border-radius: 7px; background: var(--fond); margin-bottom: 16px;
}
.presentation-prevue img, .presentation-prevue .sans-photo {
  width: 76px; height: 76px; object-fit: cover; border-radius: 6px; background: #fff;
}
.presentation-prevue .sans-photo {
  display: flex; align-items: center; justify-content: center;
  font-family: var(--titre); font-size: 26px; color: var(--rouge);
}
.presentation-prevue h3 { margin: 0 0 2px; font-size: 20px; }
.presentation-prevue p { margin: 0; color: var(--gris); }
.fichier-externe {
  display: flex; gap: 14px; align-items: flex-start; justify-content: space-between;
  padding: 12px 14px; border: 1px solid var(--trait); border-radius: 7px; margin-bottom: 14px;
}
.fichier-externe strong { display: block; word-break: break-all; }
.fichier-externe .details { font-size: 14px; color: var(--gris); margin: 2px 0 0; }
.fichier-externe ul { margin: 8px 0 0; padding-left: 18px; font-size: 14px; color: var(--alerte); }
.fichier-externe button { white-space: nowrap; }
.indice { font-size: 14px; color: var(--gris); margin: 6px 0 0; }
.puces-membres { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.puces-membres span {
  font-size: 13px; padding: 3px 10px; border-radius: 12px; background: var(--fond);
}

/* --- Site web --------------------------------------------------------------- */

.bloc .entete-bloc { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.bloc .entete-bloc .page { font-size: 13px; color: var(--gris); white-space: nowrap; }
.apercu-site { max-height: 120px; max-width: 220px; border-radius: 6px; display: block; }
.retirer-image { margin-top: 8px; }
textarea.etapes { min-height: 150px; }

/* --- Messages ---------------------------------------------------------------- */

.message { border: 1px solid var(--trait); border-radius: 8px; padding: 16px 18px; margin-bottom: 14px; }
.message.non-lu { border-color: var(--rouge); box-shadow: inset 3px 0 0 var(--rouge); }
.message .entete-message { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; }
.message .entete-message strong { font-size: 17px; }
.message .entete-message time { color: var(--gris); font-size: 14px; margin-left: auto; }
.message .coordonnees { font-size: 14px; margin: 4px 0 10px; }
.message .texte { white-space: pre-line; margin: 0 0 12px; }
.message form { display: inline; }

/* --- Connexion ---------------------------------------------------------- */

body.connexion { background: var(--fond); }
.carte-connexion {
  max-width: 380px; margin: 12vh auto; padding: 34px 32px 30px;
  background: #fff; border: 1px solid var(--trait); border-radius: 10px;
}
.carte-connexion img { width: 168px; height: auto; display: block; margin-bottom: 22px; }
.carte-connexion .retour-site { margin: 18px 0 0; font-size: 14px; }

/* --- Téléphone et écran étroit ------------------------------------------
   La plateforme s'installe sur l'écran d'accueil : elle doit rester
   utilisable à une main, sur un écran de 390 points de large. */

@media (max-width: 860px) {
  .cadre { flex-direction: column; }

  /* La barre latérale devient un bandeau horizontal défilant. */
  nav.laterale {
    width: auto; flex: none;
    border-right: none; border-bottom: 1px solid var(--trait);
    padding: 14px 0 0;
    position: sticky; top: 0; z-index: 10;
    padding-top: calc(14px + env(safe-area-inset-top));
  }
  nav.laterale .marque {
    padding: 0 16px 12px;
    display: flex; align-items: center; gap: 12px;
  }
  nav.laterale .marque img { width: 104px; }
  nav.laterale .marque .sous { margin: 0; }

  nav.laterale a {
    display: inline-block;
    border-left: none; border-bottom: 3px solid transparent;
    padding: 9px 16px; white-space: nowrap;
  }
  nav.laterale a.actif { border-left: none; border-bottom-color: var(--rouge); }

  /* Le bandeau défile horizontalement quand les entrées ne tiennent pas. */
  nav.laterale { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  main {
    padding: 22px 16px 60px;
    padding-bottom: calc(60px + env(safe-area-inset-bottom));
    max-width: none;
  }

  h1 { font-size: 27px; }
  h2 { font-size: 19px; }

  .bloc { padding: 16px 15px; border-radius: 7px; }

  /* Les tableaux défilent au doigt plutôt que de casser la mise en page. */
  main table {
    display: block; overflow-x: auto; -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  .grille.g2, .grille.g3 { grid-template-columns: 1fr; }

  .mesures { flex-wrap: wrap; gap: 22px 32px; }
  .mesure .valeur { font-size: 36px; }

  .actions { flex-wrap: wrap; }
  button, .bouton { padding: 11px 18px; }

  /* En dessous de 16 px, iOS zoome à la mise au point du champ. */
  input[type=text], input[type=date], input[type=number], input[type=email],
  input[type=tel], input[type=password], input[type=search], select, textarea { font-size: 16px; }

  .vignette, .vignette img { width: 128px; }
  .vignette img { height: 86px; }

  .video-en-place { flex-direction: column; }
  nav.laterale .pied-nav { display: inline-block; margin: 0; padding: 0; border: none; }
  .fichier-externe { flex-direction: column; }
  .presentation-prevue { grid-template-columns: 56px 1fr; }
  .presentation-prevue img, .presentation-prevue .sans-photo { width: 56px; height: 56px; }
  .video-en-place video { width: 100%; }
  table.grille-invites input[type=text] { min-width: 150px; }
}

@media (max-width: 460px) {
  nav.laterale .marque img { width: 88px; }
  h1 { font-size: 24px; }
  main { padding-left: 13px; padding-right: 13px; }
}

/* En mode application installée, l'entête colle au bord haut de l'écran. */
@media (display-mode: standalone) {
  nav.laterale { background: #fff; }
}

/* --- Membres absents ou excusés (page séance, bloc de génération) ------- */

details.absences {
  margin: 0 0 18px; border: 1px solid var(--trait); border-radius: 8px;
  padding: 0 16px; background: #fff;
}
details.absences[open] { padding-bottom: 14px; }
details.absences summary {
  cursor: pointer; padding: 12px 0; font-weight: 700; list-style-position: inside;
}
details.absences summary .compte {
  margin-left: 8px; font-weight: 400; color: var(--gris); font-size: 14px;
}
details.absences .sous { margin-top: 0; }
.grille-absents {
  display: grid; gap: 6px 18px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.case-absent {
  display: flex; align-items: flex-start; gap: 9px; margin: 0;
  padding: 7px 9px; border-radius: 6px; font-weight: 400; cursor: pointer;
}
.case-absent:hover { background: var(--fond); }
.case-absent input { width: auto; margin: 3px 0 0; flex: none; accent-color: var(--rouge); }
.case-absent span { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.case-absent strong { font-weight: 700; font-size: 15px; }
.case-absent small { color: var(--gris); font-size: 13px; }
.case-absent:has(input:checked:not(:disabled)) { background: var(--rouge-pale); }
.case-absent:has(input:checked:not(:disabled)) strong { color: var(--rouge-sombre); }
.case-absent.remplace { cursor: default; opacity: .75; }

/* --- Connexion, mot de passe -------------------------------------------- */

.facultatif { font-weight: 400; color: var(--gris); font-size: 13px; }
.carte-connexion .aide-connexion { margin: 16px 0 0; font-size: 14px; line-height: 1.5; }
.carte-connexion .aide-connexion span { color: var(--gris); font-size: 13px; }
.carte-connexion .actions { flex-wrap: wrap; }
nav.laterale .pied-nav .connecte {
  display: block; font-size: 13px; color: var(--encre); font-weight: 700; padding: 0 22px 6px;
}
.masque-visuel {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap;
}
.sous-texte { color: var(--gris); font-size: 14px; }
.defilement-tableau { overflow-x: auto; }

/* --- Agenda ------------------------------------------------------------- */

.g-agenda { grid-template-columns: 170px 1.3fr 1fr; }
.date-agenda { white-space: nowrap; font-variant-numeric: tabular-nums; }
table.liste-agenda tr.en-edition td { background: var(--rouge-pale); }
h3.ajout-agenda { font-size: 15px; margin: 18px 0 10px; }
.formulaire-agenda { padding-top: 2px; }
ul.apercu-agenda { list-style: none; padding: 0; margin: 0 0 6px; }
ul.apercu-agenda li { padding: 5px 0; border-bottom: 1px solid var(--trait); }
ul.apercu-agenda .date-agenda { font-weight: 700; margin-right: 6px; }
details.passes-agenda summary { cursor: pointer; }

/* --- Anciens invités ---------------------------------------------------- */

.recherche-invites { display: flex; align-items: center; gap: 14px; margin: 0 0 14px; }
.recherche-invites input { max-width: 460px; }
table.liste-invites td { vertical-align: top; }
table.liste-invites tr[hidden] { display: none; }

/* --- Accès membres ------------------------------------------------------ */

.interrupteur-acces { border-left: 5px solid var(--trait); }
.interrupteur-acces.est-ouvert { border-left-color: #3a8a3a; }
.interrupteur-acces.est-ferme { border-left-color: var(--rouge); }
.interrupteur-acces .etat-acces { font-family: var(--titre); }
.interrupteur-acces.est-ouvert .etat-acces { color: #2c6b2c; }
.interrupteur-acces.est-ferme .etat-acces { color: var(--rouge); }
.interrupteur-ligne { display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.bascule {
  display: inline-flex; flex: none; border: 1px solid var(--trait); border-radius: 22px;
  padding: 3px; background: var(--fond);
}
.bascule label { margin: 0; cursor: pointer; }
.bascule input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.bascule span {
  display: block; padding: 7px 18px; border-radius: 18px; font-weight: 700; font-size: 15px;
  color: var(--gris);
}
.bascule input:checked + span { background: #fff; color: var(--encre); box-shadow: 0 1px 3px rgba(0, 0, 0, .18); }
.bascule input[value="ouvert"]:checked + span { color: #2c6b2c; }
.bascule input[value="ferme"]:checked + span { color: var(--rouge); }
.bascule input:focus-visible + span { outline: 2px solid var(--rouge); outline-offset: 1px; }
.champ[hidden] { display: none; }

.selection-rapide { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; margin-bottom: 8px; }
.selection-rapide button.discret { text-decoration: underline; text-underline-offset: 3px; }
table.liste-acces td { vertical-align: top; }
table.liste-acces input[type=checkbox] { width: auto; accent-color: var(--rouge); }
.jeton.attente { background: #fdf3e2; color: var(--alerte); }
.barre-masse {
  display: grid; gap: 14px; margin-top: 6px; padding: 16px; border-radius: 8px;
  background: var(--fond);
}
.barre-masse .champ[hidden] { display: none; }

@media (max-width: 860px) {
  .g-agenda { grid-template-columns: 1fr; }
  .interrupteur-ligne { flex-direction: column; align-items: flex-start; }
  .recherche-invites { flex-direction: column; align-items: stretch; }
}
