/* ==========================================================================
   Research Share — HUG CASU 144 Urgences
   Design system : tokens clairs/sombres, lecture confortable, impression.
   ========================================================================== */

/* ── 1. Tokens ─────────────────────────────────────────────────────────── */
:root {
  color-scheme: light;

  /* Identité HUG */
  --hug-red: #c8102e;
  --hug-red-dark: #9a0c23;
  --hug-red-soft: #fdeef1;
  --hug-navy: #0f2744;
  --hug-blue: #1a4a7a;

  /* Surfaces */
  --bg: #eef3f8;
  --bg-grad-1: rgba(200, 16, 46, 0.07);
  --bg-grad-2: rgba(26, 74, 122, 0.10);
  --surface: #ffffff;
  --surface-2: #f6f9fc;
  --surface-3: #eef4f9;
  --surface-inset: #f3f7fb;
  --line: #dbe4ed;
  --line-strong: #c3d2e0;

  /* Texte */
  --text: #16212e;
  --text-strong: #0d1826;
  --muted: #5b6b7c;
  --faint: #7d91a4;
  --link: #175a92;

  /* États */
  --ok: #157347;
  --ok-bg: #e7f6ee;
  --warn: #8a5a00;
  --warn-bg: #fff6e2;
  --err: #a11919;
  --err-bg: #fdecec;
  --info-bg: #e8f1fa;

  /* Mise en forme */
  --shadow-sm: 0 1px 2px rgba(15, 39, 68, 0.06), 0 1px 3px rgba(15, 39, 68, 0.05);
  --shadow: 0 2px 4px rgba(15, 39, 68, 0.04), 0 10px 24px rgba(15, 39, 68, 0.07);
  --shadow-lg: 0 24px 60px rgba(15, 39, 68, 0.22);
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --sidebar-w: 268px;
  --measure: 72ch;

  --font: "Source Sans 3", "Segoe UI", system-ui, -apple-system, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --row-pad-y: 0.8rem;
  --row-pad-x: 1rem;
  --prose-size: 1rem;
  --prose-leading: 1.75;

  /* Densite : ces jetons pilotent TOUT le contenu (entetes, listes,
     tableaux, cartes, espacements). Un seul reglage, trois paliers. */
  --ui-scale: 1;          /* facteur typographique applique a la racine */
  --pad-head-y: 0.8rem;   /* entetes de panneau et barres d'outils */
  --pad-x: 1.1rem;        /* padding horizontal des surfaces */
  --pad-body-y: 1.05rem;  /* corps de panneau */
  --gap-block: 1.1rem;    /* entre blocs : panneaux, statistiques */
  --gap-item: 0.6rem;     /* entre elements d'une liste */
  --pad-item-y: 0.8rem;   /* element de liste / carte */
  --pad-item-x: 0.95rem;
  --hero-pad-y: 1.3rem;
  --hero-pad-x: 1.5rem;
  --excerpt-lines: 2;     /* lignes d'extrait visibles dans les listes */
}

/* Thème sombre : automatique (sauf si le clair est forcé)… */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --hug-red: #e8405c;
    --hug-red-dark: #c8102e;
    --hug-red-soft: #3a1620;
    --hug-navy: #0b1724;
    --hug-blue: #6fb3e8;

    --bg: #0a111b;
    --bg-grad-1: rgba(200, 16, 46, 0.12);
    --bg-grad-2: rgba(26, 74, 122, 0.22);
    --surface: #111c29;
    --surface-2: #16222f;
    --surface-3: #1c2a38;
    --surface-inset: #16222f;
    --line: #27363f;
    --line-strong: #394d60;

    --text: #e4ecf4;
    --text-strong: #f4f8fc;
    --muted: #a3b5c6;
    --faint: #8699ab;
    --link: #7cc0f5;

    --ok: #5fd39a;
    --ok-bg: #13302a;
    --warn: #e9b765;
    --warn-bg: #30281a;
    --err: #ff9b9b;
    --err-bg: #341c1f;
    --info-bg: #15283a;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.3), 0 12px 28px rgba(0, 0, 0, 0.38);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.6);
  }
}

/* … et thème sombre forcé. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --hug-red: #e8405c;
  --hug-red-dark: #c8102e;
  --hug-red-soft: #3a1620;
  --hug-navy: #0b1724;
  --hug-blue: #6fb3e8;

  --bg: #0a111b;
  --bg-grad-1: rgba(200, 16, 46, 0.12);
  --bg-grad-2: rgba(26, 74, 122, 0.22);
  --surface: #111c29;
  --surface-2: #16222f;
  --surface-3: #1c2a38;
  --surface-inset: #16222f;
  --line: #27363f;
  --line-strong: #394d60;

  --text: #e4ecf4;
  --text-strong: #f4f8fc;
  --muted: #a3b5c6;
  --faint: #8699ab;
  --link: #7cc0f5;

  --ok: #5fd39a;
  --ok-bg: #13302a;
  --warn: #e9b765;
  --warn-bg: #30281a;
  --err: #ff9b9b;
  --err-bg: #341c1f;
  --info-bg: #15283a;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.3), 0 12px 28px rgba(0, 0, 0, 0.38);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.6);
}

/* Densité de lecture (bascule utilisateur) */
:root[data-density="compact"] {
  --ui-scale: 0.94;
  --row-pad-y: 0.42rem;
  --row-pad-x: 0.7rem;
  --prose-size: 0.95rem;
  --prose-leading: 1.55;
  --pad-head-y: 0.5rem;
  --pad-x: 0.8rem;
  --pad-body-y: 0.65rem;
  --gap-block: 0.6rem;
  --gap-item: 0.32rem;
  --pad-item-y: 0.5rem;
  --pad-item-x: 0.7rem;
  --hero-pad-y: 0.85rem;
  --hero-pad-x: 1.05rem;
  --excerpt-lines: 1;
}
:root[data-density="large"] {
  --ui-scale: 1.06;
  --row-pad-y: 1.05rem;
  --row-pad-x: 1.15rem;
  --prose-size: 1.09rem;
  --prose-leading: 1.85;
  --pad-head-y: 1.05rem;
  --pad-x: 1.4rem;
  --pad-body-y: 1.4rem;
  --gap-block: 1.5rem;
  --gap-item: 0.85rem;
  --pad-item-y: 1.1rem;
  --pad-item-x: 1.25rem;
  --hero-pad-y: 1.7rem;
  --hero-pad-x: 1.9rem;
  --excerpt-lines: 5;
}
/* Le facteur typographique s'applique a la racine : tout ce qui est exprime
   en rem (texte, paddings, gouttieres) suit le reglage choisi. */
html { font-size: calc(100% * var(--ui-scale)); }

