:root {
    --accent: #ae2406;
    --accent-fonce: #8a1c04;
    --texte: #222;
    --doux: #666;
    --fond: #f6f4f2;
    --carte: #fff;
    --bord: #ddd;
    --ok: #1f7a3a;
    --erreur: #b3261e;
    --info: #1d5fa8;
    font-size: 15px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--texte);
    background: var(--fond);
    line-height: 1.45;
}

a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: .5rem 0 1rem; }
h2 { font-size: 1.2rem; }
small { color: var(--doux); }

.conteneur { max-width: 760px; margin: 0 auto; padding: 1.5rem 16px 3rem; }
.conteneur.large { max-width: 1400px; }

/* ---- formulaires ---- */
fieldset {
    border: 1px solid var(--bord);
    border-radius: 8px;
    background: var(--carte);
    padding: 1rem 1.25rem;
    margin: 0 0 1rem;
}
legend { font-weight: 600; padding: 0 .4rem; color: var(--accent); }

.champ { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .75rem; margin: .5rem 0; }
.champ > label { flex: 0 0 170px; font-weight: 500; }
.champ input:not([type=checkbox]), .champ select, .champ textarea { flex: 1 1 260px; max-width: 100%; }
.champ textarea { flex-basis: 100%; }
.champ.case > label { flex: 1 1 auto; font-weight: normal; }
.champ.places input { flex: 0 0 90px; }

