/* Stand de tir — planning partagé */
:root {
  --bleu: #000091;
  --bleu-clair: #E3E3FD;
  --rouge: #E1000F;
  --rouge-clair: #FDE5E6;
  --vert: #18753C;
  --vert-clair: #E3F4E8;
  --fond: #F4F5FA;
  --carte: #FFFFFF;
  --encre: #161622;
  --gris: #62627A;
  --trait: #DCDDE8;
  --ferme: #E3E4EC;
  --ferme-texte: #9C9CB0;
  --titre: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --texte: "Barlow", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --liseré: linear-gradient(90deg, var(--bleu) 0 33.33%, #fff 33.33% 66.66%, var(--rouge) 66.66% 100%);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--texte);
  font-size: 16px;
  line-height: 1.45;
  color: var(--encre);
  background: var(--fond) url("../img/motif.svg") repeat;
  background-size: 220px;
  background-attachment: fixed;
  padding-top: env(safe-area-inset-top, 0px);
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--bleu); outline-offset: 2px; border-radius: 4px; }

/* Liseré tricolore en haut de l'écran */
.lisere {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  height: calc(6px + env(safe-area-inset-top, 0px));
  background: var(--liseré);
  box-shadow: 0 1px 0 var(--trait);
}

/* ---------- Connexion ---------- */
.login-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 32px 18px; }
.login {
  width: 100%; max-width: 380px; background: var(--carte);
  border: 1px solid var(--trait); border-radius: 6px; overflow: hidden;
  box-shadow: 0 18px 40px -24px rgba(0, 0, 145, .35);
}
.login::before { content: ""; display: block; height: 6px; background: var(--liseré); border-bottom: 1px solid var(--trait); }
.login-body { padding: 30px 26px 26px; }
.login .cible { width: 52px; height: 52px; display: block; margin-bottom: 14px; }
.login h1 { font-family: var(--titre); font-weight: 700; font-size: 2.3rem; line-height: 1; margin: 0; letter-spacing: .01em; color: var(--bleu); }
.login p.sous { margin: 6px 0 24px; color: var(--gris); }
.champ { display: block; margin-bottom: 16px; }
.champ span { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.champ input, .champ textarea {
  width: 100%; padding: 12px 13px; border: 1px solid #B9BACB; border-radius: 4px;
  background: #fff; font-size: 16px; box-shadow: inset 0 -2px 0 var(--bleu-clair);
}
.champ input:focus, .champ textarea:focus { outline: none; border-color: var(--bleu); box-shadow: inset 0 -2px 0 var(--bleu); }
.champ textarea { resize: vertical; min-height: 70px; }
.erreur { color: var(--rouge); font-weight: 600; font-size: .93rem; min-height: 1.3em; margin: 4px 0 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 4px; padding: 11px 18px;
  font-weight: 600; font-size: 1rem; background: #fff; color: var(--bleu); border-color: var(--bleu);
}
.btn-plein { background: var(--bleu); color: #fff; }
.btn-plein:hover { background: #1212FF; }
.btn-large { width: 100%; padding: 13px 18px; }
.btn-danger { color: var(--rouge); border-color: var(--rouge); }
.btn-lien { border: 0; background: none; padding: 6px 2px; color: var(--bleu); text-decoration: underline; text-underline-offset: 3px; font-weight: 500; }
.btn[disabled] { opacity: .55; cursor: default; }

/* ---------- En-tête de l'application ---------- */
.entete {
  position: sticky; top: calc(6px + env(safe-area-inset-top, 0px)); z-index: 20;
  background: rgba(255, 255, 255, .97); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--trait);
}
.entete-in { max-width: 720px; margin: 0 auto; padding: 12px 16px 10px; display: flex; align-items: center; gap: 12px; }
.entete .cible { width: 34px; height: 34px; flex: none; }
.entete h1 { font-family: var(--titre); font-weight: 700; font-size: 1.6rem; line-height: 1; margin: 0; color: var(--bleu); flex: 1; }
.entete h1 small { display: block; font-family: var(--texte); font-weight: 500; font-size: .8rem; color: var(--gris); margin-top: 3px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--bleu); background: #fff;
  font-family: var(--titre); font-weight: 700; font-size: 1.1rem; color: var(--bleu);
}
.onglets { max-width: 720px; margin: 0 auto; padding: 0 16px; display: flex; gap: 22px; }
.onglets button {
  border: 0; background: none; padding: 8px 0 10px; font-weight: 600; color: var(--gris);
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.onglets button[aria-selected="true"] { color: var(--bleu); border-bottom-color: var(--bleu); }

main { max-width: 720px; margin: 0 auto; padding: 18px 16px calc(110px + env(safe-area-inset-bottom, 0px)); }

/* ---------- Agenda ---------- */
.mois-titre {
  font-family: var(--titre); font-weight: 600; font-size: 1.25rem; color: var(--encre);
  margin: 22px 0 10px; display: flex; align-items: center; gap: 10px;
}
.mois-titre::after { content: ""; flex: 1; height: 1px; background: var(--trait); }
.mois-titre:first-child { margin-top: 4px; }

.seance {
  position: relative; display: grid; grid-template-columns: 64px 1fr; gap: 0 14px;
  background: var(--carte); border: 1px solid var(--trait); border-radius: 6px;
  padding: 14px 14px 14px 18px; margin-bottom: 12px; overflow: hidden;
}
/* Bord gauche : gris = en attente, tricolore = confirmée par les deux */
.seance::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--trait); }
.seance.confirmee::before { background: linear-gradient(180deg, var(--bleu) 0 33.33%, #fff 33.33% 66.66%, var(--rouge) 66.66% 100%); box-shadow: 1px 0 0 var(--trait); }
.seance.annulee::before { background: var(--rouge-clair); }
.seance.passee { opacity: .72; }
.seance.flash { animation: flash 1.2s ease-out; }
@keyframes flash { from { box-shadow: 0 0 0 3px var(--bleu); } to { box-shadow: 0 0 0 0 transparent; } }

.date-bloc { text-align: center; padding-top: 2px; }
.date-bloc .jour-sem { font-size: .82rem; font-weight: 600; color: var(--gris); text-transform: capitalize; }
.date-bloc .num { font-family: var(--titre); font-weight: 700; font-size: 2.35rem; line-height: .95; color: var(--bleu); }
.date-bloc .mois { font-size: .8rem; color: var(--gris); }
.date-bloc .auj { display: inline-block; margin-top: 4px; font-size: .72rem; font-weight: 700; color: #fff; background: var(--rouge); padding: 1px 6px; border-radius: 3px; }

.seance-info { min-width: 0; }
.horaire { font-family: var(--titre); font-weight: 600; font-size: 1.35rem; line-height: 1.1; }
.statut { font-size: .85rem; font-weight: 600; margin-left: 6px; font-family: var(--texte); display: inline-block; white-space: nowrap; }
.statut.ok { color: var(--vert); }
.statut.attente { color: var(--gris); }
.statut.ko { color: var(--rouge); }
.lieu { color: var(--encre); margin-top: 2px; overflow-wrap: anywhere; }
.note { color: var(--gris); font-size: .93rem; margin-top: 4px; white-space: pre-line; overflow-wrap: anywhere; }

.reponses { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.rep { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; padding: 3px 9px 3px 4px; border-radius: 999px; background: #F0F0F6; }
.rep i { font-style: normal; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: .75rem; font-weight: 700; background: #fff; color: var(--gris); border: 1px solid var(--trait); }
.rep.yes { background: var(--vert-clair); } .rep.yes i { background: var(--vert); color: #fff; border-color: var(--vert); }
.rep.no { background: var(--rouge-clair); } .rep.no i { background: var(--rouge); color: #fff; border-color: var(--rouge); }
.rep.maybe { background: #FFF3D6; } .rep.maybe i { background: #B34000; color: #fff; border-color: #B34000; }

.actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--trait); }
.choix { display: inline-flex; border: 1px solid #B9BACB; border-radius: 4px; overflow: hidden; }
.choix button { border: 0; background: #fff; padding: 8px 12px; font-weight: 600; font-size: .92rem; color: var(--encre); }
.choix button + button { border-left: 1px solid #B9BACB; }
.choix button[aria-pressed="true"].yes { background: var(--vert); color: #fff; }
.choix button[aria-pressed="true"].maybe { background: #B34000; color: #fff; }
.choix button[aria-pressed="true"].no { background: var(--rouge); color: #fff; }
.actions .plus { margin-left: auto; display: flex; gap: 4px; }
.icone-btn { border: 1px solid transparent; background: none; border-radius: 4px; padding: 7px 9px; color: var(--gris); font-weight: 600; font-size: .9rem; }
.icone-btn:hover { background: #F0F0F6; color: var(--bleu); }

.vide { text-align: center; padding: 48px 18px; background: rgba(255,255,255,.85); border: 1px dashed #B9BACB; border-radius: 6px; }
.vide h2 { font-family: var(--titre); font-size: 1.5rem; margin: 10px 0 4px; color: var(--bleu); }
.vide p { color: var(--gris); margin: 0 0 18px; }
.passees-lien { display: block; margin: 18px auto 0; }

/* ---------- Vue mois ---------- */
.cal { background: var(--carte); border: 1px solid var(--trait); border-radius: 6px; padding: 12px; }
.cal-tete { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cal-tete h2 { font-family: var(--titre); font-weight: 700; font-size: 1.45rem; margin: 0; text-transform: capitalize; color: var(--bleu); }
.cal-tete button { border: 1px solid var(--trait); background: #fff; border-radius: 4px; width: 38px; height: 38px; font-size: 1.1rem; color: var(--bleu); }
.cal-grille { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-grille .js { text-align: center; font-size: .75rem; font-weight: 600; color: var(--gris); padding: 4px 0; }
.cal-jour {
  position: relative; aspect-ratio: 1 / 1; min-height: 40px; border: 1px solid transparent; border-radius: 4px;
  background: #F7F7FB; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 6px;
  font-weight: 600; font-size: .95rem;
}
.cal-jour.hors { background: transparent; color: #B0B0C0; }
.cal-jour.aujourdhui { border-color: var(--rouge); }
.cal-jour[aria-pressed="true"] { background: var(--bleu); color: #fff; }
.cal-jour .points { display: flex; gap: 3px; margin-top: auto; margin-bottom: 7px; }
.cal-jour .pt { width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--bleu); }
.cal-jour .pt.ok { background: var(--bleu); }
.cal-jour .pt.ko, .legende .pt.ko { border-color: var(--rouge); }
.cal-jour[aria-pressed="true"] .pt { border-color: #fff; }
.cal-jour[aria-pressed="true"] .pt.ok { background: #fff; }
.legende { display: flex; gap: 8px 16px; font-size: .82rem; color: var(--gris); margin: 10px 2px 0; flex-wrap: wrap; }
.legende span { display: inline-flex; align-items: center; gap: 6px; }
.legende .pt { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--bleu); display: inline-block; }
.legende .pt.ok { background: var(--bleu); }
.jour-detail h3 { font-family: var(--titre); font-weight: 600; font-size: 1.25rem; margin: 20px 0 10px; }

/* ---------- Bouton principal ---------- */
.fab-zone { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(to top, var(--fond) 60%, rgba(244,245,250,0)); pointer-events: none; }
.fab-zone .btn { pointer-events: auto; max-width: 688px; margin: 0 auto; display: flex; box-shadow: 0 10px 24px -12px rgba(0,0,145,.6); }

/* ---------- Feuille modale ---------- */
.voile { position: fixed; inset: 0; z-index: 60; background: rgba(22, 22, 34, .45); display: flex; align-items: flex-end; justify-content: center; }
.voile[hidden] { display: none; }
.feuille {
  width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; background: #fff;
  border-radius: 10px 10px 0 0; padding: 0 20px calc(20px + env(safe-area-inset-bottom, 0px));
  animation: monte .22s ease-out;
}
.feuille::before { content: ""; display: block; height: 5px; margin: 0 -20px 18px; background: var(--liseré); border-bottom: 1px solid var(--trait); }
@keyframes monte { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
@media (min-width: 640px) { .voile { align-items: center; } .feuille { border-radius: 8px; overflow-x: hidden; } }
.feuille h2 { font-family: var(--titre); font-weight: 700; font-size: 1.7rem; margin: 0 0 16px; color: var(--bleu); }
.ligne { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pied { display: flex; gap: 10px; margin-top: 8px; }
.pied .btn { flex: 1; }
.aide { font-size: .88rem; color: var(--gris); margin: -6px 0 14px; }
.bloc-reglage { border-top: 1px solid var(--trait); padding-top: 16px; margin-top: 18px; }
.bloc-reglage h3 { font-family: var(--titre); font-size: 1.25rem; margin: 0 0 12px; }
.compte { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.compte strong { font-size: 1.05rem; }
.badge { font-size: .75rem; font-weight: 700; color: var(--bleu); background: var(--bleu-clair); padding: 2px 7px; border-radius: 3px; }

.toast {
  position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  z-index: 80; background: var(--encre); color: #fff; padding: 10px 16px; border-radius: 4px; font-weight: 500;
  max-width: calc(100% - 32px); box-shadow: 0 8px 20px -8px rgba(0,0,0,.4);
}
.toast[hidden] { display: none; }
.toast.erreur-t { background: var(--rouge); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.aide.sans-marge { margin: 0; }
/* Champs date/heure sur iPhone */
.champ input[type="date"], .champ input[type="time"] { -webkit-appearance: none; appearance: none; min-height: 48px; min-width: 0; text-align: left; }
.champ input::-webkit-date-and-time-value { text-align: left; }
.ligne > * { min-width: 0; }

/* ---------- Horaires du stand ---------- */
.cal-jour.ferme:not([aria-pressed="true"]) { background-color: var(--ferme); background-image: repeating-linear-gradient(135deg, rgba(98,98,122,.14) 0 2px, transparent 2px 7px); color: var(--ferme-texte); font-weight: 500; }
.cal-jour.ferme.hors { color: #C4C4D0; }
.sw-ferme { display: inline-block; width: 16px; height: 12px; border-radius: 2px; background-color: var(--ferme); background-image: repeating-linear-gradient(135deg, rgba(98,98,122,.2) 0 1.5px, transparent 1.5px 4px); }
.ferme-msg, .horaires-jour.ferme { color: var(--rouge); background: var(--rouge-clair); font-weight: 600; padding: 10px 12px; border-radius: 4px; margin: 0 0 12px; }
.ouvert-msg { color: var(--gris); margin: -4px 0 12px; }
.horaires-jour { font-size: .92rem; color: var(--gris); margin: -8px 0 14px; }
.horaires-jour.ferme { font-size: .95rem; margin-top: -6px; }
.alerte { margin-top: 6px; color: var(--rouge); font-weight: 600; font-size: .9rem; }
.btn-large[disabled] { background: var(--gris); border-color: var(--gris); opacity: 1; }
.grille-horaires { display: grid; gap: 8px; margin-bottom: 12px; }
.ligne-horaire { display: grid; grid-template-columns: 1fr 104px 104px; gap: 8px; align-items: center; }
.ligne-horaire input[type="time"] { width: 100%; min-width: 0; padding: 8px 6px; border: 1px solid #B9BACB; border-radius: 4px; background: var(--carte); min-height: 42px; -webkit-appearance: none; appearance: none; }
.ligne-horaire input[type="time"]:disabled { opacity: .35; }
.bascule { display: flex; align-items: center; gap: 8px; font-weight: 600; text-transform: capitalize; }
.bascule input { width: 20px; height: 20px; accent-color: var(--bleu); }
.liste-horaires, .liste-fermetures { list-style: none; padding: 0; margin: 0 0 12px; }
.liste-horaires li, .liste-fermetures li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--trait); }
.liste-horaires li span:first-child { text-transform: capitalize; font-weight: 600; }
.liste-fermetures em { font-style: normal; color: var(--gris); margin-left: 6px; }
.sous-titre-reglage { margin-top: 16px !important; }

/* ---------- Choix de la date (jours d'ouverture uniquement) ---------- */
.champ small { font-weight: 400; color: var(--gris); }
.jours-choix { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -2px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.jour-chip { flex: none; width: 62px; display: flex; flex-direction: column; align-items: center; padding: 7px 4px 8px; border: 1px solid #B9BACB; border-radius: 6px; background: var(--carte); scroll-snap-align: center; line-height: 1.15; }
.jour-chip .js-c, .jour-chip .m-c { font-size: .78rem; color: var(--gris); }
.jour-chip .num-c { font-family: var(--titre); font-weight: 700; font-size: 1.5rem; color: var(--bleu); }
.jour-chip[aria-pressed="true"] { background: var(--bleu); border-color: var(--bleu); }
.jour-chip[aria-pressed="true"] span { color: #fff; }
.jour-chip.ferme { opacity: .5; }
.champ select { width: 100%; padding: 12px 13px; border: 1px solid #B9BACB; border-radius: 4px; background: var(--carte); font-size: 16px; min-height: 48px; box-shadow: inset 0 -2px 0 var(--bleu-clair); -webkit-appearance: none; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--gris) 50%), linear-gradient(135deg, var(--gris) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.champ select:disabled { opacity: .5; }

/* ---------- Archives ---------- */
.archive-mois { background: var(--carte); border: 1px solid var(--trait); border-radius: 6px; margin-bottom: 10px; }
.archive-mois summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 14px 16px; }
.archive-mois summary::-webkit-details-marker { display: none; }
.archive-mois summary::after { content: "›"; font-size: 1.3rem; color: var(--gris); transform: rotate(90deg); transition: transform .15s; }
.archive-mois[open] summary::after { transform: rotate(-90deg); }
.archive-nom { font-family: var(--titre); font-weight: 700; font-size: 1.3rem; color: var(--bleu); }
.archive-compte { flex: 1; text-align: right; font-size: .88rem; color: var(--gris); }
.archive-liste { padding: 0 12px 2px; }
.archive-liste .seance { opacity: 1; }
