/* EcoleConnect — charte D9 : vert sauge + pêche */
:root {
  --fond: #CFE6D6;
  --carte: #FFFFFF;
  --encre: #1E2A3B;
  --encre-douce: #3A4657;
  --gris: #5B6779;
  --bordure: #D5DCE7;
  --vert-bouton: #7DB898;
  --vert-bouton-texte: #143D2B;
  --vert: #3A8462;
  --vert-fonce: #1F5A40;
  --vert-clair: #E2F0E7;
  --peche: #E39478;
  --peche-clair: #FCDCCB;
  --peche-texte: #7A3420;
  --jaune-clair: #FFF3D1;
  --jaune-texte: #7A5A00;
  --bleu-clair: #E4ECFB;
  --bleu-texte: #2B5FC2;
  --violet-clair: #EEE8FA;
  --violet-texte: #6847B8;
  --gris-clair: #EDF0F5;
  --ombre: 0 1px 3px rgba(30, 42, 59, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fond); color: var(--encre);
  font-family: Nunito, system-ui, sans-serif; -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; }
#app { max-width: 480px; margin: 0 auto; padding: 20px 20px 110px; display: flex; flex-direction: column; gap: 18px; }
h1 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -.3px; }
h2 { margin: 0; font-size: 17px; font-weight: 800; }
p { margin: 0; line-height: 1.45; }
a { color: var(--vert-fonce); }
button { font-family: inherit; }
.muted { color: var(--gris); font-size: 14px; }
.ecran-centre { min-height: 60vh; display: flex; flex-direction: column; justify-content: center; gap: 16px; }