/* ── 2. Base ───────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(1200px 520px at 35% -12%, var(--bg-grad-1), transparent 60%),
    radial-gradient(900px 440px at 100% 0%, var(--bg-grad-2), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); }
:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--hug-red) 55%, transparent);
  outline-offset: 2px;
  border-radius: 4px;
}
code, kbd, samp { font-family: var(--mono); font-size: 0.9em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.25rem 0; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--hug-red);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 0 0 10px 0;
  font-weight: 700;
}
.skip-link:focus { left: 0; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ── 3. Marque ─────────────────────────────────────────────────────────── */
.brand-mark {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: 12px;
  background: linear-gradient(145deg, #e01a37, #9a0c23);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 16px rgba(200, 16, 46, 0.35);
}
.brand-144 { font-weight: 800; font-size: 1.22rem; letter-spacing: -0.04em; line-height: 1; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong {
  font-family: var(--serif);
  font-size: 1rem;
  color: #fff;
  line-height: 1.2;
}
.brand-text span { font-size: 0.78rem; color: rgba(255, 255, 255, 0.74); }

/* ── 4. Sidebar ────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: var(--sidebar-w);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(175deg, #0b1b2e 0%, #11304d 55%, #0d2340 100%);
  color: #fff;
  box-shadow: 6px 0 28px rgba(8, 20, 34, 0.26);
  overflow: hidden;
}
.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(500px 280px at 0% 0%, rgba(200, 16, 46, 0.26), transparent 62%),
    radial-gradient(400px 240px at 100% 100%, rgba(88, 160, 220, 0.14), transparent 58%);
  pointer-events: none;
}
.sidebar-brand,
.sidebar-urgence,
.sidebar-nav,
.sidebar-footer { position: relative; z-index: 1; }

.sidebar-brand { display: flex; align-items: center; gap: 0.85rem; padding: 1.2rem 1.15rem 0.9rem; }

.sidebar-urgence {
  margin: 0 1.15rem 0.9rem;
  align-self: flex-start;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  background: #c8102e;
  color: #fff;
  padding: 0.33rem 0.7rem;
  border-radius: 6px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.2rem 0.8rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  scrollbar-width: thin;
}
.sidebar-label {
  margin: 1rem 0.55rem 0.35rem;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.48);
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.88);
  font-weight: 600;
  font-size: 0.93rem;
  padding: 0.62rem 0.8rem;
  border-radius: 11px;
  transition: background 0.15s ease, color 0.15s ease;
}
.sidebar-nav a:hover { background: rgba(255, 255, 255, 0.09); color: #fff; }
.sidebar-nav a.active {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  box-shadow: inset 3px 0 0 #e8405c;
}
.sidebar-nav a.nav-admin { color: #ffc9d2; }
.sidebar-nav a.nav-admin:hover { background: rgba(200, 16, 46, 0.24); color: #fff; }
.sidebar-nav a.nav-admin.active {
  background: linear-gradient(135deg, #d31232, #9a0c23);
  color: #fff;
  box-shadow: 0 6px 16px rgba(200, 16, 46, 0.34);
}
.nav-ico { width: 1.25rem; text-align: center; opacity: 0.85; font-size: 0.95rem; }

.sidebar-footer {
  padding: 0.85rem 1.05rem 1.15rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.18);
  display: grid;
  gap: 0.6rem;
}
.sidebar-user { display: flex; align-items: center; gap: 0.7rem; }
a.sidebar-user-link {
  text-decoration: none;
  color: inherit;
  border-radius: 11px;
  padding: 0.35rem;
  margin: -0.35rem;
}
a.sidebar-user-link:hover { background: rgba(255, 255, 255, 0.09); }
.sidebar-avatar {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(145deg, #2f74b4, #1a4a7a);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.98rem;
  flex-shrink: 0;
}
.sidebar-user-meta { display: flex; flex-direction: column; gap: 0.22rem; min-width: 0; }
.sidebar-user-meta strong {
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-meta .role-pill { margin-left: 0; width: fit-content; }
.btn-logout {
  width: 100%;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.07);
}
.btn-logout:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }

/* ── 5. Shell ──────────────────────────────────────────────────────────── */
.shell {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  padding: 0 1.6rem 2rem;
  max-width: calc(1240px + var(--sidebar-w));
  min-width: 0;
  overflow-x: clip;
}

.shell-top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin: 0 -1.6rem;
  padding: 0.6rem 1.6rem;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.shell-top-title { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.shell-kicker {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.shell-top-title strong {
  font-family: var(--serif);
  font-size: 1.12rem;
  color: var(--text-strong);
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shell-top-tools { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.shell-top-meta {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--hug-red);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.sidebar-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: 11px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
}
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 20, 34, 0.55);
  z-index: 35;
}

.main { margin-top: 1.1rem; min-width: 0; max-width: 100%; }
.footer {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.84rem;
}

@media (max-width: 960px) {
  .sidebar { transform: translateX(-105%); transition: transform 0.22s ease; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .shell { margin-left: 0; max-width: none; padding: 0 1rem 2rem; }
  .shell-top { margin: 0 -1rem; padding: 0.55rem 1rem; }
  .sidebar-toggle { display: inline-grid; place-items: center; }
  .shell-top-meta { display: none; }
}

/* ── 6. Authentification : décor « urgences » + modale ────────────────── */
body.auth-body {
  display: grid;
  place-items: center;
  padding: 1.5rem 1.15rem;
  min-height: 100vh;
  background: #071321;
  color: #eaf2f9;
}

/* Décor plein écran, net et coloré (aucun flou global) */
.auth-stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(760px 480px at 84% 6%, rgba(216, 22, 54, 0.58), transparent 60%),
    radial-gradient(700px 480px at 6% 94%, rgba(32, 104, 170, 0.62), transparent 58%),
    radial-gradient(520px 380px at 50% 50%, rgba(44, 120, 185, 0.22), transparent 70%),
    linear-gradient(155deg, #081a2c 0%, #0f3152 38%, #164a78 62%, #0a2238 100%);
}

/* Trame : croix médicales, nœuds et grille de moniteur */
.auth-stage::before {
  content: "";
  position: absolute;
  inset: -10%;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='0.1' stroke-width='1.5'%3E%3Cpath d='M30 22v16M22 30h16M90 82v16M82 90h16'/%3E%3Ccircle cx='60' cy='60' r='3.4'/%3E%3Cpath d='M60 60L30 30M60 60l30 30'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 120px 120px, 46px 46px, 46px 46px;
}

/* Vignette légère : on garde le décor lisible */
.auth-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(1200px 820px at 50% 46%, transparent 0%, rgba(4, 14, 24, 0.3) 62%, rgba(3, 10, 18, 0.72) 100%);
}

/* Grandes croix décoratives */
.auth-cross {
  position: absolute;
  fill: none;
  stroke: rgba(255, 255, 255, 0.075);
  stroke-width: 5;
  stroke-linejoin: round;
}
.auth-cross-a { left: -4vw; top: -7vh; width: min(44vw, 480px); }
.auth-cross-b { right: -6vw; bottom: -9vh; width: min(34vw, 380px); transform: rotate(18deg); stroke: rgba(255, 140, 160, 0.09); }

/* Tracé ECG */
.auth-ecg {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 13vh;
  width: 100%;
  height: clamp(130px, 25vh, 250px);
  opacity: 0.8;
}
.auth-ecg-base {
  fill: none;
  stroke: rgba(150, 205, 248, 0.38);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.auth-ecg-pulse {
  fill: none;
  stroke: #ff536b;
  stroke-width: 2.8;
  stroke-linejoin: round;
  stroke-linecap: round;
  filter: drop-shadow(0 0 8px rgba(255, 83, 107, 0.9));
  stroke-dasharray: 140 860;
  animation: ecg-sweep 7s linear infinite;
}
@keyframes ecg-sweep {
  from { stroke-dashoffset: 1000; }
  to { stroke-dashoffset: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-ecg-pulse { animation: none; stroke-dasharray: none; opacity: 0.8; }
}

/* Voile de modale discret, sans flou : le décor reste net */
.auth-scrim {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: rgba(5, 14, 24, 0.26);
}

/* Colonne de contenu, au-dessus du décor */
.auth-body .auth-page {
  position: relative;
  z-index: 2;
  max-width: 448px;
  width: 100%;
  margin: 0 auto;
  display: grid;
  gap: 0.95rem;
}

/* Bandeau de marque, transparent sur le décor */
.auth-brand-bar,
.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0;
  margin: 0;
  background: none;
  box-shadow: none;
  border-radius: 0;
}
.auth-brand-bar .brand-text strong,
.auth-brand .brand-text strong { color: #fff; }
.auth-brand-bar .brand-text span,
.auth-brand .brand-text span { color: rgba(255, 255, 255, 0.76); }

.auth-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ffd9e0;
  background: rgba(216, 22, 54, 0.34);
  border: 1px solid rgba(255, 130, 150, 0.46);
  border-radius: 999px;
  padding: 0.28rem 0.62rem;
}
.auth-status .dot {
  margin: 0;
  background: #ff5370;
  animation: status-beat 2.4s ease-out infinite;
}
@keyframes status-beat {
  0% { box-shadow: 0 0 0 0 rgba(255, 83, 112, 0.65); }
  70%, 100% { box-shadow: 0 0 0 8px rgba(255, 83, 112, 0); }
}

/* Halo sombre localisé derrière la modale : elle se détache sans noyer le décor */
.auth-wrap {
  position: relative;
  width: 100%;
}
.auth-wrap::before {
  content: "";
  position: absolute;
  inset: -38px -30px;
  z-index: 0;
  border-radius: 46px;
  background: radial-gradient(closest-side, rgba(3, 10, 18, 0.82), rgba(3, 10, 18, 0) 78%);
  filter: blur(22px);
}

/* La modale de connexion */
.panel.auth-card {
  position: relative;
  z-index: 1;
  color: var(--text);
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  border-radius: 20px;
  box-shadow:
    0 0 0 1px rgba(3, 10, 18, 0.5),
    0 30px 64px -16px rgba(0, 0, 0, 0.72),
    0 12px 26px -10px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
  overflow: hidden;
  margin: 0;
  animation: auth-card-in 0.32s cubic-bezier(0.2, 0.9, 0.25, 1) both;
}
@keyframes auth-card-in {
  from { opacity: 0; transform: translateY(18px) scale(0.975); }
}
.panel.auth-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, #c8102e, #e8405c 42%, #1a4a7a);
}
.auth-card .panel-head {
  background: none;
  border-bottom: 1px solid var(--line);
  padding: 1.3rem 1.45rem 0.9rem;
  display: block;
}
.auth-card .panel-head h2 { font-size: 1.28rem; display: block; margin-bottom: 0.2rem; }
.auth-card .panel-head p { margin: 0; color: var(--muted); font-size: 0.89rem; }
.auth-card .panel-body { padding: 1.3rem 1.45rem 1.45rem; }

.auth-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 1rem;
  padding-top: 0.95rem;
  border-top: 1px solid var(--line);
}

/* Pied de décor : thème + mentions */
.auth-tools {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.auth-page .seg {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.24);
}
.auth-page .seg button { color: rgba(255, 255, 255, 0.8); }
.auth-page .seg button:hover { color: #fff; }
.auth-page .seg button[aria-pressed="true"] {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  box-shadow: none;
}
.auth-footer {
  justify-content: center;
  text-align: center;
  border: 0;
  margin-top: 0.3rem;
  padding-top: 0;
  color: rgba(255, 255, 255, 0.62);
  flex-direction: column;
  gap: 0.2rem;
}
.auth-body .flash-wrap { margin: 0; }
.auth-body .main { margin-top: 0; }

@media (max-height: 700px) {
  .auth-ecg { bottom: 3vh; opacity: 0.55; }
  .auth-cross-a, .auth-cross-b { display: none; }
}

/* ── 7. En-tête de page (hero) ─────────────────────────────────────────── */
.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(118deg, #0d2340 0%, #16456f 62%, #1a4a7a 100%);
  color: #fff;
  border-radius: calc(var(--radius) + 2px);
  padding: var(--hero-pad-y) var(--hero-pad-x);
  box-shadow: var(--shadow);
  margin-bottom: calc(var(--gap-block) * 0.78);
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(640px 320px at 100% 0%, rgba(200, 16, 46, 0.34), transparent 60%),
    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #ffd2da;
  margin-bottom: 0.5rem;
}
.hero-kicker::before {
  content: "";
  width: 1.6rem;
  height: 2px;
  background: #e8405c;
  border-radius: 2px;
}
.hero h1 {
  margin: 0 0 0.4rem;
  font-family: var(--serif);
  font-size: clamp(1.4rem, 2.3vw, 1.95rem);
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: -0.01em;
  max-width: 44ch;
}
.hero p { margin: 0; color: rgba(255, 255, 255, 0.85); max-width: 68ch; }
.hero p a, .hero a.hero-link { color: #fff; }
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.7rem;
}
.hero-meta .muted { color: rgba(255, 255, 255, 0.74); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.95rem; }
/* Bandeau condense : intitule, titre et sous-titre sur la meme ligne */
.hero-compact {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 0.9rem;
  row-gap: 0.2rem;
  padding: calc(var(--hero-pad-y) * 0.55) calc(var(--hero-pad-x) * 0.7);
  margin-bottom: calc(var(--gap-block) * 0.64);
}
.hero-compact .hero-kicker {
  margin-bottom: 0;
  font-size: 0.63rem;
  letter-spacing: 0.15em;
  flex: 0 0 auto;
}
.hero-compact .hero-kicker::before { width: 1.05rem; }
.hero-compact h1 {
  margin: 0;
  font-size: clamp(1.1rem, 1.6vw, 1.38rem);
  line-height: 1.25;
  max-width: none;
  flex: 0 1 auto;
}
.hero-compact p {
  margin: 0;
  flex: 1 1 260px;
  min-width: 0;
  max-width: none;
  font-size: 0.855rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.76);
}
.hero-compact .hero-meta,
.hero-compact .hero-actions { flex: 1 1 100%; margin-top: 0.45rem; }

/* Priorités dans le hero */
.hero-lead { margin: 0 0 0.75rem; }
.hero-priorities {
  list-style: none;
  margin: 0 0 0.25rem;
  padding: 0;
  display: grid;
  gap: 0.4rem;
  max-width: 72ch;
}
.hero-priorities li {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  padding: 0.42rem 0.7rem;
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.09);
  border-left: 3px solid rgba(255, 255, 255, 0.3);
}
.hero-priorities li:has(.prio-haute) { border-left-color: #ff5370; background: rgba(255, 83, 112, 0.16); }
.hero-prio-rank {
  font-weight: 800;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.6);
  min-width: 1ch;
}
.hero-prio-text { color: #fff; line-height: 1.45; }
.hero-prio-text a { color: #fff; text-decoration: underline; text-underline-offset: 2px; }
.hero-prio-text em {
  font-style: normal;
  display: inline-block;
  margin-left: 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.66);
}
.prio-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  align-self: center;
  background: rgba(255, 255, 255, 0.55);
}
.hero .prio-dot.prio-haute { background: #ff5370; box-shadow: 0 0 0 3px rgba(255, 83, 112, 0.25); }
.hero .prio-dot.prio-moyenne { background: #ffc46b; }
.hero .prio-dot.prio-basse { background: rgba(255, 255, 255, 0.45); }

/* Panneau « Mon plan de travail » */
.prio-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--gap-item); }
.prio-item {
  display: grid;
  grid-template-columns: 2.1rem minmax(0, 1fr) auto;
  align-items: start;
  gap: calc(var(--gap-item) * 0.5) 0.85rem;
  padding: var(--pad-item-y) var(--pad-item-x);
  border: 1px solid var(--line);
  border-left: 4px solid var(--faint);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.prio-item[hidden] { display: none; }
.prio-item.prio-level-haute { border-left-color: var(--hug-red); }
.prio-item.prio-level-moyenne { border-left-color: var(--warn); }
.prio-item.prio-level-basse { border-left-color: var(--link); }
.prio-rank {
  grid-row: span 2;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--faint);
  text-align: center;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
}
.prio-item.prio-level-haute .prio-rank { color: var(--hug-red); }
@media (max-width: 640px) {
  .prio-item { grid-template-columns: 1.8rem minmax(0, 1fr); }
  .prio-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

.prio-head { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; margin-bottom: 0.3rem; }
.prio-badge { text-transform: uppercase; letter-spacing: 0.04em; }
.prio-badge.prio-haute { background: var(--hug-red); color: #fff; border-color: transparent; }
.prio-badge.prio-moyenne { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.prio-badge.prio-basse { background: var(--surface-3); color: var(--muted); border-color: var(--line); }
.prio-title { margin: 0; font-weight: 700; color: var(--text-strong); line-height: 1.45; }
.prio-why { margin: 0.3rem 0 0; color: var(--muted); font-size: 0.88rem; line-height: 1.5; }
.prio-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.prio-actions form { margin: 0; }

/* Tri et filtres du plan de travail */
.prio-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: calc(var(--gap-item) * 0.7);
  padding: calc(var(--pad-head-y) * 0.8) var(--pad-x);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.prio-toolbar .toolbar-label { margin-right: 0.1rem; }
.chip-row { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.chip {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1.4;
}
.chip:hover { color: var(--text-strong); border-color: var(--hug-blue); }
.chip[aria-pressed="true"] {
  background: var(--hug-navy);
  border-color: var(--hug-navy);
  color: #fff;
}
:root[data-theme="dark"] .chip[aria-pressed="true"] { background: var(--hug-blue); border-color: var(--hug-blue); color: #061320; }

.prio-done-wrap { border-top: 1px solid var(--line); background: var(--surface-2); }
.prio-done { list-style: none; margin: 0.35rem 0 0; padding: 0; display: grid; gap: calc(var(--gap-item) * 0.6); }
.prio-done li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.prio-done li span { text-decoration: line-through; }
.prio-done form { margin: 0; }

/* ── 8. Statistiques ───────────────────────────────────────────────────── */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--gap-item);
  margin-bottom: var(--gap-block);
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--pad-item-y) var(--pad-item-x);
  box-shadow: var(--shadow-sm);
  display: block;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.14s ease, transform 0.14s ease;
}
a.stat:hover { border-color: var(--hug-red); transform: translateY(-2px); }
.stat .label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.stat .value {
  font-family: var(--serif);
  font-size: 1.85rem;
  line-height: 1.1;
  color: var(--text-strong);
  font-weight: 700;
  margin-top: 0.25rem;
  font-variant-numeric: tabular-nums;
}
.stat .hint { color: var(--faint); font-size: 0.8rem; }

/* ── 9. Panneaux ───────────────────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: var(--gap-block);
  min-width: 0;
  max-width: 100%;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.9rem;
  padding: var(--pad-head-y) var(--pad-x);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.panel-head h2 {
  margin: 0;
  font-size: 1.02rem;
  font-family: var(--serif);
  font-weight: 700;
  color: var(--text-strong);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.panel-head .count {
  font-family: var(--font);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
}
.panel-head-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
/* En-tete de panneau fige : le contenu defile dessous */
.panel-sticky { overflow: visible; }
.panel-sticky > .panel-sticky-head {
  position: sticky;
  top: var(--sticky-top, 58px);
  z-index: 6;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
}
/* ombre portee seulement quand l'entete est reellement decollee */
.panel-sticky > .panel-sticky-head.is-stuck {
  box-shadow: 0 10px 18px -12px rgba(0, 0, 0, 0.55);
}
.panel-sticky > .panel-sticky-head > .panel-head { border-bottom: 1px solid var(--line); }
@media (max-width: 760px) {
  .panel-sticky > .panel-sticky-head { position: static; }
}
@media (prefers-reduced-motion: no-preference) {
  .panel-sticky > .panel-sticky-head { transition: box-shadow 0.16s ease; }
}

.panel-body { padding: var(--pad-body-y) var(--pad-x); }
.panel-body > :first-child { margin-top: 0; }
.panel-body > :last-child { margin-bottom: 0; }
.panel-quiet { background: var(--surface-2); }
.panel-note {
  padding: 0.7rem 1.1rem;
  background: var(--info-bg);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
}

/* ── 10. Tableaux ──────────────────────────────────────────────────────── */
.table-wrap {
  /* Conteneur de défilement : l'en-tête sticky s'y accroche */
  overflow: auto;
  max-height: var(--table-max-h, min(68vh, 700px));
  -webkit-overflow-scrolling: touch;
  /* le défilement horizontal reste dans la zone, le vertical se poursuit
     naturellement sur la page une fois le bas du tableau atteint */
  overscroll-behavior-x: contain;
  overscroll-behavior-y: auto;
  max-width: 100%;
  width: 100%;
}
.table-wrap::-webkit-scrollbar { height: 9px; width: 9px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; }
.table-wrap::-webkit-scrollbar-corner { background: transparent; }
/* Tableaux courts (versions, collaborateurs…) : pas de boîte de défilement */
.table-wrap-short { --table-max-h: none; }

table.data {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 0.93rem;
}
table.data th,
table.data td {
  padding: var(--row-pad-y) var(--row-pad-x);
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
table.data thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--surface-3);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.73rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
  /* La bordure d'une cellule sticky disparaît au défilement : on la dessine
     en ombre interne, qui suit l'en-tête. */
  border-bottom: 0;
  box-shadow: inset 0 -1px 0 var(--line-strong);
}
table.data thead th.is-sortable {
  cursor: pointer;
  user-select: none;
  padding-right: 1.5rem;
  position: sticky;
}
table.data thead th.is-sortable:hover { color: var(--text-strong); background: var(--surface-3); }
table.data thead th.is-sortable::after {
  content: "⇅";
  position: absolute;
  right: 0.5rem;
  opacity: 0.4;
  font-size: 0.85em;
}
table.data thead th[aria-sort="ascending"]::after { content: "↑"; opacity: 1; color: var(--hug-red); }
table.data thead th[aria-sort="descending"]::after { content: "↓"; opacity: 1; color: var(--hug-red); }

table.data tbody tr { background: var(--surface); transition: background 0.1s ease; }
table.data tbody tr:nth-child(even) { background: var(--surface-2); }
table.data tbody tr:hover { background: var(--info-bg); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data a { color: var(--link); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
table.data a:hover { text-decoration: underline; }
table.data td:last-child,
table.data th:last-child { white-space: nowrap; }
table.data td.actions-cell { white-space: nowrap; }

.title-cell { min-width: 220px; max-width: 34rem; white-space: normal; }
.title-cell > a { display: inline-block; font-size: 0.98rem; line-height: 1.35; }
.title-cell .muted { display: block; margin-top: 0.2rem; white-space: normal; line-height: 1.45; }

/* Extraits de description dans les listes : le nombre de lignes affichees suit
   la densite choisie (1 ligne en compact, 2 en normal, 5 en confort).
   Selecteur a specificite egale a .title-cell .muted, place apres, pour que le
   display en boite verticale l'emporte — sans quoi le clamp reste inoperant. */
.title-cell .cell-excerpt,
td .cell-excerpt,
.cell-excerpt.cell-excerpt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--excerpt-lines, 2);
  line-clamp: var(--excerpt-lines, 2);
  overflow: hidden;
  margin-top: 0.2rem;
}
/* ==========================================================================
   === D-ID Voice — composants propres à la dé-identification vocale
   Prolonge le système de design CASU 144 : mêmes jetons, mêmes surfaces,
   mêmes rayons. Rien n'est redéfini, tout est ajouté.
   ========================================================================== */

/* ── Jetons locaux ─────────────────────────────────────────────────────── */
:root {
  --id-patient: #c8102e;
  --id-patient-bg: rgba(200, 16, 46, 0.14);
  --id-person: #8a5a00;
  --id-person-bg: rgba(226, 160, 42, 0.20);
  --wave: #1a4a7a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --id-patient: #ff8da0;
    --id-patient-bg: rgba(232, 64, 92, 0.24);
    --id-person: #ffcd7a;
    --id-person-bg: rgba(233, 183, 101, 0.20);
    --wave: #6fb3e8;
  }
}
:root[data-theme="dark"] {
  --id-patient: #ff8da0;
  --id-patient-bg: rgba(232, 64, 92, 0.24);
  --id-person: #ffcd7a;
  --id-person-bg: rgba(233, 183, 101, 0.20);
  --wave: #6fb3e8;
}

/* ── Utilitaires ───────────────────────────────────────────────────────── */
.is-hidden { display: none !important; }
.block { display: block; }
.inline-form { display: inline; }

/* ── Décor de connexion : forme d'onde vocale ──────────────────────────── */
.auth-wave {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 13vh;
  width: 100%;
  height: clamp(130px, 25vh, 250px);
  opacity: 0.85;
}
.auth-wave-base {
  fill: none;
  stroke: rgba(150, 205, 248, 0.34);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.auth-wave-pulse {
  fill: none;
  stroke: #ff536b;
  stroke-width: 2.8;
  stroke-linejoin: round;
  stroke-linecap: round;
  filter: drop-shadow(0 0 8px rgba(255, 83, 107, 0.85));
  stroke-dasharray: 150 850;
  animation: wave-sweep 8s linear infinite;
}
@keyframes wave-sweep {
  from { stroke-dashoffset: 1000; }
  to { stroke-dashoffset: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-wave-pulse { animation: none; stroke-dasharray: none; opacity: 0.75; }
}
.auth-note {
  margin: 0.9rem 0 0;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

/* ── Sceau « traitement local » dans la barre latérale ─────────────────── */
.local-seal {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.07);
}
.local-seal strong {
  display: block;
  color: #fff;
  font-size: 0.82rem;
  letter-spacing: 0.01em;
}
.local-seal em {
  display: block;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.72rem;
  font-style: normal;
  font-variant-numeric: tabular-nums;
}
.local-seal-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-top: 0.35rem;
  border-radius: 50%;
  background: #5fd39a;
  box-shadow: 0 0 0 3px rgba(95, 211, 154, 0.22);
}

/* ── Statistiques : variante positive ──────────────────────────────────── */
.stat .value-ok { color: var(--ok); }

/* ── Pastilles d'état ──────────────────────────────────────────────────── */
.badge.status-done { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.badge.status-running { background: var(--info-bg); color: var(--link); border-color: color-mix(in srgb, var(--link) 35%, transparent); }
.badge.status-queued { background: var(--surface-3); color: var(--muted); border-color: var(--line); }
.badge.status-error { background: var(--err-bg); color: var(--err); border-color: color-mix(in srgb, var(--err) 40%, transparent); }

/* ── Avancement du traitement ──────────────────────────────────────────── */
.progress {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  overflow: hidden;
}
.progress-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--hug-blue), var(--hug-red));
  transition: width 0.45s ease;
}
.progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  animation: progress-shine 1.6s linear infinite;
}
@keyframes progress-shine {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}
@media (prefers-reduced-motion: reduce) {
  .progress-fill::after { animation: none; }
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.6rem 0 0.9rem;
  font-size: 0.9rem;
}
.progress-meta span { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ── Écoute comparative ────────────────────────────────────────────────── */
.ab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
  gap: var(--gap-item);
}
.ab-card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: var(--pad-item-y) var(--pad-item-x);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.ab-card-main {
  border-color: color-mix(in srgb, var(--hug-red) 38%, var(--line));
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.ab-head { display: flex; flex-direction: column; gap: 0.22rem; min-width: 0; }
.ab-tag {
  align-self: flex-start;
  padding: 0.14rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface-3);
  color: var(--text-strong);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.ab-tag-enh { background: var(--info-bg); color: var(--link); border-color: color-mix(in srgb, var(--link) 35%, transparent); }
.ab-tag-anon { background: var(--hug-red-soft); color: var(--hug-red); border-color: color-mix(in srgb, var(--hug-red) 38%, transparent); }
.ab-card audio { width: 100%; height: 38px; }
.ab-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: var(--gap-item);
  padding-top: var(--gap-item);
  border-top: 1px solid var(--line);
}

