/* Passe Décisive — mobile d'abord. */
:root {
  /* thème : valeurs neutres de Passe Décisive, remplacées par celles du club (contraste déjà vérifié côté serveur) */
  --primaire: #16324f; --sur-primaire: #ffffff; --titres: #16324f; --secondaire: #e8743b; --trait: #c45a22; --fond-theme: #f3f5f8;
  --bleu: #16324f; --bleu-clair: #e7eef6; --accent: #e8743b; --vert: #1f7a4d; --vert-clair: #e3f4ea;
  --rouge: #b3261e; --rouge-clair: #fbe9e7; --orange-clair: #fff3e0; --texte: #1b2430; --gris: #5b6675;
  --bord: #d6dde6; --fond: #f3f5f8; --blanc: #fff; --rayon: 12px;
  font-size: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--texte); background: var(--fond);
  line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--titres); }
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 .75rem; color: var(--titres); }
h2 { font-size: 1.2rem; margin: 1.25rem 0 .5rem; color: var(--titres); }
h3 { font-size: 1.05rem; margin: 1rem 0 .4rem; }
p { margin: 0 0 .75rem; }

/* barre du haut */
.barre {
  position: sticky; top: 0; z-index: 10; background: var(--blanc); border-bottom: 1px solid var(--bord);
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .5rem .75rem; padding-top: calc(.5rem + env(safe-area-inset-top));
}
.marque { display: flex; align-items: center; gap: .5rem; text-decoration: none; font-weight: 700; color: var(--titres); }
.marque img { border-radius: 8px; }
.nav { display: flex; gap: .25rem; flex-wrap: wrap; justify-content: flex-end; }
.nav a, .nav .lien { font-size: .9rem; padding: .4rem .55rem; border-radius: 8px; text-decoration: none; color: var(--titres); background: none; border: 0; cursor: pointer; font-family: inherit; }
.nav a.actif { background: var(--bleu-clair); font-weight: 600; }

.page { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 1rem .75rem 2rem; outline: none; }
.page.large, body.large .page { max-width: 1100px; }
.pied { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; padding: 1rem; font-size: .85rem; border-top: 1px solid var(--bord); background: var(--blanc); }
.pied a { color: var(--gris); }
.chargement { color: var(--gris); text-align: center; padding: 2rem 0; }
.centre { text-align: center; }

/* cartes */
.carte { background: var(--blanc); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 1rem; margin-bottom: 1rem; }
.carte > :last-child { margin-bottom: 0; }
.hero { text-align: center; padding: 1.5rem .5rem; }
.hero h1 { font-size: 1.8rem; }
.accroche { font-size: 1.1rem; color: var(--gris); }
.hero .bouton { display: block; max-width: 360px; margin: .75rem auto; }

