/* Les couleurs, l'arrondi et les polices viennent du thème (variables injectées dans :root). */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: var(--police-texte);
  font-size: 16px;
  line-height: 1.55;
}
h1, h2, h3 { font-family: var(--police-titre); font-weight: var(--poids-titre); line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.2rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
a { color: var(--primaire); }
:focus-visible { outline: 2px solid var(--primaire); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sr-focus:focus { position: fixed; top: .5rem; left: .5rem; width: auto; height: auto; clip: auto; z-index: 50;
  padding: .5rem 1rem; background: var(--surface); border-radius: var(--rayon); }
.attenue { color: var(--attenue); }

/* ---------- Structure ---------- */
.app { display: flex; min-height: 100vh; }
.nav {
  position: sticky; top: 0; height: 100vh; width: 264px; flex: none;
  display: flex; flex-direction: column; gap: 1.75rem;
  padding: 1.5rem 1rem; background: var(--surface); border-right: 1px solid var(--bordure);
  overflow-y: auto;
}
.marque { display: flex; align-items: center; gap: .75rem; color: var(--texte); text-decoration: none; min-width: 0; }
.marque-logo { width: 46px; height: 46px; flex: none; border-radius: var(--rayon); object-fit: contain; }
.marque-initiale {
  display: grid; place-items: center; background: var(--primaire); color: var(--sur-primaire);
  font-family: var(--police-titre); font-weight: var(--poids-titre); font-size: 1.45rem;
}
.marque-nom { font-family: var(--police-titre); font-weight: var(--poids-titre); font-size: 1.12rem; line-height: 1.2; overflow-wrap: anywhere; }
.nav-liens { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-liens a {
  display: flex; align-items: center; gap: .7rem; padding: .6rem .75rem;
  border-radius: var(--rayon); color: var(--texte); text-decoration: none; font-weight: 500;
}
.nav-liens a:hover { background: var(--survol); }
.nav-liens a.actif { background: var(--primaire); color: var(--sur-primaire); }
.nav-icone { width: 1.4em; text-align: center; }
.nav-groupe { margin: 1.25rem .75rem .3rem; font-size: .85rem; color: var(--attenue); }
.nav-user {
  display: flex; justify-content: space-between; align-items: center; gap: .5rem;
  padding-top: 1rem; border-top: 1px solid var(--bordure); font-size: .9rem;
}
.nav-user span { display: block; color: var(--attenue); font-size: .82rem; }
.lien-discret { background: none; border: 0; padding: 0; color: var(--attenue); font: inherit; text-decoration: underline; cursor: pointer; }

.principal { flex: 1; min-width: 0; }
.topbar, .voile { display: none; }
.contenu { max-width: 1100px; margin: 0 auto; padding: 2.25rem clamp(1rem, 3vw, 2.5rem) 4rem; }
.entete-page { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.entete-page h1 { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; }

@media (max-width: 900px) {
  .nav { position: fixed; left: 0; z-index: 30; transform: translateX(-100%); transition: transform .2s ease; }
  .nav-ouverte .nav { transform: none; }
  .nav-ouverte .voile { display: block; position: fixed; inset: 0; z-index: 20; background: rgb(0 0 0 / .45); }
  .topbar {
    display: flex; align-items: center; gap: .5rem; position: sticky; top: 0; z-index: 10;
    padding: .5rem 1rem; background: var(--surface); border-bottom: 1px solid var(--bordure);
  }
  .topbar .marque-logo { width: 34px; height: 34px; font-size: 1.1rem; }
  .contenu { padding-top: 1.25rem; }
}
@media (prefers-reduced-motion: reduce) { .nav { transition: none; } }
.burger { display: grid; gap: 4px; padding: 10px; background: none; border: 0; border-radius: var(--rayon); cursor: pointer; }
.burger span:not(.sr) { display: block; width: 20px; height: 2px; border-radius: 2px; background: var(--texte); }

/* ---------- Composants ---------- */
.carte { background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon); padding: 1.25rem; }
.carte > h2:first-child { margin-top: 0; }
.pile { display: grid; gap: .75rem; }
.grille { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.section { margin-top: 2rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .6rem 1.1rem; border-radius: var(--rayon); border: 1px solid var(--primaire);
  background: var(--primaire); color: var(--sur-primaire);
  font: inherit; font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn-sec { background: transparent; color: var(--texte); border-color: var(--bordure); }
.btn-sec:hover { background: var(--survol); filter: none; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-petit { padding: .35rem .7rem; font-size: .88rem; }
.btn-large { width: 100%; }
.boutons { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

.champ { display: grid; gap: .35rem; margin-bottom: 1rem; }
.champ label, .champ > span { font-weight: 600; font-size: .92rem; }
.champ small { color: var(--attenue); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url],
input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; padding: .6rem .75rem; border-radius: var(--rayon);
  border: 1px solid var(--bordure); background: var(--fond); color: var(--texte); font: inherit;
}
textarea { min-height: 9rem; resize: vertical; }
input[type=color] { width: 3rem; height: 2.5rem; padding: 0; border: 1px solid var(--bordure); border-radius: var(--rayon); background: none; }
.ligne { display: grid; gap: 0 1rem; align-items: start; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.coche { display: flex; align-items: center; gap: .5rem; font-weight: 500; cursor: pointer; }
.coche input { width: 1.1rem; height: 1.1rem; accent-color: var(--primaire); }

.flash { padding: .75rem 1rem; margin-bottom: 1rem; border: 1px solid; border-radius: var(--rayon); }
.flash-ok { background: color-mix(in srgb, var(--succes) 14%, transparent); border-color: var(--succes); }
.flash-erreur { background: color-mix(in srgb, var(--danger) 14%, transparent); border-color: var(--danger); }
.flash ul { margin: .25rem 0 0; padding-left: 1.2rem; }

.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; background: var(--survol); color: var(--texte); font-size: .8rem; font-weight: 600; }
.badge-primaire { background: var(--primaire); color: var(--sur-primaire); }
.badge-ok { background: color-mix(in srgb, var(--succes) 22%, transparent); }
.badge-off { background: transparent; border: 1px solid var(--bordure); color: var(--attenue); }

.tableau { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .65rem .5rem; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--bordure); }
th { color: var(--attenue); font-size: .85rem; font-weight: 600; }
td.centre, th.centre { text-align: center; }

.vide { padding: 3rem 1rem; text-align: center; border: 1px dashed var(--bordure); border-radius: var(--rayon); }
.vide p { margin: 0 0 1rem; }

.onglets { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: 1.25rem; }
.onglets a { padding: .4rem .9rem; border: 1px solid var(--bordure); border-radius: 999px; color: var(--texte); text-decoration: none; font-size: .92rem; }
.onglets a.actif { background: var(--texte); border-color: var(--texte); color: var(--fond); }
.onglets .espace { flex: 1; }

.barre { height: 8px; overflow: hidden; border-radius: 999px; background: var(--survol); }
.barre span { display: block; height: 100%; background: var(--primaire); }

.liste-simple { list-style: none; margin: 0 0 1rem; padding: 0; }
.liste-simple li { padding: .55rem 0; border-bottom: 1px solid var(--bordure); }
.liste-simple li:last-child { border-bottom: 0; }

details.carte > summary { cursor: pointer; font-weight: 600; }
details.carte[open] > summary { margin-bottom: 1rem; }

/* ---------- Connexion ---------- */
.connexion { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.connexion-boite { width: min(100%, 380px); }
.connexion-marque { display: flex; flex-direction: column; align-items: center; gap: .9rem; margin-bottom: 1.75rem; text-align: center; }
.connexion-marque .marque-logo { width: 92px; height: 92px; font-size: 2.6rem; }
.connexion-marque h1 { margin: 0; }

/* ---------- Personnalisation ---------- */
.apercu-logo { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.apercu-logo .marque-logo { width: 72px; height: 72px; font-size: 2rem; }
.themes { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
.theme-choix {
  display: block; padding: 0; overflow: hidden; text-align: left; cursor: pointer; font: inherit;
  border: 2px solid var(--bordure); border-radius: 12px; background: none; color: inherit;
}
.theme-choix[aria-pressed=true] { border-color: var(--primaire); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primaire) 35%, transparent); }
.theme-apercu { height: 112px; padding: .9rem; display: flex; flex-direction: column; justify-content: space-between; }
.theme-apercu .aa { font-size: 1.7rem; line-height: 1; }
.theme-apercu .pastilles { display: flex; gap: 6px; }
.theme-apercu .pastilles i { display: block; width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgb(127 127 127 / .3); }
.theme-nom { display: flex; justify-content: space-between; padding: .5rem .75rem; background: var(--surface); color: var(--texte); font-size: .9rem; font-weight: 600; }

/* ---------- Modules ---------- */
.module-tete { display: flex; align-items: center; gap: .75rem; margin-bottom: .5rem; }
.module-tete h2 { margin: 0; }
.module-icone { font-size: 1.7rem; }

/* ---------- Matchs ---------- */
.jour { margin: 1.75rem 0 .6rem; color: var(--attenue); font-size: 1rem; }
.jour:first-of-type { margin-top: 0; }
.match { display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: center; }
.match-heure { min-width: 4.5ch; font-family: var(--police-titre); font-weight: var(--poids-titre); font-size: 1.35rem; }
.match-titre { margin: .35rem 0 0; }
.participants { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .45rem; }
.choix-membres {
  display: grid; gap: .45rem; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  max-height: 320px; overflow: auto; padding: .75rem; border: 1px solid var(--bordure); border-radius: var(--rayon);
}
@media (max-width: 600px) {
  .match { grid-template-columns: auto 1fr; }
  .match > .btn { grid-column: 1 / -1; justify-self: start; }
}

/* ---------- Formation ---------- */
.lecon { display: flex; gap: 1rem; align-items: center; justify-content: space-between; }
.lecon-num { font-family: var(--police-titre); font-weight: var(--poids-titre); font-size: 1.3rem; color: var(--attenue); min-width: 2ch; }
.lecon-corps { flex: 1; min-width: 0; }
.lecon-corps h3 { margin: 0 0 .2rem; }
.texte-lecon { max-width: 70ch; line-height: 1.75; }
.video { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--rayon); background: #000; }
.video iframe, .video video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.nav-lecons { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2rem; }

/* ---------- Équipes ---------- */
.pastille-equipe { display: inline-block; width: .7rem; height: .7rem; margin-right: .5rem; border-radius: 50%; vertical-align: middle; }

/* ---------- Avatars ---------- */
.avatar { width: 32px; height: 32px; flex: none; border-radius: 50%; object-fit: cover; }
.avatar-initiale { display: inline-grid; place-items: center; background: var(--survol); color: var(--attenue); font-weight: 600; font-size: .9rem; }
.avatar-moyen { width: 48px; height: 48px; font-size: 1.2rem; }
.membre-nom { display: inline-flex; align-items: center; gap: .6rem; }

/* ---------- Chiffres (diamants, statistiques) ---------- */
.chiffres { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr)); margin-bottom: 1rem; }
.chiffre { display: flex; flex-direction: column; gap: .2rem; padding: 1rem 1.1rem; background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon); }
.chiffre .valeur { font-family: var(--police-titre); font-weight: var(--poids-titre); font-size: 1.45rem; line-height: 1.15; overflow-wrap: anywhere; }
.chiffre .libelle { color: var(--attenue); font-size: .88rem; }
.chiffre-principal { background: var(--primaire); border-color: var(--primaire); color: var(--sur-primaire); grid-column: span 2; }
.chiffre-principal .valeur { font-size: 2rem; }
.chiffre-principal .libelle { color: inherit; opacity: .85; }
.chiffre-texte { margin: 0 0 .25rem; font-family: var(--police-titre); font-weight: var(--poids-titre); font-size: 1.7rem; }
@media (max-width: 420px) { .chiffre-principal { grid-column: 1 / -1; } }

/* ---------- Galerie de formation (gestion) ---------- */
.galerie-gestion { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: .75rem; }
.galerie-vignette { position: relative; width: 100px; height: 100px; border-radius: var(--rayon); overflow: hidden; border: 1px solid var(--bordure); }
.galerie-vignette img { width: 100%; height: 100%; object-fit: cover; display: block; }
.galerie-retirer {
  position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0;
  background: rgb(0 0 0 / .6); color: #fff; font-size: .8rem; line-height: 1; cursor: pointer; display: grid; place-items: center;
}
.galerie-retirer:hover { background: var(--danger); }

/* ---------- Lecteur « livre » (leçon Image à plusieurs photos) ---------- */
.livre { display: flex; flex-direction: column; gap: .75rem; outline: none; }
.livre-pages {
  position: relative; width: 100%; min-height: 220px; background: var(--survol);
  border-radius: var(--rayon); overflow: hidden; display: flex; align-items: center; justify-content: center;
}
.livre-page { display: none; width: 100%; max-height: 65vh; object-fit: contain; }
.livre-page.actif { display: block; }
.livre-barre { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.livre-compteur { font-weight: 600; color: var(--texte-attenue); white-space: nowrap; }
.livre-vignettes {
  display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .25rem; scroll-behavior: smooth;
}
.livre-vignette {
  flex: 0 0 auto; width: 56px; height: 56px; border-radius: 8px; overflow: hidden; padding: 0;
  border: 2px solid transparent; background: var(--survol); cursor: pointer; opacity: .6;
}
.livre-vignette img { width: 100%; height: 100%; object-fit: cover; display: block; }
.livre-vignette.actif { border-color: var(--primaire); opacity: 1; }
@media (max-width: 480px) {
  .livre-barre .btn span { display: none; }
  .livre-vignette { width: 44px; height: 44px; }
}

/* ---------- Messagerie : réactions, fil de discussion ---------- */
.ticket-reactions { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-top: .6rem; }
.reaction-pastille {
  border: 1px solid var(--bordure); background: var(--survol); border-radius: 999px; padding: .1rem .5rem;
  font-size: .82rem; cursor: pointer; color: var(--texte);
}
.reaction-pastille.actif { border-color: var(--primaire); background: color-mix(in srgb, var(--primaire) 18%, transparent); }
.reaction-ajouter summary { list-style: none; cursor: pointer; font-size: .85rem; color: var(--texte-attenue); padding: .1rem .4rem; }
.reaction-ajouter summary::-webkit-details-marker { display: none; }
.reaction-choix { display: inline-flex; gap: .3rem; margin-left: .3rem; }
.reaction-choix button { border: 0; background: transparent; cursor: pointer; font-size: 1rem; padding: 0 .15rem; }
.ticket-ligne { display: block; text-decoration: none; color: inherit; }