/* ── Panneau des noms repérés ──────────────────────────────────────────── */
.panel-vault { border-color: color-mix(in srgb, var(--hug-red) 32%, var(--line)); }
.panel-vault > .panel-head {
  background: linear-gradient(180deg, var(--hug-red-soft), var(--surface-2));
}
.vault-body { position: relative; }
.vault-name {
  font-family: var(--serif);
  font-size: 1.02rem;
  color: var(--text-strong);
}
.chip-time { font-variant-numeric: tabular-nums; }

/* ── Transcription annotée ─────────────────────────────────────────────── */
.transcript {
  max-height: 26rem;
  overflow-y: auto;
  padding: var(--pad-body-y) var(--pad-x);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-inset);
  font-size: var(--prose-size);
  line-height: var(--prose-leading);
  overflow-wrap: anywhere;
}
.transcript-help { margin: 0 0 0.75rem; }
.tok {
  padding: 0.05em 0.1em;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.tok:hover { background: var(--surface-3); }
.tok-id {
  font-weight: 700;
  border-bottom: 2px solid currentColor;
}
.tok-patient { color: var(--id-patient); background: var(--id-patient-bg); }
.tok-person { color: var(--id-person); background: var(--id-person-bg); }
.tok-off {
  color: var(--faint);
  background: var(--surface-3);
  border-bottom-style: dashed;
  font-weight: 600;
}
.tok-now {
  outline: 2px solid color-mix(in srgb, var(--hug-blue) 65%, transparent);
  outline-offset: 1px;
  background: var(--info-bg);
}
.tok-demo { cursor: default; padding: 0.05em 0.3em; }
.tok-demo:hover { background: inherit; }
.redacted-view {
  font-family: var(--mono);
  font-size: 0.92rem;
  white-space: pre-wrap;
}

/* ── Tableau des zones ─────────────────────────────────────────────────── */
.zone-extract {
  font-family: var(--serif);
  font-weight: 700;
  color: var(--text-strong);
}
table.data tbody tr.row-flash {
  background: var(--warn-bg);
  transition: background 0.3s ease;
}
.remask-bar {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0.9rem;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.remask-bar select { min-width: 15rem; }
.remask-bar .field-hint { flex: 1 1 18rem; margin: 0; }

/* ── Cases à cocher de formulaire ──────────────────────────────────────── */
.check-list { display: grid; gap: 0.5rem; }
.check {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0;
  font-weight: 400;
  font-size: 0.92rem;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}
.check input[type="checkbox"] { margin-top: 0.2rem; accent-color: var(--hug-red); }

input[type="range"] {
  width: 100%;
  accent-color: var(--hug-red);
  background: transparent;
}

/* ── Listes explicatives ───────────────────────────────────────────────── */
.steps {
  display: grid;
  gap: var(--gap-item);
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.steps li {
  display: grid;
  grid-template-columns: 1.75rem 1fr;
  gap: 0.2rem 0.7rem;
  counter-increment: step;
}
.steps li::before {
  content: counter(step);
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--hug-navy);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
}
.steps strong { color: var(--text-strong); }
.steps span { color: var(--muted); font-size: 0.88rem; line-height: 1.55; }

.facts { margin: 0; padding-left: 1.1rem; display: grid; gap: 0.4rem; }
.facts li { color: var(--muted); font-size: 0.9rem; line-height: 1.55; }
.facts strong { color: var(--text-strong); }

.pull-cmd {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-xs);
  background: var(--surface-3);
  font-size: 0.8rem;
  color: var(--muted);
}

/* ── Écrans étroits ────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .remask-bar { align-items: stretch; }
  .remask-bar select { min-width: 0; width: 100%; }
  .ab-tools { align-items: flex-start; }
}

@media print {
  .title-cell .cell-excerpt,
  td .cell-excerpt,
  .cell-excerpt.cell-excerpt { display: block; overflow: visible; }
}
.muted { color: var(--muted); font-size: 0.86rem; }
.tiny { font-size: 0.78rem; }
.nowrap { white-space: nowrap; }
tr.current-version td { background: var(--ok-bg) !important; }

/* Tableaux empilés sur mobile */
@media (max-width: 760px) {
  .table-wrap { max-height: none; overflow: visible; }
  table.data.stack { min-width: 0; font-size: 0.92rem; }
  table.data.stack thead { display: none; }
  table.data.stack,
  table.data.stack tbody,
  table.data.stack tr,
  table.data.stack td { display: block; width: 100%; }
  table.data.stack tbody tr {
    background: var(--surface) !important;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.65rem;
    box-shadow: var(--shadow-sm);
  }
  table.data.stack td { border: 0; padding: 0.22rem 0; white-space: normal !important; }
  table.data.stack td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--faint);
    margin-bottom: 0.1rem;
  }
  table.data.stack .title-cell { min-width: 0; max-width: none; }
  table.data.stack td.actions-cell { padding-top: 0.5rem; }
  table.data:not(.stack) { min-width: 560px; font-size: 0.88rem; }
}

