/* ==========================================================================
   Groupe Scout Athénée — thème « papier blanc, encre noire, rouge foulard »
   --------------------------------------------------------------------------
   Sommaire
     1.  Variables & réglages de base
     2.  Typographie
     3.  Boutons & éléments communs
     4.  Chrome du site (barre de progression, en-tête, navigation, pied)
     5.  Animations réutilisables (apparitions au défilement)
     6.  Accueil : héros, bandeau défilant, chiffres, grille des unités
     7.  Page d'unité : en-tête, années, maîtrise, équipes, galerie
     8.  Visionneuse de photos (lightbox)
     9.  Panneau d'administration
     10. Écran de chargement
     11. Responsive
     12. Mouvement réduit & impression
   ========================================================================== */

/* ---------------------------------------------------------------- 1. Base  */

:root {
  /* Couleurs du groupe */
  --red: #c8102e;
  --red-dark: #9d0c23;
  --red-soft: #fff0f2;
  --ink: #0c0c0d;
  --ink-2: #2a2a2f;
  --ink-3: #55555e;
  --muted: #7c7c86;
  --paper: #ffffff;
  --paper-2: #f6f6f7;
  --paper-3: #eeeef0;
  --line: #e4e4e8;

  /* Rythme */
  --radius: 18px;
  --radius-sm: 10px;
  --radius-lg: 30px;
  --gutter: 28px;
  --maxw: 1240px;

  /* Ombres */
  --shadow-1: 0 1px 2px rgba(12, 12, 13, .05), 0 8px 24px -12px rgba(12, 12, 13, .12);
  --shadow-2: 0 2px 6px rgba(12, 12, 13, .06), 0 28px 60px -24px rgba(12, 12, 13, .22);
  --shadow-red: 0 20px 50px -20px rgba(200, 16, 46, .45);

  /* Courbes */
  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-soft: cubic-bezier(.4, 0, .2, 1);

  /* Polices.
     Le site avait deux sans-serif tres proches l'une de l'autre : rien ne
     se detachait. Les titres passent a un serif (Fraunces), le texte reste
     en sans-serif (Public Sans). Georgia est le recours des titres : c'est
     le seul serif present partout, Windows comme Mac comme Android. */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Public Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  /* Fraunces change de dessin selon la taille : plus contraste et plus fin
     pour les grands titres, plus solide pour les petits intitules. Sans
     cette ligne le navigateur garde le meme dessin partout. */
  font-optical-sizing: auto;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Texture très légère : une trame de points qui évite le « blanc plat ». */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(12, 12, 13, .16) 1px, transparent 1px);
  background-size: 30px 30px;
  opacity: .22;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 0%, transparent 75%);
}

img { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }

::selection { background: var(--red); color: #fff; }

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 3px;
  border-radius: 4px;
}

.container {
  width: min(100% - (var(--gutter) * 2), var(--maxw));
  margin-inline: auto;
  position: relative;
  z-index: 1;
}

.section { padding: clamp(60px, 9vw, 130px) 0; }
.section.tight { padding: clamp(40px, 6vw, 80px) 0; }

/* ------------------------------------------------------- 2. Typographie   */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -.025em;
  margin: 0;
  text-wrap: balance;
}

h1 { font-size: clamp(2.6rem, 7.4vw, 5.6rem); }
h2 { font-size: clamp(1.9rem, 3.6vw, 3rem); }
h3 { font-size: clamp(1.15rem, 1.7vw, 1.45rem); }

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

.muted { color: var(--muted); }
.lead { font-size: clamp(1.05rem, 1.35vw, 1.22rem); color: var(--ink-3); line-height: 1.7; }

/* Petit intitulé en capitales, avec un tiret rouge devant. */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: .76rem;
  font-weight: 650;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.eyebrow::before {
  content: "";
  width: 34px;
  height: 2px;
  background: var(--red);
  transform-origin: left;
  animation: dash-in .9s var(--ease-out) both;
}

/* Numéro de section : « 01 Maîtrise » */
.section-label {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 26px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.section-label .num {
  font-family: var(--font-display);
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--red);
}

.section-title { font-size: clamp(2rem, 4.4vw, 3.4rem); }
.section-sub { max-width: 58ch; margin-top: 16px; color: var(--ink-3); }

/* Le mot mis en avant, souligné d'un trait rouge qui se dessine. */
.accent { color: var(--red); }
/* Le titre du haut portait ici un trait rouge pale qui se dessinait sous
   « de Beyrouth ». Sous un texte deja rouge il ne se lisait pas comme un
   soulignement mais comme une tache rose flottant sous les lettres, trop
   epaisse et trop loin du mot. Le titre se tient tres bien sans lui. */

/* Mots qui montent depuis un masque (titres animés). */
.mask { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: .08em; }
.mask > span {
  display: inline-block;
  transform: translateY(115%);
  transition: transform 1s var(--ease-out);
  transition-delay: var(--d, 0ms);
}
.is-in .mask > span { transform: translateY(0); }

.empty {
  padding: 34px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--paper-2);
  color: var(--muted);
  text-align: center;
}

/* -------------------------------------------- 3. Boutons & petits objets  */

.btn {
  --btn-bg: var(--ink);
  --btn-fg: #fff;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 28px;
  border: 1px solid var(--btn-bg);
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-body);
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: .01em;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition: transform .45s var(--ease), box-shadow .45s var(--ease), color .35s var(--ease-soft);
}
/* Un disque rouge qui grandit depuis le centre au survol. */
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--red);
  border-radius: inherit;
  transform: scale(0, 1);
  transform-origin: left;
  transition: transform .5s var(--ease-out);
}
.btn:hover { transform: translateY(-3px); box-shadow: var(--shadow-red); }
.btn:hover::before { transform: scale(1, 1); }
.btn:active { transform: translateY(-1px) scale(.985); }
.btn .arrow { transition: transform .45s var(--ease); }
.btn:hover .arrow { transform: translateX(5px); }

.btn.ghost {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  border-color: var(--line);
  background: var(--paper);
}
.btn.ghost:hover { --btn-fg: #fff; border-color: var(--red); box-shadow: var(--shadow-1); }

.btn.red { --btn-bg: var(--red); }
.btn.red::before { background: var(--ink); }

.btn.small { padding: 9px 17px; font-size: .85rem; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink-3);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: all .3s var(--ease);
}
.icon-btn:hover { background: var(--red); border-color: var(--red); color: #fff; transform: rotate(90deg); }

/* Pastille d'information (tranche d'âge, branche…) */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--ink-2);
  white-space: nowrap;
}
.pill.dark { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .22); color: #fff; }
.pill.red { background: var(--red-soft); border-color: rgba(200, 16, 46, .22); color: var(--red-dark); }

/* ------------------------------------------------- 3b. Le logo du groupe   */

/*  Une seule image sert partout : `assets/logo.png` (1895 × 956, fond
    transparent), que l’on recadre en CSS. Deux cadrages :
      .logo-knot    le nœud seul, en large      → en-tête, héros, chargement
      .logo-lockup  le logo entier avec le nom  → pied de page
    Il n’y a pas de cadrage carré : dans le fichier, le nœud mesure
    1095 × 271 pixels (un rapport de 4 pour 1) d’un seul tenant, sans
    extrémités fines à rogner. Une fenêtre carrée n’en montrerait qu’un
    tiers, cordes tranchées des deux côtés.
    Le texte du logo est noir : sur un fond sombre, posez-le sur une
    pastille blanche (.logo-patch). */

.logo-knot, .logo-lockup {
  background-image: url("../assets/logo.png");
  background-repeat: no-repeat;
  flex: 0 0 auto;
}
.logo-knot   { aspect-ratio: 1097 / 273; background-size: 172.743% auto; background-position: 56.516% 36.164%; }
.logo-lockup { aspect-ratio: 1119 / 545; background-size: 169.348% auto; background-position: 55.283% 60.097%; }

/* Pastille blanche pour poser le logo sur un fond noir. */
.logo-patch {
  padding: 18px 22px;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-1);
}

/* ------------------------------------------------------- 4. Chrome du site */

/* Barre de progression de lecture, tout en haut. */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 100%;
  z-index: 120;
  background: transparent;
  pointer-events: none;
}
.scroll-progress span {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--red), #ff4d68);
  transform: scaleX(0);
  transform-origin: left;
}

/* Bandeau « mode démonstration » */
.demo-banner {
  position: relative;
  z-index: 60;
  padding: 11px var(--gutter);
  background: var(--ink);
  color: #f2f2f4;
  font-size: .82rem;
  text-align: center;
  letter-spacing: .01em;
}
.demo-banner a { color: #fff; border-bottom: 1px solid var(--red); padding-bottom: 1px; }
.demo-banner a:hover { color: var(--red); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, .78);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .4s var(--ease-soft), box-shadow .4s var(--ease-soft), background .4s var(--ease-soft);
}
.site-header.scrolled {
  border-bottom-color: var(--line);
  box-shadow: 0 10px 30px -22px rgba(12, 12, 13, .3);
}

.nav {
  display: flex;
  align-items: center;
  gap: 20px;
  width: min(100% - (var(--gutter) * 2), var(--maxw));
  margin-inline: auto;
  padding: 16px 0;
  transition: padding .4s var(--ease-soft);
}
.site-header.scrolled .nav { padding: 10px 0; }

.brand { display: flex; align-items: center; gap: 13px; flex: 0 1 auto; min-width: 0; }
/* Le nœud entier, en large. Sa largeur suit un peu celle de l’écran :
   assez grand pour être lisible, assez discret pour laisser la place aux six
   unités dans la barre de navigation et au bouton du menu sur un téléphone. */
.brand .logo-knot {
  width: clamp(78px, 8vw, 104px);
  transition: transform .6s var(--ease);
}
.brand:hover .logo-knot { transform: scale(1.06); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong {
  font-family: var(--font-display);
  font-size: 1.02rem;
  letter-spacing: -.015em;
}
.brand-text span { font-size: .72rem; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.nav-links a {
  position: relative;
  padding: 9px 14px;
  border-radius: 999px;
  font-size: .92rem;
  font-weight: 550;
  /* Un nom d'unité ne se coupe jamais en deux : il déformerait l'en-tête. */
  white-space: nowrap;
  color: var(--ink-2);
  transition: color .3s var(--ease-soft), background .3s var(--ease-soft);
}
/* Petit point rouge qui apparaît sous le lien survolé / actif. */
.nav-links a::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 5px;
  height: 5px;
  margin-left: -2.5px;
  border-radius: 50%;
  background: var(--red);
  transform: scale(0);
  transition: transform .35s var(--ease-out);
}
.nav-links a:hover { background: var(--paper-2); }
.nav-links a:hover::after, .nav-links a.active::after { transform: scale(1); }
.nav-links a.active { color: var(--ink); font-weight: 650; }

.nav-links a.admin-link {
  margin-left: 8px;
  padding: 9px 18px;
  border: 1px solid var(--line);
  color: var(--ink);
}
.nav-links a.admin-link:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.nav-links a.admin-link::after { display: none; }

.nav-toggle {
  display: none;
  margin-left: auto;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  font-size: 1.1rem;
  cursor: pointer;
}

/* Pied de page */
.site-footer {
  position: relative;
  margin-top: 40px;
  padding: clamp(50px, 7vw, 90px) 0 40px;
  background: var(--ink);
  color: #d8d8dd;
  overflow: hidden;
}
.site-footer::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--red), #ff4d68, var(--red));
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 40px;
  align-items: end;
}
.site-footer h3 { color: #fff; font-size: clamp(1.6rem, 3.2vw, 2.4rem); }
.site-footer .logo-patch { display: inline-block; }
.site-footer .logo-lockup { width: min(60vw, 250px); }
.site-footer .motto-line { margin-top: 10px; color: var(--red); font-weight: 600; letter-spacing: .04em; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 10px; }
.footer-links a {
  padding: 7px 14px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;
  font-size: .84rem;
  transition: all .3s var(--ease);
}
.footer-links a:hover { background: var(--red); border-color: var(--red); color: #fff; transform: translateY(-2px); }
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin-top: 46px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, .12);
  font-size: .8rem;
  color: #8f8f98;
}
.footer-bottom a:hover { color: var(--red); }

/* ------------------------------------------------- 5. Apparitions         */

[data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity .85s var(--ease-out), transform .85s var(--ease-out);
  transition-delay: var(--d, 0ms);
  will-change: opacity, transform;
}
[data-reveal="left"]  { transform: translateX(-32px); }
[data-reveal="right"] { transform: translateX(32px); }
[data-reveal="scale"] { transform: scale(.93); }
[data-reveal="fade"]  { transform: none; }
[data-reveal="clip"]  { opacity: 1; clip-path: inset(0 0 100% 0); transform: none; transition: clip-path 1.1s var(--ease-out); }

[data-reveal].is-in {
  opacity: 1;
  transform: none;
  clip-path: inset(0 0 0 0);
  will-change: auto;
}

@keyframes dash-in { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes float-y {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-16px) rotate(1.4deg); }
}
@keyframes spin-slow { to { transform: rotate(360deg); } }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(8px); } }
@keyframes blob {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(5%, -6%) scale(1.12); }
  66%      { transform: translate(-4%, 5%) scale(.94); }
}

/* --------------------------------------------------------- 6. Accueil     */

