/* =================================================================
   MDA - feuille de style unique. Telephone d'abord, puis elargie
   pour les postes de la mairie. Aucune police a telecharger.
   ================================================================= */

:root {
  --marine:       #092A52;
  --marine-clair: #14479b;
  --accent:       #8ab4dd;

  --fond:        #f4f6f9;
  --carte:       #ffffff;
  --bord:        #c9d8ee;
  --bord-doux:   #e2e8f2;
  --texte:       #10192a;
  --texte-doux:  #566275;

  --ok:          #1d7a4c;
  --ok-fond:     #e4f4ea;
  --danger:      #b3261e;
  --danger-fond: #fdeae8;
  --attente:     #a4620a;
  --attente-fond:#fdf1de;
  --info:        #1f6b7a;
  --info-fond:   #e4f1f3;
  --neutre-fond: #eef1f6;

  --rayon:       12px;
  --ombre:       0 1px 2px rgba(9,42,82,.07), 0 4px 16px rgba(9,42,82,.07);
  --barre-haute: 66px;

  --degrade:      linear-gradient(135deg, #14479b 0%, #092A52 100%);
  --degrade-fond: linear-gradient(180deg, #eff4fc 0%, #f6f9fd 240px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px; line-height: 1.5;
  color: var(--texte);
  background: var(--fond);
  background-image: var(--degrade-fond);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--marine-clair); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 750; color: var(--marine); }
h1 { font-size: 1.34rem; letter-spacing: -.2px; }
h2 { font-size: 1.08rem; margin-bottom: .6rem; }
h3 { font-size: .98rem; margin: 1.4rem 0 .5rem; }
p { margin: 0 0 .7em; }
p:last-child { margin-bottom: 0; }
code { background: var(--neutre-fond); padding: 2px 6px; border-radius: 6px;
  font-size: .92em; font-family: ui-monospace, Consolas, monospace; }

.discret { color: var(--texte-doux); font-weight: 400; }
.ic { flex: none; }

/* ------------------------------ Entete ---------------------------- */

.entete {
  position: sticky; top: 0; z-index: 40;
  background: var(--marine); background-image: var(--degrade);
  color: #fff; padding-top: env(safe-area-inset-top);
  box-shadow: 0 1px 0 rgba(0,0,0,.15);
}
.entete-in {
  display: flex; align-items: center; gap: 12px;
  height: var(--barre-haute); padding: 0 14px;
  max-width: 1180px; margin: 0 auto;
}
.marque { display: flex; align-items: center; gap: 10px; color: #fff;
  min-width: 0; flex: 1 1 auto; }
.marque:hover { text-decoration: none; }
.marque-pastille {
  display: grid; place-items: center; flex: none;
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.28);
  font-weight: 800; font-size: 1.05rem;
}
.marque-pastille.grande { width: 54px; height: 54px; font-size: 1.5rem;
  background: var(--marine); border-color: var(--marine); color: #fff; }
.marque-texte { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.marque-texte b { font-size: 1.02rem; }
.marque-texte small { font-size: .74rem; opacity: .78;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.entete-fin { display: flex; align-items: center; gap: 6px; flex: none; }
.qui { display: flex; align-items: center; gap: 8px; color: #fff; max-width: 260px; }
.qui:hover { text-decoration: none; }
.qui-texte { font-size: .84rem; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; opacity: .9; }
.pastille { display: grid; place-items: center; flex: none;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,.18); font-size: .78rem; font-weight: 700; }
.lien-sortie { color: #fff; opacity: .8; padding: 6px; display: grid; place-items: center; }
.lien-sortie:hover { opacity: 1; }

@media (max-width: 620px) { .qui-texte { display: none; } }

/* ------------------------------ Onglets --------------------------- */

.onglets { position: sticky; top: calc(var(--barre-haute) + env(safe-area-inset-top));
  z-index: 30; background: var(--carte); border-bottom: 1px solid var(--bord-doux); }
.onglets-in { display: flex; gap: 2px; max-width: 1180px; margin: 0 auto;
  padding: 0 8px; overflow-x: auto; scrollbar-width: none; }
.onglets-in::-webkit-scrollbar { display: none; }
.onglets a { display: flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 12px 12px 10px; color: var(--texte-doux); font-size: .9rem; font-weight: 600;
  border-bottom: 3px solid transparent; }
.onglets a:hover { color: var(--marine); text-decoration: none; }
.onglets a.actif { color: var(--marine); border-bottom-color: var(--marine); }
@media (max-width: 520px) { .onglets a span { display: none; } .onglets a { padding: 12px 16px 10px; } }

/* ------------------------------- Page ----------------------------- */

.page { max-width: 1180px; margin: 0 auto; padding: 18px 14px 60px; }
.retour { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 12px;
  font-size: .9rem; font-weight: 600; color: var(--texte-doux); }
.pied { max-width: 1180px; margin: 0 auto; padding: 0 14px 30px;
  color: var(--texte-doux); font-size: .8rem; }

.titre-page h1 .compteur { display: inline-block; margin-left: .5rem; padding: .15rem .6rem;
  border-radius: 999px; background: var(--neutre-fond); color: var(--marine);
  font-size: .8rem; font-weight: 600; vertical-align: middle; letter-spacing: 0; }
.titre-page { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }

.carte { background: var(--carte); border: 1px solid var(--bord-doux);
  border-radius: var(--rayon); box-shadow: var(--ombre);
  padding: 18px; margin-bottom: 16px; }
.sous-titre { color: var(--texte-doux); margin-top: 2px; }
.intro { color: var(--texte-doux); }

.vide { padding: 22px; text-align: center; color: var(--texte-doux);
  background: var(--neutre-fond); border-radius: var(--rayon); font-size: .92rem; }

/* ----------------------------- Bandeaux --------------------------- */

.bandeau { border-radius: var(--rayon); padding: 12px 14px; margin-bottom: 16px;
  font-size: .94rem; border: 1px solid transparent; }
.bandeau.info    { background: var(--info-fond);    border-color: #bcdfe4; color: #14505c; }
.bandeau.ok      { background: var(--ok-fond);      border-color: #b9e2c9; color: #14572f; }
.bandeau.attente { background: var(--attente-fond); border-color: #f0d5a6; color: #7a4707; }
.bandeau.danger  { background: var(--danger-fond);  border-color: #f2c2bd; color: #8c1b15; }
.bandeau a { color: inherit; text-decoration: underline; }

.alerte-inline { color: var(--danger); font-weight: 600; }
.etat-ok { color: var(--ok); } .etat-danger { color: var(--danger); }
.etat-attente { color: var(--attente); }

/* ------------------------------ Badges ---------------------------- */

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: .74rem; font-weight: 700; letter-spacing: .1px; white-space: nowrap; }
.badge.neutre  { background: var(--neutre-fond);  color: var(--texte-doux); }
.badge.info    { background: var(--info-fond);    color: #14505c; }
.badge.ok      { background: var(--ok-fond);      color: #14572f; }
.badge.attente { background: var(--attente-fond); color: #7a4707; }
.badge.danger  { background: var(--danger-fond);  color: #8c1b15; }

/* ----------------------------- Boutons ---------------------------- */

.bouton, button.bouton {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  padding: 10px 16px; border-radius: 10px; border: 1px solid var(--marine);
  background: var(--marine); color: #fff; font: inherit; font-size: .93rem;
  font-weight: 650; cursor: pointer; text-decoration: none;
}
.bouton:hover { background: #0d3568; text-decoration: none; }
.bouton.fantome { background: var(--carte); color: var(--marine); border-color: var(--bord); }
.bouton.fantome:hover { background: var(--neutre-fond); }
.bouton.danger { background: var(--danger); border-color: var(--danger); }
.bouton.danger:hover { background: #96201a; }
.bouton[disabled], .mini[disabled] { opacity: .45; cursor: not-allowed; }

.mini { padding: 5px 10px; border-radius: 8px; border: 1px solid var(--marine);
  background: var(--marine); color: #fff; font: inherit; font-size: .8rem;
  font-weight: 650; cursor: pointer; }
.mini.fantome { background: var(--carte); color: var(--marine); border-color: var(--bord); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; align-items: center; }
.actions form { margin: 0; }

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

.formulaire { margin-top: 4px; }
.champ { margin-bottom: 14px; }
.champ label { display: block; font-size: .84rem; font-weight: 650;
  color: var(--texte-doux); margin-bottom: 5px; }
.requis { color: var(--danger); }
.champ input, .champ select, .champ textarea, .filtres-ligne input, .filtres-ligne select {
  width: 100%; padding: 10px 12px; font: inherit; font-size: .95rem;
  color: var(--texte); background: var(--carte);
  border: 1px solid var(--bord); border-radius: 10px;
}
.champ input:focus, .champ select:focus, .champ textarea:focus {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--marine-clair);
}
.champ textarea { resize: vertical; }
.aide { font-size: .82rem; color: var(--texte-doux); margin-top: 5px; }
.grille2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 560px) { .grille2 { grid-template-columns: 1fr; } }

.case { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; cursor: pointer; }
.case input { margin-top: 3px; width: 17px; height: 17px; flex: none; accent-color: var(--marine); }
.case span { font-size: .93rem; }
.case small { display: block; color: var(--texte-doux); font-size: .82rem; }
.cases { display: flex; flex-direction: column; }

.choix-recurrence { display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-bottom: 12px; }
.choix-recurrence .case { border: 1px solid var(--bord); border-radius: 10px;
  padding: 10px 12px; background: var(--carte); }
@media (max-width: 560px) { .choix-recurrence { grid-template-columns: 1fr; } }

.ligne-date { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ligne-date input[type=date] { flex: 1 1 44%; }
.ligne-date input[type=time] { flex: 0 1 120px; }
.ligne-date input { padding: 9px 10px; font: inherit; font-size: .93rem;
  border: 1px solid var(--bord); border-radius: 10px; background: var(--carte); }
.ligne-date .a { color: var(--texte-doux); font-size: .85rem; }
.ligne-date .retirer { flex: none; width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid var(--bord); background: var(--carte); color: var(--texte-doux);
  font-size: 1.1rem; line-height: 1; cursor: pointer; }
@media (max-width: 560px) { .ligne-date { flex-wrap: wrap; }
  .ligne-date input[type=date] { flex: 1 1 100%; } }

.couleurs { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.pastille-couleur { width: 30px; height: 30px; border-radius: 50%;
  background: var(--teinte); display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 0 0 2px var(--carte), 0 0 0 3px transparent; }
.pastille-couleur:has(input:checked) { box-shadow: 0 0 0 2px var(--carte), 0 0 0 4px var(--marine); }
.pastille-couleur input { appearance: none; margin: 0; width: 100%; height: 100%; }

/* ----------------------------- Filtres ---------------------------- */

.filtres { margin-bottom: 16px; }
.puces { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 10px; }
.puce { padding: 6px 13px; border-radius: 999px; font-size: .85rem; font-weight: 600;
  background: var(--carte); border: 1px solid var(--bord); color: var(--texte-doux); }
.puce:hover { text-decoration: none; background: var(--neutre-fond); }
.puce.actif { background: var(--marine); border-color: var(--marine); color: #fff; }
.filtres-ligne { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filtres-ligne select { flex: 0 1 220px; }
.filtres-ligne input[type=search] { flex: 1 1 200px; }

/* ------------------------------ Listes ---------------------------- */

.liste { display: grid; gap: 10px; }
.carte-liste { display: block; background: var(--carte); border: 1px solid var(--bord-doux);
  border-left: 4px solid var(--teinte, var(--bord)); border-radius: var(--rayon);
  padding: 13px 15px; box-shadow: var(--ombre); color: inherit; }
.carte-liste:hover { text-decoration: none; border-color: var(--bord);
  transform: translateY(-1px); transition: transform .1s; }
.cl-haut { display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 4px; flex-wrap: wrap; }
.cl-titre { font-weight: 700; color: var(--marine); }
.cl-meta { font-size: .87rem; color: var(--texte-doux); }
.ref { font-family: ui-monospace, Consolas, monospace; font-size: .82rem;
  color: var(--texte-doux); font-weight: 700; }

.ligne-occupation { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: 10px; color: inherit;
  border-left: 4px solid var(--teinte, var(--bord)); background: var(--neutre-fond);
  margin-bottom: 7px; font-size: .92rem; }
.ligne-occupation:hover { text-decoration: none; background: #e6ebf4; }
.ligne-occupation b { color: var(--marine); flex: none; }
.occ-qui { color: var(--texte-doux); flex: 1 1 200px; }

.ligne-fermeture { display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--bord-doux); font-size: .92rem; }
.ligne-fermeture:last-of-type { border-bottom: 0; }

.pieces { list-style: none; padding: 0; margin: 0 0 12px; }
.pieces li { padding: 6px 0; border-bottom: 1px solid var(--bord-doux); font-size: .92rem; }
.pieces li:last-child { border-bottom: 0; }

.conseils { margin: 0; padding-left: 20px; color: var(--texte-doux); font-size: .93rem; }
.conseils li { margin-bottom: 8px; }

/* ------------------------------ Fiches ---------------------------- */

.fiche { display: grid; grid-template-columns: 190px 1fr; gap: 0; margin: 14px 0 0; }
.fiche dt { font-size: .84rem; font-weight: 650; color: var(--texte-doux);
  padding: 9px 0; border-top: 1px solid var(--bord-doux); }
.fiche dd { margin: 0; padding: 9px 0; border-top: 1px solid var(--bord-doux); }
@media (max-width: 620px) {
  .fiche { grid-template-columns: 1fr; }
  .fiche dt { padding-bottom: 0; border-top: 1px solid var(--bord-doux); }
  .fiche dd { padding-top: 2px; border-top: 0; }
}

/* ----------------------------- Tuiles ----------------------------- */

.tuiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.tuile { display: flex; flex-direction: column; gap: 2px; padding: 14px;
  background: var(--carte); border: 1px solid var(--bord-doux); border-radius: var(--rayon);
  box-shadow: var(--ombre); color: var(--texte-doux); }
.tuile:hover { text-decoration: none; }
.tuile b { font-size: 1.7rem; color: var(--marine); line-height: 1.1; }
.tuile span { font-size: .82rem; }
.tuile.attention { border-color: #f0d5a6; background: var(--attente-fond); }
.tuile.attention b { color: var(--attente); }
@media (max-width: 760px) { .tuiles { grid-template-columns: 1fr 1fr; } }

/* ---------------------------- Creneaux ---------------------------- */

.creneau { display: grid; grid-template-columns: 1fr auto; gap: 8px 14px;
  align-items: center; padding: 11px 13px; margin-bottom: 8px;
  border: 1px solid var(--bord-doux); border-left: 4px solid var(--bord);
  border-radius: 10px; background: var(--carte); }
.creneau.retenu { border-left-color: var(--ok); background: #f6fbf8; }
.creneau.refuse { border-left-color: var(--danger); background: #fdf7f6; }
.creneau.annule { opacity: .6; }
.creneau-quand { display: flex; flex-direction: column; }
.creneau-quand b { color: var(--marine); font-size: .95rem; }
.creneau-quand span { color: var(--texte-doux); font-size: .87rem; }
.creneau-etat { text-align: right; }
.creneau-etat small { display: block; color: var(--texte-doux); font-size: .8rem; }
.obstacles { grid-column: 1 / -1; margin: 0; padding-left: 18px;
  color: var(--danger); font-size: .84rem; }
.boutons-creneau { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }

.decision { border-left: 4px solid var(--marine); }

/* ------------------------------ Fil ------------------------------- */

.fil { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.message { padding: 11px 13px; border-radius: 10px; background: var(--neutre-fond); }
.message.mairie { background: var(--info-fond); }
.message.interne { background: var(--attente-fond); border: 1px dashed #e0be86; }
.message-qui { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: .85rem; font-weight: 650; color: var(--marine); margin-bottom: 4px; }
.message-qui .quand { margin-left: auto; font-weight: 400; color: var(--texte-doux);
  font-size: .8rem; }
.message-texte { font-size: .94rem; }

/* ---------------------------- Planning ---------------------------- */

.navigation-periode { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 14px 0; }
.navigation-periode b { color: var(--marine); font-size: .98rem; text-align: center; }

.semaine { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
@media (max-width: 900px) { .semaine { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .semaine { grid-template-columns: 1fr; } }
.jour { background: var(--carte); border: 1px solid var(--bord-doux);
  border-radius: var(--rayon); padding: 10px; min-height: 110px; }
.jour.weekend { background: #fbfcfe; }
.jour.aujourdhui { border-color: var(--marine); box-shadow: 0 0 0 1px var(--marine); }
.jour-entete { display: flex; flex-direction: column; margin-bottom: 8px;
  padding-bottom: 6px; border-bottom: 1px solid var(--bord-doux); }
.jour-entete b { font-size: .88rem; color: var(--marine); text-transform: capitalize; }
.jour-entete small { font-size: .76rem; color: var(--texte-doux); }
.jour-vide { color: var(--texte-doux); font-size: .82rem; padding: 6px 0; }
.jour-ferme { background: var(--danger-fond); color: #8c1b15; border-radius: 8px;
  padding: 5px 8px; font-size: .78rem; margin-bottom: 6px; }

.cr { display: flex; gap: 8px; align-items: flex-start; padding: 7px 9px;
  border-radius: 8px; margin-bottom: 6px; color: inherit; font-size: .82rem;
  background: color-mix(in srgb, var(--teinte) 12%, white);
  border-left: 3px solid var(--teinte); }
.cr:hover { text-decoration: none; filter: brightness(.97); }
.cr.demande { background: repeating-linear-gradient(135deg,
  rgba(0,0,0,.03) 0 6px, transparent 6px 12px), #fbfcfe; border-left-style: dashed; }
.cr-heure { font-weight: 700; color: var(--marine); flex: none; }
.cr-corps { display: flex; flex-direction: column; min-width: 0; }
.cr-corps b { font-weight: 650; }
.cr-corps small { color: var(--texte-doux); font-size: .76rem;
  overflow: hidden; text-overflow: ellipsis; }
.cr-etat { margin-left: auto; font-size: .68rem; color: var(--texte-doux);
  text-transform: uppercase; letter-spacing: .3px; }

.mois { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.mois-entete { text-align: center; font-size: .78rem; font-weight: 700;
  color: var(--texte-doux); padding: 4px 0; }
.mois-case { background: var(--carte); border: 1px solid var(--bord-doux);
  border-radius: 8px; min-height: 88px; padding: 5px; display: flex;
  flex-direction: column; gap: 3px; }
.mois-case.hors { background: #f8fafc; opacity: .55; }
.mois-case.aujourdhui { border-color: var(--marine); box-shadow: inset 0 0 0 1px var(--marine); }
.mois-case.ferme { background: var(--danger-fond); }
.mois-num { font-size: .8rem; font-weight: 700; color: var(--texte-doux); }
.pastille-cr { display: block; font-size: .68rem; padding: 2px 5px; border-radius: 5px;
  background: color-mix(in srgb, var(--teinte) 16%, white);
  border-left: 3px solid var(--teinte); color: var(--texte);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pastille-cr.demande { opacity: .6; border-left-style: dashed; }
.pastille-plus { font-size: .68rem; color: var(--texte-doux); }
@media (max-width: 620px) {
  .mois-case { min-height: 58px; }
  .pastille-cr { font-size: 0; padding: 3px; }
}
.legende { color: var(--texte-doux); font-size: .82rem; margin-top: 14px; }

/* ----------------------------- Comptes ---------------------------- */

.ligne-compte { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px;
  padding: 12px 0; border-bottom: 1px solid var(--bord-doux); align-items: center; }
.lc-qui { display: flex; flex-direction: column; min-width: 0; }
.lc-qui small { font-size: .82rem; color: var(--texte-doux); }
.lc-etat { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.lc-actions { grid-column: 1 / -1; display: flex; gap: 7px; flex-wrap: wrap; }

.journal { width: 100%; border-collapse: collapse; font-size: .84rem; }
.journal td { padding: 6px 8px 6px 0; border-bottom: 1px solid var(--bord-doux);
  vertical-align: top; }

/* --------------------------- Pages nues --------------------------- */

body.nue { background-image: none; background: var(--fond); }
.accueil-nu { max-width: 560px; margin: 0 auto; padding: 40px 18px 60px; }
.marque-nue { text-align: center; margin-bottom: 24px; }
.marque-nue h1 { font-size: 1.9rem; margin-top: 12px; }
.marque-nue p { color: var(--texte-doux); }
.sous-carte { text-align: center; font-size: .9rem; margin-top: 14px; }

/* ------------------------- Onglets de salle ----------------------- */

.salles-onglets { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 10px; }
.puce-salle { padding: 7px 14px; border-radius: 999px; font-size: .87rem; font-weight: 650;
  background: var(--carte); border: 1px solid var(--bord); color: var(--texte-doux);
  border-left: 4px solid var(--teinte, var(--bord)); }
.puce-salle:hover { text-decoration: none; background: var(--neutre-fond); }
.puce-salle.actif { background: var(--marine); border-color: var(--marine);
  border-left-color: var(--teinte, var(--marine)); color: #fff; }
.vues-ligne { margin-bottom: 4px; }
.vues { display: flex; gap: 6px; flex-wrap: wrap; }

/* --------------------------- Grille horaire ----------------------- *
   Les jours en colonnes, les heures sur le cote. Une salle a la fois :
   superposer quatre salles sur une meme colonne d'heures ne se lit
   plus. La hauteur d'une demi-heure vient du serveur (--pas), le
   nombre de lignes aussi (--lignes) : l'amplitude d'ouverture de
   chaque salle commande la grille.
   ------------------------------------------------------------------ */

/* La grille defile dans sa propre fenetre, verticalement comme
   horizontalement.

   C'est ce qui permet aux jours de rester en haut et aux heures a
   gauche pendant qu'on parcourt la journee. Une regle « collante » ne
   tient qu'a l'interieur de la boite qui defile : tant que cette boite
   grandissait avec son contenu, il n'y avait rien a quoi se coller —
   et coller les entetes a la page se heurtait aux deux barres fixes de
   l'application. Une fenetre a soi resout les deux. */
.grille-cadre { overflow: auto; max-height: 70vh;
  background: var(--carte); border: 1px solid var(--bord-doux);
  border-radius: var(--rayon); box-shadow: var(--ombre); padding: 0 0 8px; }
.grille { display: grid; grid-template-columns: 54px repeat(7, minmax(92px, 1fr));
  min-width: 720px; }

/* L'angle haut-gauche tient les deux : il ne bouge ni en hauteur ni
   en largeur, et passe donc au-dessus de tout le reste. */
.grille-coin { position: sticky; top: 0; left: 0; z-index: 6;
  background: var(--carte); border-bottom: 1px solid var(--bord); }
.grille-jour-entete {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 8px 4px; background: var(--carte);
  border-bottom: 1px solid var(--bord); border-left: 1px solid var(--bord-doux); }
.grille-jour-entete b { font-size: .84rem; color: var(--marine); text-transform: capitalize; }
.grille-jour-entete small { font-size: .7rem; color: var(--texte-doux); }
.grille-jour-entete.weekend { background: #f7f9fc; }
.grille-jour-entete.aujourdhui { background: var(--marine); }
.grille-jour-entete.aujourdhui b,
.grille-jour-entete.aujourdhui small { color: #fff; }

.grille-heures { display: grid; grid-template-rows: repeat(var(--lignes), var(--pas));
  padding-top: 2px; }
.grille-heure { grid-column: 1; justify-self: end; padding-right: 7px;
  font-size: .72rem; font-weight: 600; color: var(--texte-doux);
  transform: translateY(-0.55em); white-space: nowrap; }

.grille-colonne { position: relative; display: grid;
  grid-template-rows: repeat(var(--lignes), var(--pas));
  border-left: 1px solid var(--bord-doux); padding-top: 2px;
  /* Un trait fin toutes les demi-heures, plus marque a l'heure pleine. */
  background-image:
    repeating-linear-gradient(to bottom,
      var(--bord-doux) 0 1px, transparent 1px calc(var(--pas) * 2)),
    repeating-linear-gradient(to bottom,
      #f0f3f8 0 1px, transparent 1px var(--pas));
  background-position: 0 2px;
}
.grille-colonne.weekend { background-color: #fbfcfe; }
.grille-colonne.aujourdhui { background-color: #f5f8fd; box-shadow: inset 0 0 0 1px var(--accent); }
.grille-colonne.trop-tot { background-color: #f6f7f9; }

/* Une case libre : discrete au repos, franche au survol. Elle ne
   s'affiche que pour qui a le droit de deposer. */
.libre { grid-column: 1; margin: 1px 2px; border-radius: 6px;
  display: grid; place-items: center start; padding-left: 6px;
  font-size: .7rem; font-weight: 700;
  color: transparent; border: 1px dashed transparent; }
.libre:hover { text-decoration: none; color: var(--marine);
  background: color-mix(in srgb, var(--marine) 9%, white);
  border-color: var(--marine-clair); }
.libre:focus-visible { outline: 2px solid var(--marine); color: var(--marine); }

.bloc { grid-column: 1; position: relative; z-index: 2; overflow: hidden;
  margin: 1px 2px; padding: 3px 6px; border-radius: 7px; color: var(--texte);
  background: color-mix(in srgb, var(--teinte) 17%, white);
  border-left: 3px solid var(--teinte); line-height: 1.2; }
.bloc:hover { text-decoration: none; filter: brightness(.96); }
.bloc b { display: block; font-size: .7rem; color: var(--marine); }
.bloc span { display: block; font-size: .74rem; font-weight: 650;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bloc small { display: block; font-size: .68rem; color: var(--texte-doux);
  overflow: hidden; }
/* Une option n'est pas une reservation : elle est en filigrane.
   Hachuree, en trait interrompu, sans couleur pleine — la couleur est
   reservee a ce que la maison des associations a valide, et l'oeil
   doit faire la difference d'un coup, sans lire.

   Sa position horizontale vient du serveur : plusieurs clubs peuvent
   viser le meme creneau, et chaque option prend alors sa voie dans la
   partie droite de la colonne. La bande de gauche reste au clic. */
.bloc.demande { z-index: 3;
  border-left-style: dashed;
  border-left-color: color-mix(in srgb, var(--teinte) 55%, white);
  background-color: rgba(255, 255, 255, .88);
  background-image: repeating-linear-gradient(135deg,
    color-mix(in srgb, var(--teinte) 24%, transparent) 0 4px, transparent 4px 9px);
  color: var(--texte-doux); }
.bloc.demande b { color: var(--texte-doux); font-weight: 600; }
.bloc.demande span { font-weight: 600; }
/* Sa propre option, reperee d'un trait : dans une colonne ou trois
   clubs se sont declares, on doit retrouver la sienne. */
.bloc.sien { box-shadow: 0 0 0 1.5px var(--marine-clair); }

.grille-fermee { grid-column: 1; z-index: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px; margin: 1px 2px;
  border-radius: 7px; font-size: .74rem; font-weight: 650; color: #8c1b15;
  background-color: var(--danger-fond);
  background-image: repeating-linear-gradient(135deg,
    rgba(179,38,30,.10) 0 6px, transparent 6px 12px); }
.grille-fermee small { font-weight: 400; font-size: .7rem; text-align: center;
  padding: 0 6px; }

.legende-grille { display: flex; gap: 16px; flex-wrap: wrap; margin: 12px 0 0;
  font-size: .82rem; color: var(--texte-doux); }
.legende-grille span { display: inline-flex; align-items: center; gap: 7px; }
.legende-grille .ex { width: 20px; height: 13px; border-radius: 4px; flex: none;
  border-left: 3px solid var(--marine-clair);
  background: color-mix(in srgb, var(--marine-clair) 17%, white); }
.legende-grille .ex.demande { border-left-style: dashed;
  border-left-color: color-mix(in srgb, var(--marine-clair) 55%, white);
  background-color: #fff;
  background-image: repeating-linear-gradient(135deg,
    color-mix(in srgb, var(--marine-clair) 24%, transparent) 0 3px, transparent 3px 7px); }
.legende-grille .ex.libre { border: 1px dashed var(--marine-clair); background: #fff; }
.legende-grille .ex.fermee { border-left-color: var(--danger);
  background-color: var(--danger-fond); }

@media (max-width: 620px) {
  .grille { grid-template-columns: 44px repeat(7, minmax(74px, 1fr)); min-width: 600px; }
  .bloc small { display: none; }
}

/* Un jour hors delai de prevenance : grise, mais explique. */
.grille-tot { grid-column: 1; z-index: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px; margin: 1px 2px;
  border-radius: 7px; font-size: .74rem; font-weight: 650; color: var(--texte-doux);
  background-image: repeating-linear-gradient(135deg,
    rgba(86,98,117,.07) 0 6px, transparent 6px 12px); }
.grille-tot small { font-weight: 400; font-size: .69rem; text-align: center; padding: 0 6px; }

/* ======================= L'application mobile ===================== *
   Installee sur un telephone, MDA doit se tenir comme une
   application et non comme une page repliee : les onglets passent en
   bas, a portee de pouce, et la grille se fait glisser d'un jour a
   l'autre.
   ================================================================== */

/* Le sigle tient en trois lettres : il lui faut moins de corps qu'une
   initiale seule. */
.marque-pastille { font-size: .74rem; letter-spacing: .3px; }
.marque-pastille.grande { font-size: 1.05rem; letter-spacing: .5px; }

@media (max-width: 700px) {
  :root { --barre-basse: 62px; }

  /* Les onglets descendent en bas de l'ecran. Sur un telephone tenu
     d'une main, le haut de l'ecran est hors de portee du pouce. */
  .onglets {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; z-index: 40;
    border-top: 1px solid var(--bord); border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -1px 12px rgba(9,42,82,.08);
  }
  .onglets-in { padding: 0; justify-content: space-around; }
  .onglets a {
    flex: 1 1 0; flex-direction: column; gap: 2px; justify-content: center;
    padding: 8px 2px 6px; border-bottom: 0; border-top: 3px solid transparent;
    font-size: .66rem; font-weight: 600; text-align: center;
  }
  /* Le libelle revient : sans lui, une barre du bas n'est qu'une
     rangee de pictogrammes a deviner. */
  .onglets a span { display: block; overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap; max-width: 100%; }
  .onglets a.actif { border-top-color: var(--marine); border-bottom-color: transparent; }

  .page { padding-bottom: calc(var(--barre-basse) + env(safe-area-inset-bottom) + 24px); }
  .pied { padding-bottom: calc(var(--barre-basse) + env(safe-area-inset-bottom) + 20px); }

  /* Un bouton d'action pleine largeur se vise mieux qu'un bouton
     centre au milieu d'une ligne. */
  .titre-page .bouton { flex: 1 1 100%; }
  .actions .bouton, .actions form { flex: 1 1 auto; }
  .actions form .bouton { width: 100%; }

  /* La grille se fait glisser jour par jour : le doigt s'arrete sur
     une colonne entiere, jamais au milieu de deux. */
  .grille-cadre { scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
  .grille-colonne, .grille-jour-entete { scroll-snap-align: start; }
  .salles-onglets { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    margin: 0 -14px 10px; padding: 0 14px; }
  .salles-onglets::-webkit-scrollbar { display: none; }
  .puce-salle { white-space: nowrap; flex: none; }
}

/* Ouverte comme une application : on gagne la place de la barre
   d'adresse, autant la rendre au contenu. */
@media (display-mode: standalone) {
  .pied { display: none; }
}

/* La colonne des heures reste en place quand on fait glisser les
   jours : une grille horaire dont on ne voit plus les heures ne se
   lit plus. Sur telephone, le glissement horizontal est la facon
   normale de passer d'un jour a l'autre - sans cela, la premiere
   chose qui sort de l'ecran est justement l'echelle. */
.grille-heures {
  position: sticky; left: 0; z-index: 4;
  background: var(--carte);
  border-right: 1px solid var(--bord);
}
.grille-coin { border-right: 1px solid var(--bord); }

/* ========================== La marque ============================ *
   Le logo fourni par la mairie, decoupe par outils/generer-icones.ps1
   en deux images : l'embleme pour le bandeau, le logo entier pour la
   page de connexion. Il est dessine sur du blanc - on le pose donc
   sur une pastille blanche plutot que de tenter un detourage, qui
   percerait aussi les fenetres de la mairie.
   ================================================================= */

:root { --vert: #4E9B23; }   /* le vert du logo */

.marque-embleme {
  height: 44px; width: auto; flex: none;
  background: #fff; border-radius: 10px; padding: 3px 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
}

.logo-grand {
  display: block; width: 100%; max-width: 330px; height: auto;
  margin: 0 auto 14px; background: #fff; border-radius: 18px;
  padding: 10px; box-shadow: var(--ombre);
}
.marque-nue p { font-size: .95rem; }

/* Le vert du logo pour l'action qui fait tout l'outil : choisir un
   creneau libre. C'est le seul endroit ou il sert de couleur d'action
   - ailleurs, il resterait decoratif. */
.libre:hover { color: var(--vert); border-color: var(--vert);
  background: color-mix(in srgb, var(--vert) 10%, white); }
.libre:focus-visible { outline-color: var(--vert); color: var(--vert); }

@media (max-width: 620px) {
  .marque-embleme { height: 38px; padding: 2px 5px; }
  .logo-grand { max-width: 270px; }
}

/* Trois clubs ou plus sur la meme heure : un seul bloc, qui annonce
   le nombre. Trois blocs de vingt pixels ne se lisent pas. */
.bloc.grappe { display: flex; flex-direction: column; justify-content: center;
  text-align: center; }
.bloc.grappe span { font-weight: 750; color: var(--marine); }
.bloc.grappe small { font-style: italic; }

/* ===================== Le dossier de l'association ================ */

.carte.document { padding: 14px 16px; }
.carte.document h3 { margin: 0; font-size: .98rem; }

.piece-ligne { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 10px; margin-bottom: 6px; border-radius: 9px;
  background: var(--neutre-fond); font-size: .88rem; }
.piece-ligne.perimee { background: var(--danger-fond); }
.piece-nom { font-weight: 650; }
.piece-info { color: var(--texte-doux); font-size: .82rem; }
.piece-echeance { margin-left: auto; font-weight: 650; font-size: .82rem; }
.piece-ligne form { margin: 0; }

.anciens { margin: 4px 0 8px; }
.anciens summary { cursor: pointer; font-size: .84rem; color: var(--texte-doux);
  padding: 4px 0; }

/* Le depot : une ligne, un fichier, une date, un bouton. Rien de plus
   ne doit s'interposer entre le document et le dossier. */
.formulaire.depot { margin-top: 10px; padding-top: 10px;
  border-top: 1px dashed var(--bord); }
.depot-ligne { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.depot-ligne input[type=file] { flex: 1 1 220px; font-size: .85rem;
  padding: 8px; border: 1px solid var(--bord); border-radius: 9px;
  background: var(--carte); }
.depot-date { display: flex; flex-direction: column; gap: 3px;
  font-size: .78rem; font-weight: 650; color: var(--texte-doux); }
.depot-date input { padding: 8px 10px; font: inherit; font-size: .88rem;
  border: 1px solid var(--bord); border-radius: 9px; background: var(--carte); }
.depot-note { width: 100%; margin-top: 8px; padding: 8px 10px; font: inherit;
  font-size: .88rem; border: 1px solid var(--bord); border-radius: 9px; }

@media (max-width: 620px) {
  .depot-ligne { flex-direction: column; align-items: stretch; }
  /* En colonne, une base flexible s applique a la HAUTEUR : sans cela
     le champ de fichier fait deux cent vingt pixels de haut. */
  .depot-ligne input[type=file] { flex: 0 0 auto; }
  .depot-ligne button { width: 100%; }
  .piece-echeance { margin-left: 0; }
}

/* Les documents demandes, cote reglages. */
.ligne-type { display: grid; grid-template-columns: 1fr auto auto; gap: 10px 16px;
  align-items: center; padding: 12px 0; border-bottom: 1px solid var(--bord-doux); }
.ligne-type.inactif { opacity: .55; }
.lt-nom { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.lt-nom input { padding: 8px 10px; font: inherit; font-size: .9rem;
  border: 1px solid var(--bord); border-radius: 9px; }
.lt-nom input:first-child { font-weight: 650; }
.lt-cases { display: flex; flex-direction: column; }
.lt-cases .case { padding: 2px 0; }
.lt-cases .case span { font-size: .82rem; }
.lt-actions { display: flex; align-items: center; gap: 8px; }
.lt-actions input { padding: 7px 8px; font: inherit; font-size: .85rem;
  border: 1px solid var(--bord); border-radius: 8px; }
@media (max-width: 760px) {
  .ligne-type { grid-template-columns: 1fr; }
}

/* Supprimer un compte : le bouton se tient a l'ecart des autres, et il
   est rouge. On ne le rencontre pas en visant « Desactiver ». */
.lc-supprimer { grid-column: 1 / -1; margin-top: 2px; }
.lc-soi { grid-column: 1 / -1; font-size: .8rem; font-style: italic; }
.mini.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.mini.danger:hover { background: #96201a; }

/* ============================ Le logo du club ===================== */

/* La zone de depot : assez grande pour y lacher un fichier sans viser,
   et qui reagit au survol pour dire « lachez ici ». */
.zone-logo { position: relative; display: flex; align-items: center; gap: 18px;
  padding: 16px; border: 2px dashed var(--bord); border-radius: var(--rayon);
  background: var(--neutre-fond); cursor: pointer;
  transition: border-color .15s, background-color .15s; }
.zone-logo:hover { border-color: var(--marine-clair); }
.zone-logo.survol { border-color: var(--vert); border-style: solid;
  background: color-mix(in srgb, var(--vert) 8%, white); }
.zone-logo.pret { border-color: var(--vert); border-style: solid; }
.zone-logo.refus { border-color: var(--danger); background: var(--danger-fond); }

/* Le champ de fichier reste la, invisible : c'est lui que le clic
   ouvre, et c'est lui qui part avec le formulaire. */
.zone-logo input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer; }

.apercu-logo { flex: none; width: 96px; height: 96px; border-radius: 16px;
  background: #fff; border: 1px solid var(--bord-doux); overflow: hidden;
  display: grid; place-items: center; }
.apercu-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.sans-logo { font-size: 1.6rem; font-weight: 800; color: var(--texte-doux); }

.consigne-logo { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.consigne-logo b { color: var(--marine); }
.consigne-logo small { color: var(--texte-doux); font-size: .84rem; }

/* Dans le bandeau : le logo tient dans la pastille ronde, sur fond
   blanc, sans deformation. */
.pastille-logo { display: block; object-fit: contain; background: #fff;
  padding: 2px; border: 1px solid rgba(255,255,255,.4); }

/* Dans la liste des associations : de quoi reconnaitre un club d'un
   coup d'oeil, sans alourdir la ligne. */
.logo-liste { width: 28px; height: 28px; object-fit: contain; vertical-align: middle;
  margin-right: 8px; border-radius: 6px; background: #fff;
  border: 1px solid var(--bord-doux); }

@media (max-width: 620px) {
  .zone-logo { flex-direction: column; text-align: center; }
  .consigne-logo { align-items: center; }
}

/* Voir le mot de passe : le bouton se loge dans le champ, a droite. */
.mdp-cadre { position: relative; display: block; }
.champ .mdp-cadre input { padding-right: 92px; }
.mdp-voir {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  min-height: 34px; padding: 4px 12px; border: 0; border-radius: 8px;
  background: var(--neutre-fond); color: var(--marine);
  font: inherit; font-size: .82rem; font-weight: 650; cursor: pointer;
}
.mdp-voir:hover { background: var(--bord-doux); }
.mdp-voir:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.mdp-voir[aria-pressed="true"] { background: var(--marine); color: #fff; }
