:root {
  --fond: #fbf8f2;
  --carte: #ffffff;
  --texte: #1f2a2a;
  --doux: #5b6b6b;
  --accent: #2b4c7e;
  --accent-clair: #e8eef8;
  --orange: #c45a1b;        /* bords et fonds seulement */
  --orange-fonce: #9a4310;  /* texte orange : contraste 5,8:1 sur --orange-clair */
  --orange-clair: #fdeee3;
  --rouge: #b3261e;
  --bord: #e6ded2;          /* séparations décoratives */
  --bord-champ: #8f8576;    /* bords des champs : contraste 3,5:1 sur le fond */
  --rayon: 14px;
}
* { box-sizing: border-box; }
html { font-size: 18px; }
body {
  margin: 0; background: var(--fond); color: var(--texte);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.45;
  padding-bottom: 84px;
}
a { color: var(--accent); }
h1 { font-size: 1.45rem; margin: .4rem 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.6rem 0 .6rem; }
h3 { font-size: 1rem; margin: 0 0 .3rem; }
p { margin: .4rem 0; }
.entete {
  display: flex; justify-content: space-between; align-items: center;
  padding: .7rem 16px; background: var(--accent); color: #fff; position: sticky; top: 0; z-index: 5;
}
.marque { color: #fff; font-weight: 700; font-size: 1.2rem; text-decoration: none; }
.marque { min-height: 44px; display: inline-flex; align-items: center; }
/* Sans compte : retour à gauche, « Accueil » à droite. */
.retour, .lien-entete {
  color: #fff; min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
}
.retour { margin-left: -10px; }
.lien-entete { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.retour + .marque { margin-right: auto; }
.cloche {
  color: #fff; text-decoration: none; position: relative;
  min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
}
.pastille {
  position: absolute; top: 2px; right: -2px; background: var(--orange-fonce); color: #fff; font-weight: 700;
  border-radius: 999px; font-size: .7rem; padding: 0 .4rem; border: 1px solid #fff;
}
.icone { width: 24px; height: 24px; flex: none; }
.page { max-width: 640px; margin: 0 auto; padding: 1rem 16px; }
.barre {
  position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: #fff;
  border-top: 1px solid var(--bord); padding-bottom: env(safe-area-inset-bottom); z-index: 5;
}
.barre a {
  flex: 1; text-align: center; padding: .5rem .2rem; font-size: .75rem; color: var(--doux); min-height: 56px;
  text-decoration: none; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.barre a.actif { color: var(--accent); font-weight: 700; }
/* Appli iPhone : pas de menu du site, la barre d'onglets flottante de l'appli le remplace. La page passe
   dessous : on laisse la place de la barre et de la barre d'accueil d'iOS pour la fin de la page. */
body.appli-iphone { padding-bottom: 50px; }
body.appli-iphone[data-menu="1"] { padding-bottom: 110px; }
.carte {
  background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon);
  padding: 1rem; margin: .7rem 0;
}
.carte.urgente { border-color: var(--orange); background: var(--orange-clair); }
.carte.info { background: var(--accent-clair); border-color: #c9d6ea; }
.carte.alerte { background: var(--orange-clair); border-color: #f2c6a8; }
.doux { color: var(--doux); font-size: .9rem; }
.etiquette {
  display: inline-block; font-size: .75rem; padding: .1rem .5rem; border-radius: 999px;
  background: var(--accent-clair); color: var(--accent); margin-right: .3rem;
}
.etiquette.orange { background: var(--orange-clair); color: var(--orange-fonce); font-weight: 600; }
.carte.urgente .etiquette.orange { background: #fff; }
.etiquette.fictif { background: #fff3c4; color: #7a5b00; }
.bouton, button {
  display: inline-block; border: 0; border-radius: 12px; padding: .8rem 1.1rem; font-size: 1rem;
  background: var(--accent); color: #fff; text-decoration: none; cursor: pointer; font-family: inherit;
  min-height: 48px;
}
.bouton.large, button.large { display: block; width: 100%; text-align: center; margin: .6rem 0; }
.bouton.secondaire, button.secondaire { background: #fff; color: var(--accent); border: 2px solid var(--accent); }
.bouton.danger, button.danger { background: var(--rouge); }
button.lien {
  background: none; color: var(--doux); padding: .6rem .4rem; min-height: 44px; text-decoration: underline;
  font-size: .9rem; display: inline-flex; align-items: center;
}
/* Liens dans une phrase : ils restent dans la ligne (pas de flex, pas de marge sur les côtés). Le
   remplissage vertical agrandit la zone à toucher sans changer la hauteur de la ligne. */
:where(.page p) a:not(.bouton) { padding: .4em 0; }
/* Liens d'action seuls sur leur ligne : au moins 44 px de haut. */
.lien-action > a, .carte > a:not(.bouton):not(.carte), .ligne > a:not(.bouton):not(.carte),
.actions > a, .actions-message a, details > summary, .filtres a {
  min-height: 44px; display: inline-flex; align-items: center;
}
.lien-action > a, .ligne > a:not(.bouton):not(.carte), .actions > a:not(.bouton) { padding: 0 .2rem; }
.lien-action { margin: .2rem 0; }
.lien-action.danger > a { color: var(--rouge); }
details > summary { cursor: pointer; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; }
/* Actions d'une carte (Mes enfants) : toutes du même style, alignées à gauche, une colonne si besoin. */
.actions-carte { flex-direction: column; align-items: flex-start; gap: 0; margin-top: .3rem; }
.actions-carte > a, .actions-carte button.lien {
  color: var(--accent); font-size: .95rem; padding: .5rem 0; min-height: 44px; text-decoration: underline;
  text-align: left; display: inline-flex; align-items: center;
}
form p, .champ { margin: .8rem 0; }
label, legend { display: block; font-weight: 600; margin-bottom: .25rem; }
fieldset { border: 0; padding: 0; margin: .8rem 0; min-width: 0; }
legend { padding: 0; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date],
input[type=time], input[type=search], input[type=tel], select, textarea {
  width: 100%; font-size: 1rem; padding: .7rem; border: 1px solid var(--bord-champ); border-radius: 10px; background: #fff;
  font-family: inherit;
}
/* Champ photo : même largeur et même police que les autres champs, bouton comme les boutons secondaires. */
input[type=file] { display: block; width: 100%; max-width: 100%; font-size: 1rem; font-family: inherit; color: var(--texte); }
input[type=file]::file-selector-button {
  font-family: inherit; font-size: 1rem; min-height: 48px; padding: .6rem 1rem; margin-right: .8rem;
  background: #fff; color: var(--accent); border: 2px solid var(--accent); border-radius: 12px; cursor: pointer;
}
input[type=checkbox], input[type=radio] { width: 1.3rem; height: 1.3rem; flex: none; margin: 0; accent-color: var(--accent); }
ul.choix, form ul { list-style: none; padding: 0; margin: 0; }
/* Choix à cocher : un choix par ligne, texte normal, toute la ligne se touche (44 px au moins).
   Django 5 range les choix dans des <div> (plus des <ul>) : on vise les deux. */
fieldset label, div[id^="id_"] > div > label, form ul li label, ul.choix label,
label:has(> input[type=checkbox]), label:has(> input[type=radio]) {
  font-weight: 400; display: flex; align-items: center; gap: .6rem; min-height: 44px; padding: .3rem 0; margin: 0;
}
fieldset > div > div + div, div[id^="id_"] > div + div { border-top: 1px solid var(--bord); }
/* Texte lu par les lecteurs d'écran seulement (étiquette d'un champ dont le sens se voit déjà). */
.lecteur-seulement {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.helptext { display: block; color: var(--doux); font-size: .85rem; }
.errorlist { color: var(--rouge); padding: 0; list-style: none; font-size: .9rem; }
.message { padding: .8rem 1rem; border-radius: 10px; background: var(--accent-clair); }
.message.error { background: #fde8e7; color: var(--rouge); }
.message.warning, .message.info { background: var(--orange-clair); }
.carte-lien { display: block; text-decoration: none; color: inherit; }
.carte-lien.ligne { display: flex; }
.extensible { flex: 1; }
/* Pas de vide au-dessus du premier élément d'un encadré, ni sous le dernier. */
.carte > :first-child { margin-top: 0; }
.carte > :last-child { margin-bottom: 0; }
.carte-titre { display: block; }
.carte-lien:hover .carte-titre, .carte-lien:focus .carte-titre { text-decoration: underline; }
.carte.nouvelle { border-color: var(--accent); border-width: 2px; }
.photo { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; background: var(--accent-clair); }
.photo.grande { width: 140px; height: 140px; }
.ligne { display: flex; gap: .8rem; align-items: center; }
.filtres { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .3rem; }
.filtres a { white-space: nowrap; padding: .4rem .8rem; border-radius: 999px; border: 1px solid var(--bord); text-decoration: none; color: var(--texte); background: #fff; }
.filtres a.actif { background: var(--accent); color: #fff; border-color: var(--accent); }
.fil { max-height: 360px; overflow-y: auto; }
.bulle { background: #f4efe7; border-radius: 12px; padding: .5rem .8rem; margin: .4rem 0; }
.bulle.moi { background: var(--accent-clair); margin-left: 2rem; }
.resultats { border: 1px solid var(--bord); border-radius: 10px; margin-top: .4rem; background: #fff; }
.resultats .vide, .resultats .message { padding: .6rem; margin: 0; }
.resultats button { display: block; width: 100%; text-align: left; background: #fff; color: var(--texte); border-bottom: 1px solid var(--bord); border-radius: 0; }
.code { font-family: ui-monospace, monospace; font-size: 1.3rem; letter-spacing: .1em; background: #fff; padding: .2rem .6rem; border-radius: 8px; border: 1px dashed var(--accent); }
.mention { font-size: .85rem; background: #fff3c4; padding: .6rem .8rem; border-radius: 10px; }
table { width: 100%; border-collapse: collapse; }
td, th { padding: .4rem; border-bottom: 1px solid var(--bord); text-align: left; }

/* Autorisation à montrer à l'école */
.autorisation h1 { font-size: 1.6rem; line-height: 1.25; }
@media print {
  .entete, .barre, .page > p { display: none; }
  .autorisation { border: 2px solid #000; }
}

.actions-message form { display: inline; }
.actions-message a, .actions-message button { font-size: .85rem; }
details.gerer form { display: block; }
/* Pied de page légal (legal/_pied.html) : liens assez grands pour le doigt. Une liste avec un écart
   plutôt que des « · » : sur un téléphone, aucun séparateur ne reste seul en bout de ligne. */
.pied-legal { text-align: center; font-size: .85rem; margin: 2rem 0 1rem; }
.pied-legal ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 0 1rem; }
.pied-legal a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 .2rem; }
/* Texte qui ne se coupe pas en fin de ligne (numéro de téléphone…). */
.insecable { white-space: nowrap; }
/* « Je ne peux plus venir » : un bouton qui déplie le formulaire. */
summary.bouton { list-style: none; display: inline-flex; align-items: center; justify-content: center; margin: .3rem 0; }
summary.bouton::-webkit-details-marker { display: none; }
summary.bouton.large { display: flex; width: 100%; }
/* Action dépliable (« Créer un cercle »…) : un bouton, et le formulaire dans un encadré dessous. */
details.action-depliable { margin: .6rem 0; }
details.action-depliable > .carte { margin-top: .4rem; }
/* Lien d'invitation : affiché entier, coupé proprement, sélectionnable. */
input.lien-invitation { width: 100%; font-family: ui-monospace, monospace; font-size: .85rem; color: var(--texte); background: #f7f3ec; }
.flexible { flex: 1; }
.texte-normal { font-weight: 400; }
.barre-texte { text-decoration: line-through; color: var(--doux); }
.marge-fine { margin: .4rem 0; }
/* Sommaire des pages légales. */
.sommaire { margin: .6rem 0 1.2rem; }
.sommaire ol { margin: .3rem 0 0; padding-left: 1.4rem; }
.sommaire li a { display: inline-block; padding: .35rem 0; }
:target { scroll-margin-top: 80px; }
/* « Me déconnecter » (comptes/_deconnexion.html) : un vrai bouton, pas un lien discret. */
form[data-deconnexion] button.lien {
  background: #fff; color: var(--accent); border: 2px solid var(--accent); padding: .8rem 1.1rem;
  min-height: 48px; text-decoration: none; font-size: 1rem; margin: .6rem 0;
}
[hidden] { display: none !important; }

/* QR codes (lien de l'école, rencontre) : noir sur blanc dans tous les thèmes. */
.centre { text-align: center; }
.qr { display: block; width: 100%; max-width: 15rem; height: auto; margin: 0 auto .6rem; }
.code.code-rencontre { display: inline-block; font-size: 2rem; letter-spacing: .25em; font-weight: 700; margin: .2rem 0; }

/* Affiche à imprimer (une page A4). */
.affiche { text-align: center; max-width: 34rem; margin: 0 auto; }
.affiche h1 { font-size: 2.2rem; margin: .4rem 0 1rem; }
.affiche ul { text-align: left; font-size: 1.15rem; line-height: 1.5; }
.affiche-ecole { font-weight: 600; color: var(--accent); }
.affiche-public { font-size: 1.2rem; margin: 0 0 1rem; }
.affiche-qr .qr { max-width: 18rem; }
.affiche-nom { font-size: 1.6rem; font-weight: 700; color: var(--accent); margin: .2rem 0; }
@media print {
  .entete, .barre, .sans-impression, .message, .pied-legal { display: none !important; }
  body, .page { background: #fff !important; padding: 0 !important; margin: 0 !important; }
  .affiche { max-width: none; }
  @page { size: A4; margin: 18mm; }
}

/* Premiers pas */
.or { color: #8a6a1f; }
.accroche { text-align: center; padding: 1.2rem 0 .6rem; }
.accroche h1 { font-size: 1.75rem; line-height: 1.2; }
.accroche p { font-size: 1.05rem; }
.trois { display: grid; gap: .6rem; }
.trois .carte h2 { margin-top: 0; font-size: 1.05rem; }
.etapes { counter-reset: e; list-style: none; padding: 0; }
.etapes li { counter-increment: e; position: relative; padding-left: 2.4rem; margin: .8rem 0; }
.etapes li::before {
  content: counter(e); position: absolute; left: 0; top: 0; width: 1.8rem; height: 1.8rem; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.progression { display: flex; gap: .3rem; margin: .5rem 0; }
.progression span { flex: 1; height: 8px; border-radius: 4px; background: var(--bord); }
.progression span.fait { background: var(--accent); }
.rdv { border-left: 4px solid var(--accent); }
.texte-long h2 { margin-top: 1.4rem; }
.texte-long li { margin: .3rem 0; }
.priere { font-style: italic; background: #fff; border-left: 3px solid #c9a227; padding: .6rem 1rem; border-radius: 6px; }
.messages-fil { max-height: 420px; overflow-y: auto; }
.bulle .auteur { font-size: .8rem; color: var(--doux); }
.bulle { overflow-wrap: anywhere; }
.texte-message { white-space: pre-line; }
.fiche-dl dt { font-weight: 600; margin-top: .6rem; }
.fiche-dl dd { margin: 0; }

/* « Pour les paroisses » : se lit à l'écran, s'imprime sur deux pages A4 pour le curé. */
.chapeau { font-size: 1.1rem; }
@media print {
  .fiche-paroisse { font-size: 11pt; }
  .fiche-paroisse h2 { margin-top: 1rem; break-after: avoid; }
  .fiche-paroisse a { color: inherit; text-decoration: none; }
}
/* Affiche imprimée : lisible à deux mètres, sur une seule page A4. */
@media print {
  .affiche { font-size: 17pt; }
  .affiche-nom { font-size: 22pt; }
  .affiche-ecole { font-size: 16pt; }
  .affiche h1 { font-size: 36pt; line-height: 1.12; }
  .affiche-public { font-size: 19pt; }
  .affiche ul { font-size: 17pt; }
  .affiche-qr .qr { width: 9cm; max-width: 9cm; }
  .affiche .doux { font-size: 12pt; }
}
