/* ==========================================================================
   Manuel Fédéral des Ordres Permanents PIT
   Feuille de style unique — pensée pour la consultation en intervention :
   contraste élevé, grandes cibles tactiles, lisible en plein soleil ou de nuit.
   ========================================================================== */

/* ---------------------------------------------------------------- tokens -- */
:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #f4f6f9;
  --bg-soft: #e9edf3;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --line: #d9e0ea;
  --line-strong: #b9c4d3;
  --text: #10151d;
  --text-soft: #4b5768;
  --text-faint: #6b7788;

  --accent: #9b1128;
  --accent-soft: #fbe9ec;
  --accent-text: #7d0d20;

  --danger: #c2183a;
  --danger-bg: #fdecef;
  --danger-line: #f3b8c4;
  --warn: #9a5b00;
  --warn-bg: #fff5e2;
  --warn-line: #f2d29a;
  --info: #14548c;
  --info-bg: #e9f2fb;
  --info-line: #b3d1ec;
  --tip: #14663a;
  --tip-bg: #e7f6ed;
  --tip-line: #a9dcc0;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgb(16 21 29 / 6%), 0 6px 20px -12px rgb(16 21 29 / 22%);
  --shadow-lg: 0 2px 6px rgb(16 21 29 / 8%), 0 24px 48px -24px rgb(16 21 29 / 32%);
  --wrap: 1080px;
}

:root[data-theme="light"] { color-scheme: light; }

/* Palette sombre : appliquée si l'utilisateur l'a choisie (data-theme="dark"),
   ou si le système est en sombre et que l'utilisateur n'a rien choisi ("auto"). */
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #080c14;
    --bg-soft: #0e1522;
    --surface: #131b2a;
    --surface-2: #182236;
    --line: #263349;
    --line-strong: #3a4a66;
    --text: #eaeff7;
    --text-soft: #a9b6c9;
    --text-faint: #8493a9;

    --accent: #ff6b83;
    --accent-soft: #2a1119;
    --accent-text: #ff8fa2;

    --danger: #ff7089;
    --danger-bg: #2b1119;
    --danger-line: #6b2233;
    --warn: #ffc061;
    --warn-bg: #2b2010;
    --warn-line: #6d5220;
    --info: #7cbaf3;
    --info-bg: #101f2f;
    --info-line: #26496b;
    --tip: #74d8a2;
    --tip-bg: #0e2418;
    --tip-line: #235438;

    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 6px 20px -12px rgb(0 0 0 / 70%);
    --shadow-lg: 0 2px 6px rgb(0 0 0 / 45%), 0 24px 48px -24px rgb(0 0 0 / 80%);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #080c14;
  --bg-soft: #0e1522;
  --surface: #131b2a;
  --surface-2: #182236;
  --line: #263349;
  --line-strong: #3a4a66;
  --text: #eaeff7;
  --text-soft: #a9b6c9;
  --text-faint: #8493a9;

  --accent: #ff6b83;
  --accent-soft: #2a1119;
  --accent-text: #ff8fa2;

  --danger: #ff7089;
  --danger-bg: #2b1119;
  --danger-line: #6b2233;
  --warn: #ffc061;
  --warn-bg: #2b2010;
  --warn-line: #6d5220;
  --info: #7cbaf3;
  --info-bg: #101f2f;
  --info-line: #26496b;
  --tip: #74d8a2;
  --tip-bg: #0e2418;
  --tip-line: #235438;

  --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 6px 20px -12px rgb(0 0 0 / 70%);
  --shadow-lg: 0 2px 6px rgb(0 0 0 / 45%), 0 24px 48px -24px rgb(0 0 0 / 80%);
}

/* couleurs de catégorie */
/* Ces teintes doivent suivre le thème : figées, elles tombaient à 2,9:1 sur
   fond sombre pour la pastille « OP N°22 ». */
