/* PWA famille (§6.2) — mobile, quatre onglets, même identité que le reste :
   vert pin, papier chaud, miel pour l'attention, brique pour raccrocher. */

:root {
  --paper: #F4F3EC;
  --card: #FFFFFF;
  --ink: #212B25;
  --ink-soft: #5A675F;
  /* couleurs du thème = Theme.palette(DEFAUT) (js/theme.js), que le thème
     de l'établissement remplace une fois connecté : aplat (en-tête,
     boutons) et son texte, survol, encre (texte accentué sur fond clair),
     aplat clair, fond de l'écran d'appel et son texte */
  --pine: #2E5B4F;
  --sur-pine: #FBF8F1;
  --pine-survol: #1F4138;
  --pine-encre: #2E5B4F;
  --pine-dark: #1F4138;
  --sage: #E4ECEA;
  --honey: #C08A2A;
  --honey-soft: #F6EBD4;
  --brick: #A64435;
  --line: #D9DCD0;
  --nuit: #132520;
  --sur-nuit: #FBF8F1;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(33,43,37,.06), 0 4px 14px rgba(33,43,37,.06);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  /* polices : celles de l'établissement une fois connecté (theme.js) */
  --font-body: "Atkinson Hyperlegible", system-ui, sans-serif;
  --font-display: "Bricolage Grotesque", sans-serif;
  /* calque de recadrage des photos de profil (packages/recadrage) : le fond
     et l'aplat de l'écran d'appel */
  --recadrage-fond: var(--nuit);
  --recadrage-texte: var(--sur-nuit);
  --recadrage-accent: var(--pine);
  --recadrage-sur-accent: var(--sur-pine);
  --recadrage-focus: var(--honey);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
/* l'ancrage du défilement du fil est fait à la main (Vues._suivreHauteurs),
   pareil partout : Safari n'en a pas, Chrome compenserait une seconde fois */
html { overflow-anchor: none; }
body {
  font-family: var(--font-body);
  font-size: 16px; line-height: 1.45; color: var(--ink);
  background: var(--paper);
}
h1, h2, h3 { font-family: var(--font-display); margin: 0; }
button { font-family: inherit; font-size: 1rem; cursor: pointer; border: none; }
:focus-visible { outline: 3px solid var(--honey); outline-offset: 2px; }

#app { min-height: 100dvh; display: flex; flex-direction: column; }

/* ---------- entête & onglets ---------- */

.entete {
  position: sticky; top: 0; z-index: 20;
  background: var(--pine); color: var(--sur-pine);
  padding: .8rem 1rem; display: flex; align-items: center; gap: .75rem;
}
.entete .titre { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; flex: 1; }
/* logo de l'établissement — la hauteur mène, un bandeau large reste entier */
.entete .logo-residence { height: 30px; max-width: 96px; object-fit: contain; flex: 0 0 auto; }
.logo-residence.grand { max-height: 72px; max-width: 100%; object-fit: contain; margin-bottom: .5rem; }
.entete .reglages-btn { background: color-mix(in srgb, var(--sur-pine) 15%, transparent); color: inherit; border-radius: 50%; width: 38px; height: 38px; font-size: 1.1rem; }
.entete .titre { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Disponible / Indisponible (§6.2.3) : choisi par le proche, sans motif */
.dispo-btn {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: .35rem;
  background: color-mix(in srgb, var(--sur-pine) 15%, transparent); color: inherit; border-radius: 999px;
  padding: .35rem .7rem; font-size: .8rem; font-weight: 700;
}
.dispo-btn .point { width: 9px; height: 9px; border-radius: 50%; background: #7FD69E; }
.dispo-btn.indisponible { background: var(--honey); color: #fff; }
.dispo-btn.indisponible .point { background: #fff; opacity: .8; }

main.contenu { flex: 1; padding: 1rem 1rem calc(80px + var(--safe-bottom)); max-width: 560px; width: 100%; margin: 0 auto; }

/* barre à la couleur de l'établissement, comme l'entête ; l'onglet actif est
   une touche claire, du papier de la page, soulignée en haut d'un trait foncé */
.onglets {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  background: var(--pine);
  /* trois ou quatre onglets : 🛎 Secrétariat n'existe qu'avec Accueil Visio */
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
}
.onglets button {
  position: relative;
  background: none; display: flex; flex-direction: column;
  /* la touche descend jusqu'au bord de l'écran, sous la barre d'accueil iOS */
  padding: .55rem 0 calc(.6rem + var(--safe-bottom));
  align-items: center; gap: .15rem; font-size: .72rem; font-weight: 700;
  color: color-mix(in srgb, var(--sur-pine) 80%, transparent);
  transition: background-color .15s, color .15s;
}
.onglets button .picto { font-size: 1.35rem; line-height: 1.2; }
/* les pictos sont des emojis, qui ne changent pas de couleur : atténués hors
   de l'onglet actif */
.onglets button:not(.actif) .picto { filter: grayscale(.6); opacity: .75; }
.onglets button:active { background: var(--pine-survol); }
.onglets button.actif { background: var(--paper); color: var(--pine-dark); }
.onglets button.actif::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: var(--pine-dark);
}
.onglets button .pastille {
  position: absolute; transform: translate(14px, -4px);
  background: var(--brick); color: #fff; border-radius: 999px;
  min-width: 18px; height: 18px; font-size: .7rem;
  display: grid; place-items: center; padding: 0 4px;
}

/* ---------- cartes & boutons ---------- */

.carte {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1rem 1.1rem; margin-bottom: 1rem;
}

/* réglage des sons (Réglages → Sonneries), construit par Sonnerie.champ() */
.reglage-son { padding: .7rem 0; border-top: 1px solid var(--line); }
.reglage-son-titre { font-weight: 700; margin-bottom: .45rem; }
.reglage-son-ligne { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.reglage-son-ligne select {
  flex: 1 1 160px; min-width: 0; padding: .7rem .8rem; font: inherit;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card);
  color: var(--ink);
}
.reglage-son-ligne .btn { padding: .7rem .9rem; }
.reglage-son-essai { min-width: 3rem; }
.reglage-son-volumes { display: flex; gap: 2px; flex: 1 1 100%; }
.reglage-son-volumes .btn { flex: 1; border-radius: 0; }
.reglage-son-volumes .btn:first-child { border-radius: 12px 0 0 12px; }
.reglage-son-volumes .btn:last-child { border-radius: 0 12px 12px 0; }
.reglage-son-volumes .btn.actif { background: var(--pine); color: var(--sur-pine); }

/* texte de diffusion mis en forme par markdown.js */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 .7rem; }
.md h2, .md h3, .md h4 { font-size: 1rem; margin: .9rem 0 .4rem; }
.md ul, .md ol { margin: 0 0 .7rem; padding-left: 1.4rem; }
.md li { margin-bottom: .25rem; }
.md hr { border: none; border-top: 1px solid var(--line); margin: .9rem 0; }
.md code {
  font-family: ui-monospace, monospace; font-size: .9em;
  background: rgba(0, 0, 0, .05); border-radius: 4px; padding: 0 .25rem;
}
.btn {
  background: var(--pine); color: var(--sur-pine); border-radius: 12px;
  padding: .8rem 1.2rem; font-weight: 700; font-size: 1rem;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
}
.btn:active { transform: scale(.98); }
.btn.geant { width: 100%; padding: 1.05rem; font-size: 1.15rem; border-radius: 14px; }
.btn.doux { background: var(--sage); color: var(--pine-dark); }
.btn.rouge { background: var(--brick); }
.btn:disabled { opacity: .5; }
a.btn { text-decoration: none; }

.ligne-raccourcis { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; }
.raccourci {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: .8rem .4rem; display: flex; flex-direction: column;
  align-items: center; gap: .3rem; font-size: .8rem; font-weight: 700; color: var(--ink);
}
.raccourci .picto { font-size: 1.6rem; }

/* ---------- accueil ---------- */

.resident-carte { display: flex; align-items: center; gap: 1rem; }
.photo-ronde {
  width: 64px; height: 64px; border-radius: 50%; object-fit: cover;
  background: var(--sage); display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700;
  font-size: 1.5rem; color: var(--pine-dark); flex: none;
}
.photo-ronde.grande { width: 110px; height: 110px; font-size: 2.5rem; }
.photo-ronde.petite { width: 40px; height: 40px; font-size: 1.05rem; }

/* « Bonjour Marie », en tête de l'Accueil, avec sa photo */
.salut {
  display: flex; align-items: center; gap: .6rem; margin: 0 0 .9rem;
  background: none; padding: 0; color: var(--ink); font-size: 1.1rem; text-align: left;
}
.salut strong { font-family: var(--font-display); }

/* une photo qui se change d'un toucher : pastille crayon dans le coin */
.photo-modifiable { position: relative; flex: none; background: none; padding: 0; border-radius: 50%; }
.photo-modifiable .crayon {
  position: absolute; right: -2px; bottom: -2px; width: 34px; height: 34px;
  border-radius: 50%; display: grid; place-items: center;
  background: var(--pine); color: var(--sur-pine); box-shadow: 0 0 0 3px var(--card);
}
.photo-modifiable .crayon svg { width: 17px; height: 17px; }

/* Réglages → Mon compte */
.mon-profil { display: flex; align-items: center; gap: 1rem; margin: .5rem 0 .7rem; }
.mon-profil p { margin: .15rem 0 0; overflow-wrap: anywhere; }

/* feuille « Votre photo » : prendre, choisir, retirer */
.feuille-photo h2 { align-self: center; }
.feuille-photo .apercu-photo { display: grid; place-items: center; margin: .2rem 0; }
.feuille-photo .apercu-photo .photo-ronde.grande { width: 140px; height: 140px; font-size: 3rem; }
.feuille-photo .retrait-photo { display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.feuille-photo .retrait-photo:empty { display: none; }
.feuille-photo .retrait-photo p { margin: 0; font-size: .9rem; color: var(--ink-soft); text-align: center; }
.statut { font-size: .85rem; }
.statut .point { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #9AA79E; margin-right: .3rem; }
.statut.present .point { background: #4CAF74; box-shadow: 0 0 0 3px rgba(76,175,116,.25); }

.fil-evenement { display: flex; gap: .7rem; align-items: baseline; padding: .45rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.fil-evenement:last-child { border-bottom: none; }
.fil-evenement .quand { color: var(--ink-soft); font-size: .78rem; white-space: nowrap; }

/* ---------- messages (fil) ---------- */

.fil { display: flex; flex-direction: column; gap: .6rem; }
.bulle {
  max-width: 82%; border-radius: 16px; padding: .7rem .9rem;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
  align-self: flex-start; font-size: .95rem;
}
.bulle.moi { align-self: flex-end; background: var(--sage); border-color: var(--sage); }
.bulle .meta { font-size: .72rem; color: var(--ink-soft); margin-top: .3rem; display: flex; flex-wrap: wrap; gap: 0 .5rem; }
.bulle .meta > * { white-space: nowrap; }
.bulle .accuse { color: var(--pine-encre); font-weight: 700; }
/* ✓ envoyé, en retrait ; ✓✓ lu par le résident, en couleur, avec l'heure */
.bulle .accuse.envoye { color: var(--ink-soft); font-weight: 400; }
.bulle .accuse.lu { color: var(--pine-encre); }
/* haut du fil paginé : la fenêtre d'avant, ou le début de la conversation */
.fil .plus-anciens {
  align-self: center; background: var(--sage); color: var(--pine-dark);
  border-radius: 999px; padding: .5rem 1rem; font-size: .85rem; font-weight: 700;
}
.fil .plus-anciens:disabled { opacity: .6; }
.fil .debut-fil { align-self: center; margin: .2rem 0; font-size: .8rem; color: var(--ink-soft); }
.bulle audio, .bulle video { max-width: 100%; border-radius: 8px; }
/* une vidéo se voit avant d'être lancée : cadre noir au format 16/9 tant que
   la première image n'est pas là, puis le format de la vidéo elle-même */
.bulle video {
  display: block; width: 100vw; background: #000;
  aspect-ratio: auto 16 / 9; max-height: 60vh; object-fit: contain;
}
.bulle img { max-width: 100%; border-radius: 10px; display: block; }
/* photo, vidéo ou vocal que le serveur n'a plus (vues.js, _indisponible) ;
   message d'une conversation chiffrée que le service n'a pas su lire */
.bulle .media-indisponible, .bulle .illisible {
  margin: 0; padding: .6rem .8rem; border-radius: 10px;
  border: 1px dashed var(--line); color: var(--ink-soft);
  font-size: .9rem;
}
/* l'événement du jour (date importante), pleine largeur dans le fil */
.fil .evenement-jour {
  align-self: stretch; display: flex; align-items: center; gap: .8rem;
  background: var(--honey-soft); border: 1px solid #EAD6A8; border-radius: var(--radius);
  padding: .8rem 1rem; color: #5A4410;
}
.evenement-jour .picto { font-size: 1.8rem; line-height: 1; }
.evenement-jour .titre { font-weight: 700; font-size: 1.05rem; color: var(--ink); }
.evenement-jour .sous { font-size: .8rem; }
.bulle.appel-trace { align-self: center; background: var(--honey-soft); border-color: var(--honey-soft); font-size: .85rem; color: #6A5310; }
/* l'accueil a raccroché avec un mot tout prêt : le mot, sous la trace */
.bulle.appel-trace .reponse-trace { margin-top: .25rem; font-style: italic; }
/* mot écrit, et mot sous une photo ou une vidéo : tel qu'il a été tapé */
.bulle .texte-bulle, .bulle .legende-bulle {
  margin: 0; white-space: pre-line; overflow-wrap: anywhere;
}
.bulle .legende-bulle { margin-top: .45rem; }

/* ---------- rédaction : « + », une ligne, ➤ — comme la discussion du panneau ---------- */

/* le fil pousse la ligne en bas de l'écran, même quand il est court ; long,
   la ligne reste accrochée au-dessus des onglets pendant qu'on le remonte */
/* (la barre des onglets fait ~61 px : la ligne glisse un peu dessous, sur sa
   marge, pour n'y laisser aucun jour) */
main.contenu.avec-redaction {
  display: flex; flex-direction: column; gap: .8rem;
  padding-bottom: calc(56px + var(--safe-bottom));
}
.redaction {
  position: sticky; z-index: 15; bottom: calc(56px + var(--safe-bottom));
  margin: auto -1rem 0; padding: .6rem 1rem calc(.6rem + 6px);
  display: flex; flex-direction: column; gap: .5rem;
  background: var(--paper); border-top: 1px solid var(--line);
}
/* le bandeau « Appel à plusieurs » au-dessus des onglets : la ligne au-dessus
   de lui (sa hauteur mesurée par Appel.majGroupes) */
body.avec-groupe main.contenu.avec-redaction,
body.avec-groupe .redaction {
  --au-dessus: calc(66px + var(--hauteur-groupe, 90px) + .3rem + var(--safe-bottom));
}
body.avec-groupe main.contenu.avec-redaction { padding-bottom: var(--au-dessus); }
body.avec-groupe .redaction { bottom: var(--au-dessus); padding-bottom: .6rem; }
.redaction .compteur { font-size: .8rem; color: var(--ink-soft); text-align: right; }
.redaction .compteur:empty { display: none; }
.redaction .compteur.limite { color: var(--brick); font-weight: 700; }
.rd-ligne {
  position: relative; display: flex; align-items: flex-end; gap: .45rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 24px;
  padding: .3rem .35rem;
}
.rd-ligne:focus-within { border-color: var(--pine); box-shadow: 0 0 0 2px var(--sage); }
.rd-plus, .rd-envoyer {
  flex: none; width: 2.6rem; height: 2.6rem; border-radius: 50%;
  display: grid; place-items: center; line-height: 1;
}
.rd-plus {
  border: 1px solid var(--line); background: var(--sage); color: var(--pine-dark);
  font-size: 1.6rem; font-weight: 700;
}
.rd-envoyer { background: var(--pine); color: var(--sur-pine); font-size: 1.15rem; }
.rd-envoyer:disabled { opacity: .35; }
.rd-envoyer.envoi { opacity: .6; animation: rd-envoi 1s ease-in-out infinite; }
@keyframes rd-envoi { 50% { transform: translateX(3px); } }
.rd-ligne .rd-texte {
  flex: 1; min-width: 0; width: auto; margin: 0; border: 0; border-radius: 0;
  background: none; resize: none; outline: none;
  padding: .55rem .3rem; line-height: 1.4; max-height: 128px;
}
.rd-ligne .rd-texte:focus-visible { outline: none; }
/* le menu du « + », au-dessus de la ligne */
.rd-menu {
  position: absolute; left: 0; bottom: calc(100% + .45rem); z-index: 2;
  display: flex; flex-direction: column; min-width: 15rem; padding: .35rem;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(33, 43, 37, .18);
}
.rd-menu[hidden] { display: none; }
.rd-action {
  display: flex; align-items: center; gap: .7rem; padding: .75rem .8rem;
  background: none; border-radius: 10px; color: var(--ink); text-align: left;
  font-weight: 700;
}
.rd-action:active { background: var(--sage); }
.rd-action .picto { flex: none; width: 1.8rem; text-align: center; font-size: 1.35rem; }
.piece-jointe {
  display: flex; gap: .8rem; align-items: center;
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: .5rem;
}
.piece-jointe img, .piece-jointe video {
  width: 96px; height: 96px; object-fit: cover; border-radius: 10px; background: #0E1A14; flex: none;
}
.piece-infos { display: flex; flex-direction: column; align-items: flex-start; gap: .4rem; font-size: .9rem; font-weight: 700; }
.piece-infos .btn { padding: .45rem .8rem; font-size: .85rem; }

/* Enregistreurs vidéo et vocal (se préparer, enregistrer, revoir), comme une
   appli d'appareil photo : l'état en haut, un panneau d'icônes accroché en bas, la vidéo dans toute
   la place qui reste entre les deux (rangée minmax(0, 1fr) de la grille). Les
   commandes ne peuvent plus sortir de l'écran : un téléphone tenu en portrait
   filme en 720 × 1280, et l'aperçu laissé à sa taille poussait les boutons
   dessous, sans défilement (iPhone). */
.plein-ecran.enregistreur-media {
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  align-items: stretch; justify-items: stretch; gap: 0; padding: 0; overflow: hidden;
}
.entete-enregistrement {
  padding: calc(.8rem + env(safe-area-inset-top, 0px)) 1rem .7rem;
  display: flex; flex-direction: column; gap: .2rem;
}
.etat-enregistrement { font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.etat-enregistrement.rec { color: #F4A08F; font-size: 1.25rem; }
.etat-enregistrement.bientot { color: #F2B65A; }
/* fond clair (couleur exacte d'une charte claire, App.appliquerTheme) : les
   mêmes rouge et ambre, foncés pour rester lisibles */
.nuit-claire .etat-enregistrement.rec { color: #8A2117; }
.nuit-claire .etat-enregistrement.bientot { color: #6A4000; }
.consigne-enregistrement { opacity: .85; font-size: .88rem; }
.cadre-camera {
  position: relative; min-height: 0; overflow: hidden; background: #000;
  display: grid; place-items: center;
}
.cadre-camera .vide { color: #C9D2CC; }
/* ce qu'on voit est ce qui est enregistré : l'image entière, sans recadrage */
.apercu-camera { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.pied-enregistrement {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; justify-items: center;
  padding: 1rem 1.5rem calc(1rem + var(--safe-bottom));
}
.place-icone { min-width: 56px; min-height: 56px; display: grid; place-items: center; }
/* les icônes prennent le texte du fond (--sur-nuit), comme les pastilles de
   l'écran d'appel : jamais de blanc en dur, invisible sur une charte claire */
.icone-enreg {
  width: 56px; height: 56px; border-radius: 50%; padding: 0;
  background: color-mix(in srgb, var(--sur-nuit) 16%, transparent); color: var(--sur-nuit);
  display: grid; place-items: center;
}
.icone-enreg svg { width: 26px; height: 26px; }
.icone-enreg:disabled { opacity: .4; }
/* le bouton du milieu : un anneau à la couleur du texte, rond rouge pour
   démarrer, carré pour arrêter */
.icone-enreg.principal {
  width: 78px; height: 78px; background: transparent; border: 4px solid var(--sur-nuit);
}
.icone-enreg.principal.valider { background: var(--pine); color: var(--sur-pine); }
.icone-enreg.principal.valider svg { width: 36px; height: 36px; }
.pastille-rec { width: 58px; height: 58px; border-radius: 50%; background: #E0453A; }
.carre-stop { width: 30px; height: 30px; border-radius: 7px; background: #E0453A; }
/* la toile enregistrée reste dans la page (certains navigateurs n'en capturent
   rien sinon), sans se voir */
.toile-cachee { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }

/* vocal : la photo du résident, entourée d'un anneau qui suit la voix (--niveau,
   de 0 à 1) — on sait qu'on est entendu ; puis la réécoute dessous */
.cadre-micro {
  min-height: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2rem; padding: 1rem 1.5rem;
}
.anneau-micro {
  --niveau: 0; border-radius: 50%;
  box-shadow: 0 0 0 calc(6px + var(--niveau) * 34px) rgba(244, 160, 143, .32);
  transition: box-shadow .08s linear;
}
.anneau-micro .photo-ronde.grande { width: 150px; height: 150px; font-size: 3.4rem; }
.cadre-micro audio { width: min(100%, 360px); }

/* ---------- appel ---------- */

.plein-ecran {
  position: fixed; inset: 0; z-index: 40; background: var(--nuit); color: var(--sur-nuit);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1.4rem; padding: 2rem 1.5rem calc(2rem + var(--safe-bottom)); text-align: center;
}
.plein-ecran h1 { font-size: 1.7rem; }
.plein-ecran .provenance { opacity: .8; }
.sonne-photo { animation: sonnerie 1.2s ease-in-out infinite; }
@keyframes sonnerie { 0%,100% { transform: scale(1); } 50% { transform: scale(1.07); } }
.boutons-appel { display: flex; gap: 1rem; width: 100%; max-width: 380px; }
.boutons-appel .btn { flex: 1; padding: 1rem; }
.duree-appel { font-variant-numeric: tabular-nums; font-size: 1.2rem; opacity: .85; }

/* Écran d'appel : un en-tête ramassé, l'image (ou la mosaïque) qui prend toute
   la hauteur libre, une rangée de pastilles dessous. */
.plein-ecran.appel-visio {
  justify-content: flex-start; gap: .6rem;
  padding: calc(.6rem + env(safe-area-inset-top, 0px)) .6rem calc(.8rem + var(--safe-bottom));
}
.entete-appel {
  width: 100%; max-width: 560px; padding: 0 .3rem; text-align: left;
  display: flex; flex-direction: column; gap: .05rem;
}
.entete-appel .ligne-titre { display: flex; align-items: baseline; gap: .6rem; }
.appel-visio .entete-appel h1 {
  flex: 1; min-width: 0; font-size: 1.15rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.appel-visio .duree-appel { font-size: .95rem; }
.appel-visio .provenance { font-size: .85rem; line-height: 1.3; }
.appel-visio .on-appelle { font-size: .85rem; line-height: 1.3; }
.appel-visio .boutons-appel { flex: 0 0 auto; }
.appel-visio .lien-discret { margin-top: 0; }

/* Cadre vidéo : la photo occupe le cadre tant qu'aucune image n'arrive —
   jamais de rectangle noir en attendant (§8.1). */
.zone-video-app {
  position: relative; overflow: hidden;
  width: 100%; max-width: 560px; flex: 1 1 auto; min-height: 0;
  border-radius: 16px; background: #0E1A14;
}
.zone-video-app .visio-scene { position: absolute; inset: 0; }
.zone-video-app .visio-attente {
  position: absolute; inset: 0; display: grid; place-items: center;
}
.zone-video-app .visio-attente[hidden] { display: none; }
/* auto-vue : assez grande pour vérifier son cadrage, jamais au centre */
.zone-video-app .visio-vignette {
  position: absolute; right: .6rem; top: .6rem; width: 28%; aspect-ratio: 3/4;
  border-radius: 10px; overflow: hidden; background: #08100C;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .4);
}
.zone-video-app .visio-vignette:empty { display: none; }

/* Une rangée de pastilles : micro, caméra, « ＋ », puis raccrocher, en rouge
   et un peu à l'écart (§6.2.2). */
.barre-appel {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
  gap: .9rem; width: 100%;
}
.commandes-visio { display: flex; align-items: center; gap: .9rem; }
.commandes-visio[hidden] { display: none; }
.rond-appel {
  width: 54px; height: 54px; border-radius: 50%; font-size: 1.35rem;
  background: color-mix(in srgb, var(--sur-nuit) 16%, transparent); color: var(--sur-nuit);
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.rond-appel[hidden] { display: none; }
.rond-appel.coupe { background: var(--brick); }
.rond-appel:active { transform: scale(.95); }
.rond-appel.ajout { font-size: 1.7rem; font-weight: 700; }
.rond-appel.raccrocher {
  width: 64px; height: 64px; margin-left: .6rem; font-size: 1.6rem;
  background: var(--brick);
}

/* ---------- appel à plusieurs (§2.3) ---------- */

/* les proches ajoutés dont le téléphone sonne encore */
.plein-ecran .on-appelle { color: #F4D58D; font-weight: 700; }
.nuit-claire .plein-ecran .on-appelle { color: #6A4000; }
.plein-ecran .on-appelle[hidden] { display: none; }

/* la feuille « Ajouter des proches », par-dessus l'écran d'appel, claire */
.plein-ecran.feuille-ajout {
  z-index: 45; background: var(--paper); color: var(--ink);
  justify-content: flex-start; overflow-y: auto; text-align: left;
  padding-top: calc(1.5rem + env(safe-area-inset-top, 0px));
}
.feuille-ajout h2 { font-size: 1.4rem; align-self: stretch; }
/* réponse rapide de l'accueil, à la fin d'un appel (Vues.reponseAccueil) */
.reponse-accueil { justify-content: center; text-align: center; gap: 1.4rem; }
.reponse-tete { display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.reponse-tete h2 { align-self: center; }
.reponse-picto {
  width: 4.5rem; height: 4.5rem; border-radius: 50%; display: grid; place-items: center;
  font-size: 2.2rem; background: var(--card); border: 1px solid var(--line);
}
.reponse-texte { font-size: 1.35rem; line-height: 1.4; margin: 0; }
.feuille-ajout > * { width: 100%; max-width: 420px; }
.aide-ajout { margin: -.6rem 0 0; color: var(--ink-soft); font-size: .9rem; }
.liste-proches { display: flex; flex-direction: column; gap: .6rem; }
.ligne-proche {
  display: flex; align-items: center; gap: .8rem;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .7rem .9rem; cursor: pointer;
}
.ligne-proche input { width: 24px; height: 24px; accent-color: var(--pine); flex: 0 0 auto; }
.ligne-proche .photo-ronde { width: 44px; height: 44px; font-size: 1.2rem; flex: 0 0 auto; }
.ligne-proche .qui { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.ligne-proche .qui span { font-size: .85rem; color: var(--ink-soft); }
.ligne-proche .etat-proche { font-size: .8rem; font-weight: 700; color: var(--ink-soft); }
.ligne-proche .etat-proche.dispo { color: #1E7A34; }
.ligne-proche.grise { opacity: .55; cursor: default; }
.feuille-ajout .lien-discret { margin-top: 0; align-self: center; width: auto; }

/* « Appel à plusieurs en cours — Rejoindre » : au-dessus des onglets, tant
   que l'appel dure ; les messages éphémères passent au-dessus de lui */
#groupe-root {
  position: fixed; left: 0; right: 0; z-index: 30;
  bottom: calc(66px + var(--safe-bottom)); padding: 0 .75rem;
  pointer-events: none;
}
.bandeau-groupe {
  pointer-events: auto; max-width: 560px; margin: 0 auto;
  display: flex; align-items: center; gap: .7rem;
  background: var(--honey); color: #fff; border-radius: var(--radius);
  padding: .6rem .7rem .6rem .9rem; box-shadow: 0 6px 20px rgba(33, 43, 37, .25);
}
.bandeau-groupe .picto { font-size: 1.4rem; }
.bandeau-groupe .texte { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.bandeau-groupe .texte span { font-size: .85rem; opacity: .95; }
.bandeau-groupe .btn { background: #fff; color: var(--pine-dark); padding: .6rem 1rem; }
body.avec-groupe main.contenu { padding-bottom: calc(150px + var(--safe-bottom)); }
body.avec-groupe #toast-root { bottom: calc(140px + var(--safe-bottom)); }

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

.plein-centre { min-height: 100dvh; display: grid; place-items: center; padding: 1.2rem; }
.boite-auth { width: 100%; max-width: 420px; }
.boite-auth .marque { text-align: center; margin-bottom: 1.2rem; }
.boite-auth .marque img { width: 64px; height: 64px; border-radius: 16px; }
/* écran d'un seul message (mauvais compte, aucun résident) : ses sorties */
.message-plein .message-titre { font-weight: 700; font-size: 1.1rem; margin: 0 0 .5rem; }
.message-plein p.petit { margin: 0; line-height: 1.45; }
.message-plein .actions-carte { margin-top: 1rem; }
.auth-onglets { display: flex; gap: .5rem; margin-bottom: .9rem; }
.auth-onglets button { flex: 1; border: 1px solid var(--line); background: var(--card); padding: .55rem; border-radius: 10px; font-weight: 700; color: var(--ink-soft); }
.auth-onglets button.actif { background: var(--pine); border-color: var(--pine); color: var(--sur-pine); }

/* Passer sur téléphone (§6.2.1) : proposé seulement sur grand écran, où
   l'invitation vient d'être lue dans une boîte mail. */
.qr-telephone {
  display: flex; align-items: center; gap: .9rem; margin-top: .9rem;
}
.qr-telephone svg { flex: 0 0 auto; width: 92px; height: 92px; border-radius: 6px; }
.qr-titre { font-weight: 700; margin: 0 0 .15rem; }
.qr-detail { margin: 0; color: var(--ink-soft); font-size: .85rem; line-height: 1.45; }

label.champ { display: block; margin-bottom: .85rem; }
label.champ > span { display: block; font-weight: 700; font-size: .85rem; margin-bottom: .3rem; }
input, textarea {
  width: 100%; padding: .7rem .8rem; font: inherit; border: 1px solid var(--line);
  border-radius: 10px; background: #FDFDFB; color: var(--ink);
}

.etape-install { text-align: center; }
.etape-install ol { text-align: left; padding-left: 1.4rem; }
.etape-install li { margin-bottom: .5rem; }
.lien-discret { background: none; color: var(--ink-soft); text-decoration: underline; font-size: .85rem; margin-top: 1rem; }

/* ---------- procédure « Préparer cet appareil » (procedure.js) ---------- */

.procedure h1 { font-size: 1.45rem; margin: .4rem 0 .6rem; }
.procedure > p { margin: 0 0 .9rem; }
.procedure .grand-picto { font-size: 2.6rem; line-height: 1; margin-bottom: .3rem; }
.procedure .petit, p.petit { font-size: .85rem; color: var(--ink-soft); }
.procedure .carte { text-align: left; }
.etapes-indicateur {
  list-style: none; padding: 0; margin: 0 0 1.2rem;
  display: flex; justify-content: center; gap: .3rem;
}
.etapes-indicateur li {
  display: flex; flex-direction: column; align-items: center; gap: .2rem;
  font-size: .72rem; font-weight: 700; color: var(--ink-soft); flex: 1; max-width: 6rem;
}
.etapes-indicateur .rond {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--card); border: 2px solid var(--line); font-size: .8rem;
}
.etapes-indicateur li.actuelle { color: var(--pine-encre); }
.etapes-indicateur li.actuelle .rond { border-color: var(--pine-encre); color: var(--pine-encre); }
.etapes-indicateur li.faite .rond { background: var(--pine); border-color: var(--pine); color: var(--sur-pine); }
ol.consignes { list-style: none; padding: 0; margin: 0; display: grid; gap: .8rem; text-align: left; }
.consigne { display: grid; grid-template-columns: 40px 1fr; gap: .7rem; align-items: start; }
.consigne .detail { font-size: .85rem; color: var(--ink-soft); }
.illustration {
  width: 40px; height: 40px; padding: 7px; border-radius: 10px;
  background: var(--sage); color: var(--pine-dark);
}
span.illustration.vide { background: none; }
.encadre-email {
  background: var(--honey-soft); border: 1px solid #EAD6A8; border-radius: 12px;
  padding: .75rem .9rem; margin: 0 0 1rem; font-size: .9rem; text-align: left;
}
.adresse-copie { display: flex; gap: .5rem; margin: 0 0 .8rem; }
.adresse-copie input { flex: 1; font-size: .85rem; }
.adresse-copie .btn { flex: 0 0 auto; padding: .6rem .8rem; font-size: .9rem; }
.zone-test { margin: .6rem 0; }
.compte-a-rebours {
  font-family: var(--font-display); font-size: 3.2rem; font-weight: 700;
  color: var(--pine-encre); font-variant-numeric: tabular-nums; margin: .4rem 0;
}
.pied-procedure { display: flex; flex-direction: column; align-items: center; gap: .1rem; margin-top: .4rem; }
.pied-procedure .lien-discret { margin-top: .6rem; }

/* page d'atterrissage : sortir d'un navigateur intégré (atterrissage.js) */
.atterrissage .sortie-seconde { width: 100%; margin-top: .6rem; }
.sortie-manuelle { margin: 1rem 0 .8rem; }
.sortie-retour { margin: .7rem 0 0; font-weight: 700; color: var(--pine-encre); }
.encart-appli p { margin: 0 0 .7rem; font-size: .92rem; }

/* tutoriel animé « Sur l'écran d'accueil » (tutoriel.js). Les couleurs de
   l'interface d'iOS sont celles du système dessiné, pas du thème ; le
   soulignement suit le thème. */
.tuto-scene { display: flex; justify-content: center; margin: 0 0 1rem; }
.tuto-scene .tuto-dessin { width: min(62vw, 210px); height: auto; }
.tuto-vignettes {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  gap: .5rem; margin: 0 0 1rem;
}
.tuto-vignettes .tuto-dessin { width: 100%; height: auto; }
.tuto-legende { text-align: center; margin: -.4rem 0 .9rem; }
.tuto ol.consignes li { border-radius: 10px; padding: .25rem; margin: -.25rem; transition: background .3s; }
.tuto ol.consignes li.en-cours { background: var(--sage); }
.tuto-dessin {
  --tuto-bleu: #007AFF; --tuto-noir: #1C1C1E; --tuto-gris: #8E8E93;
  --tuto-trait: #D1D1D6; --tuto-fond: #F2F2F7;
  font-family: -apple-system, system-ui, sans-serif;
}
.tuto-dessin text { font-size: 8px; fill: var(--tuto-noir); }
.tuto-dessin .t-heure { font-size: 7px; font-weight: 700; }
.tuto-dessin .t-titre { font-size: 10px; font-weight: 700; }
.tuto-dessin .t-url { font-size: 7px; fill: #3C3C43; }
.tuto-dessin .t-gras { font-weight: 700; }
.tuto-dessin .t-gris { font-size: 6px; fill: var(--tuto-gris); }
.tuto-dessin .t-lien { fill: var(--tuto-bleu); }
.tuto-dessin .t-ligne-menu { font-size: 7.5px; }
.tuto-dessin .t-nom-icone { font-size: 6px; fill: #FFFFFF; }
.tuto-dessin .t-ligne { fill: #E5E5EA; }
.tuto-dessin .t-bloc { fill: var(--tuto-fond); }
.tuto-dessin .t-fond-barre { fill: #F7F7F7; stroke: var(--tuto-trait); stroke-width: .5; }
.tuto-dessin .t-adresse { fill: #E5E5EA; }
.tuto-dessin .t-pastille { fill: #F7F7F7; stroke: var(--tuto-trait); stroke-width: .6; }
.tuto-dessin .t-bord { stroke: var(--tuto-trait); stroke-width: .6; }
.tuto-dessin .t-picto { fill: none; stroke: var(--tuto-bleu); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tuto-dessin .t-menu .t-picto, .tuto-dessin .t-feuille .t-picto { stroke: var(--tuto-noir); }
.tuto-dessin .t-trait-bleu, .tuto-dessin .t-trait-noir {
  fill: none; stroke: var(--tuto-bleu); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
.tuto-dessin .t-trait-noir { stroke: var(--tuto-noir); }
.tuto-dessin .t-pale { opacity: .35; }
.tuto-dessin .t-plein-noir { fill: var(--tuto-noir); }
.tuto-dessin .t-fond-feuille { fill: var(--tuto-fond); }
.tuto-dessin .t-rond { fill: var(--tuto-trait); }
.tuto-dessin .t-cible { fill: var(--honey-soft); stroke: var(--honey); stroke-width: 1; }
.tuto-dessin .t-interrupteur { fill: #34C759; }
.tuto-dessin .t-fond-accueil { fill: #6F8FA8; }
.tuto-dessin .t-case { fill: rgba(255, 255, 255, .45); }
.tuto-dessin .t-dock { fill: rgba(255, 255, 255, .3); }
.tuto-dessin .t-voile { fill: #000000; }
.tuto-dessin .t-cadre { fill: var(--tuto-noir); }
.tuto-dessin .t-pulpe { fill: rgba(28, 28, 30, .3); stroke: #FFFFFF; stroke-width: 2; }
.tuto-dessin .t-onde { fill: none; stroke: var(--honey); stroke-width: 2.5; opacity: 0; }
/* les vues : chaque étape montre ses calques */
.tuto-dessin .t-menu, .tuto-dessin .t-voile, .tuto-dessin .t-feuille,
.tuto-dessin .t-dialogue, .tuto-dessin .t-accueil {
  opacity: 0; transition: opacity .45s ease, transform .45s ease;
}
.tuto-dessin .t-feuille { transform: translateY(230px); }
.tuto-dessin[data-vue="menu"] .t-menu { opacity: 1; }
.tuto-dessin[data-vue="feuille"] .t-voile { opacity: .25; }
.tuto-dessin[data-vue="feuille"] .t-feuille { opacity: 1; transform: none; }
.tuto-dessin[data-vue="dialogue"] .t-dialogue,
.tuto-dessin[data-vue="accueil"] .t-accueil { opacity: 1; }
/* iPad : la feuille s'ouvre en bulle sous le bouton Partager, sans glisser */
.tuto-dessin.v-ipad .t-feuille,
.tuto-dessin.v-ipad[data-vue="feuille"] .t-feuille { transform: translate(52px, -48px) scale(.7); }
.tuto-dessin .t-doigt { transition: transform .8s cubic-bezier(.4, 0, .2, 1); }
.tuto-dessin .t-onde, .tuto-dessin .t-nouvelle { transform-box: fill-box; transform-origin: center; }
.tuto-dessin.tape .t-onde { animation: tuto-onde .6s ease-out; }
.tuto-dessin[data-vue="accueil"] .t-nouvelle { animation: tuto-pop .55s ease-out both; }
@keyframes tuto-onde { from { opacity: .9; transform: scale(.5); } to { opacity: 0; transform: scale(1.8); } }
@keyframes tuto-pop { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: scale(1); } }
/* vignettes fixes : rien ne bouge, le toucher se voit en anneau */
.tuto-dessin.fige * { transition: none !important; }
.tuto-dessin.fige .t-onde { opacity: .9; }
@media print { .tuto-scene, .tuto-vignettes, .tuto-legende { display: none; } }

/* rappels de l'Accueil : appareil pas prêt, proche indisponible */
.bandeau-appareil, .bandeau-indisponible { background: var(--honey-soft); border-color: #EAD6A8; }
.bandeau-appareil p, .bandeau-indisponible p { margin: 0 0 .7rem; font-size: .92rem; }
.bandeau-appareil .actions { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
.bandeau-appareil .actions .lien-discret { margin-top: 0; }

/* carte « Appels sur cet appareil » des Réglages */
.liste-controle { list-style: none; padding: 0; margin: .8rem 0; display: grid; gap: .45rem; font-size: .9rem; }
.liste-controle li { display: flex; gap: .55rem; align-items: baseline; }
.liste-controle .marque { width: 1.2rem; font-weight: 700; text-align: center; flex: 0 0 auto; }
.liste-controle li.ok .marque { color: #2F8A55; }
.liste-controle li.ko .marque { color: var(--brick); }
.liste-controle li.neutre .marque { color: var(--ink-soft); }
.liste-controle .detail { color: var(--ink-soft); }
.actions-carte { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.actions-carte .lien-discret { margin-top: 0; }

/* l'accueil (onglet Résidence) : l'appeler quand quelqu'un y est */
.carte-accueil h3 { margin: 0 0 .25rem; }
.carte-accueil .btn.geant { margin-top: .9rem; }
.carte-accueil p.petit { margin: .8rem 0 0; }
.carte-accueil a { color: var(--pine-dark); font-weight: 700; white-space: nowrap; }
/* coordonnées de la résidence (onglet Résidence) : téléphone et e-mail se
   touchent, seul moyen de la joindre sans Accueil Visio */
.coordonnees { font-size: .85rem; color: var(--ink-soft); }
.coordonnees a { color: var(--pine-dark); font-weight: 700; white-space: nowrap; }

/* dates importantes (onglet Résidence) : + pour en ajouter, ✕ pour retirer les siennes */
.tete-carte { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .4rem; }
.btn-plus {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%;
  background: var(--pine); color: var(--sur-pine); font-size: 1.5rem; font-weight: 700; line-height: 1;
}
.carte-dates .fil-evenement { align-items: center; }
.carte-dates .fil-evenement > span:first-child { flex: 1; }
.retirer-date {
  flex: 0 0 auto; min-width: 32px; height: 32px; padding: 0 .55rem; border-radius: 999px;
  background: var(--sage); color: var(--pine-dark); font-size: .8rem; font-weight: 700;
}
.retirer-date.arme { background: var(--brick); color: #fff; }
.formulaire-date { border-bottom: 1px solid var(--line); padding-bottom: .9rem; margin-bottom: .3rem; }
.choix-date { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-bottom: .85rem; }
.choix-date .btn { padding: .65rem .5rem; font-size: .92rem; }
.formulaire-date .petit { margin: -.3rem 0 .85rem; }

/* ---------- divers ---------- */

.vide { color: var(--ink-soft); text-align: center; padding: 1.4rem 0; }
.tag { display: inline-block; border-radius: 999px; padding: .1rem .6rem; font-size: .78rem; font-weight: 700; }
.tag.vert { background: var(--sage); color: var(--pine-dark); }
.tag.miel { background: var(--honey-soft); color: #7A5314; }
.tag.gris { background: #E9E9E4; color: var(--ink-soft); }

#toast-root { position: fixed; bottom: calc(86px + var(--safe-bottom)); left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: .5rem; width: max-content; max-width: 92vw; }
.toast { background: var(--ink); color: #F6F4EE; border-radius: 999px; padding: .55rem 1.1rem; font-size: .9rem; box-shadow: var(--shadow); text-align: center; }
.toast.erreur { background: var(--brick); }

/* Téléphone tourné à l'horizontale (App.figerPortrait) : par-dessus tout,
   recadrage photo compris, aux couleurs de l'écran d'appel. Le téléphone se
   redresse sous les yeux : on comprend le geste sans lire. */
#tournez {
  position: fixed; inset: 0; z-index: 3000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1rem; padding: 1.5rem; text-align: center;
  background: var(--nuit); color: var(--sur-nuit);
  font-family: var(--font-display); font-size: 1.3rem; font-weight: 700;
}
#tournez[hidden] { display: none; }
#tournez p { margin: 0; }
.tournez-picto { font-size: 3.5rem; line-height: 1; animation: redresser 2.4s ease-in-out infinite; }
@keyframes redresser { 0%, 25% { transform: rotate(-90deg); } 60%, 100% { transform: rotate(0); } }

/* ---------- mode résident (vues-resident.js, migration 0045) ---------- */

/* l'Accueil : ses proches en cartes, deux par ligne sur un téléphone */
.grille-proches { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: .7rem; }
.carte-proche {
  display: flex; flex-direction: column; align-items: center; gap: .25rem;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .9rem .5rem .8rem; color: var(--ink); text-align: center; min-width: 0;
}
.carte-proche:active { background: var(--sage); }
.carte-proche strong { font-family: var(--font-display); font-size: 1.05rem; }
.carte-proche .lien { font-size: .8rem; color: var(--ink-soft); }
.carte-proche .statut { font-size: .78rem; margin-top: .15rem; }
.photo-proche { position: relative; display: inline-block; line-height: 0; }
.carte-proche .photo-ronde { width: 72px; height: 72px; font-size: 1.8rem; }
.photo-proche .pastille {
  position: absolute; top: -4px; right: -6px;
  background: var(--brick); color: #fff; border-radius: 999px;
  min-width: 20px; height: 20px; font-size: .72rem; line-height: 1;
  display: grid; place-items: center; padding: 0 5px; box-shadow: 0 0 0 2px var(--card);
}

/* la feuille d'un proche : l'appeler ou lui écrire */
.feuille-proche { align-items: center; text-align: center; }
.feuille-proche h2 { align-self: center; text-align: center; margin: 0; }
.feuille-proche .aide-ajout { margin: -.4rem 0 0; text-align: center; }
.feuille-proche .apercu-photo { display: grid; place-items: center; }
.feuille-proche .apercu-photo .photo-ronde.grande { width: 140px; height: 140px; font-size: 3rem; }
.feuille-proche .statut { width: auto; }
.feuille-proche .petit { text-align: center; margin: -.3rem 0 0; }

/* « Il s'est passé quoi ? » : un événement s'ouvre d'un toucher */
button.fil-evenement.ouvrable {
  width: 100%; background: none; color: inherit; text-align: left;
  border-radius: 0; padding: .45rem 0;
}
button.fil-evenement.ouvrable span:first-child { flex: 1; }

/* Messages : l'en-tête et, dessous, la photo de chaque proche — comme la
   barre des onglets, celui dont on lit la conversation est une touche
   claire, soulignée d'un trait foncé */
.entete-fixe { position: sticky; top: 0; z-index: 20; }
.entete-fixe .entete { position: static; }
.bandeau-proches {
  display: flex; overflow-x: auto; background: var(--pine);
  border-top: 1px solid color-mix(in srgb, var(--sur-pine) 15%, transparent);
  scrollbar-width: none;
}
.bandeau-proches::-webkit-scrollbar { display: none; }
.bandeau-proches button {
  position: relative; flex: 1 0 4.6rem; max-width: 7rem;
  display: flex; flex-direction: column; align-items: center; gap: .2rem;
  background: none; padding: .5rem .3rem .55rem; font-size: .75rem; font-weight: 700;
  color: color-mix(in srgb, var(--sur-pine) 80%, transparent);
  transition: background-color .15s, color .15s;
}
.bandeau-proches button:not(.actif) .photo-ronde { opacity: .8; }
.bandeau-proches button:active { background: var(--pine-survol); }
.bandeau-proches button.actif { background: var(--paper); color: var(--pine-dark); }
.bandeau-proches button.actif::after {
  content: ""; position: absolute; bottom: 0; left: 0; right: 0; height: 4px;
  background: var(--pine-dark);
}
.bandeau-proches .nom { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bandeau-proches .photo-proche .pastille { box-shadow: 0 0 0 2px var(--pine); }
.bandeau-proches button.actif .photo-proche .pastille { box-shadow: 0 0 0 2px var(--paper); }

/* appel pendant un appel, sur le téléphone du résident : par-dessus
   l'écran d'appel, en haut */
.appel-en-attente {
  position: absolute; top: calc(.6rem + env(safe-area-inset-top, 0px)); left: .6rem; right: .6rem;
  z-index: 5; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  background: var(--card); color: var(--ink); border-radius: var(--radius);
  padding: .6rem .8rem; box-shadow: 0 6px 24px rgba(0,0,0,.35);
}
.appel-en-attente .texte { flex: 1; font-weight: 700; min-width: 8rem; }
.appel-en-attente .btn { padding: .45rem .8rem; font-size: .9rem; }

/* un mot « J'ai lu » de l'accueil, dans le fil du Secrétariat */
.bulle.mot-accueil { background: var(--honey-soft); border-color: #EAD6A8; }
.bulle.mot-accueil .titre-mot { font-size: .8rem; font-weight: 700; color: #6A5310; margin-bottom: .25rem; }
.bulle.mot-accueil .meta { align-items: center; }
.bulle .jai-lu { padding: .35rem .9rem; font-size: .85rem; white-space: nowrap; }

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

/* ---------- photos d'une diffusion (onglet Résidence, migration 0049) ---------- */

.carte .affiche-diffusion { display: block; max-width: 100%; border-radius: 10px; cursor: zoom-in; }
.carte .voir-photos { width: 100%; margin-top: .7rem; }
/* la photo en grand, sur fond de nuit : rien d'autre à l'écran */
.plein-ecran.galerie-diffusion { justify-content: flex-start; gap: .8rem; padding-top: calc(1rem + env(safe-area-inset-top, 0px)); }
.galerie-tete { width: 100%; display: flex; align-items: center; gap: .8rem; text-align: left; }
.galerie-tete h2 {
  flex: 1; min-width: 0; font-size: 1.15rem; margin: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.galerie-compteur { flex: none; opacity: .75; font-variant-numeric: tabular-nums; }
.galerie-fermer {
  flex: none; width: 44px; height: 44px; border-radius: 50%; font-size: 1.2rem;
  background: rgba(255, 255, 255, .14); color: inherit;
}
.galerie-scene {
  position: relative; flex: 1; min-height: 0; width: 100%;
  display: flex; align-items: center; justify-content: center; touch-action: pan-y;
}
.galerie-image { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.galerie-fleche {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 1;
  width: 48px; height: 48px; border-radius: 50%; font-size: 2rem; line-height: 1;
  background: rgba(0, 0, 0, .38); color: #fff;
}
.galerie-fleche.precedente { left: .2rem; }
.galerie-fleche.suivante { right: .2rem; }
.galerie-fleche[hidden] { display: none; }
.galerie-pied { width: 100%; max-width: 420px; }
/* la feuille « Envoyer à… », par-dessus la galerie */
.feuille-ajout .ligne-proche { width: 100%; text-align: left; font: inherit; color: inherit; }
