/* Lilou : feuille de style de l'application installable du volet court terme.
   Aucun style en ligne dans la page : la CSP n'autorise que ce fichier (style-src 'self') ; les barres
   du planning se placent par classes (debut-N, fin-N, voie-N), jamais par un style calculé.
   Reprend les composants de l'ERP (apps/erp/public/style.css) avec les couleurs de Lilou : vert calme
   (#2f5d50) sur fond chaud (#f7f4ef). Téléphone d'abord : onglets en barre du bas jusqu'à 768 px,
   sous l'en-tête au-delà. Ordre : 1. variables (clair, sombre) ; 2. base et en-tête ; 3. onglets ;
   4. composants communs ; 5. un bloc par écran. */
:root {
  --fond: #f7f4ef;
  --surface: #ffffff;
  --surface-douce: #fbf9f5;
  --texte: #1f2a27;
  --texte-doux: #5a6662;      /* 5,9:1 sur la surface, 5,4:1 sur le fond (AA) */
  --bordure: #e4dfd6;
  --bordure-forte: #cfc8bb;
  --bordure-champ: #8b928d;   /* champs de saisie : 3:1 sur la surface (WCAG 1.4.11) */
  --marque: #2f5d50;          /* 7,5:1 avec le blanc */
  --marque-texte: #ffffff;
  --marque-douce: #e3ede8;
  --barre: #2f5d50;
  --barre-texte: #ffffff;
  --anneau: #1d5fa8;          /* contour du focus clavier */
  --vert: #1f7a4a;
  --rouge: #b3362a;
  --orange: #9a5400;
  --bleu: #1d5fa8;
  --jaune-fond: #fdf3dc;
  --sejour-fond: #d8e8e1;
  --sejour-bord: #2f5d50;
  --fin-semaine: #f3eee5;
  --rayon: 12px;
  --ombre-flottante: 0 10px 28px rgba(31, 42, 39, .16), 0 2px 6px rgba(31, 42, 39, .08);
  --haut-barre: 52px;
  --haut-onglets: 60px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fond: #121816;
    --surface: #1b2421;
    --surface-douce: #1f2926;
    --texte: #e8eeeb;
    --texte-doux: #a2b0aa;
    --bordure: #2b3633;
    --bordure-forte: #3d4a46;
    --bordure-champ: #6f7d78;
    --marque: #8cc4b0;
    --marque-texte: #0f1714;
    --marque-douce: #23342f;
    --barre: #10201b;
    --barre-texte: #e8eeeb;
    --anneau: #8cc4b0;
    --vert: #5cc48c;
    --rouge: #ef7b6c;
    --orange: #f0a952;
    --bleu: #7fb2f0;
    --jaune-fond: #3a3018;
    --sejour-fond: #27443b;
    --sejour-bord: #8cc4b0;
    --fin-semaine: #1f2926;
    --ombre-flottante: 0 10px 28px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body { min-height: 100vh; min-height: 100dvh; }
a { color: var(--bleu); }

.cache { display: none !important; }
[hidden] { display: none !important; }

svg.icone {
  flex: 0 0 auto; width: 22px; height: 22px;
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}

.evitement {
  position: absolute; left: 8px; top: -60px; z-index: 20; padding: 8px 12px; border-radius: 8px;
  background: var(--surface); color: var(--texte); font-weight: 600;
}
.evitement:focus { top: 8px; }

/* ---------------------------------------------------------------------------
   En-tête
   --------------------------------------------------------------------------- */
header.barre {
  position: sticky; top: 0; z-index: 7;
  display: flex; align-items: center; gap: 10px;
  min-height: var(--haut-barre); padding: 0 16px; padding-top: env(safe-area-inset-top);
  background: var(--barre); color: var(--barre-texte);
}
header.barre h1 { margin: 0; font-size: 18px; font-weight: 800; min-width: 0; line-height: 1.15; letter-spacing: .2px; }
header.barre h1 small {
  display: block; max-width: 220px; font-size: 11.5px; font-weight: 500; opacity: .85;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
header.barre .qui { font-size: 13px; opacity: .85; max-width: 26vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
header.barre button, header.barre select {
  background: transparent; color: inherit; border: 1px solid rgba(255, 255, 255, .35); border-radius: 8px;
  padding: 5px 10px; font-size: 13.5px; width: auto; min-height: 34px;
}
header.barre button:hover, header.barre select:hover { background: rgba(255, 255, 255, .1); }
header.barre select option { color: var(--texte); background: var(--surface); }
header.barre select { max-width: 200px; text-overflow: ellipsis; }
header.barre :focus-visible { outline: 2px solid #ffffff; outline-offset: 2px; }
header.barre .bouton-icone { display: inline-flex; align-items: center; justify-content: center; padding: 4px 7px; }
header.barre .bouton-icone svg.icone { width: 20px; height: 20px; }
header.barre:has(#choix-societe:not(.cache)) h1 small { display: none; }
.barre-droite { display: flex; gap: 8px; align-items: center; min-width: 0; margin-left: auto; }

/* ---------------------------------------------------------------------------
   Onglets : barre du bas (téléphone), sous l'en-tête (grand écran)
   --------------------------------------------------------------------------- */
nav.onglets { display: flex; background: var(--surface); }
nav.onglets button.onglet {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  flex: 1 1 0; min-width: 0; min-height: var(--haut-onglets); padding: 6px 2px;
  border: 0; background: transparent; color: var(--texte-doux); font-size: 11.5px; font-weight: 500;
}
nav.onglets button.onglet:hover { color: var(--texte); }
nav.onglets button.onglet[aria-current="page"] { color: var(--marque); font-weight: 700; }
nav.onglets .onglet-nom { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

@media (max-width: 768px) {
  nav.onglets {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
    border-top: 1px solid var(--bordure); padding-bottom: env(safe-area-inset-bottom);
  }
  nav.onglets button.onglet[aria-current="page"] svg.icone { stroke-width: 2.2; }
  body:has(nav.onglets:not(.cache)) main { padding-bottom: calc(var(--haut-onglets) + 28px + env(safe-area-inset-bottom)); }
  header.barre .qui { display: none; }
}
@media (min-width: 769px) {
  nav.onglets {
    position: sticky; top: var(--haut-barre); z-index: 6; justify-content: center; gap: 4px;
    border-bottom: 1px solid var(--bordure); padding: 0 16px;
  }
  nav.onglets button.onglet {
    flex: 0 0 auto; flex-direction: row; gap: 8px; min-height: 48px; padding: 0 16px;
    font-size: 14.5px; border-bottom: 2px solid transparent; margin-bottom: -1px;
  }
  nav.onglets button.onglet svg.icone { width: 19px; height: 19px; }
  nav.onglets button.onglet[aria-current="page"] { border-bottom-color: var(--marque); }
}

main { display: block; margin: 0 auto; padding: 18px 16px 40px; max-width: 1100px; outline: none; }

/* ---------------------------------------------------------------------------
   Composants communs (repris de l'ERP)
   --------------------------------------------------------------------------- */
.carte {
  background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon);
  padding: 16px 18px; margin-bottom: 14px;
}
.carte.etroite { max-width: 440px; margin: 28px auto; }

h2 { font-size: 20px; font-weight: 700; margin: 0 0 12px; }
h3 { font-size: 15.5px; font-weight: 650; margin: 18px 0 8px; }
label { display: block; font-weight: 600; font-size: 13px; margin: 10px 0 4px; color: var(--texte-doux); }

input, select, textarea {
  width: 100%; font: inherit; font-size: 16px; padding: 8px 10px;   /* 16 px : pas de zoom automatique sur iOS */
  border: 1px solid var(--bordure-champ); border-radius: 9px; background: var(--surface); color: var(--texte);
}
textarea { resize: vertical; }
:focus-visible { outline: 2px solid var(--anneau); outline-offset: 2px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--anneau); outline-offset: 0; border-color: var(--anneau); }
button { font: inherit; cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }

.bouton {
  display: inline-block; padding: 8px 15px; border: 1px solid transparent; border-radius: 9px; min-height: 40px;
  font-size: 15px; font-weight: 600; line-height: 1.35; background: var(--marque); color: var(--marque-texte);
  text-decoration: none; text-align: center;
}
.bouton:hover { background: color-mix(in srgb, var(--marque) 88%, #000); }
.bouton.secondaire { background: var(--surface); color: var(--texte); border-color: var(--bordure-forte); }
.bouton.secondaire:hover { background: var(--fond); border-color: var(--texte-doux); }
.bouton.petit { padding: 5px 11px; font-size: 13.5px; border-radius: 8px; min-height: 34px; }
.lien { background: none; border: 0; padding: 6px 0; color: var(--texte-doux); text-decoration: underline; font-size: 14px; }

.message { padding: 10px 14px; border-radius: 9px; margin: 0 0 14px; font-weight: 500; border: 1px solid transparent; overflow-wrap: anywhere; }
.message ul { margin: 6px 0 0; padding-left: 18px; }
.message.erreur { background: color-mix(in srgb, var(--rouge) 8%, var(--surface)); color: var(--rouge);
  border-color: color-mix(in srgb, var(--rouge) 28%, transparent); }
.message.info { background: color-mix(in srgb, var(--vert) 8%, var(--surface)); color: var(--vert);
  border-color: color-mix(in srgb, var(--vert) 28%, transparent); }
.message.avertissement { background: var(--jaune-fond); color: var(--orange); border-color: color-mix(in srgb, var(--orange) 28%, transparent); }

.ligne { display: flex; gap: 8px; align-items: center; }
.ligne > * { flex: 1; }
.pousse { flex: 1 1 auto; }
.espace-haut { margin-top: 12px; }
.doux { color: var(--texte-doux); font-size: 14px; }
.petit { font-size: 12.5px; }
.sans-marge { margin: 0; }
.vide { padding: 6px 0; }
.texte-libre { white-space: pre-wrap; overflow-wrap: anywhere; }
.chargement { padding: 12px 0; }
.entete-vue { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 8px; min-height: 36px; }
.entete-vue h2 { margin: 0; flex: 1 1 auto; outline: none; }
.actions-entete { display: flex; gap: 8px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.date-du-jour { margin: 0 0 10px; color: var(--texte-doux); font-size: 15px; }
.date-du-jour::first-letter { text-transform: uppercase; }
.compte { font-weight: 600; color: var(--texte-doux); font-variant-numeric: tabular-nums; }
section.bloc > h3 { display: flex; align-items: center; gap: 8px; }

.etiquette {
  display: inline-block; font-size: 12px; font-weight: 600; line-height: 1.6; padding: 0 8px; border-radius: 99px;
  background: var(--fond); border: 1px solid var(--bordure); color: var(--texte-doux); white-space: nowrap;
}
.etiquette.alerte { background: var(--jaune-fond); color: var(--orange); border-color: color-mix(in srgb, var(--orange) 30%, transparent); }
.etiquette.ok { color: var(--vert); background: color-mix(in srgb, var(--vert) 8%, var(--surface)); border-color: color-mix(in srgb, var(--vert) 30%, transparent); }
.etiquette.erreur { color: var(--rouge); background: color-mix(in srgb, var(--rouge) 7%, var(--surface)); border-color: color-mix(in srgb, var(--rouge) 30%, transparent); }
.etiquette.info { color: var(--bleu); background: color-mix(in srgb, var(--bleu) 7%, var(--surface)); border-color: color-mix(in srgb, var(--bleu) 30%, transparent); }

/* Choix « À faire / Tous », « À venir / Archives » */
.segments { display: inline-flex; border: 1px solid var(--bordure-forte); border-radius: 10px; overflow: hidden; background: var(--surface); margin: 0 0 12px; }
.segment { border: 0; background: transparent; color: var(--texte-doux); padding: 7px 14px; font-size: 14px; font-weight: 600; min-height: 36px; }
.segment + .segment { border-left: 1px solid var(--bordure-forte); }
.segment[aria-pressed="true"] { background: var(--marque); color: var(--marque-texte); }

/* Tableaux, fiches */
.tableau { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
caption { text-align: left; font-size: 13px; color: var(--texte-doux); padding: 0 0 6px; }
th, td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--bordure); vertical-align: top; }
th { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; color: var(--texte-doux); white-space: nowrap; }
td.nombre, th.nombre { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.total td { font-weight: 700; background: var(--fond); }
tr.choisie td { background: var(--marque-douce); font-weight: 600; }
dl.fiche { display: grid; grid-template-columns: minmax(110px, 34%) 1fr; gap: 6px 12px; margin: 8px 0 0; font-size: 14.5px; }
dl.fiche dt { color: var(--texte-doux); }
dl.fiche dd { margin: 0; overflow-wrap: anywhere; }

/* Fenêtres */
dialog {
  border: 1px solid var(--bordure); border-radius: var(--rayon); background: var(--surface); color: var(--texte);
  max-width: 560px; width: calc(100% - 24px); padding: 20px; max-height: 90vh; max-height: 90dvh; overflow-y: auto;
  box-shadow: var(--ombre-flottante);
}
dialog::backdrop { background: rgba(10, 14, 12, .5); }
dialog h2 { font-size: 18px; padding-right: 8px; overflow-wrap: anywhere; }

/* Connexion (lib/connexion.js) */
.qr { display: block; margin: 12px auto; background: #fff; padding: 8px; border-radius: 8px; }
code.secret { font-size: 15px; font-weight: 700; letter-spacing: 1px; word-break: break-all; }
ol.etapes { padding-left: 20px; }

/* Séjours (listes et fiche) */
.code-logement {
  display: inline-block; min-width: 52px; padding: 1px 7px; border-radius: 7px; text-align: center;
  background: var(--marque-douce); color: var(--marque); font-weight: 750; font-size: 13.5px; font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
ul.liste-sejours { list-style: none; margin: 0; padding: 0; }
ul.liste-sejours > li { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--bordure); }
ul.liste-sejours > li:last-child { border-bottom: 0; }
.ligne-sejour {
  display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0; padding: 10px 2px; min-height: 52px;
  border: 0; background: transparent; color: inherit; text-align: left;
}
.ligne-sejour:hover .voyageur { text-decoration: underline; }
.ligne-texte { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.ligne-sejour .voyageur { font-weight: 600; overflow-wrap: anywhere; }
.ligne-sejour .details { font-size: 13.5px; }
.groupe-date > h3 { display: flex; align-items: center; gap: 8px; }
.groupe-date > h3::first-letter { text-transform: uppercase; }

/* ---------------------------------------------------------------------------
   Aujourd'hui et planning
   --------------------------------------------------------------------------- */
.grille-jour { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 18px; align-items: start; }
.grille-jour section.bloc, section.bloc { background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon); padding: 4px 14px 10px; margin-bottom: 14px; }
.grille-jour section.bloc > h3, section.bloc > h3 { margin-top: 10px; }

.planning-defilement { overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
.planning-grille { min-width: 650px; }
.planning-ligne { display: flex; align-items: stretch; border-bottom: 1px solid var(--bordure); }
.planning-ligne:last-child { border-bottom: 0; }
.planning-nom {
  position: sticky; left: 0; z-index: 2; flex: 0 0 82px; display: flex; flex-direction: column; justify-content: center; gap: 3px;
  padding: 6px 6px 6px 0; background: var(--surface); border-right: 1px solid var(--bordure);
}
.planning-nom .etiquette { font-size: 10.5px; padding: 0 5px; align-self: flex-start; }
.planning-nuits {
  position: relative; flex: 1 1 auto; display: grid; grid-template-columns: repeat(14, minmax(40px, 1fr));
  grid-auto-rows: 34px; row-gap: 4px; padding: 6px 0;
  background-image: linear-gradient(to right, var(--bordure) 1px, transparent 1px); background-size: calc(100% / 14) 100%;
}
.planning-nuits::before {   /* première colonne : la nuit d'aujourd'hui */
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: calc(100% / 14);
  background: color-mix(in srgb, var(--marque) 9%, transparent); pointer-events: none;
}
.planning-entete .planning-nuits { grid-auto-rows: auto; padding: 4px 0; background-image: none; }
.planning-entete .planning-nom { background: var(--surface); }
.planning-jour { display: flex; flex-direction: column; align-items: center; font-size: 11px; line-height: 1.25; color: var(--texte-doux); }
.planning-jour .jour-num { font-size: 13.5px; font-weight: 650; color: var(--texte); font-variant-numeric: tabular-nums; }
.planning-jour.fin-semaine { background: var(--fin-semaine); border-radius: 6px; }
.planning-jour.aujourdhui .jour-num { color: var(--marque); }
.planning-jour.aujourdhui .jour-nom { color: var(--marque); font-weight: 700; }

.barre-sejour {
  position: relative; z-index: 1; min-width: 0; margin: 0 2px; padding: 0 7px;
  display: flex; align-items: center; overflow: hidden;
  border: 1px solid var(--sejour-bord); border-radius: 7px; background: var(--sejour-fond); color: var(--texte);
  font-size: 12.5px; font-weight: 650; text-align: left;
}
.barre-sejour span { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.barre-sejour:hover { background: color-mix(in srgb, var(--sejour-fond) 80%, var(--marque)); }
.barre-sejour.demande {
  border-style: dashed; border-color: var(--orange);
  background: repeating-linear-gradient(135deg, var(--jaune-fond) 0 6px, var(--surface) 6px 12px);
}
.barre-sejour.coupe-avant { margin-left: 0; border-left-style: dotted; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.barre-sejour.coupe-apres { margin-right: 0; border-right-style: dotted; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.debut-1 { grid-column-start: 1; } .debut-2 { grid-column-start: 2; } .debut-3 { grid-column-start: 3; }
.debut-4 { grid-column-start: 4; } .debut-5 { grid-column-start: 5; } .debut-6 { grid-column-start: 6; }
.debut-7 { grid-column-start: 7; } .debut-8 { grid-column-start: 8; } .debut-9 { grid-column-start: 9; }
.debut-10 { grid-column-start: 10; } .debut-11 { grid-column-start: 11; } .debut-12 { grid-column-start: 12; }
.debut-13 { grid-column-start: 13; } .debut-14 { grid-column-start: 14; }
.fin-2 { grid-column-end: 2; } .fin-3 { grid-column-end: 3; } .fin-4 { grid-column-end: 4; } .fin-5 { grid-column-end: 5; }
.fin-6 { grid-column-end: 6; } .fin-7 { grid-column-end: 7; } .fin-8 { grid-column-end: 8; } .fin-9 { grid-column-end: 9; }
.fin-10 { grid-column-end: 10; } .fin-11 { grid-column-end: 11; } .fin-12 { grid-column-end: 12; }
.fin-13 { grid-column-end: 13; } .fin-14 { grid-column-end: 14; } .fin-15 { grid-column-end: 15; }
.voie-1 { grid-row: 1; } .voie-2 { grid-row: 2; } .voie-3 { grid-row: 3; } .voie-4 { grid-row: 4; }

details.hors-ligne { margin-top: 10px; }
details.hors-ligne > summary { cursor: pointer; padding: 8px 0; color: var(--texte-doux); font-weight: 600; font-size: 14px; }
details.hors-ligne .barre-sejour { opacity: .8; }
.legende { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 10px 0 0; font-size: 12.5px; }
.pastille { display: inline-block; width: 18px; height: 11px; border-radius: 3px; border: 1px solid var(--sejour-bord); background: var(--sejour-fond); }
.pastille.demande { border-style: dashed; border-color: var(--orange); background: var(--jaune-fond); }
.pastille.fin-semaine { border-color: var(--bordure-forte); background: var(--fin-semaine); }

/* ---------------------------------------------------------------------------
   Ménages
   --------------------------------------------------------------------------- */
.cartes-menages, .groupe-date { display: flex; flex-direction: column; gap: 10px; }
.groupe-date { margin-bottom: 14px; }
.groupe-date > h3 { margin-bottom: 0; }
.carte-menage {
  background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon); padding: 12px 14px;
}
.cartes-menages .carte-menage { background: var(--surface-douce); }
.carte-menage.urgent { border-left: 4px solid var(--rouge); }
.carte-menage.fait { opacity: .85; }
.carte-menage .tete, .carte-logement .tete { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.carte-menage .nom-annonce { font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 50%; }
.carte-menage p { margin: 6px 0 0; }
.carte-menage .prochaine { font-size: 14px; }
.carte-menage .prochaine.meme-jour { color: var(--rouge); font-weight: 600; }
.carte-menage .actions .bouton { flex: 1 1 auto; }

/* ---------------------------------------------------------------------------
   Réservations
   --------------------------------------------------------------------------- */
.filtres { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0 12px; align-items: end; margin-bottom: 12px; }
.stats { margin: 4px 0 14px; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 12px 0; }
.bilan .message p { margin: 0; }
.bilan .message p + p { margin-top: 6px; }

/* ---------------------------------------------------------------------------
   Logements
   --------------------------------------------------------------------------- */
.grille-logements { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.grille-logements .carte { margin: 0; }
.carte-logement.hors-ligne { background: var(--surface-douce); }
.carte-logement .tete h3 { margin: 0; }
.carte-logement .code-logement { font-size: 15px; }
.wifi code, .code-acces code { font-size: 15px; font-weight: 700; letter-spacing: .5px; overflow-wrap: anywhere; }
.code-acces code.code { font-size: 20px; letter-spacing: 3px; padding: 1px 8px; border-radius: 7px; background: var(--jaune-fond); }
.etat-codes .etiquette, .carte-logement dd .etiquette { margin-left: 4px; }
.liste-voyageurs { margin: 4px 0 12px; padding-left: 18px; }
.liste-voyageurs li { margin: 2px 0; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------------------
   Assistante
   --------------------------------------------------------------------------- */
.intro { margin: 0 0 12px; }
ol.messages { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
ol.messages .separateur { align-self: center; font-size: 12px; font-weight: 600; color: var(--texte-doux); padding: 4px 0; }
ol.messages .separateur::first-letter { text-transform: uppercase; }
.message-fil {
  max-width: min(640px, 92%); padding: 9px 13px; border-radius: 14px; border: 1px solid var(--bordure);
  background: var(--surface); overflow-wrap: anywhere;
}
.message-fil.moi { align-self: flex-end; background: var(--marque-douce); border-color: color-mix(in srgb, var(--marque) 25%, transparent); }
.message-fil.equipe { align-self: flex-start; background: var(--surface-douce); }
.message-fil.assistante { align-self: flex-start; }
.message-fil.en-attente { opacity: .7; }
.message-fil .auteur { font-size: 12.5px; margin-bottom: 2px; }
.message-fil .texte p { margin: 0; white-space: pre-wrap; }
.message-fil .texte p + p, .message-fil .texte ul + p, .message-fil .texte p + ul { margin-top: 8px; }
.message-fil .texte ul { margin: 0; padding-left: 20px; }
.reflechit .points::after { content: "…"; display: inline-block; animation: respirer 1.4s ease-in-out infinite; }
@keyframes respirer { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .reflechit .points::after { animation: none; } }

form.saisie {
  position: sticky; bottom: 0; z-index: 3; padding: 8px 0 10px; background: var(--fond);
  border-top: 1px solid var(--bordure);
}
form.saisie label { margin-top: 2px; }
form.saisie textarea { min-height: 72px; max-height: 40vh; }
.ligne-saisie { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.ligne-saisie .compteur { margin-right: auto; }
.ligne-saisie .aide-clavier { margin-right: auto; }
.ligne-saisie .compteur:empty { display: none; }
@media (max-width: 768px) {
  form.saisie { bottom: calc(var(--haut-onglets) + env(safe-area-inset-bottom)); }
  .ligne-saisie .aide-clavier { display: none; }
  .ligne-saisie .bouton { margin-left: auto; }
}

@media (max-width: 640px) {
  main { padding: 12px 12px 32px; }
  .carte { padding: 14px; }
  th, td { padding: 7px 5px; }
  dl.fiche { grid-template-columns: 1fr; gap: 0; }
  dl.fiche dd { margin-bottom: 8px; }
  h2 { font-size: 19px; }
  .grille-logements, .grille-jour { grid-template-columns: 1fr; }
  .carte-logement dl.fiche { grid-template-columns: 104px 1fr; gap: 6px 10px; }   /* libellés courts : deux colonnes */
  .carte-logement dl.fiche dd { margin-bottom: 0; }
}
