:root {
  --violet: #7c3aed;
  --violet-fonce: #5b21b6;
  --orange: #ff6b35;
  --vert: #10b981;
  --rouge: #dc2626;
  --bleu: #2563eb;
  --gris-fond: #f5f5f7;
  --gris-bordure: #e0e0e0;
  --texte: #1f2430;
  --texte-att: #666;
  color-scheme: light;
}

* { box-sizing: border-box; }

/* Toujours prioritaire : plusieurs règles ci-dessous fixent un display
   explicite (flex/block) sur des éléments que app.js masque avec
   l'attribut HTML "hidden". Sans cette règle, ce display explicite
   écrase le display:none par défaut du navigateur pour [hidden], et
   les écrans restent visibles superposés — même en étant "hidden". */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--gris-fond);
  color: var(--texte);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  /* De la place en bas pour la barre de navigation fixe (.nav-bas). */
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}

.ecran { display: block; }

/* ---------------- Connexion ---------------- */
.carte-login {
  max-width: 360px;
  margin: 12vh auto 0;
  background: #fff;
  border-radius: 16px;
  padding: 32px 24px;
  box-shadow: 0 4px 20px rgba(0,0,0,.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.carte-login .logo { width: 96px; margin: 0 auto 8px; display: block; }
.carte-login h1 { font-size: 1.3rem; text-align: center; margin: 0; }
.sous-titre { text-align: center; color: var(--texte-att); margin: 0 0 12px; font-size: .9rem; }
.carte-login label { font-size: .85rem; font-weight: 600; margin-top: 4px; }
.carte-login input {
  padding: 12px; border: 1px solid var(--gris-bordure); border-radius: 10px; font-size: 1rem;
}

/* ---------------- Entête ---------------- */
.entete {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  background: var(--violet); color: #fff;
  padding: max(14px, env(safe-area-inset-top)) 12px 14px;
}
.entete h1 { font-size: 1.05rem; margin: 0; flex: 1; text-align: center; }
.btn-icone {
  background: transparent; border: none; color: #fff; font-size: 1.3rem;
  padding: 4px 10px; border-radius: 8px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn-icone:active { background: rgba(255,255,255,.2); }
/* #btn-deconnexion utilise une icône SVG (voir index.html) plutôt que le
   caractère Unicode ⏻ : ce symbole "Power Symbol" (U+23FB) n'appartient
   pas au jeu d'émojis proprement dit, sa police de secours varie donc
   d'un appareil à l'autre — sur un Samsung, il s'affichait en rectangle
   barré d'une croix (glyphe manquant) au lieu de l'icône. Un SVG intégré
   rend à l'identique partout, sans dépendre d'aucune police système. */
.btn-icone svg { display: block; }

/* ---------------- Boutons ---------------- */
.btn {
  border: none; border-radius: 10px; padding: 13px 18px; font-size: 1rem;
  font-weight: 600; cursor: pointer;
}
.btn-block { width: 100%; }
.btn-primary { background: var(--violet); color: #fff; }
.btn-primary:active { background: var(--violet-fonce); }
.btn-secondaire { background: #eee; color: var(--texte); }
.btn:disabled { opacity: .6; }

/* ---------------- Liste des membres ---------------- */
.barre-recherche { padding: 12px; }
#recherche {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--gris-bordure);
  font-size: 1rem; background: #fff;
}
.info-liste { text-align: center; color: var(--texte-att); font-size: .9rem; padding: 8px 16px; }
.liste-membres { list-style: none; margin: 0; padding: 0 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.item-membre {
  background: #fff; border-radius: 12px; padding: 12px 14px;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.item-membre .nom { font-weight: 600; }
.item-membre .ville { color: var(--texte-att); font-size: .85rem; }
.item-membre .puce-rgpd {
  font-size: .7rem; background: #fde68a; color: #7a4a00; border-radius: 8px; padding: 2px 6px; white-space: nowrap;
}

/* ---------------- Fiche membre ---------------- */
.fiche-identite { padding: 16px 16px 4px; }
.fiche-identite h2 { margin: 0 0 4px; }
.fiche-coords { margin: 0; color: var(--texte-att); font-size: .9rem; }
.badge { display: inline-block; margin-top: 8px; padding: 4px 10px; border-radius: 20px; font-size: .75rem; font-weight: 700; }
.badge-rgpd { background: #fde68a; color: #7a4a00; }

.carte {
  background: #fff; margin: 12px; border-radius: 14px; padding: 14px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.carte-entete {
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 700; margin-bottom: 10px; flex-wrap: wrap; gap: 6px;
}
.carte-cotisations .carte-entete strong { color: var(--violet); font-size: 1.05rem; }

.grille-comptes { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.compte-cotisation {
  background: var(--gris-fond); border-radius: 10px; padding: 10px; text-align: center;
}
.compte-cotisation .libelle { font-size: .72rem; color: var(--texte-att); }
.compte-cotisation .montant { font-weight: 700; margin-top: 2px; }
.compte-cotisation.a-jour .montant { color: var(--vert); }

#btn-attestation { font-size: .98rem; }
#fiche-attestation-msg { margin-top: 8px; }
#fiche-attestation-msg.ok { color: var(--vert); }
#fiche-attestation-msg.erreur { color: var(--rouge); }

.liste-historique { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.liste-historique li { font-size: .85rem; display: flex; justify-content: space-between; color: var(--texte-att); }
.liste-historique li span:last-child { text-align: right; }
.liste-historique .trigramme { color: var(--bleu); font-weight: 600; }

/* ---------------- Alerte / toast ---------------- */
.alerte { padding: 10px 12px; border-radius: 8px; font-size: .88rem; }
.alerte-erreur { background: #fee2e2; color: #991b1b; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #1f2430; color: #fff; padding: 12px 18px; border-radius: 30px;
  font-size: .9rem; max-width: 90vw; text-align: center; z-index: 50;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
}
.toast.erreur { background: #7f1d1d; }

/* ---------------- Dialogue de confirmation ---------------- */
.dialogue {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: flex-end; z-index: 40;
}
.dialogue-contenu {
  background: #fff; width: 100%; border-radius: 16px 16px 0 0; padding: 20px;
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}
.dialogue-contenu p { margin: 0 0 16px; }
.dialogue-actions { display: flex; gap: 10px; }
.dialogue-actions .btn { flex: 1; }

@media (min-width: 480px) {
  .dialogue { align-items: center; justify-content: center; }
  .dialogue-contenu { max-width: 380px; border-radius: 16px; }
}

/* ---------------- Statistiques membres (camembert) ---------------- */
.stats-donut-conteneur { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.stats-donut-svg { width: 148px; height: 148px; flex-shrink: 0; }
.stats-donut-svg svg { display: block; width: 100%; height: 100%; }
.stats-donut-svg .donut-total { font-size: 34px; font-weight: 800; fill: var(--texte); }
.stats-donut-svg .donut-libelle { font-size: 12px; fill: var(--texte-att); }
.stats-legendes { display: flex; flex-direction: column; gap: 12px; flex: 1; min-width: 130px; }
.stats-legende-titre {
  display: block; font-size: .68rem; font-weight: 700; color: var(--texte-att);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px;
}
.stats-legende-liste { display: flex; flex-direction: column; gap: 4px; }
.stats-legende-item { display: flex; align-items: center; gap: 7px; font-size: .87rem; }
.stats-legende-pastille { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.stats-legende-symbole { font-size: 1.05rem; font-weight: 700; width: 14px; text-align: center; flex-shrink: 0; }

/* ---------------- Chorées des cours ---------------- */
.carte-ajout-choree label { font-size: .85rem; font-weight: 600; display: block; margin-top: 10px; }
.carte-ajout-choree input,
.carte-ajout-choree select {
  width: 100%; padding: 12px; border: 1px solid var(--gris-bordure); border-radius: 10px;
  font-size: 1rem; margin-top: 4px; background: #fff; color: var(--texte);
}
.carte-ajout-choree .btn { margin-top: 14px; }

/* Formulaire d'ajout repliable (<details> natif, sans JavaScript). Le triangle est
   dessiné en CSS (bordures) : aucune police à charger. Il pointe à droite (replié)
   et tourne vers le bas (déplié). */
.choree-depl > summary {
  display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none;
  font-weight: 700; padding: 6px 0; -webkit-tap-highlight-color: transparent; user-select: none;
}
.choree-depl > summary::-webkit-details-marker { display: none; }
.choree-depl > summary::before {
  content: ''; flex: 0 0 auto; transition: transform .15s;
  border-left: 10px solid var(--orange); border-top: 7px solid transparent; border-bottom: 7px solid transparent;
}
.choree-depl[open] > summary::before { transform: rotate(90deg); }
.choree-depl[open] > summary { margin-bottom: 4px; }

.liste-chorees { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 18px; }
.groupe-niveau { display: flex; flex-direction: column; gap: 8px; }
.niveau-entete {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
  color: #fff; font-weight: 700; font-size: .8rem; padding: 5px 14px; border-radius: 999px;
}
.niveau-entete .cnt { background: rgba(255,255,255,.28); border-radius: 999px; font-size: .72rem; padding: 1px 8px; font-weight: 600; }
.sous-liste-chorees { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.item-choree { background: #fff; border-radius: 12px; padding: 12px 14px; }
.item-choree-entete { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
/* 05/11/2026 : pastilles à gauche, puis le titre et, juste dessous en plus petit, la date
   (et l'étiquette « reprise ») — les deux lignes tiennent dans la hauteur des pastilles (36 px). */
.item-choree .item-choree-entete { justify-content: flex-start; align-items: center; gap: 0; }
.item-choree .pastilles { flex: 0 0 auto; display: flex; align-items: center; }
.item-choree .pastilles:empty { display: none; }
.item-choree .nom-bloc { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; justify-content: center; min-height: 36px; }
.item-choree .nom-bloc .nom { font-size: 1rem; line-height: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-choree .nom-sous { display: flex; align-items: center; gap: 6px; min-width: 0; line-height: 16px; white-space: nowrap; overflow: hidden; }
.item-choree .nom-sous:empty { display: none; }
.item-choree .nom-sous .date-chore { font-size: .78rem; }
.item-choree .nom-sous .badge-reprise { margin-left: 0; padding: 0 6px; line-height: 14px; font-size: .64rem; }
.item-choree .nom { font-weight: 600; }
.item-choree .choregraphe { color: var(--texte-att); font-size: .85rem; display: block; margin-top: 2px; }
.item-choree .date-chore { color: var(--bleu); font-weight: 700; white-space: nowrap; flex-shrink: 0; }
.item-choree .badge-reprise { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px;
  background: #fdf0e3; color: #b45309; border: 1px solid #f5d0a9; font-size: .68rem; font-weight: 600;
  vertical-align: middle; white-space: nowrap; }
.niveau-entete .cnt-rep { font-size: .72rem; font-weight: 500; opacity: .9; margin-left: 6px; }
.item-choree .date-ajout { color: var(--texte-att); font-size: .72rem; font-style: italic; display: block; margin-top: 2px; }

/* ---------------- Barre de navigation ---------------- */
.nav-bas {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; background: #fff; border-top: 1px solid var(--gris-bordure);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-item {
  flex: 1; background: transparent; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px 6px; color: var(--texte-att); font-size: .72rem; font-weight: 600;
}
.nav-item svg { width: 22px; height: 22px; }
.nav-item.actif { color: var(--violet); }

/* Bouton ▶ du jukebox dans la liste des chorées : cible tactile plus large. */
.item-choree .jb-play { width: 36px; height: 36px; margin-right: 10px; }

/* Pastille vidéo (01/11/2026) : même gabarit que le bouton ▶, en violet. */
.chz-video { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; margin-right: 10px; border-radius: 50%; vertical-align: middle;
  background: #6A1B9A; box-shadow: 0 2px 6px rgba(106,27,154,.4); -webkit-tap-highlight-color: transparent; }
.chz-video:active { transform: scale(.94); }
/* Pastille fiche de pas PDF (05/11/2026) : même gabarit, en rouge. */
.chz-pdf { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; margin-right: 10px; border-radius: 50%; vertical-align: middle;
  background: #C62828; box-shadow: 0 2px 6px rgba(198,40,40,.4); -webkit-tap-highlight-color: transparent; }
.chz-pdf:active { transform: scale(.94); }
/* Fenêtre vidéo, comme sur le site public : bandeau orange, Ouvrir ↗, croix. */
.chz-vid { position: fixed; inset: 0; z-index: 9500; background: rgba(0,0,0,.8); display: flex;
  align-items: center; justify-content: center; padding: 12px; }
.chz-vid[hidden] { display: none; }
.chz-vid-box { width: 100%; max-width: 1000px; background: #000; border-radius: 14px; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.chz-vid-tete { display: flex; align-items: center; gap: 10px; background: #E8730C; color: #fff; padding: 10px 10px 10px 14px; }
.chz-vid-titre { flex: 1; min-width: 0; font-weight: 700; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chz-vid-ouvrir { flex: 0 0 auto; color: #fff; text-decoration: none; font-weight: 700; font-size: .8rem;
  border: 1.5px solid rgba(255,255,255,.85); border-radius: 999px; padding: 4px 12px; }
.chz-vid-fermer { flex: 0 0 auto; width: 34px; height: 34px; border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(255,255,255,.25); color: #fff; font-size: 22px; line-height: 1; font-weight: 700; }
.chz-vid-cadre { position: relative; aspect-ratio: 16/9; background: #000; }
.chz-vid-cadre iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---- Séance du jour (pointage) ---- */
.carte-seance-filtre { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-end; margin: 12px; }
.carte-seance-filtre label { font-size: .8rem; font-weight: 600; color: var(--texte-att); display: flex; flex-direction: column; gap: 4px; }
.carte-seance-filtre input, .carte-seance-filtre select { height: 38px; border-radius: 10px; border: 1px solid #e2e2ea; padding: 0 10px; font-size: .95rem; }
.liste-seance { list-style: none; margin: 0; padding: 0 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.item-seance { background: #fff; border-radius: 12px; padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.item-seance-nom { min-width: 0; }
.item-seance .nom { font-weight: 600; display: block; }
.item-seance .choregraphe { color: var(--texte-att); font-size: .85rem; display: block; margin-top: 2px; }
.item-seance .seance-total { color: var(--texte-att); font-size: .72rem; display: block; margin-top: 2px; }
.item-seance .seance-derniere { color: var(--texte-att); font-size: .72rem; display: block; margin-top: 2px; }
/* Sélecteur « Niveau » par chorée (réaffectation n-X -> saison en cours, ajouté le
   24/09/2026) — affiché seulement en consultant une saison passée, voir app.js. */
.seance-niveau-cible { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: .72rem; font-weight: 600; color: var(--texte-att); }
.seance-niveau-select { height: 28px; border-radius: 8px; border: 1px solid #e2e2ea; padding: 0 6px; font-size: .78rem; font-weight: 600; color: #1f2430; }
.seance-stepper { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; }
.seance-stepper button { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--violet); color: #fff;
                          font-size: 1.2rem; line-height: 1; -webkit-tap-highlight-color: transparent; }
.seance-stepper button:active { background: var(--violet-fonce); }
.seance-nb { min-width: 1.4em; text-align: center; font-weight: 700; font-size: 1.05rem; }


/* ---------------- Photos des membres (16/10/2026) ---------------- */
.item-membre .item-corps { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.item-membre .item-texte { min-width: 0; }
.item-membre .nom, .item-membre .ville { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; overflow: hidden;
  background: #ede9fe; color: var(--violet-fonce); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.btn-photo-membre {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%; border: 0;
  background: var(--gris-fond); font-size: 1.15rem; display: flex; align-items: center; justify-content: center;
}
.btn-photo-membre:active { background: #e4e0f5; }
.titre-liste { font-weight: 700; color: var(--texte); }

.fiche-identite { display: grid; grid-template-columns: auto 1fr; column-gap: 14px; align-items: center; }
.fiche-identite > :not(.fiche-photo) { grid-column: 2; }
.fiche-photo {
  grid-column: 1; grid-row: 1 / span 3; position: relative; width: 84px; height: 84px; border-radius: 50%;
  border: 0; padding: 0; background: #ede9fe; color: var(--violet-fonce); font-size: 1.5rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; overflow: visible;
}
.fiche-photo img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.fiche-photo-badge {
  position: absolute; right: -2px; bottom: -2px; width: 30px; height: 30px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.2); font-size: .95rem; display: flex; align-items: center; justify-content: center;
}

.photo-nom { text-align: center; font-weight: 700; margin: 14px 16px 10px; }
.photo-cadre {
  position: relative; width: min(92vw, 440px); aspect-ratio: 1 / 1; margin: 0 auto;
  border-radius: 18px; overflow: hidden; background: #111;
}
.photo-cadre video, .photo-cadre canvas { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-cadre video.miroir { transform: scaleX(-1); }
.photo-guide {
  position: absolute; inset: 9% 20% 6%; border: 3px dashed rgba(255,255,255,.75); border-radius: 50% 50% 46% 46%;
  pointer-events: none;
}
.photo-actions { display: flex; align-items: center; justify-content: center; gap: 34px; margin: 18px 0 8px; }
.btn-rond {
  width: 52px; height: 52px; border-radius: 50%; border: 0; background: #fff; font-size: 1.35rem;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 4px rgba(0,0,0,.12); cursor: pointer;
}
.btn-declencheur {
  width: 76px; height: 76px; border-radius: 50%; border: 6px solid #fff; background: var(--violet);
  box-shadow: 0 0 0 3px var(--violet), 0 3px 10px rgba(0,0,0,.25);
}
.btn-declencheur:active { transform: scale(.94); }
.btn-declencheur:disabled { opacity: .4; }
.photo-actions-valider { display: flex; gap: 10px; margin: 18px 16px 8px; }
.photo-actions-valider .btn { flex: 1; }
.btn-lien { display: block; margin: 10px auto 24px; background: none; border: 0; color: var(--rouge); font-size: .9rem; text-decoration: underline; }
