/* =========================================================
   Gestion BPF : feuille de style
   Mobile portrait d'abord, écrans haute densité.
   Palette tirée des logos I.P. Services (encre) et BPF (lagon).
   ========================================================= */

@font-face { font-family: "Plex"; src: url("../fonts/plex-sans-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex"; src: url("../fonts/plex-sans-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Plex"; src: url("../fonts/plex-sans-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Plex"; src: url("../fonts/plex-sans-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Plex Cond"; src: url("../fonts/plex-cond-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Plex Cond"; src: url("../fonts/plex-cond-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Plex Cond"; src: url("../fonts/plex-cond-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  /* Couleurs de marque (identiques en mode clair et sombre) */
  --encre: #13294B;
  --encre-2: #1E3A66;
  --encre-3: #2C4D7F;
  --lagon: #2BB3C6;
  --lagon-fort: #0E7F92;

  /* Surfaces et texte */
  --fond: #EBF0F3;
  --surface: #FFFFFF;
  --surface-2: #F4F7F9;
  --texte: #13294B;
  --texte-2: #55667C;
  --texte-3: #8492A4;
  --trait: #D6DFE5;
  --trait-fort: #B9C6D0;
  --lagon-voile: #DDF2F5;
  --danger: #B3352D;
  --danger-voile: #FBE9E7;
  --succes: #1F7A4D;

  --police: "Plex", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --police-chiffres: "Plex Cond", "Plex", -apple-system, sans-serif;

  --r-s: 8px;
  --r-m: 14px;
  --r-l: 22px;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 64px;

  --ombre-sheet: 0 -12px 40px rgba(19, 41, 75, .22);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fond: #0C1A30;
    --surface: #13243F;
    --surface-2: #182C4C;
    --texte: #E8EEF5;
    --texte-2: #A6B4C6;
    --texte-3: #7A8BA2;
    --trait: #24395C;
    --trait-fort: #34507A;
    --lagon-voile: #123B4B;
    --lagon-fort: #2BB3C6;
    --danger: #F08A80;
    --danger-voile: #3A1E26;
    --succes: #6FD3A0;
    --ombre-sheet: 0 -12px 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--fond);
  color: var(--texte);
  font-family: var(--police);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--lagon-fort); }
code { font-size: .9em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

:focus-visible { outline: 3px solid var(--lagon); outline-offset: 2px; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico {
  width: 22px; height: 22px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.9;
  stroke-linecap: round; stroke-linejoin: round;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Structure ---------- */

.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
}

.view {
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 28px);
  outline: none;
}

.boot {
  min-height: 100dvh;
  display: grid; place-items: center;
  background: var(--encre);
}
.boot img { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; transform: scale(.96); } }

/* ---------- Fiche bilan (en-tête) ---------- */

.fiche {
  background: var(--encre);
  color: #fff;
  padding: calc(var(--safe-t) + 14px) 20px 26px;
  border-radius: 0 0 var(--r-l) var(--r-l);
  position: relative;
  overflow: hidden;
}
/* Trame discrète de cases, clin d'œil au formulaire Cerfa */
.fiche::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
}
.fiche > * { position: relative; }

.fiche-top {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 44px;
}
.marque { display: flex; align-items: center; gap: 10px; }
.marque img { width: 30px; height: auto; }
.marque span { font-weight: 600; font-size: 15px; letter-spacing: .01em; color: rgba(255,255,255,.86); }

.btn-synthese {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.22);
  background: rgba(255,255,255,.06);
  color: #fff; font-size: 14px; font-weight: 500; text-decoration: none;
}
.btn-synthese .ico { width: 18px; height: 18px; }

.annee-btn {
  display: inline-flex; align-items: flex-end; gap: 8px;
  margin: 14px 0 0;
  padding: 0; border: 0; background: none; color: #fff;
  font-family: var(--police-chiffres);
  font-weight: 700;
  font-size: clamp(72px, 24vw, 104px);
  line-height: .86;
  letter-spacing: -.02em;
}
.annee-btn .ico { width: 26px; height: 26px; margin-bottom: 8px; color: var(--lagon); stroke-width: 2.4; }
.annee-legende { margin: 8px 0 22px; color: rgba(255,255,255,.66); font-size: 14px; }

.cerfa {
  display: grid; gap: 14px;
}
.cerfa-ligne { display: grid; gap: 6px; }
.cerfa-libelle {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13.5px; color: rgba(255,255,255,.74);
}
.cerfa-libelle small { font-size: 12px; color: rgba(255,255,255,.5); }
.cases {
  display: flex; gap: 4px;
  font-family: var(--police-chiffres);
  font-weight: 600;
}
.case {
  flex: 1 1 0; max-width: 44px;
  height: 52px;
  display: grid; place-items: center;
  border: 1px solid rgba(43,179,198,.45);
  border-radius: 6px;
  background: rgba(255,255,255,.04);
  font-size: 32px;
  font-variant-numeric: tabular-nums;
}
.case.vide { border-color: rgba(43,179,198,.22); background: rgba(255,255,255,.02); }
.case.sep { flex: 0 0 auto; width: auto; border: 0; background: none; padding: 0 1px; font-size: 26px; color: rgba(255,255,255,.6); }

.fiche-pied {
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  margin-top: 18px; padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,.12);
  font-size: 14px; color: rgba(255,255,255,.78);
}
.fiche-pied b { color: #fff; font-weight: 600; }

/* ---------- Frais kilométriques ---------- */

.frais {
  margin: 16px 16px 0;
  padding: 16px 18px;
  background: var(--surface);
  border-radius: var(--r-m);
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px;
  align-items: center;
  border: 1px solid var(--trait);
  text-decoration: none; color: inherit;
}
.frais-titre { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--texte-2); }
.frais-titre .ico { width: 20px; height: 20px; color: var(--lagon-fort); }
.frais-montant {
  grid-row: span 2;
  font-family: var(--police-chiffres); font-weight: 700; font-size: 30px;
  letter-spacing: -.01em; white-space: nowrap;
}
.frais-detail { font-size: 13px; color: var(--texte-3); }
.frais-alerte { grid-column: 1 / -1; font-size: 13px; color: var(--lagon-fort); font-weight: 500; margin-top: 4px; }

/* ---------- Liste des sessions ---------- */

.liste { padding: 8px 16px 0; }

.mois {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 22px 4px 8px;
}
.mois h2 { margin: 0; font-size: 17px; font-weight: 600; text-transform: capitalize; }
.mois span { font-size: 13px; color: var(--texte-3); }

.sessions {
  list-style: none; margin: 0; padding: 0;
  background: var(--surface);
  border-radius: var(--r-m);
  border: 1px solid var(--trait);
  overflow: hidden;
}
.sessions li + li { border-top: 1px solid var(--trait); }

.session {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 14px;
  align-items: center;
  width: 100%; min-height: 72px;
  padding: 12px 14px;
  border: 0; background: none; text-align: left;
}
.session:active { background: var(--surface-2); }

.jour {
  display: grid; justify-items: center;
  padding: 6px 0 5px;
  border-radius: var(--r-s);
  background: var(--lagon-voile);
  color: var(--lagon-fort);
  line-height: 1;
}
.jour b { font-family: var(--police-chiffres); font-size: 22px; font-weight: 700; }
.jour small { font-size: 11.5px; margin-top: 3px; font-weight: 500; }

.session-corps { min-width: 0; }
.session-num { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-info { font-size: 13.5px; color: var(--texte-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag {
  font-size: 11.5px; font-weight: 500;
  padding: 2px 8px; border-radius: 999px; white-space: nowrap;
  background: var(--surface-2); color: var(--texte-2);
  border: 1px solid var(--trait);
}

.effectif {
  display: grid; justify-items: end;
  font-family: var(--police-chiffres);
}
.effectif b { font-size: 24px; font-weight: 700; line-height: 1; }
.effectif small { font-family: var(--police); font-size: 12px; color: var(--texte-3); margin-top: 3px; }

.vide-etat {
  margin: 28px 16px; padding: 28px 22px;
  text-align: center;
  border: 1.5px dashed var(--trait-fort);
  border-radius: var(--r-m);
  color: var(--texte-2);
}
.vide-etat h2 { margin: 0 0 6px; font-size: 18px; color: var(--texte); }
.vide-etat p { margin: 0 0 18px; }

/* ---------- Barre d'onglets ---------- */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  max-width: 560px; margin: 0 auto;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: 1fr 88px 1fr; align-items: center;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border-top: 1px solid var(--trait);
}
.tab {
  display: grid; justify-items: center; gap: 2px;
  height: 100%; align-content: center;
  color: var(--texte-3); text-decoration: none;
  font-size: 11.5px; font-weight: 500;
}
.tab[aria-current="page"] { color: var(--texte); }
.tab[aria-current="page"] .ico { color: var(--lagon-fort); }
.tab-add {
  justify-self: center;
  width: 60px; height: 60px; margin-top: -26px;
  display: grid; place-items: center;
  border-radius: 20px;
  border: 4px solid var(--fond);
  background: var(--lagon-fort); color: #fff;
  box-shadow: 0 6px 18px rgba(14,127,146,.4);
  transition: transform .15s ease;
}
.tab-add .ico { width: 28px; height: 28px; stroke-width: 2.4; }
.tab-add:active { transform: scale(.94); }
.tab-add[aria-expanded="true"] .ico { transform: rotate(45deg); }
.tab-add .ico { transition: transform .2s ease; }

/* ---------- Réglages ---------- */

.entete {
  padding: calc(var(--safe-t) + 18px) 20px 6px;
}
.entete h1 { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -.01em; }

.bloc { margin: 22px 16px 0; }
.bloc > h2 { margin: 0 4px 8px; font-size: 15px; font-weight: 600; color: var(--texte-2); }
.bloc-note { margin: 8px 4px 0; font-size: 13px; color: var(--texte-3); }

.carte {
  background: var(--surface);
  border: 1px solid var(--trait);
  border-radius: var(--r-m);
  overflow: hidden;
}
.carte-pad { padding: 16px; }

.annees { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.annees::-webkit-scrollbar { display: none; }
.annee-pill {
  flex: none;
  display: grid; justify-items: center; gap: 1px;
  min-width: 78px; padding: 10px 12px;
  border-radius: var(--r-m);
  border: 1px solid var(--trait);
  background: var(--surface);
}
.annee-pill b { font-family: var(--police-chiffres); font-size: 22px; font-weight: 700; line-height: 1.1; }
.annee-pill small { font-size: 12px; color: var(--texte-3); }
.annee-pill[aria-pressed="true"] { background: var(--encre); border-color: var(--encre); color: #fff; }
.annee-pill[aria-pressed="true"] small { color: rgba(255,255,255,.7); }

.ligne {
  display: flex; align-items: center; gap: 14px;
  width: 100%; min-height: 58px; padding: 10px 16px;
  border: 0; background: none; text-align: left; text-decoration: none; color: inherit;
}
.ligne + .ligne { border-top: 1px solid var(--trait); }
.ligne:active { background: var(--surface-2); }
.ligne > .ico:first-child { color: var(--lagon-fort); }
.ligne-texte { flex: 1; min-width: 0; }
.ligne-texte b { display: block; font-weight: 500; }
.ligne-texte small { display: block; font-size: 13px; color: var(--texte-3); }
.ligne .chev { color: var(--texte-3); width: 18px; height: 18px; }
.ligne.danger, .ligne.danger > .ico:first-child { color: var(--danger); }

.apropos { display: grid; grid-template-columns: 72px 1fr; gap: 16px; align-items: center; }
.apropos img { width: 72px; height: 72px; border-radius: 12px; background: #fff; }
.apropos p { margin: 0; font-size: 14px; color: var(--texte-2); }
.apropos p b { color: var(--texte); font-size: 16px; }
.confidentialite { margin: 14px 0 0; padding-top: 14px; border-top: 1px solid var(--trait); font-size: 13.5px; color: var(--texte-2); }
.version { text-align: center; font-size: 12px; color: var(--texte-3); margin: 22px 0 0; }

/* ---------- Champs de formulaire ---------- */

.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > span { font-size: 14px; font-weight: 500; color: var(--texte-2); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 50px;
  padding: 12px 14px;
  border: 1px solid var(--trait-fort);
  border-radius: var(--r-s);
  background: var(--surface);
  font-size: 16px; /* évite le zoom iOS */
  -webkit-appearance: none; appearance: none;
}
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2355667C' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 18px;
  padding-right: 40px;
}
.field input[type="date"] { min-width: 0; display: block; }
.field input:focus, .field select:focus { border-color: var(--lagon-fort); outline: none; box-shadow: 0 0 0 3px var(--lagon-voile); }
.field .aide { font-size: 12.5px; color: var(--texte-3); }

.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.duo .field { min-width: 0; }

.stepper {
  display: grid; grid-template-columns: 50px 1fr 50px; align-items: center;
  min-height: 50px;
  border: 1px solid var(--trait-fort); border-radius: var(--r-s);
  background: var(--surface);
  overflow: hidden;
}
.stepper button {
  height: 50px; border: 0; background: var(--surface-2); color: var(--texte);
  display: grid; place-items: center;
}
.stepper button:disabled { color: var(--texte-3); opacity: .5; }
.stepper output { text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }

.segments { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.segments button {
  min-height: 46px; border-radius: var(--r-s);
  border: 1px solid var(--trait-fort); background: var(--surface);
  font-weight: 500;
}
.segments button[aria-pressed="true"] { background: var(--encre); border-color: var(--encre); color: #fff; }
@media (prefers-color-scheme: dark) {
  .segments button[aria-pressed="true"] { background: var(--lagon-fort); border-color: var(--lagon-fort); color: #06222A; }
}

.interrupteur {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  min-height: 56px; margin-bottom: 16px; padding: 8px 14px;
  border: 1px solid var(--trait-fort); border-radius: var(--r-s);
  background: var(--surface);
}
.interrupteur span b { display: block; font-weight: 500; }
.interrupteur span small { display: block; font-size: 12.5px; color: var(--texte-3); }
.interrupteur input {
  -webkit-appearance: none; appearance: none;
  flex: none; width: 50px; height: 30px; border-radius: 999px;
  background: var(--trait-fort); position: relative; margin: 0;
  transition: background .2s ease;
}
.interrupteur input::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .2s ease;
}
.interrupteur input:checked { background: var(--lagon-fort); }
.interrupteur input:checked::after { transform: translateX(20px); }

.recap {
  display: flex; gap: 10px; align-items: center;
  padding: 12px 14px; margin: 4px 0 16px;
  border-radius: var(--r-s);
  background: var(--lagon-voile); color: var(--lagon-fort);
  font-size: 14px; font-weight: 500;
}
.recap .ico { width: 20px; height: 20px; }

/* Participants */
.inscrits { margin-bottom: 16px; }
.inscrits-tete { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.inscrits-tete span { font-size: 14px; font-weight: 500; color: var(--texte-2); }
.inscrits ul { list-style: none; margin: 0 0 10px; padding: 0; border: 1px solid var(--trait); border-radius: var(--r-s); overflow: hidden; }
.inscrits ul:empty { display: none; }
.inscrits li { display: flex; align-items: center; gap: 10px; padding: 8px 6px 8px 14px; background: var(--surface); }
.inscrits li + li { border-top: 1px solid var(--trait); }
.inscrits li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inscrits li small { color: var(--texte-3); }
.inscrit-ajout { display: grid; grid-template-columns: 1fr 1fr 50px; gap: 8px; }
.inscrit-ajout input {
  min-width: 0; min-height: 46px; padding: 10px 12px;
  border: 1px solid var(--trait-fort); border-radius: var(--r-s); background: var(--surface); font-size: 16px;
}
.btn-icone {
  width: 44px; height: 44px; display: grid; place-items: center;
  border: 0; border-radius: var(--r-s); background: none; color: var(--texte-2);
}
.btn-icone.plein { background: var(--encre); color: #fff; width: 50px; height: 46px; }
@media (prefers-color-scheme: dark) { .btn-icone.plein { background: var(--lagon-fort); color: #06222A; } }

/* ---------- Boutons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 20px;
  border-radius: var(--r-s);
  border: 1px solid transparent;
  font-weight: 600; font-size: 16px; text-decoration: none;
}
.btn-block { width: 100%; }
.btn-primary { background: var(--lagon-fort); color: #fff; }
@media (prefers-color-scheme: dark) { .btn-primary { color: #06222A; } }
.btn-primary:active { filter: brightness(.92); }
.btn-ghost { background: var(--surface-2); color: var(--texte); border-color: var(--trait); }
.btn-danger-text { background: none; color: var(--danger); min-height: 48px; font-weight: 500; }
.btn[disabled] { opacity: .55; pointer-events: none; }

/* ---------- Feuilles (bottom sheets) ---------- */

.sheet-layer { position: fixed; inset: 0; z-index: 40; }
.sheet-backdrop {
  position: absolute; inset: 0;
  background: rgba(8, 18, 34, .5);
  opacity: 0; transition: opacity .22s ease;
}
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-width: 560px; margin: 0 auto;
  max-height: calc(100dvh - var(--safe-t) - 24px);
  display: flex; flex-direction: column;
  background: var(--fond);
  border-radius: var(--r-l) var(--r-l) 0 0;
  box-shadow: var(--ombre-sheet);
  transform: translateY(100%);
  transition: transform .28s cubic-bezier(.2, .8, .2, 1);
  outline: none;
}
.sheet-layer.ouvert .sheet-backdrop { opacity: 1; }
.sheet-layer.ouvert .sheet { transform: translateY(0); }

.sheet-poignee { width: 40px; height: 5px; border-radius: 3px; background: var(--trait-fort); margin: 8px auto 0; flex: none; }
.sheet-tete {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 12px 8px 20px; flex: none;
}
.sheet-tete h2 { margin: 0; font-size: 20px; font-weight: 700; }
.sheet-corps { padding: 6px 20px 8px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.sheet-pied {
  flex: none;
  display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px;
  padding: 12px 20px calc(12px + var(--safe-b));
  border-top: 1px solid var(--trait);
  background: var(--surface);
}
.sheet-pied.simple { grid-template-columns: 1fr; }

.actions { display: grid; gap: 10px; padding: 4px 20px calc(20px + var(--safe-b)); }
.action {
  display: grid; grid-template-columns: 48px 1fr; gap: 14px; align-items: center;
  width: 100%; padding: 14px 16px;
  border-radius: var(--r-m); border: 1px solid var(--trait);
  background: var(--surface); text-align: left;
}
.action-ico { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--lagon-voile); color: var(--lagon-fort); }
.action-ico .ico { width: 24px; height: 24px; }
.action b { display: block; font-size: 16.5px; font-weight: 600; }
.action small { display: block; font-size: 13.5px; color: var(--texte-2); margin-top: 1px; }

.form-error {
  margin: 0 0 16px; padding: 12px 14px;
  border-radius: var(--r-s);
  background: var(--danger-voile); color: var(--danger);
  font-size: 14px; font-weight: 500;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed; left: 50%; z-index: 60;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 18px);
  transform: translate(-50%, 12px);
  max-width: calc(100% - 32px);
  padding: 12px 18px; border-radius: 12px;
  background: var(--encre); color: #fff;
  font-size: 15px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(8,18,34,.3);
  opacity: 0; transition: opacity .2s ease, transform .2s ease;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.toast.erreur { background: var(--danger); }
@media (prefers-color-scheme: dark) { .toast { background: #E8EEF5; color: #13294B; } .toast.erreur { background: #F08A80; color: #2A0F0C; } }

/* ---------- Pages connexion / installation ---------- */

.page-auth { background: var(--encre); }
.auth {
  min-height: 100dvh;
  max-width: 440px; margin: 0 auto;
  padding: calc(var(--safe-t) + 48px) 20px calc(var(--safe-b) + 24px);
  display: flex; flex-direction: column;
}
.auth-brand { color: #fff; margin-bottom: 28px; }
.auth-brand img { width: 56px; height: auto; margin-bottom: 18px; }
.auth-brand h1 { margin: 0; font-family: var(--police-chiffres); font-size: 44px; font-weight: 700; line-height: 1; letter-spacing: -.01em; }
.auth-brand p { margin: 6px 0 0; color: rgba(255,255,255,.7); }
.auth-card {
  background: var(--surface); color: var(--texte);
  border-radius: var(--r-l);
  padding: 22px 20px 20px;
}
.auth-card h2 { margin: 0 0 8px; font-size: 20px; }
.auth-card p { margin: 0 0 16px; color: var(--texte-2); font-size: 15px; }
.auth-foot { margin-top: auto; padding-top: 24px; text-align: center; color: rgba(255,255,255,.5); font-size: 13px; }

/* ---------- Mode paysage sur téléphone ---------- */

.landscape-guard { display: none; }
@media (orientation: landscape) and (max-height: 520px) and (pointer: coarse) {
  .landscape-guard {
    position: fixed; inset: 0; z-index: 100;
    display: grid; place-content: center; justify-items: center; gap: 12px;
    background: var(--encre); color: #fff; text-align: center; padding: 24px;
  }
  .landscape-guard .ico { width: 40px; height: 40px; color: var(--lagon); transform: rotate(90deg); }
  .landscape-guard p { margin: 0; font-size: 17px; }
}

/* Écrans plus larges : l'application reste une colonne de téléphone */
@media (min-width: 600px) {
  body.page-app { background: var(--trait); }
  .app { background: var(--fond); box-shadow: 0 0 0 1px var(--trait); }
}

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