/* Guichet des subventions — feuille de style. Copyright (C) 2026 Franck Petit — GPL v3, voir LICENSE.
   Le guichet est public : il s'adresse à des bénévoles, souvent le soir, souvent
   au téléphone. Priorité à la lisibilité et aux cibles tactiles, pas à l'effet. */

:root {
  --marque: #123c5a;          /* bleu nuit de la Commune de Saint-Exemple */
  --marque-fonce: #0d2c43;
  --marque-clair: #e8eef4;
  /* Ce qui s'écrit SUR la couleur de marque. En thème sombre, la marque
     s'éclaircit : du blanc dessus tomberait à un contraste d'environ 2:1,
     illisible — il faut alors de l'encre foncée. */
  --sur-marque: #ffffff;
  --encre: #1b232d;
  --encre-douce: #5b6672;
  --fond: #f6f7f9;
  --surface: #ffffff;
  --ligne: #dde2e8;
  --ok: #14653f;      --ok-fond: #e6f4ec;
  --erreur: #9b1c1c;  --erreur-fond: #fdeaea;
  --info: #1c4f9b;    --info-fond: #eaf1fd;
  --alerte: #8a5300;  --alerte-fond: #fdf3e3;
  --r: 10px;
  --r-s: 6px;
  --pas: 1.25rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --marque: #7fb2dd; --marque-fonce: #0d2c43; --marque-clair: #17293a;
    --sur-marque: #0d1b26;
    --encre: #e9edf2; --encre-douce: #a3aeba;
    --fond: #12171d; --surface: #1a2029; --ligne: #2c3541;
    --ok: #7fd6a8; --ok-fond: #16301f;
    --erreur: #f5a3a3; --erreur-fond: #331717;
    --info: #a8c8f5; --info-fond: #16233a;
    --alerte: #f0c68a; --alerte-fond: #33270f;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--encre);
  font: 400 clamp(16px, 1rem + .1vw, 17.5px)/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.conteneur { width: min(64rem, 100% - 2.5rem); margin-inline: auto; }
.conteneur.large { width: min(80rem, 100% - 2.5rem); }

/* Lien d'évitement : premier élément focalisable, invisible tant qu'on ne
   navigue pas au clavier. */
.evitement {
  position: absolute; left: -9999px;
  background: var(--surface); color: var(--encre);
  padding: .75rem 1rem; border-radius: var(--r-s); z-index: 10;
}
.evitement:focus { left: 1rem; top: 1rem; }

.entete { background: var(--marque-fonce); color: #fff; padding: .9rem 0; }
.entete .conteneur { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; }
.marque { color: #fff; text-decoration: none; display: block; }
.marque-nom { display: block; font-weight: 600; font-size: 1.05rem; }
.marque-sous { display: block; font-size: .8rem; opacity: .85; }
.nav { display: flex; flex-wrap: wrap; gap: .35rem 1rem; align-items: center; }
.nav a { color: #fff; text-decoration: none; padding: .4rem 0; border-bottom: 2px solid transparent; }
.nav a:hover, .nav a:focus { border-bottom-color: #fff; }
.nav a.bouton { background: #fff; color: var(--marque-fonce); padding: .45rem .9rem; border-radius: var(--r-s); font-weight: 600; }
.nav a.bouton:hover { border-bottom-color: transparent; opacity: .92; }

main { padding: 2rem 0 3rem; }
h1 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); line-height: 1.25; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 2rem 0 .75rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; }
p, li { max-width: 70ch; }
.intro { font-size: 1.05rem; color: var(--encre-douce); }
.discret { color: var(--encre-douce); font-size: .85rem; }

.carte, .bloc {
  background: var(--surface); border: 1px solid var(--ligne);
  border-radius: var(--r); padding: var(--pas); margin-bottom: var(--pas);
}
.cartes { display: grid; gap: var(--pas); grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }

/* Étapes : une association ne sait pas ce qu'on attend d'elle ni dans quel
   ordre. La liste numérotée est la colonne vertébrale de l'accueil. */
.etapes { list-style: none; counter-reset: etape; padding: 0; }
.etapes li {
  counter-increment: etape; position: relative;
  padding: .85rem 0 .85rem 3rem; border-top: 1px solid var(--ligne); max-width: none;
}
.etapes li::before {
  content: counter(etape);
  position: absolute; left: 0; top: .8rem;
  width: 2rem; height: 2rem; border-radius: 50%;
  display: grid; place-items: center; font-weight: 600;
  background: var(--marque-clair); color: var(--marque);
}
.etapes li.faite::before { content: "✓"; background: var(--ok-fond); color: var(--ok); }
.etapes li.faite { color: var(--encre-douce); }

label { display: block; margin-bottom: .9rem; font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=file], select, textarea {
  width: 100%; margin-top: .3rem; padding: .65rem .75rem;
  font: inherit; color: var(--encre); background: var(--surface);
  border: 1px solid var(--ligne); border-radius: var(--r-s);
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--marque); outline-offset: 2px;
}
.aide-champ { font-weight: 400; font-size: .85rem; color: var(--encre-douce); }

button, .bouton-action {
  font: inherit; font-weight: 600; cursor: pointer;
  padding: .7rem 1.2rem; min-height: 44px;      /* cible tactile */
  border: 1px solid var(--marque); border-radius: var(--r-s);
  /* ⚠️ Pas `#fff` : en thème sombre, `--marque` s'éclaircit et du blanc
     dessus tombe à un contraste d'environ 2:1. « Déposer ma demande »
     devenait presque invisible le soir, exactement quand les bénévoles
     remplissent leur dossier. */
  background: var(--marque); color: var(--sur-marque); text-decoration: none;
  display: inline-flex; align-items: center; gap: .5rem;
}
button:hover, .bouton-action:hover { background: var(--marque-fonce); border-color: var(--marque-fonce); color: #fff; }
button.sec, .bouton-action.sec { background: transparent; color: var(--marque); }
button.sec:hover, .bouton-action.sec:hover { background: var(--marque-clair); }


.msg { padding: .8rem 1rem; border-radius: var(--r-s); margin-bottom: 1rem; border: 1px solid transparent; }
.msg.ok { background: var(--ok-fond); color: var(--ok); border-color: currentColor; }
.msg.erreur { background: var(--erreur-fond); color: var(--erreur); border-color: currentColor; }
.msg.info { background: var(--info-fond); color: var(--info); border-color: currentColor; }
.msg.alerte { background: var(--alerte-fond); color: var(--alerte); border-color: currentColor; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--ligne); vertical-align: top; }
th { font-size: .85rem; color: var(--encre-douce); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tableau-defile { overflow-x: auto; }

.etat {
  display: inline-block; padding: .12rem .6rem; border-radius: 999px;
  font-size: .82rem; border: 1px solid var(--ligne); background: var(--fond);
}
/* Les pilules portent toujours un libellé : la couleur appuie, elle ne dit rien
   à elle seule. */
.etat-vote { background: var(--ok-fond); color: var(--ok); border-color: currentColor; }
.etat-rejete { background: var(--erreur-fond); color: var(--erreur); border-color: currentColor; }
.etat-correction { background: var(--alerte-fond); color: var(--alerte); border-color: currentColor; }
.etat-saisie { color: var(--encre-douce); }
.etat-instruction,
.etat-attente_vote { background: var(--info-fond); color: var(--info); border-color: currentColor; }
.etat-controle { background: var(--ok-fond); color: var(--ok); border-color: currentColor; }
.etat-annulee { color: var(--encre-douce); text-decoration: line-through; }

.liste-pieces { list-style: none; padding: 0; }
.liste-pieces li { border-top: 1px solid var(--ligne); padding: .75rem 0; max-width: none; }
.liste-pieces .manquante { color: var(--alerte); }

.pied { border-top: 1px solid var(--ligne); padding: 1.5rem 0 2.5rem; color: var(--encre-douce); font-size: .9rem; }
.pied a { color: inherit; }

.secours { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .4rem; list-style: none; padding: 0; }
.secours code { display: block; padding: .4rem; text-align: center; background: var(--fond); border: 1px solid var(--ligne); border-radius: var(--r-s); font-size: 1.05rem; }

.qr { width: 200px; height: 200px; margin: 1rem 0; padding: 8px; background: #fff; color: #1b232d; border-radius: 8px; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}


/* ---------------------------------------------------------------------------
   Parcours déclaratif en neuf étapes
   --------------------------------------------------------------------------- */

/* Masque à l'écran sans masquer pour un lecteur d'écran. `display:none` le
   retirerait aussi de la synthèse vocale. */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.fil { font-size: .9rem; color: var(--encre-douce); margin: 0 0 .5rem; }
.fil a { color: inherit; }

.etapes { margin: 1.25rem 0; }
.etapes ol {
  display: flex; flex-wrap: wrap; gap: .35rem; list-style: none; padding: 0; margin: 0;
}
.etapes li { flex: 1 1 5.5rem; }
.etapes a {
  display: flex; align-items: center; gap: .45rem; min-height: 44px;
  padding: .4rem .55rem; border: 1px solid var(--ligne); border-radius: var(--r-s);
  background: var(--surface); color: var(--encre-douce); text-decoration: none;
  font-size: .85rem;
}
.etapes a:hover { border-color: var(--marque); }
.etapes .pastille {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.5rem; height: 1.5rem; flex: 0 0 auto; border-radius: 999px;
  background: var(--fond); border: 1px solid var(--ligne); font-size: .8rem; font-weight: 600;
}
.etapes .courante a {
  border-color: var(--marque); background: var(--marque-clair); color: var(--encre);
  font-weight: 600;
}
.etapes .courante .pastille { background: var(--marque); color: var(--sur-marque); border-color: var(--marque); }
.etapes .faite .pastille { background: var(--ok-fond); color: var(--ok); border-color: currentColor; }
/* « À corriger » se voit à la forme de la pastille autant qu'à sa couleur. */
.etapes .a-corriger .pastille {
  background: var(--alerte-fond); color: var(--alerte); border-color: currentColor;
  border-width: 2px;
}
.etapes .a-corriger a { border-color: var(--alerte); }
@media (max-width: 640px) {
  .etapes .nom { display: none; }
  .etapes li { flex: 0 0 auto; }
}

.etape-titre { margin: 1.25rem 0 .25rem; }
.etape-no { font-size: .85rem; font-weight: 400; color: var(--encre-douce); }

.deux-colonnes, .trois-colonnes { display: grid; gap: .75rem; }
@media (min-width: 640px) {
  .deux-colonnes { grid-template-columns: 1fr 1fr; }
  .trois-colonnes { grid-template-columns: repeat(3, 1fr); }
}

fieldset { border: 1px solid var(--ligne); border-radius: var(--r-s); padding: .75rem 1rem; margin: 1rem 0; }
legend { padding: 0 .35rem; font-weight: 600; }
label.radio, label.case {
  display: flex; align-items: flex-start; gap: .5rem; min-height: 44px;
  align-items: center; font-weight: 400; max-width: none;
}
label.radio input, label.case input { width: 1.1rem; height: 1.1rem; flex: 0 0 auto; }

.aide { font-size: .88rem; color: var(--encre-douce); font-weight: 400; display: block; }
.derniere-sauvegarde { margin-top: .75rem; }

/* Un champ calculé n'est pas un champ grisé : c'est une valeur affichée.
   Un `input` désactivé invite à cliquer, puis déçoit. */
.calcule, .champ.calcule output, .valeur.calcule {
  font-variant-numeric: tabular-nums; font-weight: 600; color: var(--encre);
}
.champ.calcule { display: flex; flex-direction: column; justify-content: flex-end; padding-bottom: .5rem; }
.champ.calcule .etiquette { font-size: .9rem; color: var(--encre-douce); font-weight: 400; }
td.calcule, tfoot .calcule { background: var(--fond); }

.table-large { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.effectifs input { width: 100%; min-width: 4rem; }
table.effectifs th[scope="row"] { white-space: nowrap; }

/* Sous 640 px, le tableau des effectifs devient une suite de blocs : sept
   colonnes ne tiennent pas sur un téléphone, et un défilement horizontal fait
   perdre l'en-tête de ligne. */
@media (max-width: 640px) {
  table.effectifs, table.effectifs tbody, table.effectifs tr, table.effectifs td,
  table.effectifs th { display: block; }
  table.effectifs thead { display: none; }
  table.effectifs tr { border: 1px solid var(--ligne); border-radius: var(--r-s);
                       margin-bottom: .6rem; padding: .35rem .6rem; }
  table.effectifs th[scope="row"] { font-size: 1rem; color: var(--encre); padding-left: 0; }
  table.effectifs td { display: flex; align-items: center; gap: .6rem;
                       border-bottom: 0; padding: .3rem 0; }
  table.effectifs td::before {
    content: attr(data-col); flex: 0 0 9rem; font-size: .85rem; color: var(--encre-douce);
  }
}

details.action {
  border: 1px solid var(--ligne); border-radius: var(--r-s);
  padding: .5rem .75rem; margin: .6rem 0; background: var(--surface);
}
details.action > summary { cursor: pointer; font-weight: 600; min-height: 44px;
                           display: flex; align-items: center; gap: .5rem; }
details.action .montant { margin-left: auto; font-variant-numeric: tabular-nums;
                          color: var(--encre-douce); font-weight: 400; }
details.nouvelle { border-style: dashed; }

button.lien {
  background: none; border: 0; padding: .4rem 0; min-height: 44px;
  color: var(--marque); text-decoration: underline; cursor: pointer; font: inherit;
}
button.lien.danger { color: var(--erreur); }

.plan { display: grid; gap: 1.25rem; }
@media (min-width: 760px) { .plan { grid-template-columns: 1fr 1fr; } }
.plan h4 { margin: 0 0 .5rem; }
.plan .lignes { list-style: none; padding: 0; margin: 0; }
.plan .lignes li {
  display: grid; grid-template-columns: 1fr 8rem; gap: .5rem; align-items: center;
  padding: .25rem 0; border-bottom: 1px solid var(--ligne); max-width: none;
}
.plan .lignes label { margin: 0; font-weight: 400; font-size: .92rem; max-width: none; }
.plan .lignes input.montant { text-align: right; font-variant-numeric: tabular-nums; }
.plan .lignes .valeur { text-align: right; }
.plan .lignes .rubrique { background: var(--fond); font-weight: 600; }
.plan .lignes .rubrique .etiquette { font-weight: 600; }
.plan .lignes .auto .aide { grid-column: 1 / -1; margin-top: -.2rem; }
.plan .lignes .nature { opacity: .9; }
.plan .sous-total { text-align: right; margin: .5rem 0 0; }

.equilibre { padding: .5rem .75rem; border-radius: var(--r-s); margin-top: .75rem; }
.equilibre.ok { background: var(--ok-fond); color: var(--ok); }
.equilibre.non { background: var(--alerte-fond); color: var(--alerte); }

.total-etape { font-size: 1.05rem; margin-top: 1rem; }
.recap { background: var(--fond); border-radius: var(--r-s); padding: .75rem 1rem; margin: 1rem 0; }
.recap p { margin: .25rem 0; max-width: none; }

dl.fiche { display: grid; grid-template-columns: max-content 1fr; gap: .3rem .9rem; margin: .5rem 0 1rem; }
dl.fiche dt { color: var(--encre-douce); font-size: .9rem; }
dl.fiche dd { margin: 0; }

ul.declarations { padding-left: 1.2rem; }
ul.declarations li { margin: .3rem 0; }

.depot { border: 2px solid var(--marque); border-radius: var(--r-s);
         padding: 1rem; margin-top: 1rem; background: var(--marque-clair); }
.depot p { margin-top: 0; }

.barre-actions {
  display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.25rem;
  padding-top: 1rem; border-top: 1px solid var(--ligne);
}
.barre-actions button, .barre-actions .bouton { flex: 1 1 10rem; }
@media (min-width: 640px) { .barre-actions button, .barre-actions .bouton { flex: 0 0 auto; } }

a.bouton {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: .55rem 1rem; border-radius: var(--r-s);
  background: var(--marque); color: var(--sur-marque); text-decoration: none; font-weight: 600;
}
a.bouton.secondaire, button.secondaire {
  background: var(--surface); color: var(--encre); border: 1px solid var(--ligne);
}
.sous-form { margin: 0 0 1rem; }

/* Les échanges avec le service, en tête du dossier : c'est ce qu'on attend de
   l'association, elle doit le voir avant de chercher où saisir. */
.echanges { margin: 1.25rem 0; }
.echanges article {
  border-left: 3px solid var(--ligne); padding: .5rem .85rem; margin: .5rem 0;
  background: var(--surface); border-radius: 0 var(--r-s) var(--r-s) 0;
}
.echanges .du-service { border-left-color: var(--marque); background: var(--marque-clair); }
.echanges .qui { font-weight: 600; margin: 0 0 .2rem; font-size: .9rem; }
.echanges .quand { font-weight: 400; color: var(--encre-douce); margin-left: .4rem; }
.echanges article p { margin: 0; max-width: none; }
.echanges .repondre { margin-top: .75rem; }
.echanges .repondre textarea { width: 100%; }