.hero {
  position: relative;
  padding: clamp(60px, 9vw, 120px) 0 clamp(50px, 7vw, 90px);
  /* Les halos flous débordent volontairement du héros. `overflow-x: clip`
     les coupe net au bord de l’écran — et nulle part ailleurs, puisque
     `.hero` occupe toute la largeur — tandis que `overflow-y` reste
     `visible` : ils continuent donc de déborder vers le haut et le bas.
     Sans cela la page est plus large que le téléphone. On ne le voit pas
     sur un ordinateur, mais en écartant les doigts pour dézoomer, l’en-tête
     s’arrête avant le bord et tout semble de travers.
     `clip` et non `hidden` : `hidden` créerait une zone défilante et
     couperait aussi le débordement vertical. */
  overflow-x: clip;
}
/*  Deux halos rouges très diffus qui bougent lentement en fond.
    Ils sont en `absolute` : ils ne deviennent donc pas des cases de la
    grille, et ils peuvent déborder du héros sans y laisser de bord net. */
.hero-grid::before, .hero-grid::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
}
.hero-grid::before {
  width: 46vw; height: 46vw;
  top: -22vw; right: -14vw;
  background: rgba(200, 16, 46, .16);
  animation: blob 22s var(--ease-soft) infinite;
}
.hero-grid::after {
  width: 34vw; height: 34vw;
  bottom: -16vw; left: -12vw;
  background: rgba(12, 12, 13, .07);
  animation: blob 28s var(--ease-soft) infinite reverse;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: clamp(30px, 5vw, 70px);
  align-items: center;
}

.hero h1 { margin: 22px 0 0; }
.hero h1 .line { display: block; }

.hero .motto {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 26px;
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 1.8vw, 1.4rem);
  font-style: italic;
  font-weight: 600;
  color: var(--red);
}
.hero .motto::before, .hero .motto::after {
  content: "";
  width: 26px;
  height: 1px;
  background: currentColor;
  opacity: .5;
}

.hero .lead { margin-top: 24px; max-width: 52ch; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }

/* Indice « faites défiler » */
.scroll-cue {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 46px;
  font-size: .76rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}
.scroll-cue .dot {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 50%;
  animation: bob 2.4s var(--ease-soft) infinite;
}

/* Illustration : le foulard, ses anneaux et le badge tournant. */
.hero-art {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 340px;
}

/* ---- La photo du haut de page ----------------------------------------- */
/* Une proportion fixe : la photo remplit le cadre et deborde plutot que de
   se deformer, quelle que soit celle que la maitrise mettra ensuite. */
.hero-photo {
  position: relative;
  margin: 0;
  width: min(100%, 460px);
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--paper-2);
  box-shadow: var(--shadow-2);
}
.hero-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Les images du diaporama sont empilees au meme endroit ; une seule est
   visible, les autres attendent a zero d'opacite. Le fondu dure presque une
   seconde : plus court, cela clignote ; plus long, on voit deux photos
   superposees. */
.hero-photo .hs {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .9s var(--ease-soft);
}
.hero-photo .hs.is-on { opacity: 1; }

/* Le nom de l'unite montree, en bas de la photo. Le degrade existe pour que
   le texte blanc tienne aussi sur une photo claire. */
.hs-nom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 42px 18px 14px;
  background: linear-gradient(to top, rgba(10, 10, 12, .74), rgba(10, 10, 12, 0));
  color: #fff;
  font-family: var(--font-display);
  font-size: .92rem;
  font-weight: 600;
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  .hero-photo .hs { transition: none; }
}

/* La pastille tournante se detache maintenant sur une photo, et non plus sur
   le fond blanc de la page : son texte sombre y devenait illisible. Elle
   recoit donc son propre disque blanc, et se pose en coin comme un cachet. */
.hero-badge {
  position: absolute;
  z-index: 3;
  right: -5%;
  bottom: -5%;
  width: 118px;
  height: 118px;
  padding: 7px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-2);
}
.hero-badge svg { width: 100%; height: 100%; }
.hero-badge .rotor { animation: spin-slow 24s linear infinite; transform-origin: 50% 50%; }
.hero-badge text { font-family: var(--font-display); font-size: 10.2px; font-weight: 700; letter-spacing: .26em; fill: var(--ink); text-transform: uppercase; }
.hero-badge .core { fill: var(--red); }
.hero-badge .core-text { fill: #fff; font-size: 17px; letter-spacing: 0; }

/* Bandeau noir défilant */
.marquee {
  position: relative;
  padding: 20px 0;
  background: var(--ink);
  color: #fff;
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}
.marquee-track {
  display: flex;
  width: max-content;
  animation: marquee 34s linear infinite;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-track span {
  display: inline-flex;
  align-items: center;
  gap: 34px;
  padding-right: 34px;
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2.1vw, 1.7rem);
  font-weight: 700;
  letter-spacing: -.01em;
  white-space: nowrap;
}
.marquee-track span i { color: var(--red); font-style: normal; }

/* Chiffres clés */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.stat { padding: 30px 26px; background: var(--paper); transition: background .4s var(--ease-soft); }
.stat:hover { background: var(--red-soft); }
.stat .num {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 4vw, 3.2rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.03em;
}
.stat:hover .num { color: var(--red); }
/* Les quatre intitules tiennent sur une ligne et les quatre nombres sont
   donc tous a la meme hauteur. Un intitule plus long casserait cet
   alignement : c'est la seule raison de les garder courts. */
.stat .lbl { margin-top: 8px; font-size: .82rem; color: var(--muted); letter-spacing: .04em; }

/* Grille des unités */
/* Il y a six unites. Avec des colonnes automatiques on obtenait quatre
   colonnes sur un grand ecran : quatre cartes en haut, deux en bas, et deux
   trous a droite. Six se divise par trois et par deux, donc on fixe le
   nombre de colonnes : les lignes sont toujours pleines et les photos
   gagnent en largeur au passage. */
.unit-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  margin-top: 46px;
}
@media (max-width: 1000px) {
  .unit-grid { grid-template-columns: repeat(2, 1fr); }
}

.unit-card {
  position: relative;
  display: flex;
  flex-direction: column;
  /* Plus de marge en haut : la photo touche les bords de la carte. Le texte
     reprend la marge a son compte, dans .uc-corps. */
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  overflow: hidden;
  isolation: isolate;
  transform-style: preserve-3d;
  transition: border-color .45s var(--ease), box-shadow .5s var(--ease), transform .18s var(--ease-soft);
}
/* Le remplissage rouge monte du bas au survol. */
.unit-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, #fff 0%, var(--red-soft) 100%);
  opacity: 0;
  transition: opacity .5s var(--ease-soft);
}
.unit-card:hover { border-color: rgba(200, 16, 46, .45); box-shadow: var(--shadow-2); }
.unit-card:hover::before { opacity: 1; }

/* ---- La photo de l'unite, en haut de la carte -------------------------- */
/* Une proportion fixe pour les six : sans elle, une photo verticale et une
   photo horizontale donneraient deux cartes de hauteurs differentes et la
   grille partirait de travers. L'image remplit le cadre et deborde plutot
   que de se deformer. */
.uc-photo {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
}
.uc-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .8s var(--ease);
}
.unit-card:hover .uc-photo img { transform: scale(1.05); }

/* Faute de photo : l'embleme, en grand, sur le fond clair. */
.uc-photo-vide { display: grid; place-items: center; }
.uc-photo-vide .uc-emblem { font-size: 3.4rem; line-height: 1; opacity: .5; }

/* L'etiquette de branche se pose sur l'image. Elle etait placee par rapport
   a la carte entiere : elle l'est maintenant par rapport a la photo. */
.unit-card .branch-tag { top: 14px; right: 14px; }

.uc-corps {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 24px 28px 26px;
}
.unit-card h3 { margin-top: 0; }
.unit-card .age { margin-top: 10px; font-size: .84rem; font-weight: 600; color: var(--red); letter-spacing: .03em; }
.unit-card p { margin-top: 14px; font-size: .94rem; color: var(--ink-3); line-height: 1.62; }

.unit-card .go {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  /* Colle en bas de la carte : les descriptions n'ont pas toutes la meme
     longueur, et sans cela le « Decouvrir l'unite » de chaque carte se
     retrouvait a une hauteur differente d'une carte a l'autre. */
  margin-top: auto;
  padding-top: 22px;
  font-size: .88rem;
  font-weight: 650;
  color: var(--ink);
}
.unit-card .go span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: .9rem;
  transition: transform .45s var(--ease), background .4s var(--ease-soft);
}
.unit-card:hover .go span { transform: translateX(6px); background: var(--red); }

/* Bande d'appel (bas d'accueil) */
.cta-band {
  position: relative;
  padding: clamp(44px, 6vw, 72px);
  border-radius: var(--radius-lg);
  background: var(--ink);
  color: #fff;
  overflow: hidden;
  text-align: center;
}
.cta-band::before {
  content: "";
  position: absolute;
  width: 60vw; height: 60vw;
  top: -30vw; left: 50%;
  margin-left: -30vw;
  background: radial-gradient(circle, rgba(200, 16, 46, .4), transparent 62%);
  animation: blob 20s var(--ease-soft) infinite;
}
.cta-band h2 { color: #fff; }
.cta-band p { margin: 16px auto 0; max-width: 52ch; color: #c6c6cd; }
.cta-band .btn { margin-top: 30px; --btn-bg: #fff; --btn-fg: var(--ink); }
.cta-band .btn:hover { --btn-fg: #fff; }

/* ---------------------------------------------------- 7. Page d'unité     */

.unit-header {
  position: relative;
  padding: clamp(48px, 7vw, 92px) 0 clamp(40px, 5vw, 64px);
  background: var(--ink);
  color: #fff;
  overflow: hidden;
}
.unit-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 100% at 85% 0%, rgba(200, 16, 46, .38), transparent 70%);
}
/* La photo de l'unite, derriere le titre. Elle est assombrie par un voile :
   le texte blanc doit rester lisible quelle que soit la photo. */
.unit-header .fond {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  /* Le voile est un ::before, donc le premier enfant de la banniere. Sans
     ces z-index la photo, qui vient apres lui, se peignait par-dessus et le
     titre blanc se perdait dans les uniformes clairs. */
  z-index: 0;
}
.unit-header::before { z-index: 1; }
.unit-header > .container { z-index: 2; }
.unit-header.avec-photo::before {
  background:
    linear-gradient(90deg, rgba(10, 10, 12, .93) 0%, rgba(10, 10, 12, .74) 52%, rgba(10, 10, 12, .58) 100%),
    radial-gradient(ellipse 70% 100% at 85% 0%, rgba(200, 16, 46, .34), transparent 70%);
}
@media (max-width: 760px) {
  /* Sur un telephone le texte occupe toute la largeur : le voile doit etre
     uniforme, sinon la fin des lignes passe sur la partie claire. */
  .unit-header.avec-photo::before {
    background:
      linear-gradient(180deg, rgba(10, 10, 12, .86), rgba(10, 10, 12, .9)),
      radial-gradient(ellipse 70% 100% at 85% 0%, rgba(200, 16, 46, .3), transparent 70%);
  }
}
/* Emblème géant en filigrane. */
.unit-header .ghost {
  position: absolute;
  right: 3%;
  top: 50%;
  transform: translateY(-50%);
  font-size: clamp(11rem, 26vw, 24rem);
  line-height: 1;
  filter: grayscale(1) brightness(2.2);
  opacity: .09;
  pointer-events: none;
}
/* Le texte passe au-dessus de la photo et de son voile. */
.unit-header > .container { position: relative; z-index: 1; }
.unit-header .back {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: .85rem;
  color: #b9b9c2;
  transition: color .3s, gap .3s var(--ease);
}
.unit-header .back:hover { color: #fff; gap: 14px; }
.unit-header h1 { margin-top: 20px; color: #fff; }
.unit-header .meta { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 22px; }
.unit-header .desc { margin-top: 24px; max-width: 60ch; color: #c9c9d2; line-height: 1.72; }

/* Choix de l'année : onglets en pastilles */
.year-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  margin-bottom: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  box-shadow: var(--shadow-1);
}
.year-bar > label {
  font-size: .76rem;
  font-weight: 650;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  padding-left: 8px;
}
.year-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.year-tabs::-webkit-scrollbar { display: none; }
.year-tab {
  padding: 9px 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--paper-2);
  font-family: var(--font-display);
  font-size: .95rem;
  font-weight: 650;
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
  transition: all .4s var(--ease);
}
.year-tab:hover { background: var(--paper-3); transform: translateY(-2px); }
.year-tab.active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  box-shadow: 0 8px 22px -10px rgba(200, 16, 46, .7);
}
.year-bar .hint { margin-left: auto; padding-right: 10px; font-size: .8rem; color: var(--muted); }

/* Un bloc de contenu (maîtrise, équipes, photos…) */
.block { margin-bottom: clamp(50px, 7vw, 86px); }
.block:last-child { margin-bottom: 0; }

/* Maîtrise & membres */
.people {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}
.person {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  transition: transform .4s var(--ease), border-color .4s var(--ease-soft), box-shadow .4s var(--ease);
}
.person:hover { transform: translateY(-4px); border-color: rgba(200, 16, 46, .4); box-shadow: var(--shadow-1); }
.person .avatar {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-family: var(--font-display);
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: .02em;
  transition: background .4s var(--ease-soft), transform .5s var(--ease);
}
.person:hover .avatar { background: var(--red); transform: scale(1.07) rotate(-6deg); }

/* La meme pastille, mais avec un visage dedans. Elle ne tourne pas au
   survol : une photo penchee ferait accident, alors que des initiales
   penchees font un clin d'oeil. */
.person .avatar.a-photo { overflow: hidden; background: var(--paper-2); }
.person .avatar.a-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.person:hover .avatar.a-photo { background: var(--paper-2); transform: scale(1.07); }
.person .who { display: flex; flex-direction: column; min-width: 0; }
.person .name { font-weight: 650; letter-spacing: -.01em; }
.person .role { font-size: .8rem; color: var(--muted); }

/* Équipes / patrouilles / sizaines */
.teams {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.team {
  position: relative;
  padding: 26px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  overflow: hidden;
  transition: transform .45s var(--ease), box-shadow .45s var(--ease), border-color .45s var(--ease-soft);
}
/* Liseré rouge qui se déplie sur le côté gauche. */
.team::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--red);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform .6s var(--ease-out);
}
.team:hover { transform: translateY(-5px); border-color: var(--paper-3); box-shadow: var(--shadow-2); }
.team:hover::before { transform: scaleY(1); }
.team .team-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.team h3 { letter-spacing: -.02em; }
.team .count {
  font-size: .74rem;
  font-weight: 650;
  letter-spacing: .1em;
  color: var(--muted);
  text-transform: uppercase;
}
.team ul { list-style: none; margin: 20px 0 0; padding: 0; }
.team li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: .94rem;
  transition: padding-left .35s var(--ease), color .3s var(--ease-soft);
}
.team li:hover { padding-left: 8px; color: var(--red-dark); }
.team li .role { font-size: .76rem; color: var(--muted); white-space: nowrap; }

