/*
 * Gestion d'équipe : feuille de style pensée d'abord pour le téléphone.
 * Repères : texte de 17 px sur téléphone, rien sous 12 px, zones à toucher de 44 px au moins,
 * et rien ne dépasse de la largeur de l'écran (sinon le téléphone dézoome toute la page).
 */

:root {
    --bleu: #0b3d91;
    --bleu-fonce: #072c6b;
    --bleu-clair: #e6eefb;
    --fond: #eef1f6;
    --surface: #fff;
    --texte: #141c2b;
    --discret: #4e596b;
    --pale: #8a93a3;
    --bord: #dde3ec;
    --champ: #c9d1dd;
    --vert: #157a36;
    --vert-clair: #e0f2e6;
    --orange: #965800;
    --orange-clair: #fff0d4;
    --rouge: #bf2129;
    --rouge-clair: #fde7e7;
    --gris-clair: #eef0f4;
    --rayon: 16px;
    --rayon-petit: 12px;
    --ombre: 0 1px 2px rgba(16, 24, 40, .06), 0 2px 6px rgba(16, 24, 40, .04);
    --hauteur-barre: 56px;
    /* Hauteur de la navigation du bas : les boutons fixés au bas de l'écran se posent au-dessus */
    --hauteur-nav: 0px;
}

* { box-sizing: border-box; }

/* 17 px de base sur téléphone (en %, pour suivre la taille de texte choisie dans le navigateur) */
html {
    font-size: 106.25%;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    /* Filet de sécurité : un élément trop large ne doit jamais faire dézoomer la page */
    overflow-x: hidden;
    /* Les ancres (#reponse, #organisation...) ne finissent pas sous la barre du haut ni sous la navigation */
    scroll-padding-top: calc(var(--hauteur-barre) + env(safe-area-inset-top) + 12px);
    scroll-padding-bottom: 96px;
}
@supports (overflow: clip) { html { overflow-x: clip; } }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--texte);
    background: var(--fond);
    overflow-wrap: break-word;
    -webkit-font-smoothing: antialiased;
}

body.avec-nav { --hauteur-nav: calc(64px + env(safe-area-inset-bottom)); padding-bottom: calc(var(--hauteur-nav) + 8px); }

img, svg, video, canvas { max-width: 100%; }
a { color: var(--bleu); text-underline-offset: 2px; }
p { margin: 0 0 12px; }

/* 16 px au moins : en dessous, l'iPhone zoome sur le champ dès qu'on le touche */
input, select, textarea { font-size: max(16px, 1rem); max-width: 100%; }

.ico { width: 1.25em; height: 1.25em; flex: none; vertical-align: middle; }

/* ---------- Barre du haut ---------- */

