/* ==========================================================================
   KinéScribe — styles de l'application
   Sortis d'index.html le 2026-10-11 (audit de la refonte, axe A5) : ~200 Ko
   que le navigateur retéléchargeait à chaque ouverture, faute de cache.
   Le lien porte un numéro de version (?v=) : à changer à chaque modification,
   le fichier est servi avec un cache d'un jour (vercel.json).
   ========================================================================== */

/* ==========================================================================
   DESIGN SYSTEM
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* Tokens semantiques — theme FONCE par defaut, theme CLAIR via [data-theme="light"].
   Direction "Clinique moderne" (refonte 2026-06-30). Les noms de tokens sont
   conserves : seules les valeurs changent par theme, donc tout le CSS aval suit. */
:root, [data-theme="dark"] {
  --bg: #0E1116;
  --panel: #151A21;
  --panel-2: #1B212B;
  --card: #1B212B;
  --card-h: #232B38;
  --border: rgba(255,255,255,0.07);
  --border-h: rgba(255,255,255,0.16);
  --surface: var(--panel);   /* alias — barre onglets mobile + onboarding (audit 2026-06-23) */
  --muted: var(--t3);        /* alias — boutons supprimer (audit 2026-06-23) */
  --green: #34D399;          /* vert plein : fonds de boutons, bordures */
  --green-h: #4FE0A8;
  --green-d: #1A7A56;
  --green-on: #34D399;       /* vert en TEXTE/icone sur surface neutre */
  --green-ink: #06231A;      /* texte sur fond vert plein (encre sombre) */
  --green-bg: rgba(52,211,153,0.10);
  --green-br: rgba(52,211,153,0.30);
  --accent: #E8915A;
  --accent-bg: rgba(232,145,90,0.12);
  --accent-br: rgba(232,145,90,0.30);
  --danger: #F0726A;
  --warn: #ECC044;
  --info: #6BB0F2;
  --white: #FFFFFF;          /* "texte le plus fort" — bascule en quasi-noir en clair */
  --t1: #ECEAE5;
  --t2: #A8A49C;
  --t3: #8A847A;             /* contraste AA sur --bg (audit 2026-06-23) */
  --t4: #4A4640;
  --doc-bg: #FCFBF8;         /* le document genere reste sur papier dans les 2 themes */
  --doc-ink: #1A1714;
  --doc-body: #2C2620;
  --doc-mute: #8A857C;
  --doc-line: #E8E2D8;
  --shadow-float: 0 18px 50px rgba(0,0,0,0.45);
  --page-glow: radial-gradient(1100px 560px at 82% -12%, rgba(52,211,153,0.06), transparent 60%);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}
[data-theme="light"] {
  --bg: #F3F1EC;
  --panel: #FFFFFF;
  --panel-2: #F1EEE8;
  --card: #FFFFFF;
  --card-h: #F1EEE8;
  --border: rgba(20,18,14,0.10);
  --border-h: rgba(20,18,14,0.22);
  --green: #0C7A54;          /* 5,35:1 sous texte blanc ; #12936A ne tenait que 3,88:1 (2026-10-25) */
  --green-h: #0A6646;
  --green-d: #0C7A54;
  --green-on: #0C7A54;       /* vert texte assez fonce pour contraste AA sur clair */
  --green-ink: #FFFFFF;      /* texte blanc sur fond vert plein */
  --green-bg: rgba(18,147,106,0.10);
  --green-br: rgba(18,147,106,0.32);
  --accent: #C2692E;
  --accent-bg: rgba(194,105,46,0.12);
  --accent-br: rgba(194,105,46,0.32);
  --danger: #C2433B;
  --warn: #9C6A0F;
  --info: #2E72B8;
  --white: #1B1A17;
  --t1: #1B1A17;
  --t2: #57534B;
  --t3: #7A756B;
  --t4: #C9C4BA;
  --shadow-float: 0 16px 44px rgba(30,28,24,0.14);
  --page-glow: none;
}

html { scroll-behavior: smooth; }
body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--page-glow), var(--bg); color: var(--t1);
  min-height: 100vh; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

/* Focus clavier visible — restauré pour navigation au clavier (WCAG 2.4.7, audit 2026-06-23) */
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 6px; }

/* ==========================================================================
   NAV
   ========================================================================== */
nav.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  background: var(--panel); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.logo {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem; font-weight: 700; color: var(--white);
}
.logo sup {
  font-family: 'Outfit', sans-serif;
  font-size: 0.5rem; font-weight: 600; color: var(--green-on);
  vertical-align: super; letter-spacing: 1px; text-transform: uppercase;
}
.nav-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.stat-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px;
  background: var(--green-bg); border: 1px solid var(--green-br);
  border-radius: 100px; font-size: 0.78rem; font-weight: 600;
  color: var(--green-on);
}
.stat-chip .num { font-family: 'Playfair Display', serif; font-size: 0.98rem; }

.nav-btn {
  background: var(--card); border: 1px solid var(--border);
  color: var(--t2); padding: 8px 14px; border-radius: 8px;
  font-size: 0.8rem; font-weight: 500;
  transition: all 0.15s var(--ease);
  display: inline-flex; align-items: center; gap: 6px;
}
.nav-btn:hover { border-color: var(--green); color: var(--green-on); }

.nav-badge {
  padding: 5px 12px; border-radius: 100px;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.5px;
  background: var(--green-bg); color: var(--green-on);
  border: 1px solid var(--green-br);
}

/* ==========================================================================
   LAYOUT PRINCIPAL
   ========================================================================== */
/* LA HAUTEUR DE LA BARRE DU HAUT SE MESURE, ELLE NE SE DEVINE PAS (2026-08-26)
   Ces deux colonnes se calaient sur `100vh - 57px`. Mesurée en tablette paysage
   (1194x834), la barre du haut fait **112 px** : ses boutons se replient sur deux
   lignes bien avant le téléphone. La colonne de gauche était donc trop haute de
   55 px, et le bas de la page laissait un vide sous elle. `--topbar-h` est posée
   par un ResizeObserver (fin de script) ; le 57px reste comme repli si le script
   n'a pas encore tourné. */
.app {
  display: grid;
  /* `--sidebar-w` est écrite par la poignée de largeur. Sans elle (premier passage,
     script en échec), la valeur fluide d'origine s'applique. */
  grid-template-columns: var(--sidebar-w, clamp(340px, 30vw, 440px)) auto 1fr;
  min-height: calc(100vh - var(--topbar-h, 57px));
  min-height: calc(100dvh - var(--topbar-h, 57px));
}

/* ==========================================================================
   SIDEBAR
   ========================================================================== */
/* ELLE RESTE À L'ÉCRAN, ET ELLE NE LAISSE PLUS DE VIDE (2026-08-26)
   Avant : hauteur plafonnée à un écran, `position: static`. Dès que le document
   de droite dépassait la fenêtre, la page entière défilait, la colonne de gauche
   remontait hors champ et découvrait sous elle une bande du fond du corps, d'un
   gris différent de celui du panneau. Mesuré sur la version en ligne, en tablette
   paysage : 71 px de vide, et bien davantage avec un vrai document à droite.
   `sticky` la garde sous la barre du haut : elle couvre toujours la fenêtre, il
   n'y a plus de sous quoi que ce soit. Elle reste accessible pendant la lecture
   du document, ce qui est aussi ce qu'on veut quand on rédige. */
.sidebar {
  background: var(--panel);
  padding: 24px 22px 32px;
  overflow-y: auto;
  /* `contain` : arrivé en bout de liste, le doigt ne fait plus repartir la page
     entière. Sur une colonne qui défile pour elle-même, c'est le geste attendu. */
  overscroll-behavior: contain;
  position: sticky;
  top: var(--topbar-h, 57px);
  align-self: start;
  height: calc(100vh - var(--topbar-h, 57px));
  height: calc(100dvh - var(--topbar-h, 57px));
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: var(--border-h); }

/* ==========================================================================
   POIGNÉE DE LARGEUR (2026-08-26)
   --------------------------------------------------------------------------
   Demandée par un kiné sur tablette : « j'aimerais avoir la partie gauche où je
   rentre les informations réglable afin de pouvoir voir mes notes de manière
   plus globale quand je les rédige ». Le besoin est juste : pendant la saisie,
   la colonne de droite ne sert à rien, et les notes brutes se lisent mal dans
   340 px.

   Elle EST la séparation des deux colonnes : la bordure droite du panneau a été
   retirée, sinon on verrait deux traits. Elle occupe une vraie colonne de la
   grille plutôt qu'une position absolue, pour n'avoir aucune valeur à
   resynchroniser quand la largeur change.
   ========================================================================== */
.resizer {
  display: none;                 /* n'existe qu'en deux colonnes, cf. media query */
  position: sticky;
  top: var(--topbar-h, 57px);
  align-self: start;
  height: calc(100vh - var(--topbar-h, 57px));
  height: calc(100dvh - var(--topbar-h, 57px));
  /* 6 px et non 1 : un trait d'un pixel est un réglage que personne ne trouve.
     Corrigé le 2026-08-26 après un premier essai — la poignée existait, elle ne
     se voyait pas, et le besoin a été redemandé comme s'il n'était pas traité. */
  width: 6px;
  background: var(--border);
  border: none; padding: 0;
  cursor: col-resize;
  /* Sans cela, le premier mouvement du doigt est confisqué par le défilement de
     la page et la poignée ne bouge jamais sur tablette. */
  touch-action: none;
  transition: background .15s var(--ease);
}
/* La cible tactile déborde de part et d'autre : 6 px ne se saisissent pas au
   doigt. 26 px de large au total, en deçà des 44 px seulement parce qu'un rail
   plus large mangerait la largeur utile des deux colonnes. */
.resizer::before {
  content: ''; position: absolute; inset: 0 -10px;
}
/* La barrette centrale : c'est elle qui dit qu'on peut attraper le rail. Sans
   signe, le réglage existe sans être trouvé. */
.resizer::after {
  content: '';
  position: absolute; left: 1px; top: 50%;
  width: 4px; height: 46px; margin-top: -23px;
  border-radius: 3px;
  /* `--t3` et non `--border-h` : à 16 % de blanc sur un panneau à #151A21, la
     barrette se confond avec le rail et ne signale plus rien. */
  background: var(--t3);
  transition: background .15s var(--ease);
}
.resizer:hover, .resizer:focus-visible, .resizer.actif { background: var(--green); }
.resizer:hover::after, .resizer:focus-visible::after, .resizer.actif::after { background: var(--white); }
.resizer:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
/* Pendant le glissement, le curseur ne doit pas changer au survol du texte et
   rien ne doit se sélectionner sous le doigt. */
body.redimensionne { cursor: col-resize; user-select: none; }

/* ==========================================================================
   SAISIE AGRANDIE (2026-08-26)
   --------------------------------------------------------------------------
   Deuxième demande du même kiné, après avoir eu la poignée : « je veux que l'on
   puisse modifier la taille de l'interface de gauche PENDANT la prise de note,
   notamment l'augmenter ».

   La poignée règle un partage durable entre les deux colonnes. Ce n'est pas le
   même geste : pendant qu'on écrit ses notes, la colonne de droite ne sert à
   rien du tout, et ce qu'on veut est toute la place, tout de suite, puis la
   rendre. D'où une bascule d'un seul appui plutôt qu'un glissement à doser.

   Elle n'est PAS mémorisée, et c'est voulu : retrouver l'application sans son
   document à la session suivante, sans savoir pourquoi, coûterait plus que le
   geste qu'on épargne.
   ========================================================================== */
.titre-actions { display: inline-flex; align-items: center; gap: 14px; }

/* Le champ de notes prend la hauteur, à toutes les largeurs : c'est la moitié du
   besoin (« voir mes notes de manière plus globale »), et la seule qui vaille sur
   un téléphone, où il n'y a de toute façon qu'une colonne. */
body.saisie-agrandie #notes {
  height: clamp(240px, 56vh, 720px);
  height: clamp(240px, 56dvh, 720px);
}
@media (min-width: 961px) {
  /* L'autre moitié : la colonne de saisie prend toute la largeur, le document et
     la poignée s'effacent. */
  body.saisie-agrandie .app { grid-template-columns: 1fr; }
  body.saisie-agrandie .resizer,
  body.saisie-agrandie .main { display: none; }
  /* Étalé sur 1200 px, un formulaire d'une colonne devient illisible : on le
     centre sur une largeur de lecture et le reste est de la marge. */
  body.saisie-agrandie .sidebar > * {
    max-width: 960px; margin-left: auto; margin-right: auto;
  }
}

.sidebar-title {
  font-size: 0.68rem; font-weight: 600; letter-spacing: 2px;
  text-transform: uppercase; color: var(--t3);
  margin-bottom: 12px;
  display: flex; align-items: center; justify-content: space-between;
}
.mini-action {
  font-size: 0.72rem; color: var(--green-on);
  letter-spacing: 0.5px; text-transform: none; font-weight: 600;
  background: none; border: none; padding: 0;
}
.mini-action:hover { text-decoration: underline; }

.privacy-chip {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--green-bg); border: 1px solid var(--green-br);
  color: var(--green-on);
  padding: 10px 13px; border-radius: 10px;
  font-size: 0.73rem; margin-bottom: 20px; line-height: 1.5;
}

/* Type selector */
.type-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px; margin-bottom: 22px;
}
.type-btn {
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: 10px; padding: 13px 10px;
  text-align: center;
  transition: all 0.15s var(--ease);
  color: var(--t2);
}
.type-btn:hover { border-color: var(--green); color: var(--t1); background: var(--card-h); }
.type-btn.active {
  border-color: var(--green);
  background: var(--green-bg);
  color: var(--white);
}
.type-ico { font-size: 1.4rem; display: block; margin-bottom: 5px; }
.type-lbl { font-size: 0.76rem; font-weight: 500; line-height: 1.3; }
/* Forme courte du libellé, rendue uniquement sur petit écran (cf. media query). */
.type-lbl-court { display: none; }

