/* BmiReal — feuille unique, sans dépendance externe.

   Mêmes jetons, mêmes cartes, mêmes segments que MICMAC et AdapteUnRein, pour
   que les applications se lisent comme des sœurs. L'accent est violet (#6B3FA0 en clair,
   7,4:1 sur blanc ; #B79CF0 en sombre). Les marques aussi sont violettes : le
   style les distingue (trait plein, pointillé, fond surligné), l'alerte reste rouge.
   Ce qui est propre à celle-ci : le texte corrigé et ses quatre marques
   (souligné, pointillé, surligné, alerte) ; la section Biologie (ex-Biolingo),
   aux mêmes jetons — seules les valeurs hors normes gardent rouge et bleu. */

:root {
  color-scheme:  light;
  --bg:          #f6f7f8;
  --surface:     #ffffff;
  --surface-2:   #f9fafb;
  --band:        #eef1f4;
  --ink:         #1b1d20;
  --ink-2:       #4f5660;
  --ink-3:       #77808b;
  --line:        #dfe3e8;
  --line-strong: #c8ced6;
  --accent:      #6b3fa0;
  --accent-ink:  #ffffff;
  --accent-soft: #f2ecfa;
  --mot-2:       #6f6f6f;
  --sure:        #6b3fa0;
  --approchee:   #7d4fb5;
  --choix-bg:    #ebdffb;
  --choix-bord:  #8a5cc7;
  --alerte-bg:   #fde3e1;
  --alerte-bord: #c0322a;
  --jaune-bg:    #fff6d6;
  --jaune-bord:  #d9a400;
  --haut:        #b42318;
  --bas:         #1f5fbf;
  --radius:      10px;
  --radius-sm:   7px;
  --shadow:      0 1px 2px rgba(20, 28, 38, .06), 0 4px 16px rgba(20, 28, 38, .05);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* theme.js résout « auto » et pose data-theme : une seule palette sombre à décrire. */
:root[data-theme="dark"] {
  color-scheme:  dark;
  --bg:          #121417;
  --surface:     #1a1d21;
  --surface-2:   #1f2328;
  --band:        #252a30;
  --ink:         #e7eaee;
  --ink-2:       #aeb6bf;
  --ink-3:       #939ba4;
  --line:        #2d3239;
  --line-strong: #3d444d;
  --accent:      #b79cf0;
  --accent-ink:  #1a0f2e;
  --accent-soft: #2a2140;
  --mot-2:       #b4b4b4;
  --sure:        #b79cf0;
  --approchee:   #c9b3f5;
  --choix-bg:    #3b2a5e;
  --choix-bord:  #a585e0;
  --alerte-bg:   #4a1d1a;
  --alerte-bord: #ff7d72;
  --jaune-bg:    #3d3214;
  --jaune-bord:  #e0b43a;
  --haut:        #ff8a7a;
  --bas:         #8ab4ff;
  --shadow:      0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* Une classe qui pose un display l'emporterait sur l'attribut hidden. */
[hidden] { display: none !important; }

body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5;
  color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased;
}
h2 { font-size: 1rem; margin: 0 0 .5em; }
p  { margin: 0 0 .6em; }
.invisible { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.skip { position: absolute; left: -9999px; top: 0; z-index: 10;
        background: var(--accent); color: var(--accent-ink); padding: .6em 1em; }
.skip:focus { left: .5rem; top: .5rem; }

:where(button, select, input, textarea, a, .c):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); text-underline-offset: 2px; }

/* ------------------------------------------------------------------ topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .6rem clamp(.8rem, 2vw, 1.4rem);
  background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: .6rem; min-width: 0; }
/* Logo et barre du haut — bloc commun aux applications (Notion : « Modèle
   d'application »). static/logo.svg (clair) et static/logo_dark.svg (sombre),
   copiés depuis logo/ par ./<application> logo, hauteur fixe, largeur d'après
   les proportions. --barre est la hauteur de la barre : ce qui colle sous elle
   (onglets, panneau de filtres) s'y cale, au lieu d'un nombre de rem à deviner. */
:root { --barre: calc(56px + 1.5rem + 1px); }
@media (max-width: 480px) { :root { --barre: calc(36px + 1.5rem + 1px); } }
.topbar { box-sizing: border-box; min-height: var(--barre); padding-top: .75rem; padding-bottom: .75rem; }
.logo { display: block; height: 56px; width: auto; max-width: 62vw; object-fit: contain; object-position: left center; flex: none; }
.logo.sombre { display: none; }
:root[data-theme="dark"] .logo.clair { display: none; }
:root[data-theme="dark"] .logo.sombre { display: block; }
@media (max-width: 480px) { .logo { height: 36px; } }
.nom { font-size: 1.15rem; letter-spacing: .02em; }
.theme { display: flex; flex: none; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
         overflow: hidden; background: var(--surface-2); }