/* boutons */
.bouton {
  display: inline-block; text-align: center; font: inherit; font-weight: 600; font-size: 1rem; min-height: 48px;
  padding: .7rem 1.1rem; border-radius: 10px; border: 1px solid transparent; cursor: pointer; text-decoration: none;
}
.bouton.principal { background: var(--primaire); color: var(--sur-primaire); }
.bouton.secondaire { background: var(--blanc); color: var(--titres); border-color: var(--titres); }
.bouton.danger { background: var(--rouge); color: #fff; }
.bouton.succes { background: var(--vert); color: #fff; }
.bouton.whatsapp { background: #128c4a; color: #fff; }
.bouton.petit { min-height: 38px; padding: .35rem .8rem; font-size: .9rem; }
.bouton.bloc { display: block; width: 100%; }
.bouton:disabled { opacity: .55; cursor: wait; }
.boutons { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.lien { background: none; border: 0; color: var(--titres); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }

/* formulaires */
form .bouton.principal[type=submit] { width: 100%; margin-top: .5rem; }
.champ { margin-bottom: .9rem; }
.champ label { display: block; font-weight: 600; margin-bottom: .25rem; }
.champ input, .champ select, .champ textarea {
  width: 100%; font: inherit; font-size: 16px; /* évite le zoom automatique d'iOS */
  padding: .65rem .7rem; border: 1px solid var(--bord); border-radius: 8px; background: var(--blanc); color: var(--texte);
}
.champ textarea { min-height: 8rem; resize: vertical; }
.champ textarea.long { min-height: 22rem; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; }
.champ input:focus, .champ select:focus, .champ textarea:focus { outline: 2px solid var(--trait); border-color: var(--trait); }
:focus-visible { outline: 3px solid var(--trait); outline-offset: 2px; }
.champ input[readonly] { background: var(--fond); }
.aide { display: block; color: var(--gris); font-size: .85rem; margin-top: .2rem; }
.case { display: flex; gap: .6rem; align-items: flex-start; margin: .7rem 0; cursor: pointer; }
.case input { width: 24px; height: 24px; flex: none; margin-top: .1rem; accent-color: var(--primaire); }
.grille2 { display: grid; gap: 0 1rem; }
@media (min-width: 600px) { .grille2 { grid-template-columns: 1fr 1fr; } }
fieldset { border: 1px solid var(--bord); border-radius: var(--rayon); padding: .75rem 1rem; margin: 0 0 1rem; }
legend { font-weight: 700; color: var(--titres); padding: 0 .3rem; }
.encadre { background: var(--orange-clair); border-radius: var(--rayon); padding: .75rem 1rem; margin: .75rem 0; }

/* messages */
.succes { background: var(--vert-clair); color: #134a30; border-radius: 8px; padding: .75rem; }
.alerte { background: var(--rouge-clair); color: #7d1a14; border-radius: 8px; padding: .75rem; }
.info { background: var(--bleu-clair); border-radius: 8px; padding: .75rem; }
.toast {
  position: fixed; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom)); transform: translate(-50%, 150%);
  background: var(--texte); color: #fff; padding: .75rem 1rem; border-radius: 10px; max-width: 92vw; z-index: 50;
  transition: transform .25s, opacity .25s, visibility .25s; box-shadow: 0 6px 20px rgba(0,0,0,.2);
  opacity: 0; visibility: hidden;
}
.toast.visible { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.toast.erreur { background: var(--rouge); }

/* pastilles de statut */
.pastille { display: inline-block; font-size: .85rem; font-weight: 600; padding: .15rem .6rem; border-radius: 99px; white-space: nowrap; }
.pastille.en_attente { background: var(--orange-clair); color: #8a4b00; }
.pastille.validee { background: var(--vert-clair); color: #134a30; }
.pastille.refusee { background: var(--rouge-clair); color: #7d1a14; }
.pastille.neutre { background: var(--bleu-clair); color: var(--bleu); }

/* statut participant */
.statut { display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; }
.statut .pastille { font-size: 1rem; padding: .3rem .9rem; }
.rang { font-size: 2.5rem; font-weight: 800; color: var(--titres); }

/* listes / tableaux */
.liste { list-style: none; padding: 0; margin: 0; }
.liste > li { background: var(--blanc); border: 1px solid var(--bord); border-radius: var(--rayon); padding: .8rem 1rem; margin-bottom: .6rem; }
.liste .ligne1 { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
.liste .nom { font-weight: 700; }
.liste .details { color: var(--gris); font-size: .9rem; }
.filtres { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .75rem; }
.filtres button { font: inherit; font-size: .9rem; border: 1px solid var(--bord); background: var(--blanc); border-radius: 99px; padding: .35rem .8rem; cursor: pointer; }
.filtres button.actif { background: var(--primaire); color: var(--sur-primaire); border-color: var(--primaire); }
.tableau-defile { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; background: var(--blanc); }
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--bord); vertical-align: top; }
th { color: var(--gris); font-weight: 600; white-space: nowrap; }
td.nombre, th.nombre { text-align: right; white-space: nowrap; }
pre.json { white-space: pre-wrap; word-break: break-word; font-size: .8rem; margin: 0; color: var(--gris); }

/* onglets d'administration */
.onglets { display: flex; gap: .25rem; overflow-x: auto; margin: 0 -.75rem 1rem; padding: 0 .75rem; border-bottom: 1px solid var(--bord); }
.onglets a { white-space: nowrap; padding: .6rem .8rem; text-decoration: none; color: var(--gris); border-bottom: 3px solid transparent; }
.onglets a.actif { color: var(--bleu); border-bottom-color: var(--accent); font-weight: 600; }

/* logos, QR */
.logo-club { max-width: 96px; max-height: 96px; object-fit: contain; }
.logo-club.petit { max-width: 40px; max-height: 40px; vertical-align: middle; }
.entete-club { display: flex; gap: .75rem; align-items: center; margin-bottom: .75rem; }
.qr { width: 220px; height: 220px; display: block; margin: .5rem auto; image-rendering: pixelated; background: #fff; }
.qr.petit { width: 140px; height: 140px; }
.whatsapp { border-left: 4px solid #128c4a; }

/* document mis en forme */
.document h2 { font-size: 1.15rem; }
.document ul { padding-left: 1.2rem; }
.apercu-doc { border: 1px dashed var(--bord); border-radius: 8px; padding: .75rem; max-height: 60vh; overflow: auto; background: var(--blanc); }
.doc-defile { max-height: 40vh; overflow: auto; border: 1px solid var(--bord); border-radius: 8px; padding: .5rem .75rem; margin: .5rem 0; background: var(--fond); }

@media (min-width: 700px) {
  .page { padding: 1.5rem 1rem 3rem; }
  .carte { padding: 1.25rem 1.5rem; }
}
@media print {
  .barre, .pied, .toast, .nav, .boutons { display: none !important; }
  body { background: #fff; }
}

/* ================================================================ thème du club (participants et présidents) */
body.avec-theme { background: var(--fond-theme); }
body.avec-theme .barre { background: var(--primaire); border-bottom-color: transparent; }
body.avec-theme .marque, body.avec-theme .nav a, body.avec-theme .nav .lien { color: var(--sur-primaire); }
body.avec-theme .nav a.actif { background: color-mix(in srgb, var(--sur-primaire) 18%, transparent); }
body.avec-theme .marque img { background: #fff; }
.bandeau-club { position: relative; margin: -1rem -.75rem 1rem; background: var(--primaire); color: var(--sur-primaire); overflow: hidden; }
.bandeau-club .visuel { display: block; width: 100%; height: auto; aspect-ratio: 3 / 1; object-fit: cover; background: var(--primaire); }
.bandeau-club .visuels { display: flex; justify-content: center; gap: 1rem; aspect-ratio: 3 / 1; padding: .5rem; }
.bandeau-club .visuels img { height: 100%; width: auto; max-width: 48%; object-fit: contain; }
.bandeau-club .titre { display: flex; align-items: center; gap: .6rem; padding: .7rem .9rem; background: var(--primaire); }
.bandeau-club .titre img { width: 44px; height: 44px; object-fit: contain; background: #fff; border-radius: 8px; padding: 3px; flex: none; }
.bandeau-club .titre .nom { font-weight: 800; font-size: 1.15rem; line-height: 1.2; }
.bandeau-club .titre .sous { font-size: .85rem; opacity: .9; }
.visuel-inscription { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--rayon) var(--rayon) 0 0; background: var(--primaire); }
.carte.avec-visuel { padding-top: 0; overflow: hidden; }
.carte.avec-visuel > .visuel-inscription { margin: 0 -1rem 1rem; width: calc(100% + 2rem); border-radius: 0; }
.galerie { display: flex; gap: .6rem; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: .4rem; margin: 0 -.25rem; }
.galerie img { flex: none; width: 78%; max-width: 420px; height: auto; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 10px; scroll-snap-align: start; background: var(--bord); }

/* ================================================================ téléphone : utilisable à une main (sauf administration) */
@media (max-width: 699px) {
  body.nav-bas .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; justify-content: space-around; gap: 0;
    background: var(--blanc); border-top: 1px solid var(--bord); padding: .25rem .25rem calc(.25rem + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 16px rgba(0,0,0,.06);
  }
  body.nav-bas .nav a, body.nav-bas .nav .lien {
    flex: 1; text-align: center; min-height: 52px; display: flex; align-items: center; justify-content: center;
    font-size: .95rem; font-weight: 600; color: var(--titres); text-decoration: none; border-radius: 10px;
  }
  body.nav-bas.avec-theme .nav a, body.nav-bas.avec-theme .nav .lien { color: var(--titres); }
  body.nav-bas .nav a.actif { background: color-mix(in srgb, var(--primaire) 12%, transparent); }
  body.nav-bas .page { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
  body.nav-bas .pied { padding-bottom: calc(5rem + env(safe-area-inset-bottom)); }
  body.nav-bas .toast { bottom: calc(5rem + env(safe-area-inset-bottom)); }
  .boutons .bouton { flex: 1 1 auto; min-height: 48px; }
  .liste .boutons .bouton.petit { min-height: 46px; font-size: 1rem; }
}

/* ================================================================ aperçu du thème (administration) */
.apercus { display: grid; gap: 1rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) { .apercus { grid-template-columns: 300px 1fr; } }
.cadre-apercu { border: 1px solid var(--bord); border-radius: 14px; overflow: hidden; background: var(--fond-theme); font-size: 14px; }
.cadre-apercu.tel { width: 300px; max-width: 100%; border-width: 8px; border-color: #1f2937; border-radius: 26px; }
.cadre-apercu .barre-ap { background: var(--primaire); color: var(--sur-primaire); padding: .45rem .7rem; font-weight: 700; display: flex; gap: .4rem; align-items: center; }
.cadre-apercu .barre-ap img { width: 24px; height: 24px; border-radius: 5px; background: #fff; object-fit: contain; }
.cadre-apercu .contenu-ap { padding: .7rem; }
.cadre-apercu .contenu-ap h3 { color: var(--titres); margin: .2rem 0 .4rem; }
.cadre-apercu .contenu-ap a { color: var(--titres); }
.cadre-apercu .bouton { min-height: 38px; padding: .4rem .8rem; font-size: .9rem; }
.cadre-apercu .trait-ap { height: 4px; background: var(--trait); border-radius: 2px; margin: .5rem 0; }
.cadre-apercu .visuel { display: block; width: 100%; height: auto; aspect-ratio: 3 / 1; object-fit: cover; }
.cadre-apercu .visuels { display: flex; justify-content: center; aspect-ratio: 3 / 1; background: var(--primaire); }
.cadre-apercu .visuels img { height: 100%; object-fit: contain; }
.nuancier { display: flex; gap: .75rem; flex-wrap: wrap; align-items: end; }
.nuancier .champ { flex: 1 1 140px; }
.nuancier input[type=color] { height: 48px; padding: 2px; }
.ajustements { list-style: none; padding: 0; margin: .5rem 0; }
.ajustements li { padding: .45rem .6rem; border-radius: 8px; margin-bottom: .35rem; font-size: .9rem; }
.ajustements li.ajuste { background: var(--orange-clair); }
.ajustements li.info { background: var(--bleu-clair); }
.ajustements li.attention { background: var(--rouge-clair); }
.vignettes { display: flex; gap: .5rem; flex-wrap: wrap; }
.vignettes figure { margin: 0; width: 150px; }
.vignettes img { width: 150px; height: 100px; object-fit: cover; border-radius: 8px; display: block; background: var(--bord); }
.vignettes figcaption { font-size: .8rem; }
.couleurs-sport { display: inline-flex; gap: 4px; vertical-align: middle; }
.couleurs-sport i { width: 18px; height: 18px; border-radius: 4px; display: inline-block; border: 1px solid rgba(0,0,0,.15); }

/* codes de secours */
ul.codes { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: .4rem; }
ul.codes code { display: block; text-align: center; font-size: 1.05rem; padding: .45rem; background: var(--fond); border-radius: 8px; letter-spacing: .05em; }