.barre {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: calc(var(--hauteur-barre) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
    background: var(--bleu);
    color: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
}

.barre a { color: #fff; text-decoration: none; -webkit-tap-highlight-color: transparent; }

.barre .marque {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.2;
}
.nom-app { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.logo-barre { flex: none; width: 32px; height: 32px; object-fit: contain; border-radius: 8px; background: #fff; padding: 2px; }

/* Bouton « ‹ Retour » des sous-pages, à la place du nom de l'équipe */
.barre .retour {
    flex: 0 1 auto;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    min-height: 44px;
    margin-left: -6px;
    padding: 0 14px 0 2px;
    border-radius: 22px;
    font-weight: 600;
    font-size: 1rem;
}
.barre .retour span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barre .retour .ico { width: 26px; height: 26px; stroke-width: 2.4; }
.barre .retour:active, .barre .profil:active { background: rgba(255, 255, 255, .22); }

/* Prénom de la personne connectée : ouvre le profil */
.barre .profil {
    flex: none;
    margin-left: auto;
    max-width: 45%;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 4px 14px 4px 4px;
    border-radius: 22px;
    background: rgba(255, 255, 255, .14);
    font-weight: 600;
    font-size: .9rem;
}
.barre .profil .prenom { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.initiales {
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: var(--bleu);
    font-size: .78rem;
    font-weight: 800;
}
.barre .profil.actif { background: #fff; color: var(--bleu); }
.barre .profil.actif .initiales { background: var(--bleu); color: #fff; }

/* ---------- Navigation du bas ---------- */

.nav-bas {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    display: flex;
    justify-content: center;
    background: rgba(255, 255, 255, .98);
    border-top: 1px solid var(--bord);
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    box-shadow: 0 -4px 16px rgba(16, 24, 40, .06);
}

.nav-bas a {
    flex: 1 1 0;
    min-width: 0;
    max-width: 112px;
    height: 64px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 0 8px;
    color: var(--discret);
    font-size: .72rem;
    font-weight: 600;
    line-height: 1.1;
    text-decoration: none;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}
.nav-bas .icone {
    display: flex;
    align-items: center;
    justify-content: center;
    width: min(56px, 100%);
    height: 32px;
    border-radius: 16px;
    transition: background-color .15s;
}
.nav-bas .ico { width: 24px; height: 24px; }
.nav-bas a.actif { color: var(--bleu); font-weight: 700; }
.nav-bas a.actif .icone { background: var(--bleu-clair); }
.nav-bas a.actif .ico { stroke-width: 2.4; }

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

main {
    max-width: 760px;
    margin: 0 auto;
    padding: 16px max(14px, env(safe-area-inset-right)) 8px max(14px, env(safe-area-inset-left));
}

h1 { font-size: 1.5rem; line-height: 1.2; margin: 6px 2px 16px; letter-spacing: -.01em; overflow-wrap: anywhere; }
h2 { font-size: 1.15rem; line-height: 1.3; margin: 0 0 12px; }
h3 { font-size: 1rem; margin: 20px 0 8px; color: var(--discret); }

.carte {
    background: var(--surface);
    border-radius: var(--rayon);
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: var(--ombre);
}
.carte > :first-child { margin-top: 0; }
.carte > :last-child { margin-bottom: 0; }
.carte > form + p { margin-top: 10px; }
.carte.lien { display: block; text-decoration: none; color: inherit; }
.carte.annule { opacity: .7; }

.discret { color: var(--discret); font-size: .9rem; }
.lien-brut { text-decoration: none; color: inherit; }
.grandit { flex: 1; min-width: 0; }

/* Lien « Tous les matchs › » en pied de carte */
.carte > .lien-suite {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    margin: 12px -16px -16px;
    border-top: 1px solid var(--bord);
    border-radius: 0 0 var(--rayon) var(--rayon);
    font-weight: 600;
    text-decoration: none;
}
.carte > .lien-suite::after { content: "›"; margin-left: 6px; font-size: 1.3em; line-height: 1; }
.carte > .lien-suite:active { background: var(--bleu-clair); }

.flash {
    padding: 12px 14px;
    border-radius: var(--rayon-petit);
    margin-bottom: 14px;
    background: var(--vert-clair);
    color: var(--vert);
    font-weight: 600;
}
.flash.erreur { background: var(--rouge-clair); color: var(--rouge); }

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

.bouton, button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 48px;
    padding: 10px 18px;
    border: 0;
    border-radius: var(--rayon-petit);
    background: var(--bleu);
    color: #fff;
    font: inherit;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: transform .1s, filter .1s;
}
.bouton:active, button:active { transform: scale(.97); filter: brightness(.94); }
summary { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.bouton.secondaire { background: var(--bleu-clair); color: var(--bleu); }
.bouton.danger { background: var(--rouge-clair); color: var(--rouge); }
.bouton.ok { background: var(--vert-clair); color: var(--vert); }
.bouton.petit { min-height: 44px; padding: 8px 14px; font-size: .92rem; border-radius: 11px; }
.bouton.large { display: flex; width: 100%; }
.bouton.large + .bouton.large, form + form > .bouton.large:first-of-type { margin-top: 8px; }

/* Bouton d'enregistrement des longs formulaires : il reste au bas de l'écran tant que le formulaire est affiché */
.bouton.fixe {
    position: sticky;
    bottom: calc(var(--hauteur-nav) + 10px);
    z-index: 5;
    margin-top: 8px;
    min-height: 52px;
    box-shadow: 0 0 0 6px #fff, 0 6px 16px rgba(11, 61, 145, .3);
}

.barre-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.barre-actions:empty { display: none; }
.carte .barre-actions:last-child { margin-bottom: 0; }
.barre-actions form { margin: 0; }

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

.formulaire label { display: block; margin-bottom: 16px; font-weight: 600; font-size: .95rem; }

.formulaire input:not([type=checkbox]):not([type=radio]):not([type=file]),
.formulaire select,
.formulaire textarea {
    display: block;
    width: 100%;
    min-height: 48px;
    margin-top: 6px;
    padding: 11px 14px;
    border: 1.5px solid var(--champ);
    border-radius: var(--rayon-petit);
    font: inherit;
    font-size: max(16px, 1rem);
    font-weight: 400;
    color: var(--texte);
    background: #fff;
}
.formulaire input[type=file] { display: block; width: 100%; margin-top: 6px; font-weight: 400; }
.formulaire select, .filtre-rapport select {
    -webkit-appearance: none;
    appearance: none;
    padding-right: 40px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234e596b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 20px;
}
.formulaire input:focus, .formulaire select:focus, .formulaire textarea:focus, .filtre-rapport select:focus {
    outline: none;
    border-color: var(--bleu);
    box-shadow: 0 0 0 3px rgba(11, 61, 145, .18);
}

.formulaire textarea { min-height: 110px; line-height: 1.45; }
.formulaire label > .discret:last-child { display: block; margin-top: 6px; font-weight: 400; line-height: 1.4; }
.formulaire label.case { display: flex; align-items: center; gap: 12px; min-height: 44px; font-weight: 400; font-size: 1rem; }
.formulaire label.case input { flex: none; width: 24px; height: 24px; margin: 0; accent-color: var(--bleu); }
.formulaire .deux { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.formulaire.compact { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--bord); }

fieldset { min-width: 0; border: 1px solid var(--bord); border-radius: 14px; margin: 0 0 16px; padding: 12px 14px 2px; }
legend { font-weight: 700; padding: 0 6px; }

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

.liste { list-style: none; margin: 0; padding: 0; }
.liste > li { padding: 12px 0; border-bottom: 1px solid var(--bord); }
.liste > li:last-child { border-bottom: 0; }
.carte > .liste:last-child > li:last-child { padding-bottom: 0; }
.carte > h2 + .liste > li:first-child { padding-top: 4px; }
.liste a { text-decoration: none; color: inherit; display: block; }

.evenement { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.liste a.evenement { display: flex; }
.evenement > span:first-child, .evenement > .grandit { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.evenement .titre { font-weight: 700; }
.evenement .score { font-weight: 700; font-size: 1.2rem; white-space: nowrap; }
li.evenement > form, li.evenement > a { margin: 0; }
li.evenement > a { color: inherit; text-decoration: none; flex: 1; min-width: 0; }
/* Un bouton-lien dans une ligne garde la couleur de son type (la règle précédente lui donne celle du texte) */
li.evenement > a.bouton { flex: 0 0 auto; color: #fff; }
li.evenement > a.bouton.secondaire { color: var(--bleu); }
li.evenement > a.bouton.danger { color: var(--rouge); }
li.evenement > a.bouton.ok { color: var(--vert); }
li.evenement > a.badge, .evenement > .badge, .evenement > .statut { flex: none; }
.evenement.rapprocher { flex-wrap: wrap; }
.evenement.rapprocher > span { flex: 1 1 100%; }
.evenement.rapprocher select { flex: 1 1 100%; width: 100%; margin-top: 6px; }

/* Agenda : pavé de date, puis l'événement, puis son état */
.evt { display: flex; align-items: center; gap: 12px; min-width: 0; color: inherit; text-decoration: none; }
.liste a.evt, .liste li.evt { display: flex; }
.liste a.evt-corps { display: flex; }
a.evt:active, a.evt-corps:active { opacity: .7; }
.pave-date {
    flex: none;
    width: 54px;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: var(--rayon-petit);
    background: var(--bleu-clair);
    color: var(--bleu);
    line-height: 1.05;
    text-align: center;
}
.pave-date small { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; }
.pave-date strong { font-size: 1.45rem; font-weight: 800; margin: 1px 0; }
.pave-date.passe { background: var(--gris-clair); color: var(--discret); }
.pave-date.annule { background: var(--rouge-clair); color: var(--rouge); }
.evt-corps { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; color: inherit; text-decoration: none; }
.evt-titre { display: flex; align-items: center; gap: 8px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.evt-titre > span { min-width: 0; }
.evt-titre .logo { width: 26px; height: 26px; }
.evt.annule .evt-titre { color: var(--discret); text-decoration: line-through; }
.evt-meta { color: var(--discret); font-size: .9rem; line-height: 1.35; }
.evt-meta.lieu { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.evt-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.evt > .badge { flex: none; }
.evt > form { flex: none; margin: 0; }
svg.fleche { width: 20px; height: 20px; color: var(--pale); }

/* ---------- Pastilles ---------- */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--bleu-clair);
    color: var(--bleu);
    font-size: .78rem;
    font-weight: 700;
    line-height: 1.35;
    white-space: nowrap;
    vertical-align: middle;
}
.badge.alerte { background: var(--orange-clair); color: var(--orange); }
.badge.ok { background: var(--vert-clair); color: var(--vert); }
.badge.rouge { background: var(--rouge-clair); color: var(--rouge); }
.badge.neutre { background: var(--gris-clair); color: var(--discret); }
.badge.action { background: var(--bleu); color: #fff; }

/* Résultat d'un match dans les listes */
.resultat {
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 74px;
    padding: 6px 8px;
    border-radius: 10px;
    font-size: .95rem;
    font-weight: 800;
    white-space: nowrap;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}
.resultat strong { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.resultat.ok { background: var(--vert-clair); color: var(--vert); }
.resultat.rouge { background: var(--rouge-clair); color: var(--rouge); }
.resultat.alerte { background: var(--orange-clair); color: var(--orange); }
.resultat-fiche { text-align: center; margin: 4px 0 8px; }
.resultat-fiche .badge { font-size: .95rem; padding: 5px 16px; }

/* ---------- Statuts de présence ---------- */

.statut {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 700;
    white-space: nowrap;
    background: var(--gris-clair);
    color: var(--discret);
}
.statut.present { background: var(--vert-clair); color: var(--vert); }
.statut.incertain { background: var(--orange-clair); color: var(--orange); }
.statut.absent { background: var(--rouge-clair); color: var(--rouge); }

.compteurs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

/* Les trois gros boutons Présent / Incertain / Absent : le choix fait est plein */
.choix-statut { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.choix-statut button {
    flex-direction: column;
    gap: 2px;
    min-height: 58px;
    padding: 6px 4px;
    border-radius: var(--rayon-petit);
    font-size: .88rem;
    font-weight: 700;
    white-space: normal;
}
.choix-statut button .ico { width: 22px; height: 22px; stroke-width: 2.6; }
.choix-statut button.present { background: var(--vert-clair); color: var(--vert); }
.choix-statut button.incertain { background: var(--orange-clair); color: var(--orange); }
.choix-statut button.absent { background: var(--rouge-clair); color: var(--rouge); }
.choix-statut button.choisi.present { background: var(--vert); color: #fff; }
.choix-statut button.choisi.incertain { background: var(--orange); color: #fff; }
.choix-statut button.choisi.absent { background: var(--rouge); color: #fff; }
.choix-statut button.choisi { box-shadow: 0 3px 8px rgba(16, 24, 40, .18); }

.liste-joueurs { list-style: none; margin: 0; padding: 0; }
.liste-joueurs > li { padding: 12px 0; border-bottom: 1px solid var(--bord); }
.liste-joueurs > li:last-child { border-bottom: 0; padding-bottom: 0; }
.liste-joueurs .ligne { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
/* Pas de min-width: 0 ici : un prénom ne se coupe pas, ce sont les pastilles et le bouton qui passent à la ligne */
.liste-joueurs .nom { flex: 1 1 auto; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.liste-joueurs .ligne > .statut { font-size: .75rem; padding: 3px 8px; }
/* Liste de l'encadrement : une ligne de boutons plus basse par joueur */
.liste-joueurs .choix-statut button { flex-direction: row; gap: 4px; min-height: 44px; font-size: .85rem; }
.liste-joueurs .choix-statut button .ico { width: 18px; height: 18px; }
.convocation { margin: 0; }
.convocation .bouton { white-space: nowrap; }

.numero {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    margin-right: 2px;
    padding: 1px 6px;
    border-radius: 7px;
    background: var(--bleu);
    color: #fff;
    font-size: .8rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Réponse d'un parent ou d'un joueur, en haut des fiches et sur l'accueil */
.ma-reponse { margin-top: 14px; }
.ma-reponse + .ma-reponse { padding-top: 14px; border-top: 1px solid var(--bord); }
.ma-reponse .ligne { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.ma-reponse .nom { font-weight: 700; display: flex; align-items: center; gap: 6px; }
#reponse { border-left: 5px solid var(--bleu); }
#reponse .ma-reponse:first-of-type { margin-top: 0; }
details.reponses-equipe { border: 0; padding: 0; }
details.reponses-equipe > summary { color: var(--bleu); font-weight: 600; }

/* ---------- Fiches de match et de séance ---------- */

.fiche-evenement .quand { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font-size: 1.05rem; font-weight: 700; color: var(--bleu); }
.fiche-evenement .quand .discret { font-weight: 600; }
.fiche-evenement .info { display: flex; align-items: flex-start; gap: 8px; margin: 10px 0; }
.fiche-evenement .info > span { min-width: 0; overflow-wrap: anywhere; }
.fiche-evenement .quand .ico, .fiche-evenement .info .ico { width: 20px; height: 20px; margin-top: 1px; color: var(--bleu); }
.etiquettes { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 12px 0 8px; }
.notes { padding: 10px 12px; border-radius: 10px; background: var(--fond); }
.fiche-evenement .barre-actions { margin-top: 14px; }

.affiche { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: start; gap: 8px; margin: 4px 0 10px; text-align: center; }
.affiche > span { display: flex; flex-direction: column; align-items: center; gap: 8px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.affiche small { font-size: .88rem; }
.affiche > strong { margin-top: 16px; font-size: 1.9rem; line-height: 1.1; color: var(--bleu); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Raccourcis vers les parties d'une longue fiche, à faire défiler du doigt */
.sommaire {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin: -4px -14px 14px;
    padding: 2px 14px 4px;
    scrollbar-width: none;
}
.sommaire::-webkit-scrollbar { display: none; }
.sommaire a {
    flex: none;
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    padding: 6px 16px;
    border-radius: 999px;
    background: #fff;
    box-shadow: var(--ombre);
    color: var(--bleu);
    font-size: .9rem;
    font-weight: 600;
    text-decoration: none;
}

/* Rôles du match : le bouton reste sur une ligne à côté du libellé */
.evenement.role > form { flex: none; margin: 0; }
.evenement.role .bouton, .evenement.role button { white-space: nowrap; }

/* Rôles à plusieurs personnes (goûter...) : une ligne par volontaire */
.inscrits { list-style: none; margin: 8px 0 0; padding: 0 0 0 12px; border-left: 3px solid var(--vert-clair); }
.liste .inscrits li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 0; }
.inscrits form { margin: 0; flex: none; }

/* Rôles à pourvoir, premières visites */
.alerte-roles {
    background: var(--orange-clair);
    color: var(--orange);
    border-radius: var(--rayon-petit);
    padding: 12px 14px;
    margin: 12px 0;
    font-size: .95rem;
    font-weight: 600;
    line-height: 1.4;
}
main > .alerte-roles:first-of-type { margin-top: 0; }
.alerte-roles a { color: inherit; font-weight: 700; margin-left: 4px; }

.memo {
    padding: 12px 14px;
    margin-bottom: 14px;
    border-radius: var(--rayon-petit);
    background: var(--orange-clair);
    color: var(--orange);
}

/* ---------- Dépliants (fiches de l'équipe, formulaires secondaires) ---------- */

details { border-bottom: 1px solid var(--bord); padding: 2px 0; }
details:last-child { border-bottom: 0; }
summary {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    min-height: 52px;
    padding: 8px 32px 8px 0;
    list-style: none;
    cursor: pointer;
}
summary::-webkit-details-marker { display: none; }
/* Chevron : indique qu'on peut déplier */
summary::after {
    content: "";
    position: absolute;
    right: 8px;
    top: 50%;
    width: 9px;
    height: 9px;
    margin-top: -7px;
    border-right: 2.5px solid var(--pale);
    border-bottom: 2.5px solid var(--pale);
    transform: rotate(45deg);
    transition: transform .15s;
}
details[open] > summary::after { transform: translateY(4px) rotate(-135deg); }
details[open] > summary { margin-bottom: 6px; }
summary > strong { min-width: 0; overflow-wrap: anywhere; }

details.affecter { border: 0; padding: 4px 0 0; }
details.affecter > summary { display: inline-flex; min-height: 40px; padding-right: 26px; color: var(--bleu); font-weight: 600; }
details.affecter > summary::after { right: 6px; width: 7px; height: 7px; margin-top: -6px; border-color: currentColor; }

/* ---------- Contacts et équipe ---------- */

.contacts { list-style: none; margin: 0; padding: 0; }
.contacts li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--bord);
    flex-wrap: wrap;
}
.contacts li:last-child { border-bottom: 0; }
.contacts li > span:first-child { flex: 1 1 170px; min-width: 0; overflow-wrap: anywhere; }
.contacts .actions { display: flex; gap: 6px; flex-wrap: wrap; margin: 0; }

.logo { width: 28px; height: 28px; object-fit: contain; border-radius: 6px; background: #fff; flex: none; vertical-align: middle; }
.logo.grand { width: 64px; height: 64px; border-radius: 12px; }
.logo.vide { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--bleu-clair); color: var(--bleu); font-weight: 800; font-size: 1.05rem; }
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; }
.avatar.petit { width: 26px; height: 26px; font-size: .68rem; }
.avatar.grand { width: 96px; height: 96px; font-size: 2rem; }
.avatar.vide { background: var(--bleu-clair); color: var(--bleu); font-weight: 700; font-size: .85rem; }
.avatar.petit.vide { font-size: .68rem; }
.avatar.grand.vide { font-size: 2rem; }
.fiche-photo { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.form-photo { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }

/* ---------- Tableaux (admin, import, statistiques) ---------- */

/* Tableau plus large que l'écran : il défile du doigt, et une ombre au bord montre qu'il y a une suite */
.defilement, .tableau {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    background:
        linear-gradient(90deg, #fff 40%, rgba(255, 255, 255, 0)) left center / 28px 100% no-repeat local,
        linear-gradient(270deg, #fff 40%, rgba(255, 255, 255, 0)) right center / 28px 100% no-repeat local,
        radial-gradient(farthest-side at 0 50%, rgba(16, 24, 40, .2), rgba(16, 24, 40, 0)) left center / 12px 100% no-repeat scroll,
        radial-gradient(farthest-side at 100% 50%, rgba(16, 24, 40, .2), rgba(16, 24, 40, 0)) right center / 12px 100% no-repeat scroll;
}
table { border-collapse: collapse; width: 100%; font-size: .88rem; background: #fff; }
.defilement table, .tableau table { background: transparent; }
th, td { border: 1px solid var(--bord); padding: 8px; text-align: left; vertical-align: top; }
th { background: var(--bleu-clair); }

.tableau { margin: 8px 0; }
.tableau table { width: 100%; border-collapse: collapse; font-size: .85rem; font-variant-numeric: tabular-nums; }
.tableau th, .tableau td { padding: 8px 6px; text-align: center; border: 0; border-bottom: 1px solid var(--bord); white-space: nowrap; }
.tableau thead th { font-size: .72rem; text-transform: uppercase; color: var(--discret); background: var(--fond); }
.tableau .gauche { text-align: left; }
.tableau .fort { font-weight: 700; }
.tableau tr.choisie td { background: var(--orange-clair); font-weight: 600; }
.tableau tr.nous td { background: var(--bleu-clair); font-weight: 600; }
.tableau tr.eux td { background: var(--rouge-clair); font-weight: 600; }
.tableau td .logo { width: 22px; height: 22px; margin-right: 6px; }

/* ---------- Administration ---------- */

.tuiles { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-bottom: 16px; }
.tuile {
    display: block;
    padding: 16px;
    border-radius: var(--rayon);
    background: #fff;
    text-decoration: none;
    color: var(--texte);
    box-shadow: var(--ombre);
}
.tuile strong { display: block; font-size: 1.6rem; color: var(--bleu); }

.titre-rubrique { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--discret); margin: 22px 4px 8px; }
.liste.menu-admin a { display: flex; align-items: center; gap: 10px; min-height: 48px; }
.menu-admin a > span:first-child { flex: 1; min-width: 0; }
.menu-admin strong { display: block; }
.menu-admin small { display: block; margin-top: 2px; color: var(--discret); font-size: .88rem; line-height: 1.35; }
.menu-admin .fleche { color: var(--pale); font-size: 1.5rem; line-height: 1; }
.menu-admin.a-faire strong { color: var(--orange); }

.lien-copie { overflow-wrap: anywhere; word-break: break-all; font-size: .88rem; background: var(--fond); padding: 10px 12px; border-radius: 10px; }
.code-equipe { font-size: 1.8rem; font-weight: 800; letter-spacing: .12em; color: var(--bleu); text-align: center; margin: 8px 0; }

.filtres { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filtres a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 8px 18px;
    border-radius: 999px;
    background: #fff;
    box-shadow: var(--ombre);
    color: var(--texte);
    font-size: .92rem;
    font-weight: 600;
    text-decoration: none;
}
.filtres a.actif { background: var(--bleu); color: #fff; }

.guide ul, .guide ol { margin: 0; padding-left: 20px; }
.guide li { margin-bottom: 8px; line-height: 1.5; }
.guide .statut { font-size: .8rem; }

.apercu-icone { vertical-align: middle; border-radius: 8px; }
.code-mfa { font-size: 1.5rem !important; letter-spacing: .3em; text-align: center; font-family: ui-monospace, monospace; }
.cle-totp { font-family: ui-monospace, monospace; font-size: 1.05rem; word-spacing: .2em; overflow-wrap: anywhere; background: var(--fond); padding: 10px; border-radius: 8px; }
.codes-secours { list-style: none; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-family: ui-monospace, monospace; font-size: 1.1rem; }
.codes-secours li { background: var(--fond); padding: 8px; border-radius: 8px; text-align: center; }
.etapes { padding-left: 20px; }
.etapes li { margin-bottom: 12px; }
.etapes .etape { padding: 10px 0; }
.etape .barre-actions { margin: 8px 0 0; }
.aide { background: var(--bleu-clair); color: var(--texte); padding: 12px 14px; border-radius: var(--rayon-petit); margin-bottom: 14px; font-size: .95rem; }
.journal { font-family: ui-monospace, monospace; font-size: .78rem; white-space: pre-wrap; word-break: break-all; background: var(--fond); padding: 10px; border-radius: 8px; }
[hidden] { display: none !important; }
.hors-ecran { position: fixed; top: -1000px; left: 0; opacity: 0; }

.connexion { max-width: 440px; margin: 0 auto; }
.version { margin: 24px 0 4px; text-align: center; font-size: .75rem; color: var(--discret); }
.separateur { text-align: center; color: var(--discret); margin: 12px 0; }

/* Avertissements de l'accueil */
.avertissements { border-left: 5px solid var(--orange); }
.avertissements h2 { color: var(--orange); }

/* Journal de sécurité */
.kpi.alerte strong { color: var(--orange); }
.kpi.rouge strong { color: var(--rouge); }
.activite li .ligne { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.activite .qui { font-weight: 600; margin-top: 4px; overflow-wrap: anywhere; }
.activite .quand { white-space: nowrap; font-size: .88rem; }
.activite .ip { font-family: ui-monospace, monospace; font-size: .85rem; overflow-wrap: anywhere; }
.activite small { display: block; margin-top: 2px; }
.liste.activite div a { display: inline; color: var(--bleu); }

/* ---------- Rapports de statistiques ---------- */

svg.graphique { display: block; width: 100%; height: auto; margin: 8px 0; }
/* Deux dessins par graphique (voir inc/graphiques.php) : le compact sur téléphone, le large ailleurs */
svg.graphique.compact { display: none; }
@media (max-width: 699px) {
    svg.graphique.large { display: none; }
    svg.graphique.compact { display: block; max-width: 460px; margin-left: auto; margin-right: auto; }
}
.rapport-entete { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 3px solid var(--bleu); }
.rapport-entete img { border-radius: 10px; }
.rapport-entete div { display: flex; flex-direction: column; min-width: 0; }
.rapport-entete strong { font-size: 1.2rem; overflow-wrap: anywhere; }
.rapport-type { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--bleu); font-weight: 700; }
.score-rapport { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; text-align: center; }
.equipe-score span { display: block; font-size: .88rem; font-weight: 600; color: var(--discret); overflow-wrap: anywhere; }
.equipe-score strong { font-size: 2.6rem; line-height: 1.1; }
.equipe-score:first-child strong { color: var(--bleu); }
.equipe-score:last-child strong { color: var(--rouge); }
.centre-score { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.centre-score small { color: var(--discret); }
.filtre-rapport { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: 16px; }
.filtre-rapport label { flex: 1 1 220px; min-width: 0; font-weight: 600; font-size: .92rem; }
.filtre-rapport select { display: block; width: 100%; min-height: 48px; margin-top: 6px; padding: 10px 40px 10px 12px; font: inherit; font-size: max(16px, 1rem); font-weight: 400; border: 1.5px solid var(--champ); border-radius: var(--rayon-petit); color: var(--texte); }
.filtre-rapport .barre-actions { margin-bottom: 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(130px, 100%), 1fr)); gap: 8px; margin: 8px 0; }
.kpi { background: var(--fond); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; min-width: 0; }
.kpi strong { font-size: 1.35rem; color: var(--bleu); }
.kpi span { font-size: .82rem; font-weight: 600; }
.kpi small { font-size: .76rem; color: var(--discret); }
.anneaux { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 8px; max-width: 480px; margin: 8px auto; }
.anneau { margin: 0; text-align: center; }
.anneau svg.graphique { max-width: 110px; margin: 0 auto 4px; }
.anneau figcaption { font-size: .78rem; font-weight: 600; line-height: 1.2; color: var(--discret); }
.points-cles { margin: 0; padding-left: 20px; }
.points-cles li { margin-bottom: 6px; }
.rapport-joueuse { border-left: 5px solid #f29900; }
.comparaison td { width: 30%; font-size: 1rem; font-weight: 600; }
.comparaison th, .comparaison td { white-space: normal; -webkit-hyphens: auto; hyphens: auto; }
.comparaison tbody th { font-weight: 500; color: var(--discret); }
.comparaison thead .nous { color: var(--bleu); }
.comparaison thead .eux { color: var(--rouge); }
.comparaison td.meilleur, .tableau td.meilleur { color: var(--vert); }
.chronologie { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
.chronologie li { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--bord); }
.chronologie .temps { flex: none; width: 48px; color: var(--discret); font-variant-numeric: tabular-nums; }
.chronologie .score-court { flex: none; width: 46px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chronologie li.periode { font-weight: 700; color: var(--bleu); padding-top: 12px; }
.chronologie li.eux { color: var(--discret); }
.chronologie li.but.nous, .chronologie li.but7m.nous { color: var(--bleu); font-weight: 600; }
.chronologie li.deux_min, .chronologie li.disqualification { color: var(--rouge); }
.source { font-size: .8rem; color: var(--discret); text-align: center; }
.titre-joueuse { display: flex; align-items: center; gap: 12px; }

/* Trajet */
.trajets { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); gap: 10px; margin: 8px 0; }
.trajet { background: var(--fond); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.trajet span { font-size: .88rem; font-weight: 600; }
.trajet strong { font-size: 1.5rem; color: var(--bleu); }
.trajet small { color: var(--discret); }
.trajet.meilleur { border: 2px solid var(--vert); }

/* Aperçu d'une équipe FFHB */
.apercu { border: 2px solid var(--bleu); border-radius: var(--rayon); padding: 12px; margin: 12px 0; }
.apercu h3 { margin-top: 12px; }

/* Analyse de l'adversaire */
.analyse-points { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.analyse-points > div { border-radius: 10px; padding: 12px; }
.analyse-points .forts { background: var(--vert-clair); }
.analyse-points .faibles { background: var(--rouge-clair); }
.analyse-points h3 { margin: 0 0 6px; }
.analyse-points .forts h3 { color: var(--vert); }
.analyse-points .faibles h3 { color: var(--rouge); }
.analyse-points ul { margin: 0; padding-left: 18px; }
.analyse-points li { margin-bottom: 4px; }
.surveiller { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.surveiller li { display: flex; gap: 10px; align-items: flex-start; background: var(--fond); border-radius: 10px; padding: 10px; }
.surveiller .numero { flex: none; }
.surveiller small { display: block; color: var(--discret); }
.forme { display: inline-flex; gap: 3px; }
.forme span { width: 22px; height: 22px; border-radius: 50%; font-size: .72rem; font-weight: 700; color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.forme .V { background: var(--vert); }
.forme .N { background: var(--orange); }
.forme .D { background: var(--rouge); }

/* ---------- Écrans plus larges ---------- */

@media (min-width: 640px) {
    .tuiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .analyse-points { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

@media (min-width: 760px) {
    html { font-size: 100%; }
    main { padding-top: 24px; }
    .sommaire { margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; }
}

/* Petits téléphones : deux champs côte à côte avec un texte d'aide deviennent illisibles, on les empile */
@media (max-width: 479px) {
    .formulaire .deux:has(.discret) { grid-template-columns: minmax(0, 1fr); gap: 0; }
}

/* Très petits écrans (iPhone SE, vieux Android) : on gagne de la place partout */
@media (max-width: 359px) {
    main { padding-left: 10px; padding-right: 10px; }
    .carte { padding: 14px 12px; }
    .carte > .lien-suite { margin: 12px -12px -14px; }
    .sommaire { margin-left: -10px; margin-right: -10px; padding-left: 10px; padding-right: 10px; }
    .barre .profil { padding-right: 4px; }
    .barre .profil .prenom { display: none; }
    .pave-date { width: 48px; }
    .evt { gap: 10px; }
    .choix-statut { gap: 6px; }
    .choix-statut button { font-size: .8rem; }
    .liste-joueurs .choix-statut button { padding: 6px 2px; }
    .liste-joueurs .choix-statut button .ico { display: none; }
    .anneaux { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Téléphone, clavier ouvert : la navigation du bas cache le champ en cours de saisie, on la retire le temps de la saisie */
@media (pointer: coarse) {
    body.avec-nav:has(input:not([type=checkbox], [type=radio], [type=file], [type=submit], [type=button]):focus, textarea:focus) {
        --hauteur-nav: 0px;
    }
    body:has(input:not([type=checkbox], [type=radio], [type=file], [type=submit], [type=button]):focus, textarea:focus) .nav-bas {
        display: none;
    }
}

@media print {
    @page { margin: 12mm; }
    html { font-size: 100%; }
    body, body.avec-nav { background: #fff; padding: 0; font-size: 11pt; }
    .barre, .nav-bas, .pas-imprimer, .flash, .version, .sommaire, .lien-suite { display: none !important; }
    main { max-width: none; padding: 0; }
    h1 { display: none; }
    .carte { box-shadow: none; border: 1px solid var(--bord); break-inside: avoid; padding: 10px 12px; margin-bottom: 10px; }
    .tableau { overflow: visible; }
    svg.graphique.large { display: block !important; }
    svg.graphique.compact { display: none !important; }
    a { color: inherit; text-decoration: none; }
    .analyse-points { grid-template-columns: 1fr 1fr; }
    .kpi, .tableau thead th, .tableau tr.choisie td, .analyse-points > div, .forme span, .tableau tr.nous td, .tableau tr.eux td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
