/* ==========================================================================
   DM-TN Studio — Refonte visuelle 2026
   Langage : rail sombre flottant, cartes crème/blanches très arrondies,
   pilules, typographie Urbanist, micro-animations.
   Palette DM : #870000 · #5A0808 · #1A1A1A · #F7F4EF · #8C8C8C · #FFFFFF
   Ce fichier se charge APRÈS design-system.css et app.css : il peut donc
   surcharger sans toucher au reste de l'application.
   ========================================================================== */

/* --- 1. Jetons de la refonte --------------------------------------------- */
:root {
  --font-ui: "Urbanist", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;

  --rv-bg: #f7f4ef;
  --rv-bg-2: #f1ece4;
  --rv-card: #ffffff;
  --rv-card-2: #efe9e0;
  --rv-card-3: rgba(26, 26, 26, 0.06);
  --rv-ink: #1a1a1a;
  --rv-ink-2: #2e2a27;
  /* Gris de marque #8C8C8C pour les mentions ; le texte secondaire utilise
     une nuance plus dense pour rester lisible (contraste AA sur blanc). */
  --rv-gris-marque: #8c8c8c;
  --rv-muted: #6f6a63;
  --rv-line: rgba(26, 26, 26, 0.08);
  --rv-line-2: rgba(26, 26, 26, 0.15);
  --rv-red: #870000;
  --rv-red-2: #5a0808;
  --rv-red-3: #a81b1b;
  --rv-red-soft: #f6e9e6;
  --rv-red-softer: #fbf4f1;
  --rv-noir: #1a1a1a;
  --rv-cream: #f7f4ef;
  --rv-rail: #1a1a1a;
  --rv-on-rail: #f7f4ef;
  --rv-good: #2b7536;
  --rv-good-soft: #e5f1e5;
  --rv-bad: #b2381f;
  --rv-bad-soft: #f8e7e2;
  --rv-warn: #8c5300;
  --rv-warn-soft: #f7eedd;
  --rv-info: #6b5a4a;
  --rv-info-soft: #f1eae2;

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-xl: 26px;
  --r-pilule: 999px;

  --shadow: 0 1px 1px rgba(26, 26, 26, 0.03), 0 18px 38px -28px rgba(90, 8, 8, 0.4);
  --shadow-lg: 0 2px 6px rgba(26, 26, 26, 0.05), 0 42px 80px -34px rgba(90, 8, 8, 0.45);
  --shadow-red: 0 14px 30px -12px rgba(135, 0, 0, 0.45);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --sidebar-l: 76px;
  --header-h: 64px;

  --police: var(--font-ui);
}

/* --- 2. Base ------------------------------------------------------------- */
html { background: var(--rv-bg); }
body {
  font-family: var(--font-ui);
  background: var(--rv-bg);
  color: var(--rv-ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.005em;
}
h1, h2, h3, h4 { letter-spacing: -0.025em; color: var(--rv-ink); }
::selection { background: rgba(135, 0, 0, 0.16); color: var(--rv-red-2); }
:focus-visible { outline: 2px solid rgba(135, 0, 0, 0.45); outline-offset: 2px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: rgba(26, 26, 26, 0.16); border-radius: 10px;
  border: 3px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(26, 26, 26, 0.28); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* --- 3. Coquille --------------------------------------------------------- */
.app-shell--app {
  display: flex;
  gap: 14px;
  padding: 14px;
  min-height: 100vh;
  background:
    radial-gradient(900px 520px at 100% -10%, rgba(135, 0, 0, 0.055), transparent 60%),
    radial-gradient(700px 420px at -10% 110%, rgba(90, 8, 8, 0.045), transparent 60%),
    var(--rv-bg);
}
.app-shell--app .contenu {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.app-shell--app .main {
  flex: 1;
  min-width: 0;
  padding: 4px 6px 34px;
  overflow-x: hidden;
  max-width: var(--app-max, 1840px);
  width: 100%;
}
/* L'animation d'entrée ne joue qu'au changement de vue, jamais à chaque rendu. */
.app-shell--anim .main { animation: rv-page 0.5s var(--ease) both; }
@keyframes rv-page { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* --- 4. Rail latéral ----------------------------------------------------- */
.sidebar {
  width: 76px;
  flex: 0 0 76px;
  height: calc(100vh - 28px);
  position: sticky;
  top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 10px;
  background: var(--rv-rail);
  color: var(--rv-on-rail);
  border: none;
  border-radius: 26px;
  box-shadow: 0 24px 50px -30px rgba(0, 0, 0, 0.55);
  z-index: 45;
  overflow: hidden;
  transition: width 0.45s var(--ease), flex-basis 0.45s var(--ease), border-radius 0.45s var(--ease);
}
.app-shell--app.sidebar-large .sidebar,
.sidebar.sidebar--large { width: 248px; flex-basis: 248px; }

.sidebar__marque {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 0 10px;
  border: none;
  min-height: 46px;
}
.sidebar__logo-img {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  padding: 9px;
  object-fit: contain;
  background: var(--rv-cream);
  border-radius: 15px;
  display: block;
}
.sidebar__nom {
  display: none;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--rv-cream);
  white-space: nowrap;
}
.sidebar__nom span {
  display: block;
  margin-top: 3px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: rgba(247, 244, 239, 0.45);
  text-transform: uppercase;
}
.sidebar--large .sidebar__nom { display: block; }

.sidebar__nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: visible;
  padding: 4px 0 10px;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.sidebar__nav::-webkit-scrollbar { width: 0; height: 0; }
.sidebar__groupe {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(247, 244, 239, 0.35);
  padding: 14px 10px 6px;
  white-space: nowrap;
  display: none;
}
.sidebar--large .sidebar__groupe { display: block; }
.sidebar--large .sidebar__groupe:first-child { padding-top: 4px; }

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 48px;
  min-height: 46px;
  margin: 0 auto;
  padding: 0;
  border: none;
  border-radius: 14px;
  background: transparent;
  color: rgba(247, 244, 239, 0.62);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  flex: 0 0 auto;
  transition: background 0.25s var(--ease), color 0.25s var(--ease), transform 0.25s var(--ease);
}
.nav-item:hover {
  background: rgba(247, 244, 239, 0.09);
  color: var(--rv-cream);
  transform: translateY(-1px);
}
.nav-item:active { transform: scale(0.96); }
.nav-item svg { flex: 0 0 18px; width: 18px; height: 18px; opacity: 1; }
.nav-item > span:not(.nav-item__badge) { display: none; white-space: nowrap; }
.nav-item.actif {
  background: var(--rv-cream);
  color: var(--rv-red);
  box-shadow: 0 8px 18px -10px rgba(0, 0, 0, 0.6);
}
.sidebar--large .nav-item {
  width: 100%;
  justify-content: flex-start;
  padding: 0 12px;
  margin: 0;
}
.sidebar--large .nav-item > span:not(.nav-item__badge) { display: inline; }

/* Infobulle du rail replié */
.sidebar:not(.sidebar--large) .nav-item::before {
  content: attr(data-libelle);
  position: absolute;
  left: calc(100% + 14px);
  top: 50%;
  transform: translate(-6px, -50%);
  padding: 7px 11px;
  border-radius: 9px;
  background: var(--rv-noir);
  color: var(--rv-cream);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0;
  white-space: nowrap;
  box-shadow: 0 12px 26px -12px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.22s var(--ease);
  z-index: 60;
}
.sidebar:not(.sidebar--large) .nav-item:hover::before {
  opacity: 1;
  transform: translate(0, -50%);
}

.nav-item__badge {
  margin-left: auto;
  min-width: 18px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--rv-bad);
  color: #fff;
  font-size: 9.5px;
  font-weight: 800;
  line-height: 1.5;
  text-align: center;
  box-shadow: 0 0 0 2px var(--rv-rail);
}
.sidebar:not(.sidebar--large) .nav-item__badge {
  position: absolute;
  top: 5px;
  right: 5px;
  margin: 0;
  min-width: 15px;
  padding: 0 4px;
  font-size: 8.5px;
  box-shadow: 0 0 0 3px var(--rv-rail);
}
.nav-item.actif .nav-item__badge { background: var(--rv-red); box-shadow: 0 0 0 2px var(--rv-cream); }

.sidebar__pied {
  border: none;
  background: transparent;
  padding: 6px 0 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  font-size: 11px;
  color: rgba(247, 244, 239, 0.4);
}
.sidebar--large .sidebar__pied { align-items: stretch; }
.sidebar__pied-txt {
  display: none;
  padding: 8px 10px 0;
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(247, 244, 239, 0.3);
  white-space: nowrap;
}
.sidebar--large .sidebar__pied-txt { display: block; }

.rail-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 13px;
  background: rgba(247, 244, 239, 0.06);
  color: rgba(247, 244, 239, 0.7);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s var(--ease);
}
.rail-btn:hover { background: rgba(247, 244, 239, 0.14); color: var(--rv-cream); transform: translateY(-1px); }
.rail-btn:active { transform: scale(0.94); }
.sidebar--large .rail-btn {
  width: 100%;
  height: 40px;
  grid-auto-flow: column;
  justify-content: flex-start;
  gap: 10px;
  padding: 0 12px;
  font-size: 12.5px;
  font-weight: 600;
}
.rail-btn__txt { display: none; }
.sidebar--large .rail-btn__txt { display: inline; }

.rail-user {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--rv-cream);
  color: var(--rv-red);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  position: relative;
  border: none;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.rail-user:hover { transform: translateY(-1px); box-shadow: 0 10px 22px -12px rgba(0, 0, 0, 0.7); }
.rail-user::after {
  content: "";
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #3fae5a;
  border: 2px solid var(--rv-rail);
}
.sidebar--large .rail-user {
  width: 100%;
  height: auto;
  justify-content: flex-start;
  gap: 10px;
  padding: 6px;
  border-radius: 16px;
  background: rgba(247, 244, 239, 0.06);
  color: var(--rv-cream);
}
.sidebar--large .rail-user .rail-user__av {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--rv-cream);
  color: var(--rv-red);
  font-size: 11px;
  font-weight: 800;
}
.sidebar--large .rail-user::after { display: none; }
.rail-user__txt { display: none; text-align: left; }
.sidebar--large .rail-user__txt { display: block; }
.rail-user__txt b { display: block; font-size: 12px; font-weight: 700; color: var(--rv-cream); }
.rail-user__txt i { display: block; font-style: normal; font-size: 10px; color: rgba(247, 244, 239, 0.5); }

/* --- 5. Barre supérieure ------------------------------------------------- */
.header {
  position: sticky;
  top: 14px;
  z-index: 30;
  height: 64px;
  flex: 0 0 64px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  background: transparent;
  border: none;
  backdrop-filter: none;
}
.app-shell--tdb .header { background: transparent; }

.topbar-espace {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 4px 16px 4px 5px;
  background: var(--rv-card);
  border: 1px solid var(--rv-line);
  border-radius: 999px;
  box-shadow: var(--shadow);
  cursor: default;
  flex: 0 0 auto;
}
.topbar-espace__logo {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--rv-noir);
  color: var(--rv-cream);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.topbar-espace__txt { display: flex; flex-direction: column; line-height: 1.15; }
