 /* ==========================================================================
   Dowin   feuille de style
   Palette inspirée de WeChat : vert #07c160, bulles vertes, rail sombre.
   ========================================================================== */

:root {
  --green: #07c160;
  --green-dark: #06ad56;
  --bubble-me: #95ec69;
  --bubble-me-dark: #2f7d43;
  --bg: #f2f2f2;
  --panel: #ffffff;
  --panel-2: #fafafa;
  --panel-3: #f0f0f0;
  --rail: #2e2e2e;
  --rail-hover: #3a3a3a;
  --text: #191919;
  --text-soft: #7a7a7a;
  --text-faint: #a8a8a8;
  /*
   * `--text-meta` porte les informations **à lire** mais secondaires : heure et
   * état d'un message, journal d'appels, pastille de date. `--text-faint`
   * (#a8a8a8 sur #f2f2f2 = 2,1:1) les rendait illisibles   très en dessous du
   * minimum de 4,5:1 ; #6b6b6b tient 4,8:1.
   */
  --text-meta: #6b6b6b;
  --link: #0a4fa0;
  --danger-text: #c0392b;
  --border: #e3e3e3;
  --bubble-other: #ffffff;
  --hover: #ececec;
  --active: #e3e3e3;
  --danger: #e64340;
  --warn: #f0a020;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  --radius: 10px;
  --radius-lg: 14px;
  /* Alias sémantique de `--radius` (même 10 px) : nom retenu par le
   * document d'interface (§6.1), utilisé par la session de proximité. */
  --radius-sm: 10px;
  /*
   * Jetons du lot 1 « listes et contacts » : rayon de carte et échelle
   * d'espacement 4/8/12/16/24/32. Les composants nouveaux les consomment ;
   * l'existant garde ses valeurs en dur pour que rien ne change à l'écran.
   */
  --radius-card: 14px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --rail-w: 62px;
  --list-w: 306px;
  --chat-bg: #f2f2f2;
  --chat-bg-image: none;
}

[data-theme='dark'] {
  --bg: #111112;
  --panel: #1c1c1e;
  --panel-2: #232325;
  --panel-3: #2a2a2c;
  --rail: #171718;
  --rail-hover: #232325;
  --text: #e9e9ea;
  --text-soft: #9a9a9d;
  --text-faint: #6e6e71;
  --text-meta: #9a9a9d;
  /* Sur la bulle verte sombre, seul le blanc garde un contraste lisible. */
  --link: #ffffff;
  --danger-text: #ff7b74;
  --border: #2e2e30;
  --bubble-other: #2c2c2e;
  --hover: #262628;
  --active: #303032;
  --bubble-me: #2f7d43;
  --chat-bg: #111112;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', Roboto,
    Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  display: block;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
}

input,
textarea {
  font: inherit;
  color: inherit;
}

.hidden {
  display: none !important;
}

/* ------------------------------- Layout --------------------------------- */

/*
 * La rangée est **définie** : elle ne grandit plus avec le contenu.
 *
 * Avec une rangée implicite (`auto`) et un élément de grille en `min-height:
 * auto` (le défaut), la colonne du chat prenait la hauteur de son contenu : sur
 * une longue conversation, `.chat-pane` mesurait plusieurs milliers de pixels,
 * `.messages` avait donc `clientHeight === scrollHeight`   il ne défilait plus
 * du tout   et le navigateur défilait `.app` lui-même (ancrage de défilement),
 * emportant l'en-tête de la conversation hors de l'écran.
 *
 * `minmax(0, 1fr)` ici **et** `min-height: 0` sur `.chat-pane` corrigent le
 * même défaut par deux chemins indépendants : l'un suffit, les deux sont
 * conservés, car c'est le genre de panne qui revient par une autre porte.
 */
.app {
  display: grid;
  grid-template-columns: var(--rail-w) var(--list-w) 1fr;
  grid-template-rows: minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  overflow-anchor: none;
  position: relative;
}

/*
 * Poignée de redimensionnement de la liste.
 *
 * Elle est placée dans `.app` et non dans `.list-pane` : ce dernier borne son
 * contenu (`overflow: hidden`, indispensable pour qu'il n'y ait qu'un seul
 * conteneur défilant), ce qui rognerait une poignée posée sur son bord. Sa
 * position se déduit de `--list-w`, donc elle suit la colonne sans JavaScript.
 */
.list-resizer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--rail-w) + var(--list-w) - 3px);
  width: 7px;
  z-index: 15;
  cursor: col-resize;
  background: transparent;
  transition: background 0.15s;
  touch-action: none;
}

.list-resizer:hover,
.list-resizer:focus-visible,
.list-resizer.is-dragging {
  background: var(--green);
  outline: none;
}

.list-resizer::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 34px;
  transform: translate(-50%, -50%);
  border-radius: 2px;
  background: var(--text-faint);
  opacity: 0;
  transition: opacity 0.15s;
}

.list-resizer:hover::after {
  opacity: 0.5;
}

/* Sous 900 px, la liste occupe toute la largeur : plus rien à redimensionner. */
@media (max-width: 900px) {
  .list-resizer {
    display: none;
  }
}

.rail {
  background: var(--rail);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 0 10px;
  gap: 6px;
  min-height: 0;
  overflow: hidden auto;
  scrollbar-width: none;
}

.rail::-webkit-scrollbar {
  width: 0;
}

.rail__me {
  position: relative;
  margin-bottom: 18px;
}

.rail__btn,
.rail__me {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #b8b8b8;
  position: relative;
  transition: background 0.15s, color 0.15s;
}

.rail__btn svg {
  width: 24px;
  height: 24px;
}

.rail__btn:hover {
  background: var(--rail-hover);
  color: #fff;
}

.rail__btn.is-active {
  color: var(--green);
}

.rail__spacer {
  flex: 1;
}

.presence-dot {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-faint);
  border: 2px solid var(--rail);
}

.presence-dot.is-online {
  background: var(--green);
}

.badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  font-weight: 600;
}

.avatar {
  display: grid;
  place-items: center;
  border-radius: 8px;
  overflow: hidden;
  background: #ccc;
  color: #fff;
  font-weight: 600;
  flex: none;
  user-select: none;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar--rail {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  font-size: 15px;
}

.avatar--head {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 14px;
}

.avatar--row {
  width: 44px;
  height: 44px;
  font-size: 16px;
  border-radius: 50%;
}

.avatar--msg {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 14px;
}

.avatar--lg {
  width: 64px;
  height: 64px;
  font-size: 24px;
  border-radius: 50%;
}

/* ------------------------------ Liste ----------------------------------- */

.list-pane {
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

/*
 * Bouton flottant : la place du dernier élément est réservée par le dégagement
 * ci-dessous, sans quoi il masquerait la dernière conversation de la liste.
 * La page de réglages peint son propre fond et gère donc son propre dégagement.
 *
 * Il est ancré **au-dessus de la barre d'état** (`bottom: 100%` depuis le pied)
 * et non au bas du panneau : mesuré depuis le panneau, il se posait sur la
 * ligne « en ligne · n P2P ». Ancrer au pied le rend juste quel que soit sa
 * hauteur, qui change déjà entre bureau et téléphone.
 */
.fab {
  position: absolute;
  right: 16px;
  bottom: calc(100% + 14px);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28);
  z-index: 12;
  transition: background 0.15s, transform 0.15s;
}

.fab:hover {
  background: var(--green-dark);
  transform: scale(1.04);
}

.fab:active {
  transform: scale(0.97);
}

.fab svg {
  width: 23px;
  height: 23px;
}

.fab.is-open {
  background: var(--green-dark);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.32);
}

/*
 * Menu du bouton flottant. Il est positionné au-dessus du bouton par
 * openFabMenu() (mesures réelles) et non par un bottom fixe : c'est ce
 * décalage qui le faisait chevaucher le bouton et couper le dernier élément.
 */
.fab-menu {
  position: absolute;
  z-index: 25;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 272px;
  max-width: calc(100% - 20px);
  max-height: calc(100% - 150px);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
  animation: fab-menu-in 0.14s ease-out;
}

@keyframes fab-menu-in {
  from {
    opacity: 0;
    transform: translateY(5px) scale(0.98);
  }
}

.fab-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 10px;
  color: var(--text);
  text-align: left;
}

.fab-menu__item:hover,
.fab-menu__item:focus-visible {
  background: var(--hover);
}

.fab-menu__item:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: -2px;
}

.fab-menu__icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(7, 193, 96, 0.12);
  color: var(--green);
}

.fab-menu__icon svg {
  width: 17px;
  height: 17px;
}

.fab-menu__body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.fab-menu__label {
  font-size: 13.5px;
  font-weight: 600;
}

.fab-menu__hint {
  overflow: hidden;
  margin-top: 1px;
  color: var(--text-meta);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-picker {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.contact-picker__hint {
  margin: 0 0 8px;
  color: var(--text-soft);
  font-size: 12.5px;
  line-height: 1.5;
}

.contact-picker__row {
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  text-align: left;
}

.contact-picker__row:hover {
  background: var(--hover);
}

.contact-picker__chevron {
  flex: none;
  color: var(--text-faint);
}

.contact-picker__chevron svg {
  width: 16px;
  height: 16px;
}

.list-pane__body {
  padding-bottom: 76px;
}

.list-pane__body:has(.settings-page) {
  padding-bottom: 0;
}

.list-pane__head {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 12px 10px;
  border-bottom: 1px solid var(--border);
}

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.list-head__titles {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.list-head__title {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.012em;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-head__sub {
  overflow: hidden;
  color: var(--text-meta);
  font-size: 11.5px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-head__sub.is-unread {
  color: var(--green-dark);
  font-weight: 600;
}

[data-theme='dark'] .list-head__sub.is-unread {
  color: var(--green);
}

.list-head__btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--text-soft);
  transition: background 0.15s, color 0.15s;
}

.list-head__btn svg {
  width: 19px;
  height: 19px;
}

.list-head__btn:hover {
  background: var(--hover);
  color: var(--text);
}

.list-head__btn.is-active {
  background: var(--panel-3);
  color: var(--green);
}

.list-search {
  width: 100%;
}

.search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--panel-3);
  border-radius: 8px;
  padding: 5px 8px;
  min-width: 0;
}

.search__icon {
  width: 16px;
  height: 16px;
  color: var(--text-faint);
  flex: none;
}

.search input {
  border: 0;
  background: none;
  outline: none;
  flex: 1;
  min-width: 0;
  font-size: 13px;
}

/* Le champ type=search ajoute sa propre croix sur WebKit : on garde la nôtre. */
.search input::-webkit-search-cancel-button,
.search input::-webkit-search-decoration {
  display: none;
  -webkit-appearance: none;
  appearance: none;
}

.search-hit {
  padding: 0 1px;
  border-radius: 3px;
  background: rgba(7, 193, 96, 0.2);
  color: inherit;
}

.search__clear svg {
  width: 16px;
  height: 16px;
  color: var(--text-faint);
}

.icon-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--text-soft);
  flex: none;
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover {
  background: var(--hover);
  color: var(--text);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.list-pane__body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.list-pane__foot {
  border-top: 1px solid var(--border);
  padding: 7px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-soft);
  /* Repère du bouton flottant, qui se cale juste au-dessus. */
  position: relative;
}

.conn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.conn__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
}

.conn.is-online .conn__dot {
  background: var(--green);
}

.conn.is-offline .conn__dot {
  background: var(--danger);
}

.net-mode {
  font-variant-numeric: tabular-nums;
}

/*
 * Le retrait horizontal est celui des lignes de liste (12 px), pas 14 : un
 * écart de deux pixels entre un titre de section et les lignes qu'il coiffe se
 * voit immédiatement, et c'est ce qui donnait l'impression de marges
 * « chaotiques » jusque dans la liste des discussions.
 */
.section-label {
  padding: 14px 12px 6px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 600;
}

.row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  cursor: pointer;
  position: relative;
  transition: background 0.12s;
}

.row:hover {
  background: var(--hover);
}

.row.is-active {
  background: var(--active);
}

/* Le portrait et ses pastilles (présence, groupe) partagent une boîte. */
.row__avatar {
  position: relative;
  flex: none;
  width: 44px;
  height: 44px;
}

.avatar__presence {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border: 2px solid var(--panel);
  border-radius: 50%;
  background: var(--green);
}

.avatar__group-mark {
  position: absolute;
  right: -2px;
  bottom: -2px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--panel);
  color: var(--text-soft);
}

.avatar__group-mark svg {
  width: 10px;
  height: 10px;
}

/* Une conversation non lue se reconnaît aussi au texte, pas seulement au badge. */
.row.is-unread .row__title {
  font-weight: 700;
}

.row.is-unread .row__sub {
  color: var(--text);
}

.row.is-muted .row__title {
  color: var(--text-soft);
}

.row__flags {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-faint);
}

.row__flag svg {
  width: 12px;
  height: 12px;
}

.row__delivery {
  display: inline-grid;
  place-items: center;
  color: var(--text-faint);
}

.row__delivery svg {
  width: 12px;
  height: 12px;
}

.row__delivery.is-read {
  color: var(--green);
}

.row__delivery.is-failed {
  color: var(--danger);
}

.row__attach {
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-right: 4px;
  color: var(--text-faint);
  vertical-align: -2px;
}

.row__who {
  margin-right: 3px;
  color: var(--text-soft);
}

.row__preview {
  color: inherit;
}

.row__body {
  flex: 1;
  min-width: 0;
}

.row__title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row__title .pin {
  color: var(--text-faint);
  font-size: 12px;
}

.row__sub {
  color: var(--text-soft);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* Aperçu d'un appel manqué : le seul aperçu qui demande de rappeler. */
.row__sub.is-missed {
  color: var(--danger-text);
}

.row__sub.is-typing {
  color: var(--green);
}

.row__typing {
  overflow: hidden;
  text-overflow: ellipsis;
}

.row__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex: none;
}

.row__time {
  font-size: 11px;
  color: var(--text-faint);
}

.row__badge {
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  line-height: 17px;
  text-align: center;
  font-weight: 600;
}

.row__badge.is-muted {
  background: var(--text-faint);
}

.row__badge.is-dot {
  min-width: 9px;
  height: 9px;
  padding: 0;
  border-radius: 50%;
}

.tag {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--panel-3);
  color: var(--text-soft);
  font-weight: 600;
}

.tag--green {
  background: rgba(7, 193, 96, 0.14);
  color: var(--green-dark);
}

.tag--warn {
  background: rgba(240, 160, 32, 0.16);
  color: #b87400;
}

.empty-list {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
  line-height: 1.6;
}

.home-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 44px 18px 24px;
  color: var(--text-soft);
  text-align: center;
}

.home-empty__icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 8px;
  border-radius: 18px;
  background: rgba(7, 193, 96, 0.13);
  color: var(--green);
}

.home-empty__icon svg {
  width: 28px;
  height: 28px;
}

.home-empty__title {
  margin: 0;
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.home-empty__text {
  max-width: 280px;
  margin: 7px 0 16px;
  font-size: 12.5px;
  line-height: 1.6;
}

.home-empty__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(100%, 240px);
}

.home-empty__actions .btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
}

.home-empty__actions .btn svg {
  width: 16px;
  height: 16px;
}

/*
 * Sur bureau, le grand panneau d'accueil affiche déjà ces trois actions à
 * droite : les répéter dans la colonne de liste donnerait deux fois le même
 * bouton à l'écran. Sur téléphone, le panneau de droite est masqué et elles
 * restent donc visibles ici.
 */
@media (min-width: 821px) {
  .home-empty__actions {
    display: none;
  }
}

.page-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 44px 18px 24px;
  color: var(--text-soft);
  text-align: center;
}

.page-empty__icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 8px;
  border-radius: 18px;
  background: rgba(7, 193, 96, 0.13);
  color: var(--green);
}

.page-empty__icon svg {
  width: 28px;
  height: 28px;
}

.page-empty__title {
  margin: 0;
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.page-empty__text {
  max-width: 280px;
  margin: 7px 0 16px;
  font-size: 12.5px;
  line-height: 1.6;
}

.page-empty__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(100%, 240px);
}

.page-empty__actions .btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
}

.page-empty__actions .btn svg {
  width: 16px;
  height: 16px;
}

/* -------------------------------- Chat ---------------------------------- */

.chat-pane {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--chat-bg);
}

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-soft);
  text-align: center;
  padding: 30px;
}

.empty-state__logo {
  color: var(--green);
  opacity: 0.9;
}

.empty-state__logo svg {
  width: 78px;
  height: 78px;
}

.empty-state h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: 0.14em;
  color: var(--text);
}

.empty-state p {
  margin: 0;
  max-width: 460px;
  line-height: 1.7;
}

.empty-state__hint {
  color: var(--text-faint);
  font-size: 12.5px;
}

.empty-state__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

.empty-state__actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.empty-state__actions .btn svg {
  width: 16px;
  height: 16px;
}

.empty-state__recents {
  width: min(100%, 480px);
  margin-top: 10px;
}

.empty-state__recents .section-label {
  margin: 6px 0 8px;
}

.welcome-contacts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
}

.welcome-contact {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font-size: 12.5px;
  transition: border-color 0.15s, background 0.15s;
}

.welcome-contact:hover {
  border-color: var(--green);
  background: var(--panel-2);
}

.welcome-contact .avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 9px;
}

.welcome-contact__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

/*
 * `.chat` occupe la hauteur restante du panneau par le flex, jamais par un
 * `height: 100%` : un pourcentage sur un parent dont la hauteur dépend du
 * contenu retombait sur `auto`, et la conversation poussait alors la fenêtre.
 */
.chat {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.chat__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex: none;
  position: sticky;
  top: 0;
  z-index: 6;
  transition: box-shadow 0.18s ease;
}

/*
 * Ombre portée dès que le fil est défilé : c'est le repère de Telegram, il
 * matérialise la frontière entre l'en-tête et les messages qui glissent dessous.
 */
.chat.is-scrolled .chat__head {
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.07);
  border-bottom-color: transparent;
}

[data-theme='dark'] .chat.is-scrolled .chat__head {
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.45);
}

.chat__back {
  display: none;
}

.chat__title {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.chat__title strong {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat__title small {
  color: var(--text-soft);
  font-size: 12px;
}

.chat__actions {
  display: flex;
  gap: 2px;
}

.chat__banner {
  background: rgba(240, 160, 32, 0.14);
  color: #a86b00;
  padding: 7px 14px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--border);
}

/* Message épinglé : bandeau cliquable au-dessus du fil. */

.pinned-banner {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 6px 12px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  border-left: 3px solid var(--green);
}

.pinned-banner__main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
}

.pinned-banner__main svg {
  flex: none;
  width: 17px;
  height: 17px;
  color: var(--green);
}

.pinned-banner__text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}

.pinned-banner__text strong {
  font-size: 11.5px;
  color: var(--green-dark);
  font-weight: 600;
}

.pinned-banner__text span {
  font-size: 12.5px;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-theme='dark'] .chat__banner {
  color: #f0c070;
}

.messages {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 18px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 0;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

/* Peu de messages : on colle le fil au bas de la fenêtre comme dans WeChat. */
.messages > *:first-child {
  margin-top: auto;
}

/*
 * Une journée = un bloc, et la pastille de date est collante **dans** ce bloc :
 * la journée suivante la chasse vers le haut.
 *
 * Sans ce bloc, chaque séparateur avait pour bloc conteneur tout le fil : toutes
 * les pastilles déjà dépassées restaient donc collées en haut, au même décalage,
 * et se recouvraient   un pâté de deux ou trois étiquettes illisibles
 * (« diman⬦ Hier ⬦tobre ») qui grossissait avec l'historique.
 */
.day-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

/*
 * Séparateur de jour « collant » (Telegram) : il reste visible en haut du fil
 * pendant le défilement de **sa** journée. La pastille est **opaque**   une
 * version translucide laissait lire le message qui glissait dessous, ce qui
 * donnait l'impression d'un texte superposé au lieu d'un repère de date.
 */
.day-sep {
  position: sticky;
  top: 8px;
  z-index: 3;
  isolation: isolate;
  align-self: center;
  margin: 14px 0 8px;
  padding: 4px 12px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-meta);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.1);
}

/*
 * Bandeau de fond du séparateur collant. Sans lui, la pastille ne masquait que
 * son propre disque : le haut d'un message ou d'une pastille d'appel restait
 * visible tout autour et semblait se superposer au texte « Aujourd'hui ».
 */
.day-sep::before {
  content: '';
  position: absolute;
  top: -8px;
  bottom: -8px;
  left: 50%;
  z-index: -1;
  width: 100vw;
  background: var(--chat-bg);
  pointer-events: none;
  transform: translateX(-50%);
}

[data-theme='dark'] .day-sep {
  box-shadow: 0 1px 10px rgba(0, 0, 0, 0.55);
}

.sys-msg {
  align-self: center;
  margin: 6px 0;
  font-size: 11.5px;
  color: var(--text-meta);
  text-align: center;
  max-width: 70%;
  line-height: 1.5;
}

/*
 * Journal d'appels : une ligne centrée, avec icône, sens, durée et heure.
 *
 * Ces entrées étaient rendues comme des notes système en gris très pâle : un
 * appel manqué était strictement identique à un appel vidéo de 2:22. Le rouge
 * est réservé à ce qui demande une action   appel manqué ou resté sans réponse.
 */
.call-log {
  align-self: center;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 88%;
  margin: 6px 0;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-meta);
}

.call-log__badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex: none;
  display: grid;
  place-items: center;
  background: rgba(7, 193, 96, 0.14);
  color: var(--green-dark);
}

.call-log__badge svg {
  width: 14px;
  height: 14px;
}

.call-log__label {
  min-width: 0;
  overflow-wrap: anywhere;
}

.call-log__label strong {
  font-weight: 600;
}

.call-log__time {
  flex: none;
  font-variant-numeric: tabular-nums;
}

.call-log.is-missed .call-log__label,
.call-log.is-missed .call-log__time {
  color: var(--danger-text);
}

.call-log.is-missed .call-log__badge {
  background: rgba(230, 67, 64, 0.14);
  color: var(--danger-text);
}

.msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 8px;
  position: relative;
}

/*
 * Suite immédiate du même expéditeur : l'avatar n'est plus répété et l'écart se
 * resserre. C'est le regroupement de Telegram, et ce qui rend un long fil
 * lisible   sans lui, chaque bulle semble être une nouvelle prise de parole.
 */
.msg.is-follow-up {
  margin-top: 2px;
}

.msg.is-follow-up .avatar--msg {
  visibility: hidden;
}

/* Une seule pointe par prise de parole : celle de la première bulle, qui
   désigne l'avatar. Répétée sur chaque bulle du groupe, elle donnait
   l'impression de messages indépendants. */
.msg.is-follow-up .bubble::after {
  display: none;
}

.msg.is-me {
  flex-direction: row-reverse;
}

.msg__col {
  max-width: min(560px, 68%);
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.msg.is-me .msg__col {
  align-items: flex-end;
}

.msg__sender {
  font-size: 11.5px;
  color: var(--text-soft);
  padding-left: 2px;
}

.bubble {
  position: relative;
  background: var(--bubble-other);
  border-radius: var(--radius);
  padding: 9px 12px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
  word-wrap: break-word;
  overflow-wrap: anywhere;
  line-height: 1.55;
  white-space: pre-wrap;
  font-size: 14.5px;
}

.msg.is-me .bubble {
  background: var(--bubble-me);
  color: #101010;
}

[data-theme='dark'] .msg.is-me .bubble {
  color: #f2f2f2;
}

.bubble::after {
  content: '';
  position: absolute;
  top: 11px;
  width: 0;
  height: 0;
  border: 5px solid transparent;
}

.msg:not(.is-me) .bubble::after {
  left: -9px;
  border-right-color: var(--bubble-other);
}

.msg.is-me .bubble::after {
  right: -9px;
  border-left-color: var(--bubble-me);
}

.bubble--media,
.msg.is-me .bubble--media {
  /* Une photo se suffit à elle-même : ni fond coloré ni marge, sinon la
   * couleur de la bulle encadre l'image (visible surtout sur la bulle verte). */
  padding: 0;
  background: transparent;
}

.bubble--media::after {
  display: none;
}

.bubble__caption {
  padding: 6px 8px 2px;
  white-space: pre-wrap;
}

/*
 * Lien dans une bulle : souligné **et** coloré, parce que la couleur seule ne
 * suffit pas à distinguer un lien d'un texte sur la bulle verte, et que la
 * couleur du texte change d'un thème à l'autre.
 */
.bubble__link {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  word-break: break-all;
}

.bubble__link:active {
  opacity: 0.7;
}

.bubble img.attach-img {
  display: block;
  max-width: 320px;
  max-height: 320px;
  border-radius: 6px;
  cursor: zoom-in;
  background: var(--panel-3);
}

/* Aperçus par type de pièce jointe (1.115.0) : une image se montre, une vidéo
 * se lit, un document se reconnaît à son format. */
.attach-media {
  position: relative;
  display: block;
  max-width: 320px;
  border-radius: 6px;
  overflow: hidden;
}

.attach-media.is-waiting {
  width: 240px;
  min-height: 150px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  padding: 14px;
  background: var(--panel-3);
}

/* Mode économie : la pièce jointe attend un appui, sans téléchargement d'office. */
.attach-media.is-economy {
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.attach-media.is-economy:hover {
  background: var(--panel-2);
}

.attach-media__action {
  color: var(--green);
}

.attach-media__icon {
  color: var(--text-soft);
  opacity: 0.8;
}

.attach-media__hint {
  font-size: 11.5px;
  color: var(--text-soft);
  text-align: center;
  line-height: 1.35;
}

.attach-media__duree {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.attach-video {
  display: block;
  max-width: 320px;
  max-height: 320px;
  border-radius: 6px;
  background: #000;
}

/* Progression : la même dans une tuile média et dans une ligne de fichier. */
.attach-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 240px;
}

.attach-progress__track {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(127, 127, 127, 0.28);
  overflow: hidden;
}

.attach-progress__track i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--green);
  transition: width 0.2s ease;
}

.attach-progress b {
  min-width: 34px;
  text-align: right;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}

.attach-file {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 210px;
  cursor: pointer;
}

.attach-file__head {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* La vignette de format remplace l'icône unique : un PDF, un tableur et une
 * archive ne se ressemblent plus. */
.attach-file__badge {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  flex: none;
  display: grid;
  place-items: center;
  background: rgba(127, 127, 127, 0.16);
  color: var(--text-soft);
}

.attach-file__badge b {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
}

.attach-file__badge.is-pdf {
  background: rgba(229, 72, 77, 0.16);
  color: #e5484d;
}

.attach-file__badge.is-document {
  background: rgba(64, 120, 242, 0.16);
  color: #4078f2;
}

.attach-file__badge.is-tableur {
  background: rgba(28, 154, 90, 0.16);
  color: #1c9a5a;
}

.attach-file__badge.is-presentation {
  background: rgba(226, 122, 40, 0.16);
  color: #e27a28;
}

.attach-file__badge.is-archive {
  background: rgba(214, 158, 46, 0.18);
  color: #a97b0d;
}

.attach-file__badge.is-audio {
  background: rgba(122, 92, 230, 0.16);
  color: #7a5ce6;
}

.attach-file__action {
  margin-left: auto;
  flex: none;
  color: var(--text-soft);
}

.attach-file--audio {
  cursor: default;
}

.attach-audio {
  width: 100%;
  max-width: 300px;
}

.attach-file__absent {
  font-size: 11.5px;
  color: var(--text-soft);
}

/* Fiche de contact partagée (1.116.0) : avatar, nom, identifiant, action. */
.contact-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 230px;
  max-width: 300px;
}