/* En-tête */
.entete { display: flex; justify-content: space-between; align-items: center; }
.marque { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.marque img { width: 62px; height: 64px; object-fit: contain; }
.marque span { font-family: 'Baloo 2', Nunito, sans-serif; font-weight: 800; font-size: 25px; line-height: 1; color: var(--peche); }
.marque span b { color: #3F8F67; font-weight: 800; }
.marque span i { font-style: normal; color: #1F5A40; font-weight: 800; }
@media (max-width: 400px) { .marque { gap: 6px; } .marque img { width: 48px; height: 50px; } .marque span { font-size: 20px; } }
.cloche { position: relative; width: 44px; height: 44px; border-radius: 14px; border: 0; background: var(--carte);
  box-shadow: var(--ombre); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.cloche .pastille { position: absolute; top: 6px; right: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: #E5634B; color: #fff; font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.bonjour { font-family: Caveat, cursive; font-size: 42px; font-weight: 700; line-height: 1; }

/* Cartes */
.carte { background: var(--carte); border-radius: 20px; padding: 16px; box-shadow: var(--ombre);
  display: flex; flex-direction: column; gap: 10px; }
a.carte { text-decoration: none; color: var(--encre); }
.ligne { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.titre-carte { font-size: 18px; font-weight: 800; }
.section-titre { display: flex; align-items: center; gap: 8px; }
.puce { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* Etiquettes */
.etiquettes { display: flex; gap: 8px; flex-wrap: wrap; }
.enfant { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px 5px 9px; border-radius: 999px;
  background: var(--peche-clair); color: var(--peche-texte); font-weight: 800; font-size: 14px; }
.enfant::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--peche); }
.enfant.petit { font-size: 13px; padding: 3px 9px 3px 8px; }
.badge { font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 8px; align-self: flex-start; }
.badge.ecole { background: var(--bleu-clair); color: var(--bleu-texte); }
.badge.association { background: var(--violet-clair); color: var(--violet-texte); }
.statut { font-size: 13px; font-weight: 800; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.statut.a-faire { background: var(--jaune-clair); color: var(--jaune-texte); }
.statut.paye { background: var(--vert-clair); color: var(--vert-fonce); }
.statut.neutre { background: var(--gris-clair); color: #4A5566; }
.statut.encours { background: var(--bleu-clair); color: var(--bleu-texte); }

/* Boutons */
.bouton { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 0 20px;
  border-radius: 14px; border: 0; background: var(--vert-bouton); color: var(--vert-bouton-texte); font-weight: 800;
  font-size: 16px; text-decoration: none; cursor: pointer; }
.bouton.large { width: 100%; min-height: 56px; font-size: 17px; }
.bouton.secondaire { background: var(--carte); color: var(--encre); border: 1.5px solid var(--bordure); font-weight: 700; }
.bouton:disabled { opacity: .55; cursor: not-allowed; }
.lien-bouton { background: none; border: 0; padding: 8px 0; color: var(--vert-fonce); font-weight: 700; font-size: 15px;
  text-decoration: underline; cursor: pointer; align-self: flex-start; }
.retour { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; font-weight: 800; color: var(--vert-fonce); text-decoration: none; }

/* Formulaires */
label { font-weight: 700; font-size: 15px; }
.champ { width: 100%; min-height: 52px; border-radius: 14px; border: 1.5px solid var(--bordure); padding: 0 14px;
  font-size: 18px; font-family: inherit; background: #fff; color: var(--encre); }
.champ:focus { outline: 3px solid var(--vert-bouton); outline-offset: 1px; }
.code { letter-spacing: 8px; text-align: center; font-size: 26px; font-weight: 800; }
.erreur { color: #A32D2D; font-weight: 700; font-size: 14px; }
.info { background: var(--vert-clair); color: var(--vert-fonce); border-radius: 14px; padding: 12px 14px; font-size: 14px; line-height: 1.45; }

/* Filtres et choix */
.filtres { display: flex; gap: 8px; flex-wrap: wrap; }
.filtre { min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--bordure); background: #fff;
  color: var(--encre); font-weight: 700; font-size: 14px; cursor: pointer; }
.filtre[aria-pressed="true"] { background: var(--vert-bouton); border-color: var(--vert-bouton); color: var(--vert-bouton-texte); font-weight: 800; }
.segments { display: flex; gap: 4px; background: #F0F3F8; border-radius: 14px; padding: 4px; }
.segments button { flex: 1; min-height: 44px; border-radius: 12px; border: 0; background: transparent; font-weight: 700;
  font-size: 13px; color: var(--encre-douce); padding: 0 4px; cursor: pointer; }
.segments button[aria-pressed="true"] { background: #fff; color: var(--vert-fonce); font-weight: 800; box-shadow: 0 1px 2px rgba(30,42,59,.12); }
.segments button:disabled { cursor: not-allowed; }
.pas { display: flex; align-items: center; gap: 10px; }
.pas button { width: 44px; height: 44px; border-radius: 12px; border: 1.5px solid var(--bordure); background: #fff;
  font-size: 22px; font-weight: 700; cursor: pointer; color: var(--encre); }
.pas button.plus { background: var(--vert-clair); border-color: var(--vert-clair); color: var(--vert-fonce); }
.pas span { font-size: 18px; font-weight: 800; min-width: 20px; text-align: center; }
.choix-enfant { flex: 1; min-height: 48px; border-radius: 14px; border: 2px solid #E3E8F0; background: #fff;
  color: var(--vert-fonce); font-weight: 800; font-size: 15px; cursor: pointer; }
.choix-enfant[aria-pressed="true"] { border-color: var(--vert); background: var(--vert-clair); }
.recap { background-image: repeating-linear-gradient(#fff 0 27px, #E6F2EA 27px 28px); }
.total { border-top: 2px dashed var(--bordure); padding-top: 10px; }

/* Onglets du bas : barre vert foncé bien visible, onglet actif en pastille blanche */
.onglets { position: fixed; left: 0; right: 0; bottom: 0; background: #2F6E4F; border-radius: 22px 22px 0 0;
  box-shadow: 0 -6px 20px rgba(20, 61, 43, .22); display: flex; justify-content: space-around; gap: 4px;
  padding: 8px 8px calc(12px + env(safe-area-inset-bottom)); z-index: 10; }
.onglets a { flex: 1; max-width: 120px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 13px; font-weight: 800; color: #E2F0E7; text-decoration: none; padding: 8px 4px; border-radius: 16px; }
.onglets a span.icone { display: flex; }
.onglets a:hover { background: rgba(255, 255, 255, .10); }
.onglets a[aria-current="page"] { background: #fff; color: #1F5A40; box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }
.onglets a:focus-visible { outline: 3px solid #FCDCCB; outline-offset: 2px; }
.onglets svg { width: 26px; height: 26px; }

/* Images (D21) et questions oui/non (D20) */
.image-activite { width: 100%; max-height: 220px; object-fit: cover; border-radius: 18px; box-shadow: var(--ombre); background: #fff; }
.vignette { width: 56px; height: 56px; object-fit: cover; border-radius: 12px; flex: none; background: #F0F3F8; }
.questions { display: flex; flex-direction: column; gap: 10px; border-top: 1px dashed #DCE3EA; padding-top: 10px; }
.question p { font-weight: 700; margin: 0 0 6px; }
.segments.petit button { min-height: 40px; }
.depot-image { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.depot-image input[type=file] { font-size: 14px; max-width: 100%; }

/* Récapitulatif et tickets imprimables (D23) */
.feuille, .tickets { background: #fff; border-radius: 18px; padding: 16px; box-shadow: var(--ombre); }
.recap-impression table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 14px; }
.recap-impression th, .recap-impression td { border-bottom: 1px solid #E2E8EE; padding: 6px 8px; text-align: left; vertical-align: top; }
.tickets { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.ticket { border: 3px solid #3F8F67; border-radius: 0; padding: 8px 10px; display: flex; align-items: center; gap: 10px;
  min-height: 30mm; background: #E8F3EC; break-inside: avoid; page-break-inside: avoid; overflow: hidden; }
.ticket-logo { width: 15mm; height: 15mm; object-fit: contain; flex: none; }
.ticket-texte { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
.ticket-produit { font-family: 'Baloo 2', Nunito, sans-serif; font-weight: 800; font-size: 21px; line-height: 1.05; color: #3F8F67; }
.ticket-eleve { font-weight: 800; font-size: 15px; line-height: 1.15; color: #143D2B; }
.ticket-classe { font-weight: 800; font-size: 12px; color: #7A3420; background: #FCDCCB; border-radius: 999px; padding: 1px 10px; }
@media print {
  @page { size: A4; margin: 10mm; }
  html, body { background: #fff !important; }
  #onglets, .non-imprime { display: none !important; }
  #app { padding: 0 !important; max-width: none !important; gap: 0 !important; }
  .feuille, .tickets { box-shadow: none; border-radius: 0; padding: 0; }
  .recap-impression { break-after: page; page-break-after: always; }
  .tickets { grid-template-columns: repeat(3, 1fr); column-gap: 6mm; row-gap: 6mm; }
  .ticket { height: 32mm; min-height: 0; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.evenement { font-weight: 700; color: #1F5A40; margin: 0; }
.evenement:first-letter { text-transform: uppercase; }
.tickets-classe { margin: 18px 0 8px; }
@media print { .tickets-classe { margin: 0 0 4mm; font-size: 14pt; } .nouvelle-page { break-before: page; page-break-before: always; } }

/* Espace gestion (D28) */
.tableau-paiements { width: 100%; border-collapse: collapse; font-size: 14px; }
.tableau-paiements th, .tableau-paiements td { text-align: left; padding: 8px 6px; border-bottom: 1px solid #EDF0F5; vertical-align: top; }
.tableau-paiements td.montant, .tableau-paiements th.montant { text-align: right; white-space: nowrap; }
.chiffres { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.chiffres b { display: block; font-size: 22px; color: #1F5A40; }

/* Choix du type d'activité : sortie (vert) ou vente (pêche) */
.choix-type { display: flex; flex-direction: column; gap: 14px; }
.carte-type { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; width: 100%;
  padding: 18px; border-radius: 18px; border: 3px solid transparent; background: #fff; box-shadow: var(--ombre);
  font: inherit; color: #1E2A3B; cursor: pointer; }
.carte-type b { font-size: 20px; }
.carte-type .exemple { font-size: 14px; color: #5A6878; }
.carte-type.sortie { border-color: #7DB898; } .carte-type.sortie .type-icone { color: #3F8F67; }
.carte-type.vente { border-color: #E39478; } .carte-type.vente .type-icone { color: #C9714F; }
.carte-type:focus-visible { outline: 3px solid #143D2B; outline-offset: 2px; }
.type-choisi { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; }
.type-choisi.sortie { background: #E2F0E7; color: #143D2B; } .type-choisi.vente { background: #FCDCCB; color: #7A3420; }
.type-choisi > div { flex: 1; } .type-choisi span { font-size: 14px; }
.carte-type.compte-ecole { border-color: #8FB3E8; } .carte-type.compte-association { border-color: #B9A2E3; }
.benef-choisi { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; font-size: 16px; }
.benef-choisi > div { flex: 1; }
.benef-choisi.ecole { background: var(--bleu-clair); color: var(--bleu-texte); }
.benef-choisi.association { background: var(--violet-clair); color: var(--violet-texte); }
.publication { border: 3px solid #7DB898; }

/* Elèves et parents (D34) */
.classe-eleves summary { cursor: pointer; font-size: 17px; }
.ligne-eleve { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0;
  border-top: 1px solid #EDF0F5; color: inherit; text-decoration: none; }
.adresses { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; font-size: 13px; }
.adresses span::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.adresses .connecte { color: #1F5A40; } .adresses .connecte::before { background: #3F8F67; }
.adresses .pas-connecte { color: #5A6878; } .adresses .pas-connecte::before { background: #B8C2D0; }
.adresses .sans-adresse { color: #A0402A; } .adresses .sans-adresse::before { background: #E39478; }
.pastille-legende { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: 1px; }
.pastille-legende.connecte { background: #3F8F67; } .pastille-legende.pas-connecte { background: #B8C2D0; }
.pastille-legende.partiel { background: #E0A23A; }
.connexion-parent { display: block; font-size: 13px; color: #5B6577; margin-top: 2px; }

/* Sélecteur d'espace (parent / enseignant / gestion), tout en haut */
.selecteur-espace { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #2F6E4F; color: #fff;
  border-radius: 18px; padding: 8px 8px 8px 16px; box-shadow: 0 4px 14px rgba(20, 61, 43, .2); }
.selecteur-titre { font-weight: 800; font-size: 14px; color: #E2F0E7; }
.selecteur-choix { display: flex; gap: 6px; flex: 1; }
.selecteur-choix button { flex: 1; min-height: 42px; border: 0; border-radius: 12px; background: rgba(255, 255, 255, .14);
  color: #fff; font: inherit; font-weight: 800; font-size: 15px; cursor: pointer; }
.selecteur-choix button:hover { background: rgba(255, 255, 255, .24); }
.selecteur-choix button[aria-pressed="true"] { background: #FCDCCB; color: #7A3420; box-shadow: 0 2px 6px rgba(0, 0, 0, .15); }
.selecteur-choix button:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