/* ── 11. Badges & pastilles ────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 999px;
  padding: 0.16rem 0.55rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge-theme {
  background: var(--hug-red-soft);
  color: var(--hug-red);
  border-color: color-mix(in srgb, var(--hug-red) 24%, transparent);
}
.badge-publication {
  background: var(--info-bg);
  color: var(--link);
  border-color: color-mix(in srgb, var(--link) 22%, transparent);
}
.badge-protocole {
  background: var(--ok-bg);
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 24%, transparent);
}
.badge-subvention {
  background: var(--warn-bg);
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 26%, transparent);
}
.badge-status { background: var(--surface-3); color: var(--muted); border-color: var(--line); }
.badge-public {
  background: var(--ok-bg);
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 24%, transparent);
}
.badge-private { background: var(--surface-3); color: var(--faint); border-color: var(--line); }
.badge-subject {
  background: var(--info-bg);
  color: var(--link);
  border-color: color-mix(in srgb, var(--link) 20%, transparent);
}
.badge-skill {
  background: var(--warn-bg);
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 24%, transparent);
}
.badge-role-admin {
  background: var(--hug-red-soft);
  color: var(--hug-red);
  border-color: color-mix(in srgb, var(--hug-red) 24%, transparent);
}
.badge-role-chercheur {
  background: var(--info-bg);
  color: var(--link);
  border-color: color-mix(in srgb, var(--link) 20%, transparent);
}
.badge-role-lecteur { background: var(--surface-3); color: var(--muted); border-color: var(--line); }

/* Sur fond sombre (hero) */
.hero .badge { background: rgba(255, 255, 255, 0.16); color: #fff; border-color: rgba(255, 255, 255, 0.3); }
.hero .badge-skill { background: rgba(255, 240, 217, 0.18); color: #ffe6b8; border-color: rgba(255, 230, 184, 0.42); }

.subject-row { display: flex; flex-wrap: wrap; gap: 0.33rem; margin-top: 0.8rem; }
.subject-row.compact { margin-top: 0.4rem; }
/* Les etiquettes de sujets suivent la densite : masquees en compact (mode
   survol de liste), trois au plus en normal, toutes en confort. */
:root[data-density="compact"] .title-cell .subject-row { display: none; }
:root:not([data-density="large"]) .title-cell .subject-row .badge:nth-child(n+4) { display: none; }
@media print {
  .title-cell .subject-row { display: flex !important; }
  .title-cell .subject-row .badge { display: inline-flex !important; }
}

.role-pill {
  font-style: normal;
  font-size: 0.7rem;
  font-weight: 700;
  margin-left: 0.35rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}
.role-pill-admin { background: #c8102e; color: #fff; }

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
  margin-right: 0.3rem;
}
.dot-ok { background: var(--ok); }
.dot-err { background: var(--err); }

/* ── 12. Boutons ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.9rem;
  font: inherit;
  font-weight: 700;
  font-size: 0.89rem;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.14s ease, box-shadow 0.14s ease, transform 0.1s ease, border-color 0.14s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(145deg, #d31232, #a30f27);
  color: #fff;
  box-shadow: 0 4px 12px rgba(200, 16, 46, 0.26);
}
.btn-primary:hover { background: linear-gradient(145deg, #e0163a, #8f0d22); color: #fff; }
.btn-secondary { background: #1a4a7a; color: #fff; }
.btn-secondary:hover { background: #15405f; color: #fff; }
.btn-ghost { background: var(--surface); color: var(--link); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-3); border-color: var(--hug-blue); }
.btn-danger {
  background: var(--surface);
  color: var(--err);
  border-color: color-mix(in srgb, var(--err) 35%, transparent);
}
.btn-danger:hover { background: var(--err-bg); }
.btn-sm { padding: 0.32rem 0.62rem; font-size: 0.81rem; border-radius: var(--radius-xs); }
.btn-block { width: 100%; }
button:disabled, .btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none !important; }

.actions { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; }
.actions form { margin: 0; }
.inline-form { margin: 0; display: inline-flex; }
.inline-form select { padding: 0.3rem 0.5rem; font-size: 0.84rem; min-width: 130px; }

/* Barre d’outils de contenu (partage, export, impression) */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.1rem;
}
.toolbar-label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  margin-right: 0.15rem;
}
.toolbar-sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 0.25rem; }
.toolbar-spacer { flex: 1 1 1rem; }