.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* Form fields */
.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 0.74rem; font-weight: 600;
  color: var(--t2); margin-bottom: 6px; letter-spacing: 0.3px;
}
.field-hint {
  font-size: 0.7rem; color: var(--t3); margin-top: 4px;
  font-style: italic;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: 10px; padding: 11px 13px;
  font-size: 0.88rem; color: var(--t1);
  outline: none; transition: border-color 0.15s;
}
.field input:focus,
.field select:focus,
.field textarea:focus { border-color: var(--green); }
.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.field input::placeholder,
.field textarea::placeholder { color: var(--t3); }
.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23757068' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
  padding-right: 36px;
}
.field select option { background: var(--card); }
.field textarea {
  resize: vertical; min-height: 110px; line-height: 1.6;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

/* Patient row */
.patient-row {
  display: grid; grid-template-columns: 1fr auto auto;
  gap: 6px; margin-bottom: 14px;
}
.icon-btn {
  background: var(--card); border: 1.5px solid var(--border);
  border-radius: 10px; width: 42px; height: 42px;
  color: var(--t2); font-size: 1rem;
  transition: all 0.15s var(--ease);
}
.icon-btn:hover { border-color: var(--green); color: var(--green-on); }
.icon-btn.danger:hover { border-color: var(--danger); color: var(--danger); }

/* Pathology chip */
.patho-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-bg); border: 1px solid var(--accent-br);
  color: var(--accent);
  padding: 5px 10px; border-radius: 100px;
  font-size: 0.72rem; font-weight: 600; margin-top: 6px;
}
.patho-chip.hidden { display: none; }

/* Scales block */
.scales-block {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 14px;
}
.scales-title {
  font-size: 0.72rem; color: var(--t2); font-weight: 600;
  margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between;
}
.scales-title .toggle-scales {
  color: var(--green-on); background: none; border: none; padding: 0;
  font-size: 0.72rem; font-weight: 600;
}
.scales-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.scale-input {
  display: flex; align-items: center; gap: 6px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; padding: 5px 10px;
}
.scale-input label {
  font-size: 0.72rem; color: var(--t2); font-weight: 600;
  margin: 0; flex-shrink: 0; min-width: 42px;
}
.scale-input input {
  background: transparent; border: none; padding: 4px 0;
  color: var(--t1); font-size: 0.82rem; width: 100%;
  outline: none;
}
.scales-hidden { display: none; }

/* Évolution mesurée — les relevés antérieurs du même patient.
   Volontairement dense : c'est une frise qu'on lit d'un coup d'œil pendant la
   saisie, pas un tableau qu'on consulte. */
.evolution-mesures {
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border);
}
.evo-titre {
  font-size: 0.68rem; color: var(--t2); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px;
}
/* La colonne du formulaire ne fait que ~300 px de large : un libellé posé À CÔTÉ
   des relevés ne laissait que 200 px à la suite, et chaque échelle occupait
   93 px de haut à force de se replier. Constaté en mesurant la page, pas en la
   relisant. Le libellé prend donc sa propre ligne et rend toute la largeur aux
   relevés. */
.evo-ligne { padding: 4px 0; }
.evo-tete {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px; margin-bottom: 3px;
}
.evo-label {
  font-size: 0.7rem; color: var(--t2); font-weight: 600;
}
.evo-ecart {
  font-style: normal; font-size: 0.72rem; color: var(--t2);
  font-weight: 600; flex-shrink: 0;
}
.evo-suite { display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; }
.evo-pt {
  font-size: 0.76rem; color: var(--t1); white-space: nowrap;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 6px; padding: 2px 6px;
}
.evo-pt em {
  font-style: normal; font-size: 0.64rem; color: var(--t3); margin-left: 4px;
}
.evo-jour { border-color: var(--green-on); }
.evo-vide { color: var(--t3); background: transparent; border-style: dashed; }
.evo-fleche { color: var(--t3); font-size: 0.7rem; }
.evo-note {
  font-size: 0.68rem; color: var(--t3); margin-top: 8px; line-height: 1.45;
}
.evo-alerte {
  font-size: 0.72rem; color: var(--t1); line-height: 1.45;
  background: var(--panel); border: 1px solid var(--accent);
  border-radius: 8px; padding: 7px 10px; margin-bottom: 8px;
}

/* Notes area with voice */
.notes-wrap { position: relative; }
.voice-btn {
  position: absolute; top: 8px; right: 8px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; width: 32px; height: 32px;
  color: var(--t2); font-size: 0.9rem;
  transition: all 0.15s;
}
.voice-btn:hover { border-color: var(--green); color: var(--green-on); }
.voice-btn.recording {
  background: var(--danger); color: #fff; border-color: var(--danger);
  animation: pulse 1.5s ease-in-out infinite;
}

/* Template chips */
.templates-row {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px;
}
.template-chip {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 100px; padding: 5px 11px;
  font-size: 0.72rem; color: var(--t2);
  transition: all 0.15s;
}
.template-chip:hover {
  background: var(--green-bg); border-color: var(--green-br);
  color: var(--green-on);
}

/* Generate button */
.gen-btn {
  width: 100%; padding: 15px;
  background: var(--green); color: var(--green-ink);
  border: none; border-radius: 12px;
  font-size: 0.95rem; font-weight: 700;
  transition: all 0.2s var(--ease);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 4px;
}
.gen-btn:hover { background: var(--green-h); transform: translateY(-1px); }
.gen-btn:active { transform: none; }
.gen-btn:disabled { background: var(--border); color: var(--t3); cursor: not-allowed; transform: none; }
.gen-btn .shortcut {
  font-size: 0.68rem; opacity: 0.6;
  padding: 2px 6px; background: rgba(0,0,0,0.15);
  border-radius: 4px; font-weight: 500;
}

/* ==========================================================================
   MAIN
   ========================================================================== */
.main {
  display: flex; flex-direction: column;
  background: var(--bg);
  min-width: 0; /* important pour scroll horizontal */
}

/* Empty state */
.empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 48px;
  gap: 16px;
}
.empty-ico {
  width: 76px; height: 76px; border-radius: 20px;
  background: var(--card); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.1rem;
}
.empty h1 {
  font-family: 'Playfair Display', serif;
  font-size: 1.7rem; color: var(--t1); font-weight: 700;
}
.empty p { font-size: 0.92rem; color: var(--t2); max-width: 400px; line-height: 1.7; }
/* Les quatre étapes passent APRÈS l'essai en un clic (voir le commentaire dans
   #empty). Elles ne sont plus la première chose à lire, mais la marche à suivre
   une fois le résultat vu : d'où la ligne d'introduction et la marge haute plus
   large, qui les détache du bloc d'activation au lieu de le prolonger. */
.steps-intro {
  margin-top: 26px; font-size: 0.76rem; color: var(--t3);
  letter-spacing: .2px;
}
.steps {
  display: flex; gap: 24px; margin-top: 10px; flex-wrap: wrap; justify-content: center;
}
.step { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--t3); }
.step-n {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--card); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.68rem; font-weight: 700; color: var(--green-on);
}
/* — Activation : essai en un clic depuis l'écran vide — */
.try-btn {
  margin-top: 22px; padding: 13px 26px;
  background: linear-gradient(135deg, var(--green-h), var(--green));
  color: var(--green-ink); border: none; border-radius: 14px;
  font-size: 0.92rem; font-weight: 700; letter-spacing: .2px;
  display: inline-flex; align-items: center; gap: 9px;
  box-shadow: 0 12px 32px -14px color-mix(in srgb, var(--green) 78%, transparent),
              inset 0 1px 0 rgba(255,255,255,.28);
  transition: transform .18s var(--ease), box-shadow .2s var(--ease);
}
.try-btn:hover { transform: translateY(-1px); box-shadow: 0 16px 38px -14px color-mix(in srgb, var(--green) 82%, transparent), inset 0 1px 0 rgba(255,255,255,.32); }
.try-btn:active { transform: none; }
.try-btn:disabled { background: var(--border); color: var(--t3); box-shadow: none; cursor: not-allowed; transform: none; }
.try-btn .ic { width: 17px; height: 17px; }
.try-sub { margin-top: 9px; font-size: 0.75rem; color: var(--t3); max-width: 360px; }

/* — Onglets de la modale de compte — */
.account-tabs { display: flex; gap: 6px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 4px; }
.account-tab {
  flex: 1; padding: 9px 10px; border: none; background: none;
  color: var(--t2); font-size: 0.85rem; font-weight: 600; border-radius: 8px;
  cursor: pointer; transition: background .15s var(--ease), color .15s var(--ease);
}
.account-tab.active { background: var(--panel); color: var(--t1); box-shadow: 0 1px 4px -1px rgba(0,0,0,.18); }
.account-tab:not(.active):hover { color: var(--t1); }

.invite-banner {
  margin-top: 18px; padding: 9px 15px;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.78rem; color: var(--t2);
  background: var(--card); border: 1px solid var(--border); border-radius: 20px;
  max-width: 440px; text-align: left;
}
.invite-banner .ic { width: 14px; height: 14px; color: var(--t3); flex-shrink: 0; }
.invite-link {
  background: none; border: none; padding: 0;
  color: var(--green-on); font-weight: 700; font-size: inherit;
  text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
.invite-link:hover { color: var(--green-h); }

.keyboard-hint {
  margin-top: 24px; font-size: 0.74rem; color: var(--t3);
}
.keyboard-hint kbd {
  display: inline-block; padding: 2px 8px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 4px; font-family: 'SF Mono', monospace;
  font-size: 0.7rem; color: var(--t2);
  margin: 0 2px;
}

/* Streaming state */
.streaming {
  flex: 1; display: none; flex-direction: column;
  background: var(--bg);
}
.streaming.show { display: flex; }
.stream-header {
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.stream-status {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.84rem; color: var(--green-on); font-weight: 600;
}
.stream-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green);
  animation: pulse 1.2s ease-in-out infinite;
}
.stream-stop {
  padding: 7px 14px; border-radius: 8px;
  background: var(--danger); color: #fff; border: none;
  font-size: 0.78rem; font-weight: 600;
}
.stream-stop:hover { background: #F27468; }

/* Result */
.result {
  flex: 1; display: none; flex-direction: column;
  min-height: 0;
}
.result.show { display: flex; }

.result-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px; gap: 16px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.result-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.result-type {
  font-size: 0.66rem; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--green-on);
}
.result-name {
  font-size: 1rem; font-weight: 600; color: var(--white);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.result-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.action-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card); color: var(--t1);
  font-size: 0.78rem; font-weight: 600;
  transition: all 0.15s;
}
.action-btn:hover { border-color: var(--green); color: var(--green-on); }
.action-btn.primary {
  background: var(--green); color: var(--green-ink); border-color: var(--green);
}
.action-btn.primary:hover { background: var(--green-h); color: var(--green-ink); }
.action-btn.ghost { color: var(--t2); }
.action-btn.warn:hover { border-color: var(--accent); color: var(--accent); }
.action-btn.danger:hover { border-color: var(--danger); color: var(--danger); }

/* Document display */
.doc-wrap {
  flex: 1; overflow-y: auto; padding: 28px;
  display: flex; justify-content: center;
  /* LE PAPIER PREND LA HAUTEUR DE SON TEXTE, PAS CELLE DE L'ÉCRAN (2026-08-26)
     Régression introduite le matin même en bornant `.main` à un écran : ce
     conteneur est un flex, ses enfants s'étirent par défaut (`align-items:
     stretch`), et tant qu'il n'avait pas de hauteur contrainte la ligne prenait
     celle du contenu. Une fois borné, le papier s'est figé à la hauteur VISIBLE
     et son texte a débordé par le bas, hors du fond blanc : sur tablette, tout ce
     qui dépassait s'affichait en gris pâle sur le fond sombre de l'application,
     illisible. Signalé sur capture par un kiné le jour même.
     `flex-start` rend au papier sa hauteur naturelle. */
  align-items: flex-start;
}
.doc {
  width: 100%; max-width: 780px;
  background: var(--doc-bg); border-radius: 14px;
  padding: 46px 54px 38px;
  box-shadow: var(--shadow-float);
  color: var(--doc-ink);
  position: relative;
  border-top: 3px solid #1E5C4A; /* bande d'en-tête, miroir du PDF */
}

/* Edit mode */
.doc-content.editing {
  background: #FFFBF0; outline: 2px dashed var(--accent);
  border-radius: 8px; padding: 12px;
}

.doc-watermark {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 16px; margin-bottom: 18px;
  border-bottom: 1px solid var(--doc-line);
}
.doc-brand {
  display: flex; align-items: center; gap: 10px;
  font-family: 'Playfair Display', serif;
  font-size: 1.12rem; font-weight: 700; color: #1E5C4A;
}
.doc-brand::before {
  content: ''; flex-shrink: 0;
  width: 34px; height: 34px;
  background: url('assets/logo-kinescribe.png?v=20260726') center/contain no-repeat;
}
.doc-date { font-size: 0.78rem; color: var(--doc-mute); white-space: nowrap; }

/* En-tête du document : type (vert espacé) + patient — miroir du PDF. */
.doc-heading { margin-bottom: 22px; }
.doc-heading-type {
  color: #1E5C4A; font-weight: 700;
  font-size: 0.74rem; letter-spacing: 0.11em; text-transform: uppercase;
  margin-bottom: 5px;
}
.doc-heading-type .doc-demo-tag {
  display: inline-block; margin-left: 8px; vertical-align: middle;
  background: var(--accent); color: #000; border-radius: 4px;
  padding: 1px 6px; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.04em;
}
.doc-heading-patient {
  font-family: 'Playfair Display', serif;
  font-size: 1.32rem; font-weight: 700; color: var(--doc-ink);
  line-height: 1.25;
}