.topbar-espace__txt b { font-size: 12.5px; font-weight: 700; color: var(--rv-ink); }
.topbar-espace__txt i {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-style: normal;
  font-size: 10.5px;
  color: var(--rv-muted);
}
.topbar-espace__txt i::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3fae5a;
  box-shadow: 0 0 0 3px rgba(63, 174, 90, 0.14);
}

.topbar-recherche {
  flex: 1 1 auto;
  min-width: 140px;
  max-width: 640px;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  background: var(--rv-card);
  border: 1px solid var(--rv-line);
  border-radius: 999px;
  color: var(--rv-muted);
  font-size: 13px;
  cursor: text;
  box-shadow: var(--shadow);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, max-width 0.45s var(--ease);
}
.topbar-recherche:hover { border-color: var(--rv-line-2); }
.topbar-recherche:focus-within {
  border-color: rgba(135, 0, 0, 0.35);
  box-shadow: 0 0 0 4px rgba(135, 0, 0, 0.08), var(--shadow);
}
.topbar-recherche svg { flex: 0 0 17px; color: var(--rv-ink-2); opacity: 0.55; }
.topbar-recherche input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: 13px;
  color: var(--rv-ink);
}
.topbar-recherche input::placeholder { color: var(--rv-muted); }
.topbar-recherche kbd {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  color: var(--rv-muted);
  padding: 2px 6px;
  border: 1px solid var(--rv-line-2);
  border-radius: 6px;
  background: var(--rv-bg);
}

.header__outils { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.header__outils .btn--icone {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--rv-card);
  border: 1px solid var(--rv-line);
  color: var(--rv-ink-2);
  box-shadow: var(--shadow);
}
.header__outils .btn--icone:hover {
  background: var(--rv-card);
  color: var(--rv-red);
  border-color: rgba(135, 0, 0, 0.2);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}
.header__outils .nav-item__badge {
  position: absolute;
  top: 4px;
  right: 4px;
  margin: 0;
  box-shadow: 0 0 0 2px var(--rv-bg);
}

.header__utilisateur {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 52px;
  margin: 0 2px;
  padding: 4px 16px 4px 5px;
  border: 1px solid var(--rv-line);
  border-radius: 999px;
  background: var(--rv-card);
  box-shadow: var(--shadow);
}
.header__utilisateur .avatar {
  background: var(--rv-red-soft);
  color: var(--rv-red);
  width: 42px;
  height: 42px;
  flex-basis: 42px;
  font-size: 12px;
  font-weight: 800;
}
.header__utilisateur-nom { font-size: 12px; font-weight: 700; color: var(--rv-ink); }
.header__utilisateur-role { font-size: 10.5px; color: var(--rv-muted); }
.header .header__menu { display: none; background: var(--rv-card); }

/* Fil d'Ariane injecté en tête de page */
.fil-page {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 2px 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--rv-muted);
}
.fil-page__groupe { color: var(--rv-red); }
.fil-page__sep { color: rgba(26, 26, 26, 0.22); font-weight: 500; }
.fil-page__titre { color: var(--rv-muted); font-weight: 600; }

