:root {
  color-scheme: light;
  --fond: #f5f6f8;
  --surface: #ffffff;
  --surface-douce: #f0f2f5;   /* champs en lecture seule, étiquettes */
  --survol: #f7f9fc;
  --separateur: #eef0f3;
  --champ-fond: #ffffff;
  --champ-bordure: #b8c4d0;
  --texte: #1d2433;
  --texte-doux: #5a6475;
  --bordure: #dde1e8;
  --accent: #1f4e8c;
  --accent-clair: #e7eef8;
  --sur-accent: #ffffff;      /* texte sur fond accent (boutons) */
  --barre-fond: #1f4e8c;
  --focus: #9cc0ea;
  --succes: #1e6b3a;
  --succes-fond: #e6f4ea;
  --erreur: #9b1c1c;
  --erreur-fond: #fdecec;
  --erreur-bordure: #e8b4b4;
  --manquant-fond: #fffafa;
  --signal: #b3261e;          /* points d'attention, soins cochés */
  --verifier: #8a4b00;
  --verifier-fond: #fff4e5;
  --verifier-bordure: #f0c48a;
  --verifier-texte: #6b3d00;
  --verifier-champ: #d98b2b;
  --verifier-halo: #fbe3c4;
  --ombre: rgba(0,0,0,.18);
  --voile: rgba(20, 24, 32, .45);
  --rayon: 8px;
  --lit-f: #fde2e4; --lit-f-bord: #e8a3aa;   /* placement : femme */
  --lit-h: #dde9fb; --lit-h-bord: #95b6e6;   /* placement : homme */
  --lit-libre: #e6f4ea; --lit-libre-bord: #a8d5b5;
}

/* Mode sombre : choisi avec le bouton du menu, sinon celui du système. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --fond: #14181f;
  --surface: #1d232c;
  --surface-douce: #262d38;
  --survol: #232a35;
  --separateur: #2c3440;
  --champ-fond: #161b22;
  --champ-bordure: #48536a;
  --texte: #e4e8ee;
  --texte-doux: #a3adbd;
  --bordure: #333c4a;
  --accent: #8ab4f8;
  --accent-clair: #24344d;
  --sur-accent: #0e1a2e;
  --barre-fond: #182334;
  --focus: #5a8fd8;
  --succes: #81c995;
  --succes-fond: #1b3324;
  --erreur: #f28b82;
  --erreur-fond: #3b1d1d;
  --erreur-bordure: #6b3030;
  --manquant-fond: #2a1c1f;
  --signal: #f28b82;
  --verifier: #f0b968;
  --verifier-fond: #3a2a12;
  --verifier-bordure: #7a5320;
  --verifier-texte: #f5cf96;
  --verifier-champ: #d9963b;
  --verifier-halo: #4a3415;
  --ombre: rgba(0,0,0,.5);
  --voile: rgba(0, 0, 0, .6);
  --lit-f: #4a2328; --lit-f-bord: #8a4a52;
  --lit-h: #1f3250; --lit-h-bord: #4a6d9e;
  --lit-libre: #1b3324; --lit-libre-bord: #3f6b4c;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 16px/1.5 system-ui, "Segoe UI", Roboto, sans-serif;
  color: var(--texte);
  background: var(--fond);
}
a { color: var(--accent); }

/* Mise en page : barre latérale + contenu */
.cadre { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.barre {
  background: var(--barre-fond);
  color: #fff;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.barre .logo { font-weight: 700; font-size: 20px; margin-bottom: 16px; }
.barre a, .barre span.bientot {
  color: #fff;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 6px;
  display: block;
}
.barre a:hover, .barre a.actif { background: rgba(255,255,255,.15); }
.barre span.bientot { opacity: .55; }
.barre .titre-groupe {
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: .06em;
  opacity: .75;
  margin: 14px 12px 2px;
}

.principal { display: flex; flex-direction: column; min-width: 0; }
.entete {
  background: var(--surface);
  border-bottom: 1px solid var(--bordure);
  padding: 12px 24px;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.entete .pele { font-weight: 600; }
.entete .pele small { color: var(--texte-doux); font-weight: 400; }
.entete .moi { display: flex; gap: 12px; align-items: center; color: var(--texte-doux); }
.contenu { padding: 24px; max-width: 1200px; width: 100%; }

h1 { font-size: 24px; margin: 0 0 16px; }
.carte {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  padding: 20px;
  margin-bottom: 16px;
}
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-clair);
  color: var(--accent);
  font-size: 13px;
  margin-right: 4px;
}

button, .bouton {
  font: inherit;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--sur-accent);
  border-radius: 6px;
  padding: 8px 16px;
  min-height: 40px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button.secondaire, .bouton.secondaire { background: var(--surface); color: var(--accent); }
button.lien { background: none; border: none; color: var(--texte-doux); padding: 0; min-height: 0; text-decoration: underline; }

.bandeau-test { background: var(--verifier-fond); color: var(--verifier-texte); text-align: center;
  padding: 6px 12px; font-weight: 600; }
.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.messages li { padding: 10px 14px; border-radius: 6px; margin-bottom: 8px; }
.messages .success { background: var(--succes-fond); color: var(--succes); }
.messages .error { background: var(--erreur-fond); color: var(--erreur); }

/* Tableaux */
.tableau-boite { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--bordure); vertical-align: top; }
th { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--texte-doux); }
td .diff { font-size: 14px; color: var(--texte-doux); }
td .diff del { color: var(--erreur); }
td .diff ins { color: var(--succes); text-decoration: none; }