.doc-heading-sous {
  margin-top: 2px; font-size: 0.82rem; color: var(--doc-mute);
}

/* ── Sélecteur de type, compact sur petit écran ─────────────────────────────
   En 375x667, la grille 2x2 mesurait 259 px : à elle seule, elle repoussait la
   zone de notes à 756 px du haut, donc sous la ligne de flottaison, alors que la
   promesse du produit est qu'il suffit d'y écrire trois lignes. Sur téléphone,
   qui est 56 % du trafic de l'app, le sélecteur passe donc sur une seule rangée
   de quatre. Rien n'est retiré : les mêmes quatre choix, en 70 px au lieu de 259. */
@media (max-width: 700px) {
  .type-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px; margin-bottom: 16px;
  }
  .type-btn { padding: 9px 4px 8px; border-radius: 11px; }
  .type-ico { margin-bottom: 3px; }
  .type-ico .ic { width: 19px; height: 19px; }
  /* « Bilan kinésithérapique » ne tient pas dans 77 px : sur une rangée de
     quatre, on montre la forme courte. Les deux libellés sont dans le HTML et
     un seul est rendu — celui qui est masqué n'est pas non plus annoncé aux
     lecteurs d'écran, le nom accessible du bouton reste donc juste. */
  .type-lbl { display: none; }
  .type-lbl-court { display: block; font-size: 0.66rem; font-weight: 600; line-height: 1.2; }
}

/* Résumé d'anonymisation : informatif, jamais alarmant — sauf quand il a
   réellement quelque chose à signaler, où il passe en accent. */