/* Contrôle segmenté (thème, densité) */
.seg {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.seg button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1.3;
}
.seg button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text-strong);
  box-shadow: var(--shadow-sm);
}
.seg button:hover { color: var(--text-strong); }
.shell-top .seg { background: var(--surface); }

/* ── 13. Grilles ───────────────────────────────────────────────────────── */
.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 1.1rem;
  align-items: start;
}
.grid-2 > * { min-width: 0; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
@media (max-width: 1000px) { .grid-2 { grid-template-columns: 1fr; } }

.form-grid { display: grid; gap: 0.85rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.85rem; }
@media (max-width: 700px) { .form-row, .form-row-3 { grid-template-columns: 1fr; } }
.form-end { display: flex; align-items: end; padding-bottom: 0.2rem; }

/* ── 14. Formulaires ───────────────────────────────────────────────────── */
label {
  display: block;
  font-weight: 600;
  font-size: 0.86rem;
  margin-bottom: 0.32rem;
  color: var(--text-strong);
}
.field-hint { margin: 0.3rem 0 0; color: var(--muted); font-size: 0.82rem; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="search"],
input[type="number"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  font: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
textarea { min-height: 150px; resize: vertical; line-height: 1.6; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: var(--hug-blue); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--hug-red);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--hug-red) 20%, transparent);
}
select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2rem;
}
input[type="file"] {
  width: 100%;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  background: var(--surface-inset);
  color: var(--text);
}
.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--text-strong);
  margin: 0;
}
.check input { width: auto; accent-color: var(--hug-red); }