.contact-card .avatar--contact {
  width: 44px;
  height: 44px;
  font-size: 16px;
  flex: none;
}

.contact-card__body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.contact-card__name {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-card__id {
  font-size: 11.5px;
  color: var(--text-soft);
}

.contact-card__bio {
  font-size: 11.5px;
  color: var(--text-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn--small {
  padding: 5px 12px;
  font-size: 12px;
  flex: none;
}

.contact-card__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.contact-card__appel {
  padding: 5px 9px;
}

/* Carte de position (1.119.0) : aperçu dessiné localement, précision, direct. */
.position-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 210px;
  max-width: 300px;
  cursor: pointer;
}

.position-card__apercu {
  width: 64px;
  height: 64px;
  flex: none;
  display: block;
  border-radius: 10px;
  overflow: hidden;
}

/* Carte OpenStreetMap réelle : tuiles posées à la main, crédit obligatoire. */
.carte-osm {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: var(--panel-3);
}

.carte-osm__fond,
.carte-osm__couche,
.carte-osm__point {
  position: absolute;
  inset: 0;
}

.carte-osm__fond svg,
.carte-osm__point svg {
  width: 100%;
  height: 100%;
}

/* Commandes de zoom de la vue large. */
.carte-osm__zoom {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.carte-osm__bouton {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 7px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  background: rgba(255, 255, 255, 0.94);
  color: #1b1b1b;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.carte-osm__bouton:active {
  background: #fff;
}

.carte-osm__tuile {
  position: absolute;
  width: 256px;
  height: 256px;
  max-width: none;
  pointer-events: none;
  user-select: none;
}

.carte-osm__credit {
  position: absolute;
  right: 2px;
  bottom: 2px;
  padding: 0 3px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 8px;
  line-height: 1.5;
  letter-spacing: 0.2px;
  text-decoration: none;
}

.position-vue__carte .carte-osm {
  max-width: 100%;
}

.position-carte {
  display: block;
  width: 100%;
  height: auto;
}

.position-carte__fond {
  fill: rgba(127, 127, 127, 0.14);
}

.position-carte__voie {
  fill: none;
  stroke: rgba(127, 127, 127, 0.32);
  stroke-width: 2.5;
}

.position-carte__incertitude {
  fill: rgba(7, 193, 96, 0.16);
  stroke: rgba(7, 193, 96, 0.5);
  stroke-width: 1;
}

.position-carte__point {
  fill: var(--green);
  stroke: var(--panel);
  stroke-width: 1.5;
}

.position-carte__halo {
  fill: rgba(7, 193, 96, 0.3);
  transform-box: fill-box;
  transform-origin: center;
  animation: position-halo 1.8s ease-out infinite;
}

.position-carte__echelle {
  fill: currentColor;
  opacity: 0.55;
}

.position-carte__echelle-txt {
  fill: currentColor;
  opacity: 0.6;
  font-family: inherit;
}

@keyframes position-halo {
  0% { transform: scale(0.6); opacity: 0.7; }
  70% { transform: scale(1.8); opacity: 0; }
  100% { transform: scale(1.8); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .position-carte__halo {
    animation: none;
  }
}

.position-card__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.position-card__ligne {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.position-card__titre {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.position-card__coords {
  font-size: 11.5px;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}

.position-card__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-soft);
}

.position-card__precision {
  font-variant-numeric: tabular-nums;
}

.position-card__reste {
  color: var(--green-dark);
  font-variant-numeric: tabular-nums;
}

.position-card__live {
  font-style: normal;
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  flex: none;
}

.position-card__live.is-actif {
  color: var(--green-dark);
  background: rgba(7, 193, 96, 0.18);
}

.position-card__live.is-fini {
  color: var(--text-soft);
  background: rgba(127, 127, 127, 0.16);
}

.position-card__actions {
  display: flex;
  margin-top: 2px;
}

/* Vue large, ouverte au clic sur la carte. */
.position-vue {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.position-vue__carte {
  border-radius: 14px;
  overflow: hidden;
}

.position-vue__infos {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.position-vue__titre {
  font-size: 16px;
}

.position-vue__coords {
  font-size: 13px;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}

.position-vue__precision,
.position-vue__live {
  font-size: 12.5px;
  color: var(--text-soft);
}

.position-vue__live {
  color: var(--green-dark);
}

/* Écran de position (1.123.0) : carte, informations, puis les mêmes lignes de
 * menu que le reste de l'application. */
.position-menu {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.position-menu .sheet-list {
  margin: 0;
}

.position-apercu__carte {
  border-radius: 14px;
  overflow: hidden;
}

.position-apercu__infos {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.position-apercu__titre {
  font-size: 16px;
}

.position-apercu__coords {
  font-size: 13px;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}

.position-apercu__precision {
  font-size: 12.5px;
  color: var(--text-soft);
}

.position-apercu__note {
  font-size: 12px;
  color: var(--text-soft);
}

.position-apercu__direct {
  font-size: 12.5px;
  color: var(--green-dark);
}

.attach-file__meta strong {
  display: block;
  font-size: 13.5px;
  font-weight: 500;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attach-file__meta span {
  font-size: 11.5px;
  color: var(--text-soft);
}

/*
 * Message vocal   la pilule du premier modèle de référence.
 *
 * La bulle s'efface au profit de la pilule (fond, rayon et ombre portés par
 * `.voice`), sinon on aurait une bulle dans une bulle. La forme d'onde vient des
 * amplitudes réelles du son ; les barres se partagent la largeur, donc elles ne
 * s'étirent pas quand la pilule s'allonge avec la durée.
 */
.bubble--voice,
.msg.is-me .bubble--voice {
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.bubble--voice::after {
  display: none;
}

.voice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  border-radius: 999px;
  background: var(--bubble-other);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  max-width: 100%;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
}

.msg.is-me .voice {
  background: var(--green);
  border-color: transparent;
  color: #fff;
}

.voice__btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.07);
  display: grid;
  place-items: center;
  flex: none;
}

.msg.is-me .voice__btn {
  background: rgba(255, 255, 255, 0.28);
}

.voice__btn svg {
  width: 17px;
  height: 17px;
}

.voice__bars {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 24px;
  flex: 1;
  min-width: 0;
  /* Garde-fou : la forme d'onde ne doit jamais sortir de la pilule, même si une
   * largeur de durée venait à manquer de place (pilule bridée sur petit écran). */
  overflow: hidden;
}

.voice__bars i {
  display: block;
  flex: 1 1 0;
  min-width: 2px;
  max-width: 3px;
  border-radius: 2px;
  background: currentColor;
  opacity: 0.42;
  transition: opacity 0.12s;
}

.voice__bars i.is-played {
  opacity: 1;
}

.voice__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.voice__time {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  opacity: 0.9;
}

.voice__speaker {
  width: 15px;
  height: 15px;
  opacity: 0.85;
}

.msg__foot {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-meta);
  padding: 0 2px;
}

.msg__foot svg {
  width: 14px;
  height: 14px;
}

.msg__state.is-read {
  color: var(--green);
}

.msg__state.is-failed {
  color: var(--danger);
}

/*
 * Le canal (« direct / relais / boîte ») n'est plus écrit dans le fil : il ne
 * reste que dans l'infobulle de `.msg__foot` et dans le diagnostic.
 */

.reply-quote {
  border-left: 2px solid var(--green);
  padding: 3px 8px;
  margin-bottom: 6px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 4px;
  font-size: 12.5px;
  color: var(--text-soft);
  max-width: 100%;
  overflow: hidden;
}

.reply-quote strong {
  display: block;
  color: var(--text);
  font-size: 12px;
  margin-bottom: 1px;
}

.reply-quote span {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reactions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.reaction {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 12.5px;
  cursor: pointer;
  display: inline-flex;
  gap: 3px;
  align-items: center;
}

.reaction.is-mine {
  border-color: var(--green);
  background: rgba(7, 193, 96, 0.1);
}

/*
 * Barre d'actions d'un message.
 *
 * Elle est placée **dans l'espace libre**, à l'opposé de la bulle, et non
 * par-dessus : posée sur le message, elle en masquait le texte, et sur un
 * message vocal elle recouvrait exactement le bouton de lecture   celui qu'on
 * cherche du curseur.
 */
.msg__tools {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  gap: 2px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
  box-shadow: var(--shadow);
  z-index: 3;
}

.msg:hover .msg__tools {
  display: flex;
}

/* La colonne du message est au plus à 68 % : il reste de la place de l'autre
   côté de la ligne, celle que la barre occupe. */
.msg.is-me .msg__tools {
  left: 6px;
}

.msg:not(.is-me) .msg__tools {
  right: 6px;
}

.msg__tools .icon-btn {
  width: 26px;
  height: 26px;
}

.msg__tools .icon-btn svg {
  width: 16px;
  height: 16px;
}

.msg.is-deleted .bubble {
  font-style: italic;
  color: var(--text-faint);
  background: transparent;
  box-shadow: none;
  border: 1px dashed var(--border);
}

.transfer-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--panel-3);
  overflow: hidden;
  margin-top: 6px;
}

.transfer-bar i {
  display: block;
  height: 100%;
  background: var(--green);
  width: 0;
  transition: width 0.2s;
}

.typing-line {
  height: 18px;
  padding: 0 20px;
  font-size: 11.5px;
  color: var(--text-soft);
  flex: none;
}

.reply-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: var(--panel);
  border-top: 1px solid var(--border);
}

.reply-preview__body {
  flex: 1;
  min-width: 0;
  border-left: 3px solid var(--green);
  padding-left: 8px;
}

.reply-preview__body strong {
  display: block;
  font-size: 12px;
}

.reply-preview__body span {
  font-size: 12.5px;
  color: var(--text-soft);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 9px 12px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  flex: none;
}

.composer textarea {
  flex: 1;
  resize: none;
  border: 0;
  outline: none;
  background: transparent;
  max-height: 160px;
  padding: 6px 4px;
  line-height: 1.5;
  font-size: 14.5px;
}

.send-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--text-faint);
  transition: color 0.15s, background 0.15s;
}

.send-btn.is-ready {
  color: var(--green);
}

.send-btn:hover {
  background: var(--hover);
}

.recorder {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--danger);
}

.recorder__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
  animation: pulse 1s infinite;
}

.recorder__hint {
  color: var(--text-soft);
  font-size: 12px;
  margin-left: auto;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.25;
  }
}

.dropzone {
  position: absolute;
  inset: 0;
  background: rgba(7, 193, 96, 0.12);
  border: 3px dashed var(--green);
  display: grid;
  place-items: center;
  font-size: 18px;
  color: var(--green-dark);
  z-index: 20;
  pointer-events: none;
}

/* ------------------------------ Onboarding ------------------------------ */

.onboarding {
  position: fixed;
  inset: 0;
  background: linear-gradient(140deg, #0b3d24, #07c160 60%, #0b3d24);
  display: grid;
  place-items: center;
  padding: 20px;
  overflow-y: auto;
  z-index: 40;
}

.onboarding__card {
  width: min(460px, 100%);
  background: var(--panel);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 26px 26px 22px;
}

.onboarding__brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.onboarding__brand svg {
  width: 46px;
  height: 46px;
  color: var(--green);
}

.onboarding__brand h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 0.12em;
}

.onboarding__brand p {
  margin: 2px 0 0;
  color: var(--text-soft);
  font-size: 12.5px;
}

/* Marque et sélecteur de langue sur la même ligne. */
.onboarding__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.onboarding__top .onboarding__brand {
  margin-bottom: 0;
}

.lang-toggle {
  display: flex;
  gap: 2px;
  background: var(--panel-3);
  border-radius: 8px;
  padding: 2px;
  flex: none;
}

.lang-toggle__btn {
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-soft);
}

.lang-toggle__btn.is-active {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/*
 *  0tat du serveur : joignable, sur invitation, ou injoignable. Affiché avant
 * toute saisie, pour ne pas laisser remplir un formulaire que le serveur
 * refusera   ou attendre la génération des clés pour rien.
 */
.server-state {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 9px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-soft);
  margin-bottom: 16px;
}

.server-state__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  background: var(--text-faint);
}

.server-state__text {
  flex: 1;
  min-width: 0;
}

.server-state__retry {
  flex: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--green-dark);
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(7, 193, 96, 0.12);
}

[data-theme='dark'] .server-state__retry {
  color: #6ee7a0;
}

.server-state[data-state='checking'] .server-state__dot {
  background: var(--warn);
  animation: pulse 1.1s infinite;
}

.server-state[data-state='ok'] .server-state__dot {
  background: var(--green);
}

.server-state[data-state='invite'] .server-state__dot {
  background: var(--warn);
}

.server-state[data-state='down'] {
  border-color: rgba(230, 67, 64, 0.4);
  background: rgba(230, 67, 64, 0.07);
  color: var(--danger);
}

.server-state[data-state='down'] .server-state__dot {
  background: var(--danger);
}

.onboarding__lead {
  margin: 0 0 14px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-soft);
}

.onboarding__note {
  margin: 12px 0 0;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--text-faint);
}

/*
 * Téléchargement de l'application Android, en bas de la carte d'accueil.
 *
 * Une ligne discrète, séparée du formulaire par un filet : elle ne doit pas
 * rivaliser avec « Créer un compte », qui reste l'action principale. Elle est
 * ajoutée par le script seulement si le serveur publie un APK — pas de lien mort.
 */
.apk-download {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.apk-download__lien {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.apk-download__lien:hover,
.apk-download__lien:focus-visible {
  background: var(--hover);
  border-color: var(--text-faint);
}

.apk-download__icon {
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--green);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.apk-download__textes {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.apk-download__textes strong {
  font-size: 13px;
  font-weight: 600;
}

.apk-download__textes small {
  font-size: 11.5px;
  color: var(--text-soft);
}

/* Champ mot de passe avec bascule d'affichage. */
.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 40px;
}

.password-field__eye {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--text-faint);
}

.password-field__eye:hover {
  background: var(--hover);
  color: var(--text);
}

.password-field__eye svg {
  width: 18px;
  height: 18px;
}

.password-field__eye .password-field__off,
.password-field__eye.is-revealed .password-field__on {
  display: none;
}

.password-field__eye.is-revealed .password-field__off {
  display: block;
}

/* Verdict du fichier choisi : reconnu, ou non. */
.field-hint[data-kind='archive'],
.field-hint[data-kind='backup'] {
  color: var(--green-dark);
}

[data-theme='dark'] .field-hint[data-kind='archive'],
[data-theme='dark'] .field-hint[data-kind='backup'] {
  color: #6ee7a0;
}

.field-hint[data-kind='unknown'] {
  color: var(--danger);
}

.tabs {
  display: flex;
  gap: 4px;
  background: var(--panel-3);
  border-radius: 9px;
  padding: 3px;
  margin-bottom: 18px;
}

.tab {
  flex: 1;
  padding: 8px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--text-soft);
}

.tab.is-active {
  background: var(--panel);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field > span {
  display: block;
  font-size: 12.5px;
  color: var(--text-soft);
  margin-bottom: 6px;
}

.field input[type='text'],
.field input[type='password'],
.field input[type='search'],
.field select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  outline: none;
}

.field textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  outline: none;
  resize: vertical;
  min-height: 76px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--green);
}

/*
 * Sélecteur de fichier : laissé natif, il affiche un bouton gris et un texte
 * « Aucun fichier n'a été sélectionné » qui détonne au milieu d'un formulaire
 * soigné. `::file-selector-button` permet de l'accorder au reste sans renoncer
 * à un `<input type="file">`   donc sans casser les tests qui le pilotent.
 */
.field input[type='file'] {
  width: 100%;
  padding: 7px 9px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text-soft);
  font-size: 12.5px;
  cursor: pointer;
}

.field input[type='file']:hover {
  border-color: var(--green);
}

.field input[type='file']::file-selector-button {
  font: inherit;
  font-weight: 600;
  margin-right: 10px;
  padding: 6px 12px;
  border: 0;
  border-radius: 7px;
  background: var(--panel-3);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
}

.field input[type='file']::file-selector-button:hover {
  background: var(--green);
  color: #fff;
}

.field-hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-faint);
  line-height: 1.5;
}

.field-result {
  font-size: 12.5px;
  color: var(--text-soft);
  line-height: 1.55;
  min-height: 34px;
}

/* ------------------------- Ajout d'un contact ---------------------------- */

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.contact-form__lead {
  margin: 0;
  color: var(--text-soft);
  font-size: 12.5px;
  line-height: 1.55;
}

.contact-form__field {
  margin-bottom: 0;
}

.contact-form__label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-soft);
  font-size: 12.5px;
}

.contact-id-wrap {
  position: relative;
}

.contact-id-wrap__icon {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 18px;
  height: 18px;
  color: var(--text-faint);
  pointer-events: none;
  transform: translateY(-50%);
}

.contact-form .contact-id-wrap input {
  width: 100%;
  padding-left: 38px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0.02em;
}

.contact-form .contact-id-wrap input.is-valid {
  border-color: var(--green);
}

.contact-form__hint {
  margin-top: 6px;
}

.contact-form .field-result {
  min-height: 0;
}

.contact-form__status {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text-soft);
  font-size: 12.5px;
  line-height: 1.5;
}

.contact-form__status:empty {
  display: none;
}

.contact-own {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
}

.contact-own__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}