.cat[data-cat="reanimation"] h2 svg,
.proto-head--reanimation .proto-ref { color: var(--danger); }
.cat[data-cat="cardio"] h2 svg { color: #d14343; }
.cat[data-cat="respiratoire"] h2 svg { color: #1a7f9c; }
.cat[data-cat="neuro"] h2 svg { color: #6b4bbd; }
.cat[data-cat="trauma"] h2 svg { color: #b4622a; }
.cat[data-cat="environnement"] h2 svg { color: #17795c; }
.cat[data-cat="douleur"] h2 svg { color: #a3357f; }
.cat[data-cat="specifiques"] h2 svg { color: #8a6d12; }
.cat[data-cat="procedures"] h2 svg { color: #3a5a8c; }

/* ------------------------------------------------------------------ base -- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.62;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent-text); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration: none; }

:focus-visible {
  outline: 3px solid var(--info);
  outline-offset: 2px;
  border-radius: 4px;
}

h1, h2, h3 { line-height: 1.25; text-wrap: balance; }

code { font-family: var(--mono); font-size: .9em; background: var(--bg-soft); padding: .1em .35em; border-radius: 5px; }

.ico { width: 20px; height: 20px; flex: none; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px 72px; }

/* --------------------------------------------------------------- topbar --- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; }
.brand img { width: 28px; height: 28px; object-fit: contain; }
.brand span { display: flex; flex-direction: column; min-width: 0; }
.brand strong { font-size: 15px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small { font-size: 11.5px; color: var(--text-faint); letter-spacing: .04em; text-transform: uppercase; }

.topbar-actions { display: flex; gap: 6px; align-items: center; }

.btn-ghost {
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  padding: 0;
}
.btn-ghost:hover { background: var(--bg-soft); color: var(--text); }

/* ------------------------------------------------------------------ hero -- */
.hero { padding: 34px 0 10px; }
.hero h1 { margin: 0; font-size: clamp(26px, 6vw, 40px); letter-spacing: -.022em; }
.hero-sub { margin: 10px 0 0; color: var(--text-soft); font-size: 17px; max-width: 60ch; }
.hero-stats { margin: 14px 0 0; color: var(--text-faint); font-size: 14.5px; }
.hero-stats strong { color: var(--accent-text); }

/* --------------------------------------------------------------- recherche */
.searchbox { position: sticky; top: 63px; z-index: 40; padding: 12px 0; background: var(--bg); }

.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: 13px;
  box-shadow: var(--shadow);
}
.search-field:focus-within { border-color: var(--info); box-shadow: 0 0 0 4px color-mix(in srgb, var(--info) 18%, transparent); }
.search-field svg { color: var(--text-faint); }
.search-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 16.5px;
  color: inherit;
  padding: 14px 0;
  outline: none;
}
.search-field input::-webkit-search-cancel-button { display: none; }
#q-clear {
  border: 0; background: var(--bg-soft); color: var(--text-soft);
  width: 28px; height: 28px; border-radius: 50%; font-size: 18px; line-height: 1; cursor: pointer;
}

/* minmax(0, 1fr) : sans colonne explicite, la colonne implicite se dimensionne
   sur le contenu — le résumé en « white-space: nowrap » fait alors déborder
   les lignes bien au-delà du conteneur. */
.results { margin-top: 10px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.results-empty { padding: 18px; color: var(--text-soft); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.result {
  display: flex; align-items: baseline; gap: 12px;
  padding: 13px 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: inherit;
}
.result:hover, .result:focus-visible { border-color: var(--info); background: var(--surface-2); }
.result mark { background: color-mix(in srgb, var(--warn) 34%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.result-ref { font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--accent-text); white-space: nowrap; }
.result-body { min-width: 0; }
.result-title { font-weight: 620; display: block; }
.result-sub { display: block; font-size: 14px; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.results-head {
  margin: 14px 4px 6px;
  font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-faint);
}
.results-head:first-child { margin-top: 2px; }
.result-star { margin-left: auto; color: var(--warn); font-size: 15px; }

/* ------------------------------------------------ palette de recherche ---- */
/* Recherche accessible depuis n'importe quelle page, pas seulement l'accueil. */

.palette {
  position: fixed; inset: 0; z-index: 100;
  background: color-mix(in srgb, #05070c 62%, transparent);
  backdrop-filter: blur(3px);
  padding: max(16px, env(safe-area-inset-top)) 16px 16px;
  /* Flex plutôt que grid : dans une grille au dimensionnement automatique,
     le « 100% » du panneau se résout contre son propre contenu et non contre
     l'écran, ce qui le fait déborder sur mobile. */
  display: flex; justify-content: center; align-items: flex-start;
  overscroll-behavior: contain;
}
.palette[hidden] { display: none; }
:root.palette-ouverte { overflow: hidden; }

.palette-panneau {
  width: 100%;
  max-width: 640px;
  margin-top: min(9vh, 76px);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 12px;
  max-height: min(76vh, 640px);
  display: flex; flex-direction: column;
}
.palette-panneau .search-field { box-shadow: none; }
.palette-panneau .results {
  overflow-y: auto;
  margin-top: 8px;
  -webkit-overflow-scrolling: touch;
}
#pq-close {
  border: 0; background: var(--bg-soft); color: var(--text-soft);
  width: 30px; height: 30px; border-radius: 50%; font-size: 19px; line-height: 1; cursor: pointer;
}
#pq-close:hover { background: var(--line); color: var(--text); }

/* ------------------------------------------------------ vos protocoles ---- */
.perso { margin: 22px 0 0; }
.perso[hidden] { display: none; }
.perso h2 {
  display: flex; align-items: center; gap: 9px;
  margin: 0 0 12px; font-size: 15px; letter-spacing: .05em; text-transform: uppercase; color: var(--text-soft);
}
.perso h2 svg { color: var(--accent); }
.chip-star { color: var(--warn); font-size: 13px; }

/* -------------------------------------------------------- bouton favori --- */
.proto-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.fav {
  display: inline-flex; align-items: center; gap: 7px;
  margin-left: auto;
  padding: 10px 15px;
  min-height: 44px; /* cible tactile utilisable avec des gants */
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  color: var(--text-soft); font: inherit; font-size: 13.5px; font-weight: 550;
  cursor: pointer;
}
.fav:hover { border-color: var(--line-strong); color: var(--text); }
.fav .fav-ico { font-size: 15px; line-height: 1; color: var(--line-strong); }
.fav[aria-pressed="true"] {
  background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn);
}
.fav[aria-pressed="true"] .fav-ico { color: var(--warn); }

/* --------------------------------------------------------------- urgence -- */
.urgence { margin: 26px 0 8px; }
.urgence h2, .cat h2 {
  display: flex; align-items: center; gap: 9px;
  margin: 0 0 4px; font-size: 15px; letter-spacing: .05em; text-transform: uppercase; color: var(--text-soft);
}
.urgence h2 svg { color: var(--danger); }
.urgence-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 12px; }
.urgence-card {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 15px;
  background: var(--danger-bg);
  border: 1.5px solid var(--danger-line);
  border-radius: var(--radius-sm);
  text-decoration: none; color: var(--text);
  font-weight: 600; font-size: 15px;
}
.urgence-card:hover { border-color: var(--danger); }
.urgence-ref { font-size: 11.5px; font-weight: 800; letter-spacing: .07em; color: var(--danger); }

/* --------------------------------------------------------------- catnav --- */
.catnav {
  display: flex; gap: 8px; overflow-x: auto; padding: 18px 0 6px;
  margin: 14px -16px 0; padding-inline: 16px;
  scrollbar-width: none;
}
.catnav::-webkit-scrollbar { display: none; }
.catnav a {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 13px; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  text-decoration: none; color: var(--text-soft); font-size: 14px; font-weight: 550;
}
.catnav a:hover { color: var(--text); border-color: var(--line-strong); }
.catnav svg { width: 17px; height: 17px; }

/* ------------------------------------------------------------ catalogue --- */
.cat { margin-top: 34px; scroll-margin-top: 130px; }
.cat-count {
  margin-left: auto; font-size: 12px; font-weight: 700;
  background: var(--bg-soft); color: var(--text-faint);
  padding: 2px 9px; border-radius: 999px; letter-spacing: 0;
}
.cat-desc { margin: 0 0 14px; color: var(--text-faint); font-size: 14.5px; }

.grid { display: grid; gap: 10px; grid-template-columns: 1fr; }

.card {
  display: grid; gap: 3px;
  padding: 15px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none; color: inherit;
  transition: border-color .12s ease, transform .12s ease;
}
.card:hover { border-color: var(--line-strong); transform: translateY(-1px); box-shadow: var(--shadow); }
.card-ref { font-size: 11.5px; font-weight: 800; letter-spacing: .07em; color: var(--accent-text); }
.card-ref--pro { color: var(--info); }
.card-title { font-size: 17px; font-weight: 640; letter-spacing: -.011em; }
.card-resume { font-size: 14px; color: var(--text-soft); line-height: 1.5; }

/* --------------------------------------------------------------- fil ------ */
.crumbs { display: flex; align-items: center; gap: 8px; margin: 20px 0 0; font-size: 14px; color: var(--text-faint); }
.crumbs a { display: inline-flex; align-items: center; gap: 6px; color: var(--text-soft); text-decoration: none; }
.crumbs a:hover { color: var(--text); text-decoration: underline; }
.crumbs svg { width: 16px; height: 16px; }

/* -------------------------------------------------------------- protocole - */
.proto-head { padding: 18px 0 22px; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.proto-ref {
  display: inline-block;
  font-size: 12.5px; font-weight: 800; letter-spacing: .08em;
  color: var(--accent-text); background: var(--accent-soft);
  padding: 4px 10px; border-radius: 7px;
}
.proto-ref--pro { color: var(--info); background: var(--info-bg); }
.proto-head h1 { margin: 12px 0 0; font-size: clamp(25px, 5.6vw, 38px); letter-spacing: -.024em; }
.proto-resume { margin: 10px 0 0; color: var(--text-soft); font-size: 16.5px; max-width: 62ch; }

.toc {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 18px; margin: 0 0 26px;
}
.toc p { margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-faint); }
.toc ol { margin: 0; padding-left: 20px; display: grid; gap: 3px; }
.toc a { color: var(--text-soft); text-decoration: none; }
.toc a:hover { color: var(--accent-text); text-decoration: underline; }

.sec { margin: 0 0 34px; scroll-margin-top: 80px; }
.sec > h2 {
  font-size: 20px; letter-spacing: -.015em;
  margin: 0 0 14px; padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
}
.sec h3 { font-size: 16.5px; margin: 26px 0 8px; color: var(--text); }
.sec p { margin: 0 0 12px; }

.sec ul, .sec ol { margin: 0 0 14px; padding-left: 22px; display: grid; gap: 7px; }
.sec li::marker { color: var(--text-faint); }
.sec ul.sub { margin: 7px 0 2px; padding-left: 20px; gap: 5px; }
.sec ul.sub li::marker { color: var(--line-strong); }

.note {
  font-size: 14.5px; color: var(--text-soft);
  border-left: 3px solid var(--line-strong);
  padding: 2px 0 2px 12px; margin: 0 0 14px !important;
}

/* connecteurs ET / OU dans les colonnes d'antalgie */
.op-connect { list-style: none; margin-left: -22px; }
.op-connect span {
  display: inline-block; font-size: 11.5px; font-weight: 800; letter-spacing: .1em;
  background: var(--bg-soft); color: var(--text-faint);
  padding: 2px 10px; border-radius: 999px;
}

/* -------------------------------------------------------------- callouts -- */
.callout {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; margin: 0 0 18px;
  border: 1.5px solid var(--info-line);
  background: var(--info-bg);
  border-radius: var(--radius);
}
.callout > svg { color: var(--info); margin-top: 2px; }
.callout > div { min-width: 0; flex: 1; }
.callout p { margin: 0 0 6px; }
.callout p:last-child { margin-bottom: 0; }
.callout ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.callout-title { font-weight: 700; letter-spacing: .01em; }

.callout--danger { border-color: var(--danger-line); background: var(--danger-bg); }
.callout--danger > svg, .callout--danger .callout-title { color: var(--danger); }
.callout--warn { border-color: var(--warn-line); background: var(--warn-bg); }
.callout--warn > svg, .callout--warn .callout-title { color: var(--warn); }
.callout--tip { border-color: var(--tip-line); background: var(--tip-bg); }
.callout--tip > svg, .callout--tip .callout-title { color: var(--tip); }

/* ---------------------------------------------------------------- tables -- */
.table-wrap { overflow-x: auto; margin: 0 0 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
caption {
  caption-side: top; text-align: left; padding: 12px 14px 8px;
  font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-faint);
}
th, td { padding: 10px 14px; text-align: left; vertical-align: top; border-top: 1px solid var(--line); }
thead th { background: var(--surface-2); font-size: 13px; letter-spacing: .02em; border-top: 0; white-space: nowrap; }
tbody tr:first-child td { border-top: 1px solid var(--line-strong); }
tbody td:first-child { font-weight: 560; }

/* --------------------------------------------------------- deux colonnes -- */
.deux { display: grid; gap: 12px; margin: 0 0 18px; }
.col {
  border: 1.5px solid var(--info-line); background: var(--info-bg);
  border-radius: var(--radius); padding: 15px 17px;
}
.col--warn { border-color: var(--warn-line); background: var(--warn-bg); }
.col--danger { border-color: var(--danger-line); background: var(--danger-bg); }
.col--tip { border-color: var(--tip-line); background: var(--tip-bg); }
.col-title { margin: 0; font-weight: 720; font-size: 16px; }
.col--warn .col-title { color: var(--warn); }
.col--danger .col-title { color: var(--danger); }
.col--info .col-title { color: var(--info); }
.col-sub { margin: 2px 0 10px; font-size: 13.5px; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.col ul { margin: 0; padding-left: 20px; display: grid; gap: 7px; font-size: 15px; }

/* ------------------------------------------------------------- algorithme - */
.algo { margin: 0 0 20px; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.algo-head {
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--surface-2); border-bottom: 1px solid var(--line-strong);
}
.algo-head > div {
  padding: 9px 14px; font-size: 11.5px; font-weight: 800; letter-spacing: .09em;
  /* Indique qui fait quoi pendant une réanimation : doit rester lisible. */
  color: var(--text-soft);
}
.algo-head > div + div { border-left: 1px solid var(--line); }

.algo-row { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.algo-row:first-of-type { border-top: 0; }
.algo-cell { padding: 12px 14px; min-width: 0; }
.algo-cell + .algo-cell { border-left: 1px solid var(--line); background: var(--surface-2); }
.algo-cell ul { margin: 0; padding-left: 18px; display: grid; gap: 5px; font-size: 15px; }
.algo-cell li::marker { color: var(--line-strong); }
.algo-idle { margin: 0; color: var(--text-soft); }

.algo-row--equip .algo-cell { background: var(--bg-soft); font-size: 14px; }
.algo-row--equip .algo-cell + .algo-cell { background: var(--bg-soft); }

.algo-full {
  padding: 11px 14px; font-weight: 750; font-size: 14px; letter-spacing: .05em;
  background: var(--bg-soft); border-top: 1px solid var(--line); text-align: center;
}
.algo-full--danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }

.algo-rythme {
  display: flex; align-items: center; gap: 7px;
  margin: 10px 0 0; padding: 6px 10px;
  background: var(--danger-bg); border: 1px solid var(--danger-line); border-radius: 8px;
  color: var(--danger); font-weight: 750; font-size: 13px; letter-spacing: .04em;
}
.algo-rythme svg { width: 17px; height: 17px; }

/* ---------------------------------------------------------------- figures - */
.figure { margin: 0 0 18px; }
.figure img { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); width: 100%; }
.figure figcaption { margin-top: 8px; font-size: 14px; color: var(--text-soft); }
.figures { display: grid; gap: 14px; margin-bottom: 18px; }

.etapes { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 12px; }
.etape {
  display: grid;
  grid-template-columns: 34px 96px 1fr;
  gap: 14px; align-items: start;
  padding: 13px 15px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.etape-num {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-text);
  font-weight: 800; font-size: 14px;
}
.etape img { border-radius: var(--radius-sm); border: 1px solid var(--line); width: 96px; }
.etape p { margin: 0; font-size: 15px; }

/* ---------------------------------------------------- section néerlandaise */
.lang {
  border: 1px dashed var(--line-strong); border-radius: var(--radius);
  background: var(--surface-2); margin: 0 0 18px; overflow: hidden;
}
.lang summary {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 13px 16px; cursor: pointer; font-weight: 600; color: var(--text-soft);
  list-style: none;
}
.lang summary::-webkit-details-marker { display: none; }
.lang summary::before { content: "▸"; margin-right: 4px; color: var(--text-faint); }
.lang[open] summary::before { content: "▾"; }
.lang summary:hover { color: var(--text); }
.lang-badge {
  margin-left: auto; font-size: 11px; font-weight: 800; letter-spacing: .08em;
  background: var(--bg-soft); color: var(--text-faint); padding: 3px 9px; border-radius: 999px;
}
.lang-body { padding: 0 16px 8px; }
.lang-body h3:first-child { margin-top: 4px; }
.lang .note { margin: 0 16px 12px !important; }

/* ----------------------------------------------------------------- chips -- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 13px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; text-decoration: none; color: var(--text); font-size: 14.5px;
}
.chip:hover { border-color: var(--accent); }
.chip-ref { font-size: 11px; font-weight: 800; letter-spacing: .06em; color: var(--accent-text); }

/* ----------------------------------------------------------------- pager -- */
.pager { display: grid; gap: 10px; margin-top: 34px; padding-top: 24px; border-top: 1px solid var(--line); }
.pager a {
  display: grid; gap: 2px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: inherit;
}
.pager a:hover { border-color: var(--line-strong); }
.pager span { font-size: 12px; font-weight: 700; letter-spacing: .05em; color: var(--text-faint); }
.pager strong { font-weight: 600; font-size: 15.5px; }
.pager-next { text-align: right; }

/* ------------------------------------------------------------------ prose - */
.prose { max-width: 760px; }
.prose h1 { font-size: clamp(26px, 5.5vw, 36px); margin: 26px 0 18px; letter-spacing: -.022em; }
.prose h2 { font-size: 20px; margin: 34px 0 12px; padding-bottom: 7px; border-bottom: 2px solid var(--accent); display: inline-block; }
.prose h3 { font-size: 16px; margin: 0 0 8px; }
.prose p { margin: 0 0 13px; }
.comites { display: grid; gap: 14px; }
.comite { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 18px; }
.comite ul { margin: 0; padding-left: 20px; display: grid; gap: 5px; font-size: 15px; }
.sommaire { padding-left: 0; list-style: none; display: grid; gap: 4px; }
.sommaire a { display: flex; gap: 10px; align-items: baseline; padding: 9px 12px; border-radius: var(--radius-sm); text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--line); }
.sommaire a:hover { border-color: var(--accent); }

/* ------------------------------------------------- index des médicaments -- */
.outils { margin: 22px 0 0; }
.outil {
  display: flex; align-items: center; gap: 13px;
  padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: inherit;
}
.outil:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.outil svg { width: 24px; height: 24px; color: var(--accent); }
.outil span { display: grid; gap: 1px; }
.outil strong { font-size: 16px; font-weight: 620; }
.outil small { font-size: 14px; color: var(--text-soft); }

.med-famille { margin: 34px 0 0; scroll-margin-top: 90px; }
.med-famille > h2 {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; letter-spacing: .05em; text-transform: uppercase; color: var(--text-soft);
  margin: 0 0 14px;
}

.med {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); padding: 16px 18px; margin: 0 0 12px;
  scroll-margin-top: 90px;
}
.med-head { margin-bottom: 12px; }
.med-head h3 { margin: 0; font-size: 18px; letter-spacing: -.012em; }
.med-dci { margin: 2px 0 0; font-size: 13.5px; color: var(--text-faint); }

.med-proto { padding-top: 12px; border-top: 1px solid var(--line); }
.med-proto:first-of-type { border-top: 0; padding-top: 0; }
.med-lien {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; /* cible tactile utilisable avec des gants */
  text-decoration: none; color: var(--text); font-weight: 580; font-size: 15px;
}
.med-lien:hover { color: var(--accent-text); }

.med-lignes { list-style: none; margin: 6px 0 12px; padding: 0; display: grid; gap: 7px; }
.med-lignes li {
  border-left: 3px solid var(--line-strong);
  padding: 1px 0 1px 12px;
}
.med-lignes q { display: block; font-size: 15px; quotes: "«\00a0" "\00a0»"; }
.med-sec { display: block; font-size: 12.5px; color: var(--text-faint); margin-top: 2px; }

/* ------------------------------------------------------- toasts & état ---- */
.toasts {
  position: fixed; z-index: 200;
  left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom));
  display: grid; gap: 8px; justify-items: center;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 12px;
  width: min(560px, 100%);
  padding: 12px 14px;
  background: var(--surface); border: 1.5px solid var(--info-line);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  font-size: 14.5px;
}
.toast--warn { border-color: var(--warn-line); background: var(--warn-bg); }
.toast p { margin: 0; flex: 1; min-width: 0; }
.toast-action {
  border: 0; border-radius: 8px; cursor: pointer;
  background: var(--accent); color: #fff;
  padding: 7px 13px; font: inherit; font-size: 14px; font-weight: 600;
  white-space: nowrap;
}
.toast-action:hover { filter: brightness(1.1); }
.toast-fermer {
  border: 0; background: none; color: var(--text-faint);
  font-size: 20px; line-height: 1; cursor: pointer; padding: 0 2px;
}
.toast-fermer:hover { color: var(--text); }

.footer-etat {
  display: flex; flex-wrap: wrap; gap: 6px 10px; justify-content: center; align-items: center;
  font-size: 12.5px;
}
.etat {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px; border-radius: 999px;
  background: var(--bg-soft); color: var(--text-faint);
}
.etat::before { content: "•"; font-size: 14px; line-height: 1; }
.etat--ok { background: var(--tip-bg); color: var(--tip); }
.etat--ok::before { content: "✓"; font-size: 12px; }
.etat--ko { background: var(--danger-bg); color: var(--danger); }

/* ---------------------------------------------------------------- footer -- */
.footer {
  border-top: 1px solid var(--line);
  padding: 30px 16px calc(40px + env(safe-area-inset-bottom));
  background: var(--surface);
  color: var(--text-faint);
  font-size: 13.5px;
  text-align: center;
}
.footer p { margin: 0 auto 8px; max-width: 70ch; }
.footer-logo { height: 26px; width: auto; margin: 0 auto 14px; object-fit: contain; }
.footer-note { font-size: 12.5px; line-height: 1.55; opacity: .9; }
:root[data-theme="dark"] .footer-logo { background: #fff; padding: 4px 8px; border-radius: 6px; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .footer-logo { background: #fff; padding: 4px 8px; border-radius: 6px; }
}

/* ------------------------------------------------------------ responsive -- */
@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .urgence-grid { grid-template-columns: repeat(4, 1fr); }
  .deux { grid-template-columns: 1fr 1fr; }
  .figures { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: start; }
  .pager { grid-template-columns: 1fr 1fr; }
  .comites { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 960px) {
  body { font-size: 17.5px; }
  .grid { grid-template-columns: repeat(3, 1fr); }
  .catnav { flex-wrap: wrap; overflow: visible; }
}

@media (max-width: 560px) {
  .etape { grid-template-columns: 30px 1fr; }
  .etape img { grid-column: 2; width: 100%; max-width: 200px; }

  /* L'algorithme passe en colonne unique : chaque cellule porte alors le rôle
     concerné, sinon on ne sait plus qui fait quoi. */
  .algo-head { display: none; }
  .algo-row { grid-template-columns: 1fr; border-top-width: 3px; }
  .algo-cell + .algo-cell { border-left: 0; border-top: 1px dashed var(--line); }
  .algo-cell::before {
    content: attr(data-role);
    display: block;
    margin-bottom: 6px;
    font-size: 10.5px; font-weight: 800; letter-spacing: .09em;
    color: var(--text-soft);
  }
  .algo-row--equip .algo-cell { padding-block: 10px; }
}

/* --------------------------------------------------------------- impression */
@media print {
  :root { --bg: #fff; --surface: #fff; --surface-2: #fff; --text: #000; --text-soft: #333; --text-faint: #555; --line: #bbb; --line-strong: #888; }
  .topbar, .searchbox, .catnav, .pager, .btn-ghost, .urgence, .crumbs,
  .palette, .perso, .fav, .toasts, .footer-etat, .outils { display: none !important; }
  body { font-size: 11pt; background: #fff; }
  .wrap { max-width: none; padding: 0; }
  .card, .callout, .table-wrap, .col, .algo, .toc { break-inside: avoid; box-shadow: none; }
  .sec { break-inside: auto; }
  .sec > h2, .proto-head h1 { break-after: avoid; }
  .lang { border-style: solid; }
  .lang[open] .lang-body, .lang-body { display: block !important; }
  .lang summary::before { content: ""; }
  a { color: #000; text-decoration: none; }
  .footer { border-top: 1px solid #bbb; text-align: left; padding: 12px 0 0; }
}