/* Galerie */
/*  Trois colonnes, et pas moins de deux même sur un téléphone.

    La grille n'affiche que la vignette (420 px de côté). Sur une seule
    colonne, un téléphone de 360 px l'étire à 324 px de large : avec deux
    pixels d'écran pour un pixel d'image, la photo paraît floue alors que
    le plein écran, lui, est net. Sur deux colonnes la case fait 154 px,
    et l'image retrouve sa netteté.

    Si vous changez ces nombres, gardez la case en dessous d'environ
    400 px : au-delà, la vignette est de nouveau agrandie. */
.gallery {
  columns: 3;
  column-gap: 16px;
}
.gallery figure {
  position: relative;
  margin: 0 0 16px;
  border-radius: var(--radius);
  background: var(--paper-2);
  overflow: hidden;
  cursor: zoom-in;
  break-inside: avoid;
  transition: transform .5s var(--ease), box-shadow .5s var(--ease);
}
.gallery figure::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(12, 12, 13, .72));
  opacity: 0;
  transition: opacity .45s var(--ease-soft);
}
.gallery figure img {
  width: 100%;
  transition: transform .8s var(--ease), filter .6s var(--ease-soft);
}
.gallery figure:hover { transform: translateY(-5px); box-shadow: var(--shadow-2); }
.gallery figure:hover img { transform: scale(1.07); }
.gallery figure:hover::after { opacity: 1; }
.gallery figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 18px;
  color: #fff;
  font-size: .88rem;
  transform: translateY(14px);
  opacity: 0;
  transition: transform .5s var(--ease-out), opacity .4s var(--ease-soft);
}
.gallery figure:hover figcaption { transform: none; opacity: 1; }

/* Un écran tactile ne connaît pas le survol : la légende et le voile sombre
   qui la rend lisible ne s'afficheraient jamais. Sur ces écrans on les laisse
   visibles en permanence, en plus petit, la case d'un téléphone étant
   étroite. Sans cette règle, toute légende écrite par la maîtrise reste
   invisible sur un téléphone — c'est-à-dire pour la plupart des visiteurs. */
@media (hover: none) {
  .gallery figure::after { opacity: 1; }
  .gallery figcaption {
    transform: none;
    opacity: 1;
    padding: 10px 12px;
    font-size: .78rem;
    line-height: 1.3;
  }
}
/* Petite loupe au survol */
.gallery figure .zoom {
  position: absolute;
  z-index: 2;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  color: var(--ink);
  font-size: .9rem;
  transform: scale(.6);
  opacity: 0;
  transition: all .45s var(--ease-out);
}
.gallery figure:hover .zoom { transform: scale(1); opacity: 1; }

/* Navigation d'unité à unité */
.unit-nav {
  margin-top: clamp(50px, 7vw, 80px);
  padding-top: 34px;
  border-top: 1px solid var(--line);
}
.unit-nav .titre {
  margin-bottom: 16px;
  font-size: .74rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--red);
}
.unit-nav-list { display: flex; flex-wrap: wrap; gap: 10px; }
.unit-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  transition: background .4s var(--ease-soft), border-color .4s var(--ease-soft),
              color .4s var(--ease-soft), transform .4s var(--ease);
}
a.unit-chip:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
  transform: translateY(-3px);
}
.unit-chip .em { font-size: 1.15rem; line-height: 1; }
/* L'unite qu'on est en train de lire : affichee pour se reperer dans la
   liste, mais sans lien — il n'y a nulle part ou aller. */
.unit-chip.current {
  background: var(--red-soft);
  border-color: rgba(200, 16, 46, .3);
  color: var(--red);
  cursor: default;
}

/* Transition entre les pages */
#app { transition: opacity .34s var(--ease-soft), transform .34s var(--ease-soft); }
#app.leaving { opacity: 0; transform: translateY(14px); }

/* ------------------------------------------------- 8. Visionneuse photos  */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: clamp(18px, 4vw, 54px);
  background: rgba(8, 8, 10, .93);
  backdrop-filter: blur(8px);
  animation: lb-in .4s var(--ease-out) both;
}
@keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }
.lightbox img {
  grid-column: 2;
  max-width: 100%;
  max-height: 84vh;
  margin-inline: auto;
  border-radius: var(--radius);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .9);
  animation: lb-pop .55s var(--ease-out) both;
}
@keyframes lb-pop { from { opacity: 0; transform: scale(.92) translateY(18px); } to { opacity: 1; transform: none; } }
.lightbox button {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: all .35s var(--ease);
}
.lightbox button:hover { background: var(--red); border-color: var(--red); transform: scale(1.1); }
.lightbox .close { position: absolute; top: 20px; right: 20px; font-size: 1.3rem; }
.lightbox .cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 20px;
  text-align: center;
  color: #e4e4e9;
  font-size: .92rem;
}

/* ------------------------------------------- 9. Administration           */

.admin-wrap {
  width: min(100% - (var(--gutter) * 2), 1100px);
  margin: 40px auto 80px;
}
.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  margin-bottom: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow-1);
}

/* ---------------------------------------------------------------------------
   La bande de l'administration
   ---------------------------------------------------------------------------
   Cette barre etait une carte collante posee a 86px du haut, c'est-a-dire
   sous un en-tete dont la hauteur change quand on fait defiler : elle
   semblait flotter, et laissait passer le contenu sur ses cotes. Elle est
   maintenant a l'interieur de l'en-tete lui-meme. Une seule chose colle en
   haut, sans jamais de decalage, et sa teinte rose pale la distingue des
   cartes blanches de la page sans alourdir l'ecran.
   ------------------------------------------------------------------------ */
.admin-bar {
  background: var(--red-soft);
  border-top: 1px solid rgba(200, 16, 46, .14);
  border-bottom: 1px solid rgba(200, 16, 46, .18);
}
.admin-bar:empty { display: none; }

.admin-bar .admin-toolbar {
  width: min(100% - (var(--gutter) * 2), 1100px);
  margin: 0 auto;
  padding: 11px 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  position: static;
  backdrop-filter: none;
}

/* Sur fond rose, la pastille rose ne se voyait plus. */
.admin-bar .pill.red { background: #fff; }
/* La barre « Enregistrer » suit le defilement, collee en bas de l'ecran.
   L'onglet de l'annee est long : maitrise, equipes, membres puis photos. Le
   bouton se trouvait tout en bas, et on remplissait les equipes sans l'avoir
   sous les yeux. Il reste a sa place une fois la page deroulee jusqu'au bout.
   Seule cette barre-la suit : celle du haut vit dans l'en-tete (.admin-bar),
   ou elle est remise en position normale. */
.admin-toolbar.sticky-bas {
  position: sticky;
  bottom: 14px;
  z-index: 40;
  box-shadow: var(--shadow-2);
}
/* Sur un telephone, la phrase d'explication faisait monter la barre a 144px,
   soit pres d'un cinquieme de l'ecran, en permanence. Le bouton suffit : le
   meme avertissement est deja ecrit au-dessus, dans la carte des photos. */
@media (max-width: 760px) {
  .admin-toolbar.sticky-bas { padding: 12px 14px; }
  .admin-toolbar.sticky-bas .muted { display: none; }
}

.admin-toolbar .spacer, .row .spacer { flex: 1 1 auto; }

/* Dans la barre d'outils, certains boutons « icône » portent aussi du texte
   (« 🗑 Année ») : ils deviennent des pastilles, pas des ronds. */
.admin-toolbar .icon-btn {
  width: auto;
  height: auto;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 600;
  white-space: nowrap;
}
.admin-toolbar .icon-btn:hover { transform: translateY(-2px); }

.card {
  padding: 26px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  animation: card-in .5s var(--ease-out) both;
}
@keyframes card-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.card > h2, .card > h3 { margin-bottom: 18px; }

/* Carte à l'intérieur d'une carte (une équipe dans la liste des équipes). */
.card .card.nested {
  padding: 18px;
  background: var(--paper-2);
  border-radius: var(--radius);
  animation: none;
}

/* Message de confirmation après un enregistrement. */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 250;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: .92rem;
  font-weight: 600;
  box-shadow: var(--shadow-2);
  animation: toast-in .4s var(--ease-out) both;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 18px) scale(.94); }
  to   { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
/* Un refus ou une panne : rouge, et plus large car le texte est plus long. */
.toast.error {
  max-width: min(92vw, 560px);
  border-radius: var(--radius);
  background: var(--red-dark);
  text-align: center;
  line-height: 1.45;
}

.login-card {
  width: min(100% - 40px, 430px);
  margin: clamp(50px, 12vh, 120px) auto;
  padding: 36px 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow-2);
  animation: card-in .6s var(--ease-out) both;
}
.login-card h2 { margin-bottom: 8px; }

.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field > label, .field > span {
  font-size: .78rem;
  font-weight: 650;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }

input, select, textarea {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: .95rem;
  transition: border-color .3s var(--ease-soft), box-shadow .3s var(--ease-soft), background .3s;
}
input:hover, select:hover, textarea:hover { border-color: var(--paper-3); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 4px rgba(200, 16, 46, .12);
}
.row input { width: auto; flex: 1 1 180px; }
.row input.role-input, input.role-input { flex: 0 1 180px; }
select { cursor: pointer; }

.dropzone {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 44px 24px;
  border: 2px dashed var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper-2);
  color: var(--muted);
  text-align: center;
  cursor: pointer;
  transition: all .35s var(--ease);
}
.dropzone:hover { border-color: var(--red); background: var(--red-soft); color: var(--red-dark); }
/* `drag` est la classe posée par js/admin.js pendant un glisser-déposer. */
.dropzone.drag {
  border-color: var(--red);
  background: var(--red-soft);
  color: var(--red-dark);
  transform: scale(1.015);
}

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-top: 18px; }
.thumb {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--paper-2);
  transition: transform .4s var(--ease), box-shadow .4s var(--ease);
}
.thumb:hover { transform: translateY(-3px); box-shadow: var(--shadow-1); }
.thumb img { width: 100%; height: 108px; object-fit: cover; }
.thumb .icon-btn { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; font-size: .85rem; }

/*  Deux sortes de photos dans l'administration :
      - celles envoyées depuis cette page, que la maîtrise peut retirer ;
      - celles « du groupe », livrées avec le site, qu'elle voit mais ne
        peut pas toucher d'ici. Il faut qu'on les distingue d'un coup d'œil,
        sinon on cherche un bouton de suppression qui n'existe pas. */