.contact-own__label {
  color: var(--text-meta);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.contact-own__value {
  overflow: hidden;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-own__copy {
  display: inline-flex;
  align-items: center;
  flex: none;
  gap: 5px;
  padding: 6px 10px;
  font-size: 12px;
}

.contact-own__copy svg {
  width: 14px;
  height: 14px;
}

.contact-alt {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.contact-alt__title {
  padding: 9px 12px 5px;
  color: var(--text-faint);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.contact-alt__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-top: 1px solid var(--border);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
}

.contact-alt__item:hover {
  background: var(--hover);
}

.contact-alt__title + .contact-alt__item {
  border-top: 0;
}

.contact-alt__icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(7, 193, 96, 0.12);
  color: var(--green);
}

.contact-alt__icon svg {
  width: 16px;
  height: 16px;
}

.contact-alt__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.contact-alt__label {
  font-size: 13px;
  font-weight: 600;
}

.contact-alt__hint {
  overflow: hidden;
  margin-top: 1px;
  color: var(--text-meta);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-alt__chevron {
  flex: none;
  color: var(--text-faint);
}

.contact-alt__chevron svg {
  width: 15px;
  height: 15px;
}

.btn {
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  background: var(--panel-3);
  color: var(--text);
  /* Un bouton peut être un lien (ouvrir une carte, par exemple) : sans cela,
   * le soulignement par défaut des liens le ferait passer pour du texte. */
  text-decoration: none;
  transition: filter 0.15s, background 0.15s;
}

.btn:hover {
  filter: brightness(0.97);
}

.btn--primary {
  background: var(--green);
  color: #fff;
}

.btn--ghost {
  background: transparent;
  border: 1px solid var(--border);
}

.btn--danger {
  background: var(--danger);
  color: #fff;
}

.btn--block {
  width: 100%;
  margin-top: 6px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.crypto-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: rgba(7, 193, 96, 0.08);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 4px 0 16px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-soft);
}

.crypto-note svg {
  width: 18px;
  height: 18px;
  color: var(--green);
  flex: none;
  margin-top: 1px;
}

.identity-reveal {
  border-top: 1px solid var(--border);
  margin-top: 18px;
  padding-top: 16px;
}

.identity-reveal__id {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.identity-reveal__id code {
  flex: 1;
  font-size: 17px;
  letter-spacing: 0.06em;
  background: var(--panel-3);
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 600;
  color: var(--green-dark);
  text-align: center;
}

.row-buttons {
  display: flex;
  gap: 8px;
}

.warn {
  color: var(--warn);
  font-size: 11.5px;
  margin: 12px 0 0;
  line-height: 1.5;
}

/*
 * Coffre de récupération : un bloc discret, sous l'identifiant.
 *
 * Le code se note puis se recopie **à la main**, des mois plus tard : il reçoit
 * le même traitement que l'identifiant Dowen (chasse fixe, fond, sélection
 * facile), et l'avertissement est en couleur d'alerte — c'est la seule fois où
 * il est lisible.
 */
.vault-save {
  border-top: 1px solid var(--border);
  margin-top: 16px;
  padding-top: 14px;
}

.vault-save__lead {
  font-size: 12px;
  color: var(--text-soft);
  line-height: 1.6;
  margin: 0 0 10px;
}

.vault-code {
  margin-top: 12px;
}

.vault-code__lead {
  display: block;
  font-size: 12px;
  color: var(--warn);
  line-height: 1.6;
  margin-bottom: 8px;
}

/* Séparateur « ou » de la page de connexion : deux chemins, un seul formulaire. */
.onboarding__or {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 14px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.onboarding__or::before,
.onboarding__or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.avatar-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.swatch {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
}

.swatch.is-active {
  border-color: var(--text);
}

/* -------------------------------- Modales -------------------------------- */

/*
 *  0chelle d'empilement   un seul endroit à consulter :
 *   30 barre d'onglets · 60 appel · 70 visionneuse · 75 bandeau de version
 *   85 fenêtres modales · 95 messages flash · 100 verrouillage
 *
 * Les modales étaient à 50, donc **sous** la vue d'appel (60) : les fenêtres de
 * choix du micro, de la caméra et des haut-parleurs s'ouvraient bien, mais
 * invisibles derrière l'appel   elles n'apparaissaient qu'après avoir raccroché.
 */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 85;
  pointer-events: none;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  display: grid;
  place-items: center;
  padding: 18px;
  pointer-events: auto;
  /*
   * Chaque fenêtre est un **contexte d'empilement** à part entière.
   *
   * Sans cela, les z-index positifs du profil (héros, pastilles) s'échappaient
   * de leur fenêtre et peignaient par-dessus la fenêtre suivante : la galerie
   * « Toutes les photos » laissait voir le profil au travers, alors qu'elle
   * est bien opaque. L'isolation garde chaque fenêtre chez elle ; entre
   * fenêtres, c'est l'ordre du DOM qui décide, donc la dernière ouverte passe
   * devant.
   */
  isolation: isolate;
  z-index: 0;
}

.modal {
  width: min(520px, 100%);
  max-height: min(92vh, 860px);
  background: var(--panel);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal--wide {
  width: min(680px, 100%);
}

.modal__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  flex: none;
}

.modal__head h2 {
  margin: 0;
  font-size: 16px;
  flex: 1;
}

/*
 * `min-height: 0` est indispensable : sans lui, un élément flex refuse de
 * descendre sous la hauteur de son contenu et les dernières lignes se
 * retrouvent coupées par le pied de la fenêtre   invisibles, sans même une
 * barre de défilement pour les atteindre.
 */
.modal__body {
  padding: 16px 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  min-height: 0;
  flex: 1 1 auto;
}

.modal__foot {
  padding: 12px 18px 16px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
  background: var(--panel);
  flex: none;
}

.modal__body .field:last-child {
  margin-bottom: 0;
}

.member-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 4px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 7px;
  cursor: pointer;
}

.check-row:hover {
  background: var(--hover);
}

.check-row input {
  accent-color: var(--green);
  width: 16px;
  height: 16px;
}

.check-row__body {
  flex: 1;
  min-width: 0;
}

.check-row__body strong {
  display: block;
  font-size: 13.5px;
  font-weight: 500;
}

.check-row__body span {
  font-size: 11.5px;
  color: var(--text-soft);
}

.kv {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.kv:last-child {
  border-bottom: 0;
}

.kv span {
  color: var(--text-soft);
}

.kv strong {
  font-weight: 500;
  text-align: right;
  overflow-wrap: anywhere;
}

.safety {
  font-family: ui-monospace, 'Cascadia Mono', Menlo, Consolas, monospace;
  letter-spacing: 0.08em;
  background: var(--panel-3);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  text-align: center;
  margin: 6px 0 12px;
}

.settings-group {
  margin-bottom: 18px;
}

.settings-group h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin: 0 0 8px;
}

/* --------------------------- Densité compacte ---------------------------- */

[data-density='compact'] .row {
  padding: 6px 10px;
}

[data-density='compact'] .row__sub {
  font-size: 11.5px;
}

[data-density='compact'] .avatar--row {
  width: 34px;
  height: 34px;
  font-size: 13px;
}

[data-density='compact'] .row__avatar {
  width: 34px;
  height: 34px;
}

[data-density='compact'] .messages {
  padding: 8px 14px 4px;
  gap: 0;
}

[data-density='compact'] .msg {
  margin-top: 4px;
}

[data-density='compact'] .msg.is-follow-up {
  margin-top: 1px;
}

[data-density='compact'] .avatar--msg {
  width: 28px;
  height: 28px;
  font-size: 12px;
}

[data-density='compact'] .bubble {
  padding: 6px 10px;
  font-size: 13.5px;
  line-height: 1.45;
}

[data-density='compact'] .chat__head {
  padding: 6px 12px;
}

[data-density='compact'] .composer {
  padding: 6px 10px;
}

[data-density='compact'] .day-sep {
  margin: 8px 0 4px;
}

/*
 * ------------------------------ Page de réglages -------------------------
 *
 * Disposition empruntée à WeChat et Telegram : fond gris, **cartes blanches**
 * par centre d'intérêt, et à l'intérieur de chaque carte des lignes de hauteur
 * constante   icône dans une colonne de largeur fixe, libellé, valeur, puis
 * chevron ou interrupteur.
 *
 * L'ancienne page mélangeait trois systèmes d'espacement : des `.row` en
 * retrait de 12 px, des `.kv` collés au bord et des libellés de section à 14 px
 *   d'où l'impression de marges chaotiques. Ici, **une seule** variable
 * (`--settings-gutter`) gouverne la marge des cartes et la marge intérieure des
 * lignes : les colonnes s'alignent d'une carte à l'autre, par construction.
 */
.settings-page {
  --settings-gutter: 12px;
  --settings-icon: 30px;
  box-sizing: border-box;
  width: 100%;
  max-width: 720px;
  min-height: 100%;
  margin: 0 auto;
  padding: 4px var(--settings-gutter) 96px;
  background: var(--bg);
}

/*
 * Les réglages n'ont pas de conversation à afficher à droite : sur bureau, on
 * leur donne toute la largeur restante et on masque le panneau vide. La page
 * elle-même reste bornée à 720 px pour garder des lignes lisibles.
 *
 * La barre de recherche globale de la liste n'a aucun sens ici : les réglages
 * ont leur propre recherche (loupe du titre). On la masque donc entièrement,
 * ce qui libère aussi la hauteur sur téléphone.
 */
.app[data-view='settings'] .list-pane__head {
  display: none;
}

.app[data-view='settings'] .list-pane__body:has(.settings-page) {
  padding-bottom: 0;
  background: var(--bg);
}

@media (min-width: 821px) {
  .app[data-view='settings'] {
    grid-template-columns: var(--rail-w) minmax(0, 1fr);
  }

  .app[data-view='settings'] .chat-pane {
    display: none;
  }

  .app[data-view='settings'] .list-pane {
    border-right: 0;
  }

  .app[data-view='settings'] .list-resizer {
    display: none;
  }
}

/*
 * Vue « Découvrir » : la page réutilise les classes `.settings-page` et porte
 * son propre titre. Ces règles sont les symétriques de celles des réglages
 * ci-dessus ; elles ne les modifient pas.
 */
.app[data-view='discover'] .list-pane__head {
  display: none;
}

.app[data-view='discover'] .list-pane__body:has(.settings-page) {
  padding-bottom: 0;
  background: var(--bg);
}

@media (min-width: 821px) {
  .app[data-view='discover'] {
    grid-template-columns: var(--rail-w) minmax(0, 1fr);
  }

  .app[data-view='discover'] .chat-pane {
    display: none;
  }

  .app[data-view='discover'] .list-pane {
    border-right: 0;
  }

  .app[data-view='discover'] .list-resizer {
    display: none;
  }
}

.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 10px 4px 12px;
}

.settings-page__title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.settings-search-toggle {
  flex: none;
  color: var(--text-soft);
}

.settings-search-toggle.is-active {
  background: var(--panel);
  color: var(--green);
}

.settings-search {
  margin-bottom: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
}

.settings-search input {
  font-size: 14px;
}

/* Carte de profil, comme la première carte de WeChat. */
.settings-profile {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px;
  margin-bottom: 20px;
  background: var(--panel);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  text-align: left;
  transition: background 0.15s;
}

.settings-profile:hover {
  background: var(--hover);
}

.settings-profile__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-profile__name {
  font-size: 17px;
  font-weight: 600;
}

.settings-profile__hint {
  font-size: 12.5px;
  color: var(--text-meta);
}

.settings-profile__id {
  font-size: 12.5px;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}

.settings-profile__bio {
  font-size: 12.5px;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-group {
  margin-bottom: 22px;
}

.settings-group__title {
  margin: 0 0 8px 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.settings-card {
  background: var(--panel);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

.settings-item {
  display: grid;
  grid-template-columns: var(--settings-icon, 30px) minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 4px 12px;
  width: 100%;
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14.5px;
}

.settings-item:last-child {
  border-bottom: 0;
}

.settings-item.is-action {
  cursor: pointer;
  transition: background 0.12s;
}

.settings-item.is-action:hover {
  background: var(--hover);
}

.settings-item.is-danger .settings-item__label {
  color: var(--danger);
}

.settings-item.is-danger .settings-item__icon {
  color: var(--danger);
}

/* Le contrôle passe sous le libellé : un choix à trois ou quatre options ne
   tient pas dans la colonne de droite d'un panneau de 306 px. */
.settings-item.is-stacked {
  grid-template-columns: var(--settings-icon, 30px) minmax(0, 1fr);
  padding-bottom: 13px;
}

.settings-item.is-stacked .settings-item__control {
  grid-column: 1 / -1;
}

/* Précision d'une ligne à contrôle : elle occupe la largeur sous le libellé. */
.settings-item.has-below {
  grid-template-columns: var(--settings-icon, 30px) minmax(0, 1fr) auto;
}

/*
 * Bouton d action sous une description de reglage.
 *
 * Sans marge, il colle au texte ci-dessus ; et pose en ligne avec un texte de
 * deux lignes, il le chevauche. Un bloc separe regle les deux cas.
 */
.settings-item__action {
  margin-top: 10px;
}

.settings-item__below {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--text-faint);
  line-height: 1.45;
}

.settings-item__icon {
  display: grid;
  place-items: center;
  width: var(--settings-icon, 30px);
  height: 30px;
  color: var(--text-soft);
}

.settings-item__icon svg {
  width: 19px;
  height: 19px;
}

.settings-item__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.settings-item__label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-item__hint {
  font-size: 12px;
  color: var(--text-faint);
  line-height: 1.45;
}

.settings-item__value {
  font-size: 13px;
  color: var(--text-soft);
  max-width: 148px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
}

.settings-item__chevron {
  display: grid;
  place-items: center;
  color: var(--text-faint);
}

.settings-item__chevron svg {
  width: 17px;
  height: 17px;
}

/* Contrôle segmenté : toutes les options visibles, une seule active. */
.seg {
  display: flex;
  gap: 2px;
  background: var(--panel-3);
  border-radius: 9px;
  padding: 3px;
}

/* Quatre choix et plus : deux colonnes, sinon le mot « Très grande » se coupe. */
.seg.is-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.seg__btn {
  flex: 1;
  padding: 6px 4px;
  border-radius: 7px;
  font-size: 12.5px;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.15s, color 0.15s;
}

.seg__btn.is-active {
  background: var(--panel);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

[data-theme='dark'] .seg {
  background: rgba(255, 255, 255, 0.06);
}

[data-theme='dark'] .seg__btn {
  color: var(--text-meta);
}

[data-theme='dark'] .seg__btn.is-active {
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

/* Pied de page : la version de l'interface et celle annoncée par le serveur,
   côte à côte   c'est là qu'on lit une incompatibilité (Telegram fait de même). */
.settings-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 0 10px;
  font-size: 11.5px;
  color: var(--text-faint);
  text-align: center;
}

@media (max-width: 820px) {
  .settings-page {
    --settings-gutter: 10px;
    padding-bottom: calc(90px + env(safe-area-inset-bottom));
  }

  .fab {
    right: 14px;
  }

  .settings-page__title {
    margin-top: calc(10px + env(safe-area-inset-top));
  }

  .settings-item {
    padding: 13px 14px;
    font-size: 15.5px;
    min-height: 54px;
  }

  .settings-item.is-action:active {
    background: var(--active);
  }

  .settings-profile {
    padding: 16px 14px;
  }

  .seg__btn {
    padding: 8px 4px;
    font-size: 13.5px;
  }
}

/* -------------------------------- Toasts --------------------------------- */

.toasts {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 95;
  pointer-events: none;
}

/*
 * Pendant un appel, les notifications se posent **au-dessus** des commandes.
 * ì 22 px du bas, elles recouvraient le micro, la caméra et le partage d'écran  
 * au moment précis où l'on cherche le bouton qu'elles annoncent.
 */
body.in-call .toasts {
  bottom: 122px;
}

.toast {
  background: rgba(30, 30, 30, 0.94);
  color: #fff;
  padding: 10px 16px;
  border-radius: 9px;
  font-size: 13px;
  box-shadow: var(--shadow);
  max-width: 76vw;
  animation: toast-in 0.18s ease-out;
}

.toast--success {
  background: rgba(7, 150, 78, 0.96);
}

.toast--error {
  background: rgba(190, 45, 42, 0.96);
}

.toast--warning {
  background: rgba(190, 130, 20, 0.96);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* -------------------------------  0mojis ---------------------------------- */

.chat-search {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  flex: none;
}

.chat-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 13px;
  padding: 4px 2px;
}

.chat-search__count {
  font-size: 11.5px;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.msg.is-match .bubble {
  outline: 2px solid rgba(7, 193, 96, 0.45);
}

.msg.is-current-match .bubble {
  outline: 2px solid var(--green);
}

.bubble mark {
  background: #ffe066;
  color: inherit;
  border-radius: 3px;
  padding: 0 1px;
}

[data-theme='dark'] .bubble mark {
  background: #8a6d00;
  color: #fff;
}

.qr-holder {
  display: grid;
  place-items: center;
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  margin: 0 auto 14px;
  width: max-content;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12);
}

.qr-holder svg {
  display: block;
  /* La règle globale `svg { width: 22px }` ne doit pas écraser le QR code. */
  width: 220px;
  height: 220px;
  max-width: 100%;
}

.qr-id {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 9px 8px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
}

.qr-id__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}

.qr-id__body > span {
  color: var(--text-meta);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.qr-id__body code {
  overflow: hidden;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qr-id__copy {
  display: inline-flex;
  align-items: center;
  flex: none;
  gap: 5px;
  padding: 5px 9px;
  font-size: 12px;
}

.qr-id__copy svg {
  width: 14px;
  height: 14px;
}

.qr-link {
  display: block;
  overflow-wrap: anywhere;
  margin-top: 8px;
  padding: 8px 9px;
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text-meta);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  line-height: 1.5;
}

/*
 * Demande d'autorisation d'appairage (1.100.0).
 *
 * Le QR a été scanné : rien ne part avant un clic explicite. L'encart prend la
 * place du QR (masqué), pour que l'écran ne montre plus qu'une décision à
 * prendre — un code encore affiché laisserait croire qu'un second scan est
 * possible alors que le consentement ne vaut que pour un appareil.
 */
.pair-confirm {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.pair-confirm__text {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
}

.pair-confirm__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 6px;
  margin-top: 6px;
}

.media-grid button {
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel-3);
  display: grid;
  place-items: center;
  color: var(--text-faint);
}

.media-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-grid .media-file {
  flex-direction: column;
  gap: 4px;
  font-size: 10.5px;
  padding: 6px;
  text-align: center;
  word-break: break-word;
}

/* --------------------------------  0mojis --------------------------------- */

.emoji-panel {
  position: absolute;
  bottom: 58px;
  left: 12px;
  right: 12px;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(30px, 1fr));
  gap: 2px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 25;
}

.emoji-panel button {
  font-size: 19px;
  padding: 3px;
  border-radius: 6px;
  line-height: 1.2;
}

.emoji-panel button:hover {
  background: var(--hover);
}

.attach-recent {
  grid-column: 1 / -1;
  min-width: 0;
  padding: 2px 2px 8px;
  border-bottom: 1px solid var(--border);
}

.attach-recent__title {
  margin-bottom: 7px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
}

.attach-recent__list {
  display: flex;
  min-height: 68px;
  gap: 7px;
  align-items: center;
  overflow-x: auto;
  color: var(--text-2);
  font-size: 12px;
}

.attach-recent__photo {
  flex: 0 0 68px;
  width: 68px;
  height: 68px;
  padding: 0;
  overflow: hidden;
  border-radius: 8px;
}

.attach-recent__photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* -------------------------------- Appels --------------------------------- */

.call-root {
  position: fixed;
  inset: 0;
  background: #0d0d0f;
  z-index: 60;
  display: flex;
  flex-direction: column;
  color: #fff;
}

.call-head {
  padding: 16px 20px 8px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.34), transparent);
  text-align: center;
  flex: none;
}

.call-grid {
  flex: 1;
  display: grid;
  gap: 10px;
  padding: 10px 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  /*
   * Les rangées se partagent la hauteur disponible.
   *
   * Avec des rangées `auto` et `align-content: center`, chaque vignette se
   * réduisait à sa hauteur minimale : deux vignettes côte à côte donnaient deux
   * bandes de 940   170 px au milieu d'un écran noir, et sur téléphone deux
   * lamelles de 120 px. La grille occupe désormais la scène, comme dans un
   * appel à deux.
   */
  grid-auto-rows: minmax(170px, 1fr);
  align-content: stretch;
  overflow-y: auto;
  min-height: 0;
  /* Nécessaire pour que le médaillon local se positionne par rapport à la scène. */
  position: relative;
}

/*
 * Appel à deux : le correspondant occupe toute la scène, notre propre image
 * passe en médaillon dans un coin. Deux vignettes de taille égale laissaient
 * d'immenses zones noires et rapetissaient le visage de l'autre.
 */
/*
 * Commandes escamotées : l'image occupe tout, un tap les ramène.
 *
 * `display: none` et non une simple opacité nulle : les barres continuaient
 * d'occuper leur place dans la colonne, si bien que la vidéo n'était jamais
 * réellement plein écran   elle gagnait en transparence, pas en surface. Ici
 * elles libèrent la place, et le fil vidéo s'étend dedans.
 *
 * L'animation d'opacité disparaît avec elles : on ne peut pas animer un
 * `display`. C'est le prix d'un vrai plein écran, et il est modique   le
 * changement se produit au moment précis où l'on touche l'écran.
 */
.call-root.controls-hidden .call-head,
.call-root.controls-hidden .call-actions {
  display: none;
}

.call-grid.is-single {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  align-content: stretch;
  padding: 0;
  gap: 0;
}

.call-grid.is-single .call-tile {
  min-height: 0;
  border: 0;
  border-radius: 0;
}

.call-grid.is-single .call-tile .avatar {
  width: 118px;
  height: 118px;
  font-size: 42px;
  border-radius: 50%;
}

/*
 * Médaillon : quatre coins, et rien d'autre.
 *
 * Le glissement libre a été retiré. La grille d'appel peut défiler   une
 * vignette de groupe la fait déborder   et un `transform` se pose par rapport au
 * contenu défilant : le médaillon sortait donc du champ, et il fallait faire
 * défiler pour le retrouver. Un ancrage aux coins ne peut pas se perdre, et il
 * tombe toujours sous le pouce.
 *
 * La position est portée par des variables, ce qui évite de répéter quatre fois
 * le bloc de style : le coin change trois valeurs, pas la mise en forme.
 */
/*
 *  0cran de sonnerie.
 *
 * Une invitation se lit en une seconde : qui appelle, et de la voix ou de
 * l'image. La grille de vignettes n'a rien à montrer tant que personne n'a
 * décroché   elle occupait l'écran pour rien. On la masque, et l'on centre
 * l'avatar, le nom et la nature de l'appel, avec deux gros boutons ronds qu'on
 * atteint sans regarder.
 */
.call-ring {
  /*
   * Dans le flux, **pas** en surcouche.
   *
   * `position: absolute; inset: 0; z-index: 4` recouvrait tout l'écran, boutons
   * compris : les appuis tombaient sur cette couche et **on ne pouvait plus
   * décrocher**. En simple enfant souple, le bloc occupe la place laissée libre
   * entre l'en-tête et les commandes   et celles-ci restent en bas, atteignables.
   */
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
}

/* `hidden` doit l'emporter sur le `display: flex` ci-dessus. */
.call-ring.hidden {
  display: none;
}

/*
 * Pendant la sonnerie, l'en-tête disparaît : le bloc centré porte **déjà** le
 * nom et la nature de l'appel. Les garder tous les deux affichait « dowin » et
 * « Appel vidéo entrant » deux fois sur le même écran.
 */
.call-root.is-ringing .call-head {
  display: none;
}

.call-root.is-ringing .call-grid,
.call-root.is-ringing .call-quality,
.call-root.is-ringing .call-mic {
  display: none;
}

.call-ring__avatar {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  font-size: 46px;
}

.call-ring__name {
  font-size: 25px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.01em;
}

.call-ring__state {
  font-size: 14.5px;
  color: rgba(255, 255, 255, 0.72);
}

/* « Répondre par un message » : une sortie digne, pas un refus muet. */
.call-ring__quick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.74);
  font-size: 12.5px;
}

.call-ring__quick svg {
  width: 15px;
  height: 15px;
}

.call-ring__quick:active {
  background: rgba(255, 255, 255, 0.14);
}

/* Deux boutons, largement écartés, à la taille du pouce. */
.call-root.is-ringing .call-actions {
  gap: 56px;
  padding-bottom: 18px;
}

.call-root.is-ringing .call-btn {
  width: 68px;
  height: 68px;
}

.call-root.is-ringing .call-btn svg {
  width: 30px;
  height: 30px;
}

.call-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.call-action__label {
  color: rgba(255, 255, 255, 0.76);
  font-size: 12.5px;
  font-weight: 500;
}

.call-root.is-ringing {
  background:
    radial-gradient(circle at 50% 28%, rgba(7, 193, 96, 0.16), transparent 54%),
    #0b0d0c;
}

/*
 * Les trois points de « Appel en cours » : ils respirent au lieu de laisser un
 * texte figé. L'ellipse de la traduction est retirée côté texte, les points
 * portent le rythme.
 */
.call-ring__state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.call-ring__dots {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  height: 1em;
  margin-left: 3px;
}

.call-ring__dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.3;
  animation: call-dot 1.2s infinite ease-in-out;
}

.call-ring__dots i:nth-child(2) { animation-delay: 0.15s; }
.call-ring__dots i:nth-child(3) { animation-delay: 0.3s; }

@keyframes call-dot {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

@media (prefers-reduced-motion: reduce) {
  .call-ring__dots i {
    animation: none;
    opacity: 0.65;
  }
}

/*
 * Écran d'appel **sortant** : même composition que la sonnerie entrante, avec
 * l'aperçu local réduit à un médaillon.
 *
 * Avant, l'écran montrait deux tuiles pleine hauteur — sa propre caméra et une
 * tuile « En attente… » — et rien qui dise qui l'on appelait. Le bloc central
 * porte désormais l'avatar et le nom, et la grille de vignettes n'est plus
 * qu'un médaillon dans le coin.
 */
.call-root.is-inviting {
  background:
    radial-gradient(circle at 50% 28%, rgba(7, 193, 96, 0.14), transparent 54%),
    #0b0d0c;
}

.call-root.is-inviting .call-head,
.call-root.is-inviting .call-quality,
.call-root.is-inviting .call-mic {
  display: none;
}

.call-root.is-inviting .call-grid {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  left: 12px;
  right: auto;
  bottom: auto;
  width: 88px;
  height: 117px;
  flex: none;
  display: block;
  padding: 0;
  gap: 0;
  z-index: 4;
  pointer-events: none;
}

/* Appel sortant audio : aucune image à prévisualiser, donc pas de pastille. */
.call-root.is-inviting-audio .call-grid {
  display: none;
}

.call-root.is-inviting .call-grid .call-tile:not(.is-self) {
  display: none;
}

.call-root.is-inviting .call-grid .call-tile.is-self {
  width: 88px;
  height: 117px;
  min-height: 0;
  border-radius: 12px;
  border: 1px solid rgba(7, 193, 96, 0.55);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.6);
}

.call-root.is-inviting .call-grid .call-tile.is-self .call-tile__name {
  left: 5px;
  bottom: 5px;
  padding: 1px 6px;
  font-size: 9.5px;
}

.call-root.is-inviting .call-actions {
  /* Cinq commandes dont une pilule « Annuler » : à 369 px de large, un écart
   * de 10 px faisait déborder la rangée de 3 px à gauche et de 4 px à droite
   * (mesuré sur le Honor). Écart réduit et marges latérales explicites. */
  gap: 6px;
  padding: 0 8px calc(18px + env(safe-area-inset-bottom));
}

/*
 * Appel sortant **vidéo** : le correspondant n'a pas décroché, et l'appelant a
 * besoin de se voir en grand — le temps de soigner son cadre. La pastille
 * devient donc le miroir : la scène entière montre sa caméra, et l'identité du
 * correspondant passe dans une pastille compacte en haut.
 */
.call-root.is-inviting-video .call-grid {
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
  z-index: 1;
  pointer-events: none;
}

.call-root.is-inviting-video .call-grid .call-tile.is-self {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
  outline: 0;
  box-shadow: none;
  background: #000;
}

/* Un miroir remplit l'écran : pas de bandes noires du `contain`. */
.call-root.is-inviting-video .call-grid .call-tile.is-self .call-tile__media video {
  object-fit: cover;
}

.call-root.is-inviting-video .call-grid .call-tile.is-self .call-tile__name,
.call-root.is-inviting-video .call-grid .call-tile.is-self .call-tile__flags {
  display: none;
}

.call-root.is-inviting-video .call-ring {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  left: 12px;
  right: auto;
  width: auto;
  max-width: calc(100% - 128px);
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 1px;
  align-items: center;
  padding: 7px 14px 7px 7px;
  background: rgba(10, 10, 12, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  flex: none;
  min-height: 0;
  z-index: 6;
}

.call-root.is-inviting-video .call-ring__avatar {
  grid-row: 1 / 3;
  width: 40px;
  height: 40px;
  font-size: 15px;
}

.call-root.is-inviting-video .call-ring__name {
  grid-column: 2;
  grid-row: 1;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.call-root.is-inviting-video .call-ring__state {
  grid-column: 2;
  grid-row: 2;
  justify-content: flex-start;
  font-size: 11.5px;
}

/* Les commandes passent au-dessus du miroir, avec un dégradé pour le contraste. */
.call-root.is-inviting-video .call-actions {
  position: relative;
  z-index: 5;
  /* Le miroir et la pastille sont hors du flux : sans cette marge, la barre
   * remonte en haut de l'écran. */
  margin-top: auto;
  padding-top: 14px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0));
}

/* L'appel audio à deux n'a pas de vignette locale à montrer. */
.call-root--audio-solo {
  background:
    radial-gradient(circle at 50% 34%, rgba(7, 193, 96, 0.13), transparent 55%),
    #0d0d0f;
}

.call-root--audio-solo .call-tile.is-self {
  display: none;
}

.call-root--audio-solo .call-grid.is-single .call-tile {
  background: transparent;
}

.call-root--audio-solo .call-grid.is-single .call-tile .avatar {
  width: 148px;
  height: 148px;
  font-size: 54px;
  box-shadow: 0 24px 80px rgba(7, 193, 96, 0.18);
}

.call-root--audio-solo .call-tile:not(.is-self) .call-tile__name {
  display: none;
}

.call-audio-note {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  gap: 6px;
  padding: 0 16px 12px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  letter-spacing: 0.01em;
}

.call-audio-note svg {
  width: 13px;
  height: 13px;
}

@keyframes app-avatar-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(7, 193, 96, 0.3), 0 18px 50px rgba(0, 0, 0, 0.35);
  }
  50% {
    box-shadow: 0 0 0 14px rgba(7, 193, 96, 0), 0 18px 50px rgba(0, 0, 0, 0.35);
  }
}

.call-root.is-ringing .call-ring__avatar {
  animation: app-avatar-pulse 2.4s ease-out infinite;
}

.call-root.is-ringing .call-status {
  opacity: 0.75;
}

@media (max-width: 820px) {
  .call-ring__avatar {
    width: 108px;
    height: 108px;
    border-radius: 50%;
    font-size: 38px;
  }

  .call-ring__name {
    font-size: 22px;
  }

  .call-root.is-ringing .call-actions {
    gap: 48px;
  }
}

.call-grid.is-single {
  --pip-top: auto;
  --pip-bottom: 16px;
  --pip-left: auto;
  --pip-right: 16px;
  /* Rien ne défile dans un appel à deux : les vignettes tiennent dans le cadre. */
  overflow: hidden;
}

.call-grid.is-single.pip-haut { --pip-top: 16px; --pip-bottom: auto; }
.call-grid.is-single.pip-gauche { --pip-left: 16px; --pip-right: auto; }

.call-grid.is-single .call-tile.is-pip {
  position: absolute;
  top: var(--pip-top);
  bottom: var(--pip-bottom);
  left: var(--pip-left);
  right: var(--pip-right);
  /*
   * Le médaillon prend la **forme de l'image** qu'il contient.
   *
   * Un cadre fixe (168   224) imposait un portrait à une caméra qui filme en
   * paysage : l'image était alors réduite à une bande au milieu du cadre, avec
   * deux larges marges noires. La largeur reste bornée   c'est elle qui décide
   * de l'encombrement   et la hauteur suit le rapport réel de la piste, borné
   * pour qu'une vidéo très allongée ne donne pas un médaillon en lame de
   * couteau. `--pip-ratio` est posé par le script à partir de `videoWidth` et
   * `videoHeight` ; à défaut, un portrait 3/4 raisonnable.
   */
  width: var(--pip-largeur, 168px);
  height: auto;
  aspect-ratio: var(--pip-ratio, 3 / 4);
  min-height: 0;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  z-index: 3;
  cursor: pointer;
}

.call-grid.is-single .call-tile.is-self .avatar {
  width: 60px;
  height: 60px;
  font-size: 21px;
  border-radius: 50%;
}

.call-grid.is-single .call-tile.is-self .call-tile__name {
  font-size: 11px;
  left: 6px;
  bottom: 6px;
  padding: 2px 7px;
}

/* Partage d'écran et médaillon local : même règle, jamais d'image tronquée. */
.call-tile.is-screen .call-tile__media video,
.call-tile.is-self .call-tile__media video {
  object-fit: contain;
}

.call-tile {
  position: relative;
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.055), transparent 62%),
    #17171a;
  border-radius: 14px;
  overflow: hidden;
  min-height: 170px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.call-tile.is-self {
  outline: 2px solid rgba(7, 193, 96, 0.55);
  outline-offset: -2px;
}

/* Le participant qui parle, en appel de groupe. */
.call-tile.is-speaking {
  outline: 2px solid var(--green);
  outline-offset: -2px;
  box-shadow: 0 0 0 2px rgba(7, 193, 96, 0.28);
}

/*
 * Tuile « +N » : elle remplace les vignettes en trop **visuellement**.
 * Les tuiles masquées restent dans la grille, avec leur élément audio branché ;
 * `display: none` les retire de la mise en page, pas de la lecture.
 */
.call-tile.is-masquee {
  display: none !important;
}

.call-tile--more {
  grid-auto-flow: row;
  align-content: center;
  gap: 4px;
  border: 1px dashed rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.82);
  font: inherit;
  cursor: pointer;
}

.call-tile--more__count {
  font-size: 30px;
  font-weight: 600;
  line-height: 1;
}

.call-tile--more__label {
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
}

.call-tile--more:active {
  background: rgba(255, 255, 255, 0.1);
}

.call-tile__media {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

/*
 * La vidéo remplit **tout** le conteneur.
 *
 * Elle était dans une grille `place-items: center` : un élément centré n'est pas
 * étiré, sa piste reste en `auto`, et `height: 100%` devient indéterminé. La
 * vidéo retombait alors sur sa taille intrinsèque   d'où une image qui
 * n'occupait pas son cadre. En positionnement absolu, `inset: 0` ne laisse
 * aucune ambiguïté.
 */
.call-tile__media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  /*
   * `contain` et non `cover` : on veut voir **tout** le cadre envoyé par le
   * correspondant. `cover` remplissait la vignette en recadrant, ce qui coupait
   * le visage dès que le rapport d'image différait (téléphone en portrait sur
   * écran large, webcam 16/9 sur mobile). Quelques bandes noires valent mieux
   * qu'une image tronquée.
   */
  object-fit: contain;
  object-position: center;
  background: #000;
}

/*
 * Appel sans image : on **recouvre** la vidéo au lieu de la masquer.
 *
 * `visibility: hidden` et `display: none` peuvent empêcher un navigateur de
 * démarrer la lecture d'un élément média   un risque qu'on ne veut pas courir
 * sur l'élément qui porte la voix du correspondant. Un masque opaque conserve
 * le rendu tout en cachant l'image.
 */
.call-tile__placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #17171a;
  pointer-events: none;
  z-index: 1;
}

/* Une image réellement reçue reprend la main sur le masque. */
.call-tile:not(.is-audio-only) .call-tile__placeholder {
  display: none;
}

