/* BEACON RCP : bleus pastel, grain léger, surfaces translucides. Thème clair uniquement. Aucune police ni image externe. */
:root {
  --fond-1: #edf3fb;
  --fond-2: #e2ecf8;
  --halo-1: #cfe0f6;
  --halo-2: #dfe3fa;
  --surface: rgba(255, 255, 255, .78);
  --surface-pleine: #ffffff;
  --surface-douce: #f3f7fd;
  --encre: #1c2a3d;
  --encre-douce: #5d6c82;
  --trait: rgba(63, 111, 181, .14);
  --champ: #9fb2cb;
  --accent: #3a67a8;
  --accent-fort: #2c5391;
  --accent-pastel: #dbe7f7;
  --accent-pastel-2: #c7daf3;
  --bandeau: linear-gradient(120deg, #dfeafa 0%, #e7e6fa 100%);
  --ok: #2b7a5a;
  --ok-fond: #ddf2e8;
  --attente: #8a5a16;
  --attente-fond: #fbeedb;
  --erreur: #b0413b;
  --erreur-fond: #fbe4e2;
  --exemple-fond: rgba(221, 242, 232, .7);
  --exemple-texte: #245c46;
  --focus: #5b8fe0;
  --ombre: 0 1px 2px rgba(34, 60, 100, .06), 0 8px 28px rgba(34, 60, 100, .08);
  --ombre-haute: 0 2px 4px rgba(34, 60, 100, .07), 0 14px 36px rgba(34, 60, 100, .13);
  --rayon: 16px;
  --rayon-petit: 10px;
  --titres: "Calibri Light", "Calibri", Carlito, "Segoe UI Light", "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  --police: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --vite: 180ms cubic-bezier(.2, .7, .3, 1);
  --doux: 420ms cubic-bezier(.2, .7, .3, 1);
  --grain-opacite: .32;
  color-scheme: only light;
}
/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
html { scroll-behavior: smooth; background: var(--fond-2); }
body {
  min-height: 100vh;
  color: var(--encre);
  font: 15px/1.55 var(--police);
  background:
    radial-gradient(60rem 40rem at 8% -10%, var(--halo-1), transparent 60%),
    radial-gradient(50rem 36rem at 105% 10%, var(--halo-2), transparent 60%),
    linear-gradient(180deg, var(--fond-1), var(--fond-2));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
/* Grain : bruit SVG en data URI, posé sur tout l'écran, sans image à télécharger. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: var(--grain-opacite);
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .2  0 0 0 0 .3  0 0 0 0 .5  0 0 0 .9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
body > * { position: relative; z-index: 1; }

a { color: var(--accent); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-fort); }
h1, h2, h3, h4 { font-family: var(--titres); font-weight: 300; line-height: 1.2; text-wrap: balance; letter-spacing: -.005em; }
h1 { font-size: clamp(1.7rem, 1.2rem + 1.6vw, 2.35rem); margin: 0 0 .35rem; }
h2 { font-size: 1.45rem; margin: 0 0 .7rem; }
.discret { color: var(--encre-douce); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-pastel-2); }

/* ---------------------------------------------------------------- barre supérieure */
.barre {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface-pleine) 62%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--trait);
}
.barre-in { max-width: 1440px; margin: 0 auto; padding: .65rem 20px; display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.marque { color: var(--encre); text-decoration: none; display: flex; align-items: center; gap: .7rem; }
.marque:hover { color: var(--encre); }
.marque-logo { width: 34px; height: 34px; flex: none; transition: transform var(--doux); }
.marque:hover .marque-logo { transform: rotate(-12deg) scale(1.05); }
.marque-texte { display: flex; flex-direction: column; line-height: 1.15; }
.marque-nom { font-family: var(--titres); font-weight: 300; font-size: 1.35rem; letter-spacing: .18em; }
.marque-sous { font-size: .76rem; color: var(--encre-douce); }
.barre-droite { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }
.qui { font-size: .85rem; color: var(--encre-douce); padding: .25rem .7rem; background: var(--accent-pastel); border-radius: 999px; }
.barre form { margin: 0; }

.page { max-width: 1440px; margin: 0 auto; padding: 1.8rem 20px 5rem; }
.bloc-etroit { max-width: 34rem; margin: 3.5rem auto; padding: 2.2rem 2.2rem 1.8rem; background: var(--surface); border: 1px solid var(--trait); border-radius: 22px; box-shadow: var(--ombre-haute); }
.bloc-etroit p { max-width: 65ch; }
/* Un numéro de cas long ne doit pas dépasser du cadre : taille réduite et coupure de secours. */
.bloc-etroit h1 { font-size: clamp(1.25rem, .95rem + 1.2vw, 1.7rem); overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- apparition */
@keyframes monte { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes glisse { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }
@keyframes secoue { 0%, 100% { transform: none; } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.page > * { animation: monte var(--doux) both; }
.page > *:nth-child(2) { animation-delay: 50ms; }
.page > *:nth-child(3) { animation-delay: 100ms; }
.page > *:nth-child(4) { animation-delay: 150ms; }
.page > *:nth-child(n+5) { animation-delay: 200ms; }

/* ---------------------------------------------------------------- messages */
.flashs { position: fixed; top: 4.6rem; right: 20px; z-index: 30; display: flex; flex-direction: column; gap: .5rem; max-width: min(26rem, calc(100vw - 40px)); animation: none; }
.flash { margin: 0; padding: .75rem 1rem .75rem 2.4rem; border-radius: 12px; background: var(--surface-pleine); box-shadow: var(--ombre-haute); border: 1px solid var(--trait); position: relative; animation: glisse var(--doux) both; transition: opacity var(--doux), transform var(--doux); }
.flash::before { content: ""; position: absolute; left: .95rem; top: 1.05rem; width: .6rem; height: .6rem; border-radius: 50%; background: var(--accent); }
.flash-ok::before { background: var(--ok); }
.flash-erreur::before { background: var(--erreur); }
.flash-info::before { background: var(--attente); }
.flash.sortie { opacity: 0; transform: translateX(16px); }
.bloc-etroit .flash, .flash-fixe { position: relative; animation: glisse var(--doux) both; margin-bottom: 1rem; box-shadow: none; }
.flash-erreur { color: var(--erreur); }

/* ---------------------------------------------------------------- boutons */
button { font: inherit; color: inherit; }
.btn-principal {
  display: inline-flex; align-items: center; gap: .5rem;
  background: linear-gradient(135deg, #4b7cc4, #3a67a8);
  color: #fff; border: 0; border-radius: 12px; padding: .7rem 1.35rem; font-weight: 600; cursor: pointer;
  box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 6px 18px rgba(58, 103, 168, .28);
  transition: transform var(--vite), box-shadow var(--vite), filter var(--vite);
}
.btn-principal:hover { transform: translateY(-1px); box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 10px 24px rgba(58, 103, 168, .34); }
.btn-principal:active { transform: translateY(1px) scale(.99); }
.btn-principal[disabled] { filter: grayscale(.4) opacity(.7); cursor: progress; }
.btn-secondaire {
  display: inline-flex; align-items: center; gap: .45rem;
  border: 1px solid var(--trait); color: var(--accent-fort); background: var(--surface);
  border-radius: 10px; padding: .5rem .9rem; text-decoration: none; font-size: .88rem; cursor: pointer;
  transition: background var(--vite), transform var(--vite), box-shadow var(--vite);
}
.btn-secondaire:hover { background: var(--accent-pastel); transform: translateY(-1px); box-shadow: var(--ombre); color: var(--accent-fort); }
.lien-btn { background: none; border: 0; padding: .2rem .1rem; color: var(--accent); cursor: pointer; font-size: .9rem; text-decoration: none; border-radius: 6px; transition: color var(--vite), background var(--vite); }
.lien-btn:hover { color: var(--accent-fort); background: var(--accent-pastel); }
.icone { width: 1.05em; height: 1.05em; flex: none; }

/* ---------------------------------------------------------------- champs */
input[type=text], input[type=password], input[type=date], input[type=search], textarea {
  font: inherit; color: var(--encre); background: var(--surface-pleine);
  border: 1px solid var(--champ); border-radius: 10px; padding: .55rem .75rem;
  transition: border-color var(--vite), box-shadow var(--vite);
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
textarea { width: 100%; resize: vertical; field-sizing: content; min-height: 2.5rem; }
input[aria-invalid=true] { border-color: var(--erreur); box-shadow: 0 0 0 4px color-mix(in srgb, var(--erreur) 16%, transparent); }

/* cases à cocher dessinées */
input[type=checkbox] {
  appearance: none; -webkit-appearance: none; margin: 0;
  width: 1.2rem; height: 1.2rem; flex: none; border-radius: 6px;
  border: 1.5px solid var(--champ); background: var(--surface-pleine);
  display: inline-grid; place-content: center; cursor: pointer;
  transition: background var(--vite), border-color var(--vite);
}
input[type=checkbox]::after {
  content: ""; width: .62rem; height: .36rem; margin-top: -.12rem;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) scale(0);
  transition: transform var(--vite);
}
input[type=checkbox]:checked { background: var(--accent); border-color: var(--accent); }
input[type=checkbox]:checked::after { transform: rotate(-45deg) scale(1); animation: pop 260ms ease-out; }
input[type=checkbox]:disabled { cursor: default; opacity: .55; }
input[type=checkbox]:checked:disabled { opacity: .85; }

/* ---------------------------------------------------------------- cartes génériques */
.carte, .groupe, .fiche-cas, .fiche-rcp, .exemples, .nouveau-lien {
  background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon);
  box-shadow: var(--ombre);
}

/* ---------------------------------------------------------------- accueil centre */
.entete-centre { display: flex; justify-content: space-between; align-items: center; gap: 1.5rem 2.5rem; flex-wrap: wrap; margin-bottom: 1.8rem; }
.entete-centre > div:first-child { max-width: 62ch; }
.entete-centre h1 + .discret { margin: 0; }
.avancement { display: flex; align-items: center; gap: 1rem; min-width: min(18rem, 100%); padding: .9rem 1.2rem; background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); box-shadow: var(--ombre); }
.avancement-textes { display: flex; flex-direction: column; gap: .2rem; }
.avancement-chiffre { margin: 0; font-variant-numeric: tabular-nums; }
.avancement-chiffre strong { font-family: var(--titres); font-weight: 300; font-size: 1.6rem; }
.avancement .discret { margin: 0; font-size: .82rem; max-width: 26ch; }
.anneau {
  --p: 0; width: 64px; height: 64px; flex: none; border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--accent-pastel) 0);
  display: grid; place-items: center; transition: --p 900ms cubic-bezier(.2, .7, .3, 1);
}
.anneau::after { content: attr(data-pourcent); width: 50px; height: 50px; border-radius: 50%; background: var(--surface-pleine); display: grid; place-items: center; font-size: .8rem; font-weight: 600; color: var(--accent-fort); }
@property --p { syntax: "<number>"; inherits: false; initial-value: 0; }
progress { width: 100%; height: .5rem; appearance: none; border: 0; border-radius: 999px; background: var(--accent-pastel); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--accent-pastel); border-radius: 999px; }
progress::-webkit-progress-value { background: linear-gradient(90deg, #7fa6de, var(--accent)); border-radius: 999px; transition: width var(--doux); }
progress::-moz-progress-bar { background: linear-gradient(90deg, #7fa6de, var(--accent)); border-radius: 999px; }
.exports { display: flex; gap: .5rem; flex-wrap: wrap; }

.exemples { background: var(--exemple-fond); color: var(--exemple-texte); padding: 1.2rem 1.4rem; margin-bottom: 1.8rem; }
.exemples h2 { color: inherit; margin-bottom: .2rem; }
.exemples .discret { color: inherit; opacity: .85; margin-top: 0; }
.liste-exemples { list-style: none; padding: 0; margin: .8rem 0 0; display: flex; gap: .6rem; flex-wrap: wrap; }
.liste-exemples a { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: .8rem 1.2rem; background: var(--surface-pleine); border: 1px solid var(--trait); border-radius: 12px; text-decoration: none; color: var(--encre); min-width: 9.5rem; min-height: 3.2rem; transition: transform var(--vite), box-shadow var(--vite); }
.liste-exemples a:hover { transform: translateY(-2px); box-shadow: var(--ombre-haute); color: var(--encre); }
.ex-groupe { font-family: var(--titres); font-size: 1.1rem; }
.ex-loc { font-size: .82rem; color: var(--encre-douce); }

/* barre de filtres (ajoutée par commun.js) */
.filtres { display: flex; gap: .6rem 1rem; align-items: center; flex-wrap: wrap; margin: 0 0 1.2rem; }
.filtres[hidden] { display: none; }
.puces { display: inline-flex; padding: .25rem; background: var(--surface); border: 1px solid var(--trait); border-radius: 999px; box-shadow: var(--ombre); }
.puce { border: 0; background: transparent; padding: .38rem .95rem; border-radius: 999px; cursor: pointer; font-size: .88rem; color: var(--encre-douce); transition: background var(--vite), color var(--vite); }
.puce[aria-pressed=true] { background: var(--accent); color: #fff; }
.recherche { flex: 1 1 16rem; max-width: 24rem; position: relative; }
.recherche input { width: 100%; padding-left: 2.2rem; border-radius: 999px; background: var(--surface); }
.recherche svg { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); width: 1rem; height: 1rem; color: var(--encre-douce); pointer-events: none; }
.aucun-resultat { color: var(--encre-douce); font-style: italic; }

.groupe { padding: 1.2rem 1.3rem 1.3rem; margin-bottom: 1.4rem; }
.groupe[hidden] { display: none; }
.groupe > h2 { display: flex; align-items: baseline; gap: .6rem; }
.compte { font-family: var(--police); font-weight: 500; color: var(--accent-fort); background: var(--accent-pastel); font-size: .78rem; padding: .12rem .55rem; border-radius: 999px; font-variant-numeric: tabular-nums; }
.liste-cas { list-style: none; padding: 0; margin: 0; display: grid; gap: .45rem; }
.liste-cas li[hidden] { display: none; }
.ligne-cas {
  display: grid; grid-template-columns: 15rem 9rem 1fr auto; gap: .9rem; align-items: center;
  padding: .7rem 1rem; color: var(--encre); text-decoration: none;
  background: var(--surface-pleine); border: 1px solid var(--trait); border-radius: 12px;
  transition: transform var(--vite), box-shadow var(--vite), border-color var(--vite);
}
a.ligne-cas:hover { transform: translateY(-1px); box-shadow: var(--ombre); border-color: var(--accent-pastel-2); color: var(--encre); }
a.ligne-cas:hover .cas-id { color: var(--accent-fort); }
.cas-id { font-family: var(--mono); font-size: .82rem; overflow-wrap: anywhere; transition: color var(--vite); }
.cas-loc { color: var(--encre-douce); font-size: .88rem; }
.cas-q { font-size: .92rem; }
.pastille { font-size: .76rem; padding: .22rem .65rem; border-radius: 999px; white-space: nowrap; font-weight: 600; display: inline-flex; align-items: center; gap: .35rem; }
.pastille::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; }
.pastille-ok { background: var(--ok-fond); color: var(--ok); }
.pastille-attente { background: var(--attente-fond); color: var(--attente); }
.ligne-vide { color: var(--encre-douce); background: var(--surface-douce); }
@media (max-width: 860px) {
  .ligne-cas { grid-template-columns: 1fr auto; }
  .cas-loc, .cas-q { grid-column: 1 / -1; }
  .cas-loc:empty { display: none; }
}

/* ---------------------------------------------------------------- page cas */
.titre-cas { font-family: var(--titres); margin: 0 0 1rem; display: flex; align-items: baseline; gap: .8rem; flex-wrap: wrap; overflow-wrap: anywhere; }
.titre-cas small { font-family: var(--police); font-size: .85rem; color: var(--encre-douce); font-weight: 400; }
.aller-fiche { display: none; margin: -.5rem 0 1rem; font-size: .9rem; }
@media (max-width: 1100px) { .aller-fiche { display: block; } }
.deux-colonnes { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 1.6rem; align-items: start; }
@media (max-width: 1100px) { .deux-colonnes { grid-template-columns: minmax(0, 1fr); } }

/* une seule barre de défilement : la fiche du cas suit le défilement de la page */
.fiche-cas { align-self: start; }
.fiche-cas summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .95rem 1.2rem; background: var(--bandeau); border-bottom: 1px solid var(--trait); border-radius: var(--rayon) var(--rayon) 0 0; }
.fiche-cas details:not([open]) summary { border-radius: var(--rayon); border-bottom: 0; }
.fiche-cas summary::-webkit-details-marker { display: none; }
.resume-cas { font-family: var(--titres); font-size: 1.25rem; }
.fiche-cas summary .discret { font-size: .8rem; display: inline-flex; align-items: center; gap: .3rem; }
.fiche-cas summary .discret::after { content: ""; width: .45rem; height: .45rem; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); transition: transform var(--vite); margin-top: -.2rem; }
.fiche-cas details:not([open]) summary .discret::after { transform: rotate(-45deg); margin-top: 0; }
.fiche-cas-corps { padding: .6rem 1.2rem 1.3rem; font-size: .92rem; }
.fiche-cas-corps h3 { font-family: var(--police); font-weight: 700; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin: 1.5rem 0 .5rem; display: flex; align-items: center; gap: .6rem; }
.fiche-cas-corps h3::after { content: ""; flex: 1; height: 1px; background: var(--trait); }
.fiche-cas-corps h4 { font-size: 1.05rem; margin: .9rem 0 .25rem; }
.fiche-cas-corps p { margin: .3rem 0; }
.fiche-cas-corps ul { margin: .2rem 0 .6rem; padding-left: 1.2rem; }
.fiche-cas-corps li::marker { color: var(--accent); }
.fiche-cas-corps .lbl { font-weight: 600; margin-top: .7rem; }
.cas-meta { display: flex; gap: .4rem; flex-wrap: wrap; }
.cas-meta span { background: var(--accent-pastel); color: var(--accent-fort); padding: .15rem .65rem; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.kv { width: 100%; border-collapse: separate; border-spacing: 0; margin: .4rem 0; border: 1px solid var(--trait); border-radius: 12px; overflow: hidden; }
.kv th, .kv td { padding: .4rem .65rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--trait); }
.kv tr:last-child th, .kv tr:last-child td { border-bottom: 0; }
.kv th { width: 38%; background: var(--surface-douce); font-weight: 600; color: var(--encre-douce); font-size: .86rem; }
.question { font-family: var(--titres); font-size: 1.3rem; line-height: 1.3; padding: .8rem 1rem; background: var(--accent-pastel); border-radius: 12px; border-left: 3px solid var(--accent); }

/* fiche RCP */
.fiche-rcp { padding: 1.3rem; }
.bandeau { background: var(--accent-pastel); padding: .7rem 1rem; border-radius: 12px; font-size: .9rem; margin: 0 0 1rem; }
.bandeau-exemple { background: var(--exemple-fond); color: var(--exemple-texte); font-weight: 600; }
.bandeau-brouillon { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; background: var(--attente-fond); color: var(--encre); animation: glisse var(--doux) both; }
.bandeau-brouillon[hidden] { display: none; }
.bandeau-brouillon p { margin: 0; flex: 1 1 18rem; }
.erreurs { background: var(--erreur-fond); color: var(--erreur); border-radius: 12px; padding: .8rem 1rem; margin-bottom: 1rem; animation: glisse var(--doux) both; }
.erreurs p { margin: 0 0 .3rem; }
.erreurs ul { margin: 0; padding-left: 1.2rem; }
.erreurs:focus { outline: 2px solid var(--erreur); outline-offset: 2px; }

.entete-fiche { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .9fr) minmax(0, 1.3fr) minmax(8.6rem, 1.2fr); gap: .5rem; }
.entete-fiche .champ-entete:first-child .valeur { font-family: var(--mono); font-size: .8rem; }
@media (max-width: 640px) { .entete-fiche { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.champ-entete { padding: .55rem .75rem; display: flex; flex-direction: column; gap: .2rem; background: var(--surface-douce); border: 1px solid var(--trait); border-radius: 12px; min-width: 0; }
.etiquette { font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--encre-douce); font-weight: 600; }
.valeur { font-size: .92rem; overflow-wrap: anywhere; }
.champ-entete input[type=date] { padding: .3rem .4rem; font-size: .88rem; width: 100%; min-width: 0; }
.consigne { font-size: .84rem; color: var(--encre-douce); margin: .8rem 0 0; padding-left: .8rem; border-left: 2px solid var(--accent-pastel-2); }
.consigne + .consigne { margin-top: .4rem; }
.consigne + .consigne, .consignes-fin { margin-bottom: 1.2rem; }

.domaine { border: 1px solid var(--trait); margin: 1.1rem 0 0; padding: 0 0 .8rem; background: var(--surface-pleine); border-radius: 14px; min-width: 0; transition: border-color var(--doux), box-shadow var(--doux); }
.domaine > legend { float: left; width: 100%; padding: .7rem 1rem; margin-bottom: .2rem; background: var(--bandeau); border-radius: 14px 14px 0 0; font-family: var(--titres); font-size: 1.2rem; display: flex; align-items: center; gap: .65rem; }
.domaine > legend + * { clear: both; }
.badge-dom { font-family: var(--police); font-size: .72rem; font-weight: 700; min-width: 2rem; height: 2rem; padding: 0 .4rem; border-radius: 999px; display: inline-grid; place-items: center; background: var(--surface-pleine); color: var(--accent-fort); border: 1px solid var(--trait); transition: background var(--doux), color var(--doux); }
.domaine.rempli { border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.domaine.rempli .badge-dom { background: var(--ok); color: #fff; border-color: transparent; animation: pop 320ms ease-out; }
.legende-consigne { font-family: var(--police); font-size: .8rem; color: var(--encre-douce); }
.sous-domaine { margin-top: -.2rem; border-top-left-radius: 0; border-top-right-radius: 0; border-top: 1px dashed var(--trait); background: var(--surface-douce); }
.sous-domaine > legend { background: transparent; border-radius: 0; font-size: 1rem; color: var(--accent-fort); padding-bottom: .1rem; }
.grille { display: grid; gap: .45rem; padding: .6rem 1rem .3rem; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 720px) { .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .cols-2, .cols-3 { grid-template-columns: minmax(0, 1fr); } }
.case {
  display: flex; gap: .6rem; align-items: flex-start; padding: .5rem .65rem; cursor: pointer; font-size: .9rem;
  border: 1px solid var(--trait); border-radius: 10px; background: var(--surface-pleine);
  transition: background var(--vite), border-color var(--vite), transform var(--vite), box-shadow var(--vite);
}
.case:hover { border-color: var(--accent-pastel-2); background: var(--surface-douce); }
.case:active { transform: scale(.985); }
.case input { margin-top: .05rem; }
.case:has(input:checked) { background: var(--accent-pastel); border-color: color-mix(in srgb, var(--accent) 45%, transparent); box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 14%, transparent); }
.case input:checked + span { font-weight: 600; color: var(--accent-fort); }
.case:has(input:disabled:not(:checked)) { opacity: .55; }
.lecture-seule .case { cursor: default; }
.lecture-seule .case:hover { background: var(--surface-pleine); border-color: var(--trait); }
.lecture-seule .case:has(input:checked):hover { background: var(--accent-pastel); }
.precision { display: flex; gap: .6rem; align-items: center; padding: .45rem 1rem 0; font-size: .85rem; color: var(--encre-douce); }
.precision span { white-space: nowrap; }
@media (max-width: 640px) { .precision { flex-direction: column; align-items: stretch; gap: .25rem; } }
.vide { display: flex; gap: .5rem; align-items: center; margin: .6rem 1rem 0; font-size: .82rem; color: var(--encre-douce); cursor: pointer; }
.vide input:checked { background: var(--attente); border-color: var(--attente); }
.vide[hidden] { display: none; }
.vide-lu { margin: .6rem 1rem 0; font-size: .82rem; font-style: italic; color: var(--attente); }
.note-exclusive { margin: .35rem 1rem 0; font-size: .8rem; color: var(--attente); animation: glisse var(--vite) both; }
.note-exclusive:empty { display: none; }
.texte-libre textarea { margin: .6rem 1rem 0; width: calc(100% - 2rem); min-height: 5rem; }
.domaine.en-erreur { border-color: var(--erreur); box-shadow: 0 0 0 4px color-mix(in srgb, var(--erreur) 14%, transparent); animation: secoue 300ms ease-in-out; }

/* barre d'enregistrement collante */
.actions {
  position: sticky; bottom: 1rem; z-index: 5; margin-top: 1.4rem;
  display: flex; gap: 1rem; align-items: center; flex-wrap: wrap;
  padding: .7rem .8rem .7rem 1.1rem; border-radius: 16px;
  background: color-mix(in srgb, var(--surface-pleine) 97%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--trait); box-shadow: var(--ombre-haute);
}
.etat-fiche { flex: 1 1 12rem; display: flex; align-items: center; gap: .7rem; font-size: .86rem; color: var(--encre-douce); }
.etat-fiche progress { width: 7rem; }
.actions .btn-principal { margin-left: auto; }

/* ---------------------------------------------------------------- espace investigateur */
.form-simple { display: flex; flex-direction: column; gap: .55rem; max-width: 34rem; }
.form-simple label { font-size: .88rem; color: var(--encre-douce); }
.form-simple button { align-self: flex-start; margin-top: .6rem; }
.choix-groupes { border: 1px solid var(--trait); border-radius: 12px; padding: .5rem .9rem .8rem; display: flex; gap: .4rem .6rem; flex-wrap: wrap; margin: .4rem 0 0; }
.choix-groupes legend { font-size: .85rem; padding: 0 .35rem; color: var(--encre-douce); }
.choix-groupes .case { padding: .4rem .75rem; }
.form-ligne { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.nouveau-lien { background: var(--exemple-fond); padding: 1.2rem 1.4rem; margin-bottom: 1.5rem; animation: glisse var(--doux) both; }
.nouveau-lien h2 { color: var(--exemple-texte); }
.nouveau-lien p { max-width: 70ch; }
.copie { display: flex; gap: .5rem; align-items: stretch; flex-wrap: wrap; }
.lien-genere { flex: 1 1 20rem; font-family: var(--mono); font-size: .84rem; }
.table-defile { overflow-x: auto; border-radius: 12px; }
.tableau { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .9rem; }
.tableau th, .tableau td { text-align: left; padding: .65rem .8rem; border-bottom: 1px solid var(--trait); vertical-align: middle; }
.tableau th { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--encre-douce); font-weight: 600; background: transparent; }
.tableau tbody tr { transition: background var(--vite); }
.tableau tbody tr:hover { background: var(--surface-douce); }
.tableau tbody tr:last-child td { border-bottom: 0; }
.tableau .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tableau progress { width: 5.5rem; vertical-align: middle; margin-left: .5rem; }
.tableau tr.inactif td { color: var(--encre-douce); }
.actions-ligne form { display: flex; gap: .4rem; margin: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  body::before, .barre, .actions, .flashs, .filtres, .aller-fiche, .revoir-cas { display: none !important; }
  body { background: #fff; }
  .carte, .groupe, .fiche-cas, .fiche-rcp { box-shadow: none; backdrop-filter: none; }
}

/* ---------------------------------------------------------------- petits écrans */
#fiche-rcp, .domaine, .erreurs { scroll-margin-top: 6.5rem; }
@media (max-width: 640px) {
  .page { padding: 1.2rem 12px 4rem; }
  .barre-in { padding: .5rem 12px; gap: .4rem; }
  .marque-logo { width: 28px; height: 28px; }
  .marque-sous { display: none; }
  .qui { max-width: 11rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .fiche-rcp { padding: .9rem; }
  .grille { padding: .5rem .7rem .2rem; }
  .actions { bottom: .5rem; padding: .5rem; gap: .5rem; }
  .actions .lien-btn, .etat-fiche progress { display: none; }
  .etat-fiche { flex: 1 1 auto; font-size: .78rem; }
  .actions .btn-principal { padding: .6rem 1rem; }
  .bloc-etroit { margin: 1.5rem auto; padding: 1.5rem 1.2rem; }
  .avancement { width: 100%; }
  .champ-entete .valeur { font-size: .84rem; }
}

/* ---------------------------------------------------------------- séances */
.seance { display: flex; gap: 1rem 1.5rem; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 1rem 1.3rem; margin-bottom: 1.6rem; background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon); box-shadow: var(--ombre); }
.seance form { margin: 0; }
.seance-texte { flex: 1 1 24rem; }
.seance-titre { font-family: var(--titres); font-size: 1.35rem; margin: 0 0 .15rem; display: flex; align-items: center; gap: .6rem; }
.seance-texte .discret { margin: 0; }
.seance-ouverte { background: linear-gradient(120deg, rgba(221, 242, 232, .85), rgba(223, 234, 250, .85)); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.seance-grace { background: var(--attente-fond); }
.voyant { width: .7rem; height: .7rem; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 50%, transparent); animation: pulse 2s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 45%, transparent); } 100% { box-shadow: 0 0 0 .7rem transparent; } }
.seance.bientot { background: var(--attente-fond); }
.pastille-presente { background: var(--accent-pastel); color: var(--accent-fort); }
.cas-masque { margin: 1.2rem 0; padding: 1.5rem; text-align: center; color: var(--encre-douce); background: var(--surface-douce); border: 1px dashed var(--champ); border-radius: 12px; }
.bandeau-verrou { background: var(--attente-fond); }
.bandeau-admin { display: flex; gap: .6rem 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.bandeau-admin p { margin: 0; }
.bandeau-admin form { margin: 0; }

/* contenu du cas : non sélectionnable, filigrane au nom du centre */
.contenu-protege { position: relative; overflow: hidden; -webkit-user-select: none; user-select: none; }
.avec-filigrane::after { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; background: url("../centre/filigrane.svg") repeat; }
@media print { .contenu-protege { display: none; } }
.bandeau-seance.bientot { background: var(--attente-fond); }
.pastille-clos { background: var(--erreur-fond); color: var(--erreur); }
.encadre-attention { background: var(--attente-fond); border-radius: 12px; padding: .7rem .9rem; font-size: .92rem; }
.form-inline { display: inline; margin: 0; }
.lien-danger { color: var(--erreur); }
.lien-danger:hover { color: var(--erreur); background: var(--erreur-fond); }

/* ---------------------------------------------------------------- attestation de clôture */
.form-clore { display: flex; flex-direction: column; gap: 10px; align-items: flex-end; max-width: 34rem; }
.attestation { display: flex; gap: 9px; align-items: flex-start; text-align: left; font-size: 13px; color: var(--encre-douce); cursor: pointer; }
.attestation input { margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.attestation span { line-height: 1.45; }
@media (max-width: 720px) { .form-clore { align-items: stretch; max-width: none; } }

/* ---------------------------------------------------------------- question du cas, toujours visible */
.question-cas {
  margin: .2rem 0 1.1rem;
  padding: .85rem 1rem;
  background: var(--accent-pastel);
  border: 1px solid var(--accent-pastel-2);
  border-radius: var(--rayon-petit);
}
.question-titre {
  margin: 0 0 .25rem;
  font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent-fort);
}
.question-cas .question { margin: 0; padding: 0; background: none; border: 0; border-radius: 0;
  font-family: var(--titres); font-size: 1.12rem; font-weight: 600; color: var(--encre); }


/* ---------------------------------------------------------------- ouverture de séance et compteur */
.form-ouvrir { display: flex; flex-direction: column; gap: .6rem; align-items: flex-end; max-width: 30rem; }
.nb-cas { display: flex; align-items: center; gap: .7rem; font-size: .9rem; color: var(--encre-douce); text-align: right; }
.nb-cas input { width: 4.6rem; text-align: center; font-size: 1.05rem; font-weight: 600; }
.estimation { margin: 0; font-size: .8rem; text-align: right; }
.compteur-cas { margin: .5rem 0 0; font-size: .9rem; }
.compteur-cas strong { color: var(--accent-fort); }
.compteur-cas .discret { margin-left: .4rem; font-size: .85rem; }
@media (max-width: 720px) { .form-ouvrir { align-items: stretch; max-width: none; } .nb-cas, .estimation { text-align: left; } }

/* ---------------------------------------------------------------- fenêtres modales */
dialog.modale {
  border: 0; border-radius: var(--rayon); padding: 0; max-width: min(34rem, 92vw);
  background: var(--surface-pleine); color: var(--encre); box-shadow: var(--ombre-haute);
}
dialog.modale::backdrop { background: rgba(28, 42, 61, .38); backdrop-filter: blur(2px); }
dialog.modale form { padding: 1.4rem 1.5rem 1.2rem; display: flex; flex-direction: column; gap: .7rem; }
dialog.modale h2 { margin: 0; font-size: 1.35rem; }
dialog.modale p { margin: 0; }
dialog.modale textarea { width: 100%; min-height: 7rem; resize: vertical; }
dialog.modale .nb-cas { justify-content: flex-start; text-align: left; font-size: .95rem; color: var(--encre); }
dialog.modale .estimation { text-align: left; font-size: .85rem; color: var(--accent-fort); min-height: 1.1rem; }
dialog.modale .form-ouvrir { max-width: none; align-items: stretch; }
.modale-actions { display: flex; justify-content: flex-end; align-items: center; gap: 1rem; margin-top: .4rem; }
/* Sans JavaScript, la fenêtre reste un bloc ordinaire en bas de page. */
dialog.modale[open] { position: static; margin: 1.2rem auto; }
dialog.modale:modal { position: fixed; margin: auto; }

/* ---------------------------------------------------------------- signalement */
.barre-fin { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
/* Boutons de la barre : même gabarit pour « Tous les cas » et « Signaler un problème ». */
.btn-barre {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .34rem .9rem; border-radius: 999px;
  border: 1px solid var(--trait); background: var(--surface-pleine);
  color: var(--accent); font: inherit; font-size: .85rem; line-height: 1.4;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  box-shadow: 0 1px 2px rgba(34, 60, 100, .05);
  transition: background var(--vite), color var(--vite), border-color var(--vite), transform var(--vite);
}
.btn-barre:hover { background: var(--accent-pastel); color: var(--accent-fort); border-color: var(--accent-pastel-2); }
.btn-barre:active { transform: translateY(1px); }

.note-lot { margin: 0 0 1.1rem; font-size: .9rem; color: var(--encre-douce); }

/* ---------------------------------------------------------------- signalements côté investigateur */
.liste-signalements { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .8rem; }
.liste-signalements li { border: 1px solid var(--trait); border-radius: var(--rayon-petit); padding: .8rem 1rem; background: var(--surface-douce); }
.liste-signalements li.traite { opacity: .62; }
.liste-signalements li.en-attente { border-left: 3px solid var(--attente); }
.sig-tete { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; font-size: .85rem; }
.sig-centre { font-weight: 600; }
.sig-message { margin: .5rem 0 .6rem; font-size: .95rem; white-space: normal; }
.lien-alerte { color: var(--attente); font-weight: 600; }

/* ------------------------------------------------- retour à la fiche du cas */
/* La page n'a qu'un seul ascenseur : ce bouton ramène au cas quand il est sorti de l'écran. */
.revoir-cas {
  position: fixed; left: 20px; bottom: 1.4rem; z-index: 10;
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .55rem 1.05rem; border-radius: 999px; border: 1px solid var(--trait);
  background: color-mix(in srgb, var(--surface-pleine) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  color: var(--accent-fort); font: inherit; font-size: .86rem; font-weight: 600;
  box-shadow: var(--ombre-haute); cursor: pointer;
  opacity: 0; visibility: hidden; transform: translateY(.4rem);
  transition: opacity var(--vite), transform var(--vite), visibility var(--vite);
}
.revoir-cas::before { content: ""; width: .45rem; height: .45rem; border-left: 1.6px solid currentColor; border-top: 1.6px solid currentColor; transform: rotate(45deg); }
.revoir-cas:hover { background: var(--surface-pleine); border-color: var(--accent-pastel-2); }
.revoir-cas.visible { opacity: 1; visibility: visible; transform: none; }
@media (max-width: 720px) { .revoir-cas { left: 12px; bottom: 1rem; } }