.thumb.locked { border-style: dashed; }
.thumb.locked img { opacity: .92; }
.thumb-tag {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(12, 12, 13, .72);
  color: #fff;
  font-size: .64rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.thumb .caption-fixed {
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  background: var(--paper);
  color: var(--muted);
  font-size: .78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Le choix « moyenne / haute » au-dessus de la zone de dépôt. */
.quality-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}
.quality-row label { font-weight: 600; font-size: .9rem; }
.quality-row select { width: auto; min-width: 190px; }
.quality-row .muted { font-size: .82rem; }

#login-error { color: var(--red); font-size: .88rem; }

/* ------------------------------------------------ 10. Écran de chargement */

.loader {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  gap: 18px;
  background: var(--paper);
  transition: clip-path .9s var(--ease-out), opacity .4s .5s;
  clip-path: inset(0 0 0 0);
}
.loader.done { clip-path: inset(0 0 100% 0); opacity: 0; pointer-events: none; }
.loader .mark { display: grid; place-items: center; gap: 22px; }
.loader .logo-knot { width: 190px; animation: float-y 2.6s var(--ease-soft) infinite; }
.loader .bar { width: 130px; height: 2px; background: var(--paper-3); overflow: hidden; border-radius: 2px; }
.loader .bar i { display: block; height: 100%; width: 40%; background: var(--red); animation: load-slide 1.1s var(--ease-soft) infinite; }
@keyframes load-slide {
  from { transform: translateX(-120%); }
  to   { transform: translateX(340%); }
}

/* ------------------------------------------------------ 11. Responsive    */

@media (max-width: 1000px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-art { order: -1; min-height: 260px; }
  .hero-badge { width: 100px; height: 100px; right: 6%; }
  /* On garde trois colonnes : à deux, la case atteindrait 500 px et la
     vignette serait agrandie. */
  .gallery { columns: 3; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr; align-items: start; }
}

/* La barre de navigation passe en menu replié quand elle ne tient plus sur
   une ligne. Les six unités étant maintenant rangées derrière « Nos unités »,
   il ne reste que quatre entrées : la barre tient largement jusqu'à 860 px,
   là où elle demandait 1180 px du temps où les neuf liens étaient alignés. */
@media (max-width: 860px) {
  .nav-toggle { display: grid; place-items: center; }
  .nav-links {
    position: absolute;
    top: 100%;
    left: var(--gutter);
    right: var(--gutter);
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    margin: 8px 0 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: var(--shadow-2);
    opacity: 0;
    transform: translateY(-12px) scale(.98);
    pointer-events: none;
    transition: opacity .35s var(--ease-soft), transform .4s var(--ease-out);
  }
  .nav-links.open { opacity: 1; transform: none; pointer-events: auto; }
  .nav-links a { padding: 13px 14px; }
  .nav-links a::after { left: 14px; bottom: 50%; }
}

@media (max-width: 760px) {
  /* Sur un telephone, la barre d'outils tient sur plusieurs lignes : collee
     en haut, l'en-tete mangerait plus du tiers de l'ecran. Ici elle defile
     avec la page, et l'ecran reste a la personne qui travaille. */
  .admin-page .site-header { position: static; }

  :root { --gutter: 18px; }
  body { font-size: 16px; }

  /* Sur téléphone, le titre passe avant l'illustration. */
  .hero-art { order: 0; min-height: 230px; margin-top: 18px; }
  .hero { padding-top: 34px; }

  .year-bar { border-radius: var(--radius); }
  .year-bar .hint { display: none; }
  .lightbox { grid-template-columns: 1fr; }
  .lightbox .prev { position: absolute; left: 16px; bottom: 60px; }
  .lightbox .next { position: absolute; right: 16px; bottom: 60px; }
  .admin-toolbar { position: static; }
}

/* Téléphone tenu debout : deux colonnes, pas trois. Trois donneraient des
   cases de 100 px, où l'on ne distingue plus rien. Au-dessus de cette
   largeur — téléphone couché, tablette — trois colonnes valent mieux que
   deux : à deux, la case passerait 350 px et la vignette serait agrandie. */
@media (max-width: 620px) {
  /* Une photo par ligne. A deux colonnes, chaque vignette ne faisait plus
     que 156 px de large sur un telephone : des photos de groupe ou l'on ne
     reconnaissait personne. Ce sont elles qu'on vient voir. */
  .gallery { columns: 1; column-gap: 0; }
  .gallery figure { margin-bottom: 14px; }

  /* Les chiffres-cles passent les uns sous les autres. A deux colonnes la
     case tombait a 161 px, et l'intitule « 6 branches : louveteaux,
     louvettes, eclaireurs, eclaireuses, routiers, pionnieres » s'etalait
     sur SEPT lignes : la rangee du bas faisait 253 px contre 167 en haut,
     et l'ensemble avait l'air casse. Sur une colonne, chaque chiffre tient
     sur une ou deux lignes. */
  .stats { grid-template-columns: 1fr; }
  .stat { padding: 22px 24px; }
}

/* Petits téléphones : la marque se resserre pour que le nom du groupe et le
   bouton du menu tiennent sur une seule ligne. */
@media (max-width: 420px) {
  .brand { gap: 10px; }
  .brand .logo-knot { width: 66px; }
  .brand-text strong { font-size: .88rem; }
  /* « Bsalim · Scouts du Liban » tombait à 9,6 px pour tenir à côté du
     logo. Le héros affiche déjà la même ligne juste en dessous, et le
     pied de page aussi : autant la retirer que la rendre illisible. */
  .brand-text span { display: none; }
}

/*  Écrans tactiles (téléphones, tablettes), quelle que soit la largeur.

    a) Les champs de saisie passent à 16 px. En dessous de 16 px, Safari sur
       iPhone agrandit toute la page dès qu’on touche un champ, et ne la
       remet pas comme avant : se connecter à l’administration devenait
       désagréable sur téléphone.
    b) Les liens et boutons font au moins 44 px de haut. Mesuré avant :
       le lien « Administration du site » du pied de page n’en faisait que
       16, le retour « Toutes les unités » 22, et les lignes de contact 23 —
       en dessous du minimum recommandé, donc difficiles à viser. */
@media (pointer: coarse) {
  input, select, textarea { font-size: 16px; }

  /* Le lien du logo : sans cela il ne fait que la hauteur de son texte. */
  .brand { min-height: 44px; }
  .contact-line { min-height: 44px; }
  .unit-header .back { padding: 11px 0; }
  .footer-bottom a { display: inline-block; padding: 14px 0; }
  .footer-links a { display: inline-block; min-height: 44px; }
  .year-tab { padding: 12px 20px; }
}

/* --------------------------------------- 12. Mouvement réduit & impression */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  [data-reveal] { opacity: 1 !important; transform: none !important; clip-path: none !important; }
  .mask > span { transform: none !important; }
  .loader { display: none; }
}

@media print {
  .site-header, .site-footer, .demo-banner, .scroll-progress, .loader, .marquee, .year-bar, .unit-nav { display: none !important; }
  body::before, .hero::before, .hero::after { display: none; }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
  .unit-header { background: #fff; color: #000; }
  .unit-header h1, .unit-header .desc { color: #000; }
  /* Sur papier la banniere redevient blanche : la photo de fond et son voile
     n'ont plus lieu d'etre, et le texte doit rester noir sur blanc. */
  .unit-header .fond, .unit-header::before { display: none !important; }
}

/* ===========================================================================
   13. Nouveaux blocs : thème de l'année, capacités, informations d'unité,
       boîtes de dialogue de l'administration, légendes de photos.
   =========================================================================== */

/* -- Étiquette de branche en haut des cartes d'unité ---------------------- */
.unit-card .branch-tag {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 2;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-2);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
  transition: background .4s var(--ease-soft), color .4s var(--ease-soft),
              border-color .4s var(--ease-soft);
}
.unit-card:hover .branch-tag {
  border-color: transparent;
  background: var(--red);
  color: #fff;
}

/* -- Le thème de l'année ------------------------------------------------- */
.theme-band {
  position: relative;
  overflow: hidden;
  padding: clamp(44px, 7vw, 86px) clamp(26px, 5vw, 70px);
  border-radius: var(--radius-lg);
  background: var(--ink);
  color: #fff;
  text-align: center;
}
/* Deux lueurs rouges très diffuses, pour que le noir ne soit pas plat. */
.theme-band::before,
.theme-band::after {
  content: "";
  position: absolute;
  width: 46%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(200, 16, 46, .55), transparent 68%);
  pointer-events: none;
}
.theme-band::before { top: -22%; left: -10%; }
.theme-band::after { right: -12%; bottom: -30%; }
.theme-band > * { position: relative; }
.theme-band .eyebrow { color: rgba(255, 255, 255, .72); }
.theme-band .eyebrow::before { background: var(--red); }
.theme-band blockquote {
  margin: 20px auto 0;
  max-width: 24ch;
  font-family: var(--font-display);
  font-size: clamp(2rem, 5.4vw, 3.9rem);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -.02em;
}
.theme-band p {
  margin: 22px auto 0;
  max-width: 46ch;
  font-size: .96rem;
  color: #c6c6cd;
}

/* -- Les cinq capacités -------------------------------------------------- */
/* Il y a cinq capacités, un nombre impair. Avec des colonnes automatiques on
   tombait sur quatre colonnes : la cinquième carte restait seule et laissait
   trois cases grises à côté d'elle. On fixe donc le nombre de colonnes à
   chaque taille d'écran, et la dernière carte s'étire pour finir la ligne. */
.capacities {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  margin-top: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
  overflow: hidden;
}
.capacity {
  padding: 30px 26px 34px;
  background: var(--paper);
  transition: background .45s var(--ease-soft);
}
.capacity:hover { background: var(--red-soft); }
.capacity .num {
  display: block;
  font-family: var(--font-display);
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--red);
}
.capacity h3 {
  margin-top: 14px;
  font-size: 1.12rem;
  letter-spacing: -.01em;
}
.capacity p {
  margin-top: 10px;
  font-size: .88rem;
  line-height: 1.6;
  color: var(--ink-3);
}
@media (max-width: 1140px) {
  .capacities { grid-template-columns: repeat(3, 1fr); }
  .capacity:last-child { grid-column: span 2; }
}
@media (max-width: 760px) {
  .capacities { grid-template-columns: repeat(2, 1fr); }
  .capacity { padding: 26px 22px 28px; }
}
@media (max-width: 520px) {
  .capacities { grid-template-columns: 1fr; }
  .capacity:last-child { grid-column: span 1; }
}

/* -- Informations pratiques d'une unité ---------------------------------- */
.unit-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 22px 34px;
  margin-bottom: 34px;
  padding: 26px 30px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  border-radius: var(--radius);
  background: var(--paper-2);
}
.info-item .lbl {
  display: block;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.info-item .val {
  display: block;
  margin-top: 8px;
  font-size: .98rem;
  font-weight: 600;
  color: var(--ink);
}
.contact-line {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: .94rem;
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  transition: color .3s var(--ease-soft);
}
.contact-line + .contact-line { margin-top: 7px; }
.contact-line:hover { color: var(--red); }
.contact-line .ic { color: var(--red); font-size: .9em; }
/* Le pictogramme d'Instagram est un dessin, pas un caractère : sans ceci il
   repose sur la ligne d'écriture et se retrouve décalé vers le bas. */
.contact-line .ic svg { display: block; }

/* Les mêmes tuiles, posées sur le bandeau noir de bas de page. */
.band-contacts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(226px, 1fr));
  gap: 10px;
  margin-top: 26px;
  text-align: left;
}
.band-contacts .contact-line { color: #c6c6cd; }
.band-contacts .contact-line:hover { color: #fff; }
.band-contacts .contact-line + .contact-line { margin-top: 0; }

/* -- Boîtes de dialogue de l'administration ------------------------------ */
/* Remplacent prompt() et confirm(), qui ouvraient une fenêtre grise du
   navigateur — hors thème, et bloquée dans certains navigateurs intégrés. */
.modal-back {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(12, 12, 13, .52);
  backdrop-filter: blur(3px);
  animation: modal-fade .22s var(--ease-out) both;
}
.modal {
  width: min(100%, 460px);
  padding: 30px 30px 26px;
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow-2);
  animation: modal-rise .32s var(--ease-out) both;
}
.modal h2 { font-size: 1.32rem; letter-spacing: -.015em; }
.modal p { margin-top: 10px; font-size: .92rem; line-height: 1.58; }
.modal .field { margin: 20px 0 0; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 26px;
}
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-rise {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

/* -- Légende modifiable sous chaque photo de l'administration ------------ */
.thumb .caption-input {
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: var(--paper);
  font-size: .8rem;
}
.thumb .caption-input:focus {
  background: var(--red-soft);
  outline: 2px solid var(--red);
  outline-offset: -2px;
}

@media (prefers-reduced-motion: reduce) {
  .modal-back, .modal { animation: none; }
}

/* Carte proposée une seule fois, quand Firestore est encore vide. */
.seed-card {
  border-left: 3px solid var(--red);
  background: var(--red-soft);
}
.seed-card h2 { color: var(--red-dark); }
.seed-card .btn { margin-top: 18px; }

/* L'unité d'un compte qui n'en gère qu'une : affichée, non modifiable. */
.unit-fixed {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: -.01em;
  color: var(--ink);
}


/* ===========================================================================
   Tuiles de contact
   ---------------------------------------------------------------------------
   Avant, les trois contacts étaient trois lignes de texte presque
   identiques : rien ne disait lequel était l'e-mail, et sur un téléphone la
   cible à toucher ne faisait que la hauteur d'une ligne. Chaque contact est
   maintenant une tuile, avec son pictogramme dans une pastille, son
   intitulé, et la valeur mise en avant.
   =========================================================================== */
.contact-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border-radius: 14px;
  background: var(--paper-2);
  border: 1px solid transparent;
  text-decoration: none;
  color: inherit;
  transition: transform .35s var(--ease),
              background .35s var(--ease-soft),
              border-color .35s var(--ease-soft),
              box-shadow .35s var(--ease);
}
.contact-card + .contact-card { margin-top: 8px; }
.contact-card:hover {
  background: var(--paper);
  border-color: var(--red);
  transform: translateY(-2px);
  box-shadow: var(--shadow-1);
}
.contact-card .cc-ic {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--red-soft);
  color: var(--red);
  font-size: .95rem;
  transition: background .35s var(--ease-soft), color .35s var(--ease-soft);
}
.contact-card:hover .cc-ic { background: var(--red); color: #fff; }
.contact-card .cc-ic svg { display: block; }
.cc-txt { display: flex; flex-direction: column; min-width: 0; }
.cc-lbl {
  font-size: .64rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--muted);
}
.cc-val {
  font-size: .95rem;
  font-weight: 600;
  color: var(--ink);
  overflow-wrap: anywhere;   /* une adresse longue ne doit pas déborder */
}
.cc-note { font-size: .78rem; color: var(--ink-3); }

/* Sur le bandeau noir : mêmes tuiles, couleurs inversées. */
.band-contacts .contact-card {
  background: rgba(255, 255, 255, .07);
  border-color: rgba(255, 255, 255, .12);
}
.band-contacts .contact-card + .contact-card { margin-top: 0; }
.band-contacts .contact-card:hover {
  background: rgba(255, 255, 255, .13);
  border-color: rgba(255, 255, 255, .34);
  box-shadow: none;
}
.band-contacts .cc-ic { background: rgba(255, 255, 255, .14); color: #fff; }
.band-contacts .cc-lbl { color: rgba(255, 255, 255, .6); }
.band-contacts .cc-val { color: #fff; }
.band-contacts .cc-note { color: rgba(255, 255, 255, .72); }

/* Les deux boutons du bandeau « Rejoindre ». */
.cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

/* ===========================================================================
   « Trouver son unité » — deux questions, une réponse
   =========================================================================== */
.join { padding: clamp(34px, 6vw, 80px) 0 clamp(60px, 9vw, 110px); }
.join .back {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--muted);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 600;
}
.join .back:hover { color: var(--red); }
.join-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.1rem);
  line-height: 1.05;
  margin: 6px 0 30px;
}