.call-tile .avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  font-size: 30px;
}

.call-tile__name {
  position: absolute;
  left: 10px;
  bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  background: rgba(0, 0, 0, 0.5);
  padding: 3px 9px;
  border-radius: 999px;
  z-index: 2;
}

.call-tile__name svg {
  width: 14px;
  height: 14px;
}

.call-name {
  font-size: 20px;
  font-weight: 600;
}

/* Le chronomètre est dans le titre, à côté du nom. */
.call-duration {
  margin-left: 7px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 12.5px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.call-status {
  color: rgba(255, 255, 255, 0.7);
  font-size: 13.5px;
  margin-top: 2px;
}

.call-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  padding: 14px 0 30px;
  flex: none;
}

.call-btn {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  backdrop-filter: blur(6px);
}

.call-btn svg {
  width: 26px;
  height: 26px;
}

.call-btn--accept {
  background: var(--green);
}

.call-btn--hangup {
  background: var(--danger);
}

/*
 * « Annuler » pendant l'appel sortant : le libellé est explicite, sinon le
 * rond rouge se lit comme un raccrochage d'appel déjà établi.
 */
.call-actions .call-btn.call-btn--annuler {
  width: auto;
  min-width: 92px;
  padding: 0 14px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
}

.call-actions .call-btn.call-btn--annuler svg {
  width: 20px;
  height: 20px;
}

.call-btn__label {
  white-space: nowrap;
}

.call-btn.is-off {
  background: #fff;
  color: #111;
}

/* Une fonction allumée (haut-parleur, partage) : vert, pas blanc. */
.call-btn.is-active {
  background: var(--green);
  border-color: transparent;
  color: #fff;
}

/*
 * Les chevrons de périphérique (`.call-btn-group` / `.call-btn__more`) ont été
 * remplacés par un bouton unique « Options de l'appel » : les commandes sont des
 * cercles simples, et le choix du micro, de la caméra et de la sortie audio se
 * fait dans une seule feuille.
 */

/* Liste des périphériques : la ligne active est cochée. */

.sheet-item.is-checked {
  background: rgba(7, 193, 96, 0.12);
  color: var(--green-dark);
  font-weight: 600;
}

.sheet-item__icon {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--panel-3);
  color: var(--text-soft);
}

.sheet-item__icon svg {
  width: 18px;
  height: 18px;
  color: inherit;
}

.sheet-item__icon.is-active {
  background: var(--green);
  color: #fff;
}

/* Menus (1.125.0) : l'icône est verte dans sa pastille, le libellé garde la
 * couleur du texte — comme le menu « Créer » de l'accueil. */
.sheet-item__icon.is-green {
  background: rgba(7, 193, 96, 0.14);
  color: var(--green);
}

/*
 * `.sheet-item svg { color: var(--text-soft) }` a la même spécificité que
 * `.sheet-item__icon svg` : il l'emportait par l'ordre et peignait l'icône en
 * gris **dans** la pastille verte. Ces deux règles, plus spécifiques, rendent
 * la couleur de la pastille à son icône.
 */
.sheet-item__icon.is-green svg {
  color: var(--green);
}

.sheet-item__icon.is-active svg {
  color: #fff;
}

.sheet-item__label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sheet-item__label small {
  font-size: 11.5px;
  color: var(--text-faint);
  font-weight: 400;
}

.device-picker {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.device-picker__intro {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 6px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-soft);
  line-height: 1.5;
}

.device-picker__intro svg {
  width: 20px;
  height: 20px;
  flex: none;
  color: var(--green);
}

/* --------------------------- Panneau de réglages ------------------------- */

.settings-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-section > span {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}

.settings-themes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.settings-theme {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 6px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--panel-2);
  color: var(--text-soft);
  transition: border-color 0.15s, color 0.15s;
}

.settings-theme.is-active {
  border-color: var(--green);
  color: var(--green-dark);
}

.settings-theme__apercu {
  width: 100%;
  height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
}

.settings-theme__apercu.is-light {
  background: #f2f2f2;
  color: #f0a020;
}

.settings-theme__apercu.is-dark {
  background: #17171a;
  color: #8ab4f8;
}

.settings-theme__apercu.is-system {
  background: linear-gradient(90deg, #f2f2f2 50%, #17171a 50%);
  color: var(--green);
}

.settings-theme__apercu svg {
  width: 22px;
  height: 22px;
}

.settings-theme__label {
  font-size: 12.5px;
  font-weight: 600;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--border);
}

.settings-row:last-child {
  border-bottom: 0;
}

.settings-row__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.settings-row__text strong {
  font-size: 14.5px;
  font-weight: 500;
}

.settings-row__text small {
  font-size: 12px;
  color: var(--text-soft);
  line-height: 1.45;
}

/* Interrupteur : plus lisible qu'une case à cocher sur téléphone. */
.settings-switch {
  flex: none;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: var(--panel-3);
  border: 1px solid var(--border);
  position: relative;
  transition: background 0.18s;
  -webkit-tap-highlight-color: transparent;
}

.settings-switch.is-on {
  background: var(--green);
  border-color: var(--green);
}

.settings-switch__knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.18s;
}

.settings-switch.is-on .settings-switch__knob {
  transform: translateX(20px);
}

.settings-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-links .btn {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-start;
}

.settings-links .btn svg {
  width: 18px;
  height: 18px;
}

/* Pastilles d'état posées sur chaque vignette d'appel. */

.call-tile__flags {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 3;
}

.call-flag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 11px;
  backdrop-filter: blur(6px);
}

.call-flag svg {
  width: 13px;
  height: 13px;
}

.call-flag--off {
  background: rgba(230, 67, 64, 0.85);
}

.call-flag--warn {
  background: rgba(240, 160, 32, 0.9);
}

.call-flag--quality {
  gap: 2px;
  padding: 0 8px;
}

.call-flag--quality i,
.call-quality__bars i {
  display: block;
  width: 3px;
  border-radius: 1px;
  background: currentColor;
  opacity: 0.35;
}

.call-flag--quality i:nth-child(1),
.call-quality__bars i:nth-child(1) {
  height: 6px;
}

.call-flag--quality i:nth-child(2),
.call-quality__bars i:nth-child(2) {
  height: 10px;
}

.call-flag--quality i:nth-child(3),
.call-quality__bars i:nth-child(3) {
  height: 14px;
}

.call-flag--quality.is-l1 i:nth-child(1),
.call-flag--quality.is-l2 i:nth-child(-n + 2),
.call-flag--quality.is-l3 i,
.call-quality__bars.is-l1 i:nth-child(1),
.call-quality__bars.is-l2 i:nth-child(-n + 2),
.call-quality__bars.is-l3 i {
  opacity: 1;
}

.call-flag--quality.is-l1 {
  color: #ff7b72;
}

.call-flag--quality.is-l2 {
  color: #f0c040;
}

.call-flag--quality.is-l3 {
  color: #57d98a;
}

.call-unlock {
  margin: 0 auto 4px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: 14px;
  background: var(--warn);
  color: #2a1c00;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.45);
  animation: call-pulse 1.6s ease-in-out infinite;
}

.call-unlock svg {
  width: 20px;
  height: 20px;
}

@keyframes call-pulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.45);
  }
  50% {
    transform: scale(1.04);
    box-shadow: 0 10px 32px rgba(240, 160, 32, 0.55);
  }
}

.call-quality {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 2px 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
}

/*
 * Chaque mesure est un élément à part : la ligne se replie entre deux valeurs,
 * jamais au milieu de l'une d'elles. Le séparateur est décoratif (::before), il
 * n'appartient donc pas au texte copiable.
 */
.call-quality > span:nth-child(n + 3)::before {
  content: '·';
  margin-right: 6px;
  color: rgba(255, 255, 255, 0.45);
}

/* Vumètre local pendant l'appel : « mon micro capte-t-il quelque chose ? » */
.call-mic {
  margin: 8px auto 0;
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(220px, 70%);
  color: rgba(255, 255, 255, 0.6);
}

.call-mic svg {
  width: 15px;
  height: 15px;
  flex: none;
}

/*
 * Le vumètre : une piste visible et une barre qui la remplit.
 *
 * La barre interne n'avait **aucun style**   elle restait un `<i>` vide, et le
 * niveau mesuré était écrit sur le bloc parent, qui rétrécissait alors au rythme
 * de la voix. On ne voyait qu'une icône de micro orpheline sous l'en-tête.
 */
.call-mic .meter {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
}

.call-mic .meter i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: #57d98a;
  transition: width 0.09s linear;
}

.call-mic.is-off .meter i {
  background: rgba(255, 255, 255, 0.5);
}

.call-mic.is-off {
  opacity: 0.4;
}

/*
 * Avertissement « micro muet » : une **pastille** d'une ligne.
 *
 * Il a d'abord été un pavé de deux phrases, doublé d'un toast de douze
 * secondes : les deux recouvraient l'image du correspondant à chaque pause de
 * sept secondes. Le texte long vit désormais dans l'infobulle et dans la
 * feuille de qualité ; ici il ne reste que le constat, sur une ligne.
 */
.call-warning {
  margin: 8px auto 0;
  display: flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  max-width: 90%;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(240, 160, 32, 0.16);
  border: 1px solid rgba(240, 160, 32, 0.38);
  color: #f5c877;
  font-size: 12px;
  line-height: 1.3;
  text-align: left;
}

.call-warning svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.call-quality__bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  color: #57d98a;
}

.call-quality.is-l2 .call-quality__bars {
  color: #f0c040;
}

.call-quality.is-l1 .call-quality__bars {
  color: #ff7b72;
}

.call-tile.is-remote-muted .avatar {
  opacity: 0.55;
}

/* En appel, le son prime : on masque le reste de l'interface sur mobile. */
body.in-call {
  overscroll-behavior: none;
}

/* ------------------------------ Feuille d'actions ------------------------ */

.sheet-list {
  display: flex;
  flex-direction: column;
  margin: -6px -6px -8px;
}

.sheet-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 10px;
  border-radius: 10px;
  font-size: 15.5px;
  text-align: left;
  color: var(--text);
  min-height: 52px;
}

.sheet-item:hover {
  background: var(--hover);
}

.sheet-item:active {
  background: var(--active);
}

.sheet-item svg {
  width: 21px;
  height: 21px;
  color: var(--text-soft);
}

.sheet-item.is-danger {
  color: var(--danger);
}

.sheet-item.is-danger svg {
  color: var(--danger);
}

/* Message pressé au doigt : retour visuel avant l'ouverture de la feuille. */
.msg.is-pressing .bubble {
  transform: scale(0.97);
  transition: transform 0.12s ease-out;
}

.msg .bubble {
  transition: transform 0.15s ease-out;
}

/* ------------------------------ Diagnostic ------------------------------- */

.diag {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.diag-verdict {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}

.diag-verdict svg {
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 2px;
}

.diag-verdict strong {
  display: block;
  font-size: 15px;
  margin-bottom: 4px;
}

.diag-verdict p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-soft);
}

.diag-verdict.is-ok {
  background: rgba(7, 193, 96, 0.1);
  border-color: rgba(7, 193, 96, 0.35);
  color: var(--green);
}

.diag-verdict.is-warn {
  background: rgba(240, 160, 32, 0.12);
  border-color: rgba(240, 160, 32, 0.4);
  color: #b07800;
}

[data-theme='dark'] .diag-verdict.is-warn {
  color: #f0c070;
}

.diag-verdict.is-bad {
  background: rgba(230, 67, 64, 0.1);
  border-color: rgba(230, 67, 64, 0.4);
  color: var(--danger);
}

.diag-verdict.is-pending {
  color: var(--text-soft);
}

.diag-verdict.is-pending svg {
  animation: diag-spin 1.4s linear infinite;
}

@keyframes diag-spin {
  to {
    transform: rotate(360deg);
  }
}

.diag-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.diag-title {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-bottom: 6px;
}

.diag-hint {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-soft);
  line-height: 1.6;
}

/* Bouton « Réessayer l'abonnement » de l'écran « Rester joignable ». */
.diag-actions {
  display: flex;
  margin: 12px 0 10px;
}

.diag-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.diag-actions .btn:disabled {
  opacity: 0.6;
  cursor: default;
}

/* Conseils de l'écran « Rester joignable ». */
.diag-list {
  margin: 8px 0 14px;
  padding-left: 18px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-soft);
}

.diag-list li {
  margin-bottom: 7px;
}

.diag-value.is-ok {
  color: var(--green);
}

.diag-value.is-bad {
  color: var(--danger);
}

.diag-group {
  display: flex;
  gap: 8px;
  align-items: baseline;
  padding: 6px 0;
  font-size: 12px;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}

.diag-tag {
  flex: none;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--panel-3);
  color: var(--text-soft);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.diag-tag.is-host {
  background: rgba(7, 193, 96, 0.16);
  color: var(--green-dark);
}

.diag-tag.is-srflx {
  background: rgba(30, 144, 255, 0.16);
  color: #1e90ff;
}

.diag-tag.is-relay {
  background: rgba(142, 68, 173, 0.16);
  color: #8e44ad;
}

/* --------------------------- Verrouillage -------------------------------- */

.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: grid;
  place-items: center;
  padding: calc(20px + env(safe-area-inset-top)) 20px calc(20px + env(safe-area-inset-bottom));
}

.lock-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 320px;
}

.lock-logo {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: var(--green);
  color: #fff;
}

.lock-logo svg {
  width: 30px;
  height: 30px;
}

.lock-card h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
}

.lock-message {
  min-height: 18px;
  font-size: 13px;
  color: var(--text-soft);
}

.lock-message.is-error {
  color: var(--danger);
}

.lock-dots {
  display: flex;
  gap: 16px;
  margin: 4px 0 10px;
}

.lock-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--text-faint);
  transition: background 0.12s, border-color 0.12s, transform 0.12s;
}

.lock-dot.is-filled {
  background: var(--green);
  border-color: var(--green);
  transform: scale(1.08);
}

.lock-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  width: 100%;
}

.lock-key {
  aspect-ratio: 1 / 1;
  max-height: 68px;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--border);
  font-size: 24px;
  font-weight: 500;
  color: var(--text);
  display: grid;
  place-items: center;
  -webkit-tap-highlight-color: transparent;
}

.lock-key:active {
  background: var(--active);
}

.lock-key:disabled {
  background: none;
  border-color: transparent;
}

.lock-key svg {
  width: 22px;
  height: 22px;
  color: var(--text-soft);
}

.lock-forgot {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-soft);
  text-decoration: underline;
}

/* ------------------------------ Lecture QR ------------------------------- */

.scan {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.scan__frame {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 3 / 4;
  max-height: 52dvh;
}

.scan__video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan__reticle {
  position: absolute;
  inset: 14%;
  border: 3px solid rgba(255, 255, 255, 0.85);
  border-radius: 18px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.32);
}

.scan .diag-hint.is-error {
  color: var(--danger);
}

/* --------------------- Repère de non-lus et retour au bas --------------- */

.unread-sep {
  align-self: center;
  margin: 12px 0 4px;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(7, 193, 96, 0.14);
  color: var(--green-dark);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

[data-theme='dark'] .unread-sep {
  color: #6ee7a0;
}

.scroll-down {
  position: absolute;
  right: 14px;
  bottom: 92px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--panel);
  color: var(--text-soft);
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  display: grid;
  place-items: center;
  z-index: 8;
  animation: pop-in 0.16s ease-out;
}

.scroll-down svg {
  width: 20px;
  height: 20px;
  transform: rotate(-90deg);
}

.scroll-down:active {
  background: var(--active);
}

.scroll-down__count {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--green);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 20px;
  text-align: center;
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 820px) {
  .scroll-down {
    right: 12px;
    bottom: calc(74px + env(safe-area-inset-bottom));
  }
}

/* ------------------------------ Test des périphériques ------------------- */

.mediatest {
  gap: 22px;
}

.mediatest .diag-block {
  gap: 8px;
}

.mediatest select {
  width: 100%;
  padding: 9px 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: 14px;
}

.mediatest .btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
}

.mediatest .btn svg {
  width: 18px;
  height: 18px;
}

.mediatest .diag-hint.is-error {
  color: var(--danger);
}

.mediatest__preview {
  width: 100%;
  max-height: 200px;
  border-radius: 10px;
  background: #000;
  object-fit: cover;
}

/* Vumètre du micro : la seule façon de distinguer « ça capte » de « ça sort ». */
.meter {
  height: 10px;
  border-radius: 5px;
  background: var(--panel-3);
  overflow: hidden;
}

.meter i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--green) 0%, var(--green) 60%, var(--warn) 85%, var(--danger) 100%);
  transition: width 0.1s linear;
}

/* --------------------------- Bandeau de version -------------------------- */

.version-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 75;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  padding-top: calc(8px + env(safe-area-inset-top));
  background: rgba(240, 160, 32, 0.96);
  color: #2a1c00;
  font-size: 12.5px;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.25);
}

/*
 * Bannière de mise à jour de l'APK.
 *
 * Discrète et flottante, juste au-dessus de la barre d'onglets : elle informe
 * sans interrompre, et se ferme. Ce placement évite de recouvrir le champ de
 * saisie d'une conversation, et de concurrencer le bandeau de version qui, lui,
 * occupe le haut de l'écran.
 */
.maj-banner {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: calc(72px + env(safe-area-inset-bottom));
  z-index: 74;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 14px;
  background: rgba(28, 28, 30, 0.97);
  color: #fff;
  font-size: 12.5px;
  line-height: 1.3;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.38);
}

.maj-banner > svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.maj-banner__texte {
  flex: 1;
  min-width: 0;
}

.maj-banner .btn {
  flex: none;
}

.maj-banner__fermer {
  flex: none;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
}

.maj-banner__fermer:hover {
  opacity: 1;
}

.version-banner svg {
  width: 17px;
  height: 17px;
  flex: none;
}

.version-banner span {
  flex: 1;
  min-width: 0;
}

.version-banner .btn {
  flex: none;
  padding: 5px 12px;
  font-size: 12.5px;
  background: #2a1c00;
  color: #fff;
  border: 0;
}

/* ------------------------------ Journal brut ----------------------------- */

.log-view {
  margin: 10px 0 0;
  max-height: 46dvh;
  overflow: auto;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-soft);
  -webkit-overflow-scrolling: touch;
}

/* ------------------------------  0cran Stockage --------------------------- */

.storage-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.storage-resume {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border-radius: 14px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}

.storage-big {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.storage-resume span {
  font-size: 12.5px;
  color: var(--text-soft);
}

.storage-details {
  display: flex;
  flex-direction: column;
}

.storage-line {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: 'label value' 'hint hint';
  gap: 2px 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.storage-line:last-child {
  border-bottom: 0;
}

.storage-line__label {
  grid-area: label;
  font-size: 13.5px;
  color: var(--text-soft);
}

.storage-line__value {
  grid-area: value;
  font-size: 13.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.storage-line small {
  grid-area: hint;
  font-size: 11.5px;
  color: var(--text-faint);
  line-height: 1.4;
}

.storage-action {
  display: flex;
  justify-content: flex-end;
}

.storage-action .btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.storage-action .btn:disabled {
  opacity: 0.55;
  cursor: default;
}

/* ------------------------------- Lightbox -------------------------------- */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: grid;
  place-items: center;
  /* Au-dessus des fenêtres modales (85) : une photo de profil s'agrandit
     depuis la fiche, elle ne doit pas rester derrière l'overlay. */
  z-index: 90;
  cursor: zoom-out;
}

.lightbox img {
  max-width: 94vw;
  max-height: 92vh;
  border-radius: 6px;
}

/*
 * Un avatar s'affiche en grand **et en cercle** : on voit la photo telle que
 * dans la fiche, sans perdre la lecture du cadrage. 80vmin est assez grand sur
 * téléphone comme sur bureau, sans jamais dépasser la fenêtre.
 */
.lightbox img.is-avatar {
  width: min(80vw, 80vh);
  height: min(80vw, 80vh);
  object-fit: cover;
  border-radius: 50%;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}

/* ------------------------------ Responsive ------------------------------- */

/* Barre d'onglets : mobile uniquement (voir la requête média en fin de bloc). */

.tabbar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  background: var(--panel);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -1px 12px rgba(0, 0, 0, 0.05);
}

.tabbar__btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 56px;
  padding: 6px 0 4px;
  color: var(--text-soft);
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s;
}

.tabbar__btn.is-active {
  color: var(--green);
}

.tabbar__icon {
  position: relative;
  display: grid;
  place-items: center;
}

.tabbar__icon svg {
  width: 25px;
  height: 25px;
}

.tabbar__label {
  font-size: 10.5px;
  letter-spacing: 0.01em;
}

.tabbar__btn .badge {
  top: -6px;
  right: -10px;
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: var(--rail-w) 1fr;
  }

  .chat-pane {
    display: none;
  }

  .app[data-pane='chat'] .chat-pane {
    display: flex;
    position: fixed;
    inset: 0 0 0 var(--rail-w);
    z-index: 10;
  }

  .app[data-pane='chat'] .list-pane {
    display: none;
  }

  .chat__back {
    display: grid;
  }

  .msg__col {
    max-width: 78%;
  }
}

/*
 * Téléphone et petite tablette : on abandonne le rail latéral pour une barre
 * d'onglets en bas, comme WeChat et Telegram   c'est la zone que le pouce
 * atteint sans effort.
 */
@media (max-width: 820px) {
  :root {
    --rail-w: 0px;
    --tabbar-h: 58px;
  }

  .app {
    grid-template-columns: 1fr;
    padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  }

  .rail {
    display: none;
  }

  .tabbar {
    display: flex;
  }

  /* Conversation plein écran : la barre d'onglets s'efface. */
  body[data-pane='chat'] .tabbar {
    display: none;
  }

  body[data-pane='chat'] .app {
    padding-bottom: 0;
  }

  .list-pane {
    border-right: 0;
  }

  .list-pane__head {
    padding: calc(8px + env(safe-area-inset-top)) 10px 8px;
    background: var(--panel);
    position: sticky;
    top: 0;
    z-index: 4;
  }

  .list-head__btn {
    width: 40px;
    height: 40px;
  }

  .search {
    border-radius: 10px;
    padding: 8px 12px;
  }

  /* 16 px empêche le zoom automatique de Safari au moment de la saisie. */
  .search input,
  .composer textarea,
  .field input,
  .field textarea,
  .field select {
    font-size: 16px;
  }

  .list-pane__foot {
    padding-bottom: 8px;
  }

  .row {
    padding: 10px 12px;
    gap: 12px;
    min-height: 68px;
  }

  .row:active {
    background: var(--active);
  }

  .avatar--row {
    width: 48px;
    height: 48px;
    font-size: 18px;
    border-radius: 50%;
  }

  /* La boîte qui porte les pastilles doit suivre la taille mobile du portrait. */
  .row__avatar {
    width: 48px;
    height: 48px;
  }

  .row__title {
    font-size: 15.5px;
  }

  .row__sub {
    font-size: 13.5px;
  }

  .icon-btn {
    width: 40px;
    height: 40px;
  }

  .icon-btn:active {
    background: var(--active);
  }

  .avatar--head {
    width: 38px;
    height: 38px;
  }

  .app[data-pane='chat'] .chat-pane {
    inset: 0;
    z-index: 20;
    /* `--app-h` suit la fenêtre visuelle : le clavier logiciel ne recouvre
       donc jamais la zone de saisie (iOS notamment). */
    height: var(--app-h, 100dvh);
  }

  .chat {
    padding-top: env(safe-area-inset-top);
  }

  .chat__head {
    min-height: 54px;
    padding: 6px 6px 6px 2px;
    gap: 6px;
  }

  .chat__title strong {
    font-size: 16px;
  }

  .chat__actions {
    gap: 0;
  }

  /*
   * Les quatre commandes de l'en-tête (recherche, audio, vidéo, détails) sont
   * toutes visibles, y compris sur téléphone : la recherche du fil redevient
   * un geste direct au lieu de passer par la fiche contact/groupe. À 40 px par
   * bouton, l'action occupait 160 px et le titre n'avait plus de place pour un
   * nom sur un écran de 360 px ; on resserre donc les seuls boutons de
   * l'en-tête de conversation à 38 px, sans masquer ni déplacer aucune
   * commande. Les cibles tactiles du compositeur restent à 40/44 px.
   */
  .chat__actions .icon-btn {
    width: 38px;
    height: 38px;
  }

  .messages {
    padding: 12px 10px 6px;
    gap: 2px;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }

  .msg {
    gap: 8px;
    margin-top: 6px;
  }

  .msg__col {
    max-width: 80%;
  }

  .avatar--msg {
    width: 40px;
    height: 40px;
  }

  /* Pas de survol au doigt : les actions passent par l'appui long. */
  .msg__tools {
    display: none !important;
  }

  .bubble {
    font-size: 15.5px;
    padding: 9px 12px;
    border-radius: 6px;
  }

  .bubble img.attach-img {
    max-width: 240px;
    max-height: 300px;
  }

  .composer {
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    gap: 4px;
    align-items: flex-end;
  }

  .composer textarea {
    max-height: 118px;
    padding: 10px 12px;
    border-radius: 20px;
    line-height: 1.4;
  }

  .send-btn {
    width: 44px;
    height: 44px;
  }

  .composer .icon-btn {
    width: 40px;
    height: 40px;
  }

  .emoji-panel {
    left: 8px !important;
    right: 8px !important;
    bottom: calc(64px + env(safe-area-inset-bottom)) !important;
    max-height: 42vh;
  }

  /* Les fenêtres modales deviennent des feuilles ancrées en bas. */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-width: none;
    border-radius: 16px 16px 0 0;
    max-height: 92dvh;
    animation: sheet-up 0.22s ease-out;
  }

  .modal__foot {
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }

  @keyframes sheet-up {
    from {
      transform: translateY(16px);
      opacity: 0.6;
    }
    to {
      transform: none;
      opacity: 1;
    }
  }

  .toasts {
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 8px);
  }

  /* Appel sur téléphone : les commandes occupent deux rangées, la notification
   * se pose au-dessus de la grille. */
  body.in-call .toasts {
    bottom: calc(200px + env(safe-area-inset-bottom));
  }

  /* Appel : une seule vignette à la fois, en pleine hauteur. */
  .call-head {
    padding: calc(12px + env(safe-area-inset-top)) 16px 6px;
  }

  .call-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: minmax(140px, 1fr);
    gap: 8px;
    padding: 8px 10px;
  }

  .call-grid.is-single {
    padding: 0;
    gap: 0;
    --pip-bottom: 10px;
    --pip-right: 10px;
  }

  .call-grid.is-single.pip-haut { --pip-top: 10px; --pip-bottom: auto; }
  .call-grid.is-single.pip-gauche { --pip-left: 10px; --pip-right: auto; }

  .call-grid.is-single .call-tile.is-pip {
    --pip-largeur: 116px;
    border-radius: 12px;
  }

  .call-grid.is-single .call-tile .avatar {
    width: 92px;
    height: 92px;
    font-size: 33px;
    border-radius: 50%;
  }

  .call-root--audio-solo .call-grid.is-single .call-tile .avatar {
    width: 172px;
    height: 172px;
    font-size: 62px;
  }

  .call-grid.is-single .call-tile.is-self .avatar {
    width: 44px;
    height: 44px;
    font-size: 16px;
  }

  /*
   * Appel sur téléphone : on profite de l'écran.
   *
   * La scène remplit déjà tout ; ce qui reste à gagner, c'est le médaillon   qui
   * masquait le correspondant sans qu'on puisse le pousser   et les barres de
   * commandes, qui mangeaient le haut et le bas en permanence.
   */
  .call-grid.is-single .call-tile.is-self {
    /* Le geste de déplacement ne doit pas devenir un défilement ou un zoom. */
    touch-action: none;
    cursor: grab;
    transition: box-shadow 0.15s ease;
  }

  .call-grid.is-single .call-tile.is-self.is-dragging {
    cursor: grabbing;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
  }

  /*
   * L'effacement des barres est **global** (voir `.controls-hidden` plus haut) :
   * il sert aussi bien au téléphone qu'à l'appel vidéo sur grand écran.
   */

  .call-tile {
    min-height: 120px;
  }

  .call-tile.is-self {
    min-height: 96px;
  }

  .call-actions {
    /*
     * Trois par rangée, et des **cercles**.
     *
     * La version précédente donnait à chaque bouton une base d'un tiers de
     * l'écran : la largeur suivait, la hauteur restait à 62 px, et les ronds
     * devenaient des ellipses. On ne touche donc plus à la largeur des boutons  
     * c'est le **conteneur** qui est borné à trois colonnes, et
     * `justify-content: center` centre chaque rangée pour elle-même, y compris
     * la dernière quand elle est incomplète.
     */
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px 22px;
    max-width: 250px;
    margin: 0 auto;
    padding: 12px 10px calc(20px + env(safe-area-inset-bottom));
  }

  .call-actions .call-btn {
    flex: none;
  }

  /*
   * Plus de `flex-basis: 100%` sur le raccrochage : il l'étirait en bandeau
   * rouge sur toute la largeur. Il tient sa propre rangée de lui-même   il est
   * seul, et `justify-content: center` le centre.
   */
  .call-btn--hangup {
    flex: none;
  }

  .call-btn {
    width: 62px;
    height: 62px;
  }

  /* Onboarding : la carte occupe l'écran, plus de défilement horizontal. */
  .onboarding {
    padding: calc(16px + env(safe-area-inset-top)) 12px calc(16px + env(safe-area-inset-bottom));
    align-items: flex-start;
    overflow-y: auto;
  }

  .onboarding__card {
    width: 100%;
    max-width: none;
    border-radius: 16px;
    padding: 18px 16px;
  }

  .avatar-picker {
    gap: 8px;
  }
}

