/* =====================================================================
   Cabinet Pro — Design System
   ===================================================================== */

@font-face {
  font-family: 'Inter';
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  src: url('../fonts/InterVariable.woff2') format('woff2-variations');
}
@font-face {
  font-family: 'Inter';
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
  src: url('../fonts/InterVariable-Italic.woff2') format('woff2-variations');
}

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'SF Mono', Menlo, Consolas, monospace;

  /* Couleurs (clair) */
  --bg: #F7F7F8;
  --bg-elevated: #FFFFFF;
  --bg-sidebar: #FAFAFB;
  --bg-hover: #F0F0F2;
  --bg-active: #E8E9EE;
  --bg-input: #FFFFFF;
  --bg-overlay: rgba(15, 23, 42, 0.4);

  --text: #0F172A;
  --text-soft: #475569;
  --text-mute: #64748B;
  --text-on-primary: #FFFFFF;

  --border: #E5E7EB;
  --border-strong: #CBD5E1;

  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --primary-soft: #DBEAFE;
  --primary-text-on-soft: #1E40AF;

  --accent: #14B8A6;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #06B6D4;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -2px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.10), 0 10px 10px -5px rgba(15, 23, 42, 0.04);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --sidebar-w: 248px;
  --topbar-h: 56px;
  --transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Espacement (workspace clinique) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  --clinical-aside-w: 300px;
  --focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.22);

  /* ---------------------------------------------------------------
     Alias de compatibilité — tokens employés par les vues mais jamais
     définis dans :root. Sans eux, var(--x, fallback) tombait toujours
     sur le fallback (souvent #fff) → îlots clairs en thème sombre.
     Ils pointent vers les tokens réels et suivent donc le thème.
     --------------------------------------------------------------- */
  --bg-elev: var(--bg-elevated);
  --bg-card: var(--bg-elevated);
  --surface: var(--bg-elevated);
  --bg-2: var(--bg-hover);
  --bg-mute: var(--bg-hover);
  --bg-soft: var(--bg-hover);
  --bg-subtle: var(--bg-hover);
  --bg-sunk: var(--bg);
  --border-faint: var(--border);
  --border-subtle: var(--border);
  --text-primary: var(--text);
  --text-secondary: var(--text-soft);
  --text-muted: var(--text-mute);
  --text-500: var(--text-soft);
  --primary-light: var(--primary-soft);
  --brand-soft: var(--primary-soft);
  /* Encadrés de statut (thème clair) */
  --success-bg: #D1FAE5;
  --warning-bg: #FEF3C7;
  --warn-bg: #FEF3C7;
  --warn-text: #92400E;
  --ok-bg: #D1FAE5;
  --ok-text: #065F46;
  --info-bg: #DBEAFE;
  --info-text: #1E40AF;
  --danger-text: #B91C1C;
}

[data-theme='dark'] {
  --bg: #0B0F19;
  --bg-elevated: #131826;
  --bg-sidebar: #0F1320;
  --bg-hover: #1B2030;
  --bg-active: #232940;
  --bg-input: #161C2C;
  --bg-overlay: rgba(0, 0, 0, 0.6);

  --text: #F1F5F9;
  --text-soft: #CBD5E1;
  --text-mute: #64748B;

  --border: #1F2937;
  --border-strong: #334155;

  --primary: #3B82F6;
  --primary-hover: #2563EB;
  --primary-soft: rgba(59, 130, 246, 0.15);
  --primary-text-on-soft: #93C5FD;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 20px 35px rgba(0, 0, 0, 0.5);

  /* Encadrés de statut (thème sombre) — esprit des fallbacks d'origine */
  --success-bg: rgba(16, 185, 129, 0.15);
  --warning-bg: rgba(245, 158, 11, 0.15);
  --warn-bg: #4A3A1A;
  --warn-text: #F0C674;
  --ok-bg: #1E3A2A;
  --ok-text: #7FD99F;
  --info-bg: #1C2E3E;
  --info-text: #8FC1E3;
  --danger-text: #FCA5A5;
}

/* =====================================================================
   Reset
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; }
body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss03', 'cv02';
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
/* Focus HOMOGÈNE par défaut sur tout champ de saisie (recherche, inputs ad hoc) :
   bordure primaire + anneau doux, identique aux champs déjà stylés (.form-field,
   .rx-field…). Les règles par composant gardent la priorité (spécificité ≥). */
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}

/* Accessibilité : focus visible clavier */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
button:focus:not(:focus-visible),
a:focus:not(:focus-visible) { outline: none; }
a { color: inherit; text-decoration: none; transition: color var(--transition); }
ul, ol { margin: 0; padding: 0; list-style: none; }
/* Titres : interlettrage légèrement négatif = rendu plus net et compact (look produit moderne). */
h1, h2, h3, h4, h5 { margin: 0; font-weight: 600; letter-spacing: -0.012em; }
h1 { letter-spacing: -0.02em; }
svg { display: block; }

/* Scrollbars fines & flottantes : pouce arrondi détaché du bord (padding-box),
   discret au repos, plus marqué au survol. Plus léger que la barre 10px pleine. */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
  border: 3px solid transparent;
  background-clip: padding-box;
  transition: background-color var(--transition);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-mute); background-clip: padding-box; }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

/* Accessibilité : respecter « réduire les animations » du système (WCAG 2.3.3) */
@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;
  }
}

/* Recherche ⌘K : élément mis en évidence par les flèches clavier */
.result-item.active { background: var(--bg-hover); }
.desktop-back-btn:disabled { opacity: .35; cursor: default; }
/* Séparateur vertical léger entre sous-groupes de boutons */
.tools-sep { width: 1px; align-self: stretch; min-height: 18px; background: var(--border); margin: 0 4px; flex: 0 0 auto; }
/* Menu déroulant « ⋯ » (overflow) basé sur <details> */
.chip-menu { position: relative; display: inline-block; }
.chip-menu > summary { list-style: none; cursor: pointer; }
.chip-menu > summary::-webkit-details-marker { display: none; }
.chip-menu-pop {
  position: absolute; top: 100%; right: 0; margin-top: 4px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 6px; display: flex; flex-direction: column; gap: 4px;
  z-index: 50; min-width: 190px;
}
.chip-menu-pop .btn-chip, .chip-menu-pop button { width: 100%; justify-content: flex-start; text-align: left; }

/* =====================================================================
   Layout
   ===================================================================== */
#app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
}

/* Sidebar */
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 12px;
  padding-top: 36px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  user-select: none;
  -webkit-app-region: drag;
}
.sidebar > * { -webkit-app-region: no-drag; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin-bottom: 8px;
}
.brand-mark {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  position: relative;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.brand-mark::before {
  content: '';
  position: absolute;
  inset: 8px;
  background: white;
  clip-path: polygon(40% 0, 60% 0, 60% 40%, 100% 40%, 100% 60%, 60% 60%, 60% 100%, 40% 100%, 40% 60%, 0 60%, 0 40%, 40% 40%);
}
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.brand-sub { font-size: 11px; color: var(--text-mute); }

.search-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-mute);
  font-size: 13px;
  margin-bottom: 8px;
  transition: var(--transition);
}
.search-trigger:hover { border-color: var(--border-strong); color: var(--text-soft); }
.search-trigger span { flex: 1; text-align: left; }
.search-trigger kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 5px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-mute);
}

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-section {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-mute);
  padding: 16px 10px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--text-soft);
  font-weight: 500;
  font-size: 13.5px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke-width: 2;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary-text-on-soft);
  font-weight: 600;
}
.nav-item .badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: var(--danger);
  color: white;
  min-width: 18px;
  text-align: center;
}

/* Zone « Système & IA » — outils non cliniques (assistant IA, monitoring GPU,
   paramètres). Volontairement DISCRÈTE : séparée par un filet et atténuée, pour
   que les entrées cliniques dominent la sidebar (logique DMI). */
.nav-section--system {
  margin-top: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.nav-item--system {
  color: var(--text-mute);
  font-size: 13px;
  font-weight: 500;
}
.nav-item--system svg { width: 16px; height: 16px; opacity: 0.85; }
.nav-item--system:hover { color: var(--text); }
.nav-item--system.active { color: var(--primary-text-on-soft); }

.sidebar-footer {
  margin-top: auto;
  padding: 8px 4px 4px;
  position: sticky;
  bottom: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg-sidebar);
}
.sidebar-pins {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sidebar-pins:not(:has(> *:not([hidden]))) { display: none; }
.ai-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--text-soft);
}
.ai-status .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-mute);
  flex-shrink: 0;
}
.ai-status.ok .dot { background: var(--success); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2); }
.ai-status.error .dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2); }

/* Main */
.main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  flex-shrink: 0;
  -webkit-app-region: drag;
}
.topbar > * { -webkit-app-region: no-drag; }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 8px; }
.page-title { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }

.view {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px 48px;
}

/* =====================================================================
   Boutons
   ===================================================================== */
.btn-primary, .btn-secondary, .btn-ghost, .btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.btn-ghost {
  background: transparent;
  color: var(--text-soft);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { background: #DC2626; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* Micro-interactions cohérentes pour TOUS les boutons d'action :
   - pression tactile au clic (s'enfonce d'1px),
   - anneau de focus clavier doux (a11y) au lieu de l'outline système,
   - le primaire prend un peu d'élévation au survol. */
.btn-primary:active, .btn-secondary:active, .btn-ghost:active, .btn-danger:active {
  transform: translateY(0.5px);
}
.btn-primary:focus-visible, .btn-secondary:focus-visible, .btn-ghost:focus-visible, .btn-danger:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.btn-primary:hover { box-shadow: var(--shadow-md); }
.btn-primary:disabled, .btn-secondary:disabled, .btn-ghost:disabled, .btn-danger:disabled {
  opacity: .55; cursor: not-allowed; box-shadow: none; transform: none;
}
.icon-btn:active { transform: translateY(0.5px); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--text-soft);
  transition: var(--transition);
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }

/* =====================================================================
   Cartes & sections
   ===================================================================== */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card-h {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.card-h h2 { font-size: 14px; color: var(--text-soft); font-weight: 600; }

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.kpi-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.kpi-card .kpi-label {
  font-size: 12px;
  color: var(--text-soft);
  font-weight: 500;
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}
.kpi-card .kpi-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.kpi-card .kpi-sub {
  font-size: 12px;
  color: var(--text-mute);
  margin-top: 4px;
}
.kpi-card .kpi-icon {
  position: absolute;
  top: 16px; right: 16px;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft);
  color: var(--primary-text-on-soft);
  border-radius: 10px;
}
.kpi-card .kpi-icon svg { width: 18px; height: 18px; }

/* =====================================================================
   Tableau de bord (dashboard)
   ===================================================================== */
.dash-root { display: flex; flex-direction: column; gap: 16px; }

/* Hero — bandeau date + résumé du jour */
.dash-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  padding: 20px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  background:
    radial-gradient(135% 135% at 0% 0%, rgba(37, 99, 235, 0.10), transparent 55%),
    radial-gradient(120% 120% at 100% 0%, rgba(20, 184, 166, 0.08), transparent 55%),
    var(--bg-elevated);
}
.dash-hero-over {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-mute);
}
.dash-hero-day {
  font-size: 23px; font-weight: 700; letter-spacing: -0.02em;
  text-transform: capitalize; margin-top: 2px;
}
.dash-hero-stats { display: flex; gap: 26px; flex-shrink: 0; }
.dash-hero-stat { font-size: 12px; color: var(--text-soft); text-align: right; }
.dash-hero-stat b {
  display: block; font-size: 22px; font-weight: 700; line-height: 1.1;
  color: var(--text); font-variant-numeric: tabular-nums;
}

/* Bandeaux d'attention (alertes / rappels / demandes) */
.dash-attention { display: flex; flex-direction: column; gap: 8px; }
.dash-banner {
  display: flex; align-items: center; flex-wrap: wrap;
  padding: 10px 14px; border-radius: var(--radius);
  font-size: 13px; cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
}
.dash-banner:hover { filter: brightness(0.985); }
.dash-banner strong { font-weight: 700; }
.dash-banner .dash-banner-sub { color: var(--text-soft); }
.dash-banner.is-danger  { background: rgba(239, 68, 68, 0.07);  border-color: rgba(239, 68, 68, 0.20);  }
.dash-banner.is-danger  strong { color: var(--danger); }
.dash-banner.is-warning { background: rgba(245, 158, 11, 0.08); border-color: rgba(245, 158, 11, 0.22); }
.dash-banner.is-warning strong { color: var(--warning); }
.dash-banner.is-info    { background: rgba(6, 182, 212, 0.08);  border-color: rgba(6, 182, 212, 0.22);  }
.dash-banner.is-info    strong { color: var(--info); }

/* Agenda — « Aujourd'hui » + « À suivre » côte à côte.
   align-items:start → chaque carte garde sa hauteur naturelle (la carte vide
   ne s'étire pas à la hauteur de la plus longue). */
.dash-agenda { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
/* Worklists cliniques en tête (résultats à relire + demandes à traiter) :
   2 colonnes qui se réduisent à 1 si étroit, et une seule carte visible occupe
   toute la largeur (auto-fit ignore la carte masquée si l'autre est vide). */
.dash-worklists { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.dash-worklists:empty { display: none; }
.dash-count {
  font-size: 12px; font-weight: 600; color: var(--text-mute);
  background: var(--bg-hover); padding: 2px 9px; border-radius: var(--radius-full);
}
.dash-empty {
  color: var(--text-mute); font-size: 13px;
  padding: 22px 4px; text-align: center;
}
.dash-appt-list { display: flex; flex-direction: column; gap: 2px; }
.dash-appt {
  display: flex; gap: 12px; align-items: center;
  padding: 9px 10px; border-radius: 10px; cursor: pointer;
  transition: background var(--transition);
}
.dash-appt:hover { background: var(--bg-hover); }
.dash-appt-time {
  font-family: var(--font-mono); font-size: 13px; font-weight: 600;
  min-width: 46px; color: var(--text-soft);
}
.dash-appt-main { flex: 1; min-width: 0; }
.dash-appt-name {
  font-weight: 600; font-size: 13.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dash-appt-sub {
  font-size: 11.5px; color: var(--text-mute); margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dash-appt-chev { color: var(--text-mute); font-size: 16px; font-weight: 300; }

/* Pastille date pour « À suivre » */
.dash-daychip {
  text-align: center; min-width: 48px;
  background: var(--bg-hover); border-radius: 10px; padding: 5px 4px;
}
.dash-daychip .dc-wd {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-mute);
}
.dash-daychip .dc-d { font-size: 18px; font-weight: 700; line-height: 1.15; }
.dash-daychip.is-tomorrow { background: var(--primary-soft); }
.dash-daychip.is-tomorrow .dc-wd,
.dash-daychip.is-tomorrow .dc-d { color: var(--primary-text-on-soft); }

/* Réception — bandeau relégué en bas */
.dash-reception {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; cursor: pointer;
  transition: var(--transition);
}
.dash-reception:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.dash-reception.has-pending {
  border-color: rgba(37, 99, 235, 0.30);
  background: rgba(37, 99, 235, 0.04);
}
.dash-reception-ic {
  width: 38px; height: 38px; flex-shrink: 0; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-hover); border-radius: 10px;
}
.dash-reception-main { flex: 1; min-width: 0; }
.dash-reception-title { font-weight: 600; font-size: 14px; }
.dash-reception-sub { font-size: 12px; color: var(--text-mute); margin-top: 1px; }

/* Tournée du jour — itinéraire optimal des visites à domicile */
.dash-route-note { font-size: 12.5px; color: var(--text-soft); padding: 4px 0 2px; }
.dash-route-note.is-warn {
  background: #fef3c7; color: #92400e;
  padding: 8px 11px; border-radius: var(--radius-sm); margin-top: 6px;
}
.dash-route-note code { font-size: 12px; }
.dash-route-actions { margin-top: 12px; display: flex; justify-content: flex-end; }

.route-list { display: flex; flex-direction: column; margin-top: 8px; }
.route-stop {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 8px 8px; border-radius: 10px;
  transition: background var(--transition);
}
.route-stop:hover { background: var(--bg-hover); }
.route-stop.is-missing { background: rgba(245, 158, 11, 0.06); align-items: center; }
.route-badge {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; background: var(--primary);
}
.route-badge.is-first { background: var(--accent); }
.route-badge.is-missing { background: #f59e0b; }
.route-stop-main { flex: 1; min-width: 0; }
.route-stop-name { font-weight: 600; font-size: 13.5px; }
.route-stop-time { color: var(--text-mute); font-weight: 500; }
.route-addr {
  font-size: 12.5px; color: var(--text-soft); margin-top: 1px;
  cursor: pointer; text-decoration: underline; text-decoration-color: transparent;
  transition: text-decoration-color var(--transition);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.route-addr:hover { text-decoration-color: currentColor; }
.route-addr.is-empty { color: var(--text-mute); cursor: default; text-decoration: none; font-style: italic; }
/* Lien « ✎ modifier » sous une adresse affichée */
.route-edit-link {
  background: none; border: none; padding: 2px 0; margin-top: 1px;
  font-size: 11.5px; color: var(--text-mute); cursor: pointer;
}
.route-edit-link:hover { color: var(--primary); text-decoration: underline; }
/* Connecteur trajet entre deux étapes (et départ/retour domicile) */
.route-leg {
  font-size: 11.5px; color: var(--text-mute);
  padding: 3px 0 3px 38px; line-height: 1.2;
}
.route-leg.is-home { color: var(--text-soft); font-weight: 500; padding-left: 8px; }
/* Éditeur d'adresse inline (pour les visites sans adresse) */
.route-edit { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.route-inp {
  flex: 1; min-width: 120px; padding: 5px 8px; font-size: 12.5px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-elevated); color: var(--text);
}
.route-inp:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }
.route-inp.route-inp-cp { flex: 0 0 70px; min-width: 70px; }
/* Autocomplétion d'adresse (type-ahead Photon) */
.route-typeahead { position: relative; flex: 1; min-width: 150px; display: flex; }
.route-typeahead .route-inp { flex: 1; min-width: 0; }
.route-suggest {
  position: absolute; top: calc(100% + 3px); left: 0; right: 0; z-index: 60;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  max-height: 240px; overflow-y: auto;
}
.route-suggest-item { padding: 7px 10px; font-size: 12.5px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.route-suggest-item:hover, .route-suggest-item.active { background: var(--bg-hover); }

@media (max-width: 1100px) {
  .dash-agenda { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .dash-hero { flex-direction: column; align-items: flex-start; gap: 12px; padding: 16px; }
  .dash-hero-stats { gap: 22px; }
  .dash-hero-stat { text-align: left; }
}

/* =====================================================================
   Tables
   ===================================================================== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.data-table thead th {
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  position: sticky; top: 0;
  z-index: 1;
}
.data-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.data-table tbody tr { transition: background var(--transition); cursor: pointer; }
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table tbody tr.empty { cursor: default; }
.data-table tbody tr.empty td { text-align: center; color: var(--text-mute); padding: 40px 14px; }

.table-wrap {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

/* =====================================================================
   Forms
   ===================================================================== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 16px;
}
.form-grid .full { grid-column: 1 / -1; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field > label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-soft);
}
.form-field > label .required { color: var(--danger); }
.form-field input, .form-field select, .form-field textarea {
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: var(--transition);
  font-size: 13.5px;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.form-field textarea { resize: vertical; min-height: 80px; font-family: inherit; line-height: 1.55; }
.form-field .hint { font-size: 11px; color: var(--text-mute); }

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.toolbar .grow { flex: 1; }
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 12px;
  flex: 1; max-width: 480px;
  transition: var(--transition);
}
.search-bar:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.search-bar svg { width: 16px; height: 16px; color: var(--text-mute); }
.search-bar input {
  border: none; outline: none; background: transparent; flex: 1;
  font-size: 13.5px;
}

/* Pills / badges */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: var(--bg-hover);
  color: var(--text-soft);
}
.pill.primary { background: var(--primary-soft); color: var(--primary-text-on-soft); }
.pill.success { background: rgba(16, 185, 129, 0.12); color: var(--ok-text); }
.pill.warning { background: rgba(245, 158, 11, 0.12); color: var(--warn-text); }
.pill.danger { background: rgba(239, 68, 68, 0.12); color: var(--danger-text); }
.pill.info { background: rgba(6, 182, 212, 0.12); color: var(--info-text); }
.pill .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; margin-right: 6px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  color: white;
}

/* =====================================================================
   Modales
   ===================================================================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 80px 24px 24px;
  animation: modalIn 150ms ease-out;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal-content {
  position: relative;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  max-width: 640px;
  width: 100%;
  max-height: calc(100vh - 100px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: var(--bg);
}

.search-modal { padding: 0; max-width: 720px; }
.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.search-input-wrap svg { color: var(--text-mute); }
.search-input-wrap input {
  flex: 1; border: none; outline: none; background: transparent;
  font-size: 16px;
}
.search-input-wrap kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 7px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-mute);
}
.search-results {
  max-height: 60vh;
  overflow-y: auto;
  padding: 8px;
}
.search-results .group-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 12px 12px 6px;
}
.search-results .result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}
.search-results .result-item:hover,
.search-results .result-item.active {
  background: var(--bg-hover);
}
.result-item .label { font-weight: 500; font-size: 13.5px; }
.result-item .sub { font-size: 12px; color: var(--text-mute); margin-top: 1px; }
.result-item mark { background: rgba(245, 158, 11, 0.25); color: inherit; padding: 0 2px; border-radius: 2px; }

/* ===== Cockpit V2 — option « Demander à l'IA » + réponse inline dans ⌘K ===== */
.search-results .result-item--ai {
  background: linear-gradient(90deg, var(--primary-soft) 0%, transparent 90%);
  border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent);
  margin-bottom: 6px;
}
.search-results .result-item--ai:hover,
.search-results .result-item--ai.active {
  background: linear-gradient(90deg, var(--primary-soft) 0%, var(--bg-hover) 95%);
}
.result-item--ai .label { color: var(--primary-text-on-soft); font-weight: 600; }
.cockpit-ai-spark { font-size: 15px; flex-shrink: 0; }
.cockpit-ai-kbd {
  margin-left: auto; font-size: 11px; color: var(--primary-text-on-soft);
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 2px 7px; font-weight: 600; flex-shrink: 0;
}
.cockpit-ai { padding: 6px 6px 10px; }
.cockpit-ai-q {
  display: flex; gap: 8px; align-items: flex-start; font-weight: 600; font-size: 14px;
  color: var(--text); padding: 4px 0 12px; border-bottom: 1px solid var(--border); margin-bottom: 12px;
}
.cockpit-ai-thinking { display: flex; gap: 9px; align-items: center; color: var(--text-mute); font-size: 13px; padding: 4px 0; }
.cockpit-ai-steps { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.cockpit-ai-step {
  font-family: var(--font-mono); font-size: 11.5px; color: var(--text-soft);
  background: var(--bg-hover); border-radius: var(--radius-sm); padding: 5px 9px;
}
.cockpit-ai-a { white-space: pre-wrap; line-height: 1.62; font-size: 13.5px; color: var(--text); }
.cockpit-ai-err { color: var(--danger); font-size: 13px; padding: 6px 0; }

.quick-modal { max-width: 520px; padding: 24px; }
.quick-modal h3 { font-size: 16px; margin-bottom: 18px; }
.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.quick-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: var(--transition);
  font-weight: 500;
  font-size: 13.5px;
}
.quick-card:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-text-on-soft);
}
.quick-card svg { width: 24px; height: 24px; color: var(--primary); }
.form-modal { max-width: 720px; }

/* Modal taille intermédiaire (formulaires structurés type prescription) */
.modal-content.modal-md { max-width: 840px; }

/* =====================================================================
   FORMULAIRE PRESCRIPTION (refonte — sections groupées, switch propre)
   ===================================================================== */