/* --- 6. Titres de page --------------------------------------------------- */
.entete-page {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  margin: 6px 0 22px;
  flex-wrap: wrap;
}
.entete-page__titre {
  font-size: clamp(27px, 2.4vw, 36px);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.04;
  color: var(--rv-ink);
}
.entete-page__desc {
  margin-top: 7px;
  color: var(--rv-muted);
  font-size: 13.5px;
  max-width: 780px;
  line-height: 1.5;
}
.entete-page__actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* --- 7. Boutons ---------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--rv-line-2);
  background: var(--rv-card);
  color: var(--rv-ink);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -0.01em;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.22s ease, color 0.22s ease, border-color 0.22s ease,
    box-shadow 0.3s var(--ease), transform 0.22s var(--ease);
}
.btn:hover {
  background: var(--rv-card);
  border-color: rgba(135, 0, 0, 0.25);
  color: var(--rv-red);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.btn:active { transform: scale(0.975); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn--primaire {
  background: var(--rv-red);
  border-color: var(--rv-red);
  color: var(--rv-cream);
  box-shadow: var(--shadow-red);
}
.btn--primaire:hover {
  background: var(--rv-red-2);
  border-color: var(--rv-red-2);
  color: var(--rv-cream);
  box-shadow: 0 18px 34px -14px rgba(90, 8, 8, 0.6);
}
.btn--sombre {
  background: var(--rv-noir);
  border-color: var(--rv-noir);
  color: var(--rv-cream);
}
.btn--sombre:hover { background: #000; border-color: #000; color: var(--rv-cream); }
.btn--danger { background: var(--rv-bad-soft); border-color: transparent; color: var(--rv-bad); }
.btn--danger:hover { background: #f3d9d2; color: #8f2a14; }
.btn--ok { background: var(--rv-good-soft); border-color: transparent; color: var(--rv-good); }
.btn--ok:hover { background: #d8ebd9; color: #1f5a29; }
.btn--fantome { background: transparent; border-color: transparent; color: var(--rv-muted); }
.btn--fantome:hover { background: var(--rv-red-softer); color: var(--rv-red); }
.btn--sm { height: 30px; padding: 0 12px; font-size: 11.5px; gap: 5px; }
.btn--icone { width: 40px; height: 40px; padding: 0; position: relative; }
.btn--sm.btn--icone { width: 30px; height: 30px; }

/* --- 8. Cartes ----------------------------------------------------------- */
.carte {
  background: var(--rv-card);
  border: 1px solid rgba(26, 26, 26, 0.05);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
  transition: box-shadow 0.35s var(--ease), transform 0.35s var(--ease), border-color 0.35s ease;
}
.app-shell--anim .carte { animation: rv-card 0.55s var(--ease) both; }
@keyframes rv-card { from { opacity: 0; transform: translateY(12px) scale(0.995); } to { opacity: 1; transform: none; } }
.carte:hover { box-shadow: var(--shadow-lg); border-color: rgba(135, 0, 0, 0.08); }
.carte__entete {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px 0;
  border: none;
  background: transparent;
}
.carte__titre {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--rv-ink);
}
.carte__titre::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rv-red);
  box-shadow: 0 0 0 4px rgba(135, 0, 0, 0.08);
  flex: 0 0 8px;
}
.carte__actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.carte__corps { padding: 16px 20px 20px; }
.carte__corps--serre { padding: 0 0 2px; }
.carte__corps--serre .tableau-enveloppe { border-radius: 0 0 var(--r-xl) var(--r-xl); }

/* Cascade douce des cartes et tuiles d'une même grille */
.app-shell--anim .grille > *, .app-shell--anim .tdb-grille > *, .app-shell--anim .tdb-grille--rang > * { animation: rv-card 0.55s var(--ease) both; }
.grille > *:nth-child(2), .tdb-grille > *:nth-child(2), .tdb-grille--rang > *:nth-child(2) { animation-delay: 0.05s; }
.grille > *:nth-child(3), .tdb-grille > *:nth-child(3), .tdb-grille--rang > *:nth-child(3) { animation-delay: 0.1s; }
.grille > *:nth-child(4) { animation-delay: 0.15s; }
.grille > *:nth-child(5) { animation-delay: 0.2s; }
.grille > *:nth-child(6) { animation-delay: 0.25s; }

/* --- 9. Tuiles KPI ------------------------------------------------------- */
.grille { display: grid; gap: 14px; }
.grille--kpi { grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); }

.kpi {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 128px;
  padding: 17px 19px 16px;
  background: var(--rv-card-2);
  border: none;
  border-radius: 22px;
  box-shadow: none;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.kpi::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -60px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.35), transparent 70%);
  opacity: 0.6;
  pointer-events: none;
}
.kpi:hover { transform: translateY(-2px); box-shadow: 0 20px 40px -30px rgba(90, 8, 8, 0.55); }
.kpi__libelle {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: rgba(26, 26, 26, 0.46);
}
.kpi__valeur {
  font-size: clamp(28px, 2.6vw, 38px);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 1;
  color: var(--rv-ink);
}
.kpi__note { font-size: 11.5px; color: rgba(26, 26, 26, 0.5); line-height: 1.35; }
.kpi--accent { background: linear-gradient(158deg, #1a1a1a 0%, #2a0c0c 62%, #5a0808 100%); }
.kpi--accent .kpi__libelle { color: rgba(247, 244, 239, 0.55); }
.kpi--accent .kpi__valeur { color: var(--rv-cream); }
.kpi--accent .kpi__note { color: rgba(247, 244, 239, 0.6); }
.kpi--accent::after { background: radial-gradient(circle, rgba(135, 0, 0, 0.65), transparent 68%); opacity: 0.85; }
.kpi--danger { background: var(--rv-bad-soft); }
.kpi--danger .kpi__valeur { color: var(--rv-bad); }
.kpi--attention { background: var(--rv-warn-soft); }
.kpi--attention .kpi__valeur { color: var(--rv-warn); }
.kpi--ok { background: var(--rv-good-soft); }
.kpi--ok .kpi__valeur { color: var(--rv-good); }

/* La première tuile d'une série prend l'aspect « nuit » */
.grille--kpi > .kpi:first-child:not(.kpi--danger):not(.kpi--attention):not(.kpi--ok) {
  background: linear-gradient(158deg, #1a1a1a 0%, #2a0c0c 62%, #5a0808 100%);
}
.grille--kpi > .kpi:first-child:not(.kpi--danger):not(.kpi--attention):not(.kpi--ok) .kpi__libelle { color: rgba(247, 244, 239, 0.55); }
.grille--kpi > .kpi:first-child:not(.kpi--danger):not(.kpi--attention):not(.kpi--ok) .kpi__valeur { color: var(--rv-cream); }
.grille--kpi > .kpi:first-child:not(.kpi--danger):not(.kpi--attention):not(.kpi--ok) .kpi__note { color: rgba(247, 244, 239, 0.6); }
.grille--kpi > .kpi:first-child:not(.kpi--danger):not(.kpi--attention):not(.kpi--ok)::after {
  background: radial-gradient(circle, rgba(135, 0, 0, 0.7), transparent 68%);
  opacity: 0.9;
}

/* --- 10. Badges & pastilles --------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
  line-height: 1.5;
  background: var(--rv-card-2);
  color: var(--rv-ink-2);
}
.badge--nouvelle { background: var(--rv-info-soft); color: var(--rv-info); }
.badge--attente-prod { background: var(--rv-card-2); color: var(--rv-ink-2); }
.badge--production { background: var(--rv-warn-soft); color: var(--rv-warn); }
.badge--attente-verif { background: #efe4e2; color: #6c3333; }
.badge--verification { background: #efe4e2; color: #6c3333; }
.badge--attente-corr { background: var(--rv-warn-soft); color: var(--rv-warn); }
.badge--correction { background: #f6e2d8; color: #8a3b1d; }
.badge--bloque { background: var(--rv-bad-soft); color: var(--rv-bad); }
.badge--valide { background: var(--rv-good-soft); color: var(--rv-good); }
.badge--termine { background: var(--rv-card-2); color: var(--rv-ink-2); }
.badge--attente-envoi { background: #e8edf2; color: #46586b; }
.badge--envoye { background: #dff0e2; color: #1d6b33; }
.badge--doemo { background: var(--rv-red-soft); color: var(--rv-red); }
.badge--sai { background: var(--rv-good-soft); color: var(--rv-good); }
.badge--statut-source { border: 1px solid var(--rv-line-2); font-weight: 700; }
.badge--urgence { background: var(--rv-red); color: var(--rv-cream); }
.badge--priorite { background: #f7e8d8; color: #8a3b1d; }
.badge--ok { background: var(--rv-good-soft); color: var(--rv-good); }
.badge--attention { background: var(--rv-warn-soft); color: var(--rv-warn); }
.badge--danger { background: var(--rv-bad-soft); color: var(--rv-bad); }
.badge--neutre { background: var(--rv-card-2); color: var(--rv-muted); }
.badge-role { background: var(--rv-card-2); color: var(--rv-ink-2); font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }

.pastille { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.pastille--ok { background: var(--rv-good); }
.pastille--attention { background: var(--rv-warn); }
.pastille--danger { background: var(--rv-bad); }
.pastille--gris { background: #b9b2a8; }

/* --- 11. Tableaux -------------------------------------------------------- */
.tableau-enveloppe { overflow: auto; border-radius: 0 0 var(--r-xl) var(--r-xl); }
.tableau { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.8px; }
.tableau th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px 14px;
  border-bottom: 1px solid var(--rv-line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  color: var(--rv-muted);
  font-size: 9.8px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}
.tableau td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--rv-line);
  vertical-align: middle;
  color: var(--rv-ink-2);
}
.tableau tbody tr { transition: background 0.18s ease; }
.tableau tbody tr:hover td { background: var(--rv-red-softer); }
.tableau tbody tr:last-child td { border-bottom: none; }
.tableau tbody tr.selection td { background: var(--rv-red-soft); }
.tableau--compacte td { padding: 8px 11px; }
.tableau__ref { font-family: var(--font-ui); font-size: 12px; font-weight: 700; letter-spacing: 0.01em; color: var(--rv-ink); }
.tableau__secondaire { color: var(--rv-muted); font-size: 11.5px; line-height: 1.35; }
.col-nombre { text-align: right; font-variant-numeric: tabular-nums; }
.cellule-actions { display: flex; gap: 5px; justify-content: flex-end; }
.tableau td .truncate { display: inline-block; max-width: 190px; vertical-align: bottom; }

/* Les fonds de statut d'origine sont neutralisés : la pastille porte l'info. */
.tableau tbody tr[class*="statut-fond"] td,
.tableau tbody tr[class*="statut-fond"]:hover td { background: transparent; }
.tableau tbody tr[class*="statut-fond"]:hover td { background: var(--rv-red-softer); }
.tableau tbody tr[class*="statut-fond"] .tableau__secondaire,
.tableau tbody tr[class*="statut-fond"] .muted { color: var(--rv-muted); }

/* --- 12. Onglets & segments --------------------------------------------- */
.onglets {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  margin-bottom: 18px;
  border: 1px solid var(--rv-line);
  border-radius: 999px;
  background: var(--rv-card);
  box-shadow: var(--shadow);
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.onglets::-webkit-scrollbar { height: 0; }
.onglet {
  padding: 7px 15px;
  border: none;
  border-radius: 999px;
  background: transparent;
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 650;
  color: var(--rv-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.25s var(--ease), color 0.25s var(--ease), box-shadow 0.25s ease;
}
.onglet:hover { color: var(--rv-ink); background: var(--rv-card-2); }
.onglet.actif { background: var(--rv-noir); color: var(--rv-cream); box-shadow: 0 8px 18px -12px rgba(0, 0, 0, 0.6); }

.segments {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--rv-card-2);
}
.segment {
  border: none;
  background: none;
  cursor: pointer;
  padding: 6px 13px;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  color: var(--rv-muted);
  transition: background 0.25s var(--ease), color 0.25s ease, box-shadow 0.25s ease;
}
.segment:hover { color: var(--rv-ink); }
.segment.actif { background: var(--rv-card); color: var(--rv-ink); box-shadow: var(--shadow); }

/* Onglets de la fiche commande + tiroirs */
.onglets-fiche {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 14px;
  border: 1px solid var(--rv-line);
  border-radius: 999px;
  background: var(--rv-card);
  flex-wrap: wrap;
}
.onglets-fiche .onglet,
.onglets-fiche > * { border-radius: 999px !important; }
.tiroir-onglets {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  padding: 4px;
  border: 1px solid var(--rv-line);
  border-radius: 999px;
  background: var(--rv-card-2);
  border-bottom: 1px solid var(--rv-line);
}
.tiroir-onglet {
  border: none;
  background: transparent;
  border-radius: 999px;
  padding: 6px 13px;
  font-weight: 650;
  color: var(--rv-muted);
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease;
}
.tiroir-onglet--actif { background: var(--rv-card); color: var(--rv-ink); box-shadow: var(--shadow); }

/* --- 13. Formulaires ----------------------------------------------------- */
.formulaire { display: grid; gap: 14px; }
.champ { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.champ__libelle { font-size: 10.5px; font-weight: 800; letter-spacing: 0.11em; text-transform: uppercase; color: var(--rv-muted); }
.champ__aide { font-size: 11px; color: var(--rv-muted); line-height: 1.4; }
.champ__erreur { font-size: 11px; color: var(--rv-bad); font-weight: 650; }
.saisie {
  height: 42px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--rv-line-2);
  background: var(--rv-card);
  color: var(--rv-ink);
  font-family: var(--font-ui);
  font-size: 13px;
  width: 100%;
  min-width: 0;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.saisie::placeholder { color: #afa79d; }
.saisie:hover:not(:focus) { border-color: rgba(26, 26, 26, 0.28); }
.saisie:focus {
  outline: none;
  border-color: rgba(135, 0, 0, 0.55);
  box-shadow: 0 0 0 4px rgba(135, 0, 0, 0.09);
}
textarea.saisie { height: auto; min-height: 84px; padding: 11px 14px; resize: vertical; line-height: 1.55; }
select.saisie { appearance: none; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238C8C8C'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 32px; }
.saisie[aria-invalid="true"] { border-color: var(--rv-bad); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--rv-red); width: 16px; height: 16px; cursor: pointer; }

.barre-filtres {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  padding: 14px 16px;
  border-bottom: 1px solid var(--rv-line);
  background: var(--rv-card);
}
.barre-filtres--source { border-top: 1px dashed var(--rv-line); background: var(--rv-card); }
.barre-filtres__legende { align-self: center; margin-right: 4px; font-size: 9.5px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--rv-muted); }
.barre-filtres__actions { margin-left: auto; display: flex; gap: 6px; align-items: end; }
.barre-recherche { position: relative; display: flex; align-items: center; }
.barre-recherche svg { position: absolute; left: 12px; color: var(--rv-muted); pointer-events: none; }
.barre-recherche .saisie { padding-left: 36px; width: 250px; }

/* --- 14. Modale, tiroirs, toasts ---------------------------------------- */
.voile {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 26, 0.42);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 20px;
  animation: apparait 0.18s ease;
}
.modale {
  background: var(--rv-card);
  border-radius: 26px;
  box-shadow: 0 50px 100px -40px rgba(0, 0, 0, 0.55);
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: rv-modal 0.42s var(--ease) both;
}
@keyframes rv-modal { from { opacity: 0; transform: translateY(18px) scale(0.98); } to { opacity: 1; transform: none; } }
.modale--large { max-width: 920px; }
.modale__entete { display: flex; align-items: center; gap: 10px; padding: 18px 22px; border-bottom: 1px solid var(--rv-line); }
.modale__titre { font-size: 18px; font-weight: 700; letter-spacing: -0.03em; }
.modale__corps { padding: 20px 22px; overflow-y: auto; }
.modale__pied { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid var(--rv-line); background: var(--rv-bg); }

.toast-root { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast {
  min-width: 270px;
  max-width: 420px;
  padding: 13px 16px;
  border-radius: 16px;
  background: var(--rv-noir);
  color: var(--rv-cream);
  box-shadow: 0 24px 50px -22px rgba(0, 0, 0, 0.6);
  font-size: 12.5px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: rv-toast 0.4s var(--ease) both;
}
@keyframes rv-toast { from { transform: translateY(14px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }
.toast--ok { background: #1f4d2a; }
.toast--danger { background: #5a0808; }
.toast--attention { background: #6b3c05; }

.alerte {
  border-radius: 16px;
  padding: 12px 15px;
  font-size: 12.5px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid transparent;
  border-left-width: 3px;
}
.alerte--info { background: var(--rv-info-soft); color: var(--rv-info); border-color: #d9e5f0; border-left-color: var(--rv-info); }
.alerte--attention { background: var(--rv-warn-soft); color: var(--rv-warn); border-color: #efdfc6; border-left-color: var(--rv-warn); }
.alerte--danger { background: var(--rv-bad-soft); color: var(--rv-bad); border-color: #f0d3ca; border-left-color: var(--rv-bad); }
.alerte--neutre { background: var(--rv-bg-2); color: var(--rv-ink-2); border-color: var(--rv-line); border-left-color: var(--rv-line-2); }

/* --- 15. Listes, divers -------------------------------------------------- */
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 30px;
  display: grid; place-items: center; font-size: 10.5px; font-weight: 800;
  background: var(--rv-red-soft); color: var(--rv-red); letter-spacing: 0.02em;
}
.avatar--sm { width: 26px; height: 26px; flex-basis: 26px; font-size: 10px; }
.avatar--lg { width: 42px; height: 42px; flex-basis: 42px; font-size: 13px; }

.vide { display: grid; place-items: center; gap: 8px; padding: 48px 20px; color: var(--rv-muted); text-align: center; }
.vide svg { color: var(--rv-red); opacity: 0.4; }
.vide strong { color: var(--rv-ink); font-size: 13.5px; font-weight: 650; }

.jauge { height: 8px; border-radius: 999px; background: var(--rv-card-2); overflow: hidden; }
.jauge__part { height: 100%; background: var(--rv-red); border-radius: 999px; animation: rv-jauge 0.9s var(--ease) both; transform-origin: left; }
@keyframes rv-jauge { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.jauge__part--ok { background: var(--rv-good); }
.jauge__part--attention { background: var(--rv-warn); }
.jauge__part--danger { background: var(--rv-bad); }

.barre-ligne { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.barre-ligne__fond { flex: 1; height: 8px; border-radius: 999px; background: var(--rv-card-2); overflow: hidden; }
.barre-ligne__part { display: block; height: 100%; border-radius: 999px; background: var(--rv-red); animation: rv-jauge 0.9s var(--ease) both; transform-origin: left; }
.barre-ligne__valeur { min-width: 34px; text-align: right; font-weight: 700; }

.timeline__item { display: grid; grid-template-columns: 14px 1fr; gap: 10px; padding-bottom: 15px; position: relative; }
.timeline__item:not(:last-child)::before { content: ""; position: absolute; left: 6px; top: 14px; bottom: 0; width: 1px; background: var(--rv-line); }
.timeline__point { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--rv-line-2); background: var(--rv-card); margin-top: 2px; z-index: 1; }
.timeline__point--bordeaux { border-color: var(--rv-red); background: var(--rv-red-soft); }
.timeline__point--ok { border-color: var(--rv-good); background: var(--rv-good-soft); }
.timeline__point--danger { border-color: var(--rv-bad); background: var(--rv-bad-soft); }
.timeline__titre { font-size: 12.5px; font-weight: 650; }
.timeline__meta { font-size: 10.5px; color: var(--rv-muted); }

.liste-nue li { border-bottom: 1px solid var(--rv-line); }
.legendes { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11.5px; color: var(--rv-muted); }

.definitions { display: grid; grid-template-columns: 150px 1fr; gap: 9px 16px; font-size: 12.5px; }
.definitions dt { color: var(--rv-muted); font-weight: 600; }
.definitions dd { margin: 0; }

.tableau-cartes { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 12px; }
.muted { color: var(--rv-muted); }
.petit { font-size: 11.5px; }
.mono { font-family: var(--font-ui); font-variant-numeric: tabular-nums; }

/* --- 16. Dashboard direction (tdb-*) ------------------------------------ */
.app-shell--tdb {
  --tdb-fond: transparent;
  --tdb-blanc: #ffffff;
  --tdb-encre: #1a1a1a;
  --tdb-encre-2: #3a3430;
  --tdb-muet: #6f6a63;
  --tdb-bord: rgba(26, 26, 26, 0.07);
  --tdb-bleu: #870000;
  --tdb-violet: #5a0808;
  --tdb-rose: #b2381f;
  --tdb-orange: #8c5300;
  --tdb-rayon: 24px;
  --tdb-ombre: var(--shadow);
}
.app-shell--tdb .header { background: transparent; border-bottom-color: transparent; }
.main--tdb { background: transparent; padding: 4px 6px 34px; }
.tdb-entete { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 6px 0 22px; }
.tdb-entete__surtitre { font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--rv-red); }
.tdb-entete__titre { font-size: clamp(27px, 2.4vw, 36px); line-height: 1.04; letter-spacing: -0.045em; font-weight: 700; color: var(--rv-ink); margin: 6px 0 7px; }
.tdb-entete__sous { font-size: 13px; color: var(--rv-muted); }
.tdb-entete__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tdb-entete__actions .btn { border-radius: 999px; background: var(--rv-card); border-color: var(--rv-line-2); color: var(--rv-ink); }
.tdb-entete__actions .btn:hover { background: var(--rv-card); border-color: rgba(135, 0, 0, 0.25); color: var(--rv-red); }
.tdb-grille { display: grid; gap: 16px; }
.tdb-grille--hero { grid-template-columns: minmax(0, 1.6fr) minmax(300px, 0.85fr); }
.tdb-grille--rang { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 16px; }
.tdb-grille--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 16px; }
.tdb-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 30px 32px;
  border-radius: 26px;
  color: var(--rv-cream);
  background: linear-gradient(145deg, #870000 0%, #5a0808 62%, #2a0c0c 100%);
  box-shadow: 0 30px 60px -34px rgba(90, 8, 8, 0.7);
}
.tdb-hero__contenu { position: relative; z-index: 1; min-width: 0; }
.tdb-hero__pill {
  display: inline-flex; align-items: center; padding: 5px 13px; border-radius: 999px;
  background: rgba(247, 244, 239, 0.14); border: 1px solid rgba(247, 244, 239, 0.26);
  font-size: 10px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
}
.tdb-hero__titre { font-size: 29px; line-height: 1.14; letter-spacing: -0.035em; font-weight: 700; margin: 14px 0 8px; }
.tdb-hero__texte { font-size: 12.5px; color: rgba(247, 244, 239, 0.78); margin: 0 0 20px; }
.tdb-hero__stats { display: flex; gap: 36px; flex-wrap: wrap; }
.tdb-hero__stats > div { display: flex; flex-direction: column; gap: 3px; }
.tdb-hero__stats strong { font-size: 27px; font-weight: 700; line-height: 1; letter-spacing: -0.04em; }
.tdb-hero__stats span { font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(247, 244, 239, 0.7); }
.tdb-hero__deco { position: absolute; border-radius: 50%; background: rgba(247, 244, 239, 0.08); }
.tdb-hero__deco--1 { width: 280px; height: 280px; right: -80px; top: -100px; }
.tdb-hero__deco--2 { width: 180px; height: 180px; right: 120px; bottom: -110px; background: rgba(247, 244, 239, 0.05); }

.tdb-carte {
  background: var(--rv-card);
  border: 1px solid rgba(26, 26, 26, 0.05);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.35s var(--ease), transform 0.35s var(--ease);
}
.tdb-carte:hover { box-shadow: var(--shadow-lg); }
.tdb-carte__entete { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.tdb-carte__titre { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 700; color: var(--rv-ink); letter-spacing: -0.02em; }
.tdb-carte__titre::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--rv-red); box-shadow: 0 0 0 4px rgba(135, 0, 0, 0.08); }
.tdb-carte__note { font-size: 11px; color: var(--rv-muted); }
.tdb-stat { }
.tdb-classement__barre { background: var(--rv-card-2); border-radius: 999px; }
.tdb-classement__barre > span { background: var(--rv-red); border-radius: 999px; }

/* --- 17. Écran de connexion (aligné sur la refonte) --------------------- */
.lp-ecran { font-family: var(--font-ui); }
.lp-ecran .lp-badge b,
.lp-ecran .lp-version,
.lp-ecran .lp-carte__texte b,
.lp-ecran .lp-submit,
.lp-ecran .lp-titre,
.lp-ecran .lp-plan__barre b { font-family: var(--font-ui); }
.lp-visuel { background: linear-gradient(150deg, #1a1a1a 0%, #3d0909 55%, #870000 130%); }
.lp-bascule, .lp-panneau, .lp-input { border-radius: 14px; }
.lp-submit { border-radius: 999px; background: var(--rv-red); box-shadow: 0 18px 36px -20px rgba(135, 0, 0, 0.9); }
.lp-submit:hover { background: var(--rv-red-2); }
.lp-panneau { border-radius: 26px; box-shadow: 0 40px 90px -50px rgba(90, 8, 8, 0.6); }

/* --- 18. Mode sombre ----------------------------------------------------- */
html[data-theme="sombre"] {
  --rv-bg: #121110;
  --rv-bg-2: #1b1917;
  --rv-card: #1c1a18;
  --rv-card-2: #262320;
  --rv-card-3: rgba(247, 244, 239, 0.07);
  --rv-ink: #f7f4ef;
  --rv-ink-2: #ddd6cd;
  --rv-muted: #a29a90;
  --rv-line: rgba(247, 244, 239, 0.09);
  --rv-line-2: rgba(247, 244, 239, 0.18);
  --rv-red: #e05252;
  --rv-red-2: #c0392b;
  --rv-red-soft: rgba(224, 82, 82, 0.14);
  --rv-red-softer: rgba(224, 82, 82, 0.07);
  --rv-cream: #f7f4ef;
  --rv-rail: #0c0b0a;
  --rv-good: #7fc98b;
  --rv-good-soft: rgba(127, 201, 139, 0.14);
  --rv-bad: #ff8d74;
  --rv-bad-soft: rgba(255, 141, 116, 0.14);
  --rv-warn: #f0b35a;
  --rv-warn-soft: rgba(240, 179, 90, 0.14);
  /* Pas de bleu : l'information prend une teinte sable. */
  --rv-info: #c9b6a4;
  --rv-info-soft: rgba(201, 182, 164, 0.14);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 18px 38px -26px rgba(0, 0, 0, 0.8);
  --shadow-lg: 0 2px 8px rgba(0, 0, 0, 0.5), 0 42px 80px -30px rgba(0, 0, 0, 0.9);
  color-scheme: dark;
}
html[data-theme="sombre"] body { background: var(--rv-bg); }
html[data-theme="sombre"] .app-shell--app {
  background:
    radial-gradient(900px 520px at 100% -10%, rgba(224, 82, 82, 0.07), transparent 60%),
    radial-gradient(700px 420px at -10% 110%, rgba(224, 82, 82, 0.05), transparent 60%),
    var(--rv-bg);
}
html[data-theme="sombre"] .tableau th { background: rgba(28, 26, 24, 0.94); }
html[data-theme="sombre"] .kpi { background: var(--rv-card-2); }
html[data-theme="sombre"] .kpi__valeur { color: var(--rv-ink); }
html[data-theme="sombre"] .kpi__libelle { color: rgba(247, 244, 239, 0.5); }
html[data-theme="sombre"] .kpi__note { color: rgba(247, 244, 239, 0.5); }
html[data-theme="sombre"] .grille--kpi > .kpi:first-child:not(.kpi--danger):not(.kpi--attention):not(.kpi--ok) {
  background: linear-gradient(158deg, #2b2522 0%, #4a1010 62%, #870000 130%);
}
html[data-theme="sombre"] .grille--kpi > .kpi:first-child:not(.kpi--danger):not(.kpi--attention):not(.kpi--ok) .kpi__valeur { color: #fff; }
html[data-theme="sombre"] .grille--kpi > .kpi:first-child:not(.kpi--danger):not(.kpi--attention):not(.kpi--ok) .kpi__libelle,
html[data-theme="sombre"] .grille--kpi > .kpi:first-child:not(.kpi--danger):not(.kpi--attention):not(.kpi--ok) .kpi__note { color: rgba(255, 255, 255, 0.6); }
html[data-theme="sombre"] .entete-page__titre,
html[data-theme="sombre"] .tdb-entete__titre { color: var(--rv-ink); }
html[data-theme="sombre"] .sidebar { background: var(--rv-rail); }
html[data-theme="sombre"] .topbar-espace,
html[data-theme="sombre"] .topbar-recherche,
html[data-theme="sombre"] .header__utilisateur,
html[data-theme="sombre"] .header__outils .btn--icone { background: var(--rv-card); }
html[data-theme="sombre"] .topbar-recherche kbd { background: var(--rv-card-2); }
html[data-theme="sombre"] .fil-page__sep { color: rgba(247, 244, 239, 0.25); }
html[data-theme="sombre"] ::-webkit-scrollbar-thumb { background: rgba(247, 244, 239, 0.18); background-clip: content-box; }

/* --- 19. Animations & accessibilité ------------------------------------- */
@keyframes apparait { from { opacity: 0; } to { opacity: 1; } }

/* Compteurs et barres respirent doucement */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
html[data-anim="reduit"] *, html[data-anim="reduit"] *::before, html[data-anim="reduit"] *::after {
  animation: none !important;
  transition: none !important;
}

/* --- 20. Responsive ------------------------------------------------------ */
@media (max-width: 1280px) {
  .topbar-espace__txt { display: none; }
  .header__utilisateur-nom, .header__utilisateur-role { display: none; }
  .header__utilisateur { padding: 4px; }
}
@media (max-width: 1100px) {
  .tdb-grille--hero { grid-template-columns: 1fr; }
  .tdb-grille--rang { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .app-shell--app { padding: 10px; gap: 0; }
  .sidebar {
    position: fixed;
    left: 10px;
    top: 10px;
    bottom: 10px;
    height: auto;
    width: 248px;
    flex-basis: 248px;
    transform: translateX(-120%);
    transition: transform 0.42s var(--ease);
    box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.6);
  }
  .sidebar.ouvert { transform: none; }
  .sidebar .sidebar__nom, .sidebar .nav-item > span:not(.nav-item__badge), .sidebar .sidebar__groupe, .sidebar .sidebar__pied-txt, .sidebar .rail-btn__txt, .sidebar .rail-user__txt { display: block; }
  .sidebar .nav-item { width: 100%; justify-content: flex-start; padding: 0 12px; margin: 0; }
  .sidebar .sidebar__pied { align-items: stretch; }
  .sidebar .rail-btn { width: 100%; grid-auto-flow: column; justify-content: flex-start; padding: 0 12px; }
  .sidebar .rail-user { width: 100%; height: auto; justify-content: flex-start; gap: 10px; padding: 6px; border-radius: 16px; background: rgba(247, 244, 239, 0.06); color: var(--rv-cream); }
  .sidebar .rail-user::after { display: none; }
  .sidebar:not(.sidebar--large) .nav-item::before { display: none; }
  .header .header__menu { display: inline-flex; }
  .header { height: 56px; flex-basis: 56px; gap: 8px; }
  .topbar-recherche { height: 46px; }
  .header__outils .btn--icone { width: 42px; height: 42px; }
  .topbar-espace { height: 46px; padding-right: 8px; }
  .topbar-espace__logo { width: 36px; height: 36px; }
  .entete-page { margin-bottom: 16px; }
  .entete-page__actions { width: 100%; }
  .main--tdb { padding: 4px 0 24px; }
  .tdb-grille--rang { grid-template-columns: 1fr; }
  .tdb-grille--2 { grid-template-columns: 1fr; }
  .tdb-hero { padding: 22px; }
  .tdb-hero__titre { font-size: 23px; }
}
@media (max-width: 560px) {
  .topbar-recherche { display: none; }
  .header__outils { gap: 6px; }
  .header__utilisateur { display: none; }
  .kpi { min-height: 110px; padding: 14px 16px; }
  .carte__entete { padding: 15px 16px 0; }
  .carte__corps { padding: 13px 16px 16px; }
}

/* --- 21. Composants métier (commandes, production, planning) ------------- */
.cmd-actions {
  background: var(--rv-card);
  border: 1px solid var(--rv-line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 8px 10px;
  gap: 6px;
}
.cmd-action {
  border-radius: 999px;
  height: 38px;
  padding: 0 16px;
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 650;
  border: 1px solid transparent;
  transition: transform 0.22s var(--ease), box-shadow 0.25s var(--ease), background 0.2s ease;
}
.cmd-action:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--shadow); }
.cmd-action--reserver { background: var(--rv-red); color: var(--rv-cream); box-shadow: var(--shadow-red); }
.cmd-action--reserver:hover:not(:disabled) { background: var(--rv-red-2); }
.cmd-action--planifier { background: var(--rv-card); color: var(--rv-ink); border-color: var(--rv-line-2); }
.cmd-action--planifier:hover:not(:disabled) { background: var(--rv-card); color: var(--rv-red); border-color: rgba(135, 0, 0, 0.25); }
.cmd-action--liberer { background: var(--rv-noir); color: var(--rv-cream); }
.cmd-action--liberer:hover:not(:disabled) { background: #000; }
.cmd-action--exporter { background: var(--rv-red-2); color: var(--rv-cream); }
.cmd-action--exporter:hover:not(:disabled) { background: #450606; }
.cmd-actions .btn { height: 32px; padding: 0 12px; font-size: 11.5px; }
.cmd-actions__sep { background: var(--rv-line); height: 22px; }

.cmd-filtres {
  margin-bottom: 14px;
  border: 1px solid var(--rv-line);
  border-radius: 22px;
  background: var(--rv-card);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.cmd-filtres__entete {
  padding: 12px 16px;
  background: transparent;
  border-bottom: 1px solid var(--rv-line);
}
.cmd-filtres__titre { font-weight: 700; letter-spacing: -0.01em; }
.cmd-filtres__resume { background: var(--rv-red-soft); color: var(--rv-red); border-radius: 999px; font-weight: 700; }
.cmd-filtres__corps { padding: 14px 16px 12px; gap: 12px; }
.cmd-filtre-global { border-radius: 14px; }
.cmd-filtre-global .saisie, .cmd-filtre-global input { border: none; box-shadow: none; background: transparent; }
.cmd-filtre-global { background: var(--rv-bg); border: 1px solid var(--rv-line); }

/* Plateau de production */
.colonnes { gap: 12px; }
.colonne {
  background: var(--rv-card-2);
  border-radius: 20px;
  padding: 10px;
  gap: 8px;
}
.colonne__titre { font-size: 10.5px; font-weight: 800; letter-spacing: 0.1em; color: rgba(26, 26, 26, 0.55); }
.colonne__titre .badge { background: var(--rv-card); color: var(--rv-ink); }
.carte-cmd {
  background: var(--rv-card);
  border: 1px solid transparent;
  border-radius: 15px;
  padding: 11px 12px;
  box-shadow: 0 1px 1px rgba(26, 26, 26, 0.04), 0 10px 20px -18px rgba(90, 8, 8, 0.5);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.2s ease;
}
.carte-cmd:hover {
  transform: translateY(-2px);
  border-color: rgba(135, 0, 0, 0.2);
  box-shadow: 0 16px 30px -20px rgba(90, 8, 8, 0.55);
}
.carte-cmd__ref { font-size: 11.5px; font-weight: 700; color: var(--rv-red); }
.carte-cmd__client { font-size: 11.5px; color: var(--rv-ink-2); }
.carte-cmd__pied { font-size: 10.5px; color: var(--rv-muted); }

/* Calendriers */
.calendrier__case { border-radius: 14px; border-color: var(--rv-line); }
.calendrier__case--aujourdhui { border-color: var(--rv-red); box-shadow: inset 0 0 0 1px var(--rv-red); }
.calendrier__event { border-radius: 999px; padding: 2px 8px; background: var(--rv-red-soft); color: var(--rv-red-2); }
.calendrier__event--conge { background: var(--rv-good-soft); color: var(--rv-good); }
.calendrier__event--tt { background: var(--rv-info-soft); color: var(--rv-info); }
.calendrier__event--echeance { background: var(--rv-warn-soft); color: var(--rv-warn); }
.calendrier__event--ferie { background: var(--rv-card-2); color: var(--rv-ink-2); }
.planning-ferie { background: var(--rv-card-2); color: var(--rv-ink-2); }

/* Bandeaux d'information */
.cmd-planif { border-radius: 20px; }
.cmd-planif__entete { background: var(--rv-bg); border-radius: 20px 20px 0 0; }
.cmd-planif__ligne:hover { background: var(--rv-red-softer); }

/* Fiche commande */
.fiche, .fiche__entete, .fiche__bloc { }
.fiche__entete { border-radius: 22px; }
.fiche__titre { letter-spacing: -0.03em; }

/* --- 22. Tableau de bord : tuiles de rang et graphiques ----------------- */
.tdb-hero h1, .tdb-hero h2, .tdb-hero h3, .tdb-hero .tdb-hero__titre { color: var(--rv-cream); }
.tdb-rang--violet { background: linear-gradient(150deg, #a81b1b, #5a0808); }
.tdb-rang--rose { background: linear-gradient(150deg, #5a0808, #7a1414); }
.tdb-rang--orange { background: linear-gradient(150deg, #2a2521, #4a0a0a); }
.tdb-rang { border-radius: 22px; box-shadow: 0 22px 44px -30px rgba(90, 8, 8, 0.7); }
.tdb-rang__valeur { color: var(--rv-cream); }
.tdb-rang__libelle { color: rgba(247, 244, 239, 0.72); }
.tdb-rang__note { color: rgba(247, 244, 239, 0.78); }
.tdb-anneau { background: conic-gradient(var(--rv-red) calc(var(--p) * 1%), #f0e9e1 0); }
.tdb-anneau::before { background: var(--rv-card); box-shadow: inset 0 0 0 1px var(--rv-line); }
.tdb .barre-ligne__part { background: var(--rv-red); }
.tdb-classement__barre > span { background: var(--rv-red); }
.tdb-classement__barre { background: var(--rv-card-2); }
.tdb-classement__nom, .tdb-classement__valeur { color: var(--rv-ink); }
.tdb-classement__ligne:hover { background: var(--rv-red-softer); border-radius: 12px; }
.tdb-carte__titre { color: var(--rv-ink); }
.tdb-carte__note { color: var(--rv-muted); }
.tdb-entete__actions .btn { border-radius: 999px; }

/* Le dashboard porte déjà son sur-titre : pas de double fil d'Ariane. */
.main:has(.tdb-entete) .fil-page { display: none; }

/* Statuts source : la couleur vient de l'API, on la neutralise pour rester
   dans la palette DM (le point devant garde un repère visuel). */
.badge--statut-source {
  background: var(--rv-card-2) !important;
  color: var(--rv-ink-2) !important;
  border-color: var(--rv-line) !important;
}
.badge--statut-source::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.45;
  flex: 0 0 5px;
}

html[data-theme="sombre"] .app-shell--tdb {
  --tdb-blanc: var(--rv-card);
  --tdb-encre: var(--rv-ink);
  --tdb-encre-2: var(--rv-ink-2);
  --tdb-muet: var(--rv-muted);
  --tdb-bord: var(--rv-line);
  --tdb-ombre: var(--shadow);
}
html[data-theme="sombre"] .tdb-anneau { background: conic-gradient(var(--rv-red) calc(var(--p) * 1%), #332e2a 0); }
html[data-theme="sombre"] .tdb-anneau::before { background: var(--rv-card); }
html[data-theme="sombre"] .tdb-entete__actions .btn { background: var(--rv-card); color: var(--rv-ink); border-color: var(--rv-line-2); }
html[data-theme="sombre"] .tdb-classement__barre { background: var(--rv-card-2); }

/* Écran de connexion : les titres du panneau sombre restent crème
   (la règle globale h1..h4 les forçait en noir charbon). */
.lp-visuel h1, .lp-visuel h2, .lp-visuel h3, .lp-visuel h4,
.lp-edito h1, .lp-edito h1 span, .lp-edito h2 { color: var(--rv-cream); }
.lp-visuel .lp-titre, .lp-visuel .lp-titre span { color: var(--rv-cream); }
.lp-edito p { color: rgba(247, 244, 239, 0.8); }

/* Connexion en mode sombre : le rouge d'action reste profond. */
html[data-theme="sombre"] .lp-submit { background: #a81b1b; color: #fff; }
html[data-theme="sombre"] .lp-submit:hover { background: #870000; }
html[data-theme="sombre"] .lp-panneau, html[data-theme="sombre"] .lp-ecran { background: #121110; }
html[data-theme="sombre"] .lp-panneau { color: var(--rv-ink); }
html[data-theme="sombre"] .lp-input { background: var(--rv-card); border-color: var(--rv-line-2); color: var(--rv-ink); }
html[data-theme="sombre"] .lp-champ__boite { background: var(--rv-card); border-color: var(--rv-line-2); }
html[data-theme="sombre"] .lp-titre { color: var(--rv-ink); }
html[data-theme="sombre"] .lp-sous-titre { color: var(--rv-muted); }

/* Boutons d'action rapide : alignés sur les jetons (lisibles en mode sombre). */
.action-rapide {
  background: var(--rv-card);
  border: 1px solid var(--rv-line);
  color: var(--rv-ink);
  border-radius: 14px;
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 650;
  padding: 10px 12px;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s var(--ease);
}
.action-rapide svg { color: var(--rv-red); flex: 0 0 auto; }
.action-rapide:hover {
  background: var(--rv-red-softer);
  border-color: rgba(135, 0, 0, 0.28);
  color: var(--rv-red);
  transform: translateY(-1px);
}

/* --- 23. Jetons de la charte en mode sombre ----------------------------- */
/* Les composants historiques utilisent encore les variables du design
   system : on les bascule ici pour éviter tout texte encre sur fond nuit. */
html[data-theme="sombre"] {
  --anthracite: #f2ece5;
  --blanc: #1c1a18;
  --fond: #121110;
  --lavande-clair: #1b1917;
  --bordeaux-clair: rgba(224, 82, 82, 0.14);
  --accent: #e05252;
  --accent-fonce: #c0392b;
  --accent-clair: rgba(224, 82, 82, 0.14);
  --gris: #a29a90;
  --gris-clair: #8c8480;
  --gris-fonce: #ddd6cd;
  --bordure: rgba(247, 244, 239, 0.09);
  --bordure-forte: rgba(247, 244, 239, 0.18);
  --ok: #7fc98b;
  --ok-fond: rgba(127, 201, 139, 0.14);
  --attention: #f0b35a;
  --attention-fond: rgba(240, 179, 90, 0.14);
  --danger: #ff8d74;
  --danger-fond: rgba(255, 141, 116, 0.14);
  --info: #8db9ec;
  --info-fond: rgba(141, 185, 236, 0.14);
}
html[data-theme="sombre"] .btn--sombre,
html[data-theme="sombre"] .tiroir-seg__btn--actif {
  background: var(--rv-card-2);
  border-color: var(--rv-line-2);
  color: var(--rv-ink);
}
html[data-theme="sombre"] .saisie,
html[data-theme="sombre"] select.saisie,
html[data-theme="sombre"] textarea.saisie {
  background: var(--rv-card);
  color: var(--rv-ink);
  border-color: var(--rv-line-2);
}
html[data-theme="sombre"] .multi-select__liste,
html[data-theme="sombre"] .multi-select__option {
  background: var(--rv-card);
  color: var(--rv-ink);
}
html[data-theme="sombre"] .colonne { background: var(--rv-card-2); }
html[data-theme="sombre"] .colonne__titre { color: var(--rv-muted); }

/* --- 20. Messagerie : conversations + fil ------------------------------- */
.messagerie {
  display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 0;
  height: calc(100vh - 190px); min-height: 540px;
  background: var(--rv-card); border: 1px solid var(--rv-line);
  border-radius: var(--r-xl); overflow: hidden; box-shadow: var(--shadow);
}
.messagerie__liste {
  display: flex; flex-direction: column; min-height: 0;
  border-right: 1px solid var(--rv-line); background: var(--rv-bg-2);
}
.messagerie__liste-entete { padding: 16px 16px 12px; border-bottom: 1px solid var(--rv-line); }
.messagerie__liste-titre { font-size: 15px; font-weight: 750; color: var(--rv-ink); }
.messagerie__liste-sous { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 12px; color: var(--rv-muted); }
.messagerie__recherche {
  margin: 12px 12px 0; display: flex; align-items: center; gap: 7px;
  padding: 8px 11px; border: 1px solid var(--rv-line-2); border-radius: var(--r-sm);
  background: var(--rv-card); color: var(--rv-gris-marque);
}
.messagerie__recherche input {
  width: 100%; border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 13px; color: var(--rv-ink);
}
.messagerie__sections { flex: 1; overflow-y: auto; padding: 0 8px 14px; }
.messagerie__section {
  font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--rv-gris-marque); padding: 15px 9px 6px;
}
.messagerie__item {
  display: flex; flex-direction: row; align-items: center; gap: 9px; width: 100%;
  padding: 7px 9px; border: 0; border-radius: var(--r-sm); background: none;
  cursor: pointer; text-align: left; color: var(--rv-ink); font: inherit;
  transition: background 0.15s var(--ease);
}
.messagerie__item:hover { background: rgba(26, 26, 26, 0.05); }
.messagerie__item.actif { background: var(--rv-red-soft); color: var(--rv-red-2); }
.messagerie__canal-icone {
  width: 28px; height: 28px; flex: 0 0 28px; display: grid; place-items: center;
  border-radius: 9px; background: var(--rv-card); color: var(--rv-muted);
  font-weight: 800; font-size: 13px;
}
.messagerie__item.actif .messagerie__canal-icone { background: var(--rv-red); color: #fff; }
.messagerie__item-texte { display: flex; flex-direction: column; min-width: 0; }
.messagerie__nom { font-size: 13px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.messagerie__detail { font-size: 11.5px; color: var(--rv-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.messagerie__presence { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 7px; background: var(--rv-gris-marque); }
.messagerie__presence--en-ligne { background: var(--rv-good); }
.messagerie__presence--absent { background: var(--rv-warn); }
.messagerie__aucun { padding: 6px 10px 8px; font-size: 12px; color: var(--rv-muted); }
.messagerie__fil { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--rv-card); }
.messagerie__entete-fil { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--rv-line); }
.messagerie__fil-titre { font-size: 17px; font-weight: 750; letter-spacing: -0.015em; color: var(--rv-ink); }
.messagerie__fil-sous { margin-top: 1px; font-size: 12px; color: var(--rv-muted); }
.messagerie__flux {
  flex: 1; overflow-y: auto; padding: 22px;
  background: radial-gradient(1200px 320px at 18% 0%, rgba(135, 0, 0, 0.035) 0%, transparent 70%);
}
.messagerie__vide { max-width: 430px; margin: 54px auto; display: grid; justify-items: center; gap: 8px; text-align: center; color: var(--rv-muted); }
.messagerie__vide-icone { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 15px; background: var(--rv-red-soft); color: var(--rv-red); }
.messagerie__vide strong { color: var(--rv-ink); font-size: 14px; }
.messagerie__vide p { margin: 0; font-size: 13px; line-height: 1.55; }
.messagerie__composeur { display: flex; align-items: center; gap: 10px; padding: 12px 16px 6px; border-top: 1px solid var(--rv-line); background: var(--rv-card); }
.messagerie__saisie {
  flex: 1; min-height: 40px; display: flex; align-items: center; padding: 0 13px;
  border: 1px solid var(--rv-line-2); border-radius: var(--r-sm);
  background: var(--rv-bg-2); color: var(--rv-gris-marque); font-size: 13px;
}
.messagerie .btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.messagerie__note { padding: 0 16px 13px; font-size: 11.5px; color: var(--rv-muted); background: var(--rv-card); }
.messagerie__choix { display: grid; gap: 4px; max-height: 340px; overflow-y: auto; }
.messagerie__choix-item {
  display: flex; align-items: center; gap: 9px; padding: 8px; border: 0;
  border-radius: var(--r-sm); background: none; cursor: pointer; text-align: left; font: inherit;
}
.messagerie__choix-item:hover { background: var(--rv-red-softer); }
.messagerie__choix-item span { display: flex; flex-direction: column; }
.messagerie__choix-item small { font-size: 11.5px; color: var(--rv-muted); }
html[data-theme="sombre"] .messagerie { background: var(--rv-card); }
html[data-theme="sombre"] .messagerie__liste { background: var(--rv-card-2); }
@media (max-width: 1100px) {
  .messagerie { grid-template-columns: 1fr; height: auto; }
  .messagerie__liste { border-right: 0; border-bottom: 1px solid var(--rv-line); max-height: 330px; }
  .messagerie__flux { min-height: 260px; }
  .messagerie__entete-fil { flex-wrap: wrap; }
}

/* --- 21. Workflow CMD : circuit interne --------------------------------- */
.etape--termine { background: var(--rv-card-2); color: var(--rv-muted); }
.etape--boucle {
  background: transparent; border: 1px dashed var(--rv-line-2); color: var(--rv-muted);
  font-style: italic; font-weight: 600;
}
.etape--boucle.etape--faite { background: var(--rv-good-soft); color: var(--rv-good); border-style: solid; font-style: normal; }
.fiche__circuits { display: grid; gap: 8px; margin: 10px 0 3px; }
.circuit { display: grid; gap: 3px; padding-left: 8px; border-left: 2px solid var(--rv-line); }
.circuit__etapes { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.circuit__titre {
  font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--rv-muted);
}
.circuit--hors .circuit__etapes { gap: 8px; flex-wrap: wrap; }

/* --- 22. Messagerie temps réel (base DM-TN) ----------------------------- */
.messagerie--panneau { grid-template-columns: 288px minmax(0, 1fr) 340px; }
.messagerie__item.non-lu .messagerie__nom { font-weight: 800; }
.messagerie__item.non-lu .messagerie__detail { color: var(--rv-ink-2); font-weight: 600; }
.messagerie__item .msg-badge { margin-left: auto; }
.msg-badge {
  flex: 0 0 auto; min-width: 19px; height: 19px; padding: 0 6px;
  display: inline-grid; place-items: center; border-radius: 999px;
  background: var(--rv-red); color: #fff; font-size: 10.5px; font-weight: 800;
}
.msg-badge--mention { background: var(--rv-red-2); }
.msg-muet { font-size: 10px; opacity: 0.6; }

/* Présence */
.msg-presence-wrap { position: relative; flex: 0 0 26px; display: inline-flex; }
.msg-presence {
  width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px;
  background: var(--rv-gris-marque); box-shadow: 0 0 0 2px var(--rv-card);
  display: inline-block; vertical-align: middle;
}
.msg-presence-wrap .msg-presence { position: absolute; right: -1px; bottom: -1px; }
.msg-presence--en-ligne { background: var(--rv-good); }
.msg-presence--absent { background: var(--rv-warn); }
.msg-presence--absent-justifie { background: var(--rv-warn); }
.msg-presence--teletravail { background: #2f7ad6; }

/* En-tête du fil */
.msg-entete { gap: 8px; }
.msg-entete__titre { flex: 1; min-width: 0; }
.msg-entete__membres { display: inline-flex; align-items: center; padding-right: 4px; }
.msg-entete__membres .avatar { margin-left: -7px; box-shadow: 0 0 0 2px var(--rv-card); }
.msg-entete__membres .avatar:first-child { margin-left: 0; }
.msg-plus {
  width: 26px; height: 26px; margin-left: -7px; flex: 0 0 26px; display: grid; place-items: center;
  border-radius: 50%; background: var(--rv-card-2); color: var(--rv-muted);
  font-size: 10px; font-weight: 750; box-shadow: 0 0 0 2px var(--rv-card);
}
.msg-entete .btn--icone.est-actif { background: var(--rv-red-soft); color: var(--rv-red); }

/* Flux de messages */
.msg-flux { padding: 18px 22px 10px; }
.msg-jour { display: flex; align-items: center; gap: 12px; margin: 14px 0 10px; }
.msg-jour::before, .msg-jour::after { content: ""; flex: 1; height: 1px; background: var(--rv-line); }
.msg-jour span {
  font-size: 11px; font-weight: 750; color: var(--rv-muted);
  padding: 2px 10px; border: 1px solid var(--rv-line); border-radius: 999px; background: var(--rv-card);
}
.msg-nouveaux { display: flex; align-items: center; gap: 10px; margin: 10px 0 6px; }
.msg-nouveaux::before, .msg-nouveaux::after { content: ""; flex: 1; height: 1px; background: var(--rv-red); opacity: 0.45; }
.msg-nouveaux span { font-size: 10.5px; font-weight: 800; color: var(--rv-red); text-transform: uppercase; letter-spacing: 0.06em; }

.msg {
  position: relative; display: flex; gap: 10px; padding: 7px 8px;
  border-radius: var(--r-sm); transition: background 0.12s var(--ease);
}
.msg:hover { background: rgba(26, 26, 26, 0.035); }
.msg--suite { padding-top: 1px; }
.msg--epingle { box-shadow: inset 2px 0 0 var(--rv-red); }
.msg-avatar-cell { position: relative; width: 26px; flex: 0 0 26px; padding-top: 1px; }
.msg-avatar-cell .msg-presence { position: absolute; left: 18px; bottom: 0; }
.msg-gouttiere { width: 26px; flex: 0 0 26px; padding-top: 3px; text-align: center; }
.msg-heure-survol { font-size: 9.5px; color: var(--rv-muted); opacity: 0; transition: opacity 0.12s; }
.msg:hover .msg-heure-survol { opacity: 1; }
.msg-contenu { flex: 1; min-width: 0; }
.msg-entete-ligne { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.msg-auteur { font-size: 13px; font-weight: 750; color: var(--rv-ink); }
.msg-moi { font-size: 10px; font-weight: 700; color: var(--rv-red); background: var(--rv-red-soft); padding: 1px 5px; border-radius: 4px; }
.msg-heure { font-size: 11px; color: var(--rv-muted); }
.msg-modifie { font-size: 10.5px; color: var(--rv-muted); font-style: italic; }
.msg-tag {
  font-size: 9.5px; font-weight: 750; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--rv-red); background: var(--rv-red-soft); padding: 1px 6px; border-radius: 999px;
}
.msg-corps { font-size: 13.5px; line-height: 1.55; color: var(--rv-ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-corps--supprime { font-size: 12px; color: var(--rv-muted); font-style: italic; padding: 2px 0; }
.msg-mention { color: var(--rv-red-2); background: var(--rv-red-soft); border-radius: 4px; padding: 0 3px; font-weight: 650; }
.msg-parent {
  display: block; width: 100%; text-align: left; margin: 3px 0 4px; padding: 4px 9px;
  border: 0; border-left: 2px solid var(--rv-line-2); border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--rv-bg-2); color: var(--rv-muted); font: inherit; font-size: 12px;
  cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.msg-parent:hover { background: var(--rv-card-2); color: var(--rv-ink-2); }
.msg-parent b { color: var(--rv-ink-2); }

/* Actions au survol */
.msg-actions {
  position: absolute; top: -13px; right: 10px; z-index: 2;
  display: flex; align-items: center; gap: 1px; padding: 2px;
  background: var(--rv-card); border: 1px solid var(--rv-line-2); border-radius: 9px;
  box-shadow: 0 3px 10px rgba(9, 9, 11, 0.1);
  opacity: 0; pointer-events: none; transition: opacity 0.12s var(--ease);
}
.msg:hover .msg-actions, .msg:focus-within .msg-actions { opacity: 1; pointer-events: auto; }
.msg-act {
  width: 27px; height: 27px; display: inline-grid; place-items: center;
  border: 0; border-radius: 7px; background: transparent; color: var(--rv-muted);
  font: inherit; font-size: 13px; line-height: 1; cursor: pointer;
}
.msg-act:hover { background: var(--rv-red-softer); color: var(--rv-red); }
.msg-act.est-actif { background: var(--rv-red-soft); color: var(--rv-red); }
.msg-act--danger:hover { background: var(--rv-red); color: #fff; }
.msg-act--emoji { font-size: 17px; }

/* Réactions */
.msg-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.msg-reaction {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px;
  border: 1px solid transparent; border-radius: 999px; background: var(--rv-bg-2);
  color: var(--rv-ink-2); font: inherit; font-size: 11.5px; font-weight: 650; cursor: pointer;
}
.msg-reaction:hover { border-color: var(--rv-line-2); }
.msg-reaction.est-moi { background: var(--rv-red-soft); border-color: rgba(135, 0, 0, 0.25); color: var(--rv-red); }

/* Aperçu du fil */
.msg-fil-apercu {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 5px;
  padding: 3px 9px; border: 1px solid transparent; border-radius: 999px;
  background: transparent; color: var(--rv-red-2); font: inherit; font-size: 11.5px; cursor: pointer;
}
.msg-fil-apercu:hover { background: var(--rv-red-softer); }
.msg-fil-apercu b { font-weight: 750; }
.msg-fil-avatars { display: inline-flex; }
.msg-mini-av {
  width: 17px; height: 17px; display: grid; place-items: center; border-radius: 50%;
  background: var(--rv-red-soft); color: var(--rv-red); font-size: 7.5px; font-weight: 800;
  margin-left: -4px; box-shadow: 0 0 0 1.5px var(--rv-card);
}
.msg-mini-av:first-child { margin-left: 0; }
.msg-fil-date { color: var(--rv-muted); font-size: 11px; }

/* Édition */
.msg-edition { display: grid; gap: 6px; margin: 4px 0; }
.msg-champ { display: grid; gap: 5px; margin-bottom: 10px; }
.msg-champ > span {
  font-size: 10.5px; font-weight: 750; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--rv-muted);
}
.msg-champ input {
  width: 100%; padding: 9px 11px; border: 1px solid var(--rv-line-2); border-radius: var(--r-sm);
  background: var(--rv-card); font: inherit; font-size: 13px; color: var(--rv-ink);
}
.msg-champ input:focus { outline: 0; border-color: var(--rv-red); box-shadow: 0 0 0 3px var(--rv-red-soft); }
.msg-edition .ligne { justify-content: flex-end; }

/* Composeur */
.msg-composeur-wrap { border-top: 1px solid var(--rv-line); background: var(--rv-card); padding: 10px 16px 8px; }
.msg-composeur { display: flex; align-items: flex-end; gap: 8px; }
.msg-composeur textarea {
  flex: 1; min-height: 40px; max-height: 150px; resize: none; padding: 10px 13px;
  border: 1px solid var(--rv-line-2); border-radius: var(--r-sm);
  background: var(--rv-bg-2); color: var(--rv-ink); font: inherit; font-size: 13px; line-height: 1.5;
}
.msg-composeur .btn { height: 40px; }
.msg-composeur--fil { border-top: 1px solid var(--rv-line); padding: 10px 12px; }
.msg-composeur--fil textarea { background: var(--rv-card); }
.msg-emoji-bar { display: flex; flex-wrap: wrap; gap: 3px; padding-bottom: 8px; }
.msg-emoji {
  width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 8px;
  background: transparent; font-size: 17px; cursor: pointer;
}
.msg-emoji:hover { background: var(--rv-red-softer); }
.msg-note { margin-top: 6px; font-size: 11px; color: var(--rv-muted); }

/* Squelette de chargement */
.msg-squelette { display: grid; gap: 14px; padding: 8px 0; }
.msg-squelette__ligne {
  height: 34px; border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--rv-bg-2) 25%, var(--rv-card-2) 37%, var(--rv-bg-2) 63%);
  background-size: 400% 100%; animation: msg-brillance 1.4s ease infinite;
}
@keyframes msg-brillance { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* Panneaux latéraux */
.msg-panneau {
  display: flex; flex-direction: column; min-height: 0;
  border-left: 1px solid var(--rv-line); background: var(--rv-card-2);
}
.msg-panneau__entete {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 13px 14px; border-bottom: 1px solid var(--rv-line);
  font-size: 13.5px; font-weight: 750; color: var(--rv-ink);
}
.msg-panneau__corps { flex: 1; overflow-y: auto; padding: 14px; display: grid; gap: 10px; align-content: start; }
.msg-panneau__vide { padding: 22px 14px; text-align: center; font-size: 12.5px; color: var(--rv-muted); }
.msg-detail-titre { font-size: 16px; font-weight: 750; color: var(--rv-ink); }
.msg-detail-sous { font-size: 12px; color: var(--rv-muted); margin-top: -6px; }
.msg-detail-bloc {
  display: grid; gap: 5px; padding: 12px; background: var(--rv-card);
  border: 1px solid var(--rv-line); border-radius: var(--r-sm);
}
.msg-detail-libelle { font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: 0.07em; color: var(--rv-muted); }
.msg-detail-sujet { font-size: 13px; color: var(--rv-ink); }
.msg-option { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--rv-ink-2); cursor: pointer; }
.msg-option input { accent-color: var(--rv-red); }
.msg-personne { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.msg-personne__txt { display: flex; flex-direction: column; min-width: 0; }
.msg-personne__txt b { font-size: 12.5px; color: var(--rv-ink); }
.msg-personne__txt small { font-size: 11px; color: var(--rv-muted); }

.msg-ligne-panneau {
  display: grid; gap: 5px; padding: 10px; background: var(--rv-card);
  border: 1px solid var(--rv-line); border-radius: var(--r-sm);
}
.msg-ligne-panneau__tete { display: flex; align-items: center; gap: 7px; }
.msg-ligne-panneau__tete span { display: flex; flex-direction: column; min-width: 0; }
.msg-ligne-panneau__tete b { font-size: 12px; color: var(--rv-ink); }
.msg-ligne-panneau__tete small { font-size: 10.5px; color: var(--rv-muted); }
.msg-ligne-panneau__corps { font-size: 12.5px; color: var(--rv-ink-2); line-height: 1.5; }
.msg-ligne-panneau__actions { display: flex; gap: 5px; flex-wrap: wrap; }
.msg-panneau--fil .msg-fil-corps { gap: 0; padding: 8px 0 4px; }
.msg-fil-racine { padding: 6px 10px 10px; border-bottom: 1px solid var(--rv-line); }
.msg-fil-sep { display: flex; align-items: center; gap: 10px; padding: 10px 14px 6px; }
.msg-fil-sep::before, .msg-fil-sep::after { content: ""; flex: 1; height: 1px; background: var(--rv-line); }
.msg-fil-sep span { font-size: 10.5px; font-weight: 750; color: var(--rv-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.msg-panneau--fil .msg { padding-left: 12px; padding-right: 12px; }

/* Recherche globale */
.msg-recherche-voile {
  position: fixed; inset: 0; z-index: 95; display: flex; justify-content: center; align-items: flex-start;
  padding: 11vh 16px 16px; background: rgba(20, 16, 16, 0.42); backdrop-filter: blur(2px);
}
.msg-recherche-boite {
  width: min(660px, 96vw); max-height: 72vh; display: flex; flex-direction: column;
  background: var(--rv-card); border: 1px solid var(--rv-line-2);
  border-radius: var(--r-lg, 14px); box-shadow: 0 24px 60px rgba(9, 9, 11, 0.28); overflow: hidden;
}
.msg-recherche-champ { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--rv-line); }
.msg-recherche-champ input {
  flex: 1; border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 15px; color: var(--rv-ink);
}
.msg-recherche-resultats { overflow-y: auto; padding: 6px 8px 10px; }
.msg-recherche-section {
  padding: 12px 9px 5px; font-size: 10px; font-weight: 750; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--rv-muted);
}
.msg-recherche-item {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 9px;
  border: 0; border-radius: var(--r-sm); background: none; text-align: left; font: inherit; cursor: pointer;
}
.msg-recherche-item:hover { background: var(--rv-red-softer); }
.msg-recherche-item > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.msg-recherche-item b { font-size: 12.5px; color: var(--rv-ink); }
.msg-recherche-item small { font-size: 11.5px; color: var(--rv-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-recherche-ic { flex: 0 0 auto; display: inline-flex; }

/* Surbrillance lors d'un saut vers un message */
.msg-flash { animation: msg-flash 1.6s ease; }
@keyframes msg-flash {
  0%, 30% { background: var(--rv-red-soft); box-shadow: 0 0 0 3px var(--rv-red-soft); }
  100% { background: transparent; box-shadow: none; }
}

/* Choix d'une personne (modales) */
.msg-choix { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: var(--r-sm); cursor: pointer; }
.msg-choix:hover { background: var(--rv-red-softer); }
.msg-choix input { accent-color: var(--rv-red); }
.msg-choix > span { display: flex; flex-direction: column; min-width: 0; }
.msg-choix b { font-size: 12.5px; color: var(--rv-ink); }
.msg-choix small { font-size: 11px; color: var(--rv-muted); }
.msg-choix-liste { display: grid; gap: 3px; max-height: 300px; overflow-y: auto; }
.msg-choix-liste .msg-personne { width: 100%; padding: 7px 9px; border-radius: var(--r-sm); cursor: pointer; }
.msg-choix-liste .msg-personne:hover { background: var(--rv-red-softer); }
.msg-nouveau { width: 100%; margin-top: 12px; }
.msg-nouveau-nom, .msg-nouveau-sujet, .msg-sujet-champ {
  width: 100%; padding: 9px 11px; border: 1px solid var(--rv-line-2); border-radius: var(--r-sm);
  background: var(--rv-card); font: inherit; font-size: 13px; color: var(--rv-ink);
}

html[data-theme="sombre"] .msg:hover { background: rgba(255, 255, 255, 0.045); }
html[data-theme="sombre"] .msg-actions { box-shadow: 0 3px 12px rgba(0, 0, 0, 0.5); }
html[data-theme="sombre"] .msg-presence { box-shadow: 0 0 0 2px var(--rv-card-2); }
html[data-theme="sombre"] .msg-entete__membres .avatar,
html[data-theme="sombre"] .msg-mini-av { box-shadow: 0 0 0 2px var(--rv-card); }

@media (max-width: 1360px) {
  .messagerie--panneau { grid-template-columns: 276px minmax(0, 1fr) 312px; }
}
@media (max-width: 1180px) {
  .messagerie--panneau { grid-template-columns: 260px minmax(0, 1fr); }
  .messagerie--panneau .msg-panneau { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--rv-line); max-height: 360px; }
}

/* --- 22b. Messagerie : filtres, mentions, frappe, épingles, profil ------ */
.messagerie__fil { position: relative; }
.msg-composeur textarea:focus { outline: 0; border-color: var(--rv-red); box-shadow: 0 0 0 3px var(--rv-red-soft); }

/* Filtres Tous / Non lus / Mentions */
.msg-filtres { display: flex; gap: 4px; padding: 0 12px 10px; border-bottom: 1px solid var(--rv-line); }
.msg-filtre {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px;
  border: 1px solid transparent; border-radius: 999px; background: transparent;
  color: var(--rv-muted); font: inherit; font-size: 11.5px; font-weight: 650; cursor: pointer;
}
.msg-filtre:hover { background: var(--rv-red-softer); color: var(--rv-ink-2); }
.msg-filtre.est-actif { background: var(--rv-red-soft); color: var(--rv-red); border-color: rgba(135, 0, 0, 0.2); }
.msg-filtre__n {
  min-width: 16px; height: 16px; padding: 0 4px; display: inline-grid; place-items: center;
  border-radius: 999px; background: var(--rv-red); color: #fff; font-size: 9.5px; font-weight: 800;
}

/* Avatars cliquables */
.msg-avatar-btn { display: inline-flex; padding: 0; border: 0; background: none; border-radius: 50%; cursor: pointer; }
.msg-avatar-btn:focus-visible { outline: 2px solid var(--rv-red); outline-offset: 2px; }
.msg-entete__membres .msg-avatar-btn { margin-left: -7px; box-shadow: 0 0 0 2px var(--rv-card); border-radius: 50%; }
.msg-entete__membres .msg-avatar-btn:first-child { margin-left: 0; }

/* Barre des messages épinglés */
.msg-barre-epingles {
  display: flex; align-items: center; gap: 8px; padding: 6px 14px;
  border-bottom: 1px solid var(--rv-line); background: var(--rv-red-softer);
}
.msg-barre-epingles__ic { font-size: 12px; }
.msg-barre-epingles__txt {
  flex: 1; min-width: 0; display: flex; gap: 5px; align-items: baseline;
  border: 0; background: none; text-align: left; font: inherit; font-size: 12px;
  color: var(--rv-ink-2); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.msg-barre-epingles__txt b { color: var(--rv-ink); }
.msg-barre-epingles__n { font-size: 10.5px; font-weight: 750; color: var(--rv-muted); }
.msg-barre-epingles__lien {
  border: 0; background: none; font: inherit; font-size: 11.5px; font-weight: 700;
  color: var(--rv-red); cursor: pointer; white-space: nowrap;
}

/* Retour aux derniers messages */
.msg-jump {
  position: absolute; right: 22px; bottom: 104px; z-index: 3;
  display: none; align-items: center; gap: 5px; padding: 7px 12px;
  border: 1px solid var(--rv-line-2); border-radius: 999px; background: var(--rv-card);
  color: var(--rv-ink-2); font: inherit; font-size: 11.5px; font-weight: 700;
  box-shadow: 0 6px 18px rgba(9, 9, 11, 0.16); cursor: pointer;
}
.msg-jump.est-visible { display: inline-flex; }
.msg-jump:hover { color: var(--rv-red); border-color: var(--rv-red); }

/* Autocomplétion des mentions */
.msg-composeur { position: relative; }
.msg-mentions {
  position: absolute; bottom: calc(100% + 6px); left: 0; right: 0; z-index: 40;
  display: grid; gap: 2px; max-height: 240px; overflow-y: auto; padding: 5px;
  background: var(--rv-card); border: 1px solid var(--rv-line-2);
  border-radius: var(--r-md, 10px); box-shadow: 0 14px 36px rgba(9, 9, 11, 0.2);
}
.msg-mention-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px;
  border: 0; border-radius: 7px; background: none; text-align: left; font: inherit; cursor: pointer;
}
.msg-mention-item:hover, .msg-mention-item.est-actif { background: var(--rv-red-softer); }
.msg-mention-item > span { display: flex; flex-direction: column; min-width: 0; }
.msg-mention-item b { font-size: 12.5px; color: var(--rv-ink); }
.msg-mention-item small { font-size: 11px; color: var(--rv-muted); }

/* Barre de mise en forme */
.msg-outils { display: flex; align-items: center; gap: 2px; padding-bottom: 6px; }
.msg-outil {
  width: 26px; height: 24px; display: inline-grid; place-items: center;
  border: 1px solid transparent; border-radius: 6px; background: none;
  color: var(--rv-muted); font: inherit; font-size: 12px; cursor: pointer;
}
.msg-outil:hover { background: var(--rv-red-softer); color: var(--rv-red); border-color: var(--rv-line); }
.msg-outils__aide { margin-left: 6px; font-size: 10.5px; color: var(--rv-muted); }

/* Indicateur de frappe */
.msg-frappe {
  min-height: 17px; display: flex; align-items: center; gap: 4px; padding: 0 2px 4px;
  font-size: 11.5px; color: var(--rv-muted); opacity: 0; transition: opacity 0.15s;
}
.msg-frappe.est-actif { opacity: 1; }
.msg-frappe b { color: var(--rv-ink-2); font-weight: 700; }
.msg-frappe-points { display: inline-flex; gap: 2px; }
.msg-frappe-points i { width: 4px; height: 4px; border-radius: 50%; background: var(--rv-muted); animation: msg-frappe 1s infinite ease-in-out; }
.msg-frappe-points i:nth-child(2) { animation-delay: 0.15s; }
.msg-frappe-points i:nth-child(3) { animation-delay: 0.3s; }
@keyframes msg-frappe {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-3px); opacity: 1; }
}

/* Profil */
.msg-profil { min-width: 300px; }
.msg-profil__tete { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.msg-profil__nom { font-size: 16px; font-weight: 750; color: var(--rv-ink); }
.msg-profil__role { font-size: 12px; color: var(--rv-muted); }
.msg-profil__presence { display: flex; align-items: center; gap: 5px; margin-top: 3px; font-size: 11.5px; color: var(--rv-ink-2); }
.msg-profil__champs { display: grid; gap: 6px; }
.msg-profil__champ {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 7px 10px; background: var(--rv-bg-2); border-radius: var(--r-sm); font-size: 12.5px;
}
.msg-profil__champ span {
  color: var(--rv-muted); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: 0.05em; font-weight: 750;
}
.msg-profil__champ b { color: var(--rv-ink); font-weight: 650; text-align: right; }

/* Type de conversation (segments) */
.msg-segments { display: flex; gap: 4px; flex-wrap: wrap; }
.msg-segment { position: relative; cursor: pointer; }
.msg-segment input { position: absolute; opacity: 0; pointer-events: none; }
.msg-segment span {
  display: inline-flex; padding: 6px 12px; border: 1px solid var(--rv-line-2);
  border-radius: 999px; background: var(--rv-card); color: var(--rv-muted);
  font-size: 12px; font-weight: 650;
}
.msg-segment input:checked + span { background: var(--rv-red-soft); border-color: rgba(135, 0, 0, 0.28); color: var(--rv-red); }
.msg-segment input:focus-visible + span { outline: 2px solid var(--rv-red); outline-offset: 1px; }

html[data-theme="sombre"] .msg-mentions { box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55); }
html[data-theme="sombre"] .msg-jump { box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5); }
html[data-theme="sombre"] .msg-barre-epingles { background: rgba(135, 0, 0, 0.18); }