.theme label { display: flex; }
.theme input { position: absolute; opacity: 0; pointer-events: none; }
.theme span { display: grid; place-items: center; cursor: pointer; width: 2rem; height: 1.75rem;
              color: var(--ink-3); border-left: 1px solid var(--line-strong); }
.theme label:first-child span { border-left: 0; }
.theme span:hover { color: var(--ink-2); background: var(--surface); }
.theme input:checked + span { color: var(--accent); background: var(--accent-soft); }
.theme input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ------------------------------------------------------------------ layout */
.layout {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(.8rem, 2vw, 1.4rem); align-items: start;
  padding: clamp(.8rem, 2vw, 1.4rem); max-width: 96rem; margin: 0 auto;
}
@media (max-width: 860px) { .layout { grid-template-columns: minmax(0, 1fr); } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.saisie, .resultat { padding: .8rem; min-width: 0; }

.segmented { display: flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; }
.segmented label { flex: 1; display: flex; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { flex: 1; text-align: center; padding: .45em .3em; font-size: .88rem; cursor: pointer;
  color: var(--ink-2); background: var(--surface-2); border-left: 1px solid var(--line-strong); white-space: nowrap; }
.segmented label:first-child span { border-left: 0; }
.segmented input:checked + span { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (max-width: 480px) { .segmented span { font-size: .78rem; } }

.cases { border: 0; margin: .6rem 0 .5rem; padding: 0; display: flex; flex-wrap: wrap; gap: .3rem 1rem;
         font-size: .9rem; color: var(--ink-2); }
.cases label { display: inline-flex; align-items: center; gap: .35em; cursor: pointer; }
.cases input { accent-color: var(--accent); }
.cases label.eteint { opacity: .45; cursor: default; }
.cases .interrupteur { display: inline-flex; align-items: center; gap: .5em; cursor: pointer; }
/* Sous les onglets : le bandeau, puis les réglages, collés à lui. */
#saisie-texte, #saisie-biologie, #saisie-ett { margin-top: .6rem; }
.bandeau + .cases, .bandeau + .ett-tete { margin-top: 0; }

textarea#entree {
  display: block; width: 100%; min-height: 26rem; resize: vertical;
  font: inherit; font-size: .95rem; line-height: 1.55; padding: .7em .8em;
  border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--ink);
}
textarea#entree::placeholder { color: var(--ink-3); }
/* 16 px au doigt, exprès : Safari iOS agrandit la page au focus d'un champ plus
   petit et ne la réduit jamais (leçon d'AdapteUnRein, section 13). */
@media (hover: none) and (pointer: coarse) { textarea#entree, textarea.orbis, .fenetre .commentaire input { font-size: 16px; } }

/* Biologie : l'export d'Orbis est aligné en colonnes — chasse fixe (police du
   système, rien de chargé), sans retour à la ligne. */
textarea.orbis {
  display: block; width: 100%; min-height: 26rem; resize: vertical;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: .78rem; line-height: 1.5; padding: .7em .8em;
  white-space: pre; overflow-wrap: normal; overflow-x: auto;
  border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--ink);
}
textarea.orbis::placeholder { color: var(--ink-3); }

/* Sous le bandeau de l'onglet Texte : le lien vers les consignes de rédaction. */
.lien-consignes { margin: 0 0 .55rem; padding: 0 2px; font-size: .8rem; line-height: 1.45; color: var(--ink-3); }
.lien-consignes a { font-weight: 600; }

/* Bandeau d'avertissement, à la façon des alertes de NutriRéa : un trait
   d'accent à gauche sur fond doux. */
.bandeau {
  margin: 0 0 .55rem; padding: 8px 10px; font-size: .84rem; line-height: 1.45; color: var(--ink);
  background: var(--accent-soft); border-left: 3px solid var(--accent); border-radius: var(--radius-sm);
}
.bandeau strong { color: var(--accent); font-weight: 650; }
/* ETT : le sexe manque, les normes qui en dépendent sont celles d'une femme. */
.ett-alerte { margin: 0 0 .55rem; padding: 8px 10px; font-size: .84rem; line-height: 1.45; color: var(--ink);
              background: var(--jaune-bg); border: 1px solid var(--jaune-bord); border-radius: var(--radius-sm); }

.actions-saisie { display: flex; align-items: center; justify-content: flex-end; gap: .8rem; margin-top: .55rem; }
.raccourci { font-size: .76rem; color: var(--ink-3); }
@media (hover: none) and (pointer: coarse) { .raccourci { display: none; } }
kbd { font: inherit; font-size: .72rem; padding: .05em .4em; border: 1px solid var(--line-strong); border-bottom-width: 2px;
      border-radius: 4px; background: var(--surface-2); color: var(--ink-2); }
button.preset, button.bouton-primaire {
  font: inherit; cursor: pointer; border-radius: var(--radius-sm); padding: .4em .9em;
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink-2);
}
button.preset:hover { background: var(--surface); color: var(--ink); }
button.bouton-primaire { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.bouton-primaire:hover:not(:disabled) { filter: brightness(1.08); }
button.bouton-primaire:disabled { opacity: .42; cursor: default; }

/* ----------------------------------------------------------------- résultat */
.barre { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .55rem; }
.bilan { margin: 0; font-size: .86rem; color: var(--ink-2); }
.bilan strong { color: var(--ink); }
.bilan .attente { color: var(--approchee); font-weight: 600; }
.bilan .conseils { color: var(--ink-2); }

.sortie {
  min-height: 26rem; white-space: pre-wrap; word-wrap: break-word;
  font-size: .95rem; line-height: 1.75; padding: .7em .8em;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
}
.sortie:empty::before { content: "Le texte corrigé s'affiche ici, au fil de la frappe."; color: var(--ink-3); }
.sortie-ett:empty::before { content: "Le compte rendu s'écrira ici, au fur et à mesure que vous choisirez les appréciations ou saisirez les mesures."; }

/* Les quatre marques. Rien d'autre n'est souligné, sauf les liens. */
.c { cursor: pointer; border-radius: 3px; }
.c.sure { text-decoration: underline; text-decoration-color: var(--sure); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.c.approchee { text-decoration: underline dotted; text-decoration-color: var(--approchee); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.c.choix { background: var(--choix-bg); box-shadow: 0 0 0 1px var(--choix-bord) inset; padding: 0 .12em; }
.c.choix.fait { background: none; box-shadow: none; padding: 0; text-decoration: underline; text-decoration-color: var(--choix-bord); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.c.alerte { background: var(--alerte-bg); box-shadow: 0 0 0 1px var(--alerte-bord) inset; padding: 0 .12em; }
.c.annule { text-decoration: line-through; text-decoration-color: var(--ink-3); color: var(--ink-2); }
.c.typo { cursor: default; }
/* Conseil de rédaction : surligné jaune, à part des marques violettes ; rien n'est changé sans choix. */
.c.conseil { background: var(--jaune-bg); box-shadow: 0 0 0 1px var(--jaune-bord) inset; padding: 0 .12em; }
.c.conseil.fait { background: none; box-shadow: none; padding: 0; text-decoration: underline; text-decoration-color: var(--jaune-bord);
                  text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.voir .c.typo { text-decoration: underline dotted; text-decoration-color: var(--line-strong); cursor: pointer; }
.c:hover, .c.actif { outline: 1px solid var(--accent); outline-offset: 1px; }

.retraits { margin: 0 0 .6rem; font-size: .84rem; color: var(--ink-2);
  background: var(--band); border-radius: var(--radius-sm); padding: .35em .7em; }
.retraits summary { cursor: pointer; }
.retraits ol { margin: .4rem 0 .2rem; padding-left: 1.4rem; }
.retraits li { margin: .15rem 0; }
.retraits .regle { color: var(--ink-3); font-size: .78rem; }
.retraits .texte { white-space: pre-wrap; text-decoration: line-through; color: var(--ink-3); }

/* ---------------------------------------------------------------- biologie */
.barre-actions { display: flex; flex: none; align-items: center; gap: .6rem; flex-wrap: nowrap; justify-content: flex-end; }
.profil { display: inline-flex; align-items: center; gap: .4em; font-size: .84rem; color: var(--ink-2); }
.profil select { font: inherit; font-size: .86rem; padding: .3em .5em; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink); }
@media (hover: none) and (pointer: coarse) { .profil select { font-size: 16px; } }
/* Mêmes hauteurs partout (ETT à part) : celle de l'onglet Imagerie, à gauche
   comme à droite tant qu'il n'y a pas de texte. La zone de saisie remplit. */
@media (min-width: 861px) {
  :root { --hauteur: 647px; }
  body:not([data-mode="ett"]) .saisie { min-height: var(--hauteur); display: flex; flex-direction: column; }
  #saisie-texte:not([hidden]), #saisie-biologie:not([hidden]) { flex: 1; display: flex; flex-direction: column; }
  textarea#entree, textarea.orbis { flex: 1; min-height: 12rem; }
  #resultat-texte, #resultat-biologie { min-height: var(--hauteur); display: flex; flex-direction: column; }
  #resultat-texte .sortie, #resultat-biologie .sortie { flex: 1; min-height: 8rem; }
}
.accueil { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem .8rem;
  margin: 0 0 .6rem; padding: .6rem .8rem; border-radius: var(--radius-sm);
  background: var(--accent-soft); color: var(--ink); font-size: .88rem; }
.accueil p { margin: 0; }
.sortie.biologie:empty::before { content: "Aucun examen du modèle reconnu dans ce collage."; }
/* Le titre d'un paragraphe, et à côté (hors du texte copié) : le bouton copier. */
.titre-paragraphe { font-weight: 650; letter-spacing: .02em; color: var(--accent); }
.outils { display: inline-flex; align-items: center; flex-wrap: wrap; gap: .25rem; margin-left: .45rem;
  vertical-align: 1px; user-select: none; -webkit-user-select: none; white-space: normal; line-height: 1.2; }
button.copier-paragraphe { display: inline-grid; place-items: center; width: 1.45rem; height: 1.3rem; padding: 0; cursor: pointer;
  border-radius: 5px; border: 1px solid transparent; background: none; color: var(--ink-3); }
button.copier-paragraphe:hover { border-color: var(--line-strong); color: var(--accent); background: var(--surface-2); }
button.copier-paragraphe.fait { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
/* Valeurs hors normes (marques + et - d'Orbis) ; calculs ; cases. */
.valeur.haut { color: var(--haut); font-weight: 600; }
.valeur.bas { color: var(--bas); font-weight: 600; }
.valeur.doublon { text-decoration: underline dotted; text-decoration-color: var(--approchee); text-decoration-thickness: 2px; text-underline-offset: 3px; cursor: help; }
.calcul { font-style: italic; color: var(--ink-2); }
/* La case épouse son contenu (« … » quand elle est vide) ; les espaces autour
   restent du texte, hors de l'encadré. */
input.case {
  font: inherit; font-size: .9em; field-sizing: content; min-width: 1ch; max-width: 9em; padding: 0 .25em; margin: 0;
  line-height: 1.3; border: 1px dashed var(--line-strong); border-radius: 4px; background: var(--surface-2); color: var(--ink);
  vertical-align: baseline; text-align: center;
}
input.case::placeholder { color: var(--ink-3); }
input.case:focus { outline: 2px solid var(--accent); outline-offset: 0; border-style: solid; background: var(--surface); }
input.case:not(:placeholder-shown) { border-style: solid; border-color: var(--choix-bord); background: var(--choix-bg); }
@media (hover: none) and (pointer: coarse) { input.case { font-size: 16px; } }
.ignorees ul { margin: .4rem 0 .2rem; padding: 0; list-style: none; display: grid; gap: .25rem; }
.ignorees li { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; }
.ignorees .motif { color: var(--ink-3); font-size: .78rem; }
.ignorees .ligne-ignoree { min-width: 0; overflow-wrap: anywhere; }
.ignorees .lien { flex: none; font: inherit; font-size: .78rem; background: none; border: 0; padding: 0; color: var(--accent);
  cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
/* Une colonne : la saisie raccourcit, pour que le résultat reste à portée. */
@media (max-width: 860px) {
  textarea.orbis { min-height: 11rem; }
  .sortie.biologie { min-height: 8rem; }
}
.legende i.l-haut { color: var(--haut); font-weight: 600; }
.legende i.l-bas { color: var(--bas); font-weight: 600; }
.legende i.l-calcul { font-style: italic; }
.l-case { border: 1px dashed var(--line-strong); border-radius: 4px; padding: 0 .25em; background: var(--surface-2); font-style: normal; }

/* --------------------------------------------------------------------- ETT */
.ett-tete { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .55rem; }
.segmented.compact { flex: none; }
.ett-tete #ett-defauts { margin-right: auto; padding: .3em 1.2em; font-size: .84rem; line-height: inherit; border-radius: var(--radius-sm); }
@media (max-width: 480px) { .ett-tete #ett-defauts { font-size: .78rem; } }
.ett-tete .interrupteur { display: flex; align-items: center; gap: .5em; margin-left: .4rem; font-size: .84rem; cursor: pointer; }
.interrupteur input { position: absolute; opacity: 0; pointer-events: none; }
.interrupteur .piste { position: relative; flex: none; width: 2.1em; height: 1.2em; border-radius: 1em; background: var(--line-strong); transition: background .15s; }
.interrupteur .piste::after { content: ""; position: absolute; top: .15em; left: .15em; width: .9em; height: .9em; border-radius: 50%; background: var(--surface, #fff); transition: transform .15s; }
.interrupteur input:checked + .piste { background: var(--accent); }
.interrupteur input:checked + .piste::after { transform: translateX(.9em); }
.interrupteur input:focus-visible + .piste { outline: 2px solid var(--accent); outline-offset: 2px; }
.import[hidden] { display: none; }
@media (max-width: 560px) { .ett-tete { flex-wrap: wrap; } }
.segmented.compact span { padding: .3em 1.2em; font-size: .84rem; }
textarea.import {
  display: block; width: 100%; height: 4.2rem; min-height: 2.6rem; resize: vertical;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: .76rem; line-height: 1.4;
  padding: .45em .7em; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--ink);
}
textarea.import::placeholder { color: var(--ink-3); }
textarea.import.depot { outline: 2px dashed var(--accent); outline-offset: 2px; }
#ett-import-bilan:empty { display: none; }
.ignorees-vp { cursor: help; text-decoration: underline dotted; text-underline-offset: 3px; }
.formulaire { display: grid; gap: .5rem; margin-top: .6rem; }
.ett-section { margin: 0; padding: .35rem .7rem .5rem; border: 1px solid var(--line); border-radius: var(--radius-sm); min-width: 0; }
.ett-section legend { padding: 0 .35rem; font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.ett-examen { display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; margin: .15rem 0 .3rem; }
.ett-champ { display: inline-flex; align-items: center; gap: .5rem; font-size: .86rem; color: var(--ink-2); }
.ett-champ input { font: inherit; font-size: .86rem; padding: .2em .45em; border: 1px solid var(--line-strong); border-radius: 5px;
  background: var(--surface-2); color: var(--ink); width: 9.5rem; }
.ett-app { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem .6rem; margin: .22rem 0; }
.ett-app > .lib { flex: none; width: 11rem; font-size: .86rem; color: var(--ink); }
.pastilles { display: inline-flex; flex-wrap: wrap; gap: .25rem; }
.pastilles button { font: inherit; font-size: .8rem; line-height: 1.3; padding: .14em .65em; border-radius: 99px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink-2); }
.pastilles button:hover { border-color: var(--accent); color: var(--ink); }
.pastilles button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); font-weight: 600; }
/* Choix venu des normes : pastille pointillée (cliquée : trait plein). */
.pastilles button.on.norme { border-style: dashed; border-width: 1.5px; }
/* Choix cliqué puis remplacé par les normes d'une mesure saisie : pointillé rouge. */
.pastilles button.on.norme.change { border-color: var(--haut); color: var(--haut); background: var(--alerte-bg); }
.ett-app .auto { font: inherit; font-size: .74rem; background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px; }
.ett-liste { display: flex; flex-wrap: wrap; gap: .15rem .9rem; margin: 0 0 .35rem 11.6rem; font-size: .84rem; color: var(--ink-2); }
.ett-liste label { display: inline-flex; align-items: center; gap: .3em; cursor: pointer; }
.ett-liste input { accent-color: var(--accent); }
.ett-mesures { display: grid; grid-template-columns: repeat(auto-fill, minmax(14.5rem, 1fr)); gap: .2rem 1.4rem; margin: .1rem 0 .45rem 1.2rem; }
.ett-mesure { display: grid; grid-template-columns: minmax(0, 1fr) 4.4rem 4.4rem; align-items: center; gap: .4rem; font-size: .82rem; color: var(--ink-2); }
.ett-mesure .lib { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ett-mesure input { font: inherit; font-size: .86rem; width: 100%; padding: .12em .4em; text-align: right; font-variant-numeric: tabular-nums;
  border: 1px solid var(--line-strong); border-radius: 5px; background: var(--surface-2); color: var(--ink); }
.ett-mesure input:focus { outline: 2px solid var(--accent); outline-offset: 0; background: var(--surface); }
.ett-mesure input.importe { background: var(--accent-soft); border-color: var(--choix-bord); }
.ett-mesure.hors input { color: var(--haut); font-weight: 650; }
.ett-mesure .u { font-size: .76rem; color: var(--ink-3); }
.ett-titre { margin: .22rem 0; font-size: .86rem; color: var(--ink); }
.ett-calcul { margin: 0 0 .2rem 1.2rem; font-size: .8rem; color: var(--ink-3); font-style: italic; }
@media (max-width: 1250px) {
  .ett-app > .lib { width: 9rem; }
  .ett-liste { margin-left: 1.2rem; }
}
/* Le compte rendu reste en vue pendant qu'on remplit le formulaire. */
#resultat-ett { position: sticky; top: calc(var(--barre) + .8rem); }
/* Modifiable, et copié avec sa mise en forme : en-tête en gras, ligne suivante en italique. */
.sortie-ett { min-height: 6rem; max-height: calc(100vh - var(--barre) - 11rem); overflow-y: auto; white-space: normal;
  font-size: .93rem; line-height: 1.65; color: var(--ink); background: var(--surface-2); }
.sortie-ett:focus { outline: 2px solid var(--accent); outline-offset: -1px; background: var(--surface); }
.sortie-ett div { white-space: pre-wrap; }
@media (max-width: 860px) { #resultat-ett { position: static; } .sortie-ett { max-height: none; } }
.ett-mesure input.calcule { font-style: italic; }
.l-calcule { font-style: italic; }
.l-change { border: 1.5px dashed var(--haut); color: var(--haut); background: var(--alerte-bg); border-radius: 4px; padding: 0 .3em; font-style: normal; }
.l-importe { background: var(--accent-soft); border: 1px solid var(--choix-bord); border-radius: 4px; padding: 0 .3em; font-style: normal; }
.legende i.l-hors { color: var(--haut); font-weight: 650; }
.l-auto { border: 1.5px dashed var(--accent); border-radius: 99px; padding: 0 .45em; background: var(--accent-soft); font-style: normal; }

.legende { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; margin-top: .6rem; font-size: .78rem; color: var(--ink-3); }
.legende i { font-style: normal; color: var(--ink-2); }
.l-sure { text-decoration: underline; text-decoration-color: var(--sure); text-underline-offset: 3px; }
.l-approchee { text-decoration: underline dotted; text-decoration-color: var(--approchee); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.l-choix { background: var(--choix-bg); box-shadow: 0 0 0 1px var(--choix-bord) inset; padding: 0 .15em; border-radius: 3px; }
.legende i.l-conseil { background: var(--jaune-bg); box-shadow: 0 0 0 1px var(--jaune-bord) inset; padding: 0 .15em; border-radius: 3px; }
.voir-typo { display: inline-flex; align-items: center; gap: .3em; cursor: pointer; }

/* ------------------------------------------------------------------- bulle */
.bulle {
  position: absolute; z-index: 20; max-width: min(26rem, 92vw); min-width: 14rem;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: .55rem .65rem; font-size: .86rem;
}
.bulle .regle { color: var(--ink-3); font-size: .76rem; margin-bottom: .3rem; }
.bulle .orig { margin: 0 0 .4rem; }
.bulle .orig del { color: var(--ink-2); text-decoration-color: var(--alerte-bord); }
.bulle .options { display: grid; gap: .25rem; margin: .3rem 0; }
.bulle .options button {
  font: inherit; text-align: left; cursor: pointer; padding: .32em .5em; border-radius: 6px;
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink);
}
.bulle .options button:hover, .bulle .options button.on { border-color: var(--accent); background: var(--accent-soft); }
.bulle .options kbd { font: inherit; font-size: .72rem; color: var(--ink-3); margin-right: .4em; }
.bulle .pied { display: flex; justify-content: space-between; gap: .5rem; margin-top: .35rem; }
.bulle .lien { font: inherit; font-size: .78rem; background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.bulle .note { color: var(--ink-3); font-size: .76rem; }
.bulle .raison { margin: 0 0 .4rem; line-height: 1.45; }
.bulle a.lien { font-size: .78rem; }

/* -------------------------------------------------------------- signalement */
.fenetre { border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow); max-width: min(30rem, 94vw); padding: 1rem 1.1rem; }
.fenetre::backdrop { background: rgba(0,0,0,.35); }
.fenetre dl { display: grid; grid-template-columns: auto 1fr; gap: .25rem .8rem; font-size: .88rem; margin: .4rem 0 .8rem; }
.fenetre dt { color: var(--ink-3); }
.fenetre dd { margin: 0; word-break: break-word; }
.fenetre .commentaire { display: grid; gap: .25rem; font-size: .84rem; color: var(--ink-2); }
.fenetre .commentaire input { font: inherit; padding: .4em .5em; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--ink); }
.fenetre .actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .8rem; }
.aide { color: var(--ink-3); font-size: .8rem; margin: .45rem 0 0; }

/* Pied de page — bloc commun aux applications : grandes marges (celles de
   MICMAC), même police, même taille, même gris ; les intitulés en encre pleine,
   les liens à l'accent. Seule la largeur suit la grille de chaque page. */
.colophon {
  max-width: 96rem; margin: 0 auto;
  padding: 1.5rem clamp(.8rem, 3vw, 1.6rem) 3rem;
  font-size: .84rem; line-height: 1.55; color: var(--ink-2);
}
.colophon p { margin: 0 0 .55em; }
.colophon strong { font-weight: 600; color: var(--ink); }
.colophon a { color: var(--accent); }
.mentions {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 1rem; overflow: hidden;
}
.mentions section { padding: .8rem 1rem .7rem; }
.mentions section + section { border-left: 1px solid var(--line); }
.mentions h2 {
  font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 .45rem;
}
.mentions p { margin: 0; line-height: 1.55; }
.mentions strong { color: var(--ink); font-weight: 600; }
.mentions ul { margin: 0; padding: 0; list-style: none; display: grid; gap: .3rem; }
@media (max-width: 860px) {
  .mentions { grid-template-columns: minmax(0, 1fr); }
  .mentions section + section { border-left: 0; border-top: 1px solid var(--line); }
}

/* --------------------------------------------------------------- consignes
   Page /consignes : la fiche « Rédaction de textes médicaux », mise en page
   (le texte est celui de la fiche Pages). Sommaire fixe à gauche sur grand
   écran ; rubriques en blocs, cartes, tableau « à éviter / à écrire ». */
.brand { color: inherit; text-decoration: none; }
.consignes {
  display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: clamp(1rem, 3vw, 2.2rem); align-items: start;
  max-width: 76rem; margin: 0 auto; padding: clamp(.8rem, 2vw, 1.6rem) 16px 0;
}
.consignes [id] { scroll-margin-top: calc(var(--barre) + 1rem); }

/* Sommaire */
.sommaire { position: sticky; top: calc(var(--barre) + 1rem); max-height: calc(100vh - var(--barre) - 2rem); overflow: auto;
  font-size: .84rem; line-height: 1.35; }
.sommaire .retour { display: inline-block; margin-bottom: 1rem; font-weight: 600; text-decoration: none; }
.sommaire .retour:hover { text-decoration: underline; }
.sommaire ol { list-style: none; margin: 0; padding: 0; }
.sommaire > ol > li { margin-bottom: .8rem; }
.sommaire > ol > li > a { display: block; font-weight: 650; color: var(--ink); text-decoration: none; padding: .2rem 0; }
.sommaire ol ol { margin: .25rem 0 0; border-left: 2px solid var(--line); }
.sommaire ol ol a { display: block; color: var(--ink-2); text-decoration: none; padding: .2rem 0 .2rem .75rem; margin-left: -2px;
  border-left: 2px solid transparent; }
.sommaire a:hover { color: var(--accent); }
.sommaire ol ol a:hover { border-left-color: var(--accent); }

/* Fiche */
.fiche { min-width: 0; line-height: 1.62; font-size: .96rem; padding-bottom: 2rem; }
.fiche-tete { padding: clamp(1.2rem, 3vw, 2rem) clamp(1rem, 3vw, 2rem); margin-bottom: 1.4rem;
  background: var(--accent); color: var(--accent-ink); border-radius: var(--radius); }
.fiche h1 { margin: 0; font-size: clamp(1.4rem, 3vw, 1.85rem); letter-spacing: .005em; line-height: 1.2; }
.fiche .auteurs { margin: .4rem 0 0; font-size: .9rem; opacity: .85; }
.partie { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: clamp(1rem, 3vw, 1.8rem); margin-bottom: 1.4rem; }
.fiche h2 { display: flex; align-items: center; gap: .65rem; margin: 0 0 1.1rem; font-size: 1.25rem; color: var(--ink); line-height: 1.25; }
.fiche h2 .num { display: grid; place-items: center; flex: none; width: 1.9rem; height: 1.9rem; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-size: .95rem; }
.rubrique { padding: 1.1rem 0 .2rem; border-top: 1px solid var(--line); }
.rubrique:first-of-type, .encadre + .rubrique { border-top: 0; }
.fiche h3 { margin: 0 0 .5rem; font-size: 1.02rem; color: var(--accent); letter-spacing: .01em; }
.fiche h4 { margin: 0 0 .25rem; font-size: .9rem; color: var(--ink); }
.fiche p { margin: .35rem 0; }
.fiche ul { margin: .35rem 0; padding-left: 1.2rem; }
.fiche li { margin: .3rem 0; }
.fiche li::marker { color: var(--accent); }
.fiche .sous-titre { font-weight: 650; color: var(--ink); margin-top: .8rem; }
.encadre { background: var(--accent-soft); border-left: 3px solid var(--accent); border-radius: var(--radius-sm);
  padding: .7rem .9rem; margin: .6rem 0 1rem; }
.encadre .sous-titre { margin-top: 0; }
.encadre ul { margin-bottom: 0; }
.pastilles { display: flex; flex-wrap: wrap; gap: .4rem; }
.triade b { display: inline-grid; place-items: center; width: 1.25em; height: 1.25em; margin: 0 .15em 0 .3em; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-size: .8em; }

/* Mode de vie : quatre cases */
.fiche ul.grille-4 { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .55rem; }
.grille-4 li { margin: 0; padding: .55rem .7rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: .9rem; line-height: 1.45; }
.grille-4 strong { display: block; color: var(--accent); }

/* Cartes : antécédents, règles d'écriture */
.cartes { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: .65rem; margin: .5rem 0 .4rem; }
.carte { padding: .7rem .85rem; background: var(--surface-2); border: 1px solid var(--line); border-top: 3px solid var(--accent);
  border-radius: var(--radius-sm); font-size: .9rem; line-height: 1.5; }
.carte p { margin: 0; }
.carte p + p { margin-top: .35rem; }
.cartes.regles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 640px) { .cartes.regles { grid-template-columns: minmax(0, 1fr); } }
.carte.large { grid-column: 1 / -1; }

/* Exemple « hypoxémie » : étapes */
.etapes { margin: .5rem 0 1rem; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.etapes > div { display: grid; grid-template-columns: 10rem minmax(0, 1fr); border-top: 1px solid var(--line); }
.etapes > div:first-child { border-top: 0; }
.etapes dt { padding: .55rem .8rem; background: var(--surface-2); font-weight: 650; color: var(--accent); font-size: .88rem; }
.etapes dd { margin: 0; padding: .55rem .8rem; font-size: .92rem; }
@media (max-width: 560px) { .etapes > div { grid-template-columns: minmax(0, 1fr); } .etapes dt { padding-bottom: .2rem; } }

/* Conclusion : la phrase modèle */
.modele { font-size: 1.02rem; line-height: 2; padding: .7rem .9rem; border: 1px dashed var(--accent); border-radius: var(--radius-sm);
  background: var(--surface-2); }
.trou { display: inline-block; padding: 0 .5em; line-height: 1.6; border-radius: 99px; background: var(--accent-soft);
  color: var(--accent); font-style: italic; font-size: .92em; }
/* Le point final vient contre la dernière pastille : sa marge intérieure ne doit pas faire une espace. */
.modele .trou:last-child { margin-right: -.4em; }
.rappel { margin: 1.4rem 0 0 !important; padding: .7rem .9rem; text-align: center; font-weight: 650; color: var(--ink);
  background: var(--jaune-bg); border: 1px solid var(--jaune-bord); border-radius: var(--radius-sm); }

/* À éviter / à écrire */
.avant-apres { width: 100%; border-collapse: separate; border-spacing: 0; margin: .4rem 0 .6rem; font-size: .92rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.avant-apres th { text-align: left; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3); background: var(--surface-2); padding: .45rem .8rem; border-bottom: 1px solid var(--line); }
.avant-apres td { padding: .5rem .8rem; vertical-align: top; border-top: 1px solid var(--line); width: 50%; }
.avant-apres tbody tr:first-child td { border-top: 0; }
.avant-apres td:first-child { color: var(--ink-2); }
.avant-apres td + td { border-left: 1px solid var(--line); }
.avant-apres small { display: block; color: var(--ink-3); font-size: .82rem; font-style: italic; }
@media (max-width: 560px) {
  .avant-apres thead { display: none; }
  .avant-apres tr { display: block; border-top: 1px solid var(--line); }
  .avant-apres tbody tr:first-child { border-top: 0; }
  .avant-apres td { display: block; width: auto; border: 0 !important; }
  .avant-apres td:first-child { padding-bottom: 0; }
  .avant-apres td + td::before { content: "→ "; color: var(--accent); }
}

/* Formulations à corriger : une ligne par exemple, le barré puis ce qui le remplace */
.fiche ul.corrections { list-style: none; padding: 0; margin: .4rem 0 .6rem; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.corrections li { margin: 0; padding: .5rem .8rem; font-size: .92rem; border-top: 1px solid var(--line); }
.corrections li:first-child { border-top: 0; }
.corrections small { display: block; color: var(--ink-3); font-size: .82rem; font-style: italic; }

/* Exemples, barrés, ajouts */
.fiche .ex { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86em; color: var(--ink);
  background: var(--accent-soft); border: 1px solid var(--line-strong); border-radius: 5px; padding: .08em .4em;
  -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.fiche del { text-decoration-color: var(--accent); text-decoration-thickness: 1.5px; color: var(--accent); opacity: .8; }
.fiche ins { text-decoration: none; color: var(--accent); font-weight: 600; }
.fiche [id]:target, .fiche li:target { background: var(--jaune-bg); border-radius: var(--radius-sm); box-shadow: 0 0 0 .35rem var(--jaune-bg);
  transition: background 1s; }
.fiche .carte:target { box-shadow: 0 0 0 2px var(--jaune-bord); }

@media (max-width: 900px) {
  .consignes { grid-template-columns: minmax(0, 1fr); }
  .sommaire { position: static; max-height: none; overflow: visible; }
  .sommaire ol ol { display: none; }
  .sommaire > ol { display: flex; flex-wrap: wrap; gap: .4rem; }
  .sommaire > ol > li { margin: 0; }
  .sommaire > ol > li > a { padding: .25em .75em; border: 1px solid var(--line-strong); border-radius: 99px; background: var(--surface);
    font-weight: 600; color: var(--accent); }
}

@media print {
  .page-consignes .topbar, .page-consignes .sommaire, .page-consignes .colophon, .skip { display: none; }
  .page-consignes { background: #fff; }
  /* Imprimée en clair, même lue en sombre. */
  :root[data-theme="dark"] .page-consignes { --ink: #1b1d20; --ink-2: #4f5660; --ink-3: #77808b; --accent: #6b3fa0; --accent-ink: #ffffff;
    --accent-soft: #f2ecfa; --surface: #ffffff; --surface-2: #f9fafb; --line: #dfe3e8; --line-strong: #c8ced6;
    --jaune-bg: #fff6d6; --jaune-bord: #d9a400; }
  .consignes { display: block; max-width: none; padding: 0; }
  .fiche { font-size: 10pt; }
  .partie { border: 0; box-shadow: none; padding: 0; }
  .fiche-tete { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .fiche h2, .fiche h3 { break-after: avoid; }
  .carte, .etapes > div, .avant-apres tr, .fiche li { break-inside: avoid; }
}