.filters { display: flex; flex-wrap: wrap; gap: calc(var(--gap-item) * 0.85); align-items: end; }
.filters .field { min-width: 150px; flex: 1 1 150px; }
.filters .field label {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.15rem;
}
/* Controles de filtre : hauteur reduite, meme ligne de base que le bouton */
.panel-filters { margin-bottom: 0.75rem; }
.panel-filters > .panel-body { padding: calc(var(--pad-body-y) * 0.62) calc(var(--pad-x) * 0.73); }
.filters input,
.filters select,
.filters .people-picker > summary {
  padding: 0.44rem 0.65rem;
  font-size: 0.9rem;
}
.filters select { padding-right: 1.9rem; background-position: calc(100% - 15px) 55%, calc(100% - 10px) 55%; }
.filters .people-picker > summary { padding-right: 1.9rem; }
.filters > .btn { padding: 0.46rem 0.85rem; }

/* Filtre « personnes » (multi-sélection) */
.field-people { min-width: 240px; flex: 1 1 240px; }
.panel-filters { overflow: visible; }
.people-picker { position: relative; }
.people-picker > summary {
  list-style: none;
  cursor: pointer;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0.6rem 2rem 0.6rem 0.75rem;
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  position: relative;
  user-select: none;
}
.people-picker > summary::-webkit-details-marker { display: none; }
.people-picker > summary::after {
  content: "";
  position: absolute;
  right: 0.85rem;
  top: 50%;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
}
.people-picker[open] > summary::after { transform: translateY(-20%) rotate(225deg); }
.people-picker > summary:hover { border-color: var(--hug-blue); }
.people-picker[open] > summary {
  border-color: var(--hug-red);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--hug-red) 18%, transparent);
}
.people-panel {
  margin-top: 0.4rem;
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 0.6rem;
  display: grid;
  gap: 0.5rem;
}
/* Ouvert, le champ occupe toute la ligne de filtres : la liste reste lisible */
.field-people:has(.people-picker[open]) { flex: 1 1 100%; }
.people-panel .people-list { background: var(--surface); }
.people-panel input[type="search"] { padding: 0.45rem 0.6rem; font-size: 0.88rem; }
.people-list {
  display: grid;
  gap: 1px;
  max-height: 15rem;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 0.2rem;
}
.people-list label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0.35rem 0.45rem;
  border-radius: var(--radius-xs);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
}
.people-list label:hover { background: var(--surface-3); }
.people-list label[hidden] { display: none; }
.people-list input { width: auto; accent-color: var(--hug-red); margin: 0; }
.people-list label span { flex: 1; min-width: 0; }
.people-list label em {
  font-style: normal;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--faint);
  background: var(--surface-3);
  border-radius: 999px;
  padding: 0.05rem 0.4rem;
}
.people-scope {
  display: grid;
  gap: 0.3rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--line);
}
.people-scope .check { font-size: 0.85rem; font-weight: 500; }

.active-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: calc(var(--gap-item) * 0.6);
  margin-top: calc(var(--gap-item) * 1.4);
  padding-top: calc(var(--gap-item) * 1.3);
  border-top: 1px solid var(--line);
}
a.chip-remove {
  text-decoration: none;
  background: var(--hug-navy);
  border-color: var(--hug-navy);
  color: #fff;
}
a.chip-remove span { opacity: 0.7; margin-left: 0.15rem; }
a.chip-remove:hover { background: var(--hug-red); border-color: var(--hug-red); color: #fff; }
:root[data-theme="dark"] a.chip-remove { background: var(--hug-blue); border-color: var(--hug-blue); color: #061320; }

.auth-card .panel-body { padding: 1.35rem; }
.auth-hint {
  margin-top: 1rem;
  padding: 0.8rem 0.95rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.6;
}
.auth-hint code {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
  color: var(--text-strong);
}

/* ── 15. Messages & vides ──────────────────────────────────────────────── */
.flash-wrap { margin-top: 0.8rem; display: grid; gap: 0.45rem; }
.flash {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.91rem;
}
.flash::before { font-weight: 800; }
.flash-ok {
  background: var(--ok-bg);
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 28%, transparent);
}
.flash-ok::before { content: "✓"; }
.flash-warn {
  background: var(--warn-bg);
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 28%, transparent);
}
.flash-warn::before { content: "!"; }
.flash-err {
  background: var(--err-bg);
  color: var(--err);
  border-color: color-mix(in srgb, var(--err) 30%, transparent);
}
.flash-err::before { content: "✕"; }