.rx-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.rx-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  overflow: hidden;
}
.rx-section-h {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.rx-section-icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--primary-soft);
  color: var(--primary-text-on-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.rx-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-soft);
}
.rx-section-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rx-row {
  display: grid;
  gap: 10px;
  align-items: end;
}
.rx-row-2 { grid-template-columns: 1fr 1fr; }
.rx-row-3 { grid-template-columns: 1.5fr 1fr 1fr; }
.rx-row-4 { grid-template-columns: 1.5fr 1fr 1fr 1fr; }
.rx-switches { align-items: center; }
@media (max-width: 700px) {
  .rx-row-2, .rx-row-3, .rx-row-4 { grid-template-columns: 1fr; }
}

/* ─── Boutons-toggle Statut (Chronique / Aigu / Une fois / Si besoin) ─── */
.rx-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.rx-btn-toggle {
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: all 0.12s;
}
.rx-btn-toggle:hover { background: var(--bg-hover, var(--bg-elevated)); }
.rx-btn-toggle.active {
  background: var(--primary, #4f46e5);
  color: #fff;
  border-color: var(--primary, #4f46e5);
}

/* ─── Onglets Posologie (Simple / Texte libre / Modèle) ───────────────── */
.rx-tabs-h {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.rx-tab {
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 500;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-soft);
  cursor: pointer;
  transition: all 0.15s;
}
.rx-tab:hover { color: var(--text); }
.rx-tab.active {
  color: var(--primary, #4f46e5);
  border-bottom-color: var(--primary, #4f46e5);
}
.rx-tab-pane { padding: 4px 0; }
.rx-tab-stub {
  padding: 16px;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  font-size: 12.5px;
  color: var(--text-mute);
  font-style: italic;
  text-align: center;
}

/* ─── Matrice posologie simple (Matin / Midi / Soir / Coucher) ────────── */
.rx-poso-simple {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rx-poso-matrix {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.rx-poso-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.rx-poso-slot-l {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-mute);
}
.rx-poso-slot input {
  width: 60px;
  text-align: center;
  padding: 6px 4px;
  font-size: 14px;
  font-weight: 600;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.rx-poso-slot input:not(:placeholder-shown):not([value="0"]) {
  background: var(--primary-soft, #ede9fe);
  color: var(--primary, #4f46e5);
  border-color: var(--primary, #4f46e5);
}
.rx-poso-freq {
  display: flex;
  align-items: center;
  gap: 10px;
}
.rx-poso-freq label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-mute);
}
.rx-poso-freq select {
  flex: 1;
  padding: 7px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
}
@media (max-width: 700px) {
  .rx-poso-matrix { grid-template-columns: repeat(2, 1fr); }
}
.rx-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.rx-field-wide { min-width: 0; }
.rx-field-full { grid-column: 1 / -1; }
.rx-field > label {
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-mute);
}
.rx-req { color: var(--danger); margin-left: 2px; }
.rx-field input,
.rx-field textarea,
.rx-field select {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}
.rx-field textarea { resize: vertical; min-height: 64px; line-height: 1.5; }
.rx-field input:focus,
.rx-field textarea:focus,
.rx-field select:focus {
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}

/* Suggestions médicament SAMv2 */
.rx-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-height: 420px;
  overflow-y: auto;
  z-index: 6;
  display: none;
}
.rx-suggestion {
  padding: 9px 12px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}
.rx-suggestion:last-child { border-bottom: none; }
.rx-suggestion:hover, .rx-suggestion.active { background: var(--bg-hover); }
.rx-suggestion.active { box-shadow: inset 2px 0 0 var(--primary); }

/* Infos SAMv2 (prix public, délivrance, CBIP) — suggestions + panier */
.rx-dlv-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
  vertical-align: 1px;
}
.rx-dlv-free { background: rgba(22,163,74,.12); color: #15803d; border: 1px solid rgba(22,163,74,.35); }
.rx-dlv-special { background: rgba(217,119,6,.12); color: #b45309; border: 1px solid rgba(217,119,6,.35); }
.rx-dlv-rx { background: var(--bg-input); color: var(--text-soft); border: 1px solid var(--border); }
.rx-cart-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 2px 0 6px;
  font-size: 11.5px;
}
.rx-cart-info .rx-dlv-badge { margin-left: 0; }
.rx-cart-price { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.rx-cart-noremb { color: var(--text-mute); font-size: 10.5px; }
.rx-cbip-link {
  margin-left: auto;
  border: none;
  background: transparent;
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 1px 4px;
}
.rx-cbip-link:hover { text-decoration: underline; }
.rx-chap4-btn { cursor: pointer; }
.rx-chap4-panel {
  margin: 4px 0 8px;
  padding: 8px 10px;
  border: 1px dashed rgba(217,119,6,.45);
  border-radius: 8px;
  background: rgba(217,119,6,.05);
  font-size: 12px;
}
.rx-chap4-panel input {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg-input);
  color: var(--text);
  font-size: 12px;
}
.rx-chap4-result { margin-top: 6px; font-size: 11.5px; }

/* Schéma de médication interactif (poste de consultation) */
.consult-medscheme {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px 6px;
  margin: 6px 0;
}
.cms-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12.5px;
  padding-bottom: 6px;
}
.cms-hint { font-size: 11px; color: var(--text-mute); }
.cms-body {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1px 18px;
}
.cms-group {
  grid-column: 1 / -1;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 6px 0 2px;
}
.cms-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 6px 3px 8px;
  border-radius: 7px;
  box-shadow: inset 2px 0 0 var(--cms-tone, var(--border));
}
.cms-row:hover { background: var(--bg-hover); }
.cms-dot {
  width: 8px; height: 8px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--cms-tone, var(--border));
}
.cms-med { flex: 1; min-width: 0; }
.cms-act {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-mute);
  cursor: pointer;
  font-size: 12px;
  opacity: .35;
}
.cms-row:hover .cms-act { opacity: 1; }
.cms-act.on { color: #16a34a; opacity: 1; }
.cms-act:hover { background: var(--bg-hover); }
.cms-del:hover { color: var(--danger); }
.cms-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cms-sub {
  font-size: 10.5px;
  color: var(--text-mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Groupes Chronique/Aigu du schéma (colonne gauche du composeur) */
.rx-schema-group {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 8px 10px 3px;
}

/* Historique des prescriptions (colonne gauche du composeur, vue 📜) */
.rx-hist-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.rx-hist-row:hover { background: var(--bg-hover); }
.rx-hist-row:hover .rx-hist-add { opacity: 1; }
.rx-hist-date {
  width: 64px;
  flex-shrink: 0;
  font-size: 11px;
  color: var(--text-mute);
  font-variant-numeric: tabular-nums;
}
.rx-hist-med { flex: 1; min-width: 0; }
.rx-hist-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rx-hist-sub {
  font-size: 11px;
  color: var(--text-mute);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rx-hist-add {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--primary-soft, #dbeafe);
  color: var(--primary);
  font-weight: 700;
  opacity: .45;
}
.rx-suggestion-name { font-weight: 500; color: var(--text); }
.rx-suggestion-meta { color: var(--text-mute); font-size: 11px; white-space: nowrap; align-self: center; }

/* Switch (toggle) Renouvelable */
.rx-switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
  padding: 8px 0;
  align-self: end;
}
.rx-switch input { position: absolute; opacity: 0; pointer-events: none; }
.rx-switch-track {
  position: relative;
  width: 38px;
  height: 22px;
  background: var(--border-strong, #cbd5e1);
  border-radius: 999px;
  transition: background .15s;
  flex-shrink: 0;
}
.rx-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform .15s;
}
.rx-switch input:checked ~ .rx-switch-track { background: var(--primary); }
.rx-switch input:checked ~ .rx-switch-track .rx-switch-thumb { transform: translateX(16px); }
.rx-switch-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}

/* ── Bannière d'alertes cliniques (allergie, fonction rénale, interactions) ── */
.rx-alert-banner {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rx-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid;
}
.rx-alert-icon { font-size: 18px; line-height: 1.2; flex-shrink: 0; }
.rx-alert-text { flex: 1; min-width: 0; }
.rx-alert-title {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}
.rx-alert-body { font-size: 12.5px; line-height: 1.45; }
.rx-alert-danger {
  background: rgba(239, 68, 68, 0.09);
  border-color: rgba(239, 68, 68, 0.35);
  color: #991b1b;
}
.rx-alert-warning {
  background: rgba(245, 158, 11, 0.10);
  border-color: rgba(245, 158, 11, 0.35);
  color: #92400e;
}
.rx-alert-info {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.35);
  color: #1e40af;
}

/* ── Hint historique (sous le champ médicament) ────────────────────────────── */
.rx-history-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius);
  font-size: 12px;
  color: #4338ca;
}
.rx-history-icon { font-size: 14px; }
.rx-history-clear {
  margin-left: auto;
  background: transparent;
  border: none;
  font-size: 14px;
  color: var(--text-mute);
  cursor: pointer;
  padding: 0 4px;
}
.rx-history-clear:hover { color: var(--danger); }

/* =====================================================================
   PRESCRIPTION — POLISH (2026-05-29)
   Remplace les styles inline par le design system : liste d'actions
   compacte (fini le wrap sur 4 lignes), panier + cartes médicament /
   magistrale harmonisés, recherche catalogue, aperçu « Rp/ ».
   ===================================================================== */

/* ── Liste : actions compactes sur une seule ligne ─────────────────────── */
.rx-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}
.rx-act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: var(--transition);
}
.rx-act:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border-strong); }
.rx-act.is-primary { color: var(--primary); border-color: var(--primary-soft); background: var(--primary-soft); }
.rx-act.is-primary:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.rx-act.is-danger:hover { background: rgba(239, 68, 68, 0.10); color: var(--danger); border-color: rgba(239, 68, 68, 0.45); }
.rx-act-label { width: auto; padding: 0 11px; gap: 5px; font-size: 12px; font-weight: 600; }

/* ── Modal création : colonne « Ajouter / À prescrire » ─────────────────── */
.rx-cart-col {
  width: 360px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  padding-left: var(--space-3);
  display: flex;
  flex-direction: column;
}
.rx-cart-subhead {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-soft);
  margin-bottom: var(--space-2);
}
.rx-cart-subhead.mt { margin-top: var(--space-4); }
.rx-cart-count {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  color: var(--primary-text-on-soft);
  background: var(--primary-soft);
  border-radius: var(--radius-full);
  padding: 1px 8px;
  text-transform: none;
  letter-spacing: 0;
}
.rx-cart-list {
  flex: 1;
  min-width: 0;
  max-height: 340px;
  overflow-y: auto;
  padding: 2px;
  margin: 0 -2px;
}
.rx-cart-empty {
  color: var(--text-mute);
  font-size: 12px;
  padding: 22px 14px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  line-height: 1.5;
}

/* ── Carte panier (médicament & magistrale) ─────────────────────────────── */
.rx-cart-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  padding: 10px;
  margin-bottom: var(--space-2);
  box-shadow: var(--shadow-sm);
}
.rx-cart-card.is-magistral {
  border-color: var(--accent);
  background: linear-gradient(0deg, rgba(20, 184, 166, 0.05), rgba(20, 184, 166, 0.05)), var(--bg-elevated);
  padding-left: 12px;
}
.rx-cart-card.is-magistral::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  border-radius: var(--radius) 0 0 var(--radius);
  background: var(--accent);
}
.rx-cart-card-h {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: var(--space-2);
}
.rx-cart-name { font-weight: 600; font-size: 13px; color: var(--text); flex: 1; min-width: 0; line-height: 1.35; }
.rx-cart-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
}
.rx-cart-x {
  flex-shrink: 0;
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-mute);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: var(--transition);
}
.rx-cart-x:hover { background: rgba(239, 68, 68, 0.10); color: var(--danger); }
.rx-cart-meta { font-size: 10.5px; color: var(--text-mute); margin-bottom: 6px; line-height: 1.4; }
.rx-cart-card input,
.rx-cart-card textarea,
.rx-cart-card select {
  width: 100%;
  padding: 7px 10px;
  font-size: 12.5px;
  font-family: inherit;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  outline: none;
  transition: var(--transition);
}
.rx-cart-card textarea { resize: vertical; line-height: 1.45; }
.rx-cart-card input:focus,
.rx-cart-card textarea:focus,
.rx-cart-card select:focus { border-color: var(--primary); box-shadow: var(--focus-ring); }
.rx-cart-fields { display: flex; gap: 6px; margin-top: 6px; }
.rx-cart-fields > * { flex: 1; min-width: 0; }
.rx-cart-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-mute);
  margin: 8px 0 3px;
}

/* ── Aperçu « Rp/ » (reflète exactement la preuve PPE imprimée) ─────────── */
.rx-rp-preview {
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px dashed var(--accent);
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.rx-rp-label { font-size: 9px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-mute); margin-bottom: 4px; }
.rx-rp-head { font-family: Calibri, system-ui, sans-serif; font-size: 12.5px; font-weight: 600; white-space: pre-wrap; color: var(--text); }
.rx-rp-poso { font-family: Calibri, system-ui, sans-serif; font-size: 12px; margin-top: 2px; white-space: pre-wrap; color: var(--text-soft); }

/* ── Recherche catalogue magistral (475 formules officielles) ───────────── */
.rx-mag-search {
  margin-top: 6px;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  padding: 8px;
  box-shadow: var(--shadow-sm);
}
.rx-mag-search > input {
  width: 100%;
  padding: 8px 10px;
  font-size: 12.5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  outline: none;
  margin-bottom: 6px;
}
.rx-mag-search > input:focus { border-color: var(--primary); box-shadow: var(--focus-ring); }
.rx-mag-count { font-size: 10px; color: var(--text-mute); margin: 2px 2px 6px; }
.rx-mag-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px;
  font-size: 12.5px;
  color: var(--text);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.rx-mag-item:hover { background: var(--bg-hover); }
.rx-mag-item-remb { font-size: 10px; font-weight: 700; color: var(--success); white-space: nowrap; }

/* ── Colonne gauche : schéma de médication (cases à cocher → panier) ─────── */
.rx-schema-head {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: var(--text-mute);
  padding: 4px 8px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-elevated);
  z-index: 1;
}
.rx-schema-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.rx-schema-row:hover { background: var(--bg-hover); }

/* ── Statut d'auto-save des documents (lettre / rapport) ──────────────────── */
.doc-save-status {
  font-size: 11px;
  color: var(--text-mute);
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  white-space: nowrap;
  font-weight: 500;
}
.doc-save-status.saved {
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.08);
}
.doc-save-status.error {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.08);
}

/* ── Vue scindée Édition / Aperçu A4 (lettres) ─────────────────────────────── */
.letter-mode-btns {
  display: flex;
  gap: 6px;
  margin: 8px 0 10px 0;
}
.letter-mode-btns .btn-chip.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-text-on-soft);
  font-weight: 600;
}
.letter-split {
  display: grid;
  gap: 14px;
  align-items: start;
}
.letter-split.mode-split { grid-template-columns: 1fr 1fr; }
.letter-split.mode-edit  { grid-template-columns: 1fr; }
.letter-split.mode-edit .letter-split-preview { display: none; }
.letter-split.mode-preview { grid-template-columns: 1fr; }
.letter-split.mode-preview .letter-split-edit { display: none; }
.letter-split.mode-preview .letter-split-preview { max-width: 800px; margin: 0 auto; }

.letter-split-edit textarea.letter-edit {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.55;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  resize: vertical;
  width: 100%;
}
.letter-split-edit textarea.letter-edit:focus {
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
  outline: none;
}

/* Page A4 simulée — ratio 1:1.414 (210×297mm) en pixels approx */
.letter-a4-page {
  background: white;
  color: #1f2937;
  padding: 40px 50px;
  min-height: 560px;
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
  font-family: Georgia, 'Times New Roman', Times, serif;
  font-size: 13px;
  line-height: 1.6;
  overflow-x: hidden;
}
.letter-a4-line {
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 1.6em;
}
/* Petite touche : barre de "papier" en haut comme une ligne d'en-tête */
.letter-a4-page::before {
  content: '';
  display: block;
  width: 100%;
  height: 0;
  border-top: 0;
  margin-bottom: 0;
}

/* Responsive : mobile / tablette → forcer mode édition */
@media (max-width: 1100px) {
  .letter-split.mode-split { grid-template-columns: 1fr; }
  .letter-split.mode-split .letter-split-preview { max-width: 700px; margin: 0 auto; }
}

/* ── Menu Reformuler (dropdown inline) ─────────────────────────────────────── */
.rx-reformulate {
  position: relative;
  display: inline-block;
}
.rx-reformulate summary {
  cursor: pointer;
  list-style: none;
}
.rx-reformulate summary::-webkit-details-marker { display: none; }
.rx-reformulate-items {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 200px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  padding: 4px;
  gap: 1px;
}
.rx-reformulate-item {
  background: transparent;
  border: none;
  text-align: left;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}
.rx-reformulate-item:hover {
  background: var(--bg-hover);
}
.rx-reformulate-item:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ── Barre Mes modèles (templates lettres) ───────────────────────────────── */
.rx-templates-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px 10px;
  background: rgba(99, 102, 241, 0.06);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius);
  margin-bottom: 10px;
}
.rx-templates-label {
  font-size: 11.5px;
  font-weight: 700;
  color: #4338ca;
  letter-spacing: 0.03em;
  margin-right: 4px;
}
.rx-template-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px 4px 10px;
  border: 1px solid rgba(99, 102, 241, 0.3);
  background: var(--bg-elevated);
  color: #4338ca;
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}
.rx-template-chip:hover { background: rgba(99, 102, 241, 0.10); }
.rx-template-chip-del {
  color: var(--text-mute);
  margin-left: 2px;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
}
.rx-template-chip-del:hover { color: var(--danger); }

/* =====================================================================
   RAPPELS & NOTES DU PATIENT (modale openReminderModal / openPatientNoteModal)
   ===================================================================== */
.rmd-form { display: flex; flex-direction: column; gap: 14px; }

.rmd-existing { display: flex; flex-direction: column; gap: 6px; }
.rmd-existing-h {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}
.rmd-existing-loading,
.rmd-empty {
  padding: 14px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-mute);
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.rmd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-left: 3px solid var(--primary);
}
.rmd-item.is-done { opacity: 0.55; }
.rmd-item.is-done .rmd-item-title { text-decoration: line-through; }
.rmd-item.is-overdue { border-left-color: var(--danger); background: rgba(239, 68, 68, 0.04); }
.rmd-item-note { border-left-color: #7c3aed; }
.rmd-item-body { flex: 1; min-width: 0; }
.rmd-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.rmd-item-desc {
  font-size: 12px;
  color: var(--text-soft);
  margin-top: 3px;
  white-space: pre-wrap;
  word-break: break-word;
}
.rmd-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11px;
  color: var(--text-mute);
  margin-top: 4px;
}
.rmd-overdue-pill {
  background: rgba(239, 68, 68, 0.14);
  color: #b91c1c;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
}
.rmd-item-actions { display: flex; gap: 4px; flex-shrink: 0; }
.rmd-item-actions .btn-ghost { padding: 4px 8px; font-size: 12px; }