.anon-resume {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  margin: 0 0 12px; padding: 8px 12px;
  border: 1px solid var(--border, #2A3050);
  border-radius: 9px;
  font-size: 0.78rem; color: var(--t2, #B8B4AE);
}
.anon-resume .anon-ico { display: flex; color: var(--green, #2ECC8F); }
.anon-resume.a-verifier { border-color: var(--accent, #D4622A); }
.anon-resume.a-verifier #anon-resume-alerte { color: var(--accent, #D4622A); font-weight: 600; }
.anon-resume button {
  margin-left: auto; font: inherit; font-weight: 600;
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--green, #2ECC8F); text-decoration: underline;
}

/* Partage à un confrère : même gabarit que le résumé d'anonymisation, une ligne
   discrète sous le document, jamais une modale. */
.partage-confrere {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  margin: 0 0 12px; padding: 8px 12px;
  border: 1px dashed var(--border, #2A3050);
  border-radius: 9px;
  font-size: 0.78rem; color: var(--t2, #B8B4AE);
}
.partage-confrere .partage-ico { display: flex; color: var(--green, #2ECC8F); }
.partage-confrere button {
  margin-left: auto; font: inherit; font-weight: 600;
  background: none; border: 0; padding: 4px 0; cursor: pointer;
  color: var(--green, #2ECC8F); text-decoration: underline;
}

/* ── Identité repliable ─────────────────────────────────────────────────────
   Repliée par défaut : le sélecteur de patient la remplit, et le résumé sur la
   ligne de titre suffit à vérifier qu'on est sur le bon dossier. */
.identite-block {
  border: 1px solid var(--border, #2A3050);
  border-radius: 10px;
  margin-top: 14px;
  background: rgba(255,255,255,0.02);
}
.identite-block > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 14px;
  cursor: pointer;
  font-size: 0.74rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--t2, #B8B4AE);
  list-style: none;
}
.identite-block > summary::-webkit-details-marker { display: none; }
.identite-block > summary::after {
  content: '+'; font-size: 1rem; font-weight: 400; line-height: 1;
  color: var(--t3, #7C7871); flex-shrink: 0;
}
.identite-block[open] > summary::after { content: '\2212'; }
.identite-block[open] > summary { border-bottom: 1px solid var(--border, #2A3050); }
.identite-block > .field-row,
.identite-block > .field-row-3 { padding: 0 14px; }
.identite-block > .field-row:first-of-type { padding-top: 12px; }
.identite-block > .field-row-3:last-child { padding-bottom: 12px; }
.identite-resume {
  margin-left: auto;
  font-size: 0.76rem; font-weight: 500;
  letter-spacing: 0; text-transform: none;
  color: var(--t1, #F0EDE8);
  text-align: right;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.identite-resume.vide { color: var(--t3, #7C7871); font-style: italic; }

/* Rappel d'identité manquante. Discret : c'est un document de travail correct par
   ailleurs, on ne le barre pas d'un bandeau rouge. */
.sig-manquante {
  margin-top: 10px; font-size: 0.78rem; color: var(--doc-mute);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.sig-manquante button {
  font: inherit; font-weight: 600;
  background: none; border: 0; padding: 0;
  color: #1E5C4A; text-decoration: underline; cursor: pointer;
}

/* ── Famille « dossier » : champs d'identification étiquetés ────────────────
   Une pièce de dossier s'ouvre par des champs qu'on relit d'un coup d'œil six
   mois plus tard, pas par une phrase de méta séparée par des points médians. */
.doc-champs {
  margin: 10px 0 0; padding: 0;
  display: grid; grid-template-columns: auto 1fr;
  column-gap: 14px; row-gap: 3px;
  font-size: 0.82rem;
}
.doc-champ { display: contents; }
.doc-champs dt {
  color: var(--doc-mute); font-weight: 600;
  white-space: nowrap;
}
.doc-champs dd { margin: 0; color: var(--doc-body); }

/* ── Famille « lettre » : lieu et date, destinataire, objet ─────────────────
   Le nom du patient n'est PAS un titre ici : il appartient à l'objet. Une lettre
   ne parle pas d'un dossier, elle s'adresse à quelqu'un. */
.doc-heading-lettre { margin-bottom: 26px; }
.doc-lettre-lieu {
  text-align: right; font-size: 0.86rem; color: var(--doc-body);
  margin-bottom: 22px;
}
.doc-lettre-dest {
  text-align: right; font-size: 0.92rem; color: var(--doc-ink);
  font-weight: 600; margin-bottom: 26px; white-space: pre-line;
}
.doc-lettre-objet {
  font-size: 0.88rem; color: var(--doc-ink);
  padding-bottom: 14px; border-bottom: 1px solid var(--doc-line);
}
.doc-lettre-objet span {
  color: #1E5C4A; font-weight: 700;
  letter-spacing: 0.04em;
}

.doc-content {
  font-size: 0.94rem; line-height: 1.8;
  color: var(--doc-body); white-space: pre-wrap;
  outline: none;
  min-height: 200px;
}
.doc-content strong { color: var(--doc-ink); font-weight: 600; }

/* Titre de section : vert, petites capitales espacées, filet — miroir du PDF. */
.doc-content .doc-h {
  display: block;
  color: #1E5C4A; font-weight: 700;
  font-size: 0.8rem; letter-spacing: 0.07em; text-transform: uppercase;
  margin: 2px 0 9px; padding-bottom: 5px;
  border-bottom: 1px solid rgba(30, 92, 74, 0.22);
}
/* Un peu d'air avant chaque nouvelle section (sauf la première). */
.doc-content p:has(.doc-h) { margin-top: 20px; }
.doc-content p:first-child:has(.doc-h) { margin-top: 0; }

.doc-content p {
  margin-bottom: 12px; position: relative; padding-right: 12px;
}
.doc-content p:hover .para-actions,
.doc-content p:focus-within .para-actions { opacity: 1; transform: translateY(0); }
.doc-content p:hover { background: rgba(30, 92, 74, 0.03); border-radius: 6px; }

/* Barre d'actions flottante (pilule) ancrée au coin haut-droit du paragraphe.
   Flottante = n'ampute pas la largeur du texte ; visible au survol. */
.para-actions {
  position: absolute; top: -13px; right: 4px;
  display: flex; flex-direction: row; gap: 3px;
  background: var(--doc-bg, #FCFBF8);
  border: 1px solid #E5E1DA; border-radius: 9px;
  padding: 3px; box-shadow: 0 4px 16px rgba(20,18,14,0.12);
  opacity: 0; transform: translateY(4px);
  transition: opacity 0.14s, transform 0.14s; z-index: 5;
}
.para-btn {
  width: 27px; height: 27px; border-radius: 6px;
  background: #F5F1E8; color: #6B6860; border: 1px solid #E5E1DA;
  font-size: 0.75rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0; transition: all 0.12s;
}
.para-btn .ic { width: 14px; height: 14px; }
.para-btn:hover { background: var(--green); color: var(--green-ink); border-color: var(--green); }
.para-btn.danger:hover { background: #B4342A; color: #fff; border-color: #B4342A; }
.para-btn.loading { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Paragraphe en cours de régénération */
.doc-content .para-regenerating {
  background: #FFFBF0; border-left: 3px solid var(--accent);
  padding-left: 12px; position: relative;
  transition: all 0.2s;
}
.doc-content .para-regenerating::after {
  content: '⟳ régénération...';
  position: absolute; right: 0; top: 0;
  font-size: 0.7rem; color: var(--accent); font-style: italic;
  font-weight: 500;
}

/* Menu d'actions par paragraphe (labellisé, tactile-friendly) */
.para-menu-backdrop {
  position: fixed; inset: 0; z-index: 400; background: transparent;
}
.para-menu {
  position: fixed; z-index: 401; min-width: 220px;
  background: #FFFFFF; border: 1px solid #E5E1DA; border-radius: 10px;
  box-shadow: 0 10px 34px rgba(20,18,14,0.18);
  padding: 6px; display: flex; flex-direction: column;
}
.para-menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 7px; border: none; background: none;
  color: #37332E; font-size: 0.86rem; font-weight: 500;
  cursor: pointer; text-align: left; width: 100%;
}
.para-menu-item .ic { width: 15px; height: 15px; flex-shrink: 0; color: #6B6860; }
.para-menu-item:hover { background: var(--green-bg, #EEF6F1); color: var(--green-on, #1E5C4A); }
.para-menu-item:hover .ic { color: var(--green-on, #1E5C4A); }
.para-menu-item.danger { color: #B4342A; }
.para-menu-item.danger .ic { color: #B4342A; }
.para-menu-item.danger:hover { background: #FBECEA; color: #922019; }
.para-menu-item.danger:hover .ic { color: #922019; }
.para-menu-sep { height: 1px; background: #EFEBE3; margin: 4px 6px; }

/* Édition inline d'un paragraphe (textarea = aucun saut de ligne perdu) */
.para-editor { margin-bottom: 12px; }
.para-editor textarea {
  width: 100%; box-sizing: border-box;
  font-family: inherit; font-size: 0.93rem; line-height: 1.7;
  color: var(--doc-ink, #1A1714); background: #FFFBF0;
  border: 2px solid var(--accent); border-radius: 8px; padding: 10px 12px;
  resize: vertical; min-height: 90px; outline: none;
}
.para-editor-actions { display: flex; gap: 8px; margin-top: 8px; }
.para-editor-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 8px; font-size: 0.82rem; font-weight: 600;
  cursor: pointer; border: 1px solid var(--border, #E5E1DA);
}
.para-editor-btn .ic { width: 14px; height: 14px; }
.para-editor-btn.primary { background: var(--green, #1E5C4A); color: var(--green-ink, #fff); border-color: var(--green, #1E5C4A); }
.para-editor-btn.ghost { background: transparent; color: #6B6860; }
.para-editor-btn.ghost:hover { background: #F5F1E8; }

/* Éditeur global « Éditer » : vrai textarea (aucun caractère perdu) */
.doc-global-editor {
  width: 100%; box-sizing: border-box; min-height: 420px;
  font-family: inherit; font-size: 0.93rem; line-height: 1.85;
  color: var(--doc-ink, #1A1714); background: transparent;
  border: none; outline: none; resize: vertical; padding: 0; margin: 0;
  overflow: hidden;
}

/* Ajouter un paragraphe en fin de document */
.add-para-btn {
  display: inline-flex; align-items: center; gap: 7px;
  margin-top: 8px; padding: 8px 15px; border-radius: 8px;
  background: transparent; border: 1px dashed var(--doc-line, #D9D2C6);
  color: var(--doc-mute, #78746E); font-size: 0.82rem; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.add-para-btn:hover { border-color: var(--green, #1E5C4A); color: var(--green, #1E5C4A); background: rgba(30,92,74,0.04); }
.add-para-btn .ic { width: 15px; height: 15px; }

/* Barre de variantes sous le document */
.variants-bar {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 14px 28px; background: var(--panel);
  border-top: 1px solid var(--border);
  align-items: center;
}
.variants-label {
  font-size: 0.74rem; color: var(--t3); font-weight: 600;
  letter-spacing: 0.5px; text-transform: uppercase;
  margin-right: 4px;
}
.variant-btn {
  background: var(--card); border: 1px solid var(--border);
  color: var(--t1); padding: 7px 14px; border-radius: 8px;
  font-size: 0.8rem; font-weight: 500;
  transition: all 0.15s var(--ease);
  display: inline-flex; align-items: center; gap: 6px;
}
.variant-btn:hover:not(:disabled) {
  border-color: var(--green); color: var(--green-on); background: var(--green-bg);
}
.variant-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.variant-btn .ico { font-size: 0.95rem; }

/* Indicateur de version active */
.version-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--accent-bg); color: var(--accent);
  border: 1px solid var(--accent-br);
  padding: 3px 10px; border-radius: 100px;
  font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.5px; text-transform: uppercase;
  margin-left: 8px;
}

.doc-footer {
  margin-top: 36px; padding-top: 18px;
  border-top: 1px solid var(--doc-line);
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 10px;
}
.doc-footer p { font-size: 0.72rem; color: #AAA; }
.doc-sig {
  font-size: 0.78rem; color: #555;
  text-align: right; line-height: 1.5;
}

/* Stream cursor */
.stream-cursor {
  display: inline-block; width: 2px; height: 1em;
  background: var(--green); vertical-align: -2px;
  animation: blink 0.9s step-end infinite; margin-left: 1px;
}

/* Regenerate bar (appears below doc when a paragraph is regenerating) */
.regen-inline {
  display: inline-block; margin-left: 6px;
  font-size: 0.72rem; color: var(--green-on); font-style: italic;
}

/* ==========================================================================
   TOAST
   ========================================================================== */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--card); border: 1px solid var(--green);
  color: var(--green-on); padding: 12px 18px; border-radius: 10px;
  font-size: 0.82rem; font-weight: 600;
  display: none; align-items: center; gap: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 999; max-width: 380px;
}
.toast.show { display: flex; animation: slideUp 0.3s var(--ease); }

/* ==========================================================================
   VEILLE DE VERSION (2026-08-26)
   --------------------------------------------------------------------------
   Il se place au-dessus du toast, jamais par-dessus le travail : il n'occupe
   qu'un coin, il ne bloque rien, et il attend.
   ========================================================================== */
.maj-dispo {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--card); border: 1px solid var(--border-h);
  color: var(--t1); padding: 12px 16px; border-radius: 10px;
  font-size: 0.82rem;
  display: none; align-items: center; gap: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 998; max-width: 380px;
}
.maj-dispo.show { display: flex; animation: slideUp 0.3s var(--ease); }
.maj-dispo button {
  background: var(--green); color: #0F1117; border: none;
  padding: 7px 14px; border-radius: 8px;
  font: inherit; font-weight: 700; cursor: pointer; flex-shrink: 0;
}
.maj-dispo .plus-tard {
  background: none; color: var(--t3); font-weight: 500; padding: 7px 4px;
}

/* ==========================================================================
   MODAL / DRAWER
   ========================================================================== */
.overlay {
  position: fixed; inset: 0;
  background: rgba(15,17,23,0.82);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center; justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s var(--ease);
}
.overlay.show { display: flex; }

.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  max-width: 560px; width: 100%;
  padding: 30px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
  max-height: 90vh; overflow-y: auto;
}
.modal.wide { max-width: 720px; }
.modal h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem; color: var(--white); margin-bottom: 12px;
  display: flex; align-items: center; gap: 10px;
}
.modal h2 .ico {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--green-bg); border: 1px solid var(--green-br);
  color: var(--green-on); display: flex; align-items: center; justify-content: center;
  font-size: 0.95rem;
}
.modal p { font-size: 0.88rem; color: var(--t2); margin-bottom: 12px; line-height: 1.65; }
.modal ul { list-style: none; margin: 14px 0; }
.modal ul li {
  font-size: 0.85rem; color: var(--t2);
  padding: 6px 0 6px 24px; position: relative; line-height: 1.55;
}
.modal ul li::before {
  content: '✓'; position: absolute; left: 0; top: 6px;
  color: var(--green-on); font-weight: 700;
}

.modal-actions {
  display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap;
  margin-top: 20px;
  /* La barre d'action reste collée au bas de la modale quand le contenu déborde.
     Sans ça, sur un écran court (375x667, iPhone SE/8), le bouton de sortie du
     bandeau de consentement tombait 105 px sous la ligne de flottaison : la seule
     issue était de deviner que la modale défile en interne, et Échap ne la ferme
     pas. Vaut pour toutes les modales, pas seulement le consentement. */
  position: sticky;
  bottom: 0;
  z-index: 1;
  padding-top: 14px;         /* respiration sous le texte qui défile derrière */
  background: var(--panel);  /* opaque : le texte défile derrière, pas au travers */
}
.modal-btn {
  padding: 11px 20px; border-radius: 10px; border: none;
  font-size: 0.86rem; font-weight: 600; transition: all 0.15s;
}
.modal-btn.primary { background: var(--green); color: var(--green-ink); }
.modal-btn.primary:hover { background: var(--green-h); }
.modal-btn.secondary {
  background: transparent; color: var(--t2); border: 1px solid var(--border);
}
.modal-btn.secondary:hover { border-color: var(--t2); color: var(--t1); }
.modal-btn.danger {
  background: transparent; color: var(--danger); border: 1px solid var(--danger);
}
.modal-btn.danger:hover { background: var(--danger); color: #fff; }

/* Le tiroir d'historique est devenu l'écran Documents (refonte 3.3). */

.history-item {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 13px 15px;
  cursor: pointer; margin-bottom: 8px;
  transition: all 0.15s; position: relative;
}
.history-item:hover { border-color: var(--green); }
.history-type {
  font-size: 0.62rem; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--green-on); margin-bottom: 3px;
}
.history-name { font-size: 0.9rem; color: var(--t1); font-weight: 500; margin-bottom: 3px; }
.history-meta { font-size: 0.72rem; color: var(--t3); }
.history-del {
  position: absolute; top: 10px; right: 10px;
  background: transparent; border: none; color: var(--t3);
  font-size: 0.9rem; opacity: 0; transition: opacity 0.15s; padding: 4px 8px;
}
.history-item:hover .history-del { opacity: 1; }
.history-del:hover { color: var(--danger); }
.empty-list {
  text-align: center; color: var(--t3); font-size: 0.85rem; padding: 40px 20px;
}

/* Stats modal */
.stats-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin: 16px 0 20px;
}
.stat-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px;
}
.stat-val {
  font-family: 'Playfair Display', serif;
  font-size: 1.9rem; font-weight: 700;
  color: var(--green-on); line-height: 1; margin-bottom: 6px;
}
.stat-lbl { font-size: 0.78rem; color: var(--t2); }
.stat-sub { font-size: 0.7rem; color: var(--t3); margin-top: 4px; }

.stats-bar {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px;
  margin-bottom: 14px;
}
.stats-bar-title {
  font-size: 0.74rem; color: var(--t2); margin-bottom: 10px;
  display: flex; align-items: center; justify-content: space-between;
}
.bar-row {
  display: grid; grid-template-columns: 100px 1fr 40px;
  gap: 8px; align-items: center; margin-bottom: 6px;
}
.bar-label { font-size: 0.76rem; color: var(--t2); }
.bar-bar {
  height: 8px; background: var(--border); border-radius: 4px; overflow: hidden;
}
.bar-fill { height: 100%; background: var(--green); border-radius: 4px; transition: width 0.5s; }
.bar-val { font-size: 0.76rem; color: var(--t1); font-weight: 600; text-align: right; }

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }

.result.show { animation: fadeIn 0.4s; }

/* Respect de la préférence système « réduire les animations » (WCAG 2.3.3, audit 2026-06-23) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  /* Une seule colonne à la fois, par onglets : la colonne ne colle plus, elle ne
     se règle plus, et elle reprend sa hauteur naturelle. */
  .sidebar {
    border-bottom: 1px solid var(--border);
    position: static; height: auto; max-height: none; align-self: stretch;
  }
  .resizer { display: none; }
  .doc { padding: 28px 24px; }
  .result-header { flex-direction: column; align-items: flex-start; }
  nav.topbar { padding: 12px 16px; }
  .nav-btn span.lbl { display: none; }
  .stat-chip { padding: 5px 10px; font-size: 0.72rem; }
  /* Mobile tabs — panels */
  .app { padding-bottom: 60px; }
  .mob-hidden { display: none !important; }
  /* Mobile tabs — bar fixe en bas */
  .mob-tabs { display: flex; }
}
@media (min-width: 961px) {
  .mob-tabs { display: none; }
  .resizer { display: block; }

  /* DEUX COLONNES QUI DÉFILENT CHACUNE POUR ELLE-MÊME (2026-08-26)
     Rendre la colonne de gauche collante ne suffisait pas : un élément collant ne
     peut pas sortir de sa case de grille. La page ayant 45 px à défiler pour 31 px
     de jeu, la colonne repassait de 14 px SOUS la barre du haut. Mesuré, pas
     supposé.

     On borne donc la colonne de droite à un écran et le corps de page ne défile
     plus du tout à cette largeur. Ce n'est pas un ajout : `.doc-wrap` porte
     `flex: 1; overflow-y: auto` depuis toujours, et `.result` porte
     `min-height: 0` — cette mise en page était prévue, il manquait la hauteur qui
     la déclenche. Au passage, l'auto-défilement pendant la génération
     (`wrap.scrollTop = wrap.scrollHeight`) recommence à faire quelque chose : il
     agissait sur un conteneur qui ne défilait pas. */
  /* Le corps ne défile plus du tout à cette largeur : la barre du haut, la colonne
     de saisie et la colonne du document tiennent exactement dans la fenêtre, et
     chacune des deux colonnes défile pour elle-même. C'est ce qui supprime la
     classe entière du défaut, plutôt qu'un de ses symptômes : tant que la page
     défilait de quelques pixels, la colonne collante était repoussée d'autant. */
  /* SÉANCE SEULEMENT (2026-10-11). Les écrans de la refonte (Documents,
     Ordonnance, Patients…) n'ont pas de colonne qui défile pour elle-même : sous
     ce verrou, tout ce qui dépassait la fenêtre devenait inatteignable. Le
     routeur pose `data-ecran` sur <html> ; sans attribut (avant son passage),
     on est en séance. */
  html:not([data-ecran]), html:not([data-ecran]) body,
  html[data-ecran="seance"], html[data-ecran="seance"] body { height: 100%; overflow: hidden; }
  .main {
    height: calc(100vh - var(--topbar-h, 57px));
    height: calc(100dvh - var(--topbar-h, 57px));
    overflow: hidden;
  }
  /* Les deux écrans pleins (accueil, erreur de génération) sont plus hauts qu'une
     tablette en paysage : sans défilement propre, leur bas serait inatteignable.
     `safe center` garde le centrage tant que ça tient, et cesse de centrer plutôt
     que de couper le haut quand ça déborde. */
  .empty {
    min-height: 0; overflow-y: auto;
    justify-content: center;
    justify-content: safe center;
  }
}

/* ==========================================================================
   MOBILE TABS BAR
   ========================================================================== */
.mob-tabs {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 900;
  background: var(--surface);
  border-top: 1px solid var(--border);
  justify-content: stretch;
  box-shadow: 0 -2px 12px rgba(0,0,0,.18);
}
.mob-tab {
  flex: 1;
  padding: 10px 0 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--t2);
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: color .15s;
}
.mob-tab.active { color: var(--green-on); }
.mob-tab .tab-ico { font-size: 1.3rem; line-height: 1; }

/* ==========================================================================
   HALLUCINATION WARNING BANNER
   ========================================================================== */
.halluc-banner {
  display: none;
  margin: 0 0 12px 0;
  padding: 10px 14px;
  background: rgba(255, 170, 0, 0.12);
  border: 1px solid rgba(255, 170, 0, 0.45);
  border-radius: 8px;
  font-size: 0.82rem;
  color: var(--t1);
  line-height: 1.5;
}
.halluc-banner.show { display: flex; gap: 10px; align-items: flex-start; }

/* Bandeau « document d'exemple » — remplace la modale d'inscription qui
   s'ouvrait par-dessus le résultat. On laisse le praticien lire d'abord ;
   l'appel au compte reste visible mais ne bloque rien. */
.demo-banner {
  display: none;
  margin: 0 0 12px 0;
  padding: 10px 14px;
  background: rgba(0, 200, 140, 0.10);
  border: 1px solid rgba(0, 200, 140, 0.38);
  border-radius: 8px;
  font-size: 0.82rem;
  color: var(--t1);
  line-height: 1.5;
}
.demo-banner.show { display: flex; gap: 10px; align-items: flex-start; }
.demo-banner .demo-ico { flex-shrink: 0; margin-top: 1px; color: var(--green-on); }
.demo-banner .demo-cta {
  margin-left: auto; flex-shrink: 0;
  background: none; border: none; padding: 0 0 0 10px;
  color: var(--green-on); font: inherit; font-weight: 700;
  text-decoration: underline; cursor: pointer;
}
.halluc-banner .halluc-ico { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.halluc-banner .halluc-close {
  margin-left: auto; background: none; border: none; cursor: pointer;
  color: var(--t3); font-size: 1rem; flex-shrink: 0; padding: 0 0 0 6px;
}

/* ==========================================================================
   ICÔNES SVG (refonte 2026-06-30) — sprite <symbol> unique, héritent currentColor
   ========================================================================== */
.ic {
  width: 1.1em; height: 1.1em; flex: none;
  display: inline-block; vertical-align: -0.18em;
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  pointer-events: none;
}
.nav-btn .ic { width: 16px; height: 16px; }
.icon-btn .ic { width: 18px; height: 18px; }
.voice-btn .ic { width: 16px; height: 16px; }
.stat-chip .ic { width: 14px; height: 14px; }
.type-ico .ic { width: 26px; height: 26px; stroke-width: 1.8; }
.action-btn .ic, .variant-btn .ic { width: 15px; height: 15px; }
.para-btn .ic { width: 14px; height: 14px; }
.gen-btn .ic, .stream-stop .ic { width: 18px; height: 18px; }
.mob-tab .ic { width: 22px; height: 22px; }
.empty-ico .ic { width: 38px; height: 38px; stroke-width: 1.6; }
.privacy-chip .ic, .feature-chip .ic { width: 15px; height: 15px; }
.logo-lock .ic { width: 13px; height: 13px; }

/* ==========================================================================
   CHAMPS — plus discrets au repos, nets à l'intention (doctrine retrait)
   ========================================================================== */
.field input, .field select, .field textarea { border-width: 1px; }
.field input:hover:not(:focus),
.field select:hover:not(:focus),
.field textarea:hover:not(:focus) { border-color: var(--border-h); }

/* ==========================================================================
   RESPONSIVE v2 — téléphone / tablette (portrait+paysage) / desktop
   ========================================================================== */
/* Tablette paysage & desktop étroit : la sidebar fluide (clamp) gère 961-1200.
   En dessous de 961px on passe en panneaux à onglets (règle existante). */
@media (max-width: 960px) {
  .sidebar { padding: 20px 18px 28px; }
  .result-actions { width: 100%; }
}
/* Cibles tactiles ≥ 44px sur écrans tactiles (tablette/téléphone) */
@media (pointer: coarse) {
  .nav-btn, .icon-btn, .action-btn, .variant-btn, .voice-btn,
  .modal-btn, .template-chip { min-height: 44px; }
  .field input, .field select, .field textarea { min-height: 44px; }
  .mob-tab { padding: 12px 0 10px; }
  .type-btn { padding: 16px 10px; }
}
/* Sans survol (tactile : téléphone, iPad) : les contrôles révélés au :hover sont
   inaccessibles au doigt. On les rend visibles en permanence et tappables, sinon
   l'édition par paragraphe et la suppression d'historique n'existent pas sur mobile. */
@media (hover: none) {
  /* Tactile : pas de survol → la pilule reste visible et ancrée dans le
     paragraphe. Les raccourcis directs sont masqués (place limitée) ; le « ⋯»
     ouvre le menu complet, qui contient tous les gestes. */
  .doc-content p .para-actions {
    opacity: 1; transform: none;
    top: 2px; right: 2px; box-shadow: none;
  }
  .para-quick { display: none; }
  .para-btn { width: 34px; height: 34px; }
  .doc-content p { padding-right: 46px; }
  .history-del { opacity: 1; padding: 8px 10px; }
  /* Sur une tablette au doigt, il n'y a pas de touche Ctrl : cette ligne annonçait
     quatre gestes impossibles. Retour déposé le 2026-08-25 dans la boîte à idées,
     mot pour mot : « la partie droite avec les raccourcis ne me sert à rien ».
     C'est Killian lui-même qui l'a écrit, depuis son second compte : à ce jour
     aucun praticien extérieur n'a envoyé d'idée, et présenter ce retour comme
     venant d'un tiers ferait passer un test interne pour une validation.
     Un iPad muni d'un clavier à trackpad rapporte `hover: hover` et la garde donc. */
  .keyboard-hint { display: none; }
}
/* Téléphone : resserrer le chrome, document pleine largeur lisible */
@media (max-width: 560px) {
  nav.topbar { padding: 10px 12px; flex-wrap: wrap; gap: 8px; }
  .logo { font-size: 1.1rem; }
  .topbar .logo-lock { display: none; }      /* mention de confidentialité : repliée dans RGPD */
  #top-stat { display: none; }               /* chip temps gagné : visible dès la tablette */
  .topbar .nav-badge { display: none; }
  .nav-right { width: 100%; justify-content: space-between; gap: 4px; flex-wrap: nowrap; }
  .nav-right .nav-btn { padding: 9px; flex: 0 0 auto; }
  #auth-pill { flex: 1 1 auto; display: flex; justify-content: flex-end; }
  .doc { padding: 24px 18px 28px; }
  .doc-wrap { padding: 16px 12px 80px; }
  .result-header, .stream-header { padding: 14px 16px; }
  .result-actions { gap: 6px; }
  .action-btn { padding: 10px 12px; font-size: 0.76rem; }
  .empty { padding: 32px 20px 80px; }
}

/* ==========================================================================
   REFONTE PREMIUM (2026-06-30) — profondeur, matière, motion léchée.
   Doctrine design-cinematique, limites d'austérité levées. Surcharge l'existant.
   Animations transform/opacity uniquement ; prefers-reduced-motion déjà neutralisé.
   ========================================================================== */

/* — Ambiance : fond vivant multi-couches, fixé au scroll — */
:root, [data-theme="dark"] {
  --page-glow:
    radial-gradient(900px 520px at 78% -8%, rgba(52,211,153,.12), transparent 62%),
    radial-gradient(760px 620px at 4% 10%, rgba(70,130,210,.07), transparent 60%),
    radial-gradient(1200px 820px at 50% 118%, rgba(52,211,153,.06), transparent 55%);
}
[data-theme="light"] {
  --page-glow:
    radial-gradient(900px 520px at 80% -10%, rgba(18,147,106,.12), transparent 60%),
    radial-gradient(720px 560px at 0% 6%, rgba(194,105,46,.06), transparent 60%);
}
body { background: var(--page-glow), var(--bg); }

/* — Topbar : verre dépoli — */
nav.topbar {
  background: var(--panel);
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  backdrop-filter: blur(10px) saturate(140%);
  box-shadow: 0 1px 0 rgba(255,255,255,.04), 0 12px 34px -22px rgba(0,0,0,.6);
}
.logo { letter-spacing: -.5px; font-weight: 800; }

/* — Boutons de nav : matière + micro-lift — */
.nav-btn { border-radius: 11px; transition: transform .15s var(--ease), border-color .15s, color .15s, background .15s; }
.nav-btn:hover { transform: translateY(-1px); }
.stat-chip { background: linear-gradient(135deg, var(--green-bg), transparent); }

/* — Sidebar : surface sculptée + entrée latérale — */
.sidebar {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--green) 5%, transparent), transparent 240px),
    var(--panel);
  animation: kx-slideL .55s var(--ease) both;
}
.sidebar-title { font-weight: 700; }
.sidebar-title > span:first-child::before {
  content: ""; display: inline-block; width: 14px; height: 2px; border-radius: 2px;
  background: var(--green); margin-right: 8px; vertical-align: middle; opacity: .9;
}

/* — Bandeau confidentialité : premium discret — */
.privacy-chip {
  background: linear-gradient(135deg, var(--green-bg), transparent 85%);
  border-radius: 13px; align-items: center;
}

/* — Cartes de type : icône en pastille, état actif lumineux, hover en relief — */
.type-grid { gap: 10px; }
.type-btn {
  position: relative; overflow: hidden; border-radius: 16px; border-width: 1px;
  padding: 16px 12px 14px;
  transition: transform .18s var(--ease), box-shadow .2s var(--ease), border-color .2s, background .2s;
  animation: kx-rise .5s var(--ease) both;
}
.type-grid .type-btn:nth-child(1) { animation-delay: .04s; }
.type-grid .type-btn:nth-child(2) { animation-delay: .09s; }
.type-grid .type-btn:nth-child(3) { animation-delay: .14s; }
.type-grid .type-btn:nth-child(4) { animation-delay: .19s; }
.type-ico {
  display: flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; margin: 0 auto 10px; border-radius: 14px;
  background: color-mix(in srgb, var(--green) 10%, var(--card));
  border: 1px solid var(--green-br); color: var(--green-on);
  transition: transform .2s var(--ease), background .2s, color .2s, box-shadow .2s;
}
.type-btn:hover { transform: translateY(-3px); border-color: var(--green-br); box-shadow: 0 16px 34px -18px rgba(0,0,0,.5); }
.type-btn:hover .type-ico { transform: scale(1.06); }
.type-btn.active {
  background: linear-gradient(162deg, color-mix(in srgb, var(--green) 16%, var(--card)), var(--card));
  border-color: var(--green);
  box-shadow: inset 0 0 0 1px var(--green-br), 0 18px 40px -20px color-mix(in srgb, var(--green) 65%, transparent);
}
.type-btn.active .type-ico {
  background: var(--green); color: var(--green-ink); border-color: var(--green);
  box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--green) 75%, transparent);
}
.type-lbl { font-weight: 600; }

/* — Champs : focus en halo, label vivant — */
.field input, .field select, .field textarea { border-radius: 12px; transition: border-color .15s, box-shadow .2s, background .15s; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px var(--green-bg);
}

/* — Bouton Générer : le point focal — dégradé, halo, reflet balayant — */
.gen-btn {
  background: linear-gradient(135deg, var(--green-h), var(--green));
  border-radius: 14px; letter-spacing: .2px; position: relative; overflow: hidden;
  box-shadow: 0 12px 32px -12px color-mix(in srgb, var(--green) 78%, transparent), inset 0 1px 0 rgba(255,255,255,.28);
  transition: transform .18s var(--ease), box-shadow .2s var(--ease);
}
.gen-btn::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 32%, rgba(255,255,255,.38) 50%, transparent 68%);
  transform: translateX(-130%); transition: transform .7s var(--ease);
}
.gen-btn:hover { transform: translateY(-2px); box-shadow: 0 18px 44px -12px color-mix(in srgb, var(--green) 88%, transparent), inset 0 1px 0 rgba(255,255,255,.3); }
.gen-btn:hover::after { transform: translateX(130%); }
.gen-btn .shortcut { background: rgba(0,0,0,.18); }

/* — État vide : un vrai moment — icône flottante, titre sculpté — */
.main { animation: kx-rise .6s var(--ease) both; }
.empty-ico {
  width: 96px; height: 96px; border-radius: 28px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--green) 20%, var(--card)), var(--card));
  border: 1px solid var(--green-br); color: var(--green-on);
  box-shadow: 0 28px 64px -26px color-mix(in srgb, var(--green) 70%, transparent), inset 0 1px 0 rgba(255,255,255,.14);
  animation: kx-float 5.5s ease-in-out infinite;
}
.empty h1 {
  font-size: clamp(2rem, 4.2vw, 2.9rem); font-weight: 800; letter-spacing: -1.2px; line-height: 1.05;
  background: linear-gradient(180deg, var(--t1), color-mix(in srgb, var(--t1) 62%, var(--green)));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.empty > * { animation: kx-rise .6s var(--ease) both; }
.empty .empty-ico { animation: kx-float 5.5s ease-in-out infinite, kx-rise .6s var(--ease) both; }
.empty h1 { animation-delay: .06s; }
.empty p { animation-delay: .12s; }
.empty .steps { animation-delay: .18s; }
.step-n {
  background: linear-gradient(160deg, color-mix(in srgb, var(--green) 22%, var(--card)), var(--card));
  border-color: var(--green-br); color: var(--green-on); font-weight: 800;
}
.feature-chip { backdrop-filter: blur(4px); }

/* — Document : flottaison, papier net — */
.doc {
  border-radius: 16px;
  box-shadow: 0 44px 96px -42px rgba(0,0,0,.55), 0 10px 28px -16px rgba(0,0,0,.32);
}
.result.show { animation: kx-rise .45s var(--ease) both; }

/* — Barre d'actions & variantes : relief au survol — */
.action-btn, .variant-btn { transition: transform .15s var(--ease), border-color .15s, color .15s, background .15s, box-shadow .2s; border-radius: 10px; }
.action-btn:hover, .variant-btn:hover:not(:disabled) { transform: translateY(-1px); }
.action-btn.primary {
  background: linear-gradient(135deg, var(--green-h), var(--green));
  box-shadow: 0 10px 24px -12px color-mix(in srgb, var(--green) 70%, transparent);
}
.action-btn.primary:hover { box-shadow: 0 14px 30px -12px color-mix(in srgb, var(--green) 85%, transparent); }

/* — Modales / onboarding : verre, relief, tuiles d'icône — */
.overlay {
  background: color-mix(in srgb, var(--bg) 55%, rgba(0,0,0,.5));
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.modal {
  border-radius: 22px;
  box-shadow: 0 40px 100px -36px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.05);
  animation: kx-pop .3s var(--ease) both;
}
.modal h2 .ico {
  border-radius: 12px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--green) 22%, var(--card)), var(--card));
  border-color: var(--green-br);
  box-shadow: 0 8px 20px -10px color-mix(in srgb, var(--green) 60%, transparent);
}
.modal h2 .ico .ic { width: 18px; height: 18px; }
.modal-btn.primary {
  background: linear-gradient(135deg, var(--green-h), var(--green));
  box-shadow: 0 10px 26px -12px color-mix(in srgb, var(--green) 72%, transparent);
}
.history-item { transition: transform .15s var(--ease), border-color .15s, box-shadow .2s; }
.history-item:hover { transform: translateY(-2px); box-shadow: 0 12px 26px -16px rgba(0,0,0,.5); }

@keyframes kx-pop { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

/* — Keyframes premium — */
@keyframes kx-rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes kx-slideL { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }
@keyframes kx-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }

/* ==========================================================================
   CHARTE ORDONNANCE (refonte du 2026-10-11, étape 1)
   --------------------------------------------------------------------------
   Maquette validée par Killian : papier crème, émeraude, laiton. Cette section
   SURCHARGE tout ce qui précède et n'en supprime rien : retirer ce bloc rend
   l'apparence d'avant, d'un seul geste.

   Deux thèmes, mêmes noms de jetons :
   - « jour » (data-theme="light", désormais par défaut) : papier et émeraude ;
   - « soir » (data-theme="dark") : émeraude profond, laiton, papier qui reste
     papier. Le document ne change jamais de couleur : il est le miroir du PDF.

   Ce qui est retiré parce que la maquette l'a écarté : dégradés « tech », reflet
   balayant du bouton, icônes en lévitation, texte en dégradé.
   Polices : la paire du produit (Playfair Display + Outfit) est conservée, un
   test la verrouille sur toutes les surfaces ; les micro-inscriptions passent
   en chasse fixe système.
   ========================================================================== */
:root, [data-theme="light"] {
  --bg: #EFE8DA;
  --panel: #F7F2E7;
  --panel-2: #FBF8F1;
  --card: #FFFDF8;
  --card-h: #F5EFE3;
  --border: #DCD2BF;
  --border-h: #C9B48A;
  --input-br: #9A907B;       /* contour des champs : 3:1 sur le papier (WCAG 1.4.11) */
  --green: #12392F;          /* émeraude : fonds d'action, structure */
  --green-h: #1E5C4A;
  --green-d: #0C2A22;
  --green-on: #1E5C4A;       /* émeraude en texte sur papier : 6,7:1 */
  --green-ink: #F5EFE3;
  --green-bg: #EAF2EE;
  --green-br: #BFD6CB;
  --accent: #7A5C22;         /* laiton en texte : 4,9:1 sur son fond */
  --accent-bg: #F1E6CC;
  --accent-br: #C9B48A;
  --danger: #A3402A;
  --warn: #7A5C22;
  --info: #2E5E8A;
  --white: #12392F;          /* « texte le plus fort » : l'émeraude, en jour */
  --t1: #1B1A17;
  --t2: #3A3733;
  --t3: #5C574E;             /* 5,7:1 sur --bg */
  --t4: #A39C8E;
  --doc-bg: #FFFDF8;
  --doc-ink: #1A1714;
  --doc-body: #2E2B26;
  --doc-mute: #6B655A;
  --doc-line: #E6DECD;
  --shadow-float: 0 22px 48px -20px rgba(60,45,20,.28);
  --page-glow: linear-gradient(transparent, transparent);
  --mono: 'SF Mono', Consolas, ui-monospace, monospace;
}
[data-theme="dark"] {
  --bg: #0C2A22;
  --panel: #0F3129;
  --panel-2: #143A30;
  --card: #143A30;
  --card-h: #1A4A3D;
  --border: rgba(217,192,138,.20);
  --border-h: rgba(217,192,138,.42);
  --input-br: rgba(217,192,138,.50);
  --green: #D9C08A;          /* le soir, l'action est en laiton */
  --green-h: #E4D3A8;
  --green-d: #A8823E;
  --green-on: #8FD9B6;
  --green-ink: #12392F;
  --green-bg: rgba(127,209,168,.12);
  --green-br: rgba(127,209,168,.40);
  --accent: #D9C08A;
  --accent-bg: rgba(217,192,138,.12);
  --accent-br: rgba(217,192,138,.35);
  --danger: #F0A08A;
  --warn: #E8C76A;
  --info: #9CC4EA;
  --white: #F5EFE3;
  --t1: #F5EFE3;
  --t2: #CFE0D8;
  --t3: #A9BDB4;             /* 7,7:1 sur --bg */
  --t4: #4F6B62;
  --doc-bg: #F3EBDC;
  --shadow-float: 0 30px 70px rgba(0,0,0,.45);
  --page-glow: radial-gradient(1100px 600px at 30% -10%, rgba(26,74,61,.9), transparent 60%);
}

/* Corps de texte lisible : la maquette relevait 17 tailles, l'essentiel entre
   10,9 et 12,8 px. Les tailles sont en rem : relever la base les relève toutes. */
html { font-size: 106.25%; }
body { background: var(--page-glow), var(--bg); }

/* — Barre du haut : papier, double filet laiton — */
nav.topbar {
  background: var(--panel);
  -webkit-backdrop-filter: none; backdrop-filter: none;
  box-shadow: none;
  border-bottom: 3px double var(--accent-br);
}
.logo { font-style: italic; font-weight: 700; color: var(--white); letter-spacing: -.01em; }
.logo sup { color: var(--accent); }
.logo-lock { color: var(--green-on) !important; font-weight: 500; }
.nav-btn {
  background: transparent; border-color: var(--border); color: var(--t2);
  border-radius: 10px; min-height: 40px;
}
.nav-btn:hover { background: var(--card); border-color: var(--green-h); color: var(--green-on); transform: none; }
.stat-chip { background: var(--card); border-color: var(--border); color: var(--t2); }
.stat-chip .num { color: var(--green-on); }
.nav-badge { background: var(--accent-bg); color: var(--accent); border-color: var(--accent-br); }

/* — Colonne de saisie — */
.sidebar { background: var(--panel); }
.sidebar-title { font-family: var(--mono); font-size: .72rem; letter-spacing: .14em; color: var(--t3); font-weight: 500; }
.sidebar-title > span:first-child::before { display: none; }
/* Les petits liens d'action (Vider, Agrandir, + Template) vivent dans le titre de
   section mais ne sont pas des inscriptions : ils gardent la police du corps. */
.sidebar-title .mini-action { font-family: 'Outfit', sans-serif; letter-spacing: .02em; font-size: .78rem; }
/* La liste des patients n'est pas dans un .field : sans cette règle, elle
   restait un contrôle système blanc au milieu du papier. */
.patient-row select {
  width: 100%; min-height: 42px; padding: 0 36px 0 13px;
  background: var(--card); color: var(--t1);
  border: 1px solid var(--input-br); border-radius: 10px;
  font-size: .88rem; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23757068' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
}
.patient-row select:focus { outline: none; border-color: var(--green-h); box-shadow: 0 0 0 4px var(--green-bg); }
.patient-row select option { background: var(--card); color: var(--t1); }
.privacy-chip { background: var(--card); border: 1px solid var(--border); color: var(--t2); font-size: .8rem; }
.privacy-chip .ic { color: var(--green-on); }

.type-btn { background: var(--card); border: 1px solid var(--border); border-radius: 14px; color: var(--t2); animation: none; }
.type-btn:hover { transform: none; box-shadow: none; border-color: var(--green-h); background: var(--card); }
.type-btn.active {
  background: var(--card); border: 2px solid var(--green); color: var(--white);
  box-shadow: 0 8px 20px -12px rgba(18,57,47,.4);
}
.type-ico { background: var(--green-bg); border-color: var(--green-br); color: var(--green-on); box-shadow: none; }
.type-btn.active .type-ico { background: var(--green); color: var(--green-ink); border-color: var(--green); box-shadow: none; }
.type-lbl { font-size: .82rem; }

.field label { font-size: .8rem; color: var(--t2); }
.field-hint { color: var(--t3); }
.field input, .field select, .field textarea {
  background: var(--card); border: 1px solid var(--input-br); border-radius: 10px; color: var(--t1);
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--green-h); box-shadow: 0 0 0 4px var(--green-bg); }
.field select option { background: var(--card); color: var(--t1); }
.icon-btn { background: var(--card); border: 1px solid var(--input-br); }
.patho-chip { font-weight: 600; }

/* — Le bouton principal : émeraude plein, sans reflet ni dégradé — */
.gen-btn {
  background: var(--green); color: var(--green-ink);
  box-shadow: 0 12px 26px -16px rgba(18,57,47,.7);
  border-radius: 12px;
}
.gen-btn::after { display: none; }
.gen-btn:hover { background: var(--green-h); transform: none; box-shadow: 0 14px 30px -16px rgba(18,57,47,.8); }

/* — Écran d'accueil de l'appli — */
.empty-ico { background: var(--card); border-color: var(--accent-br); color: var(--green-on); box-shadow: none; animation: kx-rise .6s var(--ease) both; }
.empty h1 {
  background: none; -webkit-text-fill-color: currentColor; color: var(--white);
  font-weight: 700; letter-spacing: -.02em;
}
.step-n { background: var(--card); border-color: var(--green-br); color: var(--green-on); }

/* — Le document : une feuille, double filet laiton en tête — */
.result-header { background: var(--panel); border-bottom: 3px double var(--accent-br); }
.result-type { font-family: var(--mono); letter-spacing: .14em; color: var(--accent); }
.doc {
  border-radius: 6px; border-top: none;
  box-shadow: 0 1px 0 var(--doc-line), var(--shadow-float);
}
.doc::before {
  content: ''; position: absolute; left: 54px; right: 54px; top: 26px;
  height: 3px; border-top: 1px solid #C9B48A; border-bottom: 1px solid #C9B48A;
  pointer-events: none;
}
/* Étiquette « Exemple » : texte noir sur laiton foncé = 3,4:1, sous le seuil.
   Laiton clair et encre laiton : lisible dans les deux thèmes. */
.doc-heading-type .doc-demo-tag, .doc-demo-tag { background: #F1E6CC; color: #5E4618; border: 1px solid #C9B48A; }
.action-btn { border-radius: 10px; }
.action-btn.primary { background: var(--green); color: var(--green-ink); border-color: var(--green); box-shadow: none; }
.action-btn.primary:hover { background: var(--green-h); box-shadow: none; }

/* — Fenêtres — */
.overlay { background: rgba(27,26,23,.38); }
[data-theme="dark"] .overlay { background: rgba(0,0,0,.55); }
.modal { background: var(--panel-2); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 30px 80px -30px rgba(27,26,23,.45); }
.modal h2 .ico { background: var(--green-bg); border-color: var(--green-br); box-shadow: none; }
.modal-btn.primary { background: var(--green); color: var(--green-ink); box-shadow: none; }
.history-item:hover { transform: none; box-shadow: none; }

@media (max-width: 700px) {
  .doc::before { left: 22px; right: 22px; top: 16px; }
}

/* ==========================================================================
   RAIL DE NAVIGATION (refonte, étape 2)
   À partir de 1 100 px : un rail fixe à gauche, la barre du haut se réduit à une
   ligne (thème, temps gagné, compte). En dessous, le rail n'existe pas.
   ========================================================================== */
.rail { display: none; }
@media (min-width: 1100px) {
  body { padding-left: 232px; }
  .rail {
    display: flex; flex-direction: column; gap: 4px;
    position: fixed; top: 0; left: 0; bottom: 0; width: 232px;
    padding: 22px 14px 18px; box-sizing: border-box; overflow-y: auto;
    background: var(--panel); border-right: 1px solid var(--border);
    z-index: 60;
  }
  nav.topbar .dans-rail { display: none !important; }
  nav.topbar { justify-content: flex-end; }
}
.rail-logo {
  font-family: 'Playfair Display', serif; font-style: italic; font-weight: 700;
  font-size: 1.5rem; color: var(--white); padding: 0 12px 18px; letter-spacing: -.01em;
}
.rail-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 44px; padding: 0 12px; border: 0; border-radius: 10px;
  background: none; color: var(--t2); font: inherit; font-size: .9rem; font-weight: 500;
  text-align: left; cursor: pointer;
}
.rail-item .ic { width: 18px; height: 18px; flex: none; }
.rail-item:hover { background: var(--card); color: var(--green-on); }
.rail-item[aria-current="page"] { background: var(--green); color: var(--green-ink); }
.rail-espace { flex: 1; min-height: 20px; }

/* ==========================================================================
   SCHÉMA CORPOREL (refonte, étape 3.2)
   ========================================================================== */
.schema-block { margin: 0 0 18px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); padding: 10px 12px 12px; }
.schema-block summary { cursor: pointer; font-family: var(--mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--t3); padding: 4px 0 8px; }
.schema-opt { font-family: 'Outfit', sans-serif; text-transform: none; letter-spacing: 0; color: var(--t3); }
.sc-palette { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-bottom: 10px; }
.sc-outil { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--panel-2); color: var(--t1); font: inherit; font-size: .8rem; font-weight: 500; cursor: pointer; text-align: left; }
.sc-outil.actif { border: 2px solid var(--green-h); background: var(--card); }
.sc-echantillon { width: 18px; height: 18px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .7rem; font-weight: 700; color: #5E4618; }
.sc-figure { position: relative; width: 100%; max-width: 320px; margin: 0 auto; aspect-ratio: 470 / 560; color: var(--t2); }
.sc-dessin { position: absolute; inset: 0; width: 100%; height: 100%; }
.sc-zones { position: absolute; inset: 0; }
.sc-zone {
  position: absolute; width: 22px; height: 22px; transform: translate(-50%, -50%);
  border-radius: 50%; border: 1px dashed rgba(122,92,34,.6); background: rgba(168,130,62,.10);
  padding: 0; cursor: pointer; font-size: .78rem; font-weight: 700; color: #5E4618;
  display: flex; align-items: center; justify-content: center;
}
.sc-zone.marquee { width: 30px; height: 30px; box-shadow: 0 2px 8px rgba(60,45,20,.25); }
.sc-zone:focus-visible { outline: 2px solid var(--green-h); outline-offset: 2px; }
.sc-resume { margin: 8px 0 0; font-size: .82rem; line-height: 1.5; color: var(--t2); }

/* ==========================================================================
   ORDONNANCE (refonte, étape 3) — écran, deux colonnes
   ========================================================================== */
/* Ordre du geste (reprise du 2026-10-11) : barre d'état et impression en
   haut, identités repliées, à gauche chercher puis compléter, à droite la
   feuille qui reste en vue. Chaque manque s'affiche sur la carte du produit. */
.oa-barre {
  position: sticky; top: var(--topbar-h, 57px); z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 0 0 12px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--panel); box-shadow: 0 8px 20px -18px rgba(27,26,23,.5);
}
.oa-statut { font-size: .9rem; font-weight: 600; }
.oa-statut-ok { color: var(--green-on); }
.oa-statut-manque { font: inherit; font-weight: 600; color: var(--danger); background: none; border: 0; padding: 6px 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-align: left; }
.oa-imprimer { min-height: 44px; padding: 0 20px; }
.oa-imprimer:disabled { opacity: .45; cursor: not-allowed; }

.oa-identites { margin: 0 0 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
.oa-identites > summary {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap; list-style: none;
  padding: 10px 14px; min-height: 44px; cursor: pointer;
}
.oa-identites > summary::-webkit-details-marker { display: none; }
.oa-resume-bloc { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.oa-resume-bloc small { font-family: var(--mono); font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; color: var(--t3); }
.oa-resume-bloc strong { font-size: .92rem; color: var(--t1); overflow-wrap: anywhere; }
.oa-resume-etat { margin-left: auto; font-size: .82rem; font-weight: 600; color: var(--green-on); }
.oa-resume-etat.manque { color: var(--danger); }
.oa-identites[open] .oa-resume-etat:not(.manque) { visibility: hidden; }
.oa-identites-corps { padding: 4px 14px 12px; border-top: 1px solid var(--border); }

.oa-grille { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 960px) { .oa-grille { grid-template-columns: minmax(0, 1fr); } }
@media (min-width: 961px) {
  .oa-col-feuille { position: sticky; top: calc(var(--topbar-h, 57px) + 76px); max-height: calc(100dvh - var(--topbar-h, 57px) - 92px); overflow-y: auto; padding-bottom: 4px; }
}
.oa-bloc { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; }
.oa-h { margin: 0 0 10px; font-family: 'Playfair Display', Georgia, serif; font-size: 1.1rem; color: var(--white); }
.oa-deux { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 520px) { .oa-deux { grid-template-columns: 1fr; } }
.oa-champ { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; color: var(--t2); margin-bottom: 8px; min-width: 0; }
.oa-champ > span { font-weight: 600; }
.oa-champ input, .oa-champ select, .oa-champ textarea, .oa-recherche {
  width: 100%; box-sizing: border-box; min-height: 42px; padding: 8px 10px; font: inherit; font-size: .9rem;
  color: var(--t1); background: var(--panel-2); border: 1px solid var(--input-br, var(--border)); border-radius: 9px;
}
.oa-recherche { min-height: 50px; font-size: 1rem; padding: 0 14px; border-width: 2px; border-color: var(--accent-br); }
.oa-recherche:focus { outline: none; border-color: var(--green-h); }
.oa-ligne { display: flex; gap: 8px; }
.oa-sous-titre { margin: 12px 0 6px; font-family: var(--mono); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--t3); }
.oa-frequents { display: flex; flex-wrap: wrap; gap: 6px; }
.oa-frequent {
  min-height: 40px; padding: 0 14px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--panel-2); color: var(--t1); font: inherit; font-size: .86rem; font-weight: 500; cursor: pointer;
}
.oa-frequent:hover, .oa-frequent:focus-visible { border-color: var(--green-h); background: var(--green-bg); }
.oa-parcourir { margin-top: 12px; }
.oa-parcourir > summary { cursor: pointer; font-size: .86rem; font-weight: 600; color: var(--green-on); padding: 6px 0; }
.oa-cat { border-top: 1px solid var(--border); }
.oa-cat summary { cursor: pointer; padding: 8px 0; font-weight: 600; font-size: .86rem; color: var(--t1); }
.oa-trouves, .oa-cat-lignes { display: flex; flex-direction: column; gap: 2px; margin: 8px 0 4px; }
.oa-ajout { display: flex; gap: 10px; align-items: flex-start; width: 100%; min-height: 44px; text-align: left; font: inherit; font-size: .88rem; background: none; border: 0; border-radius: 8px; padding: 8px 10px; cursor: pointer; color: var(--t1); }
.oa-ajout:hover, .oa-ajout:focus-visible { background: var(--green-bg); }
.oa-ajout-texte { display: flex; flex-direction: column; gap: 1px; }
.oa-ajout-texte small { font-size: .74rem; color: var(--t3); }
.oa-num { flex: none; min-width: 2.2em; font-weight: 700; color: var(--green-on); }
.oa-vide { color: var(--t3); font-size: .86rem; margin: 6px 0 0; }

.oa-item { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; background: var(--panel-2); }
.oa-item header { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 10px; font-size: .92rem; }
.oa-item header strong { flex: 1; min-width: 0; }
.oa-item-corps { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.oa-item-corps .oa-large, .oa-item-corps > .oa-ci, .oa-item-corps > .oa-coche { grid-column: 1 / -1; }
@media (max-width: 520px) { .oa-item-corps { grid-template-columns: 1fr; } }
.oa-retirer { flex: none; min-height: 32px; font: inherit; font-size: .78rem; background: none; border: 1px solid var(--border); border-radius: 8px; padding: 0 10px; cursor: pointer; color: var(--t3); }
.oa-retirer:hover { color: var(--danger); border-color: var(--danger); }
.oa-ci { margin: 4px 0 10px; padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--accent-bg); border-radius: 0 8px 8px 0; font-size: .82rem; color: var(--t1); }
.oa-ci-doux { border-left-color: var(--green-h); background: var(--green-bg); }
.oa-ci-titre { margin: 0 0 4px; font-weight: 700; font-size: .8rem; }
.oa-ci ul { margin: 0 0 4px; padding-left: 18px; }
.oa-ci-plus summary { cursor: pointer; font-weight: 600; color: var(--green-on); padding: 4px 0; }
.oa-ci-plus p { margin: 4px 0; }
.oa-source { color: var(--t3); font-size: .74rem; }
.oa-coche { display: flex; gap: 10px; align-items: flex-start; font-size: .86rem; margin: 6px 0; cursor: pointer; }
.oa-coche input, .oa-attestation input { margin-top: 2px; width: 20px; height: 20px; flex: none; accent-color: var(--green-h); }
.oa-coche-forte { background: var(--green-bg); padding: 10px 12px; border-radius: 9px; }
.oa-fixe { font-size: .82rem; color: var(--green-on); font-weight: 600; margin: 0 0 8px; }
.oa-manques { margin: 4px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.oa-manques:empty { display: none; }
.oa-manques li { font-size: .82rem; color: var(--danger); padding-left: 18px; position: relative; }
.oa-manques li::before { content: '!'; position: absolute; left: 0; top: 0; width: 13px; height: 13px; border-radius: 50%; background: var(--danger); color: #fff; font-size: .62rem; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.oa-manques li.oa-avert-item { color: var(--warn); }
.oa-manques li.oa-avert-item::before { background: var(--warn); }
.oa-identites-corps .oa-manques { margin: 8px 0 10px; }

.oa-final { margin-top: 14px; }
.oa-attestation { display: flex; gap: 10px; align-items: flex-start; font-size: .86rem; font-weight: 600; color: var(--t1); cursor: pointer; padding: 10px 12px; border-radius: 9px; background: var(--green-bg); }
.oa-attestation.manque { outline: 2px solid var(--danger); }
.oa-controle { font-size: .84rem; }
.oa-erreurs, .oa-avert { margin: 10px 0 0; padding-left: 18px; }
.oa-erreurs { color: var(--danger); }
.oa-avert { color: var(--warn); }
.oa-pec { margin: 10px 0 0; font-size: .8rem; background: var(--accent-bg); padding: 7px 10px; border-radius: 8px; color: var(--t1); }
.oa-feuille-vide { margin: 8px 0; font-family: 'Outfit', sans-serif; font-size: .8rem; color: #6B655A; font-style: italic; }
/* LA FEUILLE, sur le modèle d'une ordonnance de kiné de ville (fourni le
   2026-10-11) : praticien à gauche, logo au centre, cabinet à droite ;
   « Ville, le date » à droite ; un blanc ; le patient ; les prescriptions en
   tirets ; la signature à droite. Même rendu à l'écran et à l'impression. */
.oa-feuille {
  background: #FFFDF8; color: #1A1714; border: 1px solid #E6DECD; border-radius: 6px;
  padding: 34px 36px 30px; font-family: 'Outfit', sans-serif; font-size: .86rem; line-height: 1.5;
  box-shadow: var(--shadow-float); display: flex; flex-direction: column; min-height: 520px;
}
.of-entete { display: grid; grid-template-columns: minmax(0, 1.15fr) auto minmax(0, 1fr); gap: 14px; align-items: start; }
.of-prat { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.of-prat-nom { font-weight: 700; font-size: 1.06rem; color: #12392F; margin-bottom: 4px; }
.of-logo { width: 96px; display: flex; justify-content: center; }
.of-logo img { max-width: 96px; max-height: 96px; object-fit: contain; }
.of-logo:empty { width: 0; }
.of-cabinet { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.of-cabinet-nom { font-weight: 700; font-size: 1rem; margin-bottom: 6px; }
.of-date { margin: 26px 0 0; text-align: right; padding-right: 8%; }
.of-patient { margin: 56px 0 6px; font-size: .92rem; }
.of-patient strong { font-weight: 600; }
.oa-items { list-style: none; padding: 0 0 0 4px; margin: 4px 0 0; flex: 1; }
.oa-items li { position: relative; padding-left: 26px; margin-bottom: 12px; }
.oa-items li::before { content: '-'; position: absolute; left: 6px; top: 0; font-weight: 600; }
.oa-items li > *, .oa-ligne-feuille > * { display: block; }
.oa-items li strong { font-family: 'Outfit', sans-serif; font-weight: 500; font-size: .96rem; color: #1A1714; }
/* La police à empattements n'est chargée qu'en 600-800 : posologie et durée
   sortaient aussi grasses que le produit. Le produit reste en titre, les
   consignes passent dans la police de texte, en graisse normale. */
.oa-items li span { font-family: 'Outfit', sans-serif; font-weight: 400; font-size: .94em; line-height: 1.45; color: #2A2620; }
@media (max-width: 520px) {
  .oa-barre { padding: 8px 10px; gap: 6px; }
  .oa-imprimer { width: 100%; }
}
.of-signature { margin: 40px 6% 0 auto; width: 42%; display: flex; flex-direction: column; gap: 4px; }
.of-signature-legende { font-size: .78rem; font-weight: 600; color: #2A2620; padding-left: 10px; }
.of-signature-zone { height: 80px; border: 1px dashed #D8CFBC; border-radius: 6px; }
.oa-ligne-feuille { position: relative; cursor: text; border-radius: 4px; padding: 2px 4px; margin: -2px -4px; }
.oa-ligne-feuille:hover, .oa-ligne-feuille:focus-visible { background: #F4EDDD; outline: 1px dashed #C9B48A; }
.oa-items textarea { width: 100%; min-height: 4.5em; font: inherit; color: inherit; background: #FFFFFF; border: 1px solid #A8823E; border-radius: 4px; padding: 6px 8px; resize: vertical; }
.oa-retouche { display: flex; gap: 8px; align-items: center; margin-top: 4px; font-family: 'Outfit', sans-serif; font-size: .74rem; color: #7A5C22; }
.oa-retouche button, .oa-astuce button, .oa-lien { font: inherit; color: #12392F; background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }
.oa-astuce { margin: 0 0 8px; font-family: 'Outfit', sans-serif; font-size: .74rem; color: #6B655A; }
.oa-note-retouche { margin: 0; font-size: .8rem; color: #7A5C22; }
/* IMPRESSION : une copie de la feuille, seule dans la page.
   L'ancienne méthode masquait tout le reste (visibility) et fixait la feuille :
   le reste gardait sa hauteur, d'où une seconde page, et une feuille fixe se
   répète sur chaque page imprimée. `@page { margin: 0 }` retire aussi l'en-tête
   et le pied du navigateur (date, titre, adresse de la page). */
#ks-impression { display: none; }
@media print {
  @page { size: A4; margin: 0; }
  html, body { height: auto !important; overflow: visible !important; }
  body.imprime-ordo { padding: 0 !important; margin: 0 !important; background: #fff !important; }
  body.imprime-ordo > *:not(#ks-impression) { display: none !important; }
  body.imprime-ordo #ks-impression { display: block; }
  #ks-impression .oa-feuille {
    border: 0; border-radius: 0; box-shadow: none; background: #fff;
    padding: 18mm 18mm 16mm; font-size: 10.5pt; min-height: 0;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  #ks-impression .oa-ligne-feuille { background: none; outline: 0; padding: 0; margin: 0; }
  #ks-impression .of-logo img { max-width: 28mm; max-height: 28mm; }
  #ks-impression .of-signature-zone { border: 0; }
}
.rail-sceau {
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px; padding: 14px 12px 4px; border-top: 1px solid var(--border);
  font-size: .78rem; line-height: 1.35; color: var(--green-on); font-weight: 500;
}

/* ==========================================================================
   ÉCRANS (refonte, étapes 3.3 à 3.5)
   `body[data-ecran]` désigne l'écran visible ; « seance » est l'application
   d'origine. Les autres écrans prennent sa place, la barre et le rail restent.
   ========================================================================== */
.ecran[hidden] { display: none !important; }
body[data-ecran]:not([data-ecran="seance"]) .app { display: none; }
.ecran {
  max-width: 1080px; margin: 0 auto; padding: 28px 32px 64px; box-sizing: border-box;
  min-height: calc(100dvh - var(--topbar-h, 57px));
}
.ecran-large { max-width: 1240px; }
.ecran-tete { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; padding-bottom: 14px; margin-bottom: 18px; border-bottom: 3px double var(--accent-br); }
.ecran-sur { margin: 0 0 4px; font-family: var(--mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.ecran-titre { margin: 0; font-family: 'Playfair Display', Georgia, serif; font-size: 2rem; font-weight: 700; letter-spacing: -.02em; color: var(--white); line-height: 1.1; }
.ecran-titre:focus { outline: none; }
.ecran-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ecran-actions .modal-btn, .ec-fiche-actions .modal-btn { flex: none; }
.ecran-intro { margin: 0 0 18px; font-size: .9rem; color: var(--t2); max-width: 70ch; }
.ecran-retour { display: none; margin: 0 0 10px; padding: 6px 0; border: 0; background: none; color: var(--green-on); font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; }
@media (max-width: 1099px) { .ecran-retour { display: inline-block; } }
@media (max-width: 960px) { .ecran { padding: 20px 16px 96px; } .ecran-titre { font-size: 1.6rem; } }
.mob-tab.active-ecran { color: var(--green-on); }
@media (max-width: 960px) { nav.topbar .hors-mobile { display: none !important; } }

.ec-bloc { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; margin-bottom: 16px; }
.ec-bloc-titre { margin: 0 0 4px; font-family: 'Playfair Display', Georgia, serif; font-size: 1.15rem; color: var(--white); }
.ec-bloc-sous { margin: 0 0 12px; font-size: .82rem; color: var(--t3); }
.ec-bloc-sous a, .ec-puces a { color: var(--green-on); }
.ec-vide { margin: 0 0 12px; font-size: .88rem; color: var(--t2); }
.ec-puces { margin: 0 0 12px; padding-left: 18px; font-size: .88rem; color: var(--t2); line-height: 1.6; }
.ec-champs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
@media (max-width: 700px) { .ec-champs { grid-template-columns: minmax(0, 1fr); } }
.ec-deux { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 860px) { .ec-deux { grid-template-columns: minmax(0, 1fr); } }
.stats-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 0; }
@media (max-width: 860px) { .stats-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ec-mois { display: flex; align-items: flex-end; gap: 10px; height: 140px; padding-top: 8px; }
.ec-mois-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; font-size: .72rem; color: var(--t3); }
.ec-mois-barre { width: 100%; max-width: 38px; background: var(--green); border-radius: 6px 6px 2px 2px; min-height: 2px; }
.ec-mois-val { font-weight: 700; color: var(--t1); }

.ec-barre { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.ec-barre .ec-bloc-sous { margin: 0; }
.ec-recherche, .ec-barre select {
  min-height: 44px; padding: 0 14px; border: 1px solid var(--input-br, var(--border)); border-radius: 10px;
  background: var(--panel-2); color: var(--t1); font: inherit; font-size: .92rem;
}
.ec-recherche { flex: 1 1 260px; max-width: 420px; }
.ec-grille-docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.ec-grille-docs .history-item { margin-bottom: 0; }
.ec-grille-docs .history-del { opacity: 1; min-width: 40px; min-height: 40px; top: 4px; right: 4px; display: flex; align-items: center; justify-content: center; }
.ec-grille-docs .history-item { padding-right: 46px; }
.ec-vider { margin-top: 18px; }

.ec-chiffres { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
@media (max-width: 700px) { .ec-chiffres { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ec-chiffre { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.ec-chiffre strong { font-family: 'Playfair Display', Georgia, serif; font-size: 1.8rem; line-height: 1; color: var(--green-on); }
.ec-chiffre span { font-size: .78rem; color: var(--t2); }
.ec-liste { display: flex; flex-direction: column; gap: 8px; }
.ec-dossier {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 60px; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--panel-2); color: var(--t1);
  font: inherit; text-align: left; cursor: pointer;
}
.ec-dossier:hover { border-color: var(--green-h); }
.ec-dossier:focus-visible, .ec-doc:focus-visible { outline: 2px solid var(--green-h); outline-offset: 2px; }
.ec-initiales { flex: none; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--green); color: var(--green-ink); font-weight: 700; font-size: .85rem; letter-spacing: .04em; }
.ec-initiales-grandes { width: 56px; height: 56px; font-size: 1.1rem; }
.ec-dossier-corps { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ec-dossier-corps strong { font-size: .95rem; }
.ec-dossier-infos { font-size: .8rem; color: var(--t2); margin: 0; overflow: hidden; text-overflow: ellipsis; }
.ec-dossier-fin { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.ec-seance { font-family: var(--mono); font-size: .72rem; letter-spacing: .06em; padding: 3px 8px; border-radius: 999px; background: var(--accent-bg); color: var(--t1); border: 1px solid var(--accent-br); }
.ec-depuis { font-size: .74rem; color: var(--t3); }
@media (max-width: 520px) { .ec-dossier-fin .ec-depuis { display: none; } }

.ec-retour-liste { margin: 0 0 12px; padding: 6px 0; border: 0; background: none; color: var(--green-on); font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; }
.ec-fiche-tete { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.ec-fiche-tete > div:nth-child(2) { flex: 1; min-width: 200px; }
.ec-fiche-nom { margin: 0 0 2px; font-family: 'Playfair Display', Georgia, serif; font-size: 1.5rem; color: var(--white); }
.ec-fiche-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ec-douleur.recule { border-color: var(--green-br); }
.ec-douleur-chiffres { margin: 4px 0 2px; font-family: 'Playfair Display', Georgia, serif; font-size: 2.2rem; color: var(--green-on); }
.ec-douleur-chiffres span { font-size: 1.2rem; color: var(--t3); }
.ec-courbe { display: block; width: 100%; height: auto; max-width: 260px; overflow: visible; }
.ec-courbe-grande { max-width: 680px; margin-top: 6px; }
.ec-grille { stroke: var(--border); stroke-width: 1; }
.ec-aire { fill: var(--green-bg); }
.ec-trait { fill: none; stroke: var(--green-h); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.ec-point { fill: var(--panel-2); stroke: var(--green-h); stroke-width: 2; }
.ec-valeur { font-size: 13px; font-weight: 700; fill: var(--t1); font-family: 'Outfit', sans-serif; }
.ec-date { font-size: 11px; fill: var(--t3); font-family: 'Outfit', sans-serif; }
.ec-mesures { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.ec-mesure { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--panel-2); display: flex; flex-direction: column; gap: 6px; }
.ec-mesure strong { font-size: .88rem; }
.ec-releves { font-size: .8rem; color: var(--t2); }
.ec-docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.ec-doc { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); color: var(--t2); font: inherit; font-size: .8rem; text-align: left; cursor: pointer; }
.ec-doc:hover { border-color: var(--green-h); }
.ec-doc-trace { cursor: default; }
.ec-ligne { display: flex; align-items: center; gap: 8px; }
.ec-ligne .ec-dossier { flex: 1; min-width: 0; }
.ec-ajout-jour, .ec-seance-jour, .ec-retirer-jour {
  flex: none; min-height: 44px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--panel-2); color: var(--green-on); font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer;
}
.ec-retirer-jour { min-width: 44px; padding: 0; color: var(--t3); font-size: 1.1rem; }
.ec-ajout-jour:hover, .ec-seance-jour:hover { border-color: var(--green-h); }
.ec-dans-jour { flex: none; font-size: .78rem; color: var(--t3); padding: 0 6px; }
.ec-jour { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ec-jour-item { display: flex; align-items: center; gap: 8px; }
.ec-jour-item .ec-dossier { flex: 1; min-width: 0; }
.ec-jour-item.vu .ec-dossier { opacity: .62; }
.ec-coche { flex: none; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; cursor: pointer; }
.ec-coche input { width: 22px; height: 22px; accent-color: var(--green); cursor: pointer; }
.ec-propositions { display: flex; flex-direction: column; gap: 6px; margin: -6px 0 12px; }
.ec-proposition { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 12px; border: 1px dashed var(--accent-br); border-radius: 10px; background: var(--panel-2); color: var(--t1); font: inherit; font-size: .85rem; text-align: left; cursor: pointer; }
.ec-proposition span { font-size: .76rem; color: var(--t2); }
.ec-option { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: .9rem; color: var(--t1); cursor: pointer; }
.ec-option input { width: 20px; height: 20px; accent-color: var(--green); }
@media (max-width: 520px) {
  .ec-seance-jour { display: none; }
  .ec-ligne { flex-wrap: wrap; }
  .ec-ligne .ec-ajout-jour { width: 100%; }
}
.ec-doc-trace:hover { border-color: var(--border); }
.ec-doc-archive { font-size: .72rem; color: var(--t3); font-style: italic; }
.ec-doc-type { font-size: .66rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--green-on); }

/* Très petits téléphones (audit 2026-10-11) : huit boutons de 36 px demandent
   320 px sur une seule ligne, il en reste 296 une fois la marge retirée. Le
   bouton de compte débordait de 6 px et faisait défiler toute la page de côté.
   Sous 380 px, la rangée a le droit de passer à la ligne. */
@media (max-width: 380px) {
  nav.topbar .nav-right { flex-wrap: wrap; justify-content: flex-end; row-gap: 6px; min-width: 0; max-width: 100%; }
}

/* Défilement vers un élément (Tab, saut au premier manque, ajout d'un produit) :
   le navigateur ignore les barres collantes et posait l'élément dessous. On lui
   réserve leur hauteur : la barre du haut partout, plus la barre d'état sur
   l'ordonnance, plus les onglets fixes du téléphone en bas (2026-10-11). */
html { scroll-padding-top: calc(var(--topbar-h, 57px) + 12px); }
html[data-ecran="ordonnances"] { scroll-padding-top: calc(var(--topbar-h, 57px) + 92px); }
@media (max-width: 960px) {
  html { scroll-padding-bottom: 76px; }
  html[data-ecran="ordonnances"] { scroll-padding-top: calc(var(--topbar-h, 57px) + 120px); }
}

/* Logo d'en-tête dans les Réglages (2026-10-11) : aperçu borné, contrôles qui
   passent à la ligne sur téléphone. */
.ec-logo-ligne { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-width: 0; }
.ec-logo-ligne img { width: 64px; height: 64px; object-fit: contain; border-radius: 8px; background: #fff; border: 1px solid var(--border, #E6DECD); }
.ec-logo-ligne input[type="file"] { max-width: 100%; min-width: 0; font-size: .82rem; }

/* ==========================================================================
   DÉMARRAGE ET MUR DE CONNEXION (2026-10-25)
   L'écran de démarrage couvre tout (1000) le temps que les sessions se
   rétablissent. Le mur (950) passe au-dessus de l'application et des onglets
   mobiles (900) ; sous le mur, les fenêtres (200) remontent à 960 pour que la
   connexion reste possible. Les messages courts (998) restent visibles.
   ========================================================================== */
.ecran-demarrage {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: var(--bg);
  transition: opacity 0.35s var(--ease);
}
.ecran-demarrage.fini { opacity: 0; pointer-events: none; }
.ecran-demarrage .logo { font-size: 1.9rem; }
.ed-barre { width: 160px; height: 3px; border-radius: 3px; overflow: hidden; background: var(--border); }
.ed-barre span { display: block; width: 40%; height: 100%; border-radius: 3px; background: var(--green); animation: ed-glisse 1.1s var(--ease) infinite; }
@keyframes ed-glisse { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.ed-texte { color: var(--t2); font-size: 0.85rem; }

.mur-connexion {
  position: fixed; inset: 0; z-index: 950;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; overflow-y: auto; background: var(--bg);
}
.mur-connexion[hidden] { display: none; }
.mur-carte {
  width: 100%; max-width: 440px; padding: 32px 28px; text-align: center;
  background: var(--panel); border: 1px solid var(--border); border-radius: 18px;
}
.mur-carte .logo { font-size: 1.6rem; margin-bottom: 18px; }
.mur-carte h1 { font-size: 1.25rem; font-weight: 700; color: var(--white); margin-bottom: 10px; }
.mur-carte p { font-size: 0.9rem; line-height: 1.55; color: var(--t2); }
.mur-actions { display: flex; flex-direction: column; gap: 10px; margin: 22px 0 18px; }
.mur-actions .modal-btn { width: 100%; justify-content: center; }
.mur-carte .mur-pied { font-size: 0.8rem; }
.mur-pied a { color: var(--green-on); }
body.sous-le-mur .overlay { z-index: 960; }

/* Écran de chargement des opérations longues (exports) : au-dessus du mur et des
   fenêtres (970), sous les messages courts (998), qui disent une éventuelle erreur. */
.chargement {
  position: fixed; inset: 0; z-index: 970;
  display: flex; align-items: center; justify-content: center;
  background: rgba(15,17,23,0.55); backdrop-filter: blur(2px);
}
.chargement[hidden] { display: none; }
.ch-carte {
  display: flex; align-items: center; gap: 14px; padding: 18px 22px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  color: var(--t1); font-size: 0.9rem; font-weight: 600;
}
.ch-roue {
  width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--green);
  animation: ch-tourne 0.8s linear infinite;
}
@keyframes ch-tourne { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ch-roue { animation: none; border-top-color: var(--border); border-right-color: var(--green); } }

/* Centre de notifications : la cloche et son panneau, ancré sous le bouton. */
.notif { position: relative; }
.notif #notif-btn { position: relative; padding: 8px 10px; }
.notif-point {
  position: absolute; top: 5px; right: 6px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--accent); border: 2px solid var(--card);
}
.notif-point[hidden] { display: none; }
.notif-panneau {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 401;
  width: min(360px, calc(100vw - 32px)); max-height: min(70vh, 520px); overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.28);
}
.notif-panneau[hidden] { display: none; }
.notif-tete {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px; border-bottom: 1px solid var(--border);
}
.notif-tete h2 { font-size: 0.95rem; font-weight: 700; color: var(--white); }
.notif-tete h2:focus { outline: none; }
.notif-fermer {
  background: none; border: 0; padding: 6px; border-radius: 6px; cursor: pointer;
  color: var(--t2); display: flex; min-width: 32px; min-height: 32px; align-items: center; justify-content: center;
}
.notif-liste { list-style: none; margin: 0; padding: 6px 0; }
.notif-item { padding: 12px 16px; border-bottom: 1px solid var(--border); display: grid; gap: 4px; }
.notif-item:last-child { border-bottom: 0; }
.notif-item time { font-size: 0.72rem; color: var(--t2); }
.notif-item strong { font-size: 0.88rem; color: var(--white); }
.notif-item p { font-size: 0.82rem; line-height: 1.5; color: var(--t2); }
.notif-item a { font-size: 0.8rem; font-weight: 600; color: var(--green-on); }
.notif-item.nouvelle { box-shadow: inset 3px 0 0 var(--accent); }
.notif-vide { padding: 18px 16px; font-size: 0.85rem; color: var(--t2); }
@media (max-width: 600px) {
  .notif-panneau { position: fixed; top: 64px; right: 16px; left: 16px; width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .ecran-demarrage { transition: none; }
  .ed-barre span { animation: none; width: 100%; opacity: 0.5; }
}