.join-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  list-style: none;
  padding: 0;
  margin: 0 0 30px;
}
.join-steps li {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: .84rem;
  font-weight: 600;
  color: var(--muted);
}
.join-steps .num {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--paper-3);
  color: var(--ink-3);
  font-size: .74rem;
}
.join-steps li.current { color: var(--ink); }
.join-steps li.current .num { background: var(--red); color: #fff; }
.join-steps li.done { color: var(--ink-3); }
.join-steps li.done .num { background: var(--red-soft); color: var(--red); }

.join-q {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 3vw, 1.9rem);
  margin: 0 0 6px;
}
.join-sub { color: var(--muted); margin: 0 0 4px; font-size: .92rem; }
.join-sub a { color: var(--red); }

.join-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(212px, 1fr));
  gap: 14px;
  margin-top: 24px;
}
/* Sur un ecran large, deux ou trois choix etires sur toute la largeur
   donnent des cartes enormes pour deux mots : on les plafonne et on les
   range a gauche. Sur telephone elles gardent toute la largeur, sinon
   elles paraissent plus etroites que le texte au-dessus. */
@media (min-width: 760px) {
  .join-choices {
    grid-template-columns: repeat(auto-fit, minmax(212px, 300px));
    justify-content: start;
  }
}
.join-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 24px;
  border-radius: var(--radius);
  background: var(--paper-2);
  border: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  transition: transform .4s var(--ease), border-color .35s var(--ease-soft),
              background .35s var(--ease-soft), box-shadow .4s var(--ease);
}
.join-choice:hover {
  background: var(--paper);
  border-color: var(--red);
  transform: translateY(-3px);
  box-shadow: var(--shadow-1);
}
.jc-emblem { font-size: 1.9rem; line-height: 1; margin-bottom: 6px; }
.jc-main { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; }
.jc-hint { font-size: .84rem; color: var(--muted); }

.join-result {
  margin-top: 26px;
  padding: clamp(26px, 4vw, 42px);
  border-radius: var(--radius-lg);
  background: var(--paper-2);
  border: 1px solid var(--line);
}
.jr-emblem { font-size: 2.6rem; line-height: 1; display: block; }
.jr-kicker {
  display: block;
  margin-top: 14px;
  font-size: .68rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--red);
}
.join-result h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  margin: 6px 0 4px;
}
.jr-people { color: var(--ink-3); font-weight: 600; margin: 0 0 14px; }
.jr-desc { color: var(--ink-2); margin: 0 0 14px; max-width: 62ch; }
.jr-meet { margin: 0 0 20px; font-size: .92rem; color: var(--ink-2); }
.jr-meet strong { color: var(--ink); margin-right: 6px; }
.jr-contacts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(226px, 1fr));
  gap: 10px;
  margin: 0 0 24px;
}
.jr-contacts .contact-card { background: var(--paper); }
.jr-contacts .contact-card + .contact-card { margin-top: 0; }

.join-help { margin-top: 24px; color: var(--muted); font-size: .92rem; }
.join-help a { color: var(--red); font-weight: 600; }
.join-restart { margin-top: 10px; }
.join-restart a { color: var(--muted); font-size: .88rem; text-decoration: none; }
.join-restart a:hover { color: var(--red); }

/* Le lien « Rejoindre » de la barre : c'est l'action que le site attend
   d'un visiteur qui découvre le groupe, elle ne doit pas se fondre dans
   la liste des unités. */
.nav-join {
  padding: 7px 15px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-weight: 700;
}
.nav-join:hover, .nav-join:focus-visible { background: var(--red-dark); color: #fff; }


/* ===========================================================================
   Administration : onglets, tableau de bord, droits
   ---------------------------------------------------------------------------
   L'administration ouvrait droit sur l'éditeur d'une année, c'est-à-dire sur
   sa page la plus dense. Une cheftaine qui vient ajouter deux noms voit
   maintenant d'abord où en est son unité, et choisit ensuite dans quelle
   partie elle entre.
   =========================================================================== */
.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-2);
}
.admin-tabs button {
  appearance: none;
  padding: 9px 20px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: .9rem;
  font-weight: 650;
  cursor: pointer;
  transition: background .3s var(--ease-soft), color .3s var(--ease-soft);
}
.admin-tabs button:hover { background: var(--paper); color: var(--ink); }
.admin-tabs button.active {
  background: var(--red);
  color: #fff;
  box-shadow: var(--shadow-1);
}
@media (max-width: 620px) {
  .admin-tabs { border-radius: var(--radius); }
  .admin-tabs button { flex: 1 1 auto; padding: 9px 12px; font-size: .84rem; }
}

/* --- Tableau de bord ---------------------------------------------------- */
.dash-hello h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.4vw, 2.1rem);
  margin: 4px 0 8px;
}
.dash-hello p { color: var(--ink-2); margin: 0; }
.dash-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

/* Les chiffres de l'année en cours. Une tuile vide ne dit pas « 0 » : elle
   dit ce qu'il reste à faire, sinon le zéro ressemble à une panne. */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
}
.stat-tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--paper-2);
  border: 1px solid var(--line);
}
.stat-tile .st-n {
  font-family: var(--font-display);
  font-size: 1.8rem;
  line-height: 1;
  color: var(--red);
}
.stat-tile .st-l { font-size: .84rem; color: var(--ink-2); font-weight: 600; }
.stat-tile .st-todo { font-size: .76rem; color: var(--muted); margin-top: 4px; }
.stat-tile.vide { background: var(--paper-3); }
.stat-tile.vide .st-n { color: var(--ink-3); }

.dash-help { background: var(--red-soft); border-color: rgba(200, 16, 46, .18); }
.dash-help ul { margin: 0; padding-left: 20px; color: var(--ink-2); }
.dash-help li + li { margin-top: 8px; }

/* --- Contacts ----------------------------------------------------------- */
/* Un span dans un .field est l'intitulé d'un champ : en majuscules et en petit.
   L'aide sous le champ est une phrase, elle doit se lire comme telle. */
.field > span.field-help {
  font-size: .8rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
}
.card h3.sub {
  margin: 26px 0 6px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: 1.1rem;
}

/* --- Droits ------------------------------------------------------------- */
.admin-list { display: flex; flex-direction: column; gap: 12px; }
.admin-row {
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--paper-2);
  border: 1px solid var(--line);
}
.ar-top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
/* Le nom ne doit pas pousser la case et la corbeille hors de vue. */
.ar-nom { flex: 1 1 200px; max-width: 340px; width: auto; }
.ar-groupe,
.ar-unites label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: .86rem;
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
  cursor: pointer;
}
.ar-groupe input, .ar-unites input { width: auto; margin: 0; accent-color: var(--red); }
.ar-groupe input:disabled, .ar-unites input:disabled { cursor: not-allowed; }
.ar-unites {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.ar-note {
  margin: 12px 0 0;
  font-size: .86rem;
  color: var(--red-dark);
  font-weight: 600;
}
.ar-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}
/* L'UID est là pour être comparé à la console Firebase, pas pour être lu :
   il reste discret, et ne pousse pas la ligne sur un téléphone. */
.ar-uid {
  flex: 1 1 auto;
  min-width: 0;
  font-size: .72rem;
  color: var(--ink-3);
  overflow-wrap: anywhere;
}
.admin-row .icon-btn:hover { transform: none; }

/* Les étapes à suivre dans la console Firebase. */
.guide {
  margin: 0 0 18px;
  padding-left: 22px;
  color: var(--ink-2);
}
.guide li { margin-bottom: 9px; }
.guide a { color: var(--red); font-weight: 600; }

/* ---------------------------------------------------------------------------
   Derniers ajustements pour les telephones.

   Ces regles sont tout en bas a dessein : les styles qu'elles corrigent sont
   definis plus haut dans le fichier, et une requete media n'ajoute aucune
   priorite. Placees plus tot, elles etaient tout simplement ignorees.
--------------------------------------------------------------------------- */
@media (max-width: 620px) {
  /* Deux intitules en majuscules espacees tombaient a 10,2 px et 10,9 px :
     trop petit pour etre lu sur un telephone. */
  .cc-lbl { font-size: .72rem; }

  /* Deux unites par ligne sur un telephone. A une seule par ligne, les six
     cartes faisaient cinq ecrans de defilement et on ne voyait jamais le
     choix dans son ensemble. A cette largeur la carte ne garde que ce qui
     sert a choisir : la photo, le nom et l'age. La description et la
     mention « Decouvrir l'unite » partent — la carte entiere est deja un
     lien, et le texte complet est sur la page de l'unite. */
  .unit-grid { gap: 12px; }
  .unit-card p,
  .unit-card .go { display: none; }
  .uc-corps { padding: 13px 14px 16px; }
  /* Fraunces est plus large que la police precedente : a 1,02 rem « Clan
     St. Mercure » passait sur deux lignes et sa carte depassait sa voisine.
     Les six noms tiennent sur une ligne a cette taille. */
  .unit-card h3 { font-size: .94rem; line-height: 1.2; }
  .unit-card .age { margin-top: 4px; font-size: .78rem; }
  .unit-card .branch-tag { top: 9px; right: 9px; padding: 4px 9px; font-size: .67rem; }

  /* La photo du haut passe au format paysage. En portrait elle faisait
     405 px de haut et poussait le titre et le bouton hors de l'ecran : le
     haut de page atteignait une fois et demie la hauteur du telephone. */
  .hero-photo { aspect-ratio: 4 / 3; }
  .hero-badge { width: 92px; height: 92px; padding: 6px; }
}

/* `hidden` doit l'emporter sur les regles d'affichage du menu et du pied de
   page : sans cela, un `display: flex` plus specifique rendrait visible un
   element pourtant marque comme cache (le lien « Admin », notamment). */
[hidden] { display: none !important; }

/* ---------------------------------------------------------------------------
   Onglet « Le groupe » de l'administration
--------------------------------------------------------------------------- */
/* L'apercu de la photo du groupe. Le cadre garde la meme forme que le haut
   de l'accueil, pour que la maitrise voie tout de suite ce qui sera coupe. */
.photo-groupe {
  aspect-ratio: 4 / 3;
  max-width: 420px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-2);
}
.photo-groupe img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pg-vide {
  display: grid;
  place-items: center;
  height: 100%;
  padding: 20px 26px;
  text-align: center;
  font-size: .88rem;
  line-height: 1.6;
  color: var(--muted);
}
.pg-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

/* Le bouton-portrait au debut d'une ligne de maitrise. C'est la photo
   elle-meme qu'on clique pour la changer. */
.av-btn {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  overflow: hidden;
  border: 1px dashed var(--line);
  border-radius: 50%;
  background: var(--paper-2);
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  transition: border-color .3s var(--ease-soft), transform .3s var(--ease);
}
.av-btn:hover { border-color: var(--red); transform: scale(1.06); }
.av-btn.rempli { border-style: solid; border-color: var(--line); }
.av-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.icon-btn.av-del { flex: 0 0 auto; }

/* ===========================================================================
   Actualités, dates et calendrier
   ---------------------------------------------------------------------------
   Deux colonnes sur un écran large : les dates à gauche, qu'on lit, et le
   calendrier à droite, qu'on regarde. Sur un téléphone le calendrier passe
   en premier, en plus petit : une grille de sept colonnes ne se réduit pas
   davantage sans devenir illisible.
   =========================================================================== */

/* -- La bande des prochaines dates, sur l'accueil ------------------------- */
.bande-dates {
  background: var(--paper-2);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 26px 0 30px;
}
.bd-tete {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.bd-tout {
  font-size: .88rem;
  font-weight: 600;
  color: var(--red);
  text-decoration: none;
}
.bd-tout:hover { text-decoration: underline; }
.bd-liste {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.bd-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: inherit;
  transition: transform .25s var(--ease-soft), box-shadow .25s var(--ease-soft);
}
.bd-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-1); }
.bd-jour {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 48px;
  padding: 6px 0;
  background: var(--red-soft);
  border-radius: var(--radius-sm);
  line-height: 1.1;
}
.bd-jour strong { font-family: var(--font-display); font-size: 1.3rem; color: var(--red); }
.bd-jour span { font-size: .7rem; color: var(--ink-3); }
.bd-texte { display: grid; gap: 2px; min-width: 0; }
.bd-texte strong { font-size: .95rem; }
.bd-texte span {
  font-size: .82rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* -- La page --------------------------------------------------------------- */
.actus { padding: 54px 0 90px; }
.actus-titre { font-size: clamp(2rem, 4.4vw, 3.1rem); margin: 6px 0 34px; }
.actus-haut {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 40px;
  align-items: start;
}
.actus h2 {
  font-size: 1.32rem;
  margin: 0 0 18px;
}
.actus .vide {
  color: var(--muted);
  padding: 18px 0;
}

/* -- Une date -------------------------------------------------------------- */
.date-item {
  display: flex;
  gap: 18px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  scroll-margin-top: 90px;
}
.date-item:first-of-type { border-top: 0; padding-top: 0; }
.date-item.passe { opacity: .62; }
.date-item.vise {
  background: var(--red-soft);
  border-radius: var(--radius-sm);
  padding-left: 12px;
  padding-right: 12px;
}
.di-jour {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  align-content: center;
  width: 62px;
  height: 62px;
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius-sm);
  line-height: 1.05;
}
.di-jour strong { font-family: var(--font-display); font-size: 1.5rem; }
.di-jour span { font-size: .72rem; opacity: .8; }
.di-corps { min-width: 0; }
.di-corps h3 { font-size: 1.1rem; margin: 0 0 4px; }
.di-quand { margin: 0; font-size: .9rem; color: var(--red); font-weight: 600; }
.di-lieu { margin: 2px 0 0; font-size: .88rem; color: var(--muted); }
.di-texte { margin: 10px 0 0; font-size: .94rem; color: var(--ink-2); }
.di-corps .branch-tag { position: static; display: inline-block; margin-top: 8px; }
.actus-passe { margin-top: 26px; }
.actus-passe summary {
  cursor: pointer;
  font-size: .9rem;
  color: var(--muted);
  padding: 8px 0;
}