@media (max-width: 620px) {
  .rail__btn,
  .rail__me {
    width: 38px;
    height: 38px;
  }

  .bubble img.attach-img {
    max-width: 220px;
    max-height: 260px;
  }
}

/* Appareils tactiles : pas de surbrillance bleue au tap. */
@media (hover: none) {
  * {
    -webkit-tap-highlight-color: transparent;
  }

  .icon-btn:hover,
  .rail__btn:hover,
  .row:hover {
    background: none;
  }
}

/*
 * `touch-action: manipulation` supprime le délai de 300 ms que le navigateur
 * impose avant de valider un appui (il attend un éventuel double appui de
 * zoom). Sur une messagerie, ce délai se ressent sur chaque bouton.
 */
button,
.row,
.tabbar__btn,
.rail__btn,
.chat__back,
.icon-btn,
.send-btn,
.settings-switch,
.reaction,
.scroll-down {
  touch-action: manipulation;
}

/*
 * Le corps ne doit jamais rebondir : le seul défilement légitime est celui du
 * fil et des listes. Sans cela, tirer vers le bas sur un téléphone déclenchait
 * le rafraîchissement de la page en pleine lecture.
 */
body {
  overscroll-behavior: none;
}

/*
 * Barres de défilement : fines mais **toujours lisibles**. Une zone qui défile
 * sans barre visible est une zone dont on ne devine pas qu'elle cache du
 * contenu   c'est précisément ce qui faisait disparaître les dernières lignes
 * des réglages.
 *
 * Chromium et Firefox s'excluent mutuellement : définir `scrollbar-width`
 * ferait ignorer les pseudo-éléments `::-webkit-scrollbar`, on réserve donc la
 * version standard aux moteurs qui ne connaissent pas ces derniers.
 */
@supports not selector(::-webkit-scrollbar) {
  * {
    scrollbar-width: thin;
    scrollbar-color: rgba(140, 140, 140, 0.55) transparent;
  }
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: rgba(140, 140, 140, 0.5);
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(120, 120, 120, 0.75);
  background-clip: padding-box;
}

::-webkit-scrollbar-track {
  background: transparent;
}

[data-theme='dark'] ::-webkit-scrollbar-thumb {
  background: rgba(200, 200, 200, 0.28);
  background-clip: padding-box;
}

[data-theme='dark'] ::-webkit-scrollbar-thumb:hover {
  background: rgba(200, 200, 200, 0.45);
  background-clip: padding-box;
}

/* --------------------------- Taille du texte ------------------------------ */

/*
 *  0chelle typographique choisie dans *Réglages    Apparence*.
 *
 * Elle ne s'applique qu'aux textes **lus** : bulles, listes, en-tête de
 * conversation, saisie et réglages. Un `zoom` global aurait été plus court,
 * mais il agrandirait aussi les hauteurs calculées du fil et de la zone de
 * saisie   c'est exactement ce qui avait cassé la mise en page des longues
 * conversations.
 *
 * Ce bloc est volontairement en fin de feuille : les media queries mobiles
 * fixent ces mêmes tailles en pixels, et l'échelle doit primer sur elles.
 */
:root {
  --text-scale: 1;
}

.bubble {
  font-size: calc(14.5px * var(--text-scale));
}

.row__title {
  font-size: calc(14px * var(--text-scale));
}

.row__sub {
  font-size: calc(12.5px * var(--text-scale));
}

.chat__title strong {
  font-size: calc(15px * var(--text-scale));
}

.chat__title small {
  font-size: calc(12px * var(--text-scale));
}

.msg__sender {
  font-size: calc(11.5px * var(--text-scale));
}

.msg__foot {
  font-size: calc(11px * var(--text-scale));
}

.composer textarea {
  font-size: calc(14.5px * var(--text-scale));
}

.settings-item__label {
  font-size: calc(14.5px * var(--text-scale));
}

@media (max-width: 820px) {
  .bubble {
    font-size: calc(15.5px * var(--text-scale));
  }

  .row__title {
    font-size: calc(15.5px * var(--text-scale));
  }

  .row__sub {
    font-size: calc(13.5px * var(--text-scale));
  }

  .settings-item__label {
    font-size: calc(15.5px * var(--text-scale));
  }

  /*
   * Les champs de saisie gardent 16 px au minimum : en dessous, Safari sur iOS
   * zoome automatiquement sur le champ actif   un zoom qui déplace toute la
   * mise en page et donne l'impression que l'application saute.
   */
  .composer textarea,
  .settings-search input,
  .search input {
    font-size: max(16px, calc(15px * var(--text-scale)));
  }
}

/* -------------------------- Fond de conversation -------------------------- */

/*
 * Motifs du fond de conversation, choisis dans *Réglages    Apparence*.
 * `--chat-bg-image` était déclarée depuis l'origine sans jamais être
 * consommée : elle l'est maintenant, et les couleurs suivent le thème puisque
 * c'est le CSS qui les connaît.
 */
.chat-pane {
  background-color: var(--chat-bg);
  background-image: var(--chat-bg-image);
  background-size: var(--chat-bg-size, auto);
}

[data-chatbg='dots'] {
  --chat-bg-image: radial-gradient(rgba(0, 0, 0, 0.09) 1px, transparent 1px);
  --chat-bg-size: 16px 16px;
}

[data-theme='dark'][data-chatbg='dots'] {
  --chat-bg-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px);
}

[data-chatbg='grid'] {
  --chat-bg-image: linear-gradient(rgba(0, 0, 0, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.06) 1px, transparent 1px);
  --chat-bg-size: 22px 22px;
}

[data-theme='dark'][data-chatbg='grid'] {
  --chat-bg-image: linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
}

[data-chatbg='waves'] {
  --chat-bg-image: repeating-linear-gradient(
    -45deg,
    rgba(0, 0, 0, 0.045) 0 8px,
    transparent 8px 20px
  );
  --chat-bg-size: auto;
}

[data-theme='dark'][data-chatbg='waves'] {
  --chat-bg-image: repeating-linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.035) 0 8px,
    transparent 8px 20px
  );
}

/* ------------------------------------------------------------------ */


/* ------------------------------------------------------------------ */
/* Appel replié en capsule (PiP)                                       */
/* ------------------------------------------------------------------ */
/*
 * Dans une capsule, il n'y a la place que pour **une** chose : l'image du
 * correspondant.
 *
 * Avant cette règle, la capsule recevait l'écran d'appel entier, rétréci :
 * en-tête, état, sept boutons   et, par-dessus le correspondant, l'aperçu de sa
 * propre caméra, un médaillon de 168 px de large dans une fenêtre qui en fait
 * environ 135. Ce que l'utilisateur voyait dans la capsule, c'était donc
 * **lui-même**, et non la personne à qui il parlait.
 *
 * Ce que fait cette règle, dans l'ordre d'importance :
 *   1. le correspondant occupe tout le cadre (`inset: 0`, sans grille ni marge) ;
 *   2. l'aperçu local disparaît   c'est lui qui masquait tout ;
 *   3. en-tête, boutons, sonnerie et déverrouillage du son s'effacent ;
 *   4. `object-fit: cover` remplit la fenêtre au lieu d'y laisser des bandes.
 *      Le format de la fenêtre suit celui du flux (voir `setPipAspectRatio`),
 *      donc le recadrage reste marginal.
 *
 * Le son, lui, ne dépend d'aucune de ces règles : les éléments média restent
 * branchés, seule leur présentation change.
 */
.call-root.call-root--capsule {
  background: #000;
  /* Aucune couche de l'application ne doit se glisser dans la capsule. */
  cursor: default;
}

.call-root--capsule .call-head,
.call-root--capsule .call-actions,
.call-root--capsule .call-ring,
.call-root--capsule .call-unlock,
.call-root--capsule .call-quality,
.call-root--capsule .call-mic,
.call-root--capsule .call-warning {
  display: none !important;
}

/* La grille devient la fenêtre elle-même : plus de colonnes, plus de marges. */
.call-root--capsule .call-grid {
  display: block;
  position: relative;
  inset: 0;
  padding: 0;
  margin: 0;
  gap: 0;
  overflow: hidden;
  min-height: 0;
}

/*
 * L'aperçu local est retiré du rendu : c'est lui qui recouvrait le correspondant.
 *
 * On ne masque **que** `.is-self` : si l'utilisateur avait échangé les deux
 * vidéos avant de replier, `.is-pip` désigne la vignette distante   la cacher
 * laisserait la capsule vide. Dans une capsule, le correspondant reprend le
 * cadre, quel que soit l'échange fait auparavant.
 */
.call-root--capsule .call-tile.is-self {
  /*
   * L'aperçu local n'est **pas** retiré : il devient un médaillon.
   *
   * La première version le masquait entièrement, en réponse à « la capsule
   * montre ma caméra au lieu du correspondant ». Mais le défaut n'était pas sa
   * présence, c'était sa taille : l'aperçu faisait 168 px dans une fenêtre de
   * 135 dp, donc il remplissait tout. Le correspondant reprend le cadre, et
   * l'aperçu se pose dessus, réduit (voir la règle `max-width: 200px`).
   */
  z-index: 3;
}

/*
 * Chaque vignette distante occupe le cadre entier. En maillage à trois ou plus,
 * la dernière vignette visible couvre les autres   cas rare dans une capsule de
 * 135 dp, et toujours préférable à une mosaïque illisible.
 */
.call-root--capsule .call-tile {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
  outline: none;
  transform: none;
  background: #000;
}

.call-root--capsule .call-tile__media,
.call-root--capsule .call-tile__media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 0;
}

/*
 * `cover` et non `contain` : dans une capsule, on veut l'image la plus grande
 * possible, et le format de la fenêtre suit déjà celui du flux   les bandes
 * noires n'ont donc plus de raison d'être. Le peu de recadrage qui reste est le
 * prix d'un visage lisible dans 135 dp.
 */
.call-root--capsule .call-tile:not(.is-self) .call-tile__media video {
  object-fit: cover;
}

/* Les étiquettes de nom mangeraient un tiers de la fenêtre : elles s'effacent. */
.call-root--capsule .call-tile__name,
.call-root--capsule .call-tile__flags {
  display: none !important;
}

/* Un appel sans image (audio) garde son avatar, centré et sans fond de vignette. */
.call-root--capsule .call-tile__placeholder {
  background: #000;
}

.call-root--capsule .call-tile .avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  font-size: 26px;
}

/* ------------------------------------------------------------------ */
/* Rappel d'escamotage des commandes d'appel                           */
/* ------------------------------------------------------------------ */
/*
 * Les commandes s'effacent après quatre secondes ; sans un mot, l'écran d'appel
 * paraît n'avoir aucun bouton   et l'on cherche alors un raccrochage qu'on croit
 * perdu. Ce rappel occupe sa propre ligne sous la barre, une seule fois par
 * appel, et s'efface avec les commandes qu'il décrit.
 */
.call-actions .call-hint {
  flex-basis: 100%;
  text-align: center;
  font-size: 12.5px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.62);
  padding-top: 2px;
  pointer-events: none;
}

/* ------------------------------------------------------------------ */
/* «  0crire » pendant l'appel   hors de la barre escamotable           */
/* ------------------------------------------------------------------ */
/*
 * La barre de commandes s'escamote après quatre secondes : c'est voulu, elle
 * mangeait le haut et le bas de l'image. Mais le bouton « écrire » partait avec
 * elle, et l'on ne pouvait donc plus aller lire sa conversation sans d'abord
 * retrouver des boutons invisibles.
 *
 * La pastille vit donc **hors de l'en-tête et de la barre**, directement sous la
 * racine d'appel : aucune règle d'escamotage ne peut l'emporter, et elle reste
 * visible pendant tout l'appel, dans un coin que l'on ne regarde pas.
 */
.call-ecrire {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  backdrop-filter: blur(6px);
  /* Au-dessus de la scène et du médaillon : rien ne recouvre ce bouton. */
  z-index: 20;
}

.call-ecrire svg {
  width: 17px;
  height: 17px;
}

.call-ecrire:active {
  background: rgba(255, 255, 255, 0.3);
}

/* Pendant la sonnerie, on décroche ou on refuse : « Écrire » n'a pas d'objet. */
.call-root.is-ringing .call-ecrire {
  display: none;
}

/* En bandeau, la pastille n'a plus d'objet : le bandeau porte déjà ses boutons. */
.call-root.call-root--reduit .call-ecrire {
  display: none;
}

/* ------------------------------------------------------------------ */
/* Appel quitté pour écrire — la scène s'efface, la notice reste       */
/* ------------------------------------------------------------------ */
/*
 * L'appel continue, mais il rend l'écran : on veut pouvoir écrire à quelqu'un
 * pendant la conversation, ou consulter une discussion pour lire un numéro à
 * voix haute.
 *
 * Ce qui reste n'est **pas** une pastille flottante : c'est une ligne dans le
 * pied de page de la liste (voir `.call-notice` plus bas). Elle ne recouvre
 * aucun message, ne capte aucun appui hors d'elle-même, et reste visible quelle
 * que soit la discussion ouverte. La version précédente flottait par-dessus
 * l'interface et masquait les messages — c'est ce qui a été refusé.
 */
.call-root.call-root--reduit {
  /* La racine ne sert plus qu'à rendre l'écran : elle ne doit rien couvrir. */
  inset: auto 0 0 0;
  height: 0;
  background: transparent;
  pointer-events: none;
}

.call-root--reduit .call-grid,
.call-root--reduit .call-head,
.call-root--reduit .call-ring,
.call-root--reduit .call-actions {
  display: none !important;
}

/* ------------------------------------------------------------------ */
/* Notice d'appel, dans le pied de page de la liste                    */
/* ------------------------------------------------------------------ */
/*
 * Elle occupe sa ligne au-dessus de l'état de connexion — la `flex-wrap`
 * transforme le pied en colonne quand elle est présente — et prend les couleurs
 * du thème : vert de la marque, texte blanc.
 *
 * Un seul geste, « Revenir ». Pas de raccrocher ici : couper un appel depuis une
 * ligne d'état discrète, sans voir à qui l'on parle, serait une erreur d'un
 * appui.
 */
.call-notice {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-bottom: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--green, #07c160);
  color: #fff;
  font-size: 12.5px;
  text-align: left;
}

.list-pane__foot {
  flex-wrap: wrap;
}

.call-notice__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  flex: none;
  /* Un appel en cours doit se voir sans lire : le point pulse, doucement. */
  animation: call-notice-pulse 2s ease-in-out infinite;
}

@keyframes call-notice-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.call-notice__textes {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.call-notice__nom {
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.call-notice__etat {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.call-notice__revenir {
  flex: none;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  font-size: 11.5px;
  font-weight: 600;
}

.call-notice:active {
  filter: brightness(0.94);
}

/* Dans la capsule, il n'y a de place que pour l'image. */
.call-root.call-root--capsule .call-ecrire {
  display: none;
}

/* ------------------------------------------------------------------ */
/* Capsule, vue par la largeur   sans dépendre d'un événement natif    */
/* ------------------------------------------------------------------ */
/*
 * Le 18/10/2026, la capsule de ce téléphone mesurait `sw135dp` : 135 dp de
 * large. Aucun écran utilisable ne descend là   le plus petit téléphone du
 * marché en fait le triple. Une fenêtre aussi étroite **est** une capsule, et
 * n'en est pas une autre.
 *
 * Cette règle double donc le mode piloté par la classe `call-root--capsule` :
 * `onPictureInPictureModeChanged()` n'a pas été appelé lors des essais (aucune
 * trace, alors que la capsule était bien `mode=pinned`), et faire dépendre la
 * lisibilité de la fenêtre d'un rappel incertain, c'est accepter de livrer une
 * capsule illisible en silence.
 *
 * Ce que l'on applique est la même chose que le mode par classe : le
 * correspondant plein cadre, et rien d'autre. On ne masque **que** `.is-self`
 *   la vignette distante peut porter `.is-pip` si l'utilisateur a échangé les
 * deux vidéos.
 */
@media (max-width: 200px) {
  /*
   * La capsule : une fenêtre de ~135 dp de large.
   *
   * Deux vidéos, deux rôles, et deux règles qui ne partagent aucune propriété :
   *   • la vignette sans `.is-pip` occupe tout le cadre — c'est la scène ;
   *   • la vignette avec `.is-pip` est un médaillon de 30 % dans le coin.
   *
   * L'ordre des rôles n'est pas fixe : par défaut le médaillon porte l'aperçu
   * local, mais un appui sur le médaillon échange les deux vidéos. Les règles
   * précédentes ne visaient que `.is-self` et, après un échange, laissaient
   * l'application entière dans la capsule — défaut constaté en appel réel.
   *
   * Aucune interface ici : ni en-tête, ni boutons. La capsule ne montre que les
   * images.
   */
  .call-root .call-head,
  .call-root .call-actions,
  .call-root .call-ring,
  .call-root .call-unlock,
  .call-root .call-quality,
  .call-root .call-mic,
  .call-root .call-warning,
  .call-root .call-ecrire {
    display: none !important;
  }

  /* La racine occupe la fenêtre : la capsule n'a pas de mise en page à elle. */
  .call-root.call-root--reduit,
  .call-root {
    inset: 0 !important;
    height: 100% !important;
    background: #000;
    pointer-events: auto;
  }

  .call-root .call-grid {
    display: block !important;
    position: absolute !important;
    inset: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    min-height: 0 !important;
  }

  /* La scène : tout le cadre, sans bord ni marge. */
  .call-root .call-grid .call-tile:not(.is-pip) {
    position: absolute !important;
    inset: 0 !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    aspect-ratio: auto !important;
    max-height: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    outline: none !important;
    transform: none !important;
    background: #000;
    z-index: 1 !important;
  }

  /*
   * Le médaille : 30 % de la largeur, dans le coin inférieur droit.
   *
   * Il porte l'aperçu local par défaut, et le correspondant si l'utilisateur a
   * échangé les deux vidéos. On ne nomme donc **pas** la vignette : on vise le
   * rôle.
   */
  .call-root .call-grid .call-tile.is-pip {
    position: absolute !important;
    top: auto !important;
    right: 5px !important;
    bottom: 5px !important;
    left: auto !important;
    width: 30% !important;
    height: auto !important;
    aspect-ratio: 3 / 4 !important;
    max-height: 45% !important;
    min-height: 0 !important;
    border: 1px solid rgba(255, 255, 255, 0.55) !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    background: #111;
    z-index: 3 !important;
  }

  /* Les deux vidéos remplissent leur boîte ; la scène recadre, le médaille aussi. */
  .call-root .call-grid .call-tile__media,
  .call-root .call-grid .call-tile__media video {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: 0;
  }

  .call-root .call-grid .call-tile__media video {
    object-fit: cover !important;
  }

  /* Rien d'autre : ni nom, ni badges, ni avatar par-dessus l'image. */
  .call-root .call-grid .call-tile__name,
  .call-root .call-grid .call-tile__flags {
    display: none !important;
  }

  .call-root .call-grid .call-tile__placeholder {
    background: #000;
  }
}


/* ==========================================================================
   Fiche de profil — grand portrait, actions, mosaïque « Photos »
   ==========================================================================

   Composition reprise de la maquette fournie : le portrait est le point de
   fuite, le nom et l'identité tiennent sur trois lignes, quatre icônes ouvrent
   les actions, puis une mosaïque pleine largeur montre les photos réellement
   échangées. Les valeurs de couleur restent celles de Dowen (vert #07c160) et
   suivent le thème clair ou sombre via les variables existantes.
   ========================================================================== */

.modal--profile {
  width: min(560px, 100%);
  max-height: min(93vh, 940px);
  border-radius: 22px;
}

.modal--profile .modal__body {
  padding: 0;
  background: var(--panel);
  /*
   * Le profil d'un groupe peut dépasser la fenêtre (membres, sécurité). On
   * masque la barre de défilement pour que la mosaïque reste **pleine
   * largeur**, comme la maquette ; la molette et le doigt continuent de faire
   * défiler le contenu.
   */
  scrollbar-width: none;
}

.modal--profile .modal__body::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.profile-sheet {
  --profile-pad: 22px;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  background: var(--panel);
  color: var(--text);
}

.profile-grab {
  display: none;
}

/* ------------------------------- Héros ---------------------------------- */

.profile-hero {
  position: relative;
  padding: 2px var(--profile-pad) 18px;
  overflow: hidden;
  background:
    radial-gradient(430px 220px at 50% -40px, rgba(7, 193, 96, 0.09), transparent 72%),
    radial-gradient(300px 180px at 94% -10%, rgba(30, 144, 255, 0.06), transparent 74%),
    var(--panel);
}

.profile-top {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
}

.profile-top__gap {
  flex: 1;
}

.profile-iconbtn {
  width: 38px;
  height: 38px;
  margin-inline: -8px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--text);
  transition: background 0.15s, color 0.15s;
}

.profile-iconbtn svg {
  width: 20px;
  height: 20px;
}

.profile-iconbtn:hover {
  background: var(--panel-3);
}

.profile-avatar {
  position: relative;
  z-index: 1;
  width: 132px;
  height: 132px;
  margin: 7px auto 14px;
  display: grid;
  place-items: center;
}

/* Le disque bleu pâle de la maquette, dessiné derrière le portrait. */
.profile-avatar::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 188px;
  height: 188px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: linear-gradient(160deg, #edf5ff, #dcebff);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
  pointer-events: none;
}

.profile-avatar__slot {
  position: relative;
  z-index: 1;
  display: block;
  width: 132px;
  height: 132px;
  padding: 0;
  border-radius: 50%;
  cursor: default;
}

.profile-avatar__slot.is-photo {
  cursor: zoom-in;
}

.profile-avatar__slot:disabled {
  cursor: default;
}

.profile-avatar__slot:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

.profile-avatar__zoom {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.34);
  color: #fff;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}

.profile-avatar__zoom svg {
  width: 26px;
  height: 26px;
}

.profile-avatar__slot.is-photo:hover .profile-avatar__zoom,
.profile-avatar__slot.is-photo:focus-visible .profile-avatar__zoom {
  opacity: 1;
}

.avatar--profile {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  font-size: 38px;
  letter-spacing: 0.01em;
  box-shadow: 0 16px 36px rgba(22, 44, 74, 0.2), 0 2px 6px rgba(0, 0, 0, 0.06);
}

.profile-avatar__edit {
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 2px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  border: 3px solid var(--panel);
  box-shadow: 0 4px 14px rgba(7, 193, 96, 0.42);
  transition: transform 0.15s, background 0.15s;
}

.profile-avatar__edit svg {
  width: 15px;
  height: 15px;
}

.profile-avatar__edit:hover {
  transform: scale(1.07);
  background: var(--green-dark);
}

.profile-hero__name {
  position: relative;
  z-index: 1;
  /*
   * Le nom respire sous l'auréole. On utilise un *padding* et non une marge :
   * la marge du portrait (14 px) et celle du nom fusionnaient, et le nom
   * restait collé au bas du disque. 14 + 32 = 46 px, soit 18 px sous l'auréole
   * de 188 px — la deuxième passe demandée de 16 px.
   */
  margin: 0;
  padding-top: 32px;
  font-size: 28px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
  text-align: center;
}

.profile-hero__bio {
  position: relative;
  z-index: 1;
  max-width: 36ch;
  margin: 7px auto 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-soft);
  text-align: center;
}

.profile-meta {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 30px;
  margin-top: 13px;
}

.profile-id {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.045em;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.profile-id svg {
  width: 13px;
  height: 13px;
  color: var(--text-faint);
  transition: color 0.15s;
}

.profile-id:hover {
  border-color: var(--green);
  color: var(--green-dark);
}

.profile-id:hover svg {
  color: var(--green);
}

.profile-meta__dot {
  color: var(--text-faint);
}

.profile-hero__since {
  font-size: 12px;
  color: var(--text-meta);
}

/* ------------------------------ Actions --------------------------------- */

.profile-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: center;
  padding: 0 var(--profile-pad) 18px;
}

.profile-action {
  justify-self: center;
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--text);
  transition: background 0.15s, color 0.15s, transform 0.12s;
}

.profile-action svg {
  width: 25px;
  height: 25px;
}

.profile-action:hover {
  background: rgba(7, 193, 96, 0.1);
  color: var(--green-dark);
}

.profile-action:active {
  transform: scale(0.94);
}

/* ------------------------------- Photos --------------------------------- */

.profile-photos__head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px var(--profile-pad) 12px;
  color: var(--text);
  text-align: left;
}