.empty { padding: calc(var(--pad-body-y) * 1.9) var(--pad-x); text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--text-strong); font-size: 1rem; margin-bottom: 0.3rem; }
.empty .btn { margin-top: 0.85rem; }

/* Toast (copie de lien, etc.) */
.toast-host {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  z-index: 200;
  display: grid;
  gap: 0.4rem;
  pointer-events: none;
}
.toast {
  background: var(--text-strong);
  color: var(--surface);
  padding: 0.6rem 1rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.18s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ── 16. Listes de métadonnées ─────────────────────────────────────────── */
.meta-list { display: grid; gap: 0; margin: 0; }
.meta-list div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: calc(var(--row-pad-y) * 0.65) 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}
.meta-list div:last-child { border-bottom: 0; }
.meta-list dt { color: var(--muted); }
.meta-list dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.meta-list code { font-size: 0.84rem; }

/* ── 17. Lecture (prose) ───────────────────────────────────────────────── */
.description,
.rich-content,
.prose {
  font-size: var(--prose-size);
  line-height: var(--prose-leading);
  color: var(--text);
  max-width: var(--measure);
}
.description {
  white-space: pre-wrap;
  background: var(--surface-inset);
  border: 1px solid var(--line);
  border-left: 4px solid var(--hug-red);
  padding: 0.95rem 1.1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
/* Description de projet rendue en blocs : intertitres + liens cliquables */
.description-rich { white-space: normal; }
.description-rich p { margin: 0 0 0.7rem; }
.description-rich > p:last-child { margin-bottom: 0; }
.description-rich .desc-head {
  margin: 1.25rem 0 0.3rem;
  font-weight: 700;
  font-size: 0.74rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
.description-rich > .desc-head:first-child { margin-top: 0; }
.description-rich a { overflow-wrap: anywhere; }

.rich-content > :first-child, .prose > :first-child { margin-top: 0; }
.rich-content > :last-child, .prose > :last-child { margin-bottom: 0; }
.rich-content h2, .prose h2,
.rich-content h3, .prose h3,
.rich-content h4, .prose h4 {
  font-family: var(--serif);
  color: var(--text-strong);
  line-height: 1.3;
  margin: 1.5rem 0 0.5rem;
  letter-spacing: -0.005em;
}
.rich-content h2, .prose h2 { font-size: 1.22rem; }
.rich-content h3, .prose h3 { font-size: 1.08rem; }
.rich-content h4, .prose h4 { font-size: 0.98rem; }
.rich-content p, .prose p { margin: 0 0 0.9rem; }
.rich-content ul, .prose ul,
.rich-content ol, .prose ol { margin: 0 0 0.95rem; padding-left: 1.3rem; }
.rich-content li, .prose li { margin: 0.3rem 0; padding-left: 0.1rem; }
.rich-content li::marker, .prose li::marker { color: var(--hug-red); font-weight: 700; }
.rich-content strong, .prose strong { color: var(--text-strong); }
.rich-content a, .prose a { color: var(--link); }
.rich-content blockquote, .prose blockquote {
  margin: 1rem 0;
  padding: 0.6rem 1rem;
  border-left: 3px solid var(--hug-red);
  background: var(--surface-inset);
  color: var(--muted);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
}
.summary-box { white-space: pre-wrap; }
.summary-box.rich-content { white-space: normal; }

/* Zone de lecture repliable (verbatim, longs contenus) */
.readable { position: relative; }
.readable-clamped {
  max-height: var(--clamp-h, 22rem);
  overflow: hidden;
  mask-image: linear-gradient(180deg, #000 72%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, #000 72%, transparent 100%);
}
.readable-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.7rem;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--link);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font: inherit;
  font-size: 0.83rem;
  font-weight: 700;
  cursor: pointer;
}
.readable-toggle:hover { background: var(--surface-3); }
.verbatim-box { font-size: 0.95rem; }
.verbatim-box:not(.rich-content) { white-space: pre-wrap; }

/* ── 18. Cartes diverses ───────────────────────────────────────────────── */
.admin-subnav {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.8rem;
  font-size: 0.86rem;
  color: var(--faint);
}
.admin-subnav a { color: var(--link); font-weight: 600; text-decoration: none; }
.admin-subnav a:hover { text-decoration: underline; }
.admin-subnav strong { color: var(--text-strong); }

.admin-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.admin-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}
.admin-card:hover { transform: translateY(-2px); border-color: var(--hug-red); box-shadow: var(--shadow); }
.admin-card-kicker {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--hug-red);
  margin-bottom: 0.4rem;
}
.admin-card h2 { margin: 0 0 0.4rem; font-family: var(--serif); font-size: 1.18rem; color: var(--text-strong); }
.admin-card p { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.5; }

.experts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 1rem; }
.expert-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  box-shadow: var(--shadow-sm);
}
.expert-card-head { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.6rem; }
.expert-card-head h2 { margin: 0 0 0.2rem; font-family: var(--serif); font-size: 1.08rem; color: var(--text-strong); }
.expert-card h3 {
  margin: 0.9rem 0 0.3rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--faint);
  font-family: var(--font);
}
.experts-list { display: grid; gap: 0.75rem; }
.expert-row { padding-bottom: 0.7rem; border-bottom: 1px solid var(--line); }
.expert-row:last-child { border-bottom: 0; padding-bottom: 0; }

/* Listes réunions */
.meeting-project-list,
.participant-list,
.attachment-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.meeting-project-list li,
.participant-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.meeting-project-list li:last-child,
.participant-list li:last-child,
.attachment-item:last-child { border-bottom: 0; padding-bottom: 0; }
.meeting-project-list a { flex: 1 1 11rem; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.attachment-item {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.7rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--line);
}
.attachment-item > div { min-width: 0; }
.attachment-item strong { display: block; overflow-wrap: anywhere; margin-top: 0.15rem; }
.attachment-actions { display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; }
.attachment-upload { padding-top: 0.7rem; border-top: 1px solid var(--line); }

.actions-board { display: grid; gap: 0.65rem; }
.action-card {
  border: 1px solid var(--line);
  border-left: 3px solid var(--faint);
  border-radius: var(--radius-sm);
  padding: 0.8rem 0.9rem;
  background: var(--surface-2);
}
.action-card.status-a_faire { border-left-color: var(--hug-red); }
.action-card.status-en_cours { border-left-color: var(--warn); background: var(--warn-bg); }
.action-card.status-fait { border-left-color: var(--link); background: var(--info-bg); }
.action-card.status-valide { border-left-color: var(--ok); background: var(--ok-bg); }
.action-desc { margin: 0 0 0.55rem; font-weight: 600; color: var(--text-strong); line-height: 1.5; }
.action-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 0.45rem; }
.action-view-meta { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.action-edit-desc { margin: 0 0 0.8rem; white-space: pre-wrap; }
@media (max-width: 700px) { .action-meta { grid-template-columns: 1fr; } }

/* ── 19. Modales ───────────────────────────────────────────────────────── */
.app-modal {
  border: none;
  padding: 0;
  background: transparent;
  max-width: min(640px, calc(100vw - 2rem));
  width: 100%;
  color: var(--text);
}
.app-modal-wide { max-width: min(860px, calc(100vw - 2rem)); }
.app-modal::backdrop { background: rgba(8, 20, 34, 0.6); backdrop-filter: blur(3px); }
.modal-card {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid var(--line);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.modal-head h3 { margin: 0; font-family: var(--serif); font-size: 1.12rem; color: var(--text-strong); }
.modal-close {
  border: none;
  background: transparent;
  font-size: 1.45rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0.1rem 0.35rem;
  border-radius: 8px;
}
.modal-close:hover { background: var(--surface-3); color: var(--text-strong); }
.modal-body {
  padding: 1.05rem 1.1rem;
  display: grid;
  gap: 0.75rem;
  max-height: min(70vh, 640px);
  overflow-y: auto;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.85rem 1.1rem 1rem;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.modal-card.form-grid { gap: 0; }
.modal-card.form-grid > .modal-body { gap: 0.75rem; }
.modal-body .form-grid { gap: 0.6rem; }

/* ── 20. Éditeur riche ─────────────────────────────────────────────────── */
.rich-editor {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}
.rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.22rem;
  padding: 0.4rem 0.45rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.rich-toolbar button {
  border: 1px solid transparent;
  background: var(--surface);
  border-radius: var(--radius-xs);
  padding: 0.26rem 0.52rem;
  font-size: 0.82rem;
  color: var(--text);
  cursor: pointer;
  line-height: 1.2;
}
.rich-toolbar button:hover { border-color: var(--line-strong); background: var(--surface-3); }
.rich-sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 0.18rem; }
.rich-surface {
  min-height: 220px;
  max-height: 420px;
  overflow: auto;
  padding: 0.85rem 1rem;
  outline: none;
  line-height: 1.7;
  background: var(--surface);
  color: var(--text);
}
.rich-surface-tall { min-height: 320px; max-height: 560px; }
.rich-surface:focus { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--hug-blue) 35%, transparent); }
.rich-surface h3 { margin: 0.8rem 0 0.35rem; font-family: var(--serif); color: var(--text-strong); }
.rich-surface p { margin: 0 0 0.65rem; }
.rich-surface ul, .rich-surface ol { margin: 0 0 0.65rem 1.1rem; }