/* Modal élargie pour panels bio / rapports */
.modal-content.modal-xl {
  max-width: 980px;
  height: calc(100vh - 80px);
  max-height: calc(100vh - 80px);
}
.modal-content.modal-xl .modal-body {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
/* Layout split-pane (liste gauche + contenu droit) */
.bio-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}
/* ── Panneau « Résultats » (page complète, sans aller-retour) ─────────── */
.res-wrap { outline: none; }
.res-split {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 78vh;
  min-height: 0;
  overflow: hidden;
}
.res-left {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--border);
  background: var(--bg-sunk, var(--bg));
}
.res-filters-bar { display: flex; gap: 4px; flex-wrap: wrap; padding: 8px 10px 4px; }
.res-search {
  margin: 4px 10px 8px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text);
  font-size: 12px;
}
.res-left .bio-list { flex: 1; overflow-y: auto; width: auto; border-right: none; }
.res-month {
  position: sticky; top: 0; z-index: 1;
  padding: 4px 12px 3px;
  font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-mute);
  background: var(--bg-sunk, var(--bg));
  border-bottom: 1px solid var(--border);
}
.res-item { box-shadow: inset 3px 0 0 transparent; }
.res-item:hover { box-shadow: inset 3px 0 0 var(--res-color); }
.res-item.active { box-shadow: inset 3px 0 0 var(--res-color); }
.res-item-top { display: flex; align-items: center; gap: 6px; }
.res-item-date { font-weight: 650; font-size: 12px; color: var(--text); }
.res-item-abn { font-size: 10px; color: #dc2626; font-weight: 700; margin-left: auto; }
.res-item-emitter {
  font-size: 11px; color: var(--text-mute);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.res-right { display: flex; flex-direction: column; min-height: 0; }
.res-right .bio-content { flex: 1; }
.res-content-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: 12.5px;
}
.res-head-kind { font-weight: 700; }
.res-head-emitter { color: var(--text-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40%; }
.res-head-nav { font-size: 10.5px; color: var(--text-mute); }

/* =====================================================================
   PAGE PLEIN ÉCRAN « RÉSULTATS » (rfp = results full page)
   Historique complet, triable, master-détail. Ouverte depuis la
   consultation par-dessus tout — fermer = revenir à la consultation.
   ===================================================================== */
.rfp-overlay {
  position: fixed; inset: 0; z-index: 2600;
  background: var(--bg, #f5f6f8);
  display: flex; flex-direction: column;
  animation: rfp-in .18s ease-out;
}
@keyframes rfp-in { from { opacity: 0; transform: scale(.995); } to { opacity: 1; transform: none; } }

.rfp-header {
  display: flex; align-items: center; gap: 16px;
  padding: 13px 22px;
  background: var(--surface, #fff);
  border-bottom: 1px solid var(--border);
}
.rfp-back {
  border: 1px solid var(--border); background: var(--surface, #fff);
  border-radius: 9px; padding: 7px 13px; font-size: 13px; font-weight: 650;
  cursor: pointer; color: var(--text); white-space: nowrap;
}
.rfp-back:hover { background: var(--bg-hover, var(--bg)); }
.rfp-title h1 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.rfp-sub { font-size: 12.5px; color: var(--text-mute); margin-top: 1px; }
.rfp-stats { display: flex; gap: 8px; flex-wrap: wrap; margin-left: 10px; }
.rfp-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface, #fff);
  font-size: 12.5px; font-weight: 650; color: var(--text-soft, var(--text-mute));
  transition: background .12s, color .12s, border-color .12s, box-shadow .12s;
}
.rfp-pill:hover { border-color: var(--pill-color); color: var(--text); }
.rfp-pill.active {
  background: var(--pill-color); border-color: var(--pill-color); color: #fff;
  box-shadow: 0 3px 12px color-mix(in srgb, var(--pill-color) 38%, transparent);
}
.rfp-pill-ic { font-size: 13px; line-height: 1; }
.rfp-pill-n {
  font-weight: 800; font-size: 11.5px; padding: 0 6px; border-radius: 999px;
  background: color-mix(in srgb, var(--pill-color) 14%, transparent); color: var(--pill-color);
}
.rfp-pill.active .rfp-pill-n { background: rgba(255, 255, 255, .25); color: #fff; }
.rfp-close {
  border: none; background: transparent; font-size: 17px; cursor: pointer;
  color: var(--text-mute); width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
}
.rfp-close:hover { background: var(--bg-hover, var(--bg)); color: var(--text); }

.rfp-toolbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 22px; background: var(--surface, #fff);
  border-bottom: 1px solid var(--border);
}
.rfp-search {
  flex: 1; min-width: 220px; max-width: 480px;
  padding: 9px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg, #f5f6f8); font-size: 13.5px; color: var(--text);
}
.rfp-search:focus { outline: none; border-color: var(--primary); background: var(--surface, #fff); }
.rfp-sort { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rfp-sort-label { font-size: 12px; color: var(--text-mute); font-weight: 650; margin-right: 2px; }
.rfp-sort-btn {
  border: 1px solid var(--border); background: var(--surface, #fff);
  border-radius: 8px; padding: 6px 11px; font-size: 12.5px; font-weight: 650;
  cursor: pointer; color: var(--text-soft, var(--text-mute)); white-space: nowrap;
}
.rfp-sort-btn:hover { border-color: var(--primary); color: var(--text); }
.rfp-sort-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.rfp-body {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: minmax(300px, 392px) minmax(0, 1fr);
}
.rfp-list {
  overflow-y: auto; border-right: 1px solid var(--border);
  padding: 14px; background: var(--bg, #f5f6f8);
  display: flex; flex-direction: column; gap: 8px;
}
.rfp-month {
  position: sticky; top: -14px; z-index: 1;
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-mute); padding: 9px 4px 4px; margin-top: 2px;
  background: var(--bg, #f5f6f8);
}
.rfp-month:first-child { margin-top: 0; }
.rfp-card {
  display: flex; background: var(--surface, #fff);
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  cursor: pointer; transition: box-shadow .12s, transform .12s, border-color .12s;
  /* Liste = flex colonne scrollable → sans ceci, les fiches au contenu long
     sont écrasées (flex-shrink) et leur texte rogné. */
  flex-shrink: 0;
}
.rfp-card:hover {
  border-color: color-mix(in srgb, var(--card-color) 50%, var(--border));
  box-shadow: 0 4px 14px rgba(0, 0, 0, .07); transform: translateY(-1px);
}
.rfp-card.active {
  border-color: var(--card-color);
  box-shadow: 0 4px 16px color-mix(in srgb, var(--card-color) 24%, transparent);
}
.rfp-card-bar { width: 4px; background: var(--card-color); flex-shrink: 0; }
.rfp-card-body { padding: 10px 13px; min-width: 0; flex: 1; }
.rfp-card-row1 { display: flex; align-items: center; gap: 8px; }
.rfp-card-ic { font-size: 15px; line-height: 1; }
.rfp-card-date { font-weight: 750; font-size: 13px; color: var(--text); }
.rfp-card-kind {
  font-size: 10.5px; color: var(--text-mute); background: var(--bg, #f5f6f8);
  border-radius: 6px; padding: 1px 7px; font-weight: 650;
}
.rfp-card-abn {
  margin-left: auto; font-size: 10.5px; font-weight: 800; color: #fff;
  background: #dc2626; border-radius: 999px; padding: 1px 8px; white-space: nowrap;
}
.rfp-card-emitter {
  font-size: 12.5px; font-weight: 650; color: var(--text); margin-top: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rfp-card-prev {
  font-size: 11.5px; color: var(--text-mute); margin-top: 3px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.rfp-list-empty, .rfp-detail-empty {
  padding: 30px 22px; text-align: center; color: var(--text-mute); font-size: 13px;
}

.rfp-detail { display: flex; flex-direction: column; min-height: 0; background: var(--surface, #fff); }
.rfp-detail-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 13px 24px; border-bottom: 1px solid var(--border);
}
.rfp-detail-kind { font-weight: 800; font-size: 14px; }
.rfp-detail-date { font-size: 14px; color: var(--text); }
.rfp-detail-emitter {
  color: var(--text-mute); font-size: 13px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; max-width: 38%;
}
.rfp-detail-nav { font-size: 10.5px; color: var(--text-mute); }
.rfp-detail-content { flex: 1; overflow-y: auto; padding: 22px 26px; }

/* Repli vertical sur fenêtre étroite (split master-détail trop serré). */
@media (max-width: 860px) {
  .rfp-body { grid-template-columns: 1fr; grid-template-rows: minmax(0, 42%) minmax(0, 1fr); }
  .rfp-list { border-right: none; border-bottom: 1px solid var(--border); }
  .rfp-stats { width: 100%; margin-left: 0; }
}

/* --- Espace patient (côté médecin) : gestion des résultats partagés --------- */
.pps-summary { display: flex; gap: 8px; align-items: center; margin-left: 10px; }
.pps-badge {
  display: inline-flex; align-items: center; padding: 5px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 750; color: #fff; background: var(--primary, #2563eb);
}
.pps-badge-mute { background: var(--bg, #eef1f5); color: var(--text-mute); }
.pps-note {
  padding: 12px 22px; font-size: 13px; color: var(--text-soft, var(--text-mute));
  background: var(--surface, #fff); border-bottom: 1px solid var(--border);
}
.pps-note b { color: var(--text); }
/* Bandeau d'avancement « mise au propre IA en cours ». */
.pps-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 22px; font-size: 13px; font-weight: 600;
  color: #b45309; background: #fffbeb; border-bottom: 1px solid #f59e0b44;
}
.pps-list {
  flex: 1; min-height: 0; overflow-y: auto; padding: 18px 22px;
  display: flex; flex-direction: column; gap: 10px;
  width: 100%; max-width: 820px; margin: 0 auto;
}
.pps-card { align-items: center; }
.pps-card .rfp-card-body { padding: 11px 14px; }
.pps-card.is-hidden { opacity: .62; background: var(--bg, #f5f6f8); }
.pps-card.is-hidden:hover { opacity: 1; }
.pps-hidden-tag {
  margin-left: auto; font-size: 10.5px; font-weight: 750; color: var(--text-mute);
  background: var(--bg, #eef1f5); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px;
}
/* En attente de mise au propre par l'IA (pas encore visible). */
.pps-tag-wait { color: #b45309; background: #fffbeb; border-color: #f59e0b55; }
/* Affichage forcé par le médecin avant structuration IA. */
.pps-tag-forced { color: var(--primary, #2563eb); background: color-mix(in srgb, var(--primary, #2563eb) 10%, transparent); border-color: color-mix(in srgb, var(--primary, #2563eb) 35%, var(--border)); }
.pps-toggle {
  flex-shrink: 0; margin: 0 12px; white-space: nowrap; cursor: pointer;
  padding: 7px 13px; border-radius: 9px; font-size: 12.5px; font-weight: 700;
  border: 1px solid var(--border); background: var(--surface, #fff); color: var(--text-soft, var(--text-mute));
  transition: background .12s, color .12s, border-color .12s;
}
.pps-toggle:hover { border-color: var(--primary, #2563eb); color: var(--text); }
.pps-toggle.on {
  background: color-mix(in srgb, var(--ok, #16a34a) 12%, transparent);
  border-color: color-mix(in srgb, var(--ok, #16a34a) 45%, var(--border));
  color: var(--ok, #16a34a);
}
.pps-toggle:disabled { opacity: .55; cursor: default; }

/* Split 2 colonnes : graphiques (gauche) | rapports liste+protocole (droite) */
.bio-2col {
  display: grid;
  grid-template-columns: minmax(300px, 380px) 1fr;
  flex: 1;
  min-height: 0;
  height: 74vh;
  overflow: hidden;
}
.bio-graphs-col {
  overflow-y: auto;
  padding: 12px 14px;
  border-right: 1px solid var(--border);
  background: var(--bg-sunk, var(--bg));
}
.bio-split {
  display: grid;
  grid-template-columns: 230px 1fr;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.bio-list {
  overflow-y: auto;
  border-right: 1px solid var(--border);
}
.bio-list-item {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.bio-list-item:hover { background: var(--bg-hover); }
.bio-list-item.active { background: var(--primary-soft); border-left: 3px solid var(--primary); }
.bio-content {
  overflow-y: auto;
  background: var(--bg-subtle);
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =====================================================================
   Toasts
   ===================================================================== */
.toasts {
  position: fixed;
  bottom: 20px; right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  pointer-events: auto;
  animation: toastIn 200ms ease-out;
  max-width: 380px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--info); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* =====================================================================
   Workspace clinique (dossier patient + consultation)
   ===================================================================== */
.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-hover);
  color: var(--text-soft);
  border: 1px solid var(--border);
}
.meta-chip.danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.25);
}
.meta-chip.warning {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
  border-color: rgba(245, 158, 11, 0.3);
}
[data-theme='dark'] .meta-chip.warning { color: #fbbf24; }
.meta-chip.success {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
  border-color: rgba(16, 185, 129, 0.3);
}
[data-theme='dark'] .meta-chip.success { color: #34d399; }

.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}
.action-bar-primary { gap: var(--space-2); }
.action-bar-tools { gap: 6px; }
.action-divider {
  width: 1px;
  height: 22px;
  background: var(--border);
  margin: 0 2px;
  flex-shrink: 0;
}

/* ----- Dossier patient ----- */
.patient-detail {
  display: grid;
  grid-template-columns: var(--clinical-aside-w) minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}
.patient-side {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  position: sticky;
  top: 0;
  max-height: calc(100vh - var(--topbar-h) - 48px);
  overflow-y: auto;
  padding-bottom: var(--space-4);
}
.patient-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.patient-main-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 5;
}
.patient-main-title h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.patient-main-sub {
  font-size: 13px;
  color: var(--text-soft);
  margin-top: 4px;
}
.patient-main-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.patient-header-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
}
.patient-identity-row {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}
.patient-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
/* Avatar = photo d'identité eID (carte) quand disponible. Même gabarit que l'avatar
   à initiales, mais image cadrée + léger contour pour la lisibilité. */
.patient-avatar-photo {
  object-fit: cover;
  background: var(--surface-2, #eef1f5);
  border: 2px solid var(--border, #d7dce3);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  padding: 0;
}
.patient-identity-body { flex: 1; min-width: 0; }
.patient-name { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.patient-meta { font-size: 12.5px; color: var(--text-soft); margin-top: 2px; }
.patient-meta-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: var(--space-3);
  font-size: 12.5px;
}
.patient-meta-list .row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
  align-items: baseline;
}
.patient-meta-list .key { color: var(--text-mute); }

/* ─── Sélecteur d'emplacement de calcul IA (Mac ⟷ PC distant) ─────────────── */
.compute-switcher-backdrop {
  position: fixed; inset: 0; z-index: 4000;
  background: rgba(15, 23, 42, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; backdrop-filter: blur(2px);
}
.compute-switcher {
  width: 100%; max-width: 480px;
  background: var(--bg-elevated, #fff);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
  padding: 22px;
}
.compute-switcher .cs-loading { padding: 30px; text-align: center; color: var(--text-mute); }
.compute-switcher .cs-title { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.compute-switcher .cs-sub { font-size: 12.5px; color: var(--text-soft); margin: 4px 0 16px; line-height: 1.5; }
.compute-switcher .cs-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.compute-switcher .cs-card {
  border: 2px solid var(--border);
  border-radius: 12px; padding: 12px; cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, transform 80ms ease;
  background: var(--surface-2, #f8fafc);
}
.compute-switcher .cs-card:hover { transform: translateY(-1px); }
.compute-switcher .cs-card-sel {
  border-color: var(--primary, #2563eb);
  background: color-mix(in srgb, var(--primary, #2563eb) 8%, transparent);
}
.compute-switcher .cs-card-top { display: flex; align-items: flex-start; gap: 8px; }
.compute-switcher .cs-card-icon { font-size: 22px; line-height: 1; }
.compute-switcher .cs-card-name { font-weight: 700; font-size: 13.5px; }
.compute-switcher .cs-card-spec { font-size: 11px; color: var(--text-mute); margin-top: 2px; line-height: 1.4; }
.compute-switcher .cs-check { margin-left: auto; color: var(--primary, #2563eb); font-weight: 800; opacity: 0; transition: opacity 120ms; }
.compute-switcher .cs-card-sel .cs-check { opacity: 1; }
.compute-switcher .cs-card-status { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 11.5px; color: var(--text-soft); }
.compute-switcher .cs-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.compute-switcher .cs-dot-ok { background: var(--success, #16a34a); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success, #16a34a) 22%, transparent); }
.compute-switcher .cs-dot-err { background: var(--danger, #dc2626); }
.compute-switcher .cs-dot-wait { background: var(--text-mute, #94a3b8); }
.compute-switcher .cs-remote-cfg { margin-top: 16px; }
.compute-switcher .cs-label { font-size: 11px; font-weight: 600; color: var(--text-soft); text-transform: uppercase; letter-spacing: 0.04em; }
.compute-switcher .cs-input-row { display: flex; gap: 8px; margin-top: 6px; }
.compute-switcher .cs-input {
  flex: 1; padding: 8px 10px; font-size: 13px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg, #fff); color: var(--text-primary);
}
.compute-switcher .cs-test-result { font-size: 12px; margin-top: 8px; min-height: 16px; line-height: 1.4; }
.compute-switcher .cs-rule {
  margin-top: 16px; padding: 12px; border-radius: 10px;
  background: var(--surface-2, #f1f5f9); font-size: 12px;
}
.compute-switcher .cs-rule-title { font-weight: 700; margin-bottom: 6px; font-size: 12px; }
.compute-switcher .cs-rule-line { color: var(--text-soft); margin-top: 3px; }
.compute-switcher .cs-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.cs-progress-bar { height: 10px; border-radius: 6px; background: var(--surface-2, #eef1f5); overflow: hidden; }
.cs-progress-fill { height: 100%; background: var(--primary, #2563eb); transition: width 400ms ease; }
.cs-atelier-link { display: inline-block; margin-top: 10px; font-size: 12.5px; font-weight: 600; color: var(--primary, #2563eb); text-decoration: none; }
.cs-atelier-link:hover { text-decoration: underline; }

/* ─── Atelier IA distant (tableau de bord) ────────────────────────────────── */
.atelier { max-width: 980px; }
.atelier-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.atelier-title { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.atelier-sub { font-size: 13px; color: var(--text-soft); margin-top: 4px; }
.atelier-pill { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.atelier-pill.on { background: color-mix(in srgb, var(--success, #16a34a) 14%, transparent); color: var(--success, #16a34a); }
.atelier-pill.off { background: var(--surface-2, #f1f5f9); color: var(--text-mute); }
.atelier-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.atelier-dot.on { background: var(--success, #16a34a); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success,#16a34a) 22%, transparent); }
.atelier-dot.off { background: var(--text-mute, #94a3b8); }
.atelier-dot.err { background: var(--danger, #dc2626); }
.atelier-toggle-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.atelier-switch { position: relative; width: 56px; height: 30px; border-radius: 999px; border: none; cursor: pointer; transition: background 160ms ease; flex-shrink: 0; }
.atelier-switch.off { background: var(--surface-3, #cbd5e1); }
.atelier-switch.on { background: var(--success, #16a34a); }
.atelier-knob { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform 160ms ease; }
.atelier-switch.on .atelier-knob { transform: translateX(26px); }
.atelier-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.atelier-node { padding: 14px 16px; }
.atelier-node-h { font-weight: 700; font-size: 13.5px; margin-bottom: 8px; }
.atelier-node-line { font-size: 13px; margin-top: 3px; }
.atelier-node-mut { font-size: 11.5px; color: var(--text-mute); margin-top: 6px; }
.atelier-kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 12px; }
.atelier-kpi { background: var(--bg-elevated, #fff); border: 1px solid var(--border); border-radius: 12px; padding: 14px; text-align: center; }
.atelier-kpi-val { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.atelier-kpi-lbl { font-size: 11px; color: var(--text-mute); margin-top: 2px; }
.atelier-perf { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.atelier-feed { display: flex; flex-direction: column; }
.atelier-feed-row { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--border); }
.atelier-feed-row:last-child { border-bottom: none; }
.atelier-kind { display: inline-block; font-size: 10.5px; font-weight: 600; color: var(--text-soft); background: var(--surface-2, #f1f5f9); border-radius: 5px; padding: 1px 6px; margin-right: 7px; vertical-align: middle; }

/* ─── Centre IA & GPU ──────────────────────────────────────────────────────── */
.gpu-center { max-width: 1020px; }
.gpu-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.gpu-h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.gpu-sub { font-size: 13px; color: var(--text-soft); margin-top: 4px; }
.gpu-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.gpu-dot.on { background: var(--success, #16a34a); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success,#16a34a) 22%, transparent); }
.gpu-dot.off { background: var(--text-mute, #94a3b8); }
.gpu-dot.err { background: var(--danger, #dc2626); }
.gpu-pill { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.gpu-pill.on { background: color-mix(in srgb, var(--success,#16a34a) 14%, transparent); color: var(--success, #16a34a); }
.gpu-pill.off { background: var(--surface-2, #f1f5f9); color: var(--text-mute); }
.gpu-nodes { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.gpu-node { background: var(--bg-elevated, #fff); border: 1px solid var(--border); border-left: 3px solid var(--text-mute, #94a3b8); border-radius: 14px; padding: 16px; box-shadow: var(--shadow-sm); }
.gpu-node.on { border-left-color: var(--success, #16a34a); }
.gpu-node.off { opacity: 0.85; }
.gpu-node-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.gpu-node-icon { font-size: 24px; line-height: 1; }
.gpu-node-title { font-weight: 700; font-size: 15px; }
.gpu-node-spec { font-size: 11.5px; color: var(--text-mute); margin-top: 1px; }
.gpu-state { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 700; padding: 9px 13px; border-radius: 9px; margin: 4px 0 12px; letter-spacing: 0.01em; }
.gpu-state-on { background: color-mix(in srgb, var(--success,#16a34a) 13%, transparent); color: var(--success, #16a34a); }
.gpu-state-busy { background: color-mix(in srgb, var(--primary,#2563eb) 13%, transparent); color: var(--primary, #2563eb); }
.gpu-state-off { background: color-mix(in srgb, var(--danger,#dc2626) 11%, transparent); color: var(--danger, #dc2626); }
.gpu-metric { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.gpu-metric-lbl { font-size: 12px; color: var(--text-soft); width: 78px; flex-shrink: 0; }
.gpu-gauge { position: relative; flex: 1; height: 18px; background: var(--surface-2, #eef1f5); border-radius: 9px; overflow: hidden; }
.gpu-gauge-fill { height: 100%; border-radius: 9px; transition: width 500ms ease; min-width: 2px; }
.gpu-gauge-lbl { position: absolute; right: 8px; top: 0; line-height: 18px; font-size: 11px; font-weight: 700; color: var(--text-primary); }
.gpu-line { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; margin: 6px 0; flex-wrap: wrap; }
.gpu-line-k { color: var(--text-mute); width: 110px; flex-shrink: 0; }
.gpu-chip { display: inline-block; font-size: 11px; font-weight: 600; background: color-mix(in srgb, var(--primary,#2563eb) 10%, transparent); color: var(--primary, #2563eb); border-radius: 6px; padding: 2px 8px; margin: 0 4px 4px 0; }
.gpu-mut { color: var(--text-mute); }
.gpu-actions-row { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.gpu-sel { flex: 1; min-width: 150px; padding: 6px 8px; font-size: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg, #fff); color: var(--text-primary); }
.gpu-note { font-size: 12px; color: var(--text-soft); background: var(--surface-2, #f1f5f9); border-radius: 8px; padding: 8px 12px; margin-bottom: 14px; }
.gpu-cards-title { font-weight: 700; font-size: 13px; margin: 4px 0 8px; }
.gpu-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.gpu-card { background: var(--bg-elevated, #fff); border: 1px solid var(--border); border-radius: 12px; padding: 14px; box-shadow: var(--shadow-sm); }
.gpu-card-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; font-size: 13.5px; }
.gpu-card-foot { display: flex; gap: 16px; font-size: 12.5px; color: var(--text-soft); margin-top: 8px; font-weight: 600; }
@media (max-width: 820px) { .gpu-cards { grid-template-columns: 1fr; } }
.gpu-live { padding: 14px 16px; margin-bottom: 14px; }
.gpu-live-title { font-weight: 700; font-size: 13px; margin-bottom: 8px; }
.gpu-live-node { font-size: 13.5px; padding: 7px 10px; border-radius: 8px; margin: 4px 0; background: var(--surface-2, #f1f5f9); }
.gpu-live-node.working { background: color-mix(in srgb, var(--primary,#2563eb) 9%, transparent); }
.gpu-spin { display: inline-block; animation: gpu-spin 1.4s linear infinite; }
@keyframes gpu-spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
.gpu-live-perf { font-size: 12px; color: var(--text-mute); margin-top: 8px; }
.gpu-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.gpu-seg-row { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.gpu-seg { padding: 7px 14px; font-size: 12.5px; font-weight: 600; border: none; background: var(--bg-elevated, #fff); color: var(--text-soft); cursor: pointer; border-right: 1px solid var(--border); }
.gpu-seg:last-child { border-right: none; }
.gpu-seg:hover { background: var(--surface-2, #f1f5f9); }
.gpu-seg.on { background: var(--primary, #2563eb); color: #fff; }
.gpu-kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 14px; }
.gpu-kpi { background: var(--bg-elevated, #fff); border: 1px solid var(--border); border-radius: 12px; padding: 12px; text-align: center; }
.gpu-kpi-v { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.gpu-kpi-l { font-size: 10.5px; color: var(--text-mute); margin-top: 2px; }
.gpu-table th, .gpu-table td { font-size: 12.5px; }
@media (max-width: 820px) { .gpu-nodes { grid-template-columns: 1fr; } .gpu-kpis { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 720px) { .atelier-kpis { grid-template-columns: repeat(2, 1fr); } .atelier-split { grid-template-columns: 1fr; } }
/* Carte d'infos cliquable → ouvre la modale d'édition (cf. patients.js). */
.patient-meta-list--editable {
  cursor: pointer;
  margin-left: calc(-1 * var(--space-2));
  margin-right: calc(-1 * var(--space-2));
  padding: var(--space-2);
  border-radius: var(--radius-md, 8px);
  transition: background 120ms ease, box-shadow 120ms ease;
}
.patient-meta-list--editable:hover {
  background: var(--surface-2, rgba(0, 0, 0, 0.035));
}
.patient-meta-list--editable:focus-visible {
  outline: none;
  background: var(--surface-2, rgba(0, 0, 0, 0.035));
  box-shadow: 0 0 0 2px var(--primary, #1d6fb8);
}
.patient-meta-list__edit-hint {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--text-mute);
  opacity: 0;
  transition: opacity 120ms ease;
}
.patient-meta-list--editable:hover .patient-meta-list__edit-hint,
.patient-meta-list--editable:focus-visible .patient-meta-list__edit-hint {
  opacity: 1;
}
.patient-side .card { box-shadow: var(--shadow-sm); }
.patient-side .card-h h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-soft); }

/* Onglets groupés */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-4);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scroll-padding-inline: 8px;
}
.tabs-grouped {
  flex-direction: column;
  gap: 0;
  padding-bottom: 0;
  overflow: visible;
  border-bottom: none;
}
.tabs-grouped-scroll {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--space-4);
  overflow-x: auto;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-4);
  -webkit-overflow-scrolling: touch;
}
.tabs-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}
.tabs-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-mute);
  padding-right: 4px;
  user-select: none;
}
.tabs-group-items {
  display: flex;
  gap: 2px;
  background: var(--bg-hover);
  padding: 3px;
  border-radius: var(--radius);
}
.tab {
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-soft);
  border: none;
  border-radius: calc(var(--radius-sm) + 2px);
  background: transparent;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}
.tab:hover { color: var(--text); background: var(--bg-elevated); }
.tab.active {
  color: var(--primary);
  background: var(--bg-elevated);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.tab:focus-visible { box-shadow: var(--focus-ring); }
/* Onglets CLÉS du dossier (Synthèse, Résultats) — toujours mis en avant (fond
   teinté), et pleins quand actifs. Demandé par Dr Nanni le 2026-06-20. */
.tab.tab-key { color: var(--primary); background: var(--primary-soft, #eff6ff); font-weight: 600; }
.tab.tab-key:hover { color: var(--primary); background: var(--primary-soft, #e4eefe); }
.tab.tab-key.active { color: #fff; background: var(--primary); box-shadow: var(--shadow-sm); }
#tab-content {
  min-height: 200px;
}
.calendar-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  max-width: 100%;
}

.timeline-item {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-dot {
  flex-shrink: 0;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-text-on-soft);
  display: flex; align-items: center; justify-content: center;
}
.timeline-dot svg { width: 16px; height: 16px; }
.timeline-content { flex: 1; }
.timeline-content .title { font-weight: 600; font-size: 14px; }
.timeline-content .date { font-size: 12px; color: var(--text-mute); margin-top: 2px; }
.timeline-content .desc { font-size: 13px; color: var(--text-soft); margin-top: 6px; }

/* Activité récente + aperçu côte à côte */
.activity-split {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 18px;
  align-items: start;
}
.activity-split .timeline-item {
  padding-left: 10px;
  padding-right: 10px;
  margin-left: -10px;
  margin-right: -10px;
  border-radius: var(--radius-md, 8px);
  transition: background 120ms;
}
.activity-split .timeline-item:hover { background: var(--bg-soft, rgba(0,0,0,0.03)); }
.activity-split .timeline-item.selected {
  background: var(--primary-soft);
}
.activity-split .timeline-item.selected .timeline-content .title { color: var(--primary-text-on-soft); }
.activity-preview { position: sticky; top: 18px; }
.preview-kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 18px;
  font-size: 13px;
}
.preview-kv-label { color: var(--text-mute); }
.preview-kv-value { font-weight: 600; text-align: right; }
@media (max-width: 1100px) {
  .activity-split { grid-template-columns: 1fr; }
  .activity-preview { position: static; }
}

/* Rapports de laboratoire */
.lab-report {
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 8px);
  overflow: hidden;
  background: var(--bg-elevated);
}
.lab-report-h {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-soft, rgba(0,0,0,0.025));
  border-bottom: 1px solid var(--border);
}
.lab-report-title { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.lab-report-meta { font-size: 12.5px; color: var(--text-soft); margin-top: 3px; font-weight: 500; }
.lab-report-lab { font-size: 11px; color: var(--text-mute); white-space: nowrap; }
.lab-badge-validate {
  font-size: 11.5px; font-weight: 600; white-space: nowrap; flex-shrink: 0;
  color: #b45309; background: #fef3c7; border: 1px solid #f59e0b55;
  border-radius: var(--radius-full); padding: 3px 10px;
}
.lab-table { margin: 0; }

/* Frise chronologique des résultats (cockpit) — groupée par jour */
.res-frise-event { transition: background-color var(--transition); }
.res-frise-event:hover { background: var(--bg-hover); }

/* Grille cumulative biologie — analytes × dates, anormaux colorés (cockpit) */
.lg-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-elevated); }
.lab-grid { width: 100%; border-collapse: collapse; font-size: 13px; }
.lab-grid thead th { position: sticky; top: 0; z-index: 1; background: var(--bg-elevated); text-align: right; font-weight: 500; color: var(--text-mute); padding: 9px 10px; font-size: 11.5px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.lab-grid th.lg-analyte { text-align: left; }
.lab-grid th.lg-trend { text-align: center; }
.lab-grid th.lg-last { color: var(--text); }
/* En-tête de date cliquable → ouvre le bilan complet du jour (Dr Nanni 20/06). */
.lab-grid th.lg-date-h:hover { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; }
.lab-grid td { padding: 8px 10px; border-bottom: 1px solid var(--border); }
.lab-grid tbody tr:last-child td { border-bottom: 0; }
.lab-grid td.lg-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--text-soft); }
.lab-grid td.lg-num.lg-last { color: var(--text); font-weight: 500; }
.lab-grid td.lg-analyte { text-align: left; }
.lg-ref { font-size: 11px; color: var(--text-mute); margin-top: 1px; }
.lab-grid td.lg-trend { text-align: center; width: 66px; }
.lab-grid th.lg-trend { width: 66px; }
.lg-row { cursor: pointer; }
.lg-row:hover td { background: var(--bg-hover); }
.lab-grid td.lg-high { color: #b91c1c; font-weight: 500; }
.lab-grid td.lg-low { color: #185fa5; font-weight: 500; }
.lab-grid td.lg-crit { color: #b91c1c; font-weight: 700; }
.lab-grid td.lg-sys { padding: 7px 10px 4px; font-size: 11px; font-weight: 500; letter-spacing: .02em; color: var(--text-mute); background: var(--bg); text-transform: none; }
.lab-table td, .lab-table th { font-size: 13px; }
.lab-table tr.lab-ab-crit td:first-child,
.lab-table td.lab-ab-crit { color: var(--danger); font-weight: 600; }
.lab-table tr.lab-ab-warn td:first-child,
.lab-table td.lab-ab-warn { color: var(--warning); font-weight: 600; }
.lab-flag {
  margin-left: 8px;
  font-size: 11px;
  font-weight: 600;
  opacity: 0.85;
}
.lab-raw {
  margin: 0;
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-soft);
  white-space: pre;
  overflow-x: auto;
}
.lab-raw.collapsed {
  max-height: 220px;
  overflow-y: auto;
}
.lab-empty {
  padding: 14px;
  font-size: 12.5px;
  color: var(--text-mute);
  font-style: italic;
}

/* ── Carte « 🧪 Derniers résultats » de la synthèse patient ────────── */
.synth-labs-card .synth-lab-block {
  cursor: pointer;
  padding: 8px 2px 2px;
  border-radius: 8px;
  transition: background 0.12s;
}
.synth-labs-card .synth-lab-block:hover { background: var(--bg-2, rgba(0,0,0,0.025)); }
.synth-labs-card .synth-lab-block-divider {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-faint, #eef0f3);
}
.synth-lab-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
}
.synth-lab-date { font-weight: 600; color: var(--text); }
.synth-lab-lab { color: var(--text-mute); font-size: 11.5px; }
.synth-lab-new { background: var(--primary-soft, rgba(37,99,235,.12)); color: var(--primary, #2563eb); font-weight: 600; }
.synth-lab-title {
  font-size: 12px; color: var(--text-mute); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.synth-lab-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 8px;
}
.synth-lab-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  line-height: 1.4;
  border: 1px solid transparent;
  max-width: 100%;
}
.synth-lab-chip-name {
  font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 110px;
}
.synth-lab-chip-val { font-variant-numeric: tabular-nums; font-weight: 500; }
.synth-lab-chip-unit { color: inherit; opacity: 0.75; font-weight: 400; font-size: 10.5px; }
.synth-lab-chip-arrow { font-weight: 700; margin-left: 2px; }
.synth-lab-chip-crit {
  background: rgba(239,68,68,0.10);
  color: var(--danger, #ef4444);
  border-color: rgba(239,68,68,0.30);
}
.synth-lab-chip-high,
.synth-lab-chip-low,
.synth-lab-chip-abn {
  background: rgba(245,158,11,0.10);
  color: var(--warning, #b45309);
  border-color: rgba(245,158,11,0.30);
}
.synth-lab-chip-more {
  background: var(--bg-2, #f5f5f7);
  color: var(--text-mute);
  border-color: var(--border-faint);
  font-weight: 600;
}
.synth-lab-pending {
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--text-mute);
  font-style: italic;
}

/* =====================================================================
   Consultation editor / SOAP
   ===================================================================== */
/* =====================================================================
   ÉDITEUR CONSULTATION — refonte 2026-05-24
   Layout 2 colonnes : main (SOAP + toolbar) | side (timeline verticale).
   ===================================================================== */
.consult-editor {
  display: block;
  max-width: 1600px;
}
.consult-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 14px;
  align-items: start;
}
.consult-layout.side-hidden { grid-template-columns: minmax(0, 1fr) 0; }
.consult-layout.side-hidden .consult-side { display: none; }

.consult-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.consult-side {
  position: sticky;
  top: 12px;
  align-self: start;
  max-height: calc(100vh - var(--topbar-h, 64px) - 32px);
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.consult-side-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}
.consult-side-header h3 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-soft);
  margin: 0;
}
.consult-side-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 6px 0 10px;
}

/* ── Header patient compact (52px) ─────────────────────────────────────── */
.consult-patient-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.consult-patient-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.consult-patient-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.consult-patient-text { min-width: 0; line-height: 1.2; }
.consult-patient-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.consult-patient-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.consult-patient-meta {
  font-size: 11.5px;
  color: var(--text-mute);
  margin-top: 1px;
}
.consult-patient-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.consult-side-toggle { font-size: 14px; padding: 4px 8px; }
.consult-status-pill {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-hover);
  color: var(--text-soft);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.consult-status-pill.finalized {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.3);
}
.consult-status-pill.locked {
  background: var(--primary-soft);
  color: var(--primary-text-on-soft);
  border-color: transparent;
}

/* ── SOAP compact (grid 2×2 + Traitement) ─────────────────────────────── */
.soap-section {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 14px 14px;
  box-shadow: var(--shadow-sm);
}
.soap-section-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.soap-section-h h2 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin: 0;
}
.soap-autosave {
  font-size: 11px;
  color: var(--text-mute);
  font-weight: 500;
}

/* ─── Section « Médicaments prescrits » dans la consultation ────────────── */
.consult-rx-section {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 14px 14px;
  box-shadow: var(--shadow-sm);
  margin-top: 12px;
}
.consult-rx-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.consult-rx-h h2 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin: 0;
}
.rx-list-wrap { display: flex; flex-direction: column; gap: 8px; }
.rx-empty {
  font-size: 12px;
  color: var(--text-mute);
  padding: 12px 4px;
  font-style: italic;
}
.rx-card {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  background: var(--bg-base, var(--bg-elevated));
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 8px);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.rx-card:hover {
  border-color: var(--primary-soft, var(--border));
  box-shadow: var(--shadow-xs, 0 1px 2px rgba(0,0,0,0.04));
}
.rx-card-icon { font-size: 18px; line-height: 1; padding-top: 2px; }
.rx-card-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.rx-card-title {
  font-size: 13px;
  line-height: 1.35;
  color: var(--text);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 4px;
}
.rx-card-title strong { font-weight: 600; }
.rx-card-dosage { color: var(--text-soft); font-size: 12px; }
.rx-card-poso {
  font-size: 12px;
  color: var(--text-soft);
  line-height: 1.4;
}
.rx-card-notes {
  font-size: 11px;
  color: var(--text-mute);
  font-style: italic;
  margin-top: 2px;
}
.rx-card-indication {
  font-size: 11.5px;
  color: var(--text-soft);
  margin-top: 2px;
}
.rx-card-info {
  font-size: 11.5px;
  color: var(--text-soft);
  margin-top: 2px;
  padding-left: 2px;
  border-left: 2px solid var(--primary-soft, #ede9fe);
  padding-left: 6px;
}
.rx-card-actions { display: flex; gap: 4px; align-items: center; }

.soap-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.soap-grid .full { grid-column: 1 / -1; }
.soap-field { display: flex; flex-direction: column; gap: 5px; }
.soap-field .field-h {
  display: flex;
  align-items: center;
  gap: 6px;
}
.soap-field .field-h .letter {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary-text-on-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
}
.soap-field .field-h .field-name { font-weight: 600; font-size: 12px; color: var(--text-soft); }
.soap-field textarea {
  padding: 8px 10px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: var(--transition);
  min-height: 100px;
  resize: vertical;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
}
.soap-field.full textarea { min-height: 60px; }
.soap-field textarea:focus {
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}

/* ── Barre de commande consultation (1 ligne : rec · motif · micro · acte) ──
   Remplace l'ancienne toolbar IA à 4 rangées (2026-06-11). Les chips IA vivent
   dans .soap-ai-row, attachées à la note qu'elles travaillent. */
.consult-command-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.consult-command-bar .consult-motif-input {
  flex: 1;
  min-width: 200px;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  outline: none;
  transition: var(--transition);
}
.consult-command-bar .consult-motif-input::placeholder { color: var(--text-mute); font-weight: 400; }
.consult-command-bar .consult-motif-input:focus { border-color: var(--primary); box-shadow: var(--focus-ring); }
.consult-type-seg { display: inline-flex; flex-shrink: 0; }
.soap-ai-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 2px 0 8px;
}
.soap-ai-sep {
  width: 1px;
  align-self: stretch;
  margin: 2px 4px;
  background: var(--border);
}
.btn-chip-primary {
  background: var(--primary) !important;
  color: var(--text-on-primary, #fff) !important;
  border-color: var(--primary) !important;
  font-weight: 700;
}
.btn-chip-primary:hover { filter: brightness(1.08); }
.btn-rec { flex-shrink: 0; white-space: nowrap; padding: 9px 16px; font-weight: 700; }
/* « 💊 Prescrire » — action de premier plan, toujours visible dans la barre */
.btn-rx-main { flex-shrink: 0; white-space: nowrap; font-weight: 700; }
.consult-live-indicator {
  font-size: 11px;
  color: var(--danger);
  font-weight: 700;
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
.ai-toolbar-spacer { flex: 1; }

/* Assistant IA — onglets internes (Chat/Consultation/Expert/Audit) */
.assistant-tabs {
  display: flex;
  gap: 4px;
  padding: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.assistant-tab {
  flex: 1;
  min-width: 140px;
  padding: 9px 14px;
  font-size: 13.5px;
  font-weight: 600;
  background: transparent;
  color: var(--text-soft);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background .12s, color .12s;
}
.assistant-tab:hover { background: var(--bg-hover); color: var(--text-primary); }
.assistant-tab.active {
  background: var(--primary);
  color: var(--text-on-primary, #fff);
}
.assistant-beta-badge {
  background: rgba(255,255,255,0.25);
  color: inherit;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  letter-spacing: 0.05em;
}
.assistant-tab:not(.active) .assistant-beta-badge {
  background: #d97706;
  color: white;
}
.assistant-subview { min-height: 400px; }
/* Conteneur par onglet du tab-hub : transparent pour la mise en page, il ne
   sert qu'à isoler les rendus async périmés (cf. lib/tab-hub.js). */
.tab-hub-mount { display: contents; }

/* Sélecteur de type d'acte (Visite / Consultation / Avis) — segmented control. */
.btn-type-acte {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  background: var(--bg-input);
  color: var(--text-soft);
  border: 1px solid var(--border);
  border-right: none;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.btn-type-acte:first-child { border-radius: 8px 0 0 8px; }
.btn-type-acte:last-child  { border-radius: 0 8px 8px 0; border-right: 1px solid var(--border); }
.btn-type-acte:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-type-acte.active {
  background: var(--primary);
  color: var(--text-on-primary, #fff);
  border-color: var(--primary);
}
.btn-type-acte.active + .btn-type-acte { border-left-color: var(--primary); }

/* Chips IA : boutons d'analyse compacts */
.btn-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color .12s, background .12s, transform .06s;
  white-space: nowrap;
}
.btn-chip:hover { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-text-on-soft); }
.btn-chip:active { transform: translateY(1px); }
.btn-chip-ghost { background: transparent; color: var(--text-soft); }
.btn-chip-ghost:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border-strong); }
/* ── Drawer Notes brutes / transcription ───────────────────────────────── */
.transcript-drawer-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 2px;
}
.transcript-drawer-body textarea {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  resize: vertical;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text);
}
.transcript-drawer-body textarea:focus {
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}
.transcript-drawer-hint {
  font-size: 11.5px;
  color: var(--text-mute);
  margin-right: auto;
  align-self: center;
}

/* ── Timeline verticale (sidebar droite consultation) ─────────────────── */
.tlv-loading, .tlv-empty {
  padding: 16px;
  font-size: 12px;
  color: var(--text-mute);
  text-align: center;
}
.tlv-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 6px 12px 8px;
  border-bottom: 1px solid var(--border);
}
.tlv-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 999px;
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-soft);
  transition: all .12s;
  --chip-color: var(--primary);
}
.tlv-chip:hover { border-color: var(--chip-color); color: var(--text); }
.tlv-chip.active {
  background: color-mix(in srgb, var(--chip-color) 14%, transparent);
  border-color: var(--chip-color);
  color: var(--text);
}
.tlv-chip-icon { font-size: 13px; line-height: 1; }
.tlv-chip-count { font-size: 10.5px; font-weight: 700; }

.tlv-list {
  position: relative;
  padding: 8px 12px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
/* Séparateur mois/année sur le rail de la timeline */
.tlv-sep {
  position: relative;
  z-index: 1;
  align-self: flex-start;
  margin: 8px 0 3px -2px;
  padding: 1px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-mute);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
}
/* Axe vertical décoré derrière les dots */
.tlv-list::before {
  content: '';
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 19px;
  width: 1.5px;
  background: var(--border);
  border-radius: 2px;
  pointer-events: none;
}
.tlv-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 7px 4px 7px 0;
  cursor: pointer;
  border-radius: 6px;
  transition: background .1s;
  --dot-color: var(--primary);
}
.tlv-item:hover { background: var(--bg-hover); }
.tlv-item-dot {
  flex-shrink: 0;
  width: 11px;
  height: 11px;
  margin-top: 5px;
  margin-left: 2px;
  border-radius: 50%;
  background: var(--dot-color);
  box-shadow: 0 0 0 2px var(--bg-elevated), 0 0 0 3px var(--dot-color);
  z-index: 1;
}
.tlv-item-body { flex: 1; min-width: 0; line-height: 1.3; }
.tlv-item-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-mute);
  font-weight: 600;
}
.tlv-item-icon { font-size: 12px; }
.tlv-item-date { color: var(--text); font-weight: 700; }
.tlv-item-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
}
.tlv-item-summary {
  font-size: 12px;
  color: var(--text-soft);
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

/* Responsive : sidebar empilée sous le main en dessous de 1100px */
@media (max-width: 1100px) {
  .consult-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .consult-side {
    position: static;
    max-height: 460px;
  }
}

/* =====================================================================
   APERÇU TIMELINE (modale détail rapport / imagerie / biologie / consult)
   ===================================================================== */
.rpt-doc {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 2px;
  max-height: 72vh;
  overflow-y: auto;
}
.rpt-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--bg-elevated), var(--bg));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.rpt-header-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  background: var(--primary-soft);
  color: var(--primary-text-on-soft);
}
.rpt-header-icon.rpt-icon-bio { background: rgba(239, 68, 68, 0.14); color: #ef4444; }
.rpt-header-text { flex: 1; min-width: 0; }
.rpt-header-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 4px;
}
.rpt-header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  color: var(--text-soft);
}
.rpt-header-meta span { display: inline-flex; align-items: center; gap: 4px; }
.rpt-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  flex-shrink: 0;
}
.rpt-badge-danger { background: rgba(239, 68, 68, 0.14); color: #b91c1c; }
.rpt-badge-success { background: rgba(16, 185, 129, 0.14); color: #047857; }
.rpt-status-draft { background: rgba(245, 158, 11, 0.14); color: #b45309; }
.rpt-status-final { background: rgba(16, 185, 129, 0.14); color: #047857; }
.rpt-status-sent { background: rgba(59, 130, 246, 0.14); color: #1e40af; }
.rpt-status-ehbox { background: rgba(99, 102, 241, 0.14); color: #4338ca; }

/* ── Sections (Motif, Technique, Conclusion…) ────────────────────────── */
.rpt-section {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow-xs, 0 1px 2px rgba(0,0,0,0.04));
  --section-color: var(--primary);
}
.rpt-section-h {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.rpt-section-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--section-color);
  flex-shrink: 0;
}
.rpt-section-title {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--section-color);
}
.rpt-section-hint {
  margin-left: auto;
  font-size: 11px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-mute);
}
.rpt-section-body {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.rpt-section-prewrap { font-family: inherit; }

/* Variantes colorées par type de section */
.rpt-section-conclusion {
  --section-color: #059669;
  background: linear-gradient(0deg, rgba(16, 185, 129, 0.06), rgba(16, 185, 129, 0.06)), var(--bg-elevated);
  border-color: rgba(16, 185, 129, 0.3);
}
.rpt-section-conclusion .rpt-section-body { font-weight: 500; }
.rpt-section-diagnostic {
  --section-color: #7c3aed;
  background: linear-gradient(0deg, rgba(139, 92, 246, 0.06), rgba(139, 92, 246, 0.06)), var(--bg-elevated);
  border-color: rgba(139, 92, 246, 0.3);
}
.rpt-section-context { --section-color: #0891b2; }
.rpt-section-technique { --section-color: #475569; }
.rpt-section-plan { --section-color: #d97706; }
.rpt-section-comment { --section-color: #6366f1; }
.rpt-section-meta { --section-color: #94a3b8; }
.rpt-section-meta .rpt-section-title { letter-spacing: 0.03em; }
.rpt-section-meta .rpt-section-body { font-size: 12px; color: var(--text-soft); }

/* ── Grille de valeurs biologie anormales ────────────────────────────── */
.rpt-bio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}
.rpt-bio-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: left;
  cursor: default;
  transition: border-color .12s, transform .06s, box-shadow .12s;
}
.rpt-bio-card.is-clickable { cursor: pointer; }
.rpt-bio-card.is-clickable:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.rpt-bio-card.is-clickable:active { transform: translateY(1px); }
.rpt-bio-card.is-abnormal { border-left: 3px solid #f59e0b; }
.rpt-bio-card.is-critical { border-left: 3px solid #ef4444; background: rgba(239, 68, 68, 0.04); }
.rpt-bio-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.rpt-bio-value {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.rpt-bio-num {
  font-size: 18px;
  font-weight: 700;
  color: var(--danger);
  font-variant-numeric: tabular-nums;
}
.rpt-bio-card.is-critical .rpt-bio-num { color: #b91c1c; }
.rpt-bio-unit { font-size: 11px; color: var(--text-mute); }
.rpt-bio-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2px;
}
.rpt-bio-status-pill {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
}
.rpt-bio-card.is-critical .rpt-bio-status-pill { background: rgba(239, 68, 68, 0.14); color: #b91c1c; }
.rpt-bio-trend {
  font-size: 10.5px;
  color: var(--primary);
  font-weight: 600;
}

/* ── Bloc replié pour le texte brut ──────────────────────────────────── */
.rpt-raw {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
}
.rpt-raw summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--text-soft);
  font-weight: 600;
  user-select: none;
}
.rpt-raw[open] summary { margin-bottom: 8px; }
.rpt-raw pre {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-soft);
  max-height: 320px;
  overflow-y: auto;
}

/* ══ Vue Documents — onglets Entrants / Sortants ════════════════════════ */
.doc-tabs {
  display: flex;
  border-bottom: 2px solid var(--border-faint, #e5e7eb);
  gap: 0;
  margin-bottom: 2px;
}
.doc-tab {
  padding: 9px 22px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-mute, #6b7280);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
  letter-spacing: 0.01em;
}
.doc-tab:hover { color: var(--text, #111827); }
.doc-tab.active {
  color: var(--primary, #2563eb);
  border-bottom-color: var(--primary, #2563eb);
  font-weight: 600;
}

/* ══ Vue Documents — liste premium (cartes colorées par catégorie) ════════ */
.res-wrap { display: flex; flex-direction: column; gap: 14px; }

/* Filtres : chips colorées (réutilise le look .tlv-chip de la timeline). */
.res-filters { display: flex; flex-wrap: wrap; gap: 7px; }

/* Bandeau récap (total · nouveaux [filtre cliquable] · lus). */
.res-summary {
  display: flex; align-items: center; gap: 9px;
  font-size: 12.5px; color: var(--text-mute); padding: 0 2px;
}
.res-count {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; border: none; background: transparent; cursor: default;
  padding: 0; color: var(--text-mute);
}
.res-count-new {
  cursor: pointer; font-weight: 700; color: var(--primary);
  padding: 2px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 9%, transparent);
  transition: background .12s;
}
.res-count-new:hover { background: color-mix(in srgb, var(--primary) 16%, transparent); }
.res-count-new.active {
  color: #fff; background: var(--primary);
  box-shadow: 0 2px 8px -2px color-mix(in srgb, var(--primary) 60%, transparent);
}
.res-count-new.active .res-new-dot { background: #fff; box-shadow: none; }
.res-count-read { color: var(--text-soft); }
.res-new-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent);
}

/* Groupe par mois. */
.res-group-h {
  position: sticky; top: 0; z-index: 2;
  font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-mute);
  padding: 10px 2px 6px;
  background: linear-gradient(180deg, var(--bg) 60%, transparent);
  backdrop-filter: blur(2px);
}

.res-list { display: flex; flex-direction: column; gap: 7px; }

/* Carte résultat. */
.res-card {
  position: relative;
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 13px;
  padding: 11px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  cursor: pointer;
  transition: border-color .12s, box-shadow .12s, transform .06s;
  --cat-color: var(--primary);
}
.res-card:hover {
  border-color: color-mix(in srgb, var(--cat-color) 55%, var(--border));
  box-shadow: 0 4px 16px -6px color-mix(in srgb, var(--cat-color) 35%, transparent), var(--shadow-sm);
  transform: translateY(-1px);
}
.res-card:active { transform: translateY(0); }
/* Liseré couleur de catégorie. */
.res-card::before {
  content: ''; position: absolute; left: 0; top: 10px; bottom: 10px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--cat-color);
  opacity: .85;
}
/* Non lu : fond légèrement teinté + liseré plein. */
.res-card.is-unread {
  background: linear-gradient(0deg, color-mix(in srgb, var(--cat-color) 5%, transparent), color-mix(in srgb, var(--cat-color) 5%, transparent)), var(--bg-elevated);
  border-color: color-mix(in srgb, var(--cat-color) 30%, var(--border));
}

/* Bloc icône coloré. */
.res-ico {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
  background: color-mix(in srgb, var(--cat-color) 15%, transparent);
}

/* Colonne centrale. */
.res-main { min-width: 0; }
.res-title {
  font-size: 14px; font-weight: 600; color: var(--text);
  line-height: 1.35; letter-spacing: -0.005em;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.res-card.is-unread .res-title { font-weight: 700; }
.res-sub {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  margin-top: 3px; font-size: 12px; color: var(--text-mute); min-width: 0;
}
.res-sub .res-party {
  font-weight: 600; color: var(--text-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px;
}
.res-sub .res-dot { color: var(--border-strong, #cbd5e1); }
.res-cat-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.01em;
  background: color-mix(in srgb, var(--cat-color) 13%, transparent);
  color: var(--cat-color);
  flex-shrink: 0;
}

/* Aperçu : conclusion / objet du compte-rendu (1 ligne, pour trier vite). */
.res-snippet {
  margin-top: 4px; font-size: 12.5px; line-height: 1.4; color: var(--text-soft);
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
  word-break: break-word;
}

/* Déjà lu : grisé / atténué (la nouveauté ressort, le reste s'efface). */
.res-card.is-read { background: var(--bg); }
.res-card.is-read .res-ico { background: var(--bg-hover); filter: grayscale(.5) opacity(.85); }
.res-card.is-read::before { opacity: .3; }
.res-card.is-read .res-title { color: var(--text-soft); font-weight: 500; }
.res-card.is-read .res-snippet { color: var(--text-mute); }
.res-card.is-read .res-cat-pill {
  background: var(--bg-hover); color: var(--text-mute);
}

/* Colonne droite : badge nouveau + date + supprimer. */
.res-side { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.res-new {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.02em;
  color: #fff; background: var(--cat-color);
  box-shadow: 0 2px 8px -2px color-mix(in srgb, var(--cat-color) 60%, transparent);
}
.res-date {
  font-size: 12px; color: var(--text-mute); white-space: nowrap;
  font-variant-numeric: tabular-nums; min-width: 76px; text-align: right;
}
.res-del {
  opacity: 0; border: none; background: transparent; cursor: pointer;
  color: var(--text-mute); font-size: 18px; line-height: 1;
  width: 26px; height: 26px; border-radius: 7px; flex-shrink: 0;
  transition: opacity .12s, background .12s, color .12s;
}
.res-card:hover .res-del { opacity: 1; }
.res-del:hover { background: rgba(239,68,68,0.12); color: var(--danger); }

/* Détail modale : préambule sans titre rendu en lecture confortable. */
.rpt-section-prewrap { white-space: pre-wrap; word-break: break-word; }

/* ══ Vue « Reçois-je tout ? » — réconciliation des canaux ════════════════ */
.rsrc-intro { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.rsrc-days { display: flex; gap: 6px; flex-shrink: 0; }
.rsrc-h { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-mute); margin: 20px 2px 10px; }

/* Bannière verdict. */
.rsrc-verdict {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 16px 18px; border-radius: var(--radius-lg, 12px);
  border: 1px solid var(--border); background: var(--bg-elevated);
}
.rsrc-verdict-ico { font-size: 26px; line-height: 1; flex-shrink: 0; }
.rsrc-verdict-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.rsrc-verdict-text { font-size: 13px; color: var(--text-soft); line-height: 1.55; }

/* Tonalités. */
.rsrc-tone-success { border-color: rgba(16,185,129,0.35); background: linear-gradient(0deg, rgba(16,185,129,0.06), rgba(16,185,129,0.06)), var(--bg-elevated); }
.rsrc-tone-danger { border-color: rgba(239,68,68,0.35); background: linear-gradient(0deg, rgba(239,68,68,0.06), rgba(239,68,68,0.06)), var(--bg-elevated); }
.rsrc-tone-warning { border-color: rgba(245,158,11,0.35); background: linear-gradient(0deg, rgba(245,158,11,0.06), rgba(245,158,11,0.06)), var(--bg-elevated); }
.rsrc-tone-info { border-color: rgba(59,130,246,0.30); background: linear-gradient(0deg, rgba(59,130,246,0.05), rgba(59,130,246,0.05)), var(--bg-elevated); }

/* Cartes canaux. */
.rsrc-chans { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.rsrc-chan { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; background: var(--bg-elevated); }
.rsrc-chan-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.rsrc-chan-ico { font-size: 18px; }
.rsrc-chan-name { font-weight: 700; font-size: 13.5px; flex: 1; }
.rsrc-chan-state { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.rsrc-chan-state.on { background: rgba(16,185,129,0.14); color: #047857; }
.rsrc-chan-state.off { background: rgba(148,163,184,0.18); color: var(--text-mute); }
.rsrc-chan-body { font-size: 12px; color: var(--text-soft); line-height: 1.7; }

/* Carte générique + stats. */
.rsrc-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; background: var(--bg-elevated); }
.rsrc-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.rsrc-stat { text-align: center; padding: 10px; border-radius: var(--radius); background: var(--bg); border: 1px solid var(--border); }
.rsrc-stat-n { font-size: 26px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.rsrc-stat-l { font-size: 11.5px; color: var(--text-mute); margin-top: 2px; line-height: 1.3; }
.rsrc-stat.rsrc-tone-success .rsrc-stat-n { color: #059669; }
.rsrc-stat.rsrc-tone-danger  .rsrc-stat-n { color: #dc2626; }
.rsrc-stat.rsrc-tone-warning .rsrc-stat-n { color: #d97706; }
.rsrc-stat-sub { font-size: 10.5px; color: var(--text-mute); margin-top: 3px; font-style: italic; }
.rsrc-h-danger  { color: #dc2626 !important; }
.rsrc-h-warning { color: #d97706 !important; }
.rsrc-redund { margin-top: 12px; font-size: 13px; color: var(--text-soft); }
.rsrc-since { margin-top: 8px; font-size: 11.5px; color: var(--text-mute); }

/* Barres d'estimation. */
.rsrc-bars { display: flex; flex-direction: column; gap: 10px; }
.rsrc-bar-top { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-soft); margin-bottom: 4px; }
.rsrc-bar-n { font-variant-numeric: tabular-nums; font-weight: 600; }
.rsrc-bar-track { height: 8px; border-radius: 999px; background: var(--bg-hover); overflow: hidden; }
.rsrc-bar-fill { height: 100%; border-radius: 999px; }

/* ── Bibliothèque de documents (modale) ──────────────────────────────── */
.doclib { display: flex; flex-direction: column; gap: 12px; height: 100%; padding: 16px; min-height: 0; }
.doclib-search {
  width: 100%; padding: 10px 14px; font-size: 14px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg);
}
.doclib-search:focus { border-color: var(--primary); box-shadow: var(--focus-ring); outline: none; }
.doclib-cats { display: flex; flex-wrap: wrap; gap: 6px; }
.doclib-chip {
  padding: 5px 12px; font-size: 12px; font-weight: 500;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--bg-elevated); color: var(--text-soft); cursor: pointer;
  transition: all .12s;
}
.doclib-chip:hover { border-color: var(--primary); color: var(--primary); }
.doclib-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.doclib-list {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
  overflow-y: auto; padding: 2px; flex: 1; min-height: 0; align-content: start;
}
.doclib-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; text-align: left; cursor: pointer;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); transition: border-color .12s, box-shadow .12s, background .12s;
}
.doclib-card:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.doclib-card.stub { opacity: .62; }
.doclib-card.stub:hover { border-color: var(--border-strong); box-shadow: none; }
.doclib-card-icon { font-size: 22px; line-height: 1; flex-shrink: 0; width: 28px; text-align: center; }
.doclib-card-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.doclib-card-title { font-size: 13.5px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 6px; }
.doclib-card-desc { font-size: 11.5px; color: var(--text-mute); }
.doclib-badge {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  padding: 1px 6px; border-radius: 6px; background: var(--bg); color: var(--text-mute); border: 1px solid var(--border);
}
.doclib-empty { grid-column: 1 / -1; padding: 32px; text-align: center; color: var(--text-mute); font-size: 13px; }

/* ── Bloc questionnaire IRM (formulaire imagerie) ────────────────────── */
.imagerie-check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.imagerie-mri { display: flex; flex-direction: column; gap: 8px; padding: 12px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); }
.imagerie-mri-note { font-size: 11.5px; color: var(--warn-text, #92400E); }
.imagerie-mri-row { display: flex; flex-direction: column; gap: 4px; }
.imagerie-mri-row label { font-size: 12px; }
.imagerie-hint { font-size: 11.5px; color: var(--text-mute); background: var(--bg); padding: 8px 10px; border-radius: var(--radius); }

/* ── Sélecteur clinique (médicaments + diagnostics cochables) ─────────── */
.clinical-picker { display: flex; flex-direction: column; gap: 12px; }
.pick-section { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.pick-title { font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 8px; display: flex; align-items: baseline; gap: 8px; }
.pick-hint { font-size: 10.5px; font-weight: 400; color: var(--text-mute); }
.pick-list { display: flex; flex-direction: column; gap: 4px; }
.pick-list.pick-cols { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 16px; }
.pick-item { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; font-weight: 400; cursor: pointer; padding: 3px 4px; border-radius: 6px; }
.pick-item:hover { background: var(--bg-hover, rgba(0,0,0,0.03)); }
.pick-item input { margin-top: 2px; flex-shrink: 0; }
.pick-empty { font-size: 12px; color: var(--text-mute); font-style: italic; }
@media (max-width: 720px) { .pick-list.pick-cols { grid-template-columns: 1fr; } }

@media (max-width: 720px) {
  .doclib-list { grid-template-columns: 1fr; }
}

.consult-footer-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  position: sticky;
  bottom: 0;
  z-index: 4;
}
.consult-footer-bar .footer-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.consult-footer-bar .footer-field {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
}
.consult-footer-bar .footer-field span {
  color: var(--text-soft);
  font-weight: 500;
  white-space: nowrap;
}
.consult-footer-bar .footer-field select,
.consult-footer-bar .footer-field input {
  padding: 4px 8px;
  font-size: 12.5px;
}
.consult-footer-bar .footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
}
.consult-footer-bar .footer-actions .btn-ghost,
.consult-footer-bar .footer-actions .btn-primary {
  padding: 6px 12px;
  font-size: 12.5px;
}

/* =====================================================================
   Chat
   ===================================================================== */
.chat-layout { display: grid; grid-template-columns: 260px 1fr; gap: 18px; height: calc(100vh - var(--topbar-h) - 50px); }
.chat-threads { overflow-y: auto; }
.chat-thread {
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  margin-bottom: 4px;
  transition: var(--transition);
}
.chat-thread:hover { background: var(--bg-hover); }
.chat-thread.active { background: var(--primary-soft); color: var(--primary-text-on-soft); }
.chat-thread .title { font-weight: 600; font-size: 13.5px; }
.chat-thread .sub { font-size: 11px; color: var(--text-mute); margin-top: 2px; }

.chat-window { display: flex; flex-direction: column; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.chat-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.chat-bubble.user {
  background: var(--primary);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.chat-bubble.assistant {
  background: var(--bg-hover);
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.chat-input-bar {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.chat-input-bar textarea {
  flex: 1;
  resize: none;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  font-family: inherit;
  font-size: 13.5px;
  min-height: 42px;
  max-height: 200px;
}
.chat-input-bar textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* =====================================================================
   Calendar
   ===================================================================== */
.calendar-week {
  display: grid;
  grid-template-columns: 60px repeat(7, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-elevated);
}
.cal-head { padding: 10px; text-align: center; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); font-size: 12px; font-weight: 600; color: var(--text-soft); }
.cal-head.today { color: var(--primary); }
.cal-head:last-child { border-right: none; }
.cal-time { padding: 6px 10px; text-align: right; font-size: 11px; color: var(--text-mute); border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); height: 56px; }
.cal-cell { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); height: 56px; position: relative; cursor: pointer; transition: var(--transition); }
.cal-cell:hover { background: var(--bg-hover); }
.cal-cell:last-child { border-right: none; }
.cal-event {
  position: absolute;
  left: 4px; right: 4px;
  padding: 4px 6px;
  background: var(--primary-soft);
  color: var(--primary-text-on-soft);
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-left: 3px solid var(--primary);
  cursor: pointer;
  z-index: 2;
}
.cal-event-block {
  margin: 4px;
  padding: 4px 8px;
  background: var(--primary-soft);
  color: var(--primary-text-on-soft);
  border-left: 3px solid var(--primary);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* =====================================================================
   Stats charts
   ===================================================================== */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 160px;
  padding-top: 14px;
}
.bar {
  flex: 1;
  background: linear-gradient(to top, var(--primary), var(--accent));
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  position: relative;
  transition: var(--transition);
  cursor: pointer;
}
.bar:hover { opacity: 0.85; transform: scaleY(1.02); transform-origin: bottom; }
.bar-tooltip {
  position: absolute;
  bottom: 100%; left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: var(--text);
  color: var(--bg);
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}
.bar:hover .bar-tooltip { opacity: 1; }
.chart-x-axis {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}
.chart-x-axis span {
  flex: 1;
  font-size: 9px;
  color: var(--text-mute);
  text-align: center;
}

/* =====================================================================
   Loaders
   ===================================================================== */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Placeholder de chargement animé (balayage). Utiliser <div class="skeleton">
   avec une hauteur/largeur fixées pour pré-tracer le contenu à venir. */
.skeleton {
  background: linear-gradient(90deg, var(--bg-hover) 25%, var(--bg-active) 37%, var(--bg-hover) 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
  border-radius: var(--radius-sm);
}
.skeleton-text { height: 12px; margin: 7px 0; }
.skeleton-text.sk-lg { height: 16px; }
.skeleton-text.sk-w60 { width: 60%; } .skeleton-text.sk-w40 { width: 40%; } .skeleton-text.sk-w80 { width: 80%; }
@keyframes skeleton-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
}

/* Indicateur flottant « tâche en arrière-plan » (nettoyage du dossier).
   Coin inférieur droit, non bloquant — le dossier reste navigable. */
.record-clean-badge {
  position: fixed;
  bottom: 22px; right: 22px;
  z-index: 250;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px;
  background: var(--surface, #fff);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  pointer-events: none;
  animation: record-clean-in .22s ease-out;
}
@keyframes record-clean-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* =====================================================================
   Kanban Board
   ===================================================================== */
.kanban-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 300px;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
  min-height: calc(100vh - 160px);
}
.kanban-col {
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 180px);
}
.kanban-col.dropping {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.kanban-col-h {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.kanban-col-title { font-weight: 600; font-size: 13px; }
.kanban-col-count {
  font-size: 11px;
  color: var(--text-mute);
  background: var(--bg-elevated);
  padding: 1px 7px;
  border-radius: 8px;
  margin-left: 4px;
}
.kanban-col-body {
  padding: 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.kanban-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: grab;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.kanban-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kanban-card.dragging { opacity: 0.4; cursor: grabbing; }
.kanban-card-title { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.kanban-card-body { font-size: 12px; color: var(--text-soft); line-height: 1.45; }

/* Mode "À faire" pleine largeur — une seule colonne, pas de scroll horizontal,
   messages affichés en entier (pas de truncation visuelle). */
.kanban-board.single-col {
  display: block;
  overflow-x: visible;
  grid-auto-columns: none;
}
.kanban-board.single-col .kanban-col {
  width: 100%;
  max-width: none;
  max-height: none;
}
.kanban-board.single-col .kanban-col-body {
  overflow-y: visible;
}
.kanban-board.single-col .kanban-card-body {
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.kanban-card.done {
  opacity: 0.72;
  background: var(--bg-sidebar);
}
.kanban-card.done .kanban-card-title {
  text-decoration: line-through;
  color: var(--text-mute);
}
.kanban-card-actions button {
  white-space: nowrap;
}
.loading-block {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 60px;
  color: var(--text-mute);
  font-size: 13px;
}

/* =====================================================================
   Markdown
   ===================================================================== */
.md { font-size: 13.5px; line-height: 1.6; }
.md h1, .md h2, .md h3 { margin: 18px 0 8px; font-weight: 700; }
.md h1 { font-size: 18px; }
.md h2 { font-size: 16px; }
.md h3 { font-size: 14px; }
.md p { margin: 8px 0; }
.md ul, .md ol { padding-left: 22px; margin: 8px 0; list-style: disc; }
.md ol { list-style: decimal; }
.md li { margin: 3px 0; }
.md code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-hover);
  padding: 1px 5px;
  border-radius: 4px;
}
.md pre {
  background: var(--bg-hover);
  padding: 12px;
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 12px;
}
.md strong { font-weight: 700; }
.md em { font-style: italic; }

/* =====================================================================
   Vue Demandes — refonte 2026-05-14
   ===================================================================== */

/* ── Toolbar : onglets pill + actions ─────────────────────────────── */
.dmd-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.dmd-tabs {
  display: inline-flex;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  gap: 2px;
  box-shadow: var(--shadow-sm);
}
.dmd-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.dmd-tab:hover { background: var(--bg-hover); color: var(--text); }
.dmd-tab.active {
  background: var(--primary);
  color: var(--text-on-primary);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}
.dmd-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--bg-hover);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.dmd-tab.active .dmd-tab-count {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}
.dmd-tab[data-tab="pending"]:not(.active) .dmd-tab-count[data-nonzero="1"] {
  background: #FEF3C7;
  color: #92400E;
}
.dmd-tab[data-tab="done"]:not(.active) .dmd-tab-count[data-nonzero="1"] {
  background: #D1FAE5;
  color: #065F46;
}

.dmd-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}
.dmd-actions .btn-ghost-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.dmd-actions .btn-ghost-icon:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  color: var(--text);
}
.dmd-actions .btn-ai-hero {
  background: linear-gradient(135deg, #7C3AED, #5B21B6);
  color: #fff;
  border: none;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}
.dmd-actions .btn-ai-hero:hover {
  filter: brightness(1.08);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
  transform: translateY(-1px);
}

/* ── Table : ajustements ──────────────────────────────────────────── */
.dmd-table { table-layout: fixed; }
.dmd-th-sort:hover { color: var(--primary); background: var(--bg-hover); }
.dmd-th-sort.active { color: var(--primary); }
.dmd-table thead th {
  background: var(--bg-sidebar);
  font-size: 11px;
  letter-spacing: 0.05em;
}
.dmd-table tbody td {
  padding: 14px 14px;
  vertical-align: top;
  font-size: 13px;
}
.dmd-table tbody tr { cursor: default; }

/* ── Cellule patient ──────────────────────────────────────────────── */
.dmd-patient {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dmd-patient-name { font-weight: 600; color: var(--text); line-height: 1.3; }
.dmd-patient-meta { font-size: 11.5px; color: var(--text-mute); }
.dmd-link {
  color: var(--primary);
  word-break: break-all;
  font-size: 12.5px;
}
.dmd-link:hover { text-decoration: underline; }

/* ── Badge urgence + type ─────────────────────────────────────────── */
.dmd-urg-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 22px;
  padding: 0 7px;
  border-radius: 11px;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  margin-right: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
.dmd-urg-pill.lvl-hi  { background: #DC2626; }
.dmd-urg-pill.lvl-mid { background: #F59E0B; }
.dmd-urg-pill.lvl-lo  { background: #10B981; }
.dmd-type-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--bg-hover);
  color: var(--text-soft);
  font-size: 11.5px;
  font-weight: 500;
}

/* ── Cellule message + brief IA ───────────────────────────────────── */
.dmd-msg { max-height: 220px; overflow: hidden; position: relative; }
.dmd-msg-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.dmd-msg.is-truncated::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 36px;
  background: linear-gradient(180deg, transparent, var(--bg-elevated));
  pointer-events: none;
}
.dmd-msg-expand {
  display: inline-block;
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--primary);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-weight: 600;
}
.dmd-msg-expand:hover { text-decoration: underline; }

.dmd-brief {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #F5F3FF, #EDE9FE);
  border: 1px solid #DDD6FE;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.45;
  color: #5B21B6;
}
.dmd-brief-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 6px;
  background: #7C3AED;
  color: #fff;
  font-size: 11px;
}
.dmd-brief-body { flex: 1; min-width: 0; }
.dmd-brief-reason { display: block; font-size: 11px; color: #7C3AED; opacity: 0.7; margin-top: 2px; }

/* ── Note interne : toolbar micro + textarea + actions IA ─────────── */
.dmd-note-wrap { display: flex; flex-direction: column; gap: 6px; }
.dmd-note-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 22px;
}
.dmd-note-mic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all .12s;
}
.dmd-note-mic:hover { border-color: var(--primary); background: var(--bg-hover); }
.dmd-note-mic.recording {
  background: #FEE2E2;
  border-color: #EF4444;
  color: #B91C1C;
  animation: dmd-mic-pulse 1.1s ease-in-out infinite;
}
@keyframes dmd-mic-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,.5); } 50% { box-shadow: 0 0 0 4px rgba(239,68,68,0); } }
.dmd-note {
  width: 100%;
  min-height: 70px;
  max-height: 200px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-input);
  font-size: 12.5px;
  font-family: inherit;
  line-height: 1.45;
  resize: vertical;
  transition: var(--transition);
}
.dmd-note:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.dmd-note-state {
  font-size: 10px;
  color: var(--text-mute);
  pointer-events: none;
  user-select: none;
}
.dmd-note-state.saved   { color: var(--success); }
.dmd-note-state.saving  { color: var(--warning); }
.dmd-note-state.error   { color: var(--danger); }

/* Barre IA sous la note interne — 4 boutons compacts */
.dmd-note-ia-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-top: 2px;
}
.dmd-btn-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 5px 8px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-surface);
  color: var(--text);
  cursor: pointer;
  transition: all .12s;
  white-space: nowrap;
  text-align: center;
}
.dmd-btn-mini:hover { border-color: var(--primary); transform: translateY(-1px); }
.dmd-btn-mini:disabled { opacity: 0.5; cursor: wait; transform: none; }
.dmd-btn-mini.dmd-btn-ia-reply { color: #92400E; background: #FFFBEB; border-color: #FCD34D; }
.dmd-btn-mini.dmd-btn-ia-reply:hover { background: #FEF3C7; border-color: #F59E0B; }
.dmd-btn-mini.dmd-btn-ia-triage { color: #0E7490; background: #ECFEFF; border-color: #67E8F9; }
.dmd-btn-mini.dmd-btn-ia-triage:hover { background: #CFFAFE; border-color: #22D3EE; }
.dmd-btn-mini.dmd-btn-ia-summary { color: #065F46; background: #ECFDF5; border-color: #6EE7B7; }
.dmd-btn-mini.dmd-btn-ia-summary:hover { background: #D1FAE5; border-color: #34D399; }
.dmd-btn-mini.dmd-btn-ia-mail { color: #1D4ED8; background: #EFF6FF; border-color: #93C5FD; }
.dmd-btn-mini.dmd-btn-ia-mail:hover { background: #DBEAFE; border-color: #60A5FA; }

/* ── Cellule Actions : 3 groupes hiérarchisés ─────────────────────── */
.dmd-actions-cell { padding: 10px 12px !important; }
.dmd-action-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 130px;
}
.dmd-action-stack .dmd-btn { width: 100%; }
.dmd-action-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
}
.dmd-action-group:first-child { padding-top: 0; border-top: none; }
.dmd-action-group-row { display: flex; gap: 4px; }
.dmd-action-group-row .dmd-btn { flex: 1; }

.dmd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 10px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 7px;
  border: 1px solid;
  background: var(--bg-elevated);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  letter-spacing: -0.005em;
  line-height: 1;
}
.dmd-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.dmd-btn:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* Variantes — Action principale (Fait) */
.dmd-btn-done {
  color: #fff;
  background: var(--success);
  border-color: var(--success);
  padding: 8px 10px;
  font-size: 12px;
}
.dmd-btn-done:hover { background: #059669; border-color: #059669; }
.dmd-btn-undone {
  color: #92400E;
  background: #FEF3C7;
  border-color: #FCD34D;
}
.dmd-btn-undone:hover { background: #FDE68A; }

/* Variantes — IA */
.dmd-btn-ia {
  color: #6D28D9;
  background: #F5F3FF;
  border-color: #C4B5FD;
}
.dmd-btn-ia:hover { background: #EDE9FE; border-color: #A78BFA; }
.dmd-btn-ia-reply {
  color: #B45309;
  background: #FFFBEB;
  border-color: #FCD34D;
}
.dmd-btn-ia-reply:hover { background: #FEF3C7; border-color: #F59E0B; }
.dmd-btn-ia-triage {
  color: #0E7490;
  background: #ECFEFF;
  border-color: #67E8F9;
}
.dmd-btn-ia-triage:hover { background: #CFFAFE; border-color: #22D3EE; }
.dmd-btn-ia-summary {
  color: #065F46;
  background: #ECFDF5;
  border-color: #6EE7B7;
}
.dmd-btn-ia-summary:hover { background: #D1FAE5; border-color: #34D399; }
.dmd-btn-ia-mail {
  color: #1D4ED8;
  background: #EFF6FF;
  border-color: #93C5FD;
}
.dmd-btn-ia-mail:hover { background: #DBEAFE; border-color: #60A5FA; }

/* Résumé IA inline dans cellule message (cliquable → ouvre zone réponse) */
.dmd-ai-summary {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px;
  margin-bottom: 6px;
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-radius: 6px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #065F46;
}
[data-theme="dark"] .dmd-ai-summary { background: #052e16; border-color: #166534; color: #86efac; }
.dmd-brief-icon--summary { background: #BBF7D0; color: #047857; font-size: 11px; }
.dmd-brief-text { flex: 1; min-width: 0; }

.dmd-ai-summary--clickable {
  cursor: pointer;
  user-select: none;
  transition: all .15s;
}
.dmd-ai-summary--clickable:hover { background: #DCFCE7; border-color: #86EFAC; }
.dmd-summary-chevron {
  font-size: 11px;
  color: #047857;
  flex-shrink: 0;
  opacity: 0.7;
}
.dmd-ai-summary--clickable:hover .dmd-summary-chevron { opacity: 1; }

/* Bulle "Résumé IA en cours" affichée tant que le worker n'a pas produit ai_summary */
.dmd-ai-summary--pending {
  background: #FEF3C7;
  border-color: #FCD34D;
  color: #92400E;
  font-style: italic;
  align-items: center;
}
[data-theme="dark"] .dmd-ai-summary--pending { background: #422006; border-color: #92400E; color: #FCD34D; }
.dmd-summary-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid #FCD34D;
  border-top-color: #92400E;
  border-radius: 50%;
  animation: dmdSpin 0.8s linear infinite;
  flex-shrink: 0;
}
[data-theme="dark"] .dmd-summary-spinner { border-color: #92400E; border-top-color: #FCD34D; }
@keyframes dmdSpin { to { transform: rotate(360deg); } }

/* Mail reply preview */
.dmd-mail-context { margin-bottom: 8px; }

/* Variantes — Comm */
.dmd-btn-ordo {
  color: #C2410C;
  background: #FFF7ED;
  border-color: #FDBA74;
}
.dmd-btn-ordo:hover { background: #FFEDD5; border-color: #FB923C; }
.dmd-btn-com {
  color: #1D4ED8;
  background: #EFF6FF;
  border-color: #93C5FD;
}
.dmd-btn-com:hover { background: #DBEAFE; border-color: #60A5FA; }

/* Variantes — Détail / neutre */
.dmd-btn-ghost {
  color: var(--text-soft);
  background: var(--bg-elevated);
  border-color: var(--border);
}
.dmd-btn-ghost:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  color: var(--text);
}

/* Variante — Danger */
.dmd-btn-danger {
  color: var(--danger);
  background: #FEF2F2;
  border-color: #FCA5A5;
}
.dmd-btn-danger:hover { background: #FEE2E2; border-color: var(--danger); }

/* Spinner inline pour boutons */
.dmd-btn .spin {
  display: inline-block;
  width: 11px;
  height: 11px;
  border: 1.5px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: dmd-spin 0.8s linear infinite;
}
@keyframes dmd-spin { to { transform: rotate(360deg); } }

/* Super-brief card */
.dmd-super-brief {
  margin-bottom: 14px;
  background: linear-gradient(135deg, #F5F3FF, #FAF5FF);
  border: 1px solid #DDD6FE;
}
.dmd-super-brief .card-h h2 { color: #5B21B6; }

/* =====================================================================
   Polish design Demandes (2026-05) — liseré d'urgence, statut sync,
   dé-bruitage du bouton Supprimer, focal résumé IA.
   Bloc contigu et volontairement en fin de section = revert trivial.
   ===================================================================== */

/* Liseré d'urgence à gauche de chaque ligne : triage visible au scan
   (rouge ≥8, ambre ≥5, vert <5). Sans score IA → pas de liseré. */
.dmd-table tbody tr[data-urg] td:first-child { position: relative; }
.dmd-table tbody tr[data-urg] td:first-child::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  border-radius: 0 2px 2px 0;
}
.dmd-table tbody tr[data-urg="hi"]  td:first-child::before { background: #DC2626; }
.dmd-table tbody tr[data-urg="mid"] td:first-child::before { background: #F59E0B; }
.dmd-table tbody tr[data-urg="lo"]  td:first-child::before { background: #10B981; }

/* Pastille statut « Auto-sync » : lecture immédiate « flux en vie » */
.dmd-autosync-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.28);
  color: #047857;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
[data-theme="dark"] .dmd-autosync-pill { color: #6EE7B7; }

/* La pile d'actions suit la largeur de sa colonne (plus de min-width rigide
   qui débordait de la cellule et se faisait rogner par overflow:hidden). */
.dmd-action-stack { min-width: 0; }

/* Filet anti-rognage : fenêtre trop étroite pour les 9 colonnes → on défile
   horizontalement au lieu de couper la colonne Actions (overflow:hidden du
   .table-wrap). Aucun scrollbar quand tout tient. Scopé à la vue Demandes. */
#demandes-list { overflow-x: auto; }

/* Supprimer = action destructive → discrète par défaut, rouge au survol.
   Retire le rouge permanent qui saturait visuellement chaque ligne. */
.dmd-btn-danger {
  color: var(--text-mute);
  background: transparent;
  border-color: var(--border);
  font-weight: 500;
}
.dmd-btn-danger:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.45);
}

/* Résumé IA = élément le plus lu : accent gauche + survol qui « lève » */
.dmd-ai-summary {
  padding: 7px 9px;
  border-radius: 8px;
  border-left: 3px solid #34D399;
}
.dmd-ai-summary--pending { border-left-color: #FCD34D; }
[data-theme="dark"] .dmd-ai-summary { border-left-color: #34D399; }
[data-theme="dark"] .dmd-ai-summary--pending { border-left-color: #FCD34D; }
.dmd-ai-summary--clickable {
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.dmd-ai-summary--clickable:hover {
  background: #DCFCE7;
  border-color: #86EFAC;
  border-left-color: #10B981;
  box-shadow: 0 3px 10px rgba(16, 185, 129, 0.14);
  transform: translateY(-1px);
}
[data-theme="dark"] .dmd-ai-summary--clickable:hover { background: #064e3b; border-color: #16a34a; }

/* =====================================================================
   Empty state
   ===================================================================== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-mute);
}
.empty-state .icon {
  width: 56px; height: 56px;
  margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-hover);
  border-radius: 50%;
  color: var(--text-mute);
}
.empty-state .icon svg { width: 28px; height: 28px; }
.empty-state h3 { font-size: 16px; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: 13px; max-width: 360px; margin: 0 auto 16px; }

/* =====================================================================
   Responsive
   ===================================================================== */
@media (max-width: 1100px) {
  :root { --sidebar-w: 220px; --clinical-aside-w: 260px; }
  .patient-detail { grid-template-columns: var(--clinical-aside-w) 1fr; }
  .patient-side { position: static; max-height: none; }
  .patient-main-header { position: static; }
}
/* SOAP : 2 colonnes tant que le main a au moins ~680px ; au-delà on stack. */
@media (max-width: 820px) {
  .soap-grid { grid-template-columns: 1fr; }
}

/* =====================================================================
   Orchestrateur IA — Modal Ctrl+I
   ===================================================================== */
.orchestrator-modal {
  width: 680px;
  max-width: 96vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.orchestrator-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  gap: 12px;
}
.orchestrator-history {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 80px;
  max-height: 380px;
  padding: 4px 0;
}
.orchestrator-history:empty::before {
  content: 'Aucun échange encore — posez votre première question ci-dessous.';
  color: var(--text-mute);
  font-size: 12.5px;
  font-style: italic;
  padding: 12px 0;
}
.orch-msg {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.6;
  max-width: 92%;
}
.orch-msg--user {
  background: var(--primary);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 3px;
}
.orch-msg--assistant {
  background: var(--bg);
  border: 1px solid var(--border);
  align-self: flex-start;
  border-bottom-left-radius: 3px;
  max-width: 98%;
}
.orch-msg--tool {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  color: #92400E;
  font-size: 12px;
  align-self: flex-start;
  font-family: var(--font-mono, monospace);
}
[data-theme="dark"] .orch-msg--tool { background: #1c1500; border-color: #78350f; color: #FCD34D; }
.orch-msg--error {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: var(--danger);
  align-self: flex-start;
}
.orchestrator-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}
.orchestrator-textarea {
  flex: 1;
  resize: none;
  font-size: 13.5px;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg-surface);
  color: var(--text);
  line-height: 1.5;
  transition: border-color .15s;
}
.orchestrator-textarea:focus { outline: none; border-color: var(--primary); }
.orchestrator-input-row .btn-primary { white-space: nowrap; height: 42px; padding: 0 20px; }

/* =====================================================================
   Bandeau sticky « génération IA en cours »
   ===================================================================== */
.ai-top-banner {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 14px;
  margin: 0 0 var(--space-3);
  background: var(--primary-soft);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  animation: ai-banner-pulse 2.4s ease-in-out infinite;
}
.ai-top-banner[hidden] { display: none; }
[data-theme="dark"] .ai-top-banner {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.22), rgba(99, 102, 241, 0.22));
  border-color: rgba(96, 165, 250, 0.4);
}
@keyframes ai-banner-pulse {
  0%, 100% { box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15); }
  50% { box-shadow: 0 6px 20px rgba(37, 99, 235, 0.30); }
}
.ai-top-banner-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--primary-text-on-soft);
}
.ai-top-banner-row .spin {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--primary);
  border-radius: 50%;
  display: inline-block;
  animation: ai-spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes ai-spin { to { transform: rotate(360deg); } }
.ai-top-banner-label { flex: 1; }

/* =====================================================================
   Scores cliniques — Modal 🧮
   ===================================================================== */
.scores-modal-body { min-height: 280px; max-height: 70vh; overflow-y: auto; padding: 4px 2px; }
.scores-loading { color: var(--text-mute); font-size: 13px; padding: 24px; text-align: center; }
.scores-section { margin-bottom: 20px; }
.scores-section h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-soft); margin: 0 0 8px; }
.scores-cat { margin-bottom: 14px; }
.scores-cat-label { font-size: 12px; font-weight: 600; color: var(--text-mute); margin-bottom: 6px; }
.scores-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.score-card {
  text-align: left;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg-surface);
  cursor: pointer;
  transition: all .12s;
  font-family: inherit;
}
.score-card:hover { border-color: var(--primary); background: var(--bg-hover); transform: translateY(-1px); }
.score-card-label { font-weight: 600; font-size: 13.5px; color: var(--text); margin-bottom: 3px; }
.score-card-indication { font-size: 11.5px; color: var(--text-mute); line-height: 1.4; }
.score-card--suggested { border-color: #6EE7B7; background: #F0FDF4; }
.score-card--suggested .score-card-label { color: #065F46; }
[data-theme="dark"] .score-card--suggested { background: #052e16; border-color: #166534; }
[data-theme="dark"] .score-card--suggested .score-card-label { color: #86efac; }

.score-form-header { margin-bottom: 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.score-form-header h3 { margin: 0; font-size: 16px; }
.score-form-indication { width: 100%; font-size: 12px; color: var(--text-mute); }
.score-form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-bottom: 12px; }
.score-form-grid .form-field { display: flex; flex-direction: column; }
.score-form-grid .form-field.full { grid-column: 1 / -1; }
.score-form-grid label { font-size: 11.5px; font-weight: 600; color: var(--text-soft); margin-bottom: 3px; }
.score-form-grid input[type="number"], .score-form-grid input[type="text"], .score-form-grid select {
  padding: 6px 8px; font-size: 13px; border: 1.5px solid var(--border); border-radius: 6px; background: var(--bg-surface); color: var(--text);
}
.phq-list { display: flex; flex-direction: column; gap: 4px; }
.phq-row { display: flex; align-items: center; gap: 8px; padding: 4px 6px; background: var(--bg); border-radius: 4px; }
.phq-label { flex: 1; font-size: 12.5px; }
.phq-row select { width: 56px; padding: 2px 4px; }
.score-actions { display: flex; justify-content: flex-end; padding-top: 8px; }

.score-result {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 10px;
  border-left: 4px solid var(--text-mute);
}
.score-result--low { background: #F0FDF4; border-left-color: #10B981; }
.score-result--mid { background: #FFFBEB; border-left-color: #F59E0B; }
.score-result--high { background: #FEF2F2; border-left-color: #EF4444; }
[data-theme="dark"] .score-result--low { background: #052e16; }
[data-theme="dark"] .score-result--mid { background: #1c1500; }
[data-theme="dark"] .score-result--high { background: #2c0a0a; }
.score-result-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.score-result-name { font-weight: 700; font-size: 15px; }
.score-result-value { font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; }
.score-result-category { font-size: 13px; color: var(--text-soft); margin-bottom: 8px; }
.score-result-target { padding: 6px 8px; background: rgba(255,255,255,0.5); border-radius: 6px; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
[data-theme="dark"] .score-result-target { background: rgba(255,255,255,0.05); }
.score-result-reco { font-size: 12.5px; line-height: 1.6; margin-bottom: 8px; white-space: pre-wrap; }
.score-result-source { font-size: 10.5px; color: var(--text-mute); font-style: italic; margin-bottom: 8px; }

/* =====================================================================
   Lecteur de carte eID belge
   ===================================================================== */
.eid-btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: none; cursor: pointer; font-weight: 600;
  border-radius: 10px; transition: all 0.15s ease;
  font-family: inherit;
}
.eid-btn:disabled { opacity: 0.6; cursor: wait; }

/* Variante "hero" : bouton voyant pour les emplacements clés (toolbar
   liste patients, modal nouveau patient, header fiche patient). */
.eid-btn-hero {
  padding: 12px 20px;
  font-size: 14.5px;
  background: linear-gradient(135deg, #0EA5E9 0%, #06B6D4 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.35), 0 1px 2px rgba(0,0,0,0.06);
  letter-spacing: 0.2px;
}
.eid-btn-hero:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.45), 0 1px 2px rgba(0,0,0,0.08);
}
.eid-btn-hero:active:not(:disabled) { transform: translateY(0); box-shadow: 0 2px 8px rgba(14, 165, 233, 0.35); }

/* Variante "inline" : sobre, pour une cellule de tableau ou un coin. */
.eid-btn-inline {
  padding: 8px 14px;
  font-size: 13px;
  background: #ECFEFF;
  color: #0E7490;
  border: 1px solid #67E8F9;
}
.eid-btn-inline:hover:not(:disabled) { background: #CFFAFE; border-color: #22D3EE; }

[data-theme="dark"] .eid-btn-inline { background: rgba(6, 182, 212, 0.15); color: #67E8F9; border-color: rgba(103, 232, 249, 0.4); }
[data-theme="dark"] .eid-btn-inline:hover:not(:disabled) { background: rgba(6, 182, 212, 0.25); }

/* Spinner intégré au bouton */
.eid-btn .spin {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.4); border-top-color: white;
  border-radius: 50%; animation: eid-spin 0.7s linear infinite;
}
.eid-btn-inline .spin { border-color: rgba(14, 116, 144, 0.3); border-top-color: #0E7490; }
@keyframes eid-spin { to { transform: rotate(360deg); } }

/* Bandeau eID en haut de la modal nouveau patient */
.eid-banner {
  display: flex; gap: 16px; align-items: center; justify-content: space-between;
  padding: 14px 16px; margin-bottom: 18px;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.08) 0%, rgba(6, 182, 212, 0.05) 100%);
  border: 1px solid rgba(14, 165, 233, 0.25);
  border-radius: 12px;
}
[data-theme="dark"] .eid-banner {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.12) 0%, rgba(6, 182, 212, 0.08) 100%);
  border-color: rgba(14, 165, 233, 0.35);
}
.eid-banner-text { flex: 1; min-width: 0; }
.eid-banner-title { font-size: 14px; font-weight: 700; color: #0E7490; margin-bottom: 4px; }
[data-theme="dark"] .eid-banner-title { color: #67E8F9; }
.eid-banner-sub { font-size: 12.5px; color: var(--text-soft); line-height: 1.5; }

/* Bouton eID dans le header de la fiche patient — bloc dédié */
.eid-sync-wrap {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}

/* Photo preview de la carte eID (au-dessus du formulaire) */
.eid-photo-preview {
  grid-column: 1 / -1;
  display: flex; gap: 14px; align-items: center;
  padding: 12px; margin-bottom: 14px;
  background: rgba(14, 165, 233, 0.06);
  border: 1px solid rgba(14, 165, 233, 0.2);
  border-radius: 10px;
}
.eid-photo-preview img {
  width: 80px; height: 96px; object-fit: cover;
  border-radius: 6px; border: 2px solid white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.eid-photo-meta { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: var(--text-soft); }
.eid-photo-meta strong { font-size: 14px; color: var(--text); }

/* Badge statut du lecteur (point coloré + label) */
.eid-status-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px;
  font-size: 11.5px; font-weight: 500;
  background: var(--bg-soft); border-radius: 999px;
  color: var(--text-soft);
}
.eid-status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-mute);
}
.eid-status-badge[data-state="ok"] .eid-status-dot { background: #10B981; box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25); }
.eid-status-badge[data-state="NO_CARD"] .eid-status-dot { background: #F59E0B; }
.eid-status-badge[data-state="NO_READER"] .eid-status-dot,
.eid-status-badge[data-state="BEID_MIDDLEWARE_MISSING"] .eid-status-dot,
.eid-status-badge[data-state="PKCS11_MODULE_MISSING"] .eid-status-dot,
.eid-status-badge[data-state="MODULE_LOAD_ERROR"] .eid-status-dot { background: #DC2626; }

/* Template picker (ORDO Mail) */
.tpl-pick-wrap { display: flex; flex-direction: column; gap: 8px; }
.tpl-pick-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  max-height: 60vh;
  overflow-y: auto;
}
.tpl-pick-card {
  text-align: left;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color 0.12s, background 0.12s, transform 0.06s;
  display: flex; flex-direction: column; gap: 6px;
}
.tpl-pick-card:hover {
  border-color: var(--primary);
  background: var(--bg-hover);
}
.tpl-pick-card:active { transform: scale(0.995); }
.tpl-pick-card.is-suggested {
  border-color: #FB923C;
  background: #FFF7ED;
}
.tpl-pick-card.is-suggested:hover { background: #FFEDD5; }
.tpl-pick-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.tpl-pick-name { font-weight: 600; font-size: 14px; color: var(--text); }
.tpl-pick-subject {
  font-size: 12px; color: var(--text-mute);
}
.tpl-pick-body {
  font-size: 12.5px;
  color: var(--text-soft);
  white-space: pre-wrap;
  line-height: 1.5;
  border-top: 1px solid var(--border);
  padding-top: 8px;
  max-height: 140px;
  overflow: hidden;
}

/* =====================================================================
   Mobile — accès smartphone via Tailscale.
   TOUT est isolé sous @media (max-width: 768px).
   Aucune modification du layout desktop, sauf cacher trois éléments
   mobile-only (qui n'existaient pas avant) à l'extérieur du media query.
   ===================================================================== */

.mobile-menu-btn,
.sidebar-close-btn,
.sidebar-backdrop {
  display: none;
}

@media (max-width: 768px) {
  /* --- Reset overflow body : on autorise le scroll natif --- */
  html, body {
    overflow: auto;
    height: auto;
    min-height: 100%;
    -webkit-text-size-adjust: 100%;
  }
  body {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    overscroll-behavior-y: contain;
  }

  /* --- App : single column, plein écran --- */
  #app {
    display: block;
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
  }

  /* --- Sidebar drawer hors-écran --- */
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 84vw;
    max-width: 320px;
    height: 100vh;
    height: 100dvh;
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    box-shadow: 4px 0 24px rgba(0,0,0,0.20);
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 200;
    -webkit-app-region: no-drag;
  }
  #app.sidebar-open .sidebar { transform: translateX(0); }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
  }
  #app.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  /* --- Topbar buttons : hamburger visible, back desktop caché --- */
  .mobile-menu-btn { display: inline-flex; }
  .desktop-back-btn { display: none; }
  .sidebar-close-btn {
    display: inline-flex;
    margin-left: auto;
    width: 36px; height: 36px;
  }

  .brand { padding: 6px 6px 14px; }

  /* --- Nav items : touch targets 44px+ --- */
  .nav-item {
    padding: 12px 12px;
    font-size: 15px;
    min-height: 44px;
  }
  .nav-item svg { width: 22px; height: 22px; }
  .nav-section { font-size: 12px; padding-top: 14px; }

  .search-trigger { padding: 12px 14px; font-size: 15px; }
  .search-trigger kbd { display: none; }

  /* --- Main : full width --- */
  .main {
    width: 100%;
    overflow: visible;
  }

  /* --- Topbar : sticky, safe-area --- */
  .topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: auto;
    min-height: 54px;
    padding: 0 10px;
    padding-top: max(0px, env(safe-area-inset-top));
    -webkit-app-region: no-drag;
  }
  .page-title {
    font-size: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 55vw;
  }
  .topbar-left, .topbar-right { gap: 4px; }
  .topbar-right .btn-primary {
    padding: 0 12px;
    font-size: 13px;
    white-space: nowrap;
    min-height: 38px;
  }

  /* --- View : padding réduit, marge bas safe-area --- */
  .view {
    padding: 14px 14px max(60px, env(safe-area-inset-bottom));
    overflow: visible;
  }

  /* --- Cards : padding réduit, radius réduit --- */
  .card { border-radius: 12px; padding: 14px; }

  /* --- Modales : full-screen --- */
  .modal-content {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    margin: 0 !important;
    display: flex;
    flex-direction: column;
  }
  .modal-body { flex: 1; overflow-y: auto; padding: 12px; -webkit-overflow-scrolling: touch; }
  .modal-header {
    padding: 12px 14px;
    padding-top: max(12px, env(safe-area-inset-top));
  }
  .modal-footer {
    padding: 10px 14px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    flex-wrap: wrap;
    gap: 8px;
  }
  .modal-footer .btn-primary,
  .modal-footer .btn-secondary,
  .modal-footer .btn-danger { flex: 1; min-width: 0; }

  /* --- Grilles : stack systématique --- */
  .form-grid,
  .form-grid-2,
  .form-grid-3,
  .form-row,
  .grid-2,
  .grid-3,
  .grid-cols-2,
  .grid-cols-3,
  .soap-grid,
  .patient-detail {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  /* --- Boutons : taille touch 44px --- */
  .btn-primary, .btn-secondary, .btn-ghost, .btn-danger {
    min-height: 44px;
    padding: 0 16px;
    font-size: 14px;
  }
  .btn-sm {
    min-height: 36px;
    padding: 0 12px;
    font-size: 13px;
  }
  .icon-btn { min-width: 40px; min-height: 40px; }

  /* --- Inputs : 16px évite le zoom automatique mobile --- */
  input, textarea, select {
    font-size: 16px !important;
  }
  textarea { min-height: 80px; }

  /* --- Tables : scroll horizontal sécurisé --- */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }

  /* --- AI banner : compact --- */
  .ai-top-banner {
    margin: -8px -8px 10px;
    padding: 8px 10px;
    font-size: 13px;
  }
  .ai-top-banner-row { font-size: 12.5px; }

  /* --- Consultation : bouton REC plein largeur, gros, sticky bas --- */
  #btn-consult-toggle {
    width: 100%;
    min-height: 56px;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
    border-radius: 14px;
  }
  #consult-live-indicator {
    font-size: 13.5px;
    padding: 8px 12px;
    border-radius: 8px;
  }

  /* --- Lists / rows --- */
  .result-item,
  .list-row,
  .patient-row,
  .consult-row,
  .group-title {
    padding: 12px;
    min-height: 56px;
  }
  .group-title { min-height: 0; }

  /* --- Search results plein largeur --- */
  .search-results { padding: 8px; }
  .search-input-wrap {
    padding: 12px 14px;
    padding-top: max(12px, env(safe-area-inset-top));
  }
  .search-input-wrap input { font-size: 16px; }

  /* --- Quick modal : 2 colonnes au lieu de 4 --- */
  .quick-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px;
    padding: 14px;
  }
  .quick-card {
    min-height: 100px;
    padding: 16px;
  }
  .quick-card svg { width: 28px; height: 28px; }

  /* --- Toasts : en bas, marge safe-area --- */
  .toasts {
    bottom: max(16px, env(safe-area-inset-bottom)) !important;
    left: 12px;
    right: 12px;
    top: auto;
  }
  .toast { font-size: 14px; padding: 12px 16px; }

  /* --- Orchestrator IA modal mobile --- */
  .orchestrator-history { max-height: none; flex: 1; min-height: 200px; }
  .orchestrator-input-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .orchestrator-input-row .btn-primary { width: 100%; height: 48px; }
  .orch-msg { max-width: 100%; }

  /* --- Scrollbars cachées (gestes natifs) --- */
  ::-webkit-scrollbar { width: 0; height: 0; }

  /* --- Sidebar/topbar : annule webkit-app-region (Electron drag) --- */
  .sidebar, .topbar, .sidebar > * { -webkit-app-region: no-drag; }

  /* --- Empêche le sélection texte accidentelle sur les touch --- */
  .nav-item, .btn-primary, .btn-secondary, .btn-danger,
  .icon-btn, .quick-card, .result-item {
    -webkit-user-select: none;
    user-select: none;
  }

  /* --- Action footer sticky (pour les pages avec boutons en bas) --- */
  .action-footer-sticky {
    position: sticky;
    bottom: 0;
    background: var(--bg-elevated);
    padding: 10px 14px max(10px, env(safe-area-inset-bottom));
    margin: 0 -14px -14px;
    border-top: 1px solid var(--border);
    z-index: 10;
  }
}

/* Très petit écran (Pixel 9 = 412px portrait, donc on est large, mais
   protection pour les anciens téléphones en portrait < 380px). */
@media (max-width: 380px) {
  .view { padding: 10px 10px max(50px, env(safe-area-inset-bottom)); }
  .nav-item { padding: 10px; font-size: 14px; }
  .page-title { max-width: 48vw; font-size: 15px; }
  .topbar-right .btn-primary { padding: 0 10px; font-size: 12.5px; }
  .quick-grid { grid-template-columns: 1fr !important; }
}

/* Landscape mobile (hauteur faible) — sidebar drawer plus étroit */
@media (max-width: 900px) and (max-height: 500px) and (orientation: landscape) {
  .sidebar { width: 60vw; max-width: 280px; }
  .topbar { min-height: 46px; }
  .modal-header { padding: 8px 14px; }
}

/* =====================================================================
   Mobile — Vue DEMANDES : table 9 colonnes → cards empilées.
   Isolé sous @media, n'affecte pas le desktop.
   ===================================================================== */
@media (max-width: 768px) {
  /* --- Toolbar : full width, plus dense --- */
  .dmd-toolbar {
    margin-bottom: 12px;
    gap: 10px;
    flex-direction: column;
    align-items: stretch;
  }

  /* Tabs : full width, scroll horizontal si nécessaire */
  .dmd-tabs {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    justify-content: space-between;
    -webkit-overflow-scrolling: touch;
  }
  .dmd-tab {
    padding: 11px 12px;
    font-size: 13.5px;
    flex: 1 0 auto;
    min-height: 44px;
    justify-content: center;
  }

  /* Actions : grille 2 colonnes, full width, icônes only pour gagner de la place */
  .dmd-actions {
    width: 100%;
    margin-left: 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .dmd-actions .btn-ghost-icon {
    padding: 10px 8px;
    font-size: 12.5px;
    justify-content: center;
    min-height: 44px;
    gap: 6px;
  }
  .dmd-actions .btn-ghost-icon svg { width: 18px; height: 18px; flex-shrink: 0; }
  /* Le Super-brief et le bouton "Ajouter" prennent toute la largeur */
  .dmd-actions .btn-ai-hero {
    grid-column: 1 / -1;
    min-height: 48px;
    font-size: 14px;
    font-weight: 600;
  }
  .dmd-actions .btn-primary {
    grid-column: 1 / -1;
    min-height: 48px;
    font-size: 14px;
  }

  /* --- Table 9 colonnes → cartes empilées --- */
  .dmd-table,
  .dmd-table tbody,
  .dmd-table tr,
  .dmd-table td {
    display: block;
    width: auto !important;
  }
  .dmd-table { table-layout: auto; }
  .dmd-table thead { display: none; }

  .dmd-table tbody tr {
    position: relative;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 12px;
    padding: 44px 12px 12px;
    box-shadow: var(--shadow-sm);
  }
  .dmd-table tbody td {
    border: none !important;
    padding: 4px 0;
    font-size: 13.5px;
  }

  /* col 1 : checkbox vide — cachée */
  .dmd-table tbody td:nth-child(1) { display: none; }

  /* col 2 : date — coin haut droit */
  .dmd-table tbody td:nth-child(2) {
    position: absolute;
    top: 10px;
    right: 12px;
    font-size: 11.5px;
    color: var(--text-mute);
    padding: 0;
    text-align: right;
    white-space: nowrap;
  }

  /* col 3 : type + urgence — coin haut gauche */
  .dmd-table tbody td:nth-child(3) {
    position: absolute;
    top: 10px;
    left: 12px;
    padding: 0;
    max-width: 60%;
  }

  /* col 4 : patient/titre — gros titre */
  .dmd-table tbody td:nth-child(4) {
    font-size: 15.5px;
    font-weight: 600;
    padding: 4px 0 4px;
    color: var(--text);
  }

  /* col 5 : email — petit, inline */
  .dmd-table tbody td:nth-child(5),
  .dmd-table tbody td:nth-child(6) {
    padding: 2px 0;
    font-size: 12.5px;
    color: var(--text-soft);
  }
  .dmd-table tbody td:nth-child(5):empty,
  .dmd-table tbody td:nth-child(6):empty { display: none; }
  .dmd-table tbody td:nth-child(5) .dmd-link { font-size: 12.5px; }

  /* col 7 : message — séparateur + padding */
  .dmd-table tbody td:nth-child(7) {
    padding-top: 10px;
    margin-top: 6px;
    border-top: 1px dashed var(--border) !important;
  }

  /* col 8 : note interne */
  .dmd-table tbody td:nth-child(8) {
    padding-top: 10px;
    margin-top: 6px;
  }

  /* col 9 : actions — séparateur en haut */
  .dmd-table tbody td:nth-child(9) {
    padding-top: 12px;
    margin-top: 6px;
    border-top: 1px dashed var(--border) !important;
  }

  /* Message body : max-height plus court sur mobile */
  .dmd-msg { max-height: 180px; }
  .dmd-msg-text { font-size: 13.5px; }
  .dmd-msg-expand {
    padding: 8px 10px;
    font-size: 12px;
    min-height: 36px;
  }

  /* Brief IA (résumé clickable) */
  .dmd-brief,
  .dmd-ai-summary {
    padding: 10px;
    font-size: 12.5px;
    border-radius: 10px;
  }
  .dmd-brief-icon { font-size: 18px; }

  /* Note wrap (textarea + micro + IA bar) */
  .dmd-note-wrap { gap: 8px; }
  .dmd-note-toolbar {
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
  }
  .dmd-note-mic {
    width: 40px;
    height: 40px;
    min-width: 40px;
    font-size: 18px;
  }
  .dmd-note {
    font-size: 16px !important; /* anti-zoom Android */
    min-height: 64px;
    padding: 10px 12px;
  }
  .dmd-note-state { font-size: 11.5px; }

  /* Barre IA (Réponse / Triage / Résumé) → grid 2 colonnes, plein largeur */
  .dmd-note-ia-bar {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .dmd-btn-mini {
    width: 100%;
    justify-content: center;
    padding: 10px 8px;
    font-size: 12px;
    min-height: 40px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Pièces jointes : badges qui wrap */
  .dmd-note-attachments {
    flex-wrap: wrap;
    gap: 6px;
  }

  /* Stack d'actions (Fait + Comm + Suppr) en grille auto-fit */
  .dmd-action-stack {
    display: flex !important;
    flex-direction: column;
    gap: 8px;
  }
  .dmd-action-group {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 6px;
  }
  .dmd-btn {
    min-height: 40px;
    padding: 8px 12px;
    font-size: 12.5px;
    justify-content: center;
  }

  /* Empty state plus aéré */
  .empty-state { padding: 40px 16px; }
}

/* Pixel 9 portrait étroit ou plus petit : 1 colonne pour les actions toolbar */
@media (max-width: 420px) {
  .dmd-actions { grid-template-columns: 1fr 1fr; }
  .dmd-actions .btn-ghost-icon { font-size: 11.5px; padding: 8px 6px; }
  .dmd-actions .btn-ghost-icon svg { width: 16px; height: 16px; }
  /* IA bar : si très étroit, passer en 1 colonne */
  .dmd-note-ia-bar { grid-template-columns: 1fr; }
}

/* ── Pills contexte (dossier / consultation) — épinglées dans le menu ───── */
#consult-bg-pill,
#patient-bg-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
  overflow: hidden;
}
#consult-bg-pill {
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
}
#consult-bg-pill:hover { filter: brightness(1.06); }
#patient-bg-pill {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
}
#patient-bg-pill:hover { background: var(--bg-hover); }
#consult-bg-pill[hidden],
#patient-bg-pill[hidden] { display: none; }
.ppill-icon { font-size: 14px; line-height: 1; flex-shrink: 0; }
.cpill-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cpill-dot {
  width: 8px;
  height: 8px;
  min-width: 8px;
  background: #4ADE80;
  border-radius: 50%;
  animation: cpill-pulse 1.8s ease-in-out infinite;
}
.cpill-hint {
  font-size: 10px;
  font-weight: 400;
  opacity: 0.75;
  margin-left: 2px;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
@keyframes cpill-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

/* ─── Chat consultation (assistant conversationnel) ─────────────────────── */
.chat-wrap {
  display: flex;
  flex-direction: column;
  height: 70vh;
  min-height: 480px;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg);
}
.chat-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.chat-bubble.chat-user {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-bubble.chat-assistant {
  align-self: flex-start;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  white-space: normal;
}
.chat-bubble.chat-streaming::after {
  content: '▋';
  animation: blink 1s steps(2, start) infinite;
  margin-left: 2px;
}
@keyframes blink {
  to { visibility: hidden; }
}
.chat-input-bar {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.chat-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  min-height: 44px;
  max-height: 200px;
}

/* Liens analytes cliquables dans le rapport biologique brut */
.bio-analyte-link {
  color: var(--primary);
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  border-radius: 3px;
  padding: 0 2px;
  transition: background 0.12s;
}
.bio-analyte-link:hover {
  background: var(--primary-soft);
  text-decoration: underline;
}

.chat-applied-badge {
  display: inline-block;
  margin-top: 10px;
  padding: 4px 10px;
  background: var(--success-soft, rgba(74, 222, 128, 0.15));
  color: var(--success, #16a34a);
  border: 1px solid var(--success, #16a34a);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.chat-mic-btn {
  min-width: 44px;
  font-size: 18px;
  line-height: 1;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.15s;
}
.chat-mic-btn:hover { background: var(--bg-elevated); }
.chat-mic-btn:disabled { opacity: 0.5; cursor: wait; }
.chat-mic-btn.recording {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
  animation: cpill-pulse 1.4s ease-in-out infinite;
}

/* ─── Revue clinique structurée (cartes colorées) ─────────────────────────── */
.rev-wrap { display: flex; flex-direction: column; gap: 12px; }
.rev-block { }
.rev-title { font-size: 13px; font-weight: 700; margin: 2px 0 8px; color: var(--text-soft); }
.rev-title-row { display: flex; align-items: center; gap: 8px; }
.rev-title-row .rev-title { margin: 0; }
.rev-title-danger { color: var(--danger); }
.rev-title-dx { color: var(--primary); }
.rev-title-exam { color: var(--info); }
.rev-title-cr { color: var(--accent); }
.rev-synthese {
  display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius);
  background: var(--primary-soft); color: var(--primary-text-on-soft);
  border-left: 4px solid var(--primary); font-size: 13.5px; line-height: 1.55;
}
.rev-synthese-icon { font-size: 16px; line-height: 1.4; }
.rev-eval {
  padding: 10px 14px; border-radius: var(--radius); background: var(--bg-hover);
  border-left: 4px solid var(--primary); font-size: 13.5px; line-height: 1.55; color: var(--text-soft);
}
.rev-corr {
  border: 1px solid var(--border); border-left-width: 4px; border-radius: var(--radius-sm);
  padding: 10px 12px; margin-bottom: 8px; background: var(--bg-elevated); transition: opacity .2s;
}
.rev-corr-h { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.rev-tag { font-size: 11px; font-weight: 800; letter-spacing: .03em; }
.rev-champ {
  font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 4px;
  background: var(--bg-hover); border: 1px solid var(--border); color: var(--text-soft);
}
.rev-corr-line { font-size: 12.5px; color: var(--text-soft); margin: 3px 0; }
.rev-corr-prop { color: var(--text); font-weight: 600; }
.rev-corr-why {
  font-size: 11.5px; color: var(--text-mute); font-style: italic;
  border-top: 1px dashed var(--border); padding-top: 5px; margin-top: 5px;
}
.rev-corr.crit-haute { border-color: var(--danger); background: rgba(239, 68, 68, .06); }
.rev-corr.crit-haute .rev-tag { color: var(--danger); }
.rev-corr.crit-moyenne { border-color: var(--warning); background: rgba(245, 158, 11, .06); }
.rev-corr.crit-moyenne .rev-tag { color: var(--warning); }
.rev-corr.crit-basse { border-color: #EAB308; background: rgba(234, 179, 8, .06); }
.rev-corr.crit-basse .rev-tag { color: #A16207; }
.rev-dx, .rev-exam {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 12px; margin-bottom: 6px; background: var(--bg-elevated);
}
.rev-dx { border-left: 3px solid var(--primary); }
.rev-exam { border-left: 3px solid var(--info); }
.rev-dx-h, .rev-exam-h { display: flex; align-items: center; gap: 8px; }
.rev-dx-h strong, .rev-exam-h strong { font-size: 13px; color: var(--text); }
.rev-badge {
  font-size: 11px; font-weight: 700; margin-left: auto;
  padding: 1px 9px; border-radius: var(--radius-full); white-space: nowrap;
}
.rev-badge.prob-haute, .rev-badge.urg-immediat { color: var(--danger); background: rgba(239, 68, 68, .12); }
.rev-badge.prob-moyenne, .rev-badge.urg-24h { color: var(--warning); background: rgba(245, 158, 11, .12); }
.rev-badge.prob-faible { color: #A16207; background: rgba(234, 179, 8, .15); }
.rev-badge.urg-programme { color: var(--primary); background: var(--primary-soft); }
.rev-dx-why, .rev-exam-ind { font-size: 12px; color: var(--text-soft); margin-top: 3px; }
.rev-dx-excl { font-size: 11.5px; color: var(--info); font-style: italic; margin-top: 3px; }
.rev-flags {
  margin: 0; padding: 10px 14px 10px 30px; background: rgba(239, 68, 68, .07);
  border-left: 4px solid var(--danger); border-radius: var(--radius-sm); list-style: disc;
}
.rev-flags li { color: var(--danger); font-size: 13px; margin: 3px 0; }
.rev-cr {
  border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: var(--radius); padding: 2px 14px 10px; background: rgba(20, 184, 166, .05);
}
.rev-cr-body { font-size: 13px; }
.rev-allclear {
  padding: 14px; border-radius: var(--radius); background: rgba(16, 185, 129, .10);
  color: var(--success); border: 1px solid rgba(16, 185, 129, .35); font-weight: 600;
}
.rev-applied-flash { outline: 2px solid var(--success); outline-offset: 1px; transition: outline .2s; }

/* Boîte de réception : barre de défilement TOUJOURS visible (macOS masque les
   barres overlay → le médecin ne voyait pas qu'il pouvait faire défiler les
   anciens messages). On force une piste + un curseur bien visibles. */
.inbox-list-scroll { scrollbar-width: thin; scrollbar-color: var(--text-mute) var(--bg-2, #eef0f3); }
.inbox-list-scroll::-webkit-scrollbar { width: 12px; }
.inbox-list-scroll::-webkit-scrollbar-track { background: var(--bg-2, #eef0f3); border-radius: 8px; }
.inbox-list-scroll::-webkit-scrollbar-thumb {
  background: var(--text-mute, #94a3b8); border-radius: 8px;
  border: 3px solid var(--bg-2, #eef0f3); min-height: 40px;
}
.inbox-list-scroll::-webkit-scrollbar-thumb:hover { background: var(--text-soft, #64748b); }

/* ── Mode Agenda : sidebar → onglets horizontaux ────────────────────────── */
#app.agenda-mode {
  grid-template-columns: 1fr;
}
#app.agenda-mode .sidebar {
  display: none;
}
#app.agenda-mode .mobile-menu-btn,
#app.agenda-mode .desktop-back-btn,
#app.agenda-mode .page-title {
  display: none;
}
#app.agenda-mode .topbar {
  padding: 0 8px 0 0;
}
#app.agenda-mode .topbar-left {
  padding: 0;
}
/* macOS : en mode agenda la sidebar est masquée, donc rien ne réserve
   l'espace des feux tricolores (close/réduire/agrandir). On décale les
   onglets pour qu'ils ne passent plus dessous. */
#app.is-mac.agenda-mode .topbar {
  padding-left: 78px;
}

/* Onglets de navigation (agenda-mode uniquement) */
.agenda-tabs {
  display: none;
  flex: 1;
  align-items: stretch;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.agenda-tabs::-webkit-scrollbar { display: none; }
#app.agenda-mode .agenda-tabs {
  display: flex;
}
.agenda-tabs .nav-item {
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  padding: 0 12px 7px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  color: var(--text-mute);
  height: 100%;
  white-space: nowrap;
  background: none !important;
}
.agenda-tabs .nav-item svg {
  width: 17px;
  height: 17px;
}
.agenda-tabs .nav-item:hover {
  color: var(--text-soft);
  border-bottom-color: var(--border-strong);
}
.agenda-tabs .nav-item.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
  background: none !important;
}

/* ── Agenda : sidebar gauche (mini-cal, recherche, tâches, praticiens) ───── */
.cal-layout { display: flex; gap: 16px; align-items: flex-start; }
.cal-main { flex: 1; min-width: 0; }
.cal-sidebar {
  width: 232px; flex-shrink: 0;
  position: sticky; top: 0;
  display: flex; flex-direction: column; gap: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}

/* Mini-calendrier */
.cal-mini { user-select: none; }
.cal-mini-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cal-mini-title { font-size: 13px; font-weight: 600; text-transform: capitalize; }
.cal-mini-nav {
  width: 24px; height: 24px; border: none; background: transparent; cursor: pointer;
  border-radius: 6px; color: var(--text-mute); font-size: 15px; line-height: 1;
}
.cal-mini-nav:hover { background: var(--bg-hover); color: var(--text); }
.cal-mini-grid { display: grid; grid-template-columns: 22px repeat(7, 1fr); gap: 1px; }
.cal-mini-dow { text-align: center; font-size: 10px; color: var(--text-mute); font-weight: 600; padding: 2px 0; }
.cal-mini-wk {
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--text-mute); cursor: pointer; border-radius: 4px;
}
.cal-mini-wk:hover { background: var(--bg-hover); }
.cal-mini-wk.inview { background: var(--primary-soft); color: var(--primary-text-on-soft); font-weight: 600; }
.cal-mini-day {
  display: flex; align-items: center; justify-content: center;
  height: 26px; font-size: 11.5px; cursor: pointer; border-radius: 50%;
  color: var(--text); transition: background var(--transition);
}
.cal-mini-day:hover { background: var(--bg-hover); }
.cal-mini-day.out { color: var(--text-mute); opacity: 0.5; }
.cal-mini-day.sel { box-shadow: inset 0 0 0 1px var(--primary); color: var(--primary); font-weight: 600; }
.cal-mini-day.today { background: var(--primary); color: #fff; font-weight: 700; }

/* Blocs sidebar */
.cal-sb-block { display: flex; flex-direction: column; gap: 6px; }
.cal-sb-title { font-size: 12px; font-weight: 700; color: var(--text-soft); text-transform: uppercase; letter-spacing: 0.03em; }
.cal-sb-input {
  width: 100%; box-sizing: border-box; padding: 7px 10px; font-size: 13px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-input); color: var(--text);
}
.cal-sb-input:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus-ring); }
.cal-sb-results { display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow-y: auto; }
.cal-sb-result {
  text-align: left; background: transparent; border: none; cursor: pointer;
  padding: 6px 8px; font-size: 12.5px; border-radius: 6px; color: var(--text);
}
.cal-sb-result:hover { background: var(--bg-hover); }
.cal-sb-empty { font-size: 12px; color: var(--text-mute); padding: 4px 2px; }

/* Tâches */
.cal-sb-tasklist { display: flex; flex-direction: column; max-height: 240px; overflow-y: auto; }
.cal-sb-task { display: flex; align-items: center; gap: 7px; padding: 4px 2px; }
.cal-sb-task-txt { flex: 1; min-width: 0; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-sb-task-del {
  border: none; background: transparent; color: var(--text-mute); cursor: pointer;
  font-size: 15px; line-height: 1; padding: 0 4px; border-radius: 4px; opacity: 0;
}
.cal-sb-task:hover .cal-sb-task-del { opacity: 1; }
.cal-sb-task-del:hover { color: var(--danger); }

/* Praticiens */
.cal-sb-prac { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }

/* Sous 760px : sidebar empilée au-dessus de la grille */
@media (max-width: 760px) {
  .cal-layout { flex-direction: column; }
  .cal-sidebar { width: 100%; position: static; flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
  .cal-sidebar > * { flex: 1 1 200px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   AGENDA — miroir AgendaPro (docteurnanni.be/medecin/calendar)
   Police Ubuntu scopée à l'agenda + design Material plat (cartes pleines).
   ═══════════════════════════════════════════════════════════════════════════ */
@font-face { font-family: 'Ubuntu'; font-weight: 400; font-style: normal; font-display: swap; src: url('../fonts/Ubuntu-Regular.woff2') format('woff2'); }
@font-face { font-family: 'Ubuntu'; font-weight: 500; font-style: normal; font-display: swap; src: url('../fonts/Ubuntu-Medium.woff2') format('woff2'); }
@font-face { font-family: 'Ubuntu'; font-weight: 600 700; font-style: normal; font-display: swap; src: url('../fonts/Ubuntu-Bold.woff2') format('woff2'); }

.agp-root { --agp-blue: #0288d1; --agp-teal: #01BDC3; display: flex; flex-direction: column; font-family: 'Ubuntu', var(--font-sans); color: #1e293b; }

/* Toolbar */
.agp-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; background: #fff; border-bottom: 1px solid var(--border); }
.agp-nav { display: flex; gap: 2px; }
.agp-iconbtn { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border: none; background: transparent; border-radius: 6px; cursor: pointer; color: #64748b; font-size: 14px; line-height: 1; }
.agp-iconbtn:hover { background: #f1f5f9; color: #334155; }
.agp-btn { font-size: 12px; font-weight: 600; border: 1px solid var(--border-strong); border-radius: 8px; padding: 5px 12px; background: #fff; cursor: pointer; color: #334155; }
.agp-btn:hover { background: #f8fafc; }
.agp-period { font-size: 15px; font-weight: 700; margin: 0; text-transform: capitalize; color: #1e293b; min-width: 150px; }
.agp-substats { font-size: 11px; color: #94a3b8; font-weight: 500; white-space: nowrap; }
.agp-icongroup { display: flex; gap: 1px; border: 1px solid var(--border); border-radius: 8px; padding: 2px; }
.agp-legend { display: flex; gap: 6px; flex-wrap: wrap; }
.agp-legend-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; background: #fff; cursor: pointer; color: #374151; }
.agp-legend-chip.off { color: #cbd5e1; text-decoration: line-through; }
.agp-legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.agp-toolbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.agp-weekend { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: #475569; cursor: pointer; }
.agp-viewseg { display: flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.agp-viewseg button { border: none; background: #fff; font-size: 12px; font-weight: 600; padding: 6px 12px; cursor: pointer; color: #475569; }
.agp-viewseg button:hover { background: #f8fafc; }
.agp-viewseg button.active { background: var(--agp-blue); color: #fff; }

/* Bandeau déplacement (parking) */
.agp-parkbanner { display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: rgba(2,136,209,.10); border-bottom: 1px solid rgba(2,136,209,.40); }
.agp-parkbanner-txt { font-size: 14px; font-weight: 600; color: #01579b; }
.agp-parkbanner-hint { font-size: 12px; color: #64748b; }

/* Corps : sidebar + grille */
.agp-body { display: flex; overflow: hidden; }
.agp-sidebar { width: 236px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--border); overflow-y: auto; padding-bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.agp-sb-primary { margin: 4px 10px 0; padding: 10px; background: var(--agp-blue); color: #fff; border: none; border-radius: 10px; font-weight: 600; font-size: 13px; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.agp-sb-primary:hover { background: #0277bd; }
.agp-sb-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 10px; }
.agp-sb-2col-btn { padding: 8px; border-radius: 8px; font-size: 12px; font-weight: 600; cursor: pointer; background: #fff; }
.agp-sb-2col-btn.blue { border: 1px solid #bae6fd; color: #0369a1; }
.agp-sb-2col-btn.blue:hover { background: #f0f9ff; }
.agp-sb-2col-btn.gray { border: 1px solid var(--border); color: #475569; }
.agp-sb-2col-btn.gray:hover { background: #f8fafc; }
.agp-sb-block { margin: 0 10px; position: relative; }
.agp-sb-input { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: #f8fafc; font-size: 13px; font-family: inherit; }
.agp-sb-results { position: absolute; left: 0; right: 0; z-index: 20; margin-top: 2px; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 20px rgba(0,0,0,.12); max-height: 240px; overflow-y: auto; }
.agp-sb-results:empty { display: none; }
.agp-sb-result { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border: none; background: transparent; cursor: pointer; text-align: left; }
.agp-sb-result:hover { background: #eff6ff; }
.agp-sb-ava { width: 24px; height: 24px; border-radius: 50%; background: #e0e7ff; color: #3730a3; font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.agp-sb-result-name { font-size: 13px; color: #334155; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agp-sb-empty { font-size: 12px; color: #94a3b8; padding: 8px; }
.agp-filter-chip { margin: 0 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; padding: 6px 10px; font-size: 12px; color: #1d4ed8; }
.agp-filter-chip button { border: none; background: none; color: #2563eb; cursor: pointer; font-size: 14px; line-height: 1; }
.agp-park { margin: 6px 10px; border: 2px dashed var(--border); border-radius: 10px; padding: 14px 8px; display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; }
.agp-park.active { border-color: var(--agp-blue); background: rgba(2,136,209,.08); }
.agp-park.over { border-color: #60a5fa; background: #eff6ff; }
.agp-park-hint { font-size: 11px; color: #94a3b8; line-height: 1.3; }
.agp-park-title { font-size: 11px; font-weight: 700; color: #01579b; }
.agp-park-name { font-size: 12px; font-weight: 600; color: #374151; }
.agp-park-cancel { font-size: 11px; font-weight: 600; color: #ef4444; background: none; border: none; cursor: pointer; margin-top: 2px; }

/* Grille */
.agp-scroll { flex: 1; height: 100%; overflow: auto; display: flex; background: #fff; }
.agp-col { display: flex; flex-direction: column; min-width: 128px; flex: 1; border-right: 1px solid var(--border); }
.agp-col:last-child { border-right: none; }
.agp-col.agp-gutter { flex: 0 0 48px; min-width: 48px; }
.agp-head { position: sticky; top: 0; z-index: 6; background: #fff; }
.agp-head.today { background: rgba(239,246,255,.7); }
.agp-dayhead-spacer { height: 56px; }
.agp-allday-lbl { height: 32px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: flex-end; padding-right: 6px; font-size: 9px; color: #94a3b8; text-align: right; line-height: 1.1; }
.agp-dayhead { height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-bottom: 1px solid var(--border); }
.agp-dayhead-dow { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; color: #64748b; }
.agp-dayhead-num { font-size: 17px; font-weight: 700; color: #1e293b; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.agp-dayhead-num.today { width: 32px; height: 32px; border-radius: 50%; background: var(--agp-blue); color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.agp-dayhead-count { font-size: 9.5px; color: #94a3b8; font-weight: 500; }
.agp-allday { height: 32px; border-bottom: 1px solid var(--border); }
.agp-grid { position: relative; flex-shrink: 0; }
.agp-grid.parking { cursor: copy; }
.agp-hourlbl { position: absolute; right: 8px; font-size: 12px; font-weight: 500; color: #64748b; }
.agp-hourline { position: absolute; left: 0; right: 0; border-top: 1px solid #f3f4f6; }
.agp-avail { position: absolute; left: 0; right: 0; border-left: 3px solid var(--agp-blue); pointer-events: none; }
.agp-banner { position: absolute; inset: 0; display: flex; align-items: flex-start; justify-content: center; pointer-events: none; }
.agp-banner-pill { margin-top: 8px; font-size: 10px; font-weight: 700; background: rgba(255,255,255,.9); padding: 2px 8px; border-radius: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.agp-indispo { position: absolute; left: 0; right: 0; display: flex; align-items: center; justify-content: center; background: repeating-linear-gradient(135deg, rgba(220,38,38,.16) 0 9px, rgba(220,38,38,.07) 9px 18px); border-top: 1px solid rgba(220,38,38,.45); border-bottom: 1px solid rgba(220,38,38,.45); }
.agp-indispo-lbl { font-size: 10px; font-weight: 600; color: #b91c1c; background: rgba(255,255,255,.7); padding: 1px 6px; border-radius: 4px; }
.agp-indispo-del { position: absolute; top: 2px; right: 3px; border: none; background: none; color: #ef4444; cursor: pointer; opacity: 0; font-size: 12px; }
.agp-indispo:hover .agp-indispo-del { opacity: 1; }
.agp-card { position: absolute; left: 4px; right: 4px; border-radius: 5px; overflow: hidden; cursor: grab; padding: 3px 8px; display: flex; flex-direction: column; transition: filter .12s; }
.agp-card:active { cursor: grabbing; }
.agp-card:hover { filter: brightness(.94); }
.agp-card.dim { opacity: .3 !important; }
.agp-card.cancelled .agp-card-name { text-decoration: line-through; }
.agp-card-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.agp-card-time { font-size: 11px; font-weight: 600; opacity: .9; font-variant-numeric: tabular-nums; }
.agp-card-icons { display: flex; gap: 2px; font-size: 9px; opacity: .9; }
.agp-card-name { font-size: 13px; font-weight: 600; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agp-card-reason { font-size: 11px; opacity: .82; line-height: 1.15; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agp-card-sub { font-size: 10px; opacity: .72; line-height: 1.15; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.agp-resize { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; cursor: ns-resize; }
.agp-nowline { position: absolute; left: 0; right: 0; height: 0; border-top: 2px solid rgba(239,68,68,.85); z-index: 5; pointer-events: none; }
.agp-nowdot { position: absolute; left: -3px; top: -4px; width: 7px; height: 7px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 0 2px #fff; }
.agp-rangeband { position: absolute; left: 4px; right: 4px; background: rgba(2,136,209,.2); border: 1px solid var(--agp-blue); border-radius: 6px; pointer-events: none; z-index: 7; }
.agp-droppreview { position: absolute; left: 4px; right: 4px; border: 2px dashed var(--agp-blue); background: rgba(2,136,209,.18); border-radius: 5px; display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 7; font-size: 10px; font-weight: 600; color: #01579b; }

/* Menus flottants + tooltip */
.agp-popmenu { position: fixed; z-index: 1000; background: #fff; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 5px; min-width: 180px; border: 1px solid var(--border); }
.agp-popmenu-head { font-size: 11px; color: #94a3b8; padding: 4px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agp-popmenu button { display: block; width: 100%; text-align: left; padding: 7px 10px; border: none; background: transparent; cursor: pointer; font-size: 13px; border-radius: 6px; color: #1f2937; }
.agp-popmenu button:hover { background: #f1f5f9; }
.agp-popmenu button.danger { color: #dc2626; }
.agp-popmenu button.danger:hover { background: #fef2f2; }
.agp-tooltip { position: fixed; z-index: 1001; width: 250px; background: #0f172a; color: #fff; border-radius: 12px; padding: 12px 14px; box-shadow: 0 12px 30px rgba(0,0,0,.3); pointer-events: none; font-family: 'Ubuntu', var(--font-sans); }
.agp-tip-name { font-weight: 600; font-size: 13.5px; margin: 0; }
.agp-tip-bd { font-size: 11px; color: #cbd5e1; margin: 2px 0 0; }
.agp-tip-rows { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: #e2e8f0; }
.agp-tip-rows p { margin: 0; }
.agp-tip-rows span { color: #94a3b8; }
.agp-tip-cancel { margin-top: 8px; font-size: 11px; font-weight: 600; color: #fca5a5; }
.agp-kbd { padding: 2px 8px; border-radius: 6px; background: #f1f5f9; border: 1px solid var(--border); font-size: 12px; font-family: var(--font-mono); }

/* Vue Liste */
.agp-listwrap { flex: 1; height: 100%; overflow-y: auto; background: #f8fafc; }
.agp-list { max-width: 680px; margin: 0 auto; padding: 20px; }
.agp-list-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.agp-list-head h3 { font-size: 16px; font-weight: 700; text-transform: capitalize; margin: 0; color: #1e293b; }
.agp-list-count { font-size: 12px; color: #64748b; }
.agp-list-empty { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 40px; text-align: center; color: #94a3b8; font-size: 14px; }
.agp-list-add { margin-top: 12px; color: var(--agp-blue); background: none; border: none; cursor: pointer; font-size: 13px; font-weight: 600; }
.agp-list-rows { background: #fff; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.agp-list-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border: none; border-bottom: 1px solid #f1f5f9; background: transparent; cursor: pointer; text-align: left; }
.agp-list-row:last-child { border-bottom: none; }
.agp-list-row:hover { background: #f8fafc; }
.agp-list-bar { width: 4px; align-self: stretch; border-radius: 999px; flex-shrink: 0; }
.agp-list-time { width: 96px; flex-shrink: 0; font-size: 13px; font-weight: 600; color: #334155; font-variant-numeric: tabular-nums; }
.agp-list-time-end { color: #94a3b8; font-weight: 400; }
.agp-list-main { flex: 1; min-width: 0; }
.agp-list-name { display: block; font-weight: 600; color: #1e293b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agp-list-name.cancelled { text-decoration: line-through; color: #94a3b8; }
.agp-list-reason { display: block; font-size: 12px; color: #64748b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agp-list-phone { font-size: 12px; color: #94a3b8; flex-shrink: 0; }

/* SlotFinder */
.agp-slotfinder { position: fixed; inset: 0; z-index: 900; background: rgba(0,0,0,.4); display: flex; align-items: flex-start; justify-content: center; padding: 16px; overflow-y: auto; font-family: 'Ubuntu', var(--font-sans); }
.agp-sf-panel { background: #fff; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.3); width: 100%; max-width: 1000px; margin: 16px 0; display: flex; flex-direction: column; max-height: 92vh; }
.agp-sf-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 18px 22px 12px; border-bottom: 1px solid var(--border); }
.agp-sf-head h3 { font-size: 18px; font-weight: 700; margin: 0; }
.agp-sf-head p { font-size: 13px; color: #64748b; margin: 2px 0 0; }
.agp-sf-close { border: none; background: none; font-size: 18px; color: #94a3b8; cursor: pointer; }
.agp-sf-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 22px; border-bottom: 1px solid var(--border); }
.agp-sf-motifs { display: flex; gap: 6px; flex-wrap: wrap; }
.agp-sf-motif { padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--border); background: #fff; cursor: pointer; color: #475569; }
.agp-sf-motif.active { background: var(--agp-blue); border-color: var(--agp-blue); color: #fff; }
.agp-sf-nav { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.agp-sf-weeklbl { font-size: 13px; font-weight: 600; color: #374151; min-width: 170px; text-align: center; text-transform: capitalize; }
.agp-sf-grid { padding: 16px; display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; overflow-y: auto; }
.agp-sf-loading { grid-column: 1 / -1; text-align: center; color: #94a3b8; padding: 40px; font-size: 13px; }
.agp-sf-day { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.agp-sf-day.today { border-color: var(--agp-blue); box-shadow: 0 0 0 1px rgba(2,136,209,.3); }
.agp-sf-dayhead { padding: 8px; text-align: center; background: #f8fafc; border-bottom: 1px solid var(--border); }
.agp-sf-day.today .agp-sf-dayhead { background: rgba(2,136,209,.1); }
.agp-sf-dow { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #64748b; font-weight: 600; }
.agp-sf-num { font-size: 18px; font-weight: 700; color: #1e293b; }
.agp-sf-slots { padding: 6px; display: flex; flex-direction: column; gap: 4px; min-height: 120px; }
.agp-sf-none { font-size: 11px; color: #cbd5e1; font-style: italic; text-align: center; padding: 16px 0; }
.agp-sf-none.hol { color: #ef4444; }
.agp-sf-slot { width: 100%; text-align: center; font-size: 12px; font-weight: 600; color: #01579b; background: rgba(2,136,209,.1); border: none; border-radius: 6px; padding: 6px; cursor: pointer; font-variant-numeric: tabular-nums; }
.agp-sf-slot:hover { background: var(--agp-blue); color: #fff; }

/* Police Ubuntu scopée à l'agenda (le reste de l'app garde Inter) */
#app.agenda-mode #view { font-family: 'Ubuntu', var(--font-sans); }

/* Mobile : sidebar repliée, grille pleine largeur */
@media (max-width: 760px) {
  .agp-sidebar { display: none; }
  .agp-toolbar-right { margin-left: auto; }
}

/* =====================================================================
   SYNTHÈSE CLINIQUE DU DOSSIER PATIENT (vue d'ensemble façon DMI)
   ===================================================================== */

/* Bandeau sécurité : allergies + alertes — toujours visible en tête */
.synth-safety {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; border-radius: var(--radius);
  margin-bottom: 14px; font-size: 13px;
  border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text-soft);
}
.synth-safety.danger {
  border-color: rgba(239, 68, 68, 0.45); background: rgba(239, 68, 68, 0.07);
  color: var(--text); font-weight: 500;
}
.synth-safety.warning {
  border-color: rgba(245, 158, 11, 0.45); background: rgba(245, 158, 11, 0.07);
}
.synth-safety-label { font-weight: 700; }
.synth-safety.danger .synth-safety-label { color: var(--danger); }

/* Grille de cartes cliniques */
.synthese-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 14px; margin-bottom: 14px; align-items: start;
}
.synthese-card { padding: 14px 16px; }
.synthese-card .card-h { margin-bottom: 8px; }
.synthese-card .card-h h2 { font-size: 14px; }

/* Bandeau d'ouverture « Depuis la dernière consultation » : pleine largeur,
   accent pour attirer l'œil en premier (le « quoi de neuf » du dossier). */
.synth-since-card {
  grid-column: 1 / -1;
  border-left: 3px solid var(--primary);
  background: color-mix(in srgb, var(--primary) 4%, var(--surface, #fff));
}
.synth-since-summary { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.synth-since-empty {
  display: flex; align-items: center; gap: 8px;
  color: var(--text-mute); font-size: 13px; padding: 4px 0;
}
.synth-since-ok {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--success-bg, #e6f4ea); color: var(--success, #1a7f37);
  font-weight: 700; font-size: 12px;
}

/* Encart « Conclusion d'abord » d'un compte-rendu (modale résultat) : le
   bottom-line clinique en tête, distinct du corps du rapport. */
.res-conclusion {
  margin: 0 0 14px; padding: 12px 14px;
  background: color-mix(in srgb, var(--primary) 6%, var(--surface, #fff));
  border: 1px solid color-mix(in srgb, var(--primary) 28%, var(--border));
  border-left: 4px solid var(--primary);
  border-radius: 8px;
}
.res-conclusion-h {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--primary); margin-bottom: 5px;
}
.res-conclusion-body {
  font-size: 14px; line-height: 1.55; color: var(--text);
  white-space: pre-wrap; word-break: break-word;
  max-height: 30vh; overflow-y: auto;
}

/* Ligne compacte de synthèse */
.synth-line {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 0; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.synth-line:last-child { border-bottom: none; }
.synth-line.clickable { cursor: pointer; }
.synth-line.clickable:hover .synth-line-main { color: var(--primary); }
.synth-line-icon { flex: 0 0 auto; font-size: 14px; }
.synth-line-body { flex: 1 1 auto; min-width: 0; }
.synth-line-main { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.synth-line-sub { font-size: 11.5px; color: var(--text-mute); }
.synth-empty { color: var(--text-mute); font-size: 12.5px; padding: 6px 0; }

/* Mini-fiche paramètres vitaux */
.synth-vitals-row { display: flex; flex-wrap: wrap; gap: 10px; padding: 4px 0 2px; }
.synth-vital {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 6px 10px; min-width: 64px; text-align: center;
}
.synth-vital-k { font-size: 10.5px; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.03em; }
.synth-vital-v { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Bloc repliable (RSW / Recip-e) */
.synthese-fold { margin-bottom: 14px; padding: 0; }
.synthese-fold > summary {
  cursor: pointer; padding: 12px 16px; font-weight: 600; font-size: 13.5px;
  list-style: none; user-select: none;
}
.synthese-fold > summary::-webkit-details-marker { display: none; }
.synthese-fold > summary::before { content: '▸ '; color: var(--text-mute); }
.synthese-fold[open] > summary::before { content: '▾ '; }
.synthese-fold > .card { box-shadow: none; border: none; border-top: 1px solid var(--border); margin: 0 !important; }

/* Onglet Vaccins & Prévention */
.synth-addrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.prev-row { padding: 10px 0; border-bottom: 1px solid var(--border); }
.prev-row:last-child { border-bottom: none; }
.prev-row-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.prev-row-label { font-weight: 600; font-size: 13.5px; }
.prev-row-interval { font-size: 11.5px; color: var(--text-mute); }
.prev-row-sub { font-size: 12px; color: var(--text-soft); margin-top: 3px; }
.prev-row-advice { font-size: 11.5px; color: var(--text-mute); margin-top: 2px; font-style: italic; }

/* Courbes de paramètres vitaux */
.vital-charts-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 14px; margin-bottom: 16px;
}
.vital-chart-card { padding: 12px 14px; }
.vital-chart-card .card-h h2 { font-size: 13.5px; }
.vital-chart-last { font-size: 13px; font-weight: 600; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.vital-chart-legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--text-mute); margin-bottom: 4px; }
.vital-chart-legend > span { display: inline-flex; align-items: center; gap: 5px; }
.vital-chart-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ═══════════ Dossier « Consultations & ordonnances » : timeline unifiée ═════ */
/* (vue dossier.js — fil chronologique mêlant consultations et prescriptions)   */
.dsr-root { max-width: 1080px; margin: 0 auto; }
.dsr-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.dsr-stat {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 18px; min-width: 118px;
}
.dsr-stat b { display: block; font-size: 20px; font-weight: 700; color: var(--text); line-height: 1.2; }
.dsr-stat span { font-size: 11.5px; color: var(--text-mute); }
.dsr-controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.dsr-chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.dsr-chip {
  padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text-soft);
  cursor: pointer; white-space: nowrap;
}
.dsr-chip:hover { border-color: var(--primary); color: var(--primary); }
.dsr-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.dsr-month {
  position: sticky; top: 0; z-index: 4;
  padding: 10px 0 7px; margin-top: 6px;
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-mute); background: var(--bg);
}
.dsr-day { display: grid; grid-template-columns: 84px minmax(0, 1fr); }
.dsr-day-date { text-align: right; padding: 16px 18px 0 0; }
.dsr-day-num { font-size: 16px; font-weight: 700; color: var(--text); line-height: 1.1; }
.dsr-day-sub { font-size: 11px; color: var(--text-mute); }
.dsr-day-cards {
  position: relative; border-left: 2px solid var(--border);
  padding: 10px 0 10px 22px; display: flex; flex-direction: column; gap: 10px; min-width: 0;
}
.dsr-card {
  position: relative; background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 12px; padding: 11px 14px; cursor: pointer;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.dsr-card:hover { border-color: var(--primary); box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.dsr-card::before {
  content: ''; position: absolute; left: -28px; top: 17px;
  width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid var(--bg); box-sizing: content-box;
}
.dsr-card.consult::before { background: var(--primary); }
.dsr-card.rx::before { background: var(--accent); }
.dsr-card.rx:hover { border-color: var(--accent); }
.dsr-card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dsr-kind {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  padding: 2px 8px; border-radius: 999px; white-space: nowrap;
}
.dsr-kind-consult { background: var(--primary-soft); color: var(--primary-text-on-soft); }
.dsr-kind-rx { background: rgba(20, 184, 166, 0.14); color: var(--accent); }
.dsr-name { font-size: 13.5px; color: var(--text); }
.dsr-grow { flex: 1; }
.dsr-meta { font-size: 11.5px; color: var(--text-mute); white-space: nowrap; }
.dsr-motif { font-size: 12.5px; color: var(--text-soft); margin-top: 5px; line-height: 1.45; }
.dsr-nested { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.dsr-rx-chip {
  font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px;
  background: rgba(20, 184, 166, 0.10); color: var(--accent);
  border: 1px dashed rgba(20, 184, 166, 0.45); white-space: nowrap;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.dsr-more { padding: 16px 0 6px 106px; }
.dsr-search { background: transparent; border: none; outline: none; color: var(--text); width: 100%; font-size: 13px; }
@media (max-width: 760px) {
  .dsr-day { grid-template-columns: 56px minmax(0, 1fr); }
  .dsr-day-date { padding-right: 10px; }
  .dsr-more { padding-left: 78px; }
}
