:root {
  --fond: #f5f3ee;
  --carte: #ffffff;
  --texte: #1f2328;
  --discret: #6b6f76;
  --ligne: #e3e0d8;
  --principal: #1d5c63;
  --principal-fonce: #144248;
  --or: #b88a00;
  --jaune: #fff3a8;
  --vert: #1e7d4f;
  --vert-clair: #e2f4ea;
  --rouge: #b3261e;
  --rouge-clair: #fbe6e4;
  --rayon: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fond); color: var(--texte);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--principal); }
h1 { font-size: 1.5rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.8rem 0 .7rem; }
code { background: #eee; padding: 1px 5px; border-radius: 4px; }
.discret { color: var(--discret); }
.petit { font-size: .85rem; }

/* ---------- Barre du haut ---------- */
.barre { background: var(--principal); color: #fff; position: sticky; top: 0; z-index: 10; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.barre-haut { display: flex; align-items: center; gap: .6rem; padding: .55rem 1rem; }
.logo { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.15rem; margin-right: auto; display: flex; align-items: center; gap: .5rem; }
.logo img { border-radius: 7px; box-shadow: 0 0 0 1px rgba(255,255,255,.25); }
.choix-saison select { background: var(--principal-fonce); color: #fff; border: 1px solid rgba(255,255,255,.3); border-radius: 6px; padding: .3rem .4rem; font-size: .9rem; }
.burger { display: none; background: none; border: 0; color: #fff; font-size: 1.6rem; line-height: 1; cursor: pointer; }
.menu { display: flex; flex-wrap: wrap; gap: .1rem; padding: 0 .6rem .4rem; }
.menu a { color: #dcebec; text-decoration: none; padding: .4rem .65rem; border-radius: 6px; font-size: .95rem; }
.menu a:hover, .menu a.actif { background: rgba(255,255,255,.14); color: #fff; }
.menu a.deco { margin-left: auto; opacity: .85; }

.contenu { max-width: 1200px; margin: 0 auto; padding: 1.2rem 1rem 3rem; }

/* ---------- Messages ---------- */
.flash { padding: .7rem 1rem; border-radius: var(--rayon); margin: 0 0 1rem; }
.flash-ok { background: var(--vert-clair); color: #134d31; }
.flash-erreur { background: var(--rouge-clair); color: #7a1a14; }
.flash-info { background: #e7f0f7; color: #1b4565; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-block; border: 1px solid var(--ligne); background: var(--carte); color: var(--texte);
  padding: .55rem 1rem; border-radius: 8px; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: #c9c4b8; }
.btn-principal { background: var(--principal); border-color: var(--principal); color: #fff; }
.btn-principal:hover { background: var(--principal-fonce); }
.btn-danger { color: var(--rouge); border-color: #e9b8b3; }
.btn-petit { padding: .3rem .6rem; font-size: .85rem; }
.btn-large { width: 100%; padding: .8rem; font-size: 1.05rem; margin-top: .5rem; }

/* ---------- Chiffres clés ---------- */
.chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.chiffre { background: var(--carte); border-radius: var(--rayon); padding: .8rem 1rem; border: 1px solid var(--ligne); color: var(--discret); font-size: .9rem; }
.chiffre span { display: block; font-size: 1.5rem; font-weight: 700; color: var(--texte); }
.chiffre.alerte span { color: var(--rouge); }
.chiffres.petits .chiffre span { font-size: 1.2rem; }

.entete-section { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.entete-section h1, .entete-section h2 { margin-bottom: .3rem; }

/* ---------- Cartes groupes ---------- */
.grille-groupes { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .8rem; }
.carte-groupe {
  display: flex; flex-direction: column; gap: .3rem; background: var(--carte); border: 1px solid var(--ligne);
  border-left: 5px solid var(--or); border-radius: var(--rayon); padding: .9rem 1rem; text-decoration: none; color: var(--texte);
}
.carte-groupe:hover { box-shadow: 0 3px 10px rgba(0,0,0,.07); }
.carte-groupe strong { color: var(--or); }
.carte-groupe small { color: var(--discret); }
.carte-groupe-chiffres { display: flex; justify-content: space-between; margin-top: .3rem; }
.pastille { display: inline-block; padding: .1rem .55rem; border-radius: 99px; font-size: .78rem; font-weight: 700; align-self: flex-start; }
.pastille-verte { background: var(--vert-clair); color: var(--vert); }
.pastille-rouge { background: var(--rouge-clair); color: var(--rouge); }

/* ---------- Tableaux ---------- */
.tableau { width: 100%; border-collapse: collapse; background: var(--carte); border-radius: var(--rayon); overflow: hidden; border: 1px solid var(--ligne); }
.tableau th, .tableau td { padding: .5rem .6rem; border-bottom: 1px solid var(--ligne); text-align: left; vertical-align: middle; }
.tableau th { background: #faf8f3; font-size: .82rem; text-transform: uppercase; letter-spacing: .02em; color: var(--discret); }
.tableau .num { text-align: right; white-space: nowrap; }
.tableau tfoot td { background: #faf8f3; font-weight: 600; }
.tableau-adh td.nom { background: var(--jaune); font-weight: 600; }
.tableau-adh td.nom a { color: var(--texte); text-decoration: none; }
tr.cliquable { cursor: pointer; }
tr.cliquable:hover td { background: #f6faf9; }
tr.cliquable:hover td.nom { background: #fbeb85; }
.boutons { white-space: nowrap; }
.en-ligne { display: inline; }
.pied-label { text-align: right; }

.defile { overflow-x: auto; border-radius: var(--rayon); }
.tableau-adh td.petit { min-width: 120px; }

/* ---------- Choix des colonnes ---------- */
.col-cachee { display: none !important; }
.choix-colonnes { margin: 0 0 .8rem; }
.choix-colonnes summary { list-style: none; display: inline-block; }
.choix-colonnes summary::-webkit-details-marker { display: none; }
.choix-colonnes summary::before { content: '⚙ '; }
.choix-colonnes-liste { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; background: var(--carte); border: 1px solid var(--ligne); border-radius: var(--rayon); padding: .8rem 1rem; margin-top: .5rem; }
.choix-colonnes-liste label { display: flex; align-items: center; gap: .35rem; font-size: .95rem; }
.choix-colonnes-liste input { width: 1.15rem; height: 1.15rem; accent-color: var(--principal); }
.tableau-adh tfoot td.pied-vide { padding: 0; }

/* ---------- Filtres ---------- */
.filtres { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1rem; }
.filtres select, .filtres input[type=search] { flex: 1 1 180px; }

/* ---------- Formulaires ---------- */
input[type=text], input[type=tel], input[type=number], input[type=password], input[type=search], input[type=file], select, textarea {
  width: 100%; padding: .6rem .7rem; border: 1px solid #cfcabd; border-radius: 8px; font: inherit; background: #fff; color: var(--texte);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--principal); outline-offset: 0; border-color: var(--principal); }
input:disabled, select:disabled, textarea:disabled { background: #f3f1ec; color: var(--texte); }
input.maj { text-transform: uppercase; }
.formulaire fieldset {
  border: 1px solid var(--ligne); background: var(--carte); border-radius: var(--rayon); padding: 1rem;
  margin: 0 0 1rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .8rem 1rem;
}
.formulaire legend { font-weight: 700; padding: 0 .4rem; }
.formulaire label { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; font-weight: 600; color: #3b3f45; }
.formulaire label.large { grid-column: 1 / -1; }
.formulaire label.case { flex-direction: row; align-items: center; gap: .5rem; font-size: 1rem; padding-top: 1.4rem; }
.formulaire label.case input { width: 1.3rem; height: 1.3rem; accent-color: var(--principal); }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1.5rem; }
.actions .btn-danger { margin-left: auto; }
.aide { padding-left: 1.3rem; }
.aide li { margin-bottom: .3rem; }

/* ---------- Aide ---------- */
.aide-doc details { background: var(--carte); border: 1px solid var(--ligne); border-radius: var(--rayon); margin-bottom: .6rem; }
.aide-doc summary { padding: .85rem 1rem; font-weight: 700; cursor: pointer; color: var(--principal); }
.aide-doc details[open] summary { border-bottom: 1px solid var(--ligne); }
.aide-doc ul, .aide-doc ol { margin: .7rem 0; padding: 0 1rem 0 2.2rem; }
.aide-doc li { margin-bottom: .35rem; }
.aide-doc details > p, .aide-doc dl { padding: 0 1rem .6rem; margin: .5rem 0; }
.aide-doc dt { font-weight: 700; margin-top: .6rem; }
.aide-doc dd { margin: .2rem 0 0; color: #3b3f45; }

/* ---------- Connexion ---------- */
.carte-login { max-width: 400px; margin: 8vh auto 0; background: var(--carte); border-radius: 14px; padding: 2rem 1.6rem; box-shadow: 0 6px 30px rgba(0,0,0,.08); border-top: 6px solid var(--or); }
.carte-login h1 { margin-top: 0; color: var(--principal); }
.icone-login { display: block; margin: 0 auto 1rem; border-radius: 16px; }
.carte-login h1, .carte-login > .discret { text-align: center; }
.carte-login form label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; margin-bottom: .9rem; font-size: .92rem; }

/* ---------- Téléphone ---------- */
@media (max-width: 760px) {
  .burger { display: block; }
  .menu { display: none; flex-direction: column; padding: 0 .5rem .6rem; }
  body.menu-ouvert .menu { display: flex; }
  .menu a.deco { margin-left: 0; }
  .contenu { padding: 1rem .7rem 3rem; }
  .choix-saison select { max-width: 150px; }

  /* Le tableau des adhérents devient une liste de fiches */
  .tableau-adh, .tableau-adh tbody, .tableau-adh tr, .tableau-adh td, .tableau-adh tfoot { display: block; width: 100%; }
  .defile { overflow: visible; }
  .tableau-adh { background: none; border: 0; }
  .tableau-adh thead { display: none; }
  .tableau-adh tbody tr { background: var(--carte); border: 1px solid var(--ligne); border-radius: var(--rayon); margin-bottom: .6rem; padding: .3rem 0; overflow: hidden; }
  .tableau-adh td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: .25rem .9rem; text-align: right; }
  .tableau-adh td::before { content: attr(data-l); color: var(--discret); font-size: .85rem; text-align: left; }
  .tableau-adh td.nom { margin-top: -.3rem; padding: .5rem .9rem; }
  .tableau-adh td:empty, .tableau-adh td[data-l="Fact. acquit."]:empty { display: none; }
  .tableau-adh tfoot tr { display: flex; justify-content: space-between; background: var(--carte); border-radius: var(--rayon); border: 1px solid var(--ligne); }
  .tableau-adh tfoot td { display: block; width: auto; text-align: left; }
  .tableau-adh tfoot td:empty { display: none; }

  .tableau-simple { font-size: .9rem; }
  .tableau-simple th, .tableau-simple td { padding: .4rem; }
  .actions .btn { flex: 1 1 auto; text-align: center; }
  .actions .btn-danger { margin-left: 0; }
}

/* ---------- Impression ---------- */
@media print {
  .barre, .filtres, .btn, .actions { display: none !important; }
  body { background: #fff; font-size: 12px; }
  .contenu { padding: 0; max-width: none; }
  .tableau { border: 1px solid #999; }
  .chiffre { border: 1px solid #999; }
  .aide-doc details { break-inside: avoid; border: 1px solid #999; }
}