/* -- Le calendrier --------------------------------------------------------- */
.calendrier {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  position: sticky;
  top: 86px;
}
.cal-tete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.cal-tete strong { font-family: var(--font-display); font-size: 1rem; }
.cal-fleche {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  text-decoration: none;
  color: var(--ink-2);
  font-size: 1.2rem;
  line-height: 1;
}
.cal-fleche:hover { background: var(--paper-3); }
.cal-grille {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.cal-nom {
  display: grid;
  place-items: center;
  height: 26px;
  font-size: .7rem;
  color: var(--muted);
}
.cal-jour, .cal-vide {
  display: grid;
  place-items: center;
  height: 36px;
  border-radius: var(--radius-sm);
  font-size: .86rem;
  color: var(--ink-2);
  border: 0;
  background: none;
  font-family: inherit;
}
button.cal-jour { cursor: pointer; }
.cal-jour.a-date {
  background: var(--red);
  color: #fff;
  font-weight: 600;
}
.cal-jour.a-date:hover { background: var(--red-dark); }
.cal-jour.aujourdhui { outline: 2px solid var(--ink); outline-offset: -2px; }
.cal-retour {
  display: block;
  margin-top: 12px;
  font-size: .82rem;
  color: var(--red);
  text-decoration: none;
}

/* -- Les actualités -------------------------------------------------------- */
.actus-nouvelles { margin-top: 56px; }
.actu {
  padding: 26px 0;
  border-top: 1px solid var(--line);
  max-width: 760px;
}
.actu-date {
  margin: 0 0 4px;
  font-size: .82rem;
  color: var(--muted);
  text-transform: lowercase;
}
.actu h3 { font-size: 1.3rem; margin: 0 0 10px; }
.actu-texte { font-size: .97rem; color: var(--ink-2); line-height: 1.68; }

/* -- Les pièces jointes ---------------------------------------------------- */
.pj-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.pj-img { margin: 0; }
.pj-img img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--paper-2);
  display: block;
}
.pj-docs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.pj {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: .88rem;
  color: var(--ink);
  transition: border-color .2s var(--ease-soft), box-shadow .2s var(--ease-soft);
}
.pj:hover { border-color: var(--red); box-shadow: var(--shadow-1); }
.pj[disabled] { opacity: .6; cursor: progress; }
.pj-ic {
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: .06em;
  padding: 4px 6px;
  border-radius: 5px;
  background: var(--red-soft);
  color: var(--red);
}
.pj-nom { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pj-poids { color: var(--muted); font-size: .8rem; }

@media (max-width: 1000px) {
  /* Sur un écran étroit, les dates restent en premier : ce sont elles qu'on
     vient lire. Le calendrier, qui sert à se repérer, passe en dessous —
     mis en haut, il repoussait la première sortie hors de l'écran. */
  .actus-haut { grid-template-columns: 1fr; gap: 28px; }
  .calendrier { position: static; max-width: 420px; }
}
@media (max-width: 760px) {
  .bd-liste { grid-template-columns: 1fr; }
  .actus { padding: 34px 0 60px; }
  .di-jour { width: 52px; height: 52px; }
  .di-jour strong { font-size: 1.25rem; }
  .pj-nom { max-width: 150px; }
}

/* ===========================================================================
   Administration — onglet « Actualités »
   =========================================================================== */

/* Le formulaire ouvert, pour qu'on voie d'un coup d'œil ce qu'on modifie. */
.card.surligne {
  border-color: var(--red);
  box-shadow: var(--shadow-1);
}

/* Deux champs côte à côte : date de début et de fin, heure et lieu. */
.duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

/* La liste des dates et des actualités déjà publiées. */
.liste-admin {
  list-style: none;
  margin: 14px 0 18px;
  padding: 0;
}
.liste-admin li {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.liste-admin li.passe { opacity: .55; }
.la-date {
  font-variant-numeric: tabular-nums;
  font-size: .85rem;
  color: var(--ink-3);
}
.la-titre {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.la-note { font-size: .8rem; color: var(--muted); }

/* Les pièces jointes dans le formulaire. */
.pj-form {
  list-style: none;
  margin: 8px 0 12px;
  padding: 0;
}
.pj-form li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--paper-2);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}
.pj-form li.neuf { background: var(--red-soft); }
.pjf-nom {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .9rem;
}
.pjf-poids { font-size: .8rem; color: var(--muted); }

@media (max-width: 760px) {
  .duo { grid-template-columns: 1fr; }
  .liste-admin li {
    grid-template-columns: minmax(0, 1fr) auto auto;
    row-gap: 4px;
  }
  .la-date { grid-column: 1 / -1; }
  .la-note { grid-column: 1 / -1; }
}

/* ===========================================================================
   Barre de navigation : « Nos unités » en panneau
   ---------------------------------------------------------------------------
   La barre portait neuf liens de front — l'accueil, les six unités, les
   actualités, « Rejoindre ». Tout avait le même poids, donc rien ne se
   voyait. Les unités sont maintenant derrière une seule entrée.
   =========================================================================== */

.nav-groupe { position: relative; }

/* L'étiquette « Nos unités » du menu téléphone : inutile sur grand écran,
   où le bouton porte déjà le mot. */
.nav-titre { display: none; }

.nav-deroulant {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border: 0;
  border-radius: 999px;
  background: none;
  font-family: inherit;
  font-size: .92rem;
  font-weight: 550;
  color: var(--ink-2);
  cursor: pointer;
  transition: color .3s var(--ease-soft), background .3s var(--ease-soft);
}
.nav-deroulant:hover { background: var(--paper-2); }
.nav-deroulant.active { color: var(--ink); font-weight: 650; }
.nav-deroulant .chev {
  font-size: .7rem;
  transition: transform .3s var(--ease-soft);
}
.nav-groupe.ouvert .nav-deroulant { background: var(--paper-2); }
.nav-groupe.ouvert .chev { transform: rotate(180deg); }

.nav-panneau {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translate(-50%, -8px);
  width: 330px;
  padding: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s var(--ease-soft), transform .3s var(--ease-out);
  z-index: 20;
}
.nav-groupe.ouvert .nav-panneau {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}
.nav-links .nav-panneau a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.nav-links .nav-panneau a::after { display: none; }
.nav-links .nav-panneau a.active { background: var(--red-soft); color: var(--red); }
.nu-nom { font-weight: 600; }
.nu-age { font-size: .78rem; color: var(--muted); }

@media (max-width: 860px) {
  /* Dans le menu replié, les unités ne se cachent pas derrière un second
     geste : elles s'affichent en deux colonnes, sous leur titre. */
  .nav-deroulant { display: none; }
  .nav-titre {
    display: block;
    padding: 12px 14px 4px;
    font-size: .72rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .nav-panneau {
    position: static;
    width: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }
  .nav-links .nav-panneau a {
    display: block;
    padding: 10px 12px;
  }
  .nu-age { display: block; }

  /* Le point rouge de la page courante se posait sur la première lettre.
     Dans le menu replié, la page courante se marque par un fond, pas par
     une pastille au milieu du mot. */
  .nav-links a::after { display: none; }
  .nav-links a.active { background: var(--paper-2); }
  .nav-links .nav-join { margin-top: 8px; text-align: center; }
}

/* -- Les événements sur plusieurs jours ------------------------------------
   « 12–14 déc. » tient dans le pavé si on réduit un peu le chiffre ; « 30 nov.
   → 2 déc. » n'y tient pas, alors le pavé s'élargit et passe sur deux lignes. */
.bd-jour.multi strong,
.di-jour.multi strong { font-size: 1.15rem; letter-spacing: -.01em; white-space: nowrap; }
.bd-jour.multi strong { font-size: .95rem; }
.di-jour.multi strong { font-size: 1.2rem; }

.bd-jour.deux-mois,
.di-jour.deux-mois { width: auto; padding-left: 8px; padding-right: 8px; }
.bd-jour.deux-mois { min-width: 48px; }
.bd-jour.multi { min-height: 47px; }
.di-jour.deux-mois { min-width: 62px; }
.bd-jour.deux-mois strong,
.di-jour.deux-mois strong { font-size: .78rem; white-space: nowrap; }
.di-jour.deux-mois strong { font-size: .88rem; }

/* ===========================================================================
   Les commandes de la photo du haut
   ===========================================================================
   Trois boutons posés sur la photo : reculer, plein écran, avancer. Ils sont
   cachés tant qu'on ne les demande pas — la photo d'accueil doit rester une
   photo. Sur ordinateur le survol les fait venir ; au doigt, un appui sur
   l'image ajoute « cmd-vue » et c'est la même chose. */
.hs-cmd {
  position: absolute;
  z-index: 4;
  inset: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  /* Le cadre couvre toute la photo pour placer les flèches sur les bords et
     le plein écran dans le coin ; sans cela il avalerait le clic qui doit
     faire apparaître ou disparaître les boutons. */
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s var(--ease-soft), visibility .25s;
}
.hero-photo:hover .hs-cmd,
.hero-photo:focus-within .hs-cmd,
.hero-photo.cmd-vue .hs-cmd {
  opacity: 1;
  visibility: visible;
}

.hs-cmd button {
  pointer-events: auto;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(14, 14, 16, .55);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background .18s var(--ease-soft), transform .18s var(--ease-soft);
}
.hs-cmd button:hover { background: var(--red); transform: scale(1.08); }
.hs-cmd button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Le bouton du milieu est plus discret : on ne va en plein écran que si on
   l'a cherché, alors que les flèches servent à chaque passage. */
.hs-cmd .hs-plein {
  position: absolute;
  top: 0;
  right: 0;
  width: 34px;
  height: 34px;
  font-size: 1rem;
}

/* Sur un écran tactile il n'y a pas de survol : la photo ne doit pas garder
   les boutons allumés après un appui qui voulait seulement les faire
   disparaître. La classe suffit, on retire donc la règle de survol. */
@media (hover: none) {
  .hero-photo:hover .hs-cmd { opacity: 0; visibility: hidden; }
  .hero-photo.cmd-vue .hs-cmd { opacity: 1; visibility: visible; }
}

@media (max-width: 760px) {
  .hs-cmd { inset: 8px; }
  .hs-cmd button { width: 36px; height: 36px; font-size: 1.3rem; }
  .hs-cmd .hs-plein { width: 32px; height: 32px; font-size: .92rem; }
}

/* ===========================================================================
   Administration — onglet « Carnet »
   ===========================================================================
   Le classeur de l'unité. Le sommaire montre d'emblée tout ce que le carnet
   contiendra : une cheftaine qui vient de l'Excel doit reconnaître ses
   feuilles, même celles qui ne sont pas encore posées. */
.carnet-tete {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: start;
}
.carnet-tete h2 { margin: 6px 0 8px; }
.carnet-tete .muted { margin: 0; max-width: 60ch; font-size: .92rem; }
.carnet-chiffres { display: flex; gap: 12px; }

/* Le sommaire : une tuile par page du carnet. */
.carnet-sommaire {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
  margin: 18px 0 22px;
}
.carnet-page {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 2px 12px;
  padding: 14px 16px;
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .18s var(--ease-soft), box-shadow .18s var(--ease-soft);
}
.carnet-page:hover { border-color: var(--red); box-shadow: var(--shadow-1); }
.carnet-page.active { border-color: var(--red); background: var(--red-soft); }
.cp-icone { grid-row: 1 / 3; font-size: 1.4rem; line-height: 1; }
.cp-titre { font-weight: 650; font-size: .95rem; }
.cp-titre em {
  font-style: normal;
  font-size: .72rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: 4px;
  vertical-align: 1px;
}
.cp-texte { font-size: .84rem; color: var(--muted); }

/* Les pages pas encore écrites restent visibles mais sans promesse : on ne
   met pas un bouton mort sous la main d'une cheftaine pressée. */
.carnet-page.a-venir { cursor: default; opacity: .62; }
.carnet-page.a-venir:hover { border-color: var(--line); box-shadow: none; }

/* Le résumé du calendrier, sous les deux dates. */
.carnet-resume {
  margin: 14px 0 0;
  padding: 12px 14px;
  background: var(--paper-2);
  border-left: 3px solid var(--red);
  border-radius: var(--radius-sm);
  font-size: .92rem;
}

/* Le petit compteur à côté du nom d'une liste. */
.liste-compte {
  display: inline-block;
  margin-left: 6px;
  padding: 0 7px;
  background: var(--paper-2);
  border-radius: 999px;
  font-size: .75rem;
  color: var(--muted);
  font-weight: 500;
}

.liste-codes { margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.liste-codes li { font-size: .92rem; }
.liste-codes strong {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-right: 8px;
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: .82rem;
}
.liste-codes .muted { font-size: .84rem; margin-left: 6px; }

@media (max-width: 860px) {
  .carnet-tete { grid-template-columns: 1fr; }
  .carnet-chiffres { flex-wrap: wrap; }
}

/* -- Carnet : la page « Les scouts » --------------------------------------
   Pas de tableau à 22 colonnes : une ligne par scout avec ce qu'on regarde
   en faisant l'appel, et la fiche complète seulement quand on l'ouvre. */
.scouts-tete {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.scouts-tete h2 { margin: 0 0 4px; }

.scouts-filtres {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 10px;
  margin-top: 16px;
}

.scouts-liste { margin: 0; padding: 0; list-style: none; }
.scouts-liste li + li { border-top: 1px solid var(--line); }

.scout-ligne {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px 70px 54px;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 8px;
  text-align: left;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s var(--ease-soft);
}
.scout-ligne:hover { background: var(--paper-2); }
.scout-ligne.active { background: var(--red-soft); }
.sl-nom { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sl-eq, .sl-age { font-size: .86rem; color: var(--muted); }
.sl-marques { display: flex; gap: 6px; justify-content: flex-end; font-size: .95rem; }
.sl-p { color: var(--red); }

/* Les titres à l'intérieur d'une fiche de scout. */
.sc-titre {
  margin: 22px 0 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: .78rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
}
.sc-titre:first-of-type { margin-top: 8px; padding-top: 0; border-top: 0; }

/* Une case à cocher alignée avec son texte, et non au-dessus. */
.field .case {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-weight: 500;
}
.field .case input { width: 17px; height: 17px; margin: 0; }

.form-boutons { display: flex; align-items: center; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.form-boutons .spacer { flex: 1 1 auto; }

@media (max-width: 760px) {
  .scouts-filtres { grid-template-columns: 1fr; }
  /* Sur un téléphone, l'équipe passe sous le nom : trois colonnes de 90 px
     coupent les prénoms libanais en plein milieu. */
  .scout-ligne {
    grid-template-columns: minmax(0, 1fr) 54px;
    row-gap: 2px;
  }
  .sl-nom { grid-column: 1; }
  .sl-marques { grid-column: 2; grid-row: 1 / 3; }
  .sl-eq { grid-column: 1; grid-row: 2; }
  .sl-age { display: none; }
}

/* ---------------------------------------------------------------------------
   Carnet — Présences et La réunion

   Quatre couleurs, une par code, les mêmes partout : dans les boutons de
   l'appel, dans les compteurs, et dans la grille de la saison. Une cheftaine
   apprend la couleur une fois.

   P vert, R ambre, E bleu, A rouge. Le rouge du groupe reste réservé aux
   éléments du site, donc l'absence prend un rouge plus sombre et plus mat :
   deux rouges côte à côte se confondraient.
--------------------------------------------------------------------------- */
:root {
  --pr-P: #157f3d;
  --pr-P-fond: #e8f6ec;
  --pr-R: #9a6400;
  --pr-R-fond: #fdf3e0;
  --pr-E: #1d5fa8;
  --pr-E-fond: #e9f1fb;
  --pr-A: #a81f2e;
  --pr-A-fond: #fbebed;
}

.re-tete {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 24px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 18px;
}
.re-tete h2 { margin: 2px 0 4px; }

.re-barre {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.re-barre select { min-width: 15rem; max-width: 100%; }
.re-barre .icon-btn { font-size: 1.3rem; line-height: 1; }
.re-barre .icon-btn:disabled { opacity: .3; cursor: default; }

/* --- Les compteurs ------------------------------------------------------ */
.pr-compteurs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}
.prc {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 13px;
  font-size: .85rem;
  color: var(--ink-3);
  background: var(--paper);
}
.prc strong { color: var(--ink); }
.prc.c-P { background: var(--pr-P-fond); border-color: transparent; }
.prc.c-P strong { color: var(--pr-P); }
.prc.c-R { background: var(--pr-R-fond); border-color: transparent; }
.prc.c-R strong { color: var(--pr-R); }
.prc.c-E { background: var(--pr-E-fond); border-color: transparent; }
.prc.c-E strong { color: var(--pr-E); }
.prc.c-A { background: var(--pr-A-fond); border-color: transparent; }
.prc.c-A strong { color: var(--pr-A); }
.prc.a-faire { border-color: var(--ink-3); border-style: dashed; }
.prc.total {
  background: var(--ink);
  color: #fff;
  border-color: transparent;
  font-weight: 600;
}

.pr-raccourcis {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.pr-raccourcis .spacer { flex: 1 1 auto; }

/* --- L'appel, une ligne par scout --------------------------------------- */
.pr-liste { list-style: none; margin: 0; padding: 0; }
.pr-ligne {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 9rem auto;
  align-items: center;
  gap: 10px 14px;
  padding: 9px 2px;
  border-top: 1px solid var(--line);
}
.pr-ligne:first-child { border-top: 0; }
.pr-nom { font-weight: 600; }
.pr-eq { color: var(--muted); font-size: .88rem; }

.pr-codes { display: flex; gap: 6px; }
.pr-code {
  /* 42 px de haut : une cheftaine tape là-dessus debout, avec un enfant qui
     parle à côté. Plus petit, on se trompe de code. */
  min-width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink-3);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s var(--ease-soft), background .12s var(--ease-soft);
}
.pr-code:hover { background: var(--paper-2); }
.pr-code:active { transform: scale(.94); }
.pr-code.c-P.on { background: var(--pr-P); border-color: var(--pr-P); color: #fff; }
.pr-code.c-R.on { background: var(--pr-R); border-color: var(--pr-R); color: #fff; }
.pr-code.c-E.on { background: var(--pr-E); border-color: var(--pr-E); color: #fff; }
.pr-code.c-A.on { background: var(--pr-A); border-color: var(--pr-A); color: #fff; }

/* --- La grille de la saison --------------------------------------------- */
.gr-cadre {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  -webkit-overflow-scrolling: touch;
}
.gr-table {
  border-collapse: separate;
  border-spacing: 0;
  font-size: .82rem;
  white-space: nowrap;
}
.gr-table th, .gr-table td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0;
}
/* La colonne des noms reste visible quand on fait glisser la grille : sans
   elle, on ne sait plus de qui on lit la ligne. */
.gr-nom {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--paper);
  text-align: left;
  font-weight: 600;
  padding: 7px 12px !important;
  min-width: 10rem;
  box-shadow: 1px 0 0 var(--line);
}
thead .gr-nom { background: var(--paper-2); }
.gr-date { background: var(--paper-2); vertical-align: bottom; }
.gr-date button {
  border: 0;
  background: none;
  font: inherit;
  color: var(--ink-3);
  cursor: pointer;
  padding: 7px 8px;
  /* Les dates à la verticale : 43 colonnes à plat feraient trois écrans. */
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
}
.gr-date button:hover { color: var(--red); text-decoration: underline; }
.gr-date.ici { background: var(--ink); }
.gr-date.ici button { color: #fff; }
.gr-case {
  width: 2.1rem;
  text-align: center;
  font-weight: 700;
  color: var(--ink-3);
  padding: 7px 0 !important;
}
.gr-case.c-P { background: var(--pr-P-fond); color: var(--pr-P); }
.gr-case.c-R { background: var(--pr-R-fond); color: var(--pr-R); }
.gr-case.c-E { background: var(--pr-E-fond); color: var(--pr-E); }
.gr-case.c-A { background: var(--pr-A-fond); color: var(--pr-A); }
.gr-case.ici { box-shadow: inset 0 0 0 2px var(--ink); }
/* Le pourcentage reste collé à droite, comme les noms à gauche : c'est
   le chiffre qu'on cherche, et il serait sinon à 43 colonnes de là. */
.gr-pc {
  position: sticky;
  right: 0;
  z-index: 2;
  text-align: right;
  padding: 7px 12px !important;
  font-weight: 600;
  border-right: 0 !important;
  background: var(--paper-2);
  box-shadow: -1px 0 0 var(--line);
}

/* --- La feuille d'un samedi --------------------------------------------- */
.feuille .fe-tete {
  border-bottom: 2px solid var(--ink);
  padding-bottom: 10px;
  margin-bottom: 16px;
}
.feuille .fe-tete h2 { margin: 0; }
.feuille .fe-tete p { margin: 2px 0 0; color: var(--ink-3); }

.fe-chiffres {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin-bottom: 8px;
  color: var(--ink-3);
}
.fe-chiffres strong { font-size: 1.3rem; color: var(--ink); }

.fe-equipes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px 24px;
}
.fe-eq h4 {
  margin: 0 0 4px;
  font-family: var(--font-body);
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--red);
}
.fe-eq ul { margin: 0; padding-left: 18px; }
.fe-eq li { margin: 2px 0; }
.fe-eq em { color: var(--muted); font-size: .85rem; }

.fe-soins, .fe-tels { margin: 0; padding-left: 18px; }
.fe-soins li, .fe-tels li { margin: 3px 0; }
.fe-absents, .fe-notes { color: var(--ink-2); }

/* Quatre lignes vides quand il n'y a pas encore de notes : la feuille sert
   aussi à écrire dessus pendant la réunion. */
.fe-lignes { display: grid; gap: 22px; margin-top: 10px; }
.fe-lignes span { border-bottom: 1px solid var(--line); height: 1px; }

/* --- À l'impression ----------------------------------------------------- */
@media print {
  .demo-banner, .site-header, .admin-bar, .admin-tabs,
  .carnet-tete, .carnet-sommaire, .no-print, .toast { display: none !important; }
  body, .admin-page { background: #fff; }
  main, #admin { padding: 0 !important; margin: 0 !important; max-width: none; }
  .card, .feuille {
    box-shadow: none !important;
    border: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .fe-eq, .fe-soins li { break-inside: avoid; }
  a[href]::after { content: ""; }
}

@media (max-width: 760px) {
  /* Sur un téléphone, les quatre codes prennent toute la largeur sous le nom :
     à côté du nom, la colonne devenait si étroite que « Karim Abou Jaoude »
     tenait sur trois lignes. */
  .pr-ligne {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 8px;
  }
  .pr-nom { grid-column: 1; grid-row: 1; }
  .pr-eq { grid-column: 2; grid-row: 1; text-align: right; }
  .pr-codes { grid-column: 1 / -1; grid-row: 2; }
  .pr-code { flex: 1 1 0; }
  /* Les raccourcis se mettent les uns sous les autres : côte à côte,
     « Effacer cet appel » se repliait sur trois lignes de trois lettres. */
  .pr-raccourcis { flex-direction: column; align-items: stretch; }
  .pr-raccourcis .spacer { display: none; }
  .re-barre select { min-width: 0; flex: 1 1 10rem; }
  .gr-nom { min-width: 7.5rem; }
}

/* ---------------------------------------------------------------------------
   Carnet — Badges et Santé
--------------------------------------------------------------------------- */
.bg-liste { list-style: none; margin: 0; padding: 0; }
.bg-liste li { border-top: 1px solid var(--line); }
.bg-liste li:first-child { border-top: 0; }

.bg-ligne {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, .8fr);
  align-items: baseline;
  gap: 4px 16px;
  width: 100%;
  padding: 11px 6px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.bg-ligne:hover { background: var(--paper-2); }
.bg-ligne.active { background: var(--red-soft); }
.bg-date { color: var(--muted); font-size: .85rem; }
.bg-nom { font-weight: 600; }
.bg-nom em { font-weight: 400; color: var(--ink-3); font-size: .88rem; }
.bg-qui { color: var(--ink-3); }
.bg-par { color: var(--muted); font-size: .85rem; }

/* --- Santé --------------------------------------------------------------- */
.sa-urgences { list-style: none; margin: 0 0 14px; padding: 0; }
.sa-urgences li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 4px 0;
  border-bottom: 1px dotted var(--line);
}
.sa-urgences strong {
  /* Le numéro d'abord, en gros : c'est ce qu'on cherche des yeux quand la
     feuille est posée par terre et que quelqu'un saigne. */
  min-width: 5.5rem;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  color: var(--red);
}
.sa-urgences em { color: var(--muted); font-size: .85rem; }

.sa-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
.sa-table th, .sa-table td {
  text-align: left;
  vertical-align: top;
  padding: 7px 12px 7px 0;
  border-bottom: 1px solid var(--line);
}
.sa-table thead th {
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.sa-table tbody th { font-weight: 600; white-space: nowrap; }
/* Une ligne avec une note médicale se repère d'un coup d'œil, à l'écran
   comme sur le papier : un filet rouge, qui s'imprime aussi en noir et blanc
   parce qu'il reste un trait. */
.sa-table tr.a-lire th { box-shadow: inset 3px 0 0 var(--red); padding-left: 10px; }

@media print {
  .sa-table { font-size: .82rem; }
  .sa-table tr, .sa-urgences li { break-inside: avoid; }
  .gr-cadre { overflow: visible; border: 0; }
}

@media (max-width: 760px) {
  .bg-ligne {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 2px;
  }
  .bg-date { grid-column: 2; grid-row: 1; text-align: right; }
  .bg-nom { grid-column: 1; grid-row: 1; }
  .bg-qui { grid-column: 1 / -1; grid-row: 2; font-size: .9rem; }
  .bg-par { grid-column: 1 / -1; grid-row: 3; }
  .sa-table { font-size: .82rem; white-space: normal; }
  .sa-table th, .sa-table td { padding-right: 8px; }
}

/* ---------------------------------------------------------------------------
   Carnet — Caisse

   L'argent entré et l'argent sorti ne se distinguent pas seulement par la
   couleur : il y a toujours un + ou un − devant. Un chef daltonien, ou une
   feuille imprimée en noir et blanc, lisent la même chose.
--------------------------------------------------------------------------- */
.ca-bilan {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px 24px;
  padding: 18px 0 4px;
  border-top: 1px solid var(--line);
}
.cab { display: flex; flex-direction: column; gap: 2px; }
.cab-quoi {
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.cab strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.cab-gros { font-size: 1.75rem !important; font-family: var(--font-display); }
.cab-gros.negatif { color: var(--red); }
.cab-lbp { color: var(--muted); font-size: .82rem; }
.cab-aide { color: var(--muted); font-size: .78rem; }
.entree { color: var(--pr-P); }
.sortie { color: var(--pr-A); }

.ca-depart { display: flex; gap: 8px; align-items: center; }
.ca-depart input {
  width: 8rem;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  font-variant-numeric: tabular-nums;
}

/* --- Les lignes ---------------------------------------------------------- */
.ca-liste { list-style: none; margin: 0; padding: 0; }
.ca-liste li { border-top: 1px solid var(--line); }
.ca-liste li:first-child { border-top: 0; }

.ca-ligne {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1.6fr) minmax(0, 1fr) 7.5rem 7.5rem 1.6rem;
  align-items: baseline;
  gap: 4px 14px;
  width: 100%;
  padding: 11px 6px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.ca-ligne:hover { background: var(--paper-2); }
.ca-ligne.active { background: var(--red-soft); }
.cal-date {
  color: var(--muted);
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
}
.cal-quoi { font-weight: 600; }
.cal-quoi em { font-weight: 400; color: var(--ink-3); font-size: .85rem; }
.cal-ou { color: var(--ink-3); font-size: .88rem; }
.cal-montant, .cal-solde {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.cal-montant { font-weight: 600; }
/* Le solde courant est une information de second plan : on le lit quand on
   le cherche, il ne doit pas concurrencer le montant de la ligne. */
.cal-solde { color: var(--muted); font-size: .85rem; }
.cal-recu { text-align: center; }

/* Les chips de catégorie sont cliquables : elles doivent avoir l'air de
   boutons sans casser l'alignement des compteurs. */
button.prc {
  font: inherit;
  font-size: .85rem;
  cursor: pointer;
  transition: transform .12s var(--ease-soft);
}
button.prc:hover { border-color: var(--ink-3); }
button.prc:active { transform: scale(.96); }

@media (max-width: 860px) {
  .ca-ligne {
    grid-template-columns: minmax(0, 1fr) auto auto;
    row-gap: 2px;
  }
  .cal-date { grid-column: 1; grid-row: 1; }
  .cal-quoi { grid-column: 1; grid-row: 2; }
  .cal-ou { grid-column: 1; grid-row: 3; }
  .cal-montant { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 1.05rem; }
  .cal-solde { grid-column: 2; grid-row: 3; }
  .cal-recu { grid-column: 3; grid-row: 1 / span 3; align-self: center; }
}

/* L'en-tete de la caisse : sans elle, la colonne de droite ressemblait a un
   second montant. C'est le solde APRES la ligne, filtre ou non. */
.ca-entete {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1.6fr) minmax(0, 1fr) 7.5rem 7.5rem 1.6rem;
  gap: 14px;
  padding: 0 6px 8px;
  font-size: .7rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.ca-entete span { font-size: inherit; color: inherit; font-weight: 600; }
.ca-entete .cal-montant, .ca-entete .cal-solde { text-align: right; }
@media (max-width: 860px) { .ca-entete { display: none; } }

/* ---------------------------------------------------------------------------
   Carnet — Prix, Rations, Budget camp, Courses
--------------------------------------------------------------------------- */
.trio, .quatuor { display: grid; gap: 0 18px; }
.trio { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.quatuor { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* --- Prix et rations : la même liste en colonnes ------------------------- */
.px-liste { list-style: none; margin: 0; padding: 0; }
.px-liste li { border-top: 1px solid var(--line); }
.px-liste li:first-child { border-top: 0; }

.px-entete, .px-ligne {
  display: grid;
  grid-template-columns: minmax(0, 2fr) 8rem 8.5rem 8.5rem 7rem;
  align-items: baseline;
  gap: 4px 14px;
  width: 100%;
  text-align: left;
}
.px-entete.rt, .px-ligne.rt {
  grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr));
}
.px-entete {
  padding: 0 6px 8px;
  font-size: .7rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  border-top: 0;
}
.px-entete span:not(:first-child) { text-align: right; }
.px-ligne {
  padding: 10px 6px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  font: inherit;
  cursor: pointer;
}
.px-ligne:hover { background: var(--paper-2); }
.px-ligne.active { background: var(--red-soft); }
.pxl-nom { font-weight: 600; }
.pxl-nom em { display: block; font-weight: 400; font-size: .8rem; color: var(--muted); }
.pxl-paquet, .pxl-prix, .pxl-unite, .pxl-date {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.pxl-unite { color: var(--ink-3); }
.pxl-date { color: var(--muted); font-size: .82rem; }
/* Un prix jamais vérifié, ou vieux de six mois, se signale : au Liban il a
   peut-être doublé depuis. */
.pxl-date.vieux { color: var(--red); }

/* --- Le tableau du budget ----------------------------------------------- */
.bg-table td { font-variant-numeric: tabular-nums; text-align: right; }
.bg-table th { text-align: left; }
.bg-table thead th:not(:first-child) { text-align: right; }
.bg-table .gras { font-weight: 700; }

/* --- La liste de courses ------------------------------------------------- */
.co-liste { list-style: none; margin: 0; padding: 0; }
.co-liste li {
  display: grid;
  grid-template-columns: 2.2rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--line);
}
.co-liste li:first-child { border-top: 0; }
/* Ce qui est acheté s'efface sans disparaître : on voit ce qu'il reste à
   prendre sans perdre la trace de ce qu'on a déjà mis dans le chariot. */
.co-liste li.fait .col-nom { text-decoration: line-through; }
.co-liste li.fait { opacity: .62; }

.co-case { display: flex; justify-content: center; }
.co-case input { width: 20px; height: 20px; cursor: pointer; }

.co-ligne {
  display: grid;
  grid-template-columns: minmax(0, 2fr) 7rem 7.5rem 7.5rem 6rem;
  align-items: baseline;
  gap: 4px 12px;
  padding: 11px 6px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.co-ligne:hover { background: var(--paper-2); }
.co-ligne.active { background: var(--red-soft); }
.col-nom { font-weight: 600; }
.col-nom em { display: block; font-weight: 400; font-size: .8rem; color: var(--muted); }
.col-qte, .col-est, .col-paye, .col-ecart {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.col-qte { color: var(--ink-3); font-size: .88rem; }
.col-est { color: var(--muted); }
.col-paye { font-weight: 600; }
.col-ecart { font-size: .85rem; }

.co-caisse { min-width: 6.5rem; text-align: right; font-size: .82rem; }
.co-caisse.ok { color: var(--pr-P); }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 980px) {
  .trio, .quatuor { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .px-entete { display: none; }
  .px-ligne, .px-ligne.rt {
    grid-template-columns: minmax(0, 1fr) auto auto;
    row-gap: 2px;
  }
  .pxl-nom { grid-column: 1 / -1; }
  .co-ligne {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 2px;
  }
  .col-nom { grid-column: 1 / -1; }
  /* Deux lignes de chiffres, pas quatre : la liste se lit en marchant
     dans le magasin. */
  .col-qte { grid-column: 1; grid-row: 2; }
  .col-est { grid-column: 2; grid-row: 2; }
  .col-paye { grid-column: 1; grid-row: 3; text-align: left; }
  .col-ecart { grid-column: 2; grid-row: 3; text-align: right; }
  .co-liste li { grid-template-columns: 2.2rem minmax(0, 1fr); }
  .co-caisse { grid-column: 2; text-align: left; padding: 0 6px 10px; }
}

@media (max-width: 600px) {
  .trio, .quatuor { grid-template-columns: 1fr; }
}

/* Une ligne qui attend la réponse du serveur. */
.co-liste li.attente { opacity: .5; }
.co-liste li.attente .co-case input { cursor: progress; }

@media (max-width: 980px) {
  /* Sur un téléphone, le tiret « pas encore payé » ne sert à rien :
     il ne fait qu%27allonger la ligne. */
  .co-ligne .col-paye.vide { display: none; }
}

/* ===========================================================================
   La trousse de premiers secours
   =========================================================================== */

/* Les trois chiffres qui décident s'il faut passer à la pharmacie. */
.tr-compteurs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0 4px;
}
.trc {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper-2);
}
.trc b { display: block; font-size: 1.5rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.trc span { font-size: .82rem; color: var(--muted); }
/* Un compteur à zéro reste gris : seule une vraie alerte prend la couleur. */
.trc.perime { border-color: rgba(200, 16, 46, .35); background: var(--red-soft); }
.trc.perime b { color: var(--red-dark); }
.trc.bientot { border-color: #e9cf8a; background: #fff9e8; }
.trc.bientot b { color: #8a6d00; }
.trc.manque { border-color: #cfd8e6; background: #f4f7fc; }
.trc.manque b { color: #26456e; }

.tr-liste { list-style: none; margin: 0; padding: 0; }
.tr-liste li { border-top: 1px solid var(--line); }
.tr-liste li:first-child { border-top: 0; }
.tr-ligne {
  display: grid;
  grid-template-columns: minmax(0, 2fr) 5.5rem 7rem 8rem;
  align-items: baseline;
  gap: 4px 12px;
  width: 100%;
  padding: 11px 6px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.tr-ligne:hover { background: var(--paper-2); }
.tr-ligne.active { background: var(--red-soft); }
.trl-nom { font-weight: 600; }
.trl-nom em { display: block; font-weight: 400; font-size: .8rem; color: var(--muted); }
.trl-qte, .trl-date, .trl-etat {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: .9rem;
  color: var(--ink-3);
}
/* « 12 / 30 » en rouge : il en manque, et c'est tout ce qu'on veut voir. */
.trl-qte.manque { color: var(--red); font-weight: 600; }
.trl-date.perime { color: var(--red); font-weight: 600; }
.trl-date.bientot { color: #8a6d00; font-weight: 600; }
.trl-etat { font-size: .82rem; }
.trl-etat.perime { color: var(--red-dark); font-weight: 600; }
.trl-etat.bientot { color: #8a6d00; }
.trl-etat.manque { color: #26456e; }
.trl-etat.ok { color: var(--muted); }

/* Le verdict dans la fiche : la même phrase que dans la liste, en grand. */
.tr-verdict {
  margin: 0 0 4px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper-2);
  font-weight: 600;
}
.tr-verdict.perime { border-color: rgba(200, 16, 46, .35); background: var(--red-soft); color: var(--red-dark); }
.tr-verdict.bientot { border-color: #e9cf8a; background: #fff9e8; color: #8a6d00; }
.tr-verdict.manque { border-color: #cfd8e6; background: #f4f7fc; color: #26456e; }

/* La liste à racheter : ce que le classeur ne savait pas sortir tout seul. */
.tr-courses { list-style: none; margin: 0; padding: 0; }
.tr-courses li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 2px;
  border-top: 1px solid var(--line);
}
.tr-courses li:first-child { border-top: 0; }
.trc-nom { font-weight: 600; }
.trc-combien { color: var(--muted); font-size: .88rem; white-space: nowrap; }

@media (max-width: 760px) {
  .tr-compteurs { grid-template-columns: 1fr; gap: 8px; }
  .trc { display: flex; align-items: baseline; gap: 10px; padding: 9px 12px; }
  .trc b { font-size: 1.15rem; }
  /* Sur un téléphone la ligne tient sur deux rangées : le nom en haut,
     les chiffres et le verdict en dessous. */
  .tr-ligne { grid-template-columns: minmax(0, 1fr) auto; row-gap: 6px; }
  .trl-nom { grid-column: 1 / -1; grid-row: 1; }
  .trl-qte { grid-column: 1; grid-row: 2; text-align: left; }
  .trl-date { grid-column: 2; grid-row: 2; }
  .trl-etat { grid-column: 1 / -1; grid-row: 3; text-align: left; }
}

/* ===========================================================================
   Importer les inscriptions
   =========================================================================== */

.sc-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
/* Le vrai champ de fichier est laid et jamais cliqué directement : c'est le
   bouton à côté qui l'ouvre. */
.imp-cache { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.imp-unites { list-style: none; margin: 14px 0; padding: 0; }
.imp-unites li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 7rem minmax(0, 1.2fr);
  gap: 4px 12px;
  align-items: baseline;
  padding: 8px 2px;
  border-top: 1px solid var(--line);
}
.imp-unites li:first-child { border-top: 0; }
.imp-unites li.hors { opacity: .5; }
.impu-nom { font-weight: 600; }
.impu-n { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-3); font-size: .9rem; }
.impu-ou { color: var(--muted); font-size: .88rem; }

.imp-choix {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 10px 0;
  font-size: .92rem;
  color: var(--ink-2);
}
.imp-choix input { margin-top: 3px; width: 18px; height: 18px; flex: 0 0 auto; cursor: pointer; }

.imp-bilan { list-style: none; margin: 10px 0 0; padding: 0; }
.imp-bilan li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 2px;
  border-top: 1px solid var(--line);
}
.imp-bilan li:first-child { border-top: 0; }
.impb-nom { font-weight: 600; }
.impb-n { color: var(--muted); font-size: .9rem; }

@media (max-width: 760px) {
  .imp-unites li { grid-template-columns: minmax(0, 1fr) auto; }
  .impu-ou { grid-column: 1 / -1; }
}