.profile-photos__title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  transition: color 0.15s;
}

.profile-photos__head:hover:not(:disabled) .profile-photos__title {
  color: var(--green-dark);
}

.profile-photos__count {
  min-width: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--panel-3);
  color: var(--text-meta);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.profile-photos__chevron {
  width: 28px;
  height: 28px;
  margin-left: auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--text-soft);
  transition: background 0.15s, color 0.15s;
}

.profile-photos__chevron svg {
  width: 18px;
  height: 18px;
}

.profile-photos__head:hover:not(:disabled) .profile-photos__chevron {
  background: var(--panel-3);
  color: var(--text);
}

.profile-photos__head:disabled {
  cursor: default;
}

.profile-photos__head:disabled .profile-photos__title {
  color: var(--text-meta);
}

.profile-photos__head:disabled .profile-photos__chevron {
  opacity: 0.35;
}

/* La mosaïque est **pleine largeur**, comme dans la maquette. */
.profile-gallery-wrap {
  margin-inline: 0;
}

.profile-gallery {
  display: grid;
  grid-template-columns: 1.38fr 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 3px;
  aspect-ratio: 2.55 / 1;
  overflow: hidden;
  background: var(--panel-3);
}

.profile-gallery.is-1 {
  grid-template-columns: 1fr;
  /* Une seule photo : un bandeau large, pas une demi-fenêtre — mesuré, le
   * ratio 2:1 faisait déborder la note de bas de fiche sur un écran 820 px. */
  aspect-ratio: 2.6 / 1;
}

.profile-gallery.is-1 .photo-tile {
  grid-column: 1;
  grid-row: 1 / span 2;
}

/*
 * Trois et quatre photos : les colonnes latérales occupent les **deux** rangées.
 * Les placements sont explicites : laissée à l'auto-placement, la quatrième
 * vignette basculait dans une colonne implicite hors du cadre (mesuré : la
 * mosaïque débordait de 44 px et laissait un trou gris en bas à droite).
 */
.profile-gallery.is-2 {
  grid-template-columns: 1fr 1fr;
  aspect-ratio: 2.1 / 1;
}

.profile-gallery.is-2 .photo-tile:nth-child(1) {
  grid-column: 1;
  grid-row: 1 / span 2;
}

.profile-gallery.is-2 .photo-tile:nth-child(2) {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.profile-gallery.is-3 {
  grid-template-columns: 1.4fr 1fr;
  grid-template-rows: 1fr 1fr;
  aspect-ratio: 2.1 / 1;
}

.profile-gallery.is-3 .photo-tile:nth-child(1) {
  grid-column: 1;
  grid-row: 1 / span 2;
}

.profile-gallery.is-3 .photo-tile:nth-child(2) {
  grid-column: 2;
  grid-row: 1;
}

.profile-gallery.is-3 .photo-tile:nth-child(3) {
  grid-column: 2;
  grid-row: 2;
}

.profile-gallery.is-4 .photo-tile:nth-child(1) {
  grid-column: 1;
  grid-row: 1 / span 2;
}

.profile-gallery.is-4 .photo-tile:nth-child(2) {
  grid-column: 2;
  grid-row: 1;
}

.profile-gallery.is-4 .photo-tile:nth-child(3) {
  grid-column: 2;
  grid-row: 2;
}

.profile-gallery.is-4 .photo-tile:nth-child(4) {
  grid-column: 3;
  grid-row: 1 / span 2;
}

.photo-tile {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--panel-3);
  color: var(--text-faint);
}

.photo-tile__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.03);
  transition: opacity 0.25s ease, transform 0.35s ease;
}

.photo-tile__img.is-ready {
  opacity: 1;
  transform: none;
}

.photo-tile:hover .photo-tile__img.is-ready {
  transform: scale(1.035);
}

.photo-tile__placeholder {
  width: 26px;
  height: 26px;
}

.photo-tile::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, 0.16));
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.photo-tile:hover::after {
  opacity: 1;
}

.photo-tile__more {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 1;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(8, 18, 14, 0.58);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.02em;
  backdrop-filter: blur(6px);
}

.profile-gallery__empty {
  margin: 0 var(--profile-pad);
  padding: 26px 18px;
  border: 1px dashed var(--border);
  border-radius: 16px;
  background: var(--panel-2);
  color: var(--text-soft);
  text-align: center;
}

.profile-gallery__empty-icon {
  display: grid;
  place-items: center;
  margin-bottom: 8px;
  color: var(--text-faint);
}

.profile-gallery__empty-icon svg {
  width: 30px;
  height: 30px;
}

.profile-gallery__empty p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
}

.profile-foot {
  padding: 16px var(--profile-pad) 18px;
}

.profile-note {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin: 0;
  color: var(--text-meta);
  font-size: 11.5px;
  line-height: 1.55;
}

.profile-note__icon {
  flex: none;
  margin-top: 1px;
  color: var(--green);
}

.profile-note__icon svg {
  width: 15px;
  height: 15px;
}

/* -------------------------- Informations / contact ----------------------- */

.profile-body--view {
  padding-bottom: 22px;
}

.profile-note--view {
  margin-top: 18px;
}

.profile-info {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel-2);
}

.profile-info__row {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 12px 14px;
  color: var(--text);
  text-align: left;
}

.profile-info__row + .profile-info__row {
  border-top: 1px solid var(--border);
}

.profile-info__row.is-action {
  transition: background 0.15s;
}

.profile-info__row.is-action:hover {
  background: var(--hover);
}

.profile-info__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel);
  color: var(--text-soft);
}

.profile-info__icon svg {
  width: 16px;
  height: 16px;
}

.profile-info__label {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--text-soft);
}

.profile-info__value {
  max-width: 55%;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  text-align: right;
}

.profile-info__chevron {
  display: grid;
  place-items: center;
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--text-faint);
}

.profile-info__chevron svg {
  width: 15px;
  height: 15px;
}

.profile-contact__status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 9px 0 0;
  color: var(--text-soft);
  font-size: 12.5px;
}

.profile-group__meta {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 7px 0 0;
  color: var(--text-soft);
  font-size: 13px;
}

.profile-id--static {
  cursor: default;
}

.profile-id--static:hover {
  border-color: var(--border);
  color: var(--text);
}

.profile-id--static:hover svg {
  color: var(--text-soft);
}

.profile-section__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.profile-section__head .profile-section__title {
  margin: 0;
}

.profile-section__count {
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--panel-3);
  color: var(--text-meta);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.profile-section__action {
  width: 28px;
  height: 28px;
  margin-left: auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--text-soft);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.profile-section__action svg {
  width: 15px;
  height: 15px;
}

.profile-section__action:hover {
  background: var(--panel);
  border-color: var(--green);
  color: var(--green-dark);
}

.profile-members {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel-2);
}

.profile-member {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}

.profile-member + .profile-member {
  border-top: 1px solid var(--border);
}

.profile-member .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 13px;
}

.profile-member__body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}

.profile-member__name {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.profile-member__name > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-member__badge {
  flex: none;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(7, 193, 96, 0.12);
  color: var(--green-dark);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.profile-member__id {
  overflow: hidden;
  color: var(--text-meta);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-member__remove {
  width: 28px;
  height: 28px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--text-faint);
  transition: background 0.15s, color 0.15s;
}

.profile-member__remove svg {
  width: 15px;
  height: 15px;
}

.profile-member__remove:hover {
  background: rgba(230, 67, 64, 0.12);
  color: var(--danger);
}

.profile-safety-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
}

.profile-safety__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--text-soft);
  font-size: 12px;
}

.profile-safety__head strong {
  overflow: hidden;
  color: var(--text);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-safety__head span {
  flex: none;
  color: var(--text-meta);
  font-size: 11px;
}

.profile-status-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--text-faint);
}

.profile-status-dot.is-online {
  background: var(--green);
}

.profile-avatar__presence {
  position: absolute;
  right: 4px;
  bottom: 4px;
  z-index: 2;
  width: 18px;
  height: 18px;
  border: 3px solid var(--panel);
  border-radius: 50%;
  background: var(--text-faint);
}

.profile-avatar__presence.is-online {
  background: var(--green);
}

.profile-safety {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel-2);
}

.profile-safety__hint {
  margin: 10px 0 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.6;
}

/*
 * Fiche correspondant : même composition, mais l'ensemble tient dans la
 * fenêtre sur un écran 900 px. Mesuré à 58 px de trop avec les espacements du
 * profil personnel : on resserre la mosaïque et les cartes, pas le portrait.
 */
.modal--profile--contact .profile-hero {
  padding-bottom: 8px;
}

.modal--profile--contact .profile-avatar {
  margin-top: 5px;
  margin-bottom: 10px;
}

.modal--profile--contact .profile-actions {
  padding-bottom: 8px;
}

.modal--profile--contact .profile-gallery {
  aspect-ratio: 3.2 / 1;
}

.modal--profile--contact .profile-section {
  margin-top: 10px;
}

.modal--profile--contact .profile-info__row {
  padding: 8px 14px;
}

.modal--profile--contact .profile-safety {
  padding: 10px;
}

/* ------------------------------- Édition -------------------------------- */

.profile-body {
  padding: 4px var(--profile-pad) 10px;
}

.profile-section {
  margin-top: 18px;
}

.profile-section:first-child {
  margin-top: 4px;
}

.profile-section__title {
  margin: 0 0 10px 2px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.field--profile {
  margin-bottom: 14px;
}

.field--profile:last-child {
  margin-bottom: 0;
}

.field--profile > span {
  margin: 0 0 6px 2px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
}

.field--profile input[type='text'] {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-2);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.field--profile input[type='text']:focus {
  border-color: var(--green);
  background: var(--panel);
  box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.12);
}

.profile-edit .profile-note {
  margin-top: 18px;
}

.profile-savebar {
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px var(--profile-pad) 14px;
  border-top: 1px solid var(--border);
  background: var(--panel);
}

/* --------------------------- Sélecteur d'avatar -------------------------- */

.avatar-crop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.crop-stage {
  position: relative;
  width: 300px;
  max-width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  background: #111;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.crop-stage.is-dragging {
  cursor: grabbing;
}

.crop-stage:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

.crop-stage::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55);
  pointer-events: none;
}

.crop-image {
  position: absolute;
  left: 50%;
  top: 50%;
  max-width: none;
  transform: translate(-50%, -50%);
  pointer-events: none;
  user-select: none;
}

.crop-loader {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--panel-3);
  color: var(--text-soft);
  font-size: 12.5px;
  text-align: center;
}

.crop-hint {
  max-width: 38ch;
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.55;
  text-align: center;
}

.crop-warning,
.profile-quality {
  margin: 0;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(240, 160, 32, 0.12);
  color: var(--warn);
  font-size: 11.5px;
  line-height: 1.45;
  text-align: center;
}

.profile-quality {
  margin: 8px 2px 0;
  text-align: left;
}

.profile-quality-link {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 6px;
  margin: 10px auto 0;
  padding: 5px 11px;
  border: 1px solid rgba(240, 160, 32, 0.3);
  border-radius: 999px;
  background: rgba(240, 160, 32, 0.12);
  color: var(--warn);
  font-size: 11.5px;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s;
}

.profile-quality-link:hover {
  background: rgba(240, 160, 32, 0.2);
  border-color: rgba(240, 160, 32, 0.5);
}

.crop-zoom {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 340px;
}

.crop-zoom__icon {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--text-meta);
}

.crop-zoom__slider {
  flex: 1;
  accent-color: var(--green);
}

.crop-zoom__value {
  min-width: 48px;
  color: var(--text-meta);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.avatar-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.avatar-photo {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.avatar-photo svg {
  width: 16px;
  height: 16px;
  color: var(--text-soft);
}

.avatar-photo:hover {
  border-color: var(--green);
  background: var(--panel);
  color: var(--green-dark);
}

.avatar-photo__thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-palette {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
}

.swatch {
  position: relative;
  width: 32px;
  height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  transition: transform 0.15s, box-shadow 0.15s;
}

.swatch:hover {
  transform: scale(1.08);
}

.swatch.is-active {
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--green);
}

.swatch__check {
  width: 15px;
  height: 15px;
  color: #fff;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}

/* --------------------------- Galerie complète ---------------------------- */

.photo-gallery {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.photo-gallery__count {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-meta);
}

.photo-gallery__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 36px 18px;
  color: var(--text-soft);
  font-size: 13px;
  text-align: center;
}

.photo-gallery__empty svg {
  width: 30px;
  height: 30px;
  color: var(--text-faint);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}

.photo-grid .photo-tile {
  aspect-ratio: 1;
  border-radius: 8px;
}

/* --------------------------- Carte des réglages -------------------------- */

.settings-card {
  border: 1px solid var(--border);
}

.settings-profile {
  position: relative;
  overflow: hidden;
  gap: 14px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background:
    radial-gradient(300px 130px at 0% 0%, rgba(7, 193, 96, 0.12), transparent 72%),
    radial-gradient(220px 120px at 100% 10%, rgba(30, 144, 255, 0.08), transparent 72%),
    var(--panel);
  box-shadow: none;
}

.settings-profile:hover {
  background:
    radial-gradient(300px 130px at 0% 0%, rgba(7, 193, 96, 0.16), transparent 72%),
    radial-gradient(220px 120px at 100% 10%, rgba(30, 144, 255, 0.1), transparent 72%),
    var(--panel-2);
  border-color: rgba(7, 193, 96, 0.38);
}

.settings-profile__photo {
  position: relative;
  flex: none;
  width: 58px;
  height: 58px;
}

.settings-profile__photo .avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 2px solid var(--panel);
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.settings-profile__badge {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--panel);
  background: var(--green);
  color: #fff;
}

.settings-profile__badge svg {
  width: 11px;
  height: 11px;
}

.settings-profile__body,
.settings-profile__cta {
  position: relative;
  z-index: 1;
}

.settings-profile__cta {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--panel);
  color: var(--text-soft);
}

.settings-profile__cta svg {
  width: 17px;
  height: 17px;
}

/* ------------------------------- Thème sombre --------------------------- */

[data-theme='dark'] .profile-hero {
  background:
    radial-gradient(430px 220px at 50% -40px, rgba(7, 193, 96, 0.16), transparent 72%),
    radial-gradient(300px 180px at 94% -10%, rgba(30, 144, 255, 0.12), transparent 74%),
    var(--panel);
}

[data-theme='dark'] .profile-avatar::before {
  background: linear-gradient(160deg, rgba(30, 144, 255, 0.2), rgba(7, 193, 96, 0.08));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

[data-theme='dark'] .avatar--profile {
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.3);
}

[data-theme='dark'] .profile-id:hover,
[data-theme='dark'] .profile-action:hover,
[data-theme='dark'] .profile-photos__head:hover:not(:disabled) .profile-photos__title,
[data-theme='dark'] .avatar-photo:hover {
  color: var(--green);
}

[data-theme='dark'] .settings-profile {
  background:
    radial-gradient(300px 130px at 0% 0%, rgba(7, 193, 96, 0.18), transparent 72%),
    radial-gradient(220px 120px at 100% 10%, rgba(30, 144, 255, 0.12), transparent 72%),
    var(--panel);
}

[data-theme='dark'] .settings-profile:hover {
  background:
    radial-gradient(300px 130px at 0% 0%, rgba(7, 193, 96, 0.24), transparent 72%),
    radial-gradient(220px 120px at 100% 10%, rgba(30, 144, 255, 0.16), transparent 72%),
    var(--panel-2);
}

/* ----------------------------- Adaptations ------------------------------ */

@media (max-width: 820px) {
  .modal--profile {
    width: 100%;
    max-width: none;
    max-height: 94dvh;
    border-radius: 24px 24px 0 0;
  }

  .profile-grab {
    display: block;
    width: 40px;
    height: 4px;
    margin: 9px auto 0;
    border-radius: 999px;
    background: var(--border);
  }

  .profile-savebar {
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 620px) {
  .profile-sheet {
    --profile-pad: 18px;
  }

  .profile-top {
    min-height: 42px;
  }

  .profile-avatar {
    width: 112px;
    height: 112px;
    margin-top: 4px;
  }

  .profile-avatar::before {
    width: 168px;
    height: 168px;
  }

  .profile-avatar__slot {
    width: 112px;
    height: 112px;
  }

  .avatar--profile {
    width: 112px;
    height: 112px;
    font-size: 32px;
  }

  .profile-hero__name {
    font-size: 25px;
  }

  .profile-actions {
    padding-bottom: 14px;
  }

  .profile-action {
    width: 44px;
    height: 44px;
  }

  .profile-action svg {
    width: 22px;
    height: 22px;
  }

  .profile-photos__head {
    padding-top: 10px;
  }

  .profile-gallery {
    aspect-ratio: 2.2 / 1;
  }

  .modal--profile--contact .profile-gallery {
    aspect-ratio: 2.2 / 1;
  }

  .profile-section__action {
    width: 36px;
    height: 36px;
  }

  .profile-member {
    padding: 9px 10px;
  }

  .profile-member .avatar {
    width: 34px;
    height: 34px;
  }

  .profile-member__remove {
    width: 36px;
    height: 36px;
  }

  .photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Un anneau de focus homogène : ces commandes sont des icônes, sans relief. */
.profile-iconbtn:focus-visible,
.profile-id:focus-visible,
.profile-action:focus-visible,
.profile-photos__head:focus-visible,
.photo-tile:focus-visible,
.swatch:focus-visible,
.avatar-photo:focus-visible,
.settings-profile:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------ */
/* Appel mobile : la video prend la place du chrome                    */
/* ------------------------------------------------------------------ */
/*
 * Sur telephone, empiler un en-tete de trois lignes et deux rangees de
 * commandes au-dessus et au-dessous de l'image lui laissait 54 % de la
 * hauteur. Le chrome passe donc en surimpression : la video occupe tout
 * l'ecran, et les bandes que le 9:16 laisse en haut et en bas passent sous
 * l'en-tete et sous la barre.
 *
 * Rien ne change sur ordinateur, ou la place ne manque pas.
 */
@media (max-width: 820px) {
  .call-root {
    overflow: hidden;
  }

  .call-grid {
    position: absolute;
    inset: 0;
    z-index: 1;
    padding: 0;
  }

  /* Groupe : deux colonnes, et les tuiles ne passent pas sous le chrome. */
  .call-grid:not(.is-single) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: minmax(120px, 1fr);
    padding: calc(96px + env(safe-area-inset-top)) 10px calc(112px + env(safe-area-inset-bottom));
  }

  /* Capsule native : une fenêtre de quelques dizaines de pixels, sans marge. */
  .call-root--capsule .call-grid:not(.is-single) {
    padding: 0;
  }

  /*
   * Groupe replié : l'aperçu local devient un médaillon flottant.
   *
   * On réutilise la tuile `.is-self` (son `<video>` est déjà branché sur le
   * flux local) : aucun second élément média, et la caméra continue d'émettre.
   * Le médaillon se pose en haut à gauche (les pastilles d'état sont en haut à
   * droite et les noms en bas à gauche, donc il ne les recouvre pas) ; la tuile
   * « +N » occupe le coin inférieur droit.
   */
  .call-grid.is-groupe-replie .call-tile.is-self {
    position: absolute;
    /* Décalé du coin de la tuile : il doit se lire comme un médaillon posé
     * par-dessus, pas comme un encart aligné sur la grille. */
    top: calc(104px + env(safe-area-inset-top));
    left: 8px;
    right: auto;
    bottom: auto;
    width: 88px;
    height: auto;
    /* Format fixe : un médaillon 9:16 serait trop haut dans une tuile 2x2. */
    aspect-ratio: 3 / 4;
    min-height: 0;
    border: 2px solid rgba(255, 255, 255, 0.78);
    border-radius: 14px;
    /* Le liseré vert est déjà porté par `.call-tile.is-self` (outline). */
    box-shadow:
      0 12px 36px rgba(0, 0, 0, 0.8),
      0 0 0 2px rgba(7, 193, 96, 0.35);
    overflow: hidden;
    z-index: 3;
    background: #000;
  }

  .call-grid.is-groupe-replie .call-tile.is-self .call-tile__name {
    left: 6px;
    bottom: 6px;
    padding: 2px 7px;
    font-size: 10px;
  }

  .call-grid.is-groupe-replie .call-tile.is-self .avatar {
    width: 48px;
    height: 48px;
    font-size: 18px;
  }

  .call-head {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 108px;
    grid-template-areas:
      'title quality pill'
      'status status status'
      'mic mic mic'
      'warning warning warning';
    align-items: center;
    gap: 2px 10px;
    padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0.5) 58%, transparent);
    text-align: left;
  }

  .call-head .call-name {
    grid-area: title;
    display: flex;
    align-items: baseline;
    gap: 7px;
    min-width: 0;
    min-height: 36px;
    font-size: 17px;
    line-height: 36px;
    white-space: nowrap;
  }

  .call-head .call-name__text {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .call-head .call-duration {
    flex: none;
    margin-left: 0;
  }

  .call-head .call-status {
    grid-area: status;
    min-width: 0;
    margin: 0;
    font-size: 12.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .call-head .call-quality {
    grid-area: quality;
    display: flex;
    flex-wrap: nowrap;
    justify-self: end;
    gap: 5px;
    margin: 0;
    padding: 5px 9px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    background: rgba(8, 8, 10, 0.5);
    color: #fff;
    font-size: 12px;
    line-height: 1.2;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }

  .call-head .call-quality__label {
    font-weight: 600;
  }

  .call-head .call-quality__chevron {
    width: 14px;
    height: 14px;
    margin-left: 1px;
    opacity: 0.7;
  }

  /* Le niveau du micro vit dans l'anneau du bouton, plus dans l'en-tete. */
  .call-head .call-mic {
    display: none;
  }

  .call-head .call-warning {
    grid-area: warning;
    justify-self: start;
    max-width: 100%;
    margin: 6px 0 0;
  }

  .call-actions {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 6;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 24px 12px calc(12px + env(safe-area-inset-bottom));
    background: linear-gradient(to top, rgba(0, 0, 0, 0.86), rgba(0, 0, 0, 0.55) 58%, transparent);
  }

  .call-actions .call-btn {
    flex: none;
    width: 58px;
    height: 58px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }

  /* Les deux boutons de sonnerie gardent leur couleur pleine. */
  .call-actions .call-btn:not(.call-btn--accept):not(.call-btn--hangup) {
    background: rgba(10, 10, 12, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.18);
  }

  .call-actions .call-btn svg {
    width: 24px;
    height: 24px;
  }

  .call-actions .call-btn.is-off:not(.call-btn--accept):not(.call-btn--hangup) {
    background: #fff;
    border-color: transparent;
    color: #111;
  }

  .call-actions .call-btn.is-active:not(.call-btn--accept):not(.call-btn--hangup) {
    background: var(--green);
    border-color: transparent;
    color: #fff;
  }

  /*
   * Le bouton micro porte le niveau : un anneau qui s'allume avec la voix.
   * Le vumetre de l'en-tete mesurait la meme chose, sur une ligne de plus.
   */
  .call-actions .call-btn[data-mic] {
    position: relative;
  }

  .call-actions .call-btn[data-mic]::after {
    content: '';
    position: absolute;
    inset: -5px;
    border: 2px solid rgba(7, 193, 96, calc(0.12 + var(--niveau-micro, 0) * 0.88));
    border-radius: 50%;
    transform: scale(calc(1 + var(--niveau-micro, 0) * 0.1));
    transition: border-color 0.08s linear, transform 0.08s linear;
    pointer-events: none;
  }

  .call-actions .call-btn[data-mic].is-off::after {
    display: none;
  }

  .call-actions .call-btn--hangup {
    border-color: transparent;
  }

  .call-root.is-ringing .call-actions {
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }

  .call-ecrire {
    top: calc(10px + env(safe-area-inset-top));
  }

  .call-unlock {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: calc(112px + env(safe-area-inset-bottom));
    z-index: 8;
    width: fit-content;
    max-width: calc(100% - 24px);
    margin: 0 auto;
  }

  .call-audio-note {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: calc(112px + env(safe-area-inset-bottom));
    z-index: 4;
    width: fit-content;
    max-width: calc(100% - 32px);
    margin: 0 auto;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.45);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }

  /* Le medaillon se pose au-dessus de la barre, jamais dessous. */
  .call-grid.is-single {
    --pip-bottom: calc(106px + env(safe-area-inset-bottom));
  }

  .call-grid.is-single.pip-haut {
    --pip-top: calc(96px + env(safe-area-inset-top));
  }

  /*
   * En tete-a-tete, le nom du correspondant est deja dans l'en-tete ; la
   * pastille de la vignette faisait doublon. Sur ordinateur, on la garde :
   * quand les commandes s'escamotent, c'est le seul nom qui reste.
   */
  .call-grid.is-single .call-tile:not(.is-self) .call-tile__name {
    display: none;
  }

  /* Les pastilles d'etat passent sous l'en-tete, sinon elles disparaissent. */
  .call-grid.is-single .call-tile__flags {
    top: calc(100px + env(safe-area-inset-top));
    right: 12px;
  }

  /* La puce de l'en-tete porte deja la qualite : pas deux fois. */
  .call-grid.is-single .call-tile__flags .call-flag--quality {
    display: none;
  }

  .call-root--reduit .call-unlock,
  .call-root--reduit .call-audio-note {
    display: none !important;
  }

  /* La capsule ne montre que l'image : le filigrane de chiffrement y est illisible. */
  .call-root--capsule .call-audio-note {
    display: none !important;
  }

  /*
   * Les trois barres de la puce suivaient la couleur du niveau, pas son
   * remplissage : toutes restaient a 35 % d'opacite. Une barre par palier.
   */
  .call-quality.is-l1 .call-quality__bars i:nth-child(1),
  .call-quality.is-l2 .call-quality__bars i:nth-child(-n + 2),
  .call-quality.is-l3 .call-quality__bars i {
    opacity: 1;
  }
}

/* Capsule vue par la largeur : le filigrane n'a pas sa place dans 135 dp. */
@media (max-width: 200px) {
  .call-root .call-audio-note {
    display: none !important;
  }
}

/* Telephone etroit : cinq cibles de 52 px tiennent encore. */
@media (max-width: 360px) {
  .call-actions {
    gap: 8px;
  }

  .call-actions .call-btn {
    width: 52px;
    height: 52px;
  }

  .call-actions .call-btn svg {
    width: 22px;
    height: 22px;
  }

  .call-actions .call-btn.call-btn--annuler {
    width: auto;
    min-width: 84px;
    padding: 0 10px;
    gap: 5px;
    font-size: 12px;
  }
}

/*
 * La puce qualite est un bouton : on neutralise le style natif sans ecraser
 * la taille de la ligne desktop (12 px).
 */
button.call-quality {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  /* Un bouton se réduit à son contenu : sans marges auto, la ligne de qualité
   * se collait à gauche de l'en-tête desktop. */
  margin-left: auto;
  margin-right: auto;
  color: inherit;
  font-family: inherit;
  font-size: 12px;
  font-weight: inherit;
  line-height: 1.2;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button.call-quality:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
  border-radius: 999px;
}