/* Formulaires */
label { display: block; font-weight: 600; margin-bottom: 4px; }
input[type=text], input[type=search], input[type=password], input[type=email], input[type=date], input[type=number], select, textarea {
  font: inherit;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--bordure);
  border-radius: 6px;
  background: var(--champ-fond);
  color: var(--texte);
}
.champ { margin-bottom: 14px; }
.erreurs { color: var(--erreur); }

/* Connexion */
.page-connexion { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.page-connexion .carte { width: 100%; max-width: 380px; }
.page-connexion h1 { text-align: center; }

@media (max-width: 760px) {
  .cadre { grid-template-columns: 1fr; }
  .barre { flex-direction: row; flex-wrap: wrap; padding: 10px; }
  .barre .logo { margin: 0 12px 0 0; width: 100%; }
  .barre .titre-groupe, .barre span.bientot { display: none; }
  .contenu { padding: 16px; }
}

/* ===== Fiche malade ===== */
h2 { font-size: 18px; margin: 0 0 12px; }
.sous-titre { color: var(--texte-doux); margin: -8px 0 16px; }
.fiche-colonnes { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
/* La colonne de droite s'étire sur toute la hauteur de la fiche : sa carte peut ainsi rester visible
   pendant qu'on descend (03/11/2026). Si elle est plus haute que l'écran, elle défile seule. */
.fiche-cote { align-self: stretch; }
.fiche-cote .collant { position: sticky; top: 68px; max-height: calc(100vh - 84px); overflow-y: auto; }
.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 16px; }
.grille .large { grid-column: 1 / -1; }
fieldset { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
legend { font-weight: 600; margin-bottom: 6px; padding: 0; }
.choix { display: flex; flex-wrap: wrap; gap: 6px; }
.choix label { margin: 0; font-weight: 400; cursor: pointer; }
.choix input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choix span { display: inline-block; padding: 7px 14px; border: 1px solid var(--champ-bordure); border-radius: 6px; background: var(--champ-fond); min-height: 40px; line-height: 24px; }
.choix input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--sur-accent); font-weight: 700; }
.choix input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 1px; }
.case { display: flex; gap: 8px; align-items: center; font-weight: 400; margin: 4px 0; cursor: pointer; }
.case input { width: 18px; height: 18px; flex: none; }
.niveaux { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 16px; }
.niveau .choix span { padding: 5px 10px; min-height: 34px; line-height: 22px; }
.groupes-soins { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 16px; margin: 8px 0 12px; }
.groupe-soins input:checked + * , .groupe-soins label:has(input:checked) { color: var(--signal); font-weight: 700; }
.pastille { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--accent-clair); color: var(--accent); vertical-align: middle; }
.pastille.rouge { background: var(--erreur-fond); color: var(--erreur); }
.pastille.vert { background: var(--succes-fond); color: var(--succes); }
.carte.discret { color: var(--texte-doux); }
.aide, .petit { color: var(--texte-doux); font-size: 14px; }
.puces { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.puces li { background: var(--accent-clair); color: var(--accent); border-radius: 999px; padding: 4px 4px 4px 12px; display: flex; align-items: center; gap: 2px; }
.puces button { background: none; border: 0; color: var(--accent); min-height: 32px; min-width: 32px; padding: 0; font-size: 18px; }
.ajout-patho { display: flex; gap: 8px; }
.doublons, .avertissement { background: var(--verifier-fond); border: 1px solid var(--verifier-bordure); color: var(--verifier-texte); border-radius: 6px; padding: 10px 14px; margin: 0 0 14px; }
.doublons ul { list-style: none; padding: 0; margin: 6px 0 0; }
.doublons li { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 6px 0; border-top: 1px solid var(--verifier-bordure); }
.erreur-bloc { background: var(--erreur-fond); border: 1px solid var(--erreur-bordure); color: var(--erreur); border-radius: 6px; padding: 12px 14px; margin-bottom: 16px; }
.erreur-bloc p { margin: 0 0 8px; }
.en-erreur input, .en-erreur select, .en-erreur textarea { border-color: var(--erreur); }
.attention { padding-left: 18px; margin: 0 0 16px; color: var(--signal); font-weight: 600; }
.attention .vide { color: var(--texte-doux); font-weight: 400; list-style: none; margin-left: -18px; }
.manquants { padding-left: 18px; color: var(--erreur); }
.complet { color: var(--succes); font-weight: 600; }
.actions { display: flex; flex-direction: column; gap: 8px; }
.actions .bouton { text-align: center; }
@media (max-width: 1000px) { .fiche-colonnes { grid-template-columns: 1fr; } .fiche-cote .collant { position: static; } }

.lecture-seule select:disabled, .lecture-seule textarea:disabled { background: var(--surface-douce); color: var(--texte); }
.lecture-seule .choix input:not(:checked) + span { opacity: .45; }
.lecture-seule .choix label { cursor: default; }

/* Pathologies : liste réduite à la frappe */
.liste-choix { list-style: none; margin: 6px 0 0; padding: 0; max-height: 240px; overflow-y: auto; border: 1px solid var(--bordure); border-radius: 6px; background: var(--champ-fond); }
.liste-choix li { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--separateur); }
.liste-choix li:hover, .liste-choix li:focus { background: var(--accent-clair); outline: none; }
.liste-choix li.vide { cursor: default; color: var(--texte-doux); }
.compteur { margin: 4px 0 0; }
.ligne-2 { display: grid; grid-template-columns: repeat(3, minmax(0, 160px)); gap: 0 16px; }
.medecin { padding-top: 4px; border-top: 1px dashed var(--bordure); }
.ajout-patho { align-items: center; } .ajout-patho button { white-space: nowrap; }