/* ── 21. Progression LLM ───────────────────────────────────────────────── */
form.is-progressing .progress-idle { display: none; }
form.is-progressing .modal-foot .btn-ghost,
form.is-progressing .modal-close { opacity: 0.45; pointer-events: none; }
.progress-panel {
  display: grid;
  gap: 0.7rem;
  padding: 0.85rem 0.95rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.progress-panel[hidden] { display: none !important; }
.progress-spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid var(--line-strong);
  border-top-color: var(--hug-red);
  animation: progress-spin 0.8s linear infinite;
  justify-self: start;
}
@keyframes progress-spin { to { transform: rotate(360deg); } }
.progress-meta { display: flex; justify-content: space-between; gap: 0.75rem; align-items: baseline; }
.progress-meta strong { color: var(--text-strong); font-size: 0.94rem; }
.progress-track { height: 9px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #c8102e, #e85a3a 55%, #1a4a7a);
  transition: width 0.25s ease;
}
.progress-hint { margin: 0; font-size: 0.84rem; }
dialog.app-modal[data-busy]::backdrop { background: rgba(8, 20, 34, 0.75); }

/* ── 22. Enregistreur audio ────────────────────────────────────────────── */
.audio-recorder {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.85rem 0.95rem;
  background: var(--surface-inset);
  display: grid;
  gap: 0.6rem;
}
.audio-recorder-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem;
  align-items: baseline;
}
.audio-controls { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; }
.audio-timer { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text-strong); min-width: 3.2rem; }
.audio-playback { width: 100%; margin-top: 0.15rem; }

/* ── 23. Document imprimable (CR, fiche projet) ────────────────────────── */
.doc-body { background: var(--bg); }
.doc-page {
  max-width: 820px;
  margin: 1.25rem auto 3rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.4rem 2.6rem 2.8rem;
}
.doc-toolbar {
  max-width: 820px;
  margin: 1.25rem auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}
.doc-head { border-bottom: 2px solid var(--hug-red); padding-bottom: 1rem; margin-bottom: 1.6rem; }
.doc-org { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.doc-org .brand-mark { width: 40px; height: 40px; border-radius: 10px; box-shadow: none; }
.doc-org-text { display: flex; flex-direction: column; line-height: 1.3; }
.doc-org-text strong { font-family: var(--serif); color: var(--text-strong); font-size: 0.98rem; }
.doc-org-text span { font-size: 0.78rem; color: var(--muted); }
.doc-kicker {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--hug-red);
}
.doc-head h1 {
  font-family: var(--serif);
  font-size: 1.75rem;
  line-height: 1.25;
  margin: 0.35rem 0 0.75rem;
  color: var(--text-strong);
}
.doc-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.6rem 1.2rem;
  margin: 0;
  font-size: 0.89rem;
}
.doc-facts div { display: grid; gap: 0.1rem; }
.doc-facts dt {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--faint);
}
.doc-facts dd { margin: 0; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.doc-section { margin: 2rem 0 0; break-inside: avoid; }
.doc-section > h2 {
  font-family: var(--serif);
  font-size: 1.16rem;
  color: var(--text-strong);
  margin: 0 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.doc-section > h2 .count { font-family: var(--font); font-size: 0.78rem; color: var(--muted); font-weight: 700; }
.doc-list { margin: 0; padding-left: 1.2rem; }
.doc-list li { margin: 0.3rem 0; line-height: 1.6; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.doc-table th, .doc-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--line);
}
.doc-table th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--faint);
  border-bottom: 1px solid var(--line-strong);
}
.doc-foot {
  margin-top: 2.4rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--faint);
}
@media (max-width: 680px) {
  .doc-page { margin: 0.75rem; padding: 1.4rem 1.2rem 2rem; }
  .doc-toolbar { margin: 0.75rem; }
}

/* ── 24. Impression ────────────────────────────────────────────────────── */
@media print {
  @page { margin: 14mm 14mm 16mm; }
  :root { --prose-leading: 1.5; }
  html, body {
    background: #fff !important;
    color: #000 !important;
    font-size: 10.5pt;
  }
  .sidebar, .sidebar-backdrop, .shell-top, .footer,
  .toolbar, .hero-actions, .panel-head-actions, .doc-toolbar,
  .sidebar-toggle, .skip-link, .toast-host, dialog, .no-print,
  .readable-toggle, form.filters, .actions, .btn,
  .attachment-actions, .seg { display: none !important; }
  .shell { margin: 0 !important; padding: 0 !important; max-width: none !important; }
  .main { margin: 0 !important; }
  .grid-2 { display: block !important; }
  .panel {
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    break-inside: avoid;
    margin-bottom: 10pt;
    background: #fff !important;
  }
  .panel-head { background: #f3f3f3 !important; }
  .hero {
    background: #fff !important;
    color: #000 !important;
    border: 0 !important;
    border-bottom: 2pt solid #c8102e !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 0 8pt !important;
    margin-bottom: 12pt !important;
  }
  .hero::before { display: none !important; }
  .hero h1, .hero .hero-kicker { color: #000 !important; }
  .hero p, .hero .muted, .hero-meta .muted { color: #333 !important; }
  .readable-clamped {
    max-height: none !important;
    overflow: visible !important;
    mask-image: none !important;
    -webkit-mask-image: none !important;
  }
  .doc-page {
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    max-width: none !important;
    background: #fff !important;
  }
  .table-wrap { overflow: visible !important; max-height: none !important; }
  .panel-sticky > .panel-sticky-head { position: static !important; box-shadow: none !important; }
  table.data { min-width: 0 !important; font-size: 9.5pt; }
  table.data thead th {
    position: static !important;
    background: #f3f3f3 !important;
    color: #000 !important;
  }
  table.data tbody tr { background: #fff !important; }
  .badge, .hero .badge { border: 1pt solid #bbb !important; background: #fff !important; color: #000 !important; }
  a { color: #000 !important; text-decoration: none !important; }
  .rich-content, .prose, .description { max-width: none !important; }
  .description { background: #fafafa !important; border-left: 2pt solid #c8102e !important; }
  .verbatim-box { max-height: none !important; }
}

/* === D-ID Voice : ajouts a l'impression === */
@media print {
  .transcript { max-height: none !important; overflow: visible !important; border: 0 !important; background: #fff !important; }
  .tok-id { color: #000 !important; background: #f0f0f0 !important; border-bottom: 1pt solid #000 !important; }
  .tok-now { outline: 0 !important; }
  .progress, .ab-tools, .ab-card audio, .remask-bar { display: none !important; }
  .vault-body.is-hidden { display: block !important; }
  .local-seal { display: none !important; }
}