input, select, textarea, button, .bouton {
    font: inherit;
    padding: .45rem .6rem;
    border: 1px solid #bbb;
    border-radius: 6px;
    background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.invalide { border-color: var(--erreur); background: #fff5f4; }
.erreur { color: var(--erreur); font-weight: bold; }

button, .bouton {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}
button:hover, .bouton:hover { background: var(--accent-fonce); }
button.secondaire, .bouton.secondaire { background: #fff; color: var(--accent); }
button.danger { background: #fff; color: var(--erreur); border-color: var(--erreur); }
button.danger:hover { background: var(--erreur); color: #fff; }
button.lien { background: none; border: 0; color: inherit; text-decoration: underline; padding: 0; }
button.petit { font-size: .8em; padding: .2em .5em; }

.actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; margin-top: 1rem; }
.ligne { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 0 0 1rem; }
.piege { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---- messages ---- */
.alerte, .notice, .flash {
    padding: .75rem 1rem;
    border-radius: 6px;
    background: #fff8e1;
    border-left: 4px solid #e0a800;
}
.erreur-bloc, .flash.erreur { background: #fdecea; border-left-color: var(--erreur); }
.flash.succes { background: #e8f5ec; border-left-color: var(--ok); }
.flash.info { background: #e8f0fb; border-left-color: var(--info); }

.recap { display: grid; grid-template-columns: minmax(120px, 200px) 1fr; gap: .4rem 1rem; background: var(--carte); padding: 1rem; border-radius: 8px; }
.recap dt { font-weight: 600; }
.recap dd { margin: 0; }
.texte { background: var(--carte); padding: 1rem 1.25rem; border-radius: 8px; }
.langues { text-align: right; margin: 0; }

/* ---- administration ---- */
.barre {
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem;
    background: var(--accent); color: #fff; padding: .5rem 16px;
}
.barre nav { display: flex; flex-wrap: wrap; gap: .25rem; }
.barre nav a { color: #fff; text-decoration: none; padding: .35rem .6rem; border-radius: 5px; }
.barre nav a:hover, .barre nav a.actif { background: rgba(255,255,255,.2); }
.deconnexion { display: flex; gap: .75rem; align-items: center; }

.carte { background: var(--carte); border: 1px solid var(--bord); border-radius: 8px; padding: 1rem 1.25rem; margin-bottom: 1rem; }
.carte summary { cursor: pointer; font-weight: 600; }
.connexion { max-width: 420px; margin: 10vh auto 0; }
.deux-colonnes { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
.resume { margin: .5rem 0 1rem; }

.defilement { overflow-x: auto; }
.tableau { width: 100%; border-collapse: collapse; background: var(--carte); font-size: .9rem; }
.tableau th, .tableau td { padding: .45rem .5rem; border-bottom: 1px solid var(--bord); text-align: left; vertical-align: top; }
.tableau thead th { background: #efeae6; position: sticky; top: 0; }
.tableau tbody tr:hover { background: #faf7f5; }
.tableau.compact { font-size: .85rem; }
.tableau .commentaire { max-width: 260px; }
.boutons, .boutons form { display: flex; gap: .35rem; flex-wrap: wrap; }
.boutons button, .boutons .bouton { padding: .25rem .5rem; font-size: .85rem; }
.ligne-erreur { background: #fdecea; }
.alerte-texte { color: var(--erreur); font-weight: bold; }

.badge { display: inline-block; padding: .1rem .45rem; border-radius: 4px; background: #eee; font-size: .85em; }
.badge.ok { background: #e8f5ec; color: var(--ok); }
.badge.retard { background: #222; color: #fff; }

.onglets { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: 1rem; }
.onglets a { padding: .4rem .7rem; border-radius: 6px; text-decoration: none; background: #fff; border: 1px solid var(--bord); }
.onglets a.actif { background: var(--accent); color: #fff; border-color: var(--accent); }

@media (max-width: 600px) {
    .champ > label { flex-basis: 100%; }
    .recap { grid-template-columns: 1fr; }
}

@media print {
    .actions, .langues, .barre { display: none; }
    body { background: #fff; }
}

/* ---- disponibilités, stages et formules ---- */
.disponibilites { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .5rem 1.5rem; }
.disponibilites h3 { margin: .5rem 0 .25rem; font-size: 1rem; }
.disponibilites ul { list-style: none; margin: 0; padding: 0; }
.disponibilites li { display: flex; justify-content: space-between; gap: 1rem; padding: .25rem 0; border-bottom: 1px dotted var(--bord); }
.disponibilites li.attente strong { color: #a86b00; }
.disponibilites li.complet strong { color: var(--erreur); }
.disponibilites li.ouvert strong { color: var(--ok); }
.tableau input.nombre { width: 5.5rem; }
.tableau tr.inactif td { color: #999; }
.tableau tfoot th { text-align: left; background: #efeae6; }

/* paiement en ligne */
.paiement { border-left: 4px solid var(--ok); }
.paiement h2 { margin-top: 0; }
.boutons-paiement { display: flex; flex-wrap: wrap; gap: .5rem; }
.boutons-paiement .bouton { text-decoration: none; }

/* options cumulables (cases à cocher) */
.champ > .libelle { flex: 0 0 170px; font-weight: 500; align-self: flex-start; }
.champ .cases { flex: 1 1 260px; display: flex; flex-direction: column; gap: .35rem; }
.champ .cases label { font-weight: normal; }

/* page Paiement en ligne */
.champ .aide { flex-basis: 100%; padding-left: calc(170px + .75rem); }
.champ .aide .effacer { font-weight: normal; margin-left: .5rem; white-space: nowrap; }
.verification { list-style: none; padding: 0; margin: 0 0 1rem; }
.verification li { padding: .25rem 0; }
@media (max-width: 600px) { .champ .aide { padding-left: 0; } }

/* inscription ferme, chambres */
.badge.ferme { background: #e8f0fb; color: var(--info); font-weight: 600; }
.tableau tr.ligne-a-traiter td:first-child { box-shadow: inset 3px 0 0 var(--info); }

/* tableaux interactifs : recherche, filtres, tri (admin.js) */
.recherche-tableau input[type=search] { flex: 1 1 260px; max-width: 420px; }
.recherche-tableau .compteur { color: var(--doux); font-size: .9rem; }
mark.surligne { background: #ffeb3b; color: inherit; padding: 0; border-radius: 2px; }
.tableau thead tr.filtres th { position: static; padding: .25rem .35rem; background: #f6f2ef; }
.tableau tr.filtres input, .tableau tr.filtres select { width: 100%; min-width: 6.5rem; padding: .2rem .3rem; font-size: .8rem; font-weight: normal; }
.tableau tr.filtres .actif { outline: 2px solid #ffeb3b; background: #fffde7; }
.tableau th.triable { cursor: pointer; user-select: none; white-space: nowrap; }
.tableau th.triable::after { content: ' ↕'; color: #b8aea6; font-size: .8em; }
.tableau th[aria-sort=ascending]::after { content: ' ▲'; color: var(--accent); }
.tableau th[aria-sort=descending]::after { content: ' ▼'; color: var(--accent); }

/* champs obligatoires (formulaire public et administration) */
.requis { color: var(--erreur); font-weight: 700; }
.legende-requis { margin: 0 0 1rem; color: var(--doux); font-size: .9rem; }
.message-erreur { display: block; flex-basis: 100%; color: var(--erreur); font-size: .85rem; margin-top: .15rem; }
.envoi-document { margin: 0; flex-wrap: nowrap; }
.envoi-document input[type=file] { max-width: 260px; padding: .25rem; }

/* =====================================================================
   Pages publiques : thème du site musiqueacoustique.org
   (Source Sans 3, licence SIL OFL, hébergée ici : aucune requête vers Google)
   ===================================================================== */
@font-face {
    font-family: 'Source Sans 3';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url(fonts/source-sans-3-latin.woff2) format('woff2');
}

body.public {
    --accent: #3f6b4d;
    --accent-fonce: #2f5239;
    --accent-clair: #e9f1eb;
    --vert-site: #6a9a78;
    --texte: #212529;
    --doux: #5f6b64;
    --fond: #f5f7f5;
    --bord: #d5ddd7;
    --erreur: #d7261e;
    font-family: 'Source Sans 3', 'Source Sans Pro', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 1.07rem;
    border-top: 6px solid var(--vert-site);
}
body.public .conteneur { max-width: 820px; padding-top: 2rem; }

body.public h1 { font-size: 2rem; font-weight: 700; line-height: 1.2; margin: .25rem 0 1.5rem; }
body.public h1::after { content: ''; display: block; width: 64px; height: 4px; margin-top: .6rem; border-radius: 2px; background: var(--vert-site); }
body.public h1 .sous-titre { display: block; font-size: 1.15rem; font-weight: 400; color: var(--doux); margin-top: .2rem; }
body.public .langues a { display: inline-block; padding: .2rem .75rem; border: 1px solid var(--bord); border-radius: 999px; background: #fff; text-decoration: none; font-size: .9rem; }

/* sections : cartes numérotées */
body.public form { counter-reset: section; }
body.public fieldset {
    border: 0;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 6px 20px rgba(30, 60, 40, .06);
    padding: 1.5rem 1.75rem 1.25rem;
    margin: 0 0 1.25rem;
}
body.public legend {
    float: left; width: 100%;
    display: flex; align-items: center; gap: .65rem;
    padding: 0 0 .9rem; margin-bottom: 1rem;
    border-bottom: 1px solid #edf1ee;
    color: var(--texte); font-size: 1.25rem; font-weight: 700;
}
body.public legend::before {
    counter-increment: section; content: counter(section);
    display: inline-grid; place-items: center; flex: 0 0 2rem; height: 2rem; border-radius: 50%;
    background: var(--accent); color: #fff; font-size: 1rem;
}
body.public legend + * { clear: both; }

/* champs : libellé au-dessus, deux colonnes */
body.public .grille { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.25rem; }
body.public .grille .large { grid-column: 1 / -1; }
body.public .champ { display: flex; flex-direction: column; align-items: stretch; gap: .35rem; margin: 0; }
body.public .champ > * { flex: none; }
body.public .champ > label, body.public .champ > .libelle { font-weight: 600; font-size: .95rem; }

body.public input:not([type=checkbox]), body.public select, body.public textarea {
    width: 100%; min-height: 2.9rem; padding: .6rem .8rem;
    border: 1px solid var(--bord); border-radius: 10px; background: #fbfcfb;
    transition: border-color .15s, box-shadow .15s, background-color .15s;
}
body.public textarea { min-height: 7rem; resize: vertical; }
body.public input:hover, body.public select:hover, body.public textarea:hover { border-color: #b4c3b8; }
body.public input:focus, body.public select:focus, body.public textarea:focus {
    outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px rgba(63, 107, 77, .18);
}
body.public .invalide:not(.champ) { border-color: var(--erreur); background: #fff6f5; }
body.public .invalide:not(.champ):focus { box-shadow: 0 0 0 3px rgba(215, 38, 30, .15); }

/* cases à cocher : tuiles cliquables */
body.public input[type=checkbox] { flex: 0 0 auto; width: 1.2rem; height: 1.2rem; margin: .1rem 0 0; accent-color: var(--accent); }
body.public .champ .cases { gap: .5rem; }
body.public .cases label, body.public .champ.case > label {
    display: flex; align-items: flex-start; gap: .7rem;
    padding: .75rem .9rem; border: 1px solid var(--bord); border-radius: 10px; background: #fbfcfb;
    font-weight: 400; cursor: pointer; transition: border-color .15s, background-color .15s;
}
body.public .cases label:hover, body.public .champ.case > label:hover { border-color: #b4c3b8; }
body.public .cases label:has(input:checked), body.public .champ.case > label:has(input:checked) {
    border-color: var(--accent); background: var(--accent-clair);
}
body.public .consentements .champ + .champ { margin-top: .6rem; }
body.public .champ.invalide { background: none; }
body.public .champ.case.invalide > label { border-color: var(--erreur); background: #fff6f5; }
body.public .consentements a { font-weight: 600; }

/* boutons */
body.public button, body.public .bouton {
    padding: .8rem 1.6rem; border-radius: 999px; font-weight: 700; letter-spacing: .01em;
    box-shadow: 0 2px 6px rgba(47, 82, 57, .25); transition: background-color .15s, transform .1s;
}
body.public button:active, body.public .bouton:active { transform: translateY(1px); }
body.public button.secondaire, body.public .bouton.secondaire { background: #fff; color: var(--accent); box-shadow: none; }
body.public button.secondaire:hover, body.public .bouton.secondaire:hover { background: var(--accent-clair); }
body.public .actions { margin-top: 1.5rem; }

/* encadrés */
body.public .carte, body.public .texte, body.public .recap {
    border: 0; border-radius: 14px; box-shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 6px 20px rgba(30, 60, 40, .06);
}
body.public .carte { padding: 1.1rem 1.5rem; margin-bottom: 1.25rem; }
body.public .carte summary { font-size: 1.1rem; }
body.public .alerte, body.public .notice, body.public .flash { border-radius: 10px; }

@media (max-width: 600px) {
    body.public h1 { font-size: 1.6rem; }
    body.public fieldset { padding: 1.1rem 1rem 1rem; }
    body.public .grille { grid-template-columns: 1fr; }
    body.public .actions button { flex: 1 1 100%; }
}

/* ---- champ masqué par JavaScript (ex. colocataire hors chambre double) ---- */
[hidden] { display: none !important; }
body.public .champ .aide { padding-left: 0; color: var(--doux); font-size: .88rem; }

/* ---- comptes à rebours (formulaire avant l'ouverture, compte-a-rebours.php) ---- */
.decompte { text-align: center; margin: 1.25rem 0; }
.decompte-titre { font-size: 1.2rem; font-weight: 600; margin: 0 0 .75rem; }
.decompte-unites { display: flex; justify-content: center; gap: clamp(.75rem, 4vw, 2.5rem); flex-wrap: wrap; }
.decompte-unites span { display: flex; flex-direction: column; align-items: center; min-width: 4.5rem; }
.decompte-unites b { font-size: clamp(2.4rem, 9vw, 4rem); font-weight: 700; line-height: 1.05; color: #e21b1b; font-variant-numeric: tabular-nums; }
.decompte-unites small { color: #e21b1b; font-size: 1rem; }
.decompte-fin { display: none; font-size: 1.2rem; font-weight: 600; }
.decompte.termine .decompte-unites, .decompte.termine .decompte-titre { display: none; }
.decompte.termine .decompte-fin { display: block; }
.decompte-message { text-align: center; font-size: 1.2rem; font-weight: 600; }
.decompte-message .bouton, .decompte-fin .bouton { margin-left: .5rem; }
.decompte-periode { text-align: center; color: var(--doux); }
body.public .attente-ouverture { text-align: center; }
body.public .attente-ouverture h2 { margin-top: .25rem; }

/* page intégrée dans le site (iframe) : fond transparent, sans bandeau */
body.public.integre { background: transparent; border-top: 0; }
body.public.integre .conteneur { max-width: none; padding: .5rem 8px; }
pre.code { white-space: pre-wrap; word-break: break-all; background: #f6f2ef; padding: .6rem .8rem; border-radius: 6px; font-size: .85rem; user-select: all; }

/* logo en tête des pages publiques ; le lien de langue se place à sa droite */
body.public .conteneur { position: relative; }
body.public .logo { display: block; width: 130px; height: auto; margin: 0 0 .75rem; mix-blend-mode: multiply; } /* fond blanc du dessin rendu transparent */
body.public .logo ~ .langues { position: absolute; top: 2rem; right: 16px; }
@media (max-width: 600px) { body.public .logo { width: 100px; } }