/* Detail de la qualite, ouvert par la puce. */
.call-details {
  display: grid;
  gap: 10px;
}

.call-detail {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  font-size: 14px;
}

.call-detail__label {
  color: var(--text-soft);
}

.call-detail__value {
  font-weight: 600;
  text-align: right;
}

.call-details__note {
  margin: 4px 0 0;
  color: var(--text-soft);
  font-size: 12.5px;
  line-height: 1.5;
}

/* ------------------------- Sélection multiple ------------------------- */

/* La barre de sélection vit au-dessus du pied de page : l'état de connexion et
   l'appel en cours restent visibles, et le bouton de création disparaît. */
.selection-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: var(--panel-2);
}

.selection-bar__all {
  margin-right: auto;
  padding: 8px 4px;
  background: none;
  border: 0;
  color: var(--green);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.selection-bar__all:disabled {
  color: var(--text-faint);
  cursor: default;
}

.selection-bar__delete {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.selection-bar__delete svg {
  width: 17px;
  height: 17px;
}

.selection-bar__delete:disabled {
  opacity: 0.55;
  cursor: default;
}

/* Le bouton de création n'a plus de sens pendant une suppression. */
#app.is-selection #btn-compose {
  display: none;
}

/* La case de sélection est dessinée à gauche de l'avatar ; la ligne cochée
   prend la teinte verte, y compris au survol. */
.row__check {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border: 2px solid var(--border);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: transparent;
}

.row__check svg {
  width: 14px;
  height: 14px;
}

.row.is-selected,
.row.is-selected:hover {
  background: color-mix(in srgb, var(--green) 12%, var(--panel));
}

.row.is-selected .row__check {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.row.is-selection:not(.is-selected):hover {
  background: var(--hover);
}



/* ==========================================================================
   Documents légaux (1.132.0)
   ========================================================================== */
.legal-doc-wrap { display: flex; flex-direction: column; gap: 10px; }
.legal-doc { font-size: 14px; line-height: 1.65; color: var(--text); }
.legal-doc h2 { font-size: 16px; margin: 20px 0 8px; padding-top: 4px; border-top: 1px solid var(--border); }
.legal-doc h3 { font-size: 14.5px; margin: 16px 0 6px; }
.legal-doc p, .legal-doc li { color: var(--text); }
.legal-doc ul, .legal-doc ol { padding-left: 20px; margin: 8px 0; }
.legal-doc li { margin: 4px 0; }
.legal-doc code { background: var(--panel-3); padding: 1px 5px; border-radius: 4px; font-size: 0.92em; }
.legal-doc a { color: var(--link); }
.legal-doc table { width: 100%; border-collapse: collapse; font-size: 13px; display: block; overflow-x: auto; margin: 10px 0; }
.legal-doc th, .legal-doc td { border: 1px solid var(--border); padding: 6px 8px; text-align: left; vertical-align: top; }
.legal-doc th { background: var(--panel-2); font-weight: 600; }
.legal-doc hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.legal-doc__version { color: var(--text-soft); font-size: 12px; margin: 0; }
.check-row__links { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; align-items: baseline; }
.check-row__links a { color: var(--link); }

.legal-consent p { margin: 0 0 10px; }
.legal-consent-docs { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.legal-consent-docs .btn { flex: 0 0 auto; }

/* ---------------- Lecture QR : image importée, lien collé ---------------- */
.scan__choix {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.scan__camera:empty {
  display: none;
}

.scan__fichier {
  display: inline-flex;
  justify-content: center;
  width: 100%;
}

.scan__fichier-entree {
  display: none;
}

.scan__lien {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.scan__lien-entree {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.scan__lien-entree:focus {
  outline: 2px solid var(--green);
  outline-offset: 1px;
}

.scan__lien .btn {
  flex: none;
}

.pair-link-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

@media (max-width: 460px) {
  .scan__lien {
    flex-direction: column;
  }
}

/* ---------------- Suivi d'appairage : étapes et progression --------------- */
.suivi {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.suivi__barre {
  height: 6px;
  border-radius: 99px;
  overflow: hidden;
  background: var(--panel-2);
  border: 1px solid var(--border);
}

.suivi__remplissage {
  width: 4%;
  height: 100%;
  border-radius: 99px;
  background: var(--green);
  transition: width 0.35s ease;
}

.suivi__etapes {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.suivi__etape {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.35;
}

.suivi__puce {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: transparent;
  font-size: 12px;
  font-weight: 700;
}

.suivi__etape.est-faite {
  color: var(--text);
}

.suivi__etape.est-faite .suivi__puce {
  border-color: var(--green);
  background: var(--green);
  color: var(--on-green, #04120a);
}

.suivi__etape.est-faite .suivi__puce::before {
  content: '✓';
}

.suivi__etape.est-courante {
  color: var(--text);
  font-weight: 600;
}

.suivi__etape.est-courante .suivi__puce {
  border-color: var(--green);
  border-width: 2px;
  background: transparent;
  animation: suivi-pulse 1.1s ease-in-out infinite;
}

@keyframes suivi-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(7, 193, 96, 0.35);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(7, 193, 96, 0);
  }
}

.suivi__statut {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.5;
}

.suivi__statut.est-fini {
  color: var(--green-dark);
  font-weight: 600;
}

.suivi__statut.est-erreur {
  color: var(--danger);
}

/* ------------------------- Bibliothèque de groupe ------------------------ */

.library {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.library__search {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
}

.library__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.library__chip {
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-soft);
  font-size: 12.5px;
  cursor: pointer;
}

.library__chip.is-active {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.library__summary {
  margin: 0;
  color: var(--text-soft);
  font-size: 12.5px;
}

.library__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(56vh, 460px);
  overflow-y: auto;
  padding-right: 2px;
}

.library__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 16px;
  text-align: center;
  color: var(--text-soft);
}

.library__empty strong {
  color: var(--text);
}

.library__empty p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  max-width: 34ch;
}

.library__empty-icon {
  color: var(--text-faint);
}

.library-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}

.library-item__icon {
  flex: 0 0 auto;
  color: var(--text-soft);
  display: inline-flex;
}

.library-item__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.library-item__name {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-item__meta {
  color: var(--text-soft);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-item__badge {
  align-self: flex-start;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(7, 193, 96, 0.14);
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 600;
}

.library-item__actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
}

.library-item__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
}

.library-item__btn:hover,
.library-item__btn:focus-visible {
  background: var(--hover);
  color: var(--text);
}

.library-item__btn--danger:hover,
.library-item__btn--danger:focus-visible {
  color: var(--danger);
}

.library-add {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.library-choix-ligne {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.library-choix__nom {
  color: var(--text-soft);
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

.library-progress {
  width: 100%;
  height: 8px;
  accent-color: var(--green);
}

.library-etat {
  margin: 0;
  color: var(--text-soft);
  font-size: 12.5px;
}

.modal__label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  color: var(--text-soft);
}

.modal__input {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
}

/* --------------------------- Gestion de groupe -------------------------- */

.gestion {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.gestion__bloc {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.gestion__bloc:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.gestion__bloc h3 {
  margin: 0;
  font-size: 14.5px;
}

.gestion__aide {
  margin: 0;
  color: var(--text-soft);
  font-size: 12.5px;
  line-height: 1.5;
}

.gestion__membre,
.gestion__demande {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}

.gestion__membre:last-child,
.gestion__demande:last-child {
  border-bottom: 0;
}

.gestion__membre-nom {
  flex: 1 1 160px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
}

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

.gestion__role,
.gestion__role-fixe {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font-size: 12.5px;
}

.gestion__badge {
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(7, 193, 96, 0.14);
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 600;
}

.gestion__btn-suppr {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
}

.gestion__btn-suppr:hover,
.gestion__btn-suppr:focus-visible {
  background: var(--hover);
  color: var(--danger);
}

.gestion__choix {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.gestion__chip {
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-soft);
  font-size: 12.5px;
  cursor: pointer;
}

.gestion__chip.is-active {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.gestion__chip:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.gestion__accept {
  padding: 5px 10px;
  font-size: 12.5px;
}

.gestion__refuse {
  padding: 5px 10px;
  font-size: 12.5px;
}

/* -------------------------------- Échéances -------------------------------- */

/*
 * Carte d'une échéance dans le fil : une bande verte discrète, la date en
 * petit, les détails sur plusieurs lignes. Une échéance passée est atténuée
 * mais reste dans l'historique — on ne réécrit pas le passé.
 */
.echeance {
  min-width: 210px;
  max-width: 300px;
  padding: 10px 12px;
  border-radius: 12px;
  border-left: 3px solid var(--green);
  background: rgba(7, 193, 96, 0.08);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.echeance.is-passee {
  border-left-color: var(--text-faint);
  background: rgba(255, 255, 255, 0.04);
  opacity: 0.72;
}
.echeance__head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.3;
}
.echeance__head svg {
  width: 15px;
  height: 15px;
  flex: none;
  color: var(--green);
}
.echeance.is-passee .echeance__head svg {
  color: var(--text-faint);
}
.echeance__quand {
  font-size: 12px;
  color: var(--text-soft);
}
.echeance__details {
  font-size: 12.5px;
  white-space: pre-wrap;
  color: var(--text-soft);
}
.echeance__badge {
  font-size: 10.5px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* -------------------------------- Sondages -------------------------------- */

/*
 * Carte d'un sondage : la jauge occupe le fond de l'option, le libellé et le
 * décompte restent lisibles par-dessus. L'option choisie a une bordure verte,
 * y compris quand plusieurs choix sont permis.
 */
.sondage {
  min-width: 230px;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sondage__question {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.35;
}
.sondage__meta {
  font-size: 11.5px;
  color: var(--text-soft);
}
.sondage__option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  text-align: left;
  font-size: 13px;
  overflow: hidden;
  cursor: pointer;
}
.sondage__option:disabled {
  cursor: default;
}
.sondage__jauge {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: rgba(7, 193, 96, 0.22);
  transition: width 0.2s ease;
}
.sondage__texte {
  position: relative;
  flex: 1;
}
.sondage__compte {
  position: relative;
  font-size: 11.5px;
  color: var(--text-soft);
  white-space: nowrap;
}
.sondage__option.is-choisi {
  border-color: var(--green);
  background: rgba(7, 193, 96, 0.14);
}
.sondage__option.is-choisi .sondage__texte {
  font-weight: 600;
}
.sondage__pied {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-soft);
  flex-wrap: wrap;
}
.sondage__badge {
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-size: 10.5px;
}
.sondage__clore {
  margin-left: auto;
  background: none;
  border: 0;
  color: var(--green);
  font-size: 11.5px;
  padding: 2px 0;
  cursor: pointer;
}
.sondage.is-clos .sondage__option {
  opacity: 0.75;
}

/* --------------------------------- Mentions ------------------------------- */

/*
 * Une mention `@nom` est surlignée en vert ; quand c'est **moi** qui suis cité,
 * la bulle entière reçoit un liseré, pour que la citation se repère en
 * parcourant le fil.
 */
.mention {
  color: var(--green);
  font-weight: 600;
}
.mention.is-me {
  background: rgba(7, 193, 96, 0.16);
  border-radius: 4px;
  padding: 0 2px;
}
.bubble--mention {
  box-shadow: 0 0 0 1px rgba(7, 193, 96, 0.55);
}

/* --------------------------- Suggestions @nom ---------------------------- */

/*
 * Panneau de suggestions au-dessus de la barre de saisie. Absolu par rapport
 * au composeur (position relative posée ici pour ne pas dépendre d'une règle
 * existante), il ne pousse pas le fil et se ferme au choix ou à Échap.
 */
.composer {
  position: relative;
}
.mention-panel {
  position: absolute;
  left: 52px;
  right: 52px;
  bottom: calc(100% + 8px);
  display: flex;
  flex-direction: column;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--panel, #1c1c1e);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  z-index: 20;
}
.mention-panel.hidden {
  display: none;
}
.mention-suggestion {
  text-align: left;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: inherit;
  font-size: 13px;
  cursor: pointer;
}
.mention-suggestion.is-active {
  background: rgba(7, 193, 96, 0.18);
}
.mention-suggestion strong {
  color: var(--green);
  font-weight: 600;
}

/* -------------------------------- Annonces -------------------------------- */

/*
 * Carte d'une annonce d'administrateur : une cloche, le libellé, puis le texte.
 * Elle se distingue d'une échéance (pas de date) et d'un message ordinaire
 * (texte nettement séparé, fond légèrement plus clair).
 */
.annonce {
  min-width: 220px;
  max-width: 300px;
  padding: 10px 12px;
  border-radius: 12px;
  border-left: 3px solid var(--green);
  background: rgba(7, 193, 96, 0.07);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.annonce__head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--green);
}
.annonce__head svg {
  width: 14px;
  height: 14px;
  flex: none;
}
.annonce__texte {
  font-size: 13.5px;
  line-height: 1.45;
  white-space: pre-wrap;
}

/* ------------------------- Mention non lue (liste) ------------------------ */

/*
 * Petit `@` vert devant l'aperçu quand le dernier message non lu me cite.
 * Il ne remplace pas le compteur de non-lus : il signale qu'il y a quelque
 * chose à regarder, pas seulement à compter.
 */
.row__mention {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  margin-right: 4px;
  border-radius: 5px;
  background: rgba(7, 193, 96, 0.18);
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
}

/* ------------------------------ Récap de fil ------------------------------ */

/*
 * Bande de récap au-dessus du fil : elle ne bloque rien, se ferme d'un × et
 * résume ce qui a été manqué. Le détail s'ouvre dans une fenêtre.
 */
.recap-band {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 8px 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(7, 193, 96, 0.28);
  background: rgba(7, 193, 96, 0.08);
}
.recap-band__corps {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.recap-band__titre {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}
.recap-band__titre svg {
  width: 14px;
  height: 14px;
  flex: none;
  color: var(--green);
}
.recap-band__resume {
  font-size: 12px;
  color: var(--text-soft);
}
.recap-band__actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
}
.recap-band__voir {
  padding: 4px 8px;
  font-size: 12px;
}
.recap-band__fermer {
  border: 0;
  background: none;
  color: var(--text-faint);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}
.recap-section {
  margin-bottom: 12px;
}
.recap-section__titre {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-soft);
}
.recap-ligne {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.recap-ligne strong {
  color: var(--text-soft);
  font-weight: 500;
  white-space: nowrap;
}
.recap-annonce {
  font-size: 13px;
  line-height: 1.45;
  padding: 8px 10px;
  border-left: 3px solid var(--green);
  background: rgba(7, 193, 96, 0.06);
  border-radius: 8px;
  margin-bottom: 6px;
  white-space: pre-wrap;
}

/* ---------------------------------- Fils ---------------------------------- */

/*
 * Lien « N réponses » sous le message racine, et panneau du fil : racine en
 * encadré, réponses à la suite, zone de saisie en bas. Les réponses de fil ne
 * sont pas rendues dans le fil principal.
 */
.thread-link {
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(7, 193, 96, 0.35);
  background: rgba(7, 193, 96, 0.08);
  color: var(--green);
  font-size: 11.5px;
  cursor: pointer;
}
.thread-link svg {
  width: 13px;
  height: 13px;
}
.fil {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 56vh;
  overflow-y: auto;
  padding-right: 2px;
}
.fil-msg {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.fil-msg.is-racine {
  border-left: 3px solid var(--green);
  background: rgba(7, 193, 96, 0.07);
}
.fil-msg__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
}
.fil-msg__heure {
  font-size: 11px;
  color: var(--text-faint);
}
.fil-msg__texte {
  font-size: 13.5px;
  line-height: 1.4;
  white-space: pre-wrap;
}
.fil__sep {
  font-size: 11.5px;
  color: var(--text-soft);
  padding: 2px 0;
}
.fil__form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding-top: 4px;
}
.fil__champ {
  flex: 1;
  resize: none;
}

/* --------------------------- Navigation d'épingles ------------------------ */

/*
 * Bandeau d'épingles multiples : compteur « 1/3 » et flèches discrètes entre le
 * texte et le bouton de détachement. Une seule épingle garde l'ancien bandeau.
 */
.pinned-banner__nav {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: none;
}
.pinned-banner__prev,
.pinned-banner__next {
  border: 0;
  background: none;
  color: var(--text-soft);
  font-size: 18px;
  line-height: 1;
  padding: 0 4px;
  cursor: pointer;
}
.pinned-banner__compte {
  font-size: 11.5px;
  color: var(--text-soft);
  min-width: 26px;
  text-align: center;
}

/* --------------------------- Poignée du profil ---------------------------- */

/*
 * La poignée `@nom` apparaît sous le nom (fiche d'un contact) ou à côté de
 * l'identifiant (profil personnel), dans le vert de l'application.
 */
.profile-handle {
  margin: 2px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--green);
  word-break: break-all;
}
.profile-meta .profile-handle {
  margin: 0;
  font-size: 12px;
}

/* ------------------------------ Sondage anonyme --------------------------- */

/*
 * Le sondage anonyme n'affiche que des totaux : un petit rappel sous la carte
 * explique où vont les bulletins (à l'auteur seul).
 */
.sondage__note {
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-faint);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 6px;
  margin-top: 2px;
}
.sondage-anonyme__aide {
  display: block;
  font-size: 11px;
  color: var(--text-soft);
  line-height: 1.4;
}

/* ------------------------- Visionneuse PDF (1.164.0) ---------------------- */

/*
 * La page blanche tient la largeur réelle du corps (calculée dans
 * ui/apercu.js), le fond reste blanc dans les deux thèmes — c'est le document
 * qui décide de sa couleur, pas l'interface. La barre de navigation est
 * volontairement compacte : sur un écran de 369 px, deux flèches et un compteur
 * doivent tenir sur une seule ligne.
 */
.apercu-document .modal__body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--panel-2);
}

.apercu-pdf {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.apercu-pdf__chargement {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 8px;
  font-size: 13px;
  color: var(--text-soft);
}

.apercu-pdf__spinner {
  width: 18px;
  height: 18px;
  flex: none;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--green);
  animation: apercu-pdf-tourne 0.8s linear infinite;
}

@keyframes apercu-pdf-tourne {
  to {
    transform: rotate(360deg);
  }
}

.apercu-pdf__vue {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 120px;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}

.apercu-pdf__page {
  display: block;
  max-width: 100%;
  height: auto;
  background: #fff;
}

.apercu-pdf__barre {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 2px 0;
}

.apercu-pdf__nav {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--panel-3);
  color: var(--text-soft);
}

.apercu-pdf__nav:hover:not(:disabled),
.apercu-pdf__nav:focus-visible:not(:disabled) {
  background: var(--hover);
  color: var(--text);
}

.apercu-pdf__nav:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.apercu-pdf__nav svg {
  width: 18px;
  height: 18px;
}

.apercu-pdf__compteur {
  min-width: 72px;
  text-align: center;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text-meta);
}

.apercu-pdf__erreur {
  padding: 18px 8px;
  text-align: center;
  color: var(--text-soft);
}

.apercu-pdf__erreur p {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.5;
}

/*
 * Sur ordinateur, « Ouvrir avec une application » n'a de sens que si le rendu a
 * échoué : la classe `is-erreur` est posée sur la fenêtre par ui/apercu.js.
 */
.apercu-document:not(.is-erreur) .apercu-pdf__externe-pied--repli {
  display: none;
}

/*
 * Miniature de la page 1 dans le fil : même emplacement que la pastille de
 * format, que l'image remplace quand elle est prête. La pastille reste dans le
 * conteneur tant que le rendu n'a pas eu lieu (repli).
 */
.attach-file__apercu {
  width: 42px;
  height: 42px;
  flex: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(127, 127, 127, 0.16);
}

.attach-file__apercu-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  background: #fff;
}

/* Même vignette dans la Bibliothèque, un peu plus haute que large. */
.library-item__apercu {
  flex: 0 0 auto;
  width: 38px;
  height: 50px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 5px;
  background: rgba(127, 127, 127, 0.12);
}

.library-item__apercu-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  background: #fff;
}

@media (max-width: 620px) {
  .apercu-document .modal__body {
    padding: 10px 12px 8px;
  }

  .apercu-pdf__nav {
    width: 40px;
    height: 40px;
  }

  .apercu-pdf__compteur {
    min-width: 64px;
  }
}

/* ----------------- Visionneuse PDF : zoom et recherche (1.165.0) ---------- */

/*
 * Barre d'outils au-dessus de la page : zoom (−, pourcentage, +, ajuster) et
 * loupe. Elle passe à la ligne plutôt que de déborder : à 369 px, deux rangées
 * de 40 px tiennent, une rangée de trop non.
 */
.apercu-pdf__outils,
.apercu-pdf__recherche {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}

.apercu-pdf__zoom {
  min-width: 46px;
  text-align: center;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-meta);
}

/* « − » et « + » sont du texte : le sprite n'a pas d'icône « moins ». */
.apercu-pdf__nav--texte {
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
}

.apercu-pdf__recherche {
  padding: 6px;
  border-radius: 8px;
  background: var(--panel-3);
}

.apercu-pdf__recherche-champ {
  flex: 1 1 120px;
  min-width: 0;
  max-width: 220px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel);
  font-size: 13px;
}

.apercu-pdf__recherche-compte {
  min-width: 54px;
  text-align: center;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text-meta);
}

/*
 * Zone de page : c'est elle qui défile (horizontal et vertical) quand le zoom
 * dépasse. Le conteneur centré porte le canvas et la surcouche ; `max-content`
 * le laisse grandir avec la page, `margin: 0 auto` le recentre tant qu'il tient.
 */
.apercu-pdf__vue {
  display: block;
  max-height: min(70vh, 720px);
  overflow: auto;
  overscroll-behavior: contain;
}

.apercu-pdf__conteneur {
  position: relative;
  width: max-content;
  margin: 0 auto;
}

/* Le canvas garde sa taille réelle : le `max-width` du 1.164.0 le réduirait. */
.apercu-pdf__page {
  max-width: none;
}

/* Surcouche de surlignage : au-dessus du canvas, jamais interactive. */
.apercu-pdf__surlignage {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

.apercu-pdf__surligne {
  position: absolute;
  border-radius: 2px;
  background: rgba(255, 214, 0, 0.42);
  box-shadow: 0 0 0 1px rgba(255, 214, 0, 0.55);
}

.apercu-pdf__surligne.is-actif {
  background: rgba(255, 140, 0, 0.55);
  box-shadow: 0 0 0 1px rgba(230, 120, 0, 0.9);
}

[data-theme='dark'] .apercu-pdf__surligne {
  background: rgba(255, 214, 0, 0.35);
}

[data-theme='dark'] .apercu-pdf__surligne.is-actif {
  background: rgba(255, 140, 0, 0.5);
}

@media (max-width: 620px) {
  .apercu-pdf__zoom {
    min-width: 40px;
  }

  .apercu-pdf__recherche-champ {
    flex-basis: 100px;
    max-width: none;
  }

  .apercu-pdf__vue {
    max-height: min(56vh, 560px);
  }
}

/*
 * La page défile dans SA zone, jamais la fenêtre.
 *
 * Sans cela, le corps de la fenêtre gagne une barre de défilement dès que les
 * barres d'outils s'ajoutent : sa largeur utile perd alors une dizaine de
 * pixels, et la page rendue « ajustée » déborde de cette même dizaine. La vue
 * devient donc l'unique zone défilante : le corps est rigide, la rangée de
 * commandes garde sa taille, seule la page se résorbe.
 */
.apercu-document .modal__body {
  overflow: hidden;
}

.apercu-pdf {
  flex: 1 1 auto;
  min-height: 0;
}

.apercu-pdf > * {
  flex: none;
}

.apercu-pdf > .apercu-pdf__vue {
  flex: 1 1 auto;
  min-height: 140px;
  max-height: none;
}

/* -------------------- Aperçu des documents non-PDF (1.165.0) ---------------- */

/*
 * Texte, archive ZIP et bureautique (DOCX/ODT/PPTX/XLSX) extraits dans le
 * client : la fenêtre reprend le corps commun .apercu-document et n'ajoute
 * que le contenu. Le texte est un <pre> qui défile tout seul : un long
 * document ne fait jamais grandir la fenêtre au-delà de l'écran.
 */
.apercu-doc {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.apercu-doc__chargement {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 8px;
  font-size: 13px;
  color: var(--text-soft);
}

.apercu-doc__spinner {
  width: 18px;
  height: 18px;
  flex: none;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--green);
  animation: apercu-doc-tourne 0.8s linear infinite;
}

@keyframes apercu-doc-tourne {
  to {
    transform: rotate(360deg);
  }
}

.apercu-doc__texte {
  margin: 0;
  max-height: min(62vh, 540px);
  overflow: auto;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Consolas, 'Courier New', monospace;
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 4;
}

.apercu-doc__liste {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: min(62vh, 540px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
}

.apercu-doc__fichier {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.apercu-doc__fichier:last-child {
  border-bottom: 0;
}

.apercu-doc__nom {
  min-width: 0;
  overflow-wrap: anywhere;
}

.apercu-doc__taille {
  flex: none;
  color: var(--text-meta);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.apercu-doc__resume {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-meta);
}

.apercu-doc__note {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-meta);
}

.apercu-doc__erreur {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 8px;
}

.apercu-doc__message {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-soft);
}

/* ------------------- Couleur d'accent et fonds (1.166.0) ------------------- */

/*
 * Les palettes viennent de core/themes.js, qui pose seulement
 * data-accent sur <html> : le CSS choisit les couleurs. Trois variables suffisent
 * à teinter toute l'interface (boutons, pastilles, bulles envoyées) ; le thème
 * sombre a sa propre bulle, plus foncée, pour garder le texte lisible.
 */
[data-accent='vert'] {
  --green: #07c160;
  --green-dark: #06ad56;
  --bubble-me: #95ec69;
}

[data-theme='dark'][data-accent='vert'] {
  --bubble-me: #2f7d43;
}

[data-accent='bleu'] {
  --green: #2b7de9;
  --green-dark: #1f66c4;
  --bubble-me: #a8cef7;
}

[data-theme='dark'][data-accent='bleu'] {
  --bubble-me: #1f5f9e;
}

[data-accent='violet'] {
  --green: #8e5cf7;
  --green-dark: #7343d6;
  --bubble-me: #cdb8f7;
}

[data-theme='dark'][data-accent='violet'] {
  --bubble-me: #5a3f96;
}

[data-accent='orange'] {
  --green: #f08a1d;
  --green-dark: #d2740f;
  --bubble-me: #ffd39a;
}

[data-theme='dark'][data-accent='orange'] {
  --bubble-me: #9a5a12;
}

[data-accent='rose'] {
  --green: #e5537f;
  --green-dark: #c93f69;
  --bubble-me: #f7b8cc;
}

[data-theme='dark'][data-accent='rose'] {
  --bubble-me: #9e2f55;
}

[data-accent='turquoise'] {
  --green: #12b3a6;
  --green-dark: #0f9a8e;
  --bubble-me: #9fe6dd;
}

[data-theme='dark'][data-accent='turquoise'] {
  --bubble-me: #1d6f68;
}

[data-chatbg='sable'] {
  --chat-bg-image: radial-gradient(rgba(120, 90, 40, 0.1) 1.5px, transparent 1.5px);
  --chat-bg-size: 18px 18px;
}

[data-theme='dark'][data-chatbg='sable'] {
  --chat-bg-image: radial-gradient(rgba(230, 200, 150, 0.07) 1.5px, transparent 1.5px);
}

[data-chatbg='foret'] {
  --chat-bg-image: repeating-linear-gradient(
    60deg,
    rgba(20, 80, 40, 0.06) 0 6px,
    transparent 6px 18px
  );
  --chat-bg-size: auto;
}

[data-theme='dark'][data-chatbg='foret'] {
  --chat-bg-image: repeating-linear-gradient(
    60deg,
    rgba(120, 220, 160, 0.05) 0 6px,
    transparent 6px 18px
  );
}

[data-chatbg='nuit'] {
  --chat-bg-image: radial-gradient(circle at 30% 20%, rgba(40, 50, 120, 0.12), transparent 55%),
    radial-gradient(circle at 80% 80%, rgba(80, 40, 120, 0.1), transparent 50%);
  --chat-bg-size: auto;
}

[data-theme='dark'][data-chatbg='nuit'] {
  --chat-bg-image: radial-gradient(circle at 30% 20%, rgba(90, 110, 220, 0.16), transparent 55%),
    radial-gradient(circle at 80% 80%, rgba(150, 80, 220, 0.12), transparent 50%);
}

/* Pastilles de la couleur d'accent (réglages → Apparence). */
.accent-grille {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.accent-pastille {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 46px;
  min-height: 46px;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  font-size: 10.5px;
  color: var(--text-soft);
}

.accent-pastille.is-active {
  border-color: var(--green);
  box-shadow: inset 0 0 0 1px var(--green);
  color: var(--text);
}

.accent-pastille[data-accent='vert'] {
  --pastille: #07c160;
}

.accent-pastille[data-accent='bleu'] {
  --pastille: #2b7de9;
}

.accent-pastille[data-accent='violet'] {
  --pastille: #8e5cf7;
}

.accent-pastille[data-accent='orange'] {
  --pastille: #f08a1d;
}

.accent-pastille[data-accent='rose'] {
  --pastille: #e5537f;
}

.accent-pastille[data-accent='turquoise'] {
  --pastille: #12b3a6;
}

.accent-pastille::before {
  content: '';
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--pastille, var(--green));
}

/* ------------------------------ Quiz (1.166.0) ---------------------------- */

.quiz {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.quiz__titre {
  font-weight: 600;
  font-size: 14.5px;
}

.quiz__meta,
.quiz__progress {
  font-size: 11.5px;
  color: var(--text-meta);
}

.quiz__question {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.quiz__intitule {
  font-weight: 500;
  font-size: 13.5px;
}

.quiz__option {
  text-align: left;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  font-size: 13px;
  line-height: 1.35;
}

.quiz__option.is-choisi {
  border-color: var(--green);
  box-shadow: inset 0 0 0 1px var(--green);
}

.quiz__option.is-juste {
  border-color: var(--green);
  background: color-mix(in srgb, var(--green) 16%, transparent);
}

.quiz__option.is-faux {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 13%, transparent);
}

.quiz__valider,
.dispo__enregistrer {
  align-self: flex-start;
  padding: 7px 12px;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
}

.quiz__valider:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.quiz__score {
  font-size: 16px;
  font-weight: 700;
  color: var(--green-dark);
}

.quiz__stats {
  font-size: 11.5px;
  color: var(--text-meta);
}

/* -------------------------- Disponibilités (1.166.0) ---------------------- */

.dispo {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.dispo__titre {
  font-weight: 600;
  font-size: 14.5px;
}

.dispo__meta {
  font-size: 11.5px;
  color: var(--text-meta);
}

.dispo__creneau {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  text-align: left;
}

.dispo__creneau.is-meilleur {
  border-color: var(--green);
  box-shadow: inset 0 0 0 1px var(--green);
}

.dispo__creneau.is-choisi {
  background: color-mix(in srgb, var(--green) 12%, var(--panel-2));
}

.dispo__libelle {
  flex: 1 1 140px;
  min-width: 0;
  font-size: 13px;
}

.dispo__barre {
  flex: 1 1 100%;
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--border);
}

.dispo__barre > span,
.dispo__barre > i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--green);
}