/* Accompagnant */
.resultats { list-style: none; padding: 0; margin: 10px 0 0; }
.resultats li { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--bordure); }
.boutons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
button.danger { color: var(--erreur); border-color: var(--erreur); }

/* Documents */
.documents { list-style: none; padding: 0; margin: 0 0 16px; }
.documents li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--bordure); }
.vignette { width: 64px; height: 64px; flex: none; border-radius: 6px; overflow: hidden; background: var(--accent-clair); display: grid; place-items: center; text-decoration: none; }
.vignette img { width: 100%; height: 100%; object-fit: cover; }
.vignette .type { font-weight: 700; color: var(--accent); font-size: 14px; }
.doc-texte { flex: 1; min-width: 0; }
.ajout-document { border-top: 1px dashed var(--bordure); padding-top: 12px; }
input[type=file] { font: inherit; max-width: 100%; }

/* Photo d'identité en tête de fiche */
.tete-fiche { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.tete-fiche h1 { margin-bottom: 4px; }
.tete-fiche .sous-titre { margin: 0 0 8px; }
.portrait { width: 104px; height: 128px; flex: none; border-radius: 8px; overflow: hidden; background: var(--accent-clair); display: grid; place-items: center; border: 1px solid var(--bordure); }
.portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
.portrait .initiales { font-size: 34px; font-weight: 700; color: var(--accent); }
.form-photo { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.petit-bouton { min-height: 36px; padding: 6px 12px; font-size: 14px; cursor: pointer; }
.cache { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.messages .warning { background: var(--verifier-fond); color: var(--verifier-texte); }

/* Liste des malades */
.entete-liste { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.entete-liste h1 { margin: 0; }
.filtres-grille { display: grid; grid-template-columns: 2fr repeat(4, minmax(150px, 1fr)); gap: 0 12px; }
.filtres-bas { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.filtres-bas .boutons { margin-top: 0; }
.resume { color: var(--texte-doux); margin: 0 0 10px; }
.texte-rouge { color: var(--erreur); font-weight: 600; }
.carte.sans-marge { padding: 0; overflow: hidden; }
.liste-malades td { vertical-align: middle; }
.liste-malades tbody tr:hover { background: var(--survol); }
.liste-malades tr.desiste td, .historique-pelerinages tr.desiste td { color: var(--texte-doux); }
.col-photo { width: 52px; }
.mini-portrait { width: 36px; height: 44px; border-radius: 4px; overflow: hidden; background: var(--accent-clair); color: var(--accent); font-size: 13px; font-weight: 700; display: grid; place-items: center; }
.mini-portrait img { width: 100%; height: 100%; object-fit: cover; }
.pagination { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 14px 0; }
.pagination a, .pagination strong, .pagination span { padding: 6px 10px; border-radius: 6px; }
.pagination a { border: 1px solid var(--bordure); background: var(--surface); text-decoration: none; }
.pagination strong { background: var(--accent); color: var(--sur-accent); }
.visuellement-cache { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (max-width: 900px) { .filtres-grille { grid-template-columns: 1fr 1fr; } .filtres-grille .recherche { grid-column: 1 / -1; } }
@media (max-width: 560px) { .filtres-grille { grid-template-columns: 1fr; } }
th a.tri { color: inherit; text-decoration: none; display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; }
th a.tri:hover { color: var(--accent); }
th a.tri.actif { color: var(--accent); }
th a.tri .fleche { font-size: 10px; opacity: .5; }
th a.tri.actif .fleche { opacity: 1; }
.a-verifier { padding-left: 18px; color: var(--verifier); font-size: 14px; }
.a-verifier li { margin-bottom: 4px; }

/* Mise en valeur des contrôles (règle 20) */
.marque-requis { display: none; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--erreur); background: var(--erreur-fond); border-radius: 4px; padding: 1px 6px; margin-left: 4px; }
[data-requis].manquant .marque-requis { display: inline-block; }
[data-requis].manquant input, [data-requis].manquant select, [data-requis].manquant textarea { border-left: 4px solid var(--erreur); background: var(--manquant-fond); }
.a-verifier-champ input, .a-verifier-champ select, .a-verifier-champ textarea { border-color: var(--verifier-champ); box-shadow: 0 0 0 2px var(--verifier-halo); }
.message-verifier { color: var(--verifier); font-size: 13px; margin: 4px 0 0; }
.en-erreur input, .en-erreur select, .en-erreur textarea { box-shadow: 0 0 0 2px var(--erreur-fond); }

/* Parties de la fiche : délimitation sobre (filet gris sous le titre) */
.fiche-sections .carte, #documents { margin-bottom: 20px; }
.fiche-sections .carte > h2, #documents > h2 { padding-bottom: 10px; margin-bottom: 16px; border-bottom: 1px solid var(--bordure);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.etiquette-medical { font-size: 12px; font-weight: 500; color: var(--texte-doux); background: var(--surface-douce);
  border: 1px solid var(--bordure); border-radius: 4px; padding: 1px 8px; }

/* Garde « modifications non enregistrées » */
.garde-dialogue { border: 1px solid var(--bordure); border-radius: 10px; padding: 24px; max-width: 440px; width: calc(100% - 32px); box-shadow: 0 12px 40px var(--ombre); background: var(--surface); color: var(--texte); }
.garde-dialogue::backdrop { background: var(--voile); }
.garde-dialogue h2 { margin: 0 0 8px; font-size: 18px; }
.garde-dialogue p { margin: 0 0 18px; }
.garde-dialogue .boutons { justify-content: flex-end; }
button.danger { color: var(--erreur); border-color: var(--erreur); }

/* Bouton mode clair / sombre, en bas du menu */
.bouton-theme { margin-top: auto; display: flex; align-items: center; gap: 8px; width: 100%; background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.25); color: #fff; font-size: 14px; padding: 8px 12px; border-radius: 6px; text-align: left; }
.bouton-theme:hover { background: rgba(255,255,255,.16); }
.bouton-theme .icone { font-size: 16px; line-height: 1; }
/* Le menu reste à l'écran quand la fiche défile : le bouton de thème est toujours visible. */
@media (min-width: 761px) { .barre { position: sticky; top: 0; height: 100vh; overflow-y: auto; } }
@media (max-width: 760px) { .bouton-theme { margin-top: 0; width: auto; margin-left: auto; } }

/* Fiche en consultation (29/10/2026) : les champs se lisent comme du texte ; « Modifier la fiche » pour changer. */
.tete-fiche .tete-action { margin-left: auto; flex: none; }
.pastille.mode-modif { background: var(--verifier-fond); color: var(--verifier-texte); border: 1px solid var(--verifier-bordure); }
.verrou { margin: -6px 0 12px; }
.consultation input:disabled, .consultation select:disabled, .consultation textarea:disabled {
  border-color: transparent; background: transparent; color: var(--texte); -webkit-text-fill-color: var(--texte);
  opacity: 1; padding-left: 0; appearance: none; -webkit-appearance: none; resize: none; cursor: default; }
.consultation input:disabled::placeholder, .consultation textarea:disabled::placeholder { color: var(--texte-doux); -webkit-text-fill-color: var(--texte-doux); }
.consultation [data-requis].manquant input:disabled, .consultation [data-requis].manquant select:disabled { border-left: 4px solid var(--erreur); padding-left: 8px; background: var(--manquant-fond); }
.consultation .choix label { cursor: default; }
.consultation .choix label:has(input:not(:checked)) { display: none; }
.consultation .choix:not(:has(input:checked))::after { content: "—"; color: var(--texte-doux); }
.consultation .choix input:checked + span { background: var(--accent-clair); color: var(--accent); border-color: transparent; }
.consultation .groupe-soins:not(:has(input:checked)) { display: none; }
.consultation .groupe-soins label:has(input:not(:checked)) { display: none; }
.consultation .groupe-soins input[type=checkbox] { display: none; }
.consultation .niveau:has(input[value="N"]:checked) { opacity: .6; }
.si-rien-coche { display: none; }
.consultation .medical:not(:has(.groupes-soins input:checked)) .si-rien-coche { display: block; }
.consultation .medical .puces li { padding-right: 12px; }
.puces li.vide { background: none; color: var(--texte-doux); padding-left: 0; }
#resultats[aria-busy] { opacity: .6; transition: opacity .15s; }
[hidden] { display: none !important; }
/* Champs verrouillés en modification (identité) : visiblement non modifiables. */
.fiche-form:not(.consultation) input:disabled, .fiche-form:not(.consultation) select:disabled,
.fiche-form:not(.consultation) textarea:disabled { background: var(--surface-douce); color: var(--texte-doux); cursor: not-allowed; }
.fiche-form:not(.consultation) .choix input:disabled + span { cursor: not-allowed; }
.fiche-form:not(.consultation) .choix input:disabled:not(:checked) + span { opacity: .45; }

/* Commentaires datés */
.nouveau-commentaire { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.ligne-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin-top: 6px; }
.commentaires { list-style: none; margin: 0; padding: 0; }
.commentaire { border-top: 1px solid var(--separateur); padding: 12px 0; }
.commentaire.important { border-left: 3px solid var(--signal); padding-left: 12px; background: var(--manquant-fond); }
.com-tete { font-size: 14px; color: var(--texte-doux); display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.com-tete strong { color: var(--texte); }
.com-texte { margin: 4px 0 0; white-space: normal; overflow-wrap: anywhere; }
.com-actions { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 6px; font-size: 14px; }
.com-actions details { flex: 1 1 100%; }
.com-actions details:not([open]) { flex: 0 0 auto; }
.com-actions summary { cursor: pointer; color: var(--texte-doux); text-decoration: underline; list-style: none; }
.com-actions summary::-webkit-details-marker { display: none; }
.com-actions details[open] summary { margin-bottom: 6px; }
.attention.importants { font-weight: 400; }
.attention.importants a { color: var(--signal); font-weight: 600; }
.attention.importants .petit { color: var(--texte-doux); font-weight: 400; }
.tete-fiche { flex-wrap: wrap; }
.tete-fiche > div:not(.portrait) { flex: 1 1 220px; min-width: 0; }
@media (max-width: 760px) { .tete-fiche .tete-action { margin-left: 0; } }
.form-lien { display: inline; margin: 0; }
.com-actions button.lien { font-size: 14px; color: var(--texte-doux); }

/* Règle 9 : ancien « O » de PeleWin à préciser */
.niveau.a-preciser:not(:has(input:checked)) .choix { background: var(--verifier-fond); border: 1px solid var(--verifier-bordure); border-radius: 6px; padding: 6px 8px; }
.niveau.a-preciser:has(input:checked) .note-preciser { display: none; }
.consultation .niveau.a-preciser .choix:not(:has(input:checked))::after { content: "À préciser"; color: var(--verifier); font-weight: 600; }
.consultation .note-preciser { display: none; }

/* Précision par besoin ou soin (01/11/2026) : visible seulement quand il y a un besoin */
.precision { margin-top: 6px; }
.precision input { font-size: 14px; padding: 6px 10px; }
.niveau:has(input[value="N"]:checked) .precision { display: none; }
.avec-precision .precision { display: none; margin: 0 0 6px 26px; }
.avec-precision:has(.case input:checked) .precision { display: block; }
.consultation .precision input:placeholder-shown { display: none; }
.consultation .precision { margin-top: 2px; }
.consultation .precision input:disabled { font-size: 14px; color: var(--texte-doux); -webkit-text-fill-color: var(--texte-doux); font-style: italic; padding: 0; min-height: 0; }
.consultation .avec-precision .precision { margin-left: 0; }

/* IMC calculé (03/11/2026) */
.etiquette-imc { display: block; font-weight: 600; margin-bottom: 4px; }
.valeur-calculee { margin: 0; padding: 8px 0; font-size: 16px; font-weight: 600; min-height: 40px; }
.imc .aide { margin: 0; font-size: 12px; }
/* Suppression d'une fiche (administrateur) */
.lien-danger { color: var(--erreur); font-size: 14px; text-align: center; margin-top: 4px; }
button.danger-plein { background: var(--erreur); border-color: var(--erreur); color: var(--fond); }
.avertissement.desistement p { margin: 0 0 8px; } .avertissement.desistement form { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }

/* Bandeau de la fiche : nom de la personne et mode, collé en haut quand on descend (03/11/2026).
   Il ne prend pas de place dans la page (marge négative) : rien ne saute quand il apparaît. */
.bandeau-fiche { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  height: 56px; margin: 0 -24px -56px; padding: 0 24px; overflow: hidden; white-space: nowrap;
  background: var(--surface); border-bottom: 1px solid var(--bordure); box-shadow: 0 2px 6px rgba(0,0,0,.08);
  visibility: hidden; opacity: 0; transition: opacity .15s, visibility .15s; }
.bandeau-fiche.visible { visibility: visible; opacity: 1; }
.bandeau-fiche .mini-portrait { flex: none; }
.bandeau-fiche .mini-portrait img { width: 100%; height: 100%; object-fit: cover; }
.bandeau-fiche .bandeau-nom { font-size: 16px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) { .bandeau-fiche { margin: 0 -16px -56px; padding: 0 16px; } }
.fiche-form .carte, #commentaires, #documents { scroll-margin-top: 70px; }

/* Liens de famille (règle 4, 05/11/2026) */
.liste-famille { list-style: none; margin: 0 0 12px; padding: 0; }
.liste-famille li { padding: 6px 0; border-bottom: 1px solid var(--separateur); }
.liste-famille li:last-child { border-bottom: 0; }
.liste-famille .relation { font-weight: 600; }

/* Recherche unique (09/11/2026) */
.recherche-menu { margin-bottom: 12px; }
.recherche-menu input { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 0; border-radius: 6px; font: inherit; }
.groupe-resultats { margin-top: 16px; }
.groupe-resultats h2 { font-size: 18px; margin: 0 0 8px; }
.groupe-resultats h2 small { font-size: 14px; font-weight: 400; color: var(--texte-doux); margin-left: 6px; }
.lignes-personnes { list-style: none; margin: 0; padding: 0; }
.lignes-personnes li { border-top: 1px solid var(--separateur); }
.lignes-personnes a { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 10px 4px; color: inherit; text-decoration: none; }
.lignes-personnes a:hover { background: var(--survol); }
.lignes-personnes .sexe { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-douce); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; }
.lignes-personnes .nom { flex: 1 1 220px; }
.lignes-personnes .detail { flex: 2 1 260px; color: var(--texte-doux); font-size: 15px; }
.recherche-aide { color: var(--texte-doux); margin: 12px 0 0; }

/* Placement en chambre (14/11/2026) */
.messages .info { background: var(--accent-clair); color: var(--texte); }
.placement { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; }
.placement-cote { position: sticky; top: 12px; display: grid; gap: 12px; }
.placement-cote .carte { margin: 0; }
.placement-cote h2 { margin: 0 0 4px; font-size: 1.1em; }
.puces-infos { list-style: none; padding: 0; margin: 8px 0; }
.puces-infos li { padding: 2px 0; }
.liste-a-placer { list-style: none; padding: 0; margin: 0; max-height: 60vh; overflow-y: auto; }
.liste-a-placer li { border-top: 1px solid var(--separateur); }
.liste-a-placer li a { display: block; padding: 6px 4px; text-decoration: none; color: var(--texte); }
.liste-a-placer li a:hover, .liste-a-placer li.actif a { background: var(--accent-clair); }
.liste-a-placer li.vide { padding: 8px 4px; color: var(--texte-doux); }
.sexe-F { color: var(--lit-f-bord); } .sexe-H { color: var(--lit-h-bord); } .sexe-x { color: var(--texte-doux); }
.onglets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.onglets a { padding: 6px 12px; border: 1px solid var(--bordure); border-radius: var(--rayon); text-decoration: none; background: var(--surface); }
.onglets a.actif { background: var(--accent); color: var(--sur-accent); border-color: var(--accent); }
.legende .lit { display: inline-block; width: auto; margin-right: 6px; }
.secteur h2 { margin: 0 0 10px; font-size: 1.1em; }
.grille-chambres { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.chambre { border: 1px solid var(--bordure); border-radius: var(--rayon); padding: 8px; background: var(--surface); }
.chambre.fermee { opacity: .6; }
.chambre.en-alerte { border-color: var(--verifier-champ); }
.chambre-tete { font-weight: 600; margin-bottom: 6px; display: flex; justify-content: space-between; gap: 6px; }
.lits { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.lits form { margin: 0; }
.lit { display: block; width: 100%; text-align: left; padding: 3px 6px; border-radius: 4px; font-size: .9em;
       border: 1px solid var(--bordure); color: var(--texte); text-decoration: none; background: var(--surface-douce); }
.lit.libre { background: var(--lit-libre); border-color: var(--lit-libre-bord); }
.lit.F { background: var(--lit-f); border-color: var(--lit-f-bord); }
.lit.H { background: var(--lit-h); border-color: var(--lit-h-bord); }
.lit.choisi-lit { outline: 3px solid var(--verifier-champ); outline-offset: 1px; }
button.lit.placer { cursor: pointer; font: inherit; font-size: .9em; }
button.lit.placer:hover { border-color: var(--succes); }
.alerte-chambre { margin: 6px 0 0; font-size: .85em; color: var(--verifier-texte); background: var(--verifier-fond); border-radius: 4px; padding: 4px 6px; }
.grille-secteurs { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 16px; }
.tableau-secteurs { width: 100%; border-collapse: collapse; }
.tableau-secteurs th, .tableau-secteurs td { padding: 4px 6px; text-align: left; border-top: 1px solid var(--separateur); }
.tableau-secteurs tr.ferme th, .tableau-secteurs tr.ferme td { color: var(--texte-doux); }
@media (max-width: 1000px) { .placement { grid-template-columns: 1fr; } .placement-cote { position: static; } }
@media (max-width: 560px) { .grille-secteurs { grid-template-columns: 1fr; } .tableau-secteurs select { max-width: 120px; } }

/* Liste par secteur (14/11/2026) */
.liste-secteur { width: 100%; border-collapse: collapse; }
.liste-secteur th, .liste-secteur td { padding: 4px 8px; text-align: left; }
.liste-secteur tr.nouvelle-chambre td { border-top: 1px solid var(--separateur); }
.liste-secteur tr.libre td { color: var(--texte-doux); }

/* Impression : seulement le contenu de la page, en noir sur blanc. */
@media print {
  .barre, .entete, .messages, .pas-imprime { display: none !important; }
  body, .carte { background: #fff !important; color: #000 !important; box-shadow: none !important; }
  .cadre, .principal, .contenu { display: block; margin: 0; padding: 0; }
  .secteur-liste { break-inside: auto; border: none; padding: 0; }
  .secteur-liste + .secteur-liste { break-before: page; }
  .liste-secteur a { color: inherit; text-decoration: none; }
}

/* Demandes au secrétariat et suivi du pèlerinage (14/11/2026) */
.filtres { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.bouton-filtre { border: 1px solid var(--bordure); border-radius: 8px; padding: 4px 10px; color: var(--texte); text-decoration: none; font-size: 14px; }
.bouton-filtre.actif { background: var(--accent); border-color: var(--accent); color: var(--sur-accent); }
.barre .compte-menu { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 6px; border-radius: 999px; background: var(--signal); color: #fff; font-size: 12px; font-weight: 600; text-align: center; }
.etapes { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 0 0 14px; }
.etape { display: block; background: var(--surface); border: 1px solid var(--bordure); border-radius: 10px; padding: 12px 14px; color: var(--texte); text-decoration: none; }
.etape:hover { background: var(--survol); }
.etape.actif { border-color: var(--accent); box-shadow: inset 0 -3px 0 var(--accent); }
.etape .nombre { font-size: 28px; font-weight: 700; line-height: 1.1; }
.etape .nom { font-weight: 600; }
.etape .qui { color: var(--texte-doux); font-size: 13px; }
.etape.fini .nombre { color: var(--succes); }
.etape.bloque .nombre { color: var(--verifier); }
.taches { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.taches a { display: flex; gap: 10px; align-items: baseline; color: var(--texte); text-decoration: none; padding: 6px 8px; border-radius: 8px; }
.taches a:hover { background: var(--survol); }
.taches .nombre { min-width: 32px; font-size: 20px; font-weight: 700; color: var(--verifier); text-align: right; }
.taches .fait .nombre { color: var(--succes); }
.taches .fait a { color: var(--texte-doux); }

/* Services et textes de la lettre (14/11/2026) : petit traitement de texte. */
.titre-carte { padding: 14px 16px 0; }
.liste-textes th, .liste-textes td { padding: 6px 10px; text-align: left; }
.liste-textes tr.desiste td { color: var(--texte-doux); }
.etiquette { display: block; font-weight: 600; margin-bottom: 6px; }
.editeur { border: 1px solid var(--bordure, var(--separateur)); border-radius: 8px; background: var(--surface); }
.editeur-outils { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border-bottom: 1px solid var(--separateur); }
.editeur-outils button { padding: 4px 10px; min-width: 36px; font-size: 14px; }
.editeur-outils .separateur { width: 1px; background: var(--separateur); margin: 2px 4px; }
.editeur-zone { min-height: 220px; padding: 12px 14px; outline: none; line-height: 1.5; overflow-wrap: anywhere; }
.editeur-zone:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); border-radius: 0 0 8px 8px; }
.texte-lettre h3 { font-size: 1.1em; margin: 0.8em 0 0.3em; }
.texte-lettre h4 { font-size: 1em; margin: 0.6em 0 0.2em; }
.texte-lettre p { margin: 0 0 0.5em; }
.texte-lettre ul, .texte-lettre ol { margin: 0 0 0.5em 1.4em; padding: 0; }