.dispo__compte {
  flex: none;
  font-size: 12px;
  color: var(--text-meta);
  font-variant-numeric: tabular-nums;
}

.dispo__badge {
  flex: none;
  padding: 1px 7px;
  border: 1px solid var(--green);
  border-radius: 999px;
  color: var(--green-dark);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ------------------------------ Galerie (1.166.0) ------------------------- */

.galerie {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 240px;
}

.galerie__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.galerie__tab {
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  font-size: 12.5px;
  color: var(--text-soft);
}

.galerie__tab.is-active {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.galerie__grille {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
  max-height: min(62vh, 540px);
  overflow: auto;
}

.galerie__item {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  text-align: left;
  font-size: 11.5px;
}

.galerie__item img {
  width: 100%;
  height: 96px;
  object-fit: cover;
  display: block;
  background: var(--panel-3);
}

.galerie__item strong,
.galerie__item small {
  padding: 0 7px;
  overflow-wrap: anywhere;
}

.galerie__item strong {
  padding-top: 6px;
  font-size: 12px;
}

.galerie__item small {
  padding-bottom: 6px;
  color: var(--text-meta);
}

.galerie__vide {
  padding: 20px 12px;
  text-align: center;
  color: var(--text-soft);
  font-size: 13px;
}

.galerie__lien {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
}

.galerie__lien strong {
  color: var(--green-dark);
  padding: 0;
}

/* ------------------------------ Signets (1.166.0) ------------------------- */

.signets {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: min(62vh, 540px);
  overflow: auto;
}

.signets__item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  text-align: left;
  min-width: 0;
}

.signets__item > button:first-child {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
}

.signets__item strong {
  display: block;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.signets__meta {
  display: block;
  font-size: 11.5px;
  color: var(--text-meta);
}

.signets__retirer {
  flex: none;
  padding: 4px 7px;
  border-radius: 6px;
  color: var(--danger-text);
  font-size: 11.5px;
}

.signets__vide {
  padding: 20px 12px;
  text-align: center;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.5;
}

/* Sur 369 px, les cartes gardent la largeur de la bulle. */
@media (max-width: 620px) {
  .quiz__option,
  .dispo__creneau,
  .galerie__item,
  .signets__item {
    font-size: 12.5px;
  }

  .galerie__grille {
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  }
}

/* --------------- Compléments d'intégration (classes réelles) --------------- */

.accent-pastille::before {
  content: none;
}

.accent-pastille__couleur {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.accent-pastille__libelle {
  font-size: 10.5px;
  line-height: 1.1;
  text-align: center;
}

.quiz__entete,
.quiz__pied {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.quiz__pied {
  align-items: flex-start;
  gap: 6px;
}

.quiz__description {
  font-size: 12px;
  color: var(--text-soft);
  overflow-wrap: anywhere;
}

.quiz__option {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.quiz__option-texte {
  min-width: 0;
  overflow-wrap: anywhere;
}

.quiz__option-marque {
  flex: none;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-meta);
}

.quiz__option.is-juste .quiz__option-marque {
  color: var(--green-dark);
}

.dispo__aide,
.dispo__statut {
  font-size: 11.5px;
  color: var(--text-meta);
}

.dispo__vide {
  padding: 2px 0;
}

.galerie__onglets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.galerie__tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.galerie__compte {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--panel-3);
  color: var(--text-soft);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.galerie__tab.is-active .galerie__compte {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.galerie__corps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 180px;
}

.galerie__item {
  cursor: pointer;
}

.galerie__vignette {
  display: grid;
  place-items: center;
  width: 100%;
  height: 96px;
  overflow: hidden;
  background: var(--panel-3);
  color: var(--text-soft);
}

.galerie__vignette img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.galerie__nom {
  display: block;
  padding: 6px 7px 0;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.galerie__detail {
  display: block;
  padding: 0 7px 7px;
  font-size: 11px;
  color: var(--text-meta);
}

.galerie__item--lien {
  padding: 8px 10px;
  gap: 3px;
}

.galerie__item--lien .galerie__nom {
  padding: 0;
  color: var(--green-dark);
}

.galerie__item--lien .galerie__detail {
  padding: 0;
  overflow-wrap: anywhere;
}

.signets__corps {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.signets__entete {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-meta);
}

.signets__liste {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: min(62vh, 540px);
  overflow: auto;
}

.signets__vide {
  padding: 20px 12px;
  text-align: center;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.5;
}

.signets__ouvrir-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  text-align: left;
  min-width: 0;
  flex: 1 1 auto;
}

.signets__ligne {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.signets__auteur {
  font-size: 12.5px;
}

.signets__date {
  flex: none;
  font-size: 11px;
  color: var(--text-meta);
}

.signets__apercu {
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.signets__meta {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-meta);
}

.signets__meta svg {
  width: 13px;
  height: 13px;
}

.signets__conversation {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signets__action {
  margin-left: auto;
  color: var(--green-dark);
}

.signets__retirer {
  flex: none;
  align-self: flex-start;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--danger-text);
  background: var(--panel-2);
  font-size: 11.5px;
}

/* ------------------ Lot 1 : listes et contacts (1.174.0) ------------------ */

/*
 * Composants du lot « listes et contacts » : onglets de la liste, index
 * alphabétique des contacts, avatars de groupe composés, tuiles de l'accueil
 * vide et action texte de l'en-tête. Le balisage correspondant est produit par
 * public/js/ui/list.js et public/js/ui/dom.js.
 *
 * Aucun sélecteur existant n'est retouché : `.tabs` et `.tab` (onboarding,
 * modales), `.row`, l'`.avatar` de base et les requêtes média déjà en place
 * gardent leur comportement. Ces composants ne consomment que les variables du
 * thème clair/sombre, si bien que `[data-theme='dark']` n'a besoin d'aucune
 * règle supplémentaire, et les nouveaux jetons sont posés dans `:root`.
 */

/*
 * Anneau de focus global. La spécificité d'une pseudo-classe (0,1,0) le laisse
 * perdre devant les `:focus-visible` déjà déclarés (0,2,0) et devant les
 * sélecteurs de champs qui peignent déjà leur bordure : les composants qui
 * avaient un repère le gardent, les autres en gagnent un.
 */
:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

/* --------------------------- Onglets de la liste ------------------------- */

/*
 * Onglets textuels sous l'en-tête de liste. Ils ne se replient jamais mais
 * défilent horizontalement quand la colonne est trop étroite (à 360 px par
 * exemple), sans déborder : le conteneur est borné par `.list-pane__head`.
 */
.list-tabs {
  display: flex;
  align-items: stretch;
  gap: var(--space-4);
  min-width: 0;
  max-width: 100%;
  padding: var(--space-2) var(--space-3) var(--space-1);
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.list-tabs::-webkit-scrollbar {
  display: none;
}

.list-tabs__btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  flex: none;
  min-height: 34px;
  padding: var(--space-1) 2px calc(var(--space-2) + 2px);
  color: var(--text-soft);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: color 0.15s;
}

/*
 * Onglet actif : vert et souligné de 2 px, comme les maquettes. Le vert foncé
 * reste lisible sur panneau blanc comme sur panneau sombre, sans règle de
 * thème dédiée.
 */
.list-tabs__btn::after {
  content: '';
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 1px;
  height: 2px;
  border-radius: 2px;
  background: transparent;
  transition: background 0.15s;
}

.list-tabs__btn:hover {
  color: var(--text);
}

.list-tabs__btn.is-active {
  color: var(--green-dark);
}

.list-tabs__btn.is-active::after {
  background: var(--green);
}

/* Le conteneur rogne son axe vertical : on rentre l'anneau de focus d'autant. */
.list-tabs__btn:focus-visible {
  outline-offset: -2px;
}

.list-tabs__count {
  display: inline-grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  padding: 0 var(--space-1);
  border-radius: 999px;
  background: var(--panel-3);
  color: var(--text-meta);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.list-tabs__btn.is-active .list-tabs__count {
  background: rgba(7, 193, 96, 0.14);
  color: var(--green-dark);
}

/* --------------------------- Contacts : index A–Z ------------------------ */

/*
 * En-tête de lettre : il reste collé en haut de la zone défilante et peint un
 * fond opaque, sans quoi les lignes passeraient dessous à travers. z-index 2 le
 * garde sous l'index (3), sous l'en-tête de liste (4 sur téléphone) et sous les
 * modales (85).
 */
.contact-letter {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 5px var(--space-3) 4px;
  background: var(--panel);
  color: var(--text-meta);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.4;
  text-transform: uppercase;
}

/*
 * Index alphabétique : repère de pouce, donc mobile seulement. Masqué au-dessus
 * de 821 px (rien ne change sur bureau), il est fixé au bord droit de la
 * fenêtre et centré verticalement, sous l'en-tête de liste et sous les modales.
 */
.contact-index {
  display: none;
}

.contact-index__lettre {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border-radius: 999px;
  color: var(--text-meta);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1;
  user-select: none;
  -webkit-user-select: none;
  transition: color 0.12s, background 0.12s;
}

.contact-index__lettre:hover {
  color: var(--text);
}

.contact-index__lettre.is-active {
  background: rgba(7, 193, 96, 0.14);
  color: var(--green-dark);
}

.contact-index__lettre:focus-visible {
  outline-offset: -2px;
}

/*
 * La marge de droite réserve la largeur de l'index : sans elle, l'heure et les
 * pastilles de fin de ligne passeraient dessous. Elle n'existe qu'en mobile et
 * seulement quand l'index est rendu (`has-index`), pour ne pas rétrécir les
 * lignes de bureau.
 */
@media (max-width: 820px) {
  .list-pane__body.has-index {
    padding-right: var(--space-5);
  }

  .contact-index {
    position: fixed;
    top: 50%;
    right: 2px;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-1) 0;
    transform: translateY(-50%);
    user-select: none;
    -webkit-user-select: none;
    /*
     * Le glissement sert à parcourir l'index : le doigt ne doit pas faire
     * défiler la liste à la place.
     */
    touch-action: none;
  }
}

/* ------------------------- Avatar de groupe composé ---------------------- */

/*
 * Mosaïque 2×2 des portraits des membres, dans le cercle habituel. Les cellules
 * sont peintes par le JS (photo, ou initiales avec leur couleur de fond en
 * style inline) ; le fond du cercle sert de séparateur d'un pixel entre elles.
 *
 * Le rognage au cercle est porté par `.avatar__cells` et non par l'avatar :
 * `overflow: visible` permet à la pastille du nombre de membres de déborder du
 * cercle, qu'elle soit sœur de l'avatar ou enfant (la boîte du portrait,
 * `.row__avatar`, reste le parent positionné dans les deux cas).
 */
.avatar--group {
  position: relative;
  display: grid;
  place-items: stretch;
  overflow: visible;
  border-radius: 50%;
  background: var(--panel);
}

.avatar__cells {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 1px;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  border-radius: 50%;
  overflow: hidden;
}

.avatar__cell {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--panel-3);
  color: #fff;
  font-size: 0.6em;
  font-weight: 600;
  line-height: 1;
}

.avatar__cell img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/*
 * Le helper peut poser de 1 à 4 cellules : sans ces replis, un groupe de deux
 * membres laisserait la moitié basse du cercle vide et un groupe de trois une
 * case blanche. Les quatre cellules gardent la grille 2×2 nominale.
 */
.avatar__cell:only-child {
  grid-column: 1 / -1;
  grid-row: 1 / -1;
}

.avatar__cell:first-child:nth-last-child(2) {
  grid-column: 1 / -1;
}

.avatar__cell:last-child:nth-last-child(2) {
  grid-column: 1 / -1;
}

.avatar__cell:first-child:nth-last-child(3) {
  grid-row: 1 / -1;
}

/* Pastille du nombre de membres (18 px, fond du panneau, liseré de bordure). */
.avatar__count {
  position: absolute;
  right: -2px;
  bottom: -2px;
  z-index: 1;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 var(--space-1);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text-meta);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* ------------------------ Tuiles de l'accueil vide ----------------------- */

/*
 * Trois tuiles illustrées à la place des boutons empilés (« Nouvelle
 * discussion », « Créer un groupe », « Scanner une invitation »). La grille
 * tient sur trois colonnes à partir de 360 px et retombe sur une seule colonne
 * juste en dessous.
 */
.home-empty__actions--tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
  width: 100%;
  max-width: 360px;
}

/*
 * Sur bureau, .home-empty__actions est masqué par la requête média de
 * largeur : le panneau d'accueil de droite affiche déjà ces trois actions. Le
 * display: grid ci-dessus, plus bas dans la feuille, annulerait ce masquage ;
 * on le rétablit explicitement pour ne rien doubler à l'écran.
 */
@media (min-width: 821px) {
  .home-empty__actions--tiles {
    display: none;
  }
}

.quick-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  padding: var(--space-3) var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--panel);
  color: var(--text);
  text-align: center;
  transition: background 0.15s;
}

.quick-tile:hover {
  background: var(--hover);
}

.quick-tile:active {
  background: var(--active);
}

.quick-tile__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  /* Même teinte verte que `.home-empty__icon`, juste au-dessus. */
  background: rgba(7, 193, 96, 0.13);
  color: var(--green);
}

.quick-tile__icon svg {
  width: 19px;
  height: 19px;
}

.quick-tile__label {
  min-width: 0;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
}

/* Sous 360 px, trois tuiles ne tiennent plus : une seule colonne. */
@media (max-width: 359px) {
  .home-empty__actions--tiles {
    grid-template-columns: minmax(0, 1fr);
    max-width: 240px;
  }
}

/* -------------------------- En-tête : action texte ------------------------ */

/* Action verte à droite du titre de l'en-tête (« Inviter des amis + »). */
.list-head__link {
  flex: none;
  margin-left: auto;
  padding: var(--space-1) var(--space-2);
  border-radius: 8px;
  color: var(--green-dark);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s;
}

.list-head__link:hover {
  background: var(--hover);
}

/* ------------------------------- Mouvement -------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .list-tabs__btn,
  .list-tabs__btn::after,
  .contact-index__lettre,
  .quick-tile,
  .list-head__link {
    transition: none;
  }
}

/* ------------------- Lot 3-4 : statuts et session (1.176.0) --------------- */

/*
 * Rail des statuts en haut des discussions (A6 « local », réglage désactivé
 * par défaut). Le JS ne le rend pas quand il est vide : aucune règle de
 * masquage à écrire. Il vit dans `.list-pane__body`, qui défile
 * verticalement : il défile donc horizontalement sans jamais élargir la
 * colonne de liste.
 */
.statuts-rail {
  display: flex;
  gap: 10px;
  padding: var(--space-3) var(--space-3) var(--space-2);
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.statuts-rail::-webkit-scrollbar {
  display: none;
}

/*
 * Bulle d'un statut : bouton colonne de largeur fixe (l'anneau et le nom
 * gardent leur place quel que soit le texte) ; `position: relative` porte le
 * compteur.
 */
.statut-bulle {
  position: relative;
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  width: 64px;
  padding: 0;
  text-align: center;
}

/*
 * L'anneau est le fond vert rogné au cercle : le padding de 2 px donne
 * l'anneau, et il reste visible en thème sombre puisque `--green` y est
 * défini. `overflow: hidden` rabat les coins de l'avatar dans le cercle.
 */
.statut-bulle__anneau {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  padding: 2px;
  border-radius: 50%;
  background: var(--green);
  overflow: hidden;
}

/* L'avatar reçoit `avatar()` sans classe de taille : on la fixe ici (50 px
   utiles, 54 - 2 × 2), et les initiales gardent une taille lisible. */
.statut-bulle__avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  font-size: 15px;
}

.statut-bulle__nom {
  display: block;
  width: 100%;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.statut-bulle:hover .statut-bulle__nom {
  color: var(--text);
}

/* Compteur (> 1) : rouge plutôt que vert, seul contraste confortable pour un
   texte blanc de 10 px sur --danger. */
.statut-bulle__count {
  position: absolute;
  top: 0;
  right: 4px;
  display: grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 var(--space-1);
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* --------------------- Session de proximité (modale) ---------------------- */

/*
 * Contenu de `openGroupInviteModal(…, { session: true })`. Ces classes
 * nouvelles surchargent les styles existants seulement quand elles sont
 * présentes : l'invitation normale (`#invite-*`, `.qr-holder`) ne change pas.
 */
.session-invite {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-1) 0 var(--space-2);
  text-align: center;
}

/*
 * Le QR garde `.qr-holder` (fond blanc, ombre) mais prend la largeur utile de
 * la fenêtre, plafonnée à 320 px. `width: 100%` + `height: auto` sur le SVG
 * conservent le carré du viewBox et la netteté vectorielle ; à 360 px de
 * large, le QR se réduit avec le corps de la modale au lieu de déborder.
 * Les deux cas de balisage sont couverts : la classe sur le `.qr-holder`
 * lui-même, ou sur un conteneur qui le porte.
 */
.session-invite__qr {
  width: 100%;
  max-width: 320px;
  margin: 0 auto var(--space-2);
  background: #fff;
}

.session-invite__qr .qr-holder {
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  background: #fff;
}

.session-invite__qr svg,
.session-invite__qr .qr-holder svg {
  width: 100%;
  height: auto;
}

/* Compte à rebours : chiffres tabulaires pour que la largeur ne saute pas
   d'une seconde à l'autre. */
.session-invite__compte {
  color: var(--text);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

/* À l'échéance, le JS ajoute cette classe : même nœud, couleur de danger. */
.session-invite__expire {
  color: var(--danger-text);
}

/* Code du lien : se coupe n'importe où plutôt que d'élargir la fenêtre. */
.session-invite__lien {
  display: block;
  max-width: 100%;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--text-meta);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
  word-break: break-all;
  overflow-wrap: anywhere;
}

/* --------------- 1.177.0 : capsules et Moments (volet CSS) --------------- */

/*
 * Capsules temporelles dans les bulles, formulaire de capsule et fenêtre
 * Moments. Les classes viennent de public/js/ui/capsule.js, chat.js et
 * moments.js ; rien n'est renommé. Aucun style existant de `.bubble`, `.msg*`,
 * `.modal*` ni `.qr-holder` n'est modifié : tout est nouveau et ne s'applique
 * qu'aux classes ci-dessous.
 */

/* ------------------------- Capsule dans une bulle ------------------------- */

/*
 * La carte vit dans la bulle, qui hérite `white-space: pre-wrap` : la carte
 * repart donc en texte normal et ne rouvre `pre-wrap` que pour le contenu de
 * la capsule. Le fond explicite la détache de la bulle verte des envois.
 */
.capsule-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  width: 100%;
  max-width: 300px;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--panel);
  color: var(--text);
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}

/*
 * Scellée : le contenu n'est pas encore lisible. Le pointillé et le fond plus
 * doux le disent sans couleur d'alerte ; ce n'est pas un bouton, donc pas de
 * curseur de clic.
 */
.capsule-card.is-sealed {
  border-style: dashed;
  background: var(--panel-2);
  cursor: default;
}

.capsule-card__icone {
  display: inline-grid;
  place-items: center;
  color: var(--green);
  line-height: 0;
}

.capsule-card__icone svg {
  width: 18px;
  height: 18px;
}

.capsule-card.is-sealed .capsule-card__icone {
  color: var(--warn);
}

.capsule-card__titre {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

.capsule-card__quand {
  color: var(--text-meta);
  font-size: 12px;
  line-height: 1.4;
}

.capsule-card__texte {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.capsule-card__note {
  color: var(--text-faint);
  font-size: 11px;
  line-height: 1.4;
}

/* --------------------------- Formulaire de capsule ------------------------ */

.capsule-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.capsule-form__presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.capsule-form__preset {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
  transition: background 0.12s, color 0.12s;
}

.capsule-form__preset:hover {
  background: var(--hover);
  color: var(--text);
}

/* Libellé au-dessus du contrôle : la couleur et la taille s'appliquent au
   libellé, les contrôles reprennent les leurs explicitement. */
.capsule-form__champ {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
  color: var(--text-soft);
  font-size: 12.5px;
  line-height: 1.3;
}

.capsule-form__champ textarea,
.capsule-form__champ input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

.capsule-form__champ textarea {
  min-height: 96px;
  max-height: 160px;
  resize: vertical;
}

.capsule-form__champ input[type='datetime-local'] {
  font-size: 13.5px;
}

.capsule-form__hint {
  margin: 0;
  color: var(--text-meta);
  font-size: 11.5px;
  line-height: 1.5;
}

/* -------------------------------- Moments --------------------------------- */

/*
 * Colonne de contenu de la fenêtre Moments. La classe peut aussi être passée
 * comme `className` de la fenêtre elle-même (précédent `.cr`) : `:not(.modal)`
 * évite alors d'imposer colonne et gap à la fenêtre, dont la mise en page
 * (`.modal`) reste inchangée.
 */
.moments:not(.modal) {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
  max-width: 100%;
}

.moments__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.moments__lead {
  flex: 1 1 250px;
  min-width: 0;
  margin: 0;
  color: var(--text-soft);
  font-size: 12.5px;
  line-height: 1.5;
}

/*
 * Base de 250 px : à 360 px de large (corps de fenêtre ≈ 324 px), le lead et
 * le bouton ne tiennent plus côte à côte et le bouton passe seul à la ligne,
 * aligné à droite. Sur bureau, les deux restent sur une ligne.
 */
.moments__head .btn {
  flex: none;
  margin-left: auto;
}

.moments__feed {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

.moments__empty {
  padding: var(--space-6) var(--space-3);
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.moment-carte {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--panel);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
}

.moment-carte:hover {
  background: var(--panel-2);
}

.moment-carte__image {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  background: var(--panel-3);
}

.moment-carte__image img {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: cover;
}

.moment-carte__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
  padding: var(--space-3);
}

.moment-carte__meta {
  overflow: hidden;
  color: var(--text-meta);
  font-size: 11.5px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.moment-carte__texte {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* -------------------------------- Publication ------------------------------ */

.moment-publier {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.moment-publier__photo {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.moment-publier__photo img {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: cover;
}

.moment-publier__legende {
  width: 100%;
  min-height: 76px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  resize: vertical;
}

.moment-destinataires {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 180px;
  padding: var(--space-1);
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.moment-destinataire {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  padding: 7px var(--space-2);
  border-radius: 7px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.12s;
}

.moment-destinataire:hover {
  background: var(--hover);
}

.moment-destinataire input {
  flex: none;
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--green);
}

.moment-destinataire > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/*
 * Au-delà de la limite de destinataires, le JS désactive les cases restantes :
 * la ligne reste lisible mais visiblement inerte.
 */
.moment-destinataire:has(input:disabled) {
  color: var(--text-faint);
  cursor: default;
}

.moment-destinataire:has(input:disabled):hover {
  background: none;
}

/* ------------------------------- Mouvement -------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .capsule-form__preset,
  .moment-carte,
  .moment-destinataire {
    transition: none;
  }
}
