/* Courrier : style « verre ». Un fond doux peint une seule fois, deux panneaux translucides posés dessus
   (la navigation à gauche, la vue à droite), des cartes plus opaques pour ce qu'on lit. Le flou réel
   (backdrop-filter) n'est payé que par les petits éléments flottants (menus, notifications, barre de
   sélection, barre d'onglets du téléphone) ; les grands panneaux sont une simple teinte translucide sur un
   fond déjà flou, ce qui ne coûte rien au défilement. Thème clair et sombre selon le système ; transparence
   réduite (préférence système) : surfaces pleines. */

:root {
  --fond: #e9edf4;
  --fond-a: #c9d6f2;
  --fond-b: #f3dcd2;
  --fond-c: #d5ecea;
  --verre: rgb(248 250 253 / .58);
  --verre-fort: rgb(252 253 255 / .74);
  --verre-bord: rgb(255 255 255 / .78);
  --verre-flottant: rgb(252 253 255 / .82);
  --carte: rgb(255 255 255 / .72);
  --carte-forte: rgb(255 255 255 / .9);
  --surface: #ffffff;
  --surface-2: rgb(240 243 248 / .9);
  --survol: rgb(255 255 255 / .62);
  --selection: rgb(226 233 255 / .95);
  --bordure: rgb(28 38 64 / .1);
  --texte: #141824;
  --texte-2: #4a5263;
  --texte-3: #727a8c;
  --accent: #2d5bea;
  --accent-doux: rgb(45 91 234 / .11);
  --rouge: #d12a2a;
  --rouge-doux: rgb(220 38 38 / .1);
  --gris: #9ca3af;
  --tri-fond: rgb(99 102 241 / .07);
  --tri-bord: rgb(99 102 241 / .2);
  --ombre: 0 1px 2px rgb(20 30 60 / .05), 0 6px 22px rgb(20 30 60 / .07);
  --ombre-panneau: 0 24px 60px -20px rgb(30 45 90 / .28), inset 0 1px 0 rgb(255 255 255 / .7);
  --ombre-flottant: 0 18px 50px -12px rgb(20 30 60 / .35);
  --rayon: 12px;
  --rayon-panneau: 24px;
  --rayon-carte: 16px;
  --serie-recus: #2a78d6;
  --serie-envoyes: #eb6834;
  --vert: #15803d;
  --sur-accent: #ffffff;
  --police: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --fond-haut: #dae0f0; /* teinte unie du haut du fond : barre d'état de Safari et de la web app */
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fond: #0b0f19;
    --fond-a: #1b2a55;
    --fond-b: #3a2140;
    --fond-c: #0f3a3d;
    --verre: rgb(20 25 38 / .62);
    --verre-fort: rgb(26 32 48 / .78);
    --verre-bord: rgb(255 255 255 / .08);
    --verre-flottant: rgb(30 36 54 / .86);
    --carte: rgb(36 43 62 / .62);
    --carte-forte: rgb(40 47 68 / .92);
    --surface: #1a1f2d;
    --surface-2: rgb(44 51 72 / .7);
    --survol: rgb(255 255 255 / .06);
    --selection: rgb(92 124 255 / .22);
    --bordure: rgb(255 255 255 / .09);
    --texte: #e8ebf2;
    --texte-2: #a7afc0;
    --texte-3: #7c8599;
    --accent: #7d9bff;
    --accent-doux: rgb(125 155 255 / .16);
    --rouge: #f87171;
    --rouge-doux: rgb(248 113 113 / .14);
    --gris: #6b7280;
    --tri-fond: rgb(129 140 248 / .1);
    --tri-bord: rgb(129 140 248 / .25);
    --ombre: 0 1px 2px rgb(0 0 0 / .3), 0 6px 22px rgb(0 0 0 / .25);
    --ombre-panneau: 0 24px 60px -20px rgb(0 0 0 / .6), inset 0 1px 0 rgb(255 255 255 / .06);
    --ombre-flottant: 0 18px 50px -12px rgb(0 0 0 / .7);
    --serie-recus: #3987e5;
    --serie-envoyes: #d95926;
    --vert: #4ade80;
    --sur-accent: #0b0f19;
    --fond-haut: #1f2643;
    color-scheme: dark;
  }
}

/* Transparence réduite ou contraste renforcé : surfaces pleines. */
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  :root { --verre: var(--surface); --verre-fort: var(--surface); --verre-flottant: var(--surface); --carte: var(--surface); }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
/* Safari (iOS 26) colore la barre d'état d'après le fond de html : une couleur unie, celle du haut du fond.
   Le body couvre toute la fenêtre et garde son propre fond : rien ne change à l'écran. */
html { background-color: var(--fond-haut); }
body {
  margin: 0;
  font: 14px/1.45 var(--police);
  color: var(--texte);
  background-color: var(--fond);
  /* Le fond : quelques taches de couleur très floues, peintes une fois (rien ne bouge derrière les panneaux). */
  background-image:
    radial-gradient(60vmax 45vmax at 8% 0%, var(--fond-a), transparent 70%),
    radial-gradient(50vmax 40vmax at 100% 18%, var(--fond-b), transparent 70%),
    radial-gradient(55vmax 45vmax at 70% 110%, var(--fond-c), transparent 70%),
    linear-gradient(160deg, color-mix(in srgb, var(--fond) 92%, #fff), var(--fond));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
kbd {
  display: inline-block; min-width: 1.5em; padding: 0 .35em; border: 1px solid var(--bordure);
  border-bottom-width: 2px; border-radius: 5px; font: 11px/1.6 var(--police); text-align: center;
  color: var(--texte-2); background: var(--carte);
}
.ic { width: 16px; height: 16px; flex: none; }
.discret { color: var(--texte-3); }

.appli {
  display: grid;
  grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
  gap: 12px;
  height: 100%;
  padding: 0 12px 12px;
}

/* --- Entrées de la navigation (dossiers, libellés, filtres) -------------- */

.entrees { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.entree {
  display: flex; align-items: center; gap: 11px; width: 100%; height: 36px; padding: 0 12px;
  border: 0; border-radius: 11px; background: none; text-align: left; color: var(--texte-2); font-weight: 520;
}
.entree:hover { background: var(--survol); color: var(--texte); }
.entree.actif { background: var(--carte-forte); color: var(--texte); font-weight: 620; box-shadow: var(--ombre); }
.entree.actif .ic { color: var(--accent); }
.entree-libelle { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compte { font-size: 12px; color: var(--texte-3); font-variant-numeric: tabular-nums; font-weight: 500; }
#filtres li:first-child .ic { color: var(--rouge); }
.pastille {
  display: inline-block; width: 9px; height: 9px; margin: 0 3px; flex: none; border-radius: 50%;
  background: var(--c, var(--gris)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c, var(--gris)) 20%, transparent);
}
.raccourcis {
  display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 14px; padding: 12px 12px 4px;
  border-top: 1px solid var(--bordure); font-size: 12px; color: var(--texte-3);
}
.raccourcis kbd + kbd { margin-left: 2px; }

/* --- Liste en cartes ------------------------------------------------------ */

.colonne-liste { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.liste-tete { display: flex; align-items: center; gap: 6px; padding: 2px 0 8px; }
.bouton-icone {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none;
  border: 0; border-radius: 11px; background: none; color: var(--texte-2);
}
.bouton-icone:hover, .bouton-icone.actif { background: var(--survol); color: var(--texte); }
.bouton-icone .ic { width: 18px; height: 18px; }
.menu { display: none; }
.recherche {
  flex: 1; display: flex; align-items: center; gap: 6px; min-width: 0; height: 42px; padding: 0 3px 0 12px;
  border: 1px solid var(--verre-bord); border-radius: 14px; background: var(--carte-forte); box-shadow: var(--ombre);
}
.recherche:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-doux); }
.recherche-icone { display: grid; color: var(--texte-3); }
.recherche input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; padding: 0; }
.recherche input::-webkit-search-cancel-button { cursor: pointer; }
.recherche:focus-within .indice { display: none; }
.filtres-avances {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 2px 10px;
  font-size: 12px; color: var(--texte-2);
}
.filtres-avances label { display: flex; flex-direction: column; gap: 3px; }
.filtres-avances label:first-child { grid-column: 1 / -1; }
.filtres-avances input {
  height: 34px; padding: 0 10px; border: 1px solid var(--bordure); border-radius: 10px; background: var(--carte-forte);
}
.liste-info {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 28px;
  padding: 0 4px 6px; font-size: 12px; color: var(--texte-3);
}
.liste-info .total { margin-right: auto; visibility: hidden; }
.puce-filtre {
  display: inline-flex; align-items: center; gap: 2px; max-width: 220px; padding: 1px 2px 1px 8px;
  border-radius: 999px; background: var(--accent-doux); color: var(--accent); font-weight: 550;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.puce-filtre button { display: grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; background: none; color: inherit; }
.puce-filtre button:hover { background: color-mix(in srgb, currentColor 15%, transparent); }
.puce-filtre .ic { width: 12px; height: 12px; }

.liste-defilement { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -6px; padding: 2px 6px 12px; scrollbar-width: thin; }
.messages { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.groupe {
  position: sticky; top: -2px; z-index: 1; justify-self: start; margin: 6px 0 -2px; padding: 3px 10px;
  border-radius: 999px; font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em;
  color: var(--texte-2); background: var(--verre-flottant); box-shadow: var(--ombre);
}
.message {
  position: relative; display: grid; grid-template-columns: 38px minmax(0, 1fr); column-gap: 12px; align-items: start;
  padding: 12px 14px 12px 12px; cursor: pointer; scroll-margin: 40px 0 8px;
  border: 1px solid var(--verre-bord); border-radius: var(--rayon-carte); background: var(--carte);
  box-shadow: 0 1px 2px rgb(20 30 60 / .04);
  /* Gros volumes : le navigateur ne met en page que les cartes visibles. */
  content-visibility: auto; contain-intrinsic-size: auto 96px;
  transition: background-color .12s, border-color .12s, box-shadow .12s;
}
.message > .zone-choix { margin-top: 1px; }
.message-corps { min-width: 0; }
.message::before {
  content: ""; position: absolute; left: -1px; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--boite, transparent); opacity: .8;
}
.message:hover { background: var(--carte-forte); box-shadow: var(--ombre); }
.message[aria-selected="true"] {
  background: var(--carte-forte); border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 8px 24px -10px color-mix(in srgb, var(--accent) 60%, transparent);
}
.ligne-haut { display: flex; align-items: center; gap: 8px; }
.correspondant {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600;
  display: flex; align-items: center; gap: 6px;
}
.point-non-lu { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-doux); }
.message.non-lu .correspondant { font-weight: 720; }
.message.non-lu .sujet { font-weight: 650; color: var(--texte); }
.prefixe { color: var(--texte-3); font-weight: 500; }
.marques { display: inline-flex; gap: 4px; color: var(--texte-3); }
.marques .ic { width: 14px; height: 14px; }
.marque-urgent { color: var(--rouge); display: inline-grid; }
.marque-pj { display: inline-grid; }
.message time { flex: none; font-size: 12px; color: var(--texte-3); font-variant-numeric: tabular-nums; }
.message.urgent time { color: var(--rouge); font-weight: 600; }
.ligne-sujet { display: flex; align-items: center; gap: 8px; margin-top: 3px; min-width: 0; }
.sujet { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--texte-2); font-weight: 550; }
.puce-categorie {
  display: inline-flex; align-items: center; gap: 1px; flex: none; padding: 0 8px 0 3px; border-radius: 999px;
  font-size: 11px; font-weight: 600; line-height: 19px; color: var(--texte-2); background: var(--surface-2);
}
.puce-categorie .pastille { width: 7px; height: 7px; box-shadow: none; }
.resume {
  margin-top: 4px; color: var(--texte-3); font-size: 13px;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.vide-liste, .erreur-liste { padding: 40px 24px; text-align: center; color: var(--texte-3); list-style: none; }
.erreur-liste { color: var(--rouge); display: grid; gap: 12px; justify-items: center; }
.squelette {
  display: grid; gap: 8px; padding: 16px; border: 1px solid var(--verre-bord); border-radius: var(--rayon-carte);
  background: var(--carte); list-style: none;
}
.squelette span { height: 10px; border-radius: 5px; background: color-mix(in srgb, var(--texte) 9%, transparent); animation: pulse 1.2s ease-in-out infinite; }
.squelette span:nth-child(1) { width: 45%; }
.squelette span:nth-child(3) { width: 80%; }
@keyframes pulse { 50% { opacity: .45; } }
.sentinelle { height: 1px; }

/* --- Lecture ----------------------------------------------------------- */

.lecture-vide, .lecture-chargement {
  display: grid; place-content: center; justify-items: center; gap: 4px; height: 100%;
  padding: 24px; text-align: center; color: var(--texte-2);
}
.lecture-vide > .ic { width: 40px; height: 40px; color: var(--texte-3); stroke-width: 1.4; margin-bottom: 8px; }
.lecture-vide p { margin: 0; }
.message-ouvert { max-width: 920px; margin: 0 auto; padding: 18px 26px 40px; }
.barre-outils { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.retour { display: none; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.bouton {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 13px;
  border: 1px solid var(--bordure); border-radius: 10px; background: var(--carte-forte); color: var(--texte-2);
  font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap;
}
.bouton:hover { color: var(--texte); background: var(--survol); }
.bouton.actif { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--bordure)); background: var(--accent-doux); }
.bouton .ic { width: 15px; height: 15px; }
.lecture-tete h1 { margin: 6px 0 10px; font-size: 22px; line-height: 1.25; letter-spacing: -.015em; overflow-wrap: anywhere; }
.etiquettes { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.etiquette {
  display: inline-flex; align-items: center; gap: 3px; padding: 2px 9px 2px 5px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--texte-2);
}
.etiquette.discret { padding-left: 9px; font-weight: 500; color: var(--texte-3); }
.etiquette.urgent { color: var(--rouge); background: var(--rouge-doux); }
.etiquette .ic { width: 13px; height: 13px; }
.entetes {
  display: grid; gap: 3px; margin: 0 0 16px; padding: 12px 14px; border: 1px solid var(--verre-bord);
  border-radius: 14px; background: var(--carte-forte); font-size: 13px;
}
.entete { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 8px; }
.entete dt { color: var(--texte-3); }
.entete dd { margin: 0; overflow-wrap: anywhere; color: var(--texte-2); }
.lien-adresse { padding: 0; border: 0; background: none; text-align: left; color: var(--texte-2); }
.lien-adresse strong { color: var(--texte); }
.lien-adresse:hover strong { color: var(--accent); text-decoration: underline; }

.tri {
  display: grid; gap: 10px; margin-bottom: 16px; padding: 14px 16px 10px; border: 1px solid var(--tri-bord);
  border-radius: var(--rayon); background: var(--tri-fond);
}
.tri-ligne { display: grid; grid-template-columns: 18px 1fr; gap: 10px; }
.tri-ligne > .ic { margin-top: 2px; color: var(--accent); }
.tri-ligne.afaire > .ic { color: var(--rouge); }
.tri-ligne strong { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--texte-2); }
.tri-ligne p { margin: 1px 0 0; }
.tri-source { margin: 0; font-size: 11px; color: var(--texte-3); text-align: right; }

.pieces-jointes { margin-bottom: 16px; }
.pieces-jointes h2 { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--texte-2); }
.pieces-jointes ul { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.pieces-jointes a {
  display: inline-flex; align-items: center; gap: 8px; max-width: 320px; padding: 8px 10px;
  border: 1px solid var(--bordure); border-radius: var(--rayon); background: var(--surface);
  color: var(--texte); text-decoration: none;
}
.pieces-jointes a:hover { border-color: var(--accent); }
.pieces-jointes a .ic:first-child { color: var(--accent); }
.pieces-jointes a .ic:last-child { color: var(--texte-3); }
.pj-nom { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.pj-taille { flex: none; font-size: 12px; color: var(--texte-3); }

.corps { border: 1px solid var(--bordure); border-radius: 16px; overflow: hidden; background: var(--carte-forte); box-shadow: var(--ombre); }
.corps-html { display: block; width: 100%; height: 400px; border: 0; background: #fff; color-scheme: light; }
.corps-texte {
  padding: 18px 20px; white-space: pre-wrap; overflow-wrap: anywhere;
  font: 14px/1.6 var(--police); background: var(--surface); color: var(--texte);
}

/* --- Coquille : navigation, panneau principal, en-tête de la vue -------------------- */

.coquille {
  display: grid; grid-template-columns: 252px minmax(0, 1fr); gap: 14px;
  height: 100dvh; padding: 14px;
}
.navigation, .principal {
  min-height: 0; border: 1px solid var(--verre-bord); border-radius: var(--rayon-panneau);
  background: var(--verre); box-shadow: var(--ombre-panneau);
}
.navigation { display: flex; flex-direction: column; padding: 16px 12px 12px; }
.nav-tete { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 16px; }
.marque {
  display: flex; align-items: center; gap: 10px; color: var(--texte); text-decoration: none;
  font-weight: 720; font-size: 18px; letter-spacing: -.02em;
}
.marque img { border-radius: 9px; box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--accent) 70%, transparent); }
.nav-fermer { display: none; }
.bouton.nouveau {
  justify-content: flex-start; gap: 10px; height: 42px; margin: 0 2px 6px; padding: 0 14px; border: 0; border-radius: 13px;
  background: color-mix(in srgb, var(--accent) 16%, var(--carte)); color: var(--accent); font-size: 14px; font-weight: 650;
}
.bouton.nouveau:hover { background: var(--accent); color: var(--sur-accent); }
.nav-defilement { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -6px; padding: 0 6px; scrollbar-width: thin; }
.nav-titre {
  margin: 18px 12px 6px; font-size: 12.5px; font-weight: 650; color: var(--texte-3); letter-spacing: .01em;
}
.onglets { display: grid; gap: 2px; }
.onglet {
  position: relative; display: flex; align-items: center; gap: 11px; height: 40px; padding: 0 12px; border-radius: 12px;
  color: var(--texte-2); font-weight: 560; text-decoration: none; white-space: nowrap;
}
.onglet:hover { background: var(--survol); color: var(--texte); }
.onglet.actif { background: var(--carte-forte); color: var(--accent); font-weight: 650; box-shadow: var(--ombre); }
.onglet .ic { width: 18px; height: 18px; }
.onglet span { flex: 1; }
.badge-onglet {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: 11px; font-weight: 700; line-height: 20px;
  text-align: center; color: var(--texte-2); background: var(--surface-2); font-variant-numeric: tabular-nums;
}
.onglet.actif .badge-onglet { background: var(--accent-doux); color: var(--accent); }
.badge-onglet.urgent { background: var(--rouge); color: #fff; }
.nav-pied { padding-top: 10px; margin-top: 8px; border-top: 1px solid var(--bordure); }
.profil {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px; border: 0; border-radius: 14px;
  background: none; text-align: left; color: var(--texte-2);
}
.profil:hover { background: var(--survol); }
.profil-avatar { width: 38px; height: 38px; font-size: 13px; }
.profil-texte { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.profil-texte strong { color: var(--texte); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profil-texte span { font-size: 12px; color: var(--texte-3); }
.nav-pied .panneau { top: auto; bottom: calc(100% + 6px); left: 0; right: auto; }
.voile { display: none; }

.principal { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.tete-vue {
  display: flex; align-items: center; gap: 14px; min-width: 0; margin: 12px 12px 12px; padding: 10px 10px 10px 18px;
  border: 1px solid var(--verre-bord); border-radius: 18px; background: var(--verre-fort);
}
.ouvrir-navigation { display: none; }
.tete-titre { min-width: 0; flex: none; }
.tete-titre h1 { margin: 0; font-size: 19px; line-height: 1.2; letter-spacing: -.02em; font-weight: 720; }
.tete-titre p { margin: 1px 0 0; min-height: 1.2em; font-size: 12.5px; color: var(--texte-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tete-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.tete-actions .bouton-icone { background: var(--carte-forte); box-shadow: var(--ombre); }
.nouveau-court { display: none !important; }

.bouton.primaire { background: var(--accent); border-color: var(--accent); color: var(--sur-accent); font-weight: 600; }
.bouton.primaire:hover { background: color-mix(in srgb, var(--accent) 88%, #000); color: var(--sur-accent); }
.bouton.danger { color: var(--rouge); }
.bouton.danger:hover { background: var(--rouge-doux); }
.bouton.petit { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 9px; }
.bouton.large { width: 100%; justify-content: center; height: 40px; font-size: 14px; }
.bouton:disabled { opacity: .55; cursor: default; }
.bouton-icone.danger:hover { color: var(--rouge); background: var(--rouge-doux); }
.bouton-icone.petit { width: 30px; height: 30px; border-radius: 9px; }
.bouton-icone.petit .ic { width: 15px; height: 15px; }
.ancre { position: relative; }
.panneau {
  position: absolute; z-index: 30; top: calc(100% + 8px); right: 0; width: min(400px, calc(100vw - 24px));
  max-height: min(70dvh, 540px); overflow: auto; padding: 8px; border: 1px solid var(--verre-bord);
  border-radius: 16px; background: var(--verre-flottant); box-shadow: var(--ombre-flottant);
  -webkit-backdrop-filter: blur(22px) saturate(1.4); backdrop-filter: blur(22px) saturate(1.4);
}
.panneau.menu-compte { width: 250px; }
.menu-tete { display: grid; padding: 6px 10px 10px; border-bottom: 1px solid var(--bordure); margin-bottom: 4px; font-size: 13px; }
.menu-entree {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 10px;
  background: none; text-align: left;
}
.menu-entree:hover, .menu-entree:focus-visible { background: var(--survol); }
.indicateur { position: relative; color: var(--texte-2); }
.indicateur .badge {
  position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  font-size: 11px; font-weight: 700; line-height: 18px; color: #fff; background: var(--accent);
}
.indicateur.en-erreur .badge { background: var(--rouge); }
.panneau-tete { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px; }
.panneau-aide { margin: 2px 6px 8px; font-size: 12px; color: var(--texte-3); }
.liste-demandes { list-style: none; margin: 0; padding: 0; }
.demande { display: flex; align-items: center; gap: 8px; padding: 9px 6px; border-top: 1px solid var(--bordure); }
.demande-texte { flex: 1; min-width: 0; display: grid; gap: 1px; }
.demande-sujet { font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.demande-detail { display: flex; flex-wrap: wrap; gap: 0 8px; font-size: 12px; color: var(--texte-3); }
.demande-etat { color: var(--accent); }
.demande.erreur .demande-etat { color: var(--rouge); }
.demande-erreur { margin: 4px 0 0; font-size: 12px; color: var(--texte-2); overflow-wrap: anywhere; }
.demande-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

.filtre-adresses {
  display: flex; gap: 6px; min-width: 0; overflow-x: auto; scrollbar-width: none; padding: 2px;
}
.filtre-adresses::-webkit-scrollbar { display: none; }
.puce-adresse {
  display: inline-flex; align-items: center; gap: 6px; flex: none; height: 32px; padding: 0 13px 0 11px;
  border: 1px solid transparent; border-radius: 999px; background: var(--survol); color: var(--texte-2);
  font-size: 13px; font-weight: 560; white-space: nowrap;
}
.puce-adresse:first-child { padding-left: 13px; }
.puce-adresse:hover { background: var(--carte-forte); color: var(--texte); }
.puce-adresse.actif { border-color: color-mix(in srgb, var(--accent) 35%, transparent); background: var(--carte-forte); color: var(--accent); box-shadow: var(--ombre); }
.puce-adresse .pastille { margin: 0; }

.vues { position: relative; flex: 1; min-height: 0; }
.vue { height: 100%; min-height: 0; }

/* Panneaux de lecture : une carte plus opaque, à droite de la liste. */
.lecture {
  min-width: 0; min-height: 0; overflow-y: auto; outline: none; scrollbar-width: thin;
  border: 1px solid var(--verre-bord); border-radius: 20px; background: var(--carte);
}

/* Restes de l'ancienne vue Discussions, utilisés ailleurs : avatars, sélecteur, citations. */
.selecteur {
  height: 32px; max-width: 170px; padding: 0 8px; border: 1px solid var(--bordure); border-radius: 10px;
  background: var(--carte-forte); font-size: 13px;
}
.avatar {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 50%;
  background: hsl(var(--h, 230) 52% 48%); color: #fff; font-weight: 650; font-size: 15px; letter-spacing: .02em;
}
.avatar.grand { width: 40px; height: 40px; font-size: 14px; }
.avatar.moyen { width: 38px; height: 38px; font-size: 13px; }
.citation { margin: 4px 0 6px; font-size: 13px; }
.citation summary {
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 999px; cursor: pointer;
  list-style: none; color: var(--texte-3); background: color-mix(in srgb, var(--texte) 6%, transparent);
}
.citation summary::-webkit-details-marker { display: none; }
.citation summary .ic { width: 13px; height: 13px; }
.citation[open] summary { margin-bottom: 4px; }
.citation-texte { padding: 2px 0 2px 10px; border-left: 3px solid var(--bordure); color: var(--texte-2); white-space: pre-wrap; }
.pastille.mini { width: 6px; height: 6px; margin: 0; box-shadow: none; }

.etat-suppression {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 4px 0 10px; border-radius: 10px;
  background: var(--accent-doux); color: var(--accent); font-size: 13px; font-weight: 560;
}
.etat-suppression.erreur { background: var(--rouge-doux); color: var(--rouge); }
.etat-suppression .ic { width: 15px; height: 15px; }

/* --- Accueil -------------------------------------------------------------------------- */

.vue-accueil { overflow-y: auto; scrollbar-width: thin; }
.ac { padding: 0 12px 16px; }
.ac-grille { display: grid; gap: 14px; }
.ac-sections { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; }
.ac-tuile {
  position: relative; display: flex; align-items: flex-start; gap: 12px; min-width: 0; padding: 16px;
  border: 1px solid var(--verre-bord); border-radius: 18px; background: var(--carte); text-align: left; color: var(--texte);
  transition: background-color .15s, box-shadow .15s, transform .15s;
}
.ac-tuile:hover { background: var(--carte-forte); box-shadow: var(--ombre); transform: translateY(-1px); }
.ac-tuile-icone {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 12px;
  background: var(--accent-doux); color: var(--accent);
}
.ac-tuile-icone .ic { width: 20px; height: 20px; }
.ac-tuile.accent .ac-tuile-icone { background: var(--accent); color: var(--sur-accent); }
.ac-tuile.alerte .ac-tuile-icone { background: var(--rouge); color: #fff; }
.ac-tuile-texte { display: grid; min-width: 0; }
.ac-tuile-libelle { font-size: 13px; font-weight: 600; color: var(--texte-2); }
.ac-tuile-valeur { font-size: 26px; line-height: 1.15; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ac-tuile-detail { font-size: 12px; line-height: 1.35; color: var(--texte-3); display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ac-tuile-fleche { position: absolute; top: 16px; right: 14px; width: 15px; height: 15px; color: var(--texte-3); opacity: 0; transition: opacity .15s; }
.ac-tuile:hover .ac-tuile-fleche { opacity: 1; }
.ac-tuile.squelette { display: grid; height: 96px; }
.ac-colonnes { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.ac-pile { display: grid; gap: 14px; }
.ac-carte {
  display: flex; flex-direction: column; min-width: 0; padding: 14px 14px 10px;
  border: 1px solid var(--verre-bord); border-radius: 20px; background: var(--carte);
}
.ac-carte.squelette { height: 320px; }
.ac-carte-tete { display: flex; align-items: center; gap: 8px; padding: 2px 4px 10px; }
.ac-carte-tete h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.ac-carte-tete h2 .ic { width: 17px; height: 17px; color: var(--accent); }
.ac-compte {
  min-width: 22px; padding: 0 7px; border-radius: 11px; font-size: 12px; font-weight: 700; line-height: 22px; text-align: center;
  background: var(--accent-doux); color: var(--accent); font-variant-numeric: tabular-nums;
}
.ac-liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ac-liste li { position: relative; transition: opacity .2s, transform .2s; }
.ac-liste li.sortie { opacity: 0; transform: translateX(14px); }
.ac-liste li.avec-case { display: grid; grid-template-columns: 30px minmax(0, 1fr); align-items: start; gap: 2px; }
.ac-liste li.avec-case .case-fait { margin-top: 10px; }
.ac-mail {
  position: relative; display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 12px; width: 100%; padding: 9px 10px;
  border: 0; border-radius: 14px; background: none; text-align: left; color: var(--texte);
}
.ac-mail:hover { background: var(--carte-forte); }
.ac-mail-corps { display: grid; gap: 1px; min-width: 0; }
.ac-mail-haut { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ac-mail-de { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.ac-mail-haut time { flex: none; font-size: 12px; color: var(--texte-3); }
.ac-mail.urgent time { color: var(--rouge); font-weight: 600; }
.ac-mail-haut .marque-urgent .ic { width: 14px; height: 14px; }
.ac-mail-sujet { display: flex; align-items: center; gap: 2px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; color: var(--texte-2); font-weight: 550; }
.ac-mail-sujet .pastille { width: 7px; height: 7px; box-shadow: none; margin-left: 0; }
.ac-mail-resume { font-size: 12.5px; color: var(--texte-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-mail-action { display: flex; gap: 5px; align-items: flex-start; margin-top: 3px; padding: 5px 8px; border-radius: 9px; background: var(--tri-fond); font-size: 12.5px; color: var(--texte-2); }
.ac-mail-action .ic { width: 14px; height: 14px; margin-top: 2px; color: var(--accent); }
.ac-mail.urgent .ac-mail-action { background: var(--rouge-doux); }
.ac-mail.urgent .ac-mail-action .ic { color: var(--rouge); }
.ac-carte-pied { display: flex; justify-content: flex-end; padding-top: 6px; margin-top: 6px; border-top: 1px solid var(--bordure); }
.ac-lien {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 0; border-radius: 10px;
  background: none; color: var(--accent); font-size: 13px; font-weight: 650;
}
.ac-lien:hover { background: var(--accent-doux); }
.ac-lien .ic { width: 14px; height: 14px; }
.ac-vide { display: grid; justify-items: center; gap: 2px; padding: 26px 12px; text-align: center; color: var(--texte-2); }
.ac-vide > .ic { width: 30px; height: 30px; margin-bottom: 6px; color: var(--vert); stroke-width: 1.5; }
.ac-vide p { margin: 0; }
.ac-agenda { display: grid; gap: 10px; }
.ac-jour h3 { margin: 0 4px 6px; font-size: 12px; font-weight: 650; color: var(--texte-3); text-transform: uppercase; letter-spacing: .05em; }
.ac-jour ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ac-ev {
  display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 10px; padding: 8px 10px; border-radius: 12px;
  background: color-mix(in srgb, var(--c) 10%, transparent); border-left: 3px solid var(--c);
}
.ac-ev-heure { font-size: 12.5px; font-weight: 650; color: var(--texte-2); font-variant-numeric: tabular-nums; padding-top: 1px; }
.ac-ev-texte { display: grid; min-width: 0; }
.ac-ev-texte strong { font-weight: 620; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-ev-lieu { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--texte-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-ev-lieu .ic { width: 12px; height: 12px; }
.ac-erreur { margin: 8px 4px 0; font-size: 12px; color: var(--rouge); }

/* --- Dialogues, rédaction, notifications --------------------------------------- */

.dialogue {
  width: min(440px, calc(100vw - 24px)); padding: 22px; border: 1px solid var(--bordure); border-radius: 20px;
  background: var(--surface); color: var(--texte); box-shadow: 0 20px 60px rgb(0 0 0 / .3);
}
.dialogue::backdrop { background: rgb(12 16 28 / .35); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.dialogue h2 { margin: 0 0 8px; font-size: 17px; }
.dialogue p { margin: 0 0 12px; color: var(--texte-2); }
.dialogue-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.bouton.danger.primaire, .dialogue .bouton.danger { background: var(--rouge); border-color: var(--rouge); color: #fff; }
.champ { display: grid; gap: 4px; margin-bottom: 12px; font-size: 13px; color: var(--texte-2); }
.champ input, .r-champ input {
  height: 38px; padding: 0 10px; border: 1px solid var(--bordure); border-radius: 8px; background: var(--surface-2);
  color: var(--texte); font-size: 14px;
}
.champ input:focus, .r-champ input:focus, .r-corps:focus, .selecteur:focus {
  outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-doux); background: var(--surface);
}
.erreur-formulaire { margin: 0 0 12px; padding: 8px 10px; border-radius: 8px; background: var(--rouge-doux); color: var(--rouge); font-size: 13px; }

.dialogue-redaction { width: min(720px, calc(100vw - 24px)); padding: 0; }
.redaction { display: flex; flex-direction: column; max-height: min(88dvh, 820px); }
.r-tete { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 8px 20px; }
.r-tete h2 { margin: 0; }
.r-champs { display: grid; padding: 0 20px; border-bottom: 1px solid var(--bordure); }
.r-champ { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 4px 0; border-top: 1px solid var(--bordure); }
.r-champ input, .r-champ .selecteur { flex: 1; min-width: 0; height: 34px; max-width: none; border-color: transparent; background: none; padding: 0 6px; }
.r-libelle { width: 44px; flex: none; font-size: 13px; color: var(--texte-3); }
.r-ligne { display: flex; align-items: center; gap: 8px; }
.r-ligne .r-champ { flex: 1; }
.lien-discret { border: 0; background: none; color: var(--texte-3); font-size: 13px; padding: 4px 6px; }
.lien-discret:hover { color: var(--accent); }
.r-corps {
  flex: 1; min-height: 240px; margin: 0; padding: 14px 20px; border: 0; resize: none; background: var(--surface);
  color: var(--texte); font: 14px/1.6 var(--police);
}
.r-pieces { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0 20px; }
.r-pieces:not(:empty) { padding-bottom: 8px; }
.r-pieces li {
  display: inline-flex; align-items: center; gap: 6px; max-width: 280px; padding: 2px 2px 2px 8px;
  border: 1px solid var(--bordure); border-radius: 8px; font-size: 12px;
}
.r-alerte { display: flex; gap: 8px; margin: 0 20px 10px; padding: 10px 12px; border-radius: 10px; font-size: 13px; background: var(--rouge-doux); color: var(--rouge); }
.r-alerte.info { background: var(--accent-doux); color: var(--texte); }
.r-alerte .ic { margin-top: 2px; color: var(--accent); }
.r-alerte.erreur .ic { color: var(--rouge); }
.r-pied { display: flex; align-items: center; gap: 8px; padding: 10px 14px 12px 20px; border-top: 1px solid var(--bordure); }
.r-etat { flex: 1; min-width: 0; margin: 0; font-size: 12px; color: var(--texte-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.toasts {
  position: fixed; z-index: 50; left: 50%; bottom: 20px; transform: translateX(-50%);
  display: grid; gap: 8px; width: min(460px, calc(100vw - 24px)); pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-radius: 12px;
  background: rgb(24 28 40 / .88); color: #f3f4f6; box-shadow: var(--ombre-flottant); pointer-events: auto;
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  animation: monte .18s ease-out;
}
.toast.erreur { background: #7f1d1d; }
.toast.sortie { opacity: 0; transition: opacity .2s; }
.toast-texte { flex: 1; font-size: 13px; }
.toast-action { border: 0; background: none; color: #a5b4fc; font-weight: 700; padding: 6px 8px; border-radius: 6px; }
.toast-action:hover { background: rgb(255 255 255 / .08); }
.toast-fermer { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 6px; background: none; color: #9ca3af; }
@keyframes monte { from { transform: translateY(8px); opacity: 0; } }

/* --- Connexion ------------------------------------------------------------------ */

.page-connexion { display: block; overflow: auto; height: auto; min-height: 100dvh; background:
  radial-gradient(1200px 600px at 20% -10%, var(--accent-doux), transparent 60%), var(--fond); }
:root:has(> .page-connexion) { --fond-haut: #dbe2f3; }
@media (prefers-color-scheme: dark) {
  :root:has(> .page-connexion) { --fond-haut: #171e32; }
}
.connexion { display: grid; place-items: center; min-height: 100dvh; padding: 24px 16px; }
.carte-connexion {
  width: min(380px, 100%); padding: 32px 28px 24px; border: 1px solid var(--bordure); border-radius: 18px;
  background: var(--surface); box-shadow: var(--ombre); text-align: center;
}
.carte-connexion h1 { margin: 10px 0 2px; font-size: 22px; letter-spacing: -.02em; }
.carte-connexion > .discret { margin: 0 0 22px; }
.carte-connexion .champ { text-align: left; }
.champ-mdp { position: relative; display: block; }
.champ-mdp input { width: 100%; padding-right: 42px; }
.champ-mdp .bouton-icone { position: absolute; right: 3px; top: 2px; }
.pied-connexion { margin: 14px 0 0; font-size: 12px; }
/* Téléphone, écran tactile : 16 px au moins dans les champs (en dessous, iOS zoome à la saisie)
   et des cibles plus hautes. */
@media (max-width: 720px), (pointer: coarse) {
  .champ input { font-size: 16px; }
  .carte-connexion .champ input { height: 44px; }
  .carte-connexion .champ-mdp .bouton-icone { top: 4px; }
  .carte-connexion .bouton.large { height: 46px; font-size: 16px; }
}

/* --- Statistiques ------------------------------------------------------------------ */

.vue-stats { overflow-y: auto; }
.stats { max-width: 1100px; margin: 0 auto; padding: 0 12px 24px; }
.stats-tete { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.stats-tete h1 { margin: 0; font-size: 20px; letter-spacing: -.015em; }
.stats-reglages { display: flex; flex-wrap: wrap; gap: 8px; }
.segments { display: inline-flex; padding: 2px; border: 1px solid var(--bordure); border-radius: 9px; background: var(--surface-2); }
.segments button { height: 28px; padding: 0 11px; border: 0; border-radius: 7px; background: none; color: var(--texte-2); font-size: 13px; font-weight: 550; }
.segments button.actif { background: var(--surface); color: var(--texte); box-shadow: 0 1px 2px rgb(16 24 40 / .12); }
.tuiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.tuile { display: grid; gap: 2px; padding: 14px 16px; border: 1px solid var(--verre-bord); border-radius: 18px; background: var(--carte); }
.tuile-libelle { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--texte-2); }
.tuile-valeur { font-size: 24px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.carte { padding: 16px 18px; margin-bottom: 12px; border: 1px solid var(--verre-bord); border-radius: 20px; background: var(--carte); min-width: 0; }
.carte h2 { margin: 0 0 10px; font-size: 14px; }
.carte-tete { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.legende { display: flex; gap: 14px; list-style: none; margin: 0; padding: 0; font-size: 12px; color: var(--texte-2); }
.legende li { display: inline-flex; align-items: center; gap: 6px; }
.trait { display: inline-block; width: 14px; height: 3px; border-radius: 2px; background: var(--c, var(--gris)); }
.trait.recus { --c: var(--serie-recus); }
.trait.envoyes { --c: var(--serie-envoyes); }
.graphique { position: relative; min-height: 220px; }
.courbes { display: block; max-width: 100%; overflow: visible; }
.courbes .grille { stroke: var(--bordure); stroke-width: 1; }
.courbes .axe { stroke: color-mix(in srgb, var(--texte-3) 60%, transparent); stroke-width: 1; }
.courbes .graduation { fill: var(--texte-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.courbes .serie { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.courbes .serie.recus { stroke: var(--serie-recus); }
.courbes .serie.envoyes { stroke: var(--serie-envoyes); }
.courbes .point { stroke: var(--surface); stroke-width: 2; }
.courbes .point.recus { fill: var(--serie-recus); }
.courbes .point.envoyes { fill: var(--serie-envoyes); }
.courbes .etiquette-serie { fill: var(--texte-2); font-size: 12px; font-weight: 600; }
.courbes .repere { stroke: var(--texte-3); stroke-width: 1; stroke-dasharray: 3 3; }
.courbes .zone-survol { fill: transparent; cursor: crosshair; outline: none; }
.courbes .zone-survol:focus-visible { stroke: var(--accent); stroke-width: 2; }
.infobulle {
  position: absolute; z-index: 3; display: grid; gap: 3px; min-width: 150px; padding: 8px 10px; border: 1px solid var(--bordure);
  border-radius: 8px; background: var(--surface); box-shadow: var(--ombre); font-size: 12px; pointer-events: none;
}
.infobulle strong { font-size: 12px; }
.ligne-bulle { display: flex; align-items: center; gap: 6px; color: var(--texte-2); }
.ligne-bulle b { margin-left: auto; padding-left: 12px; color: var(--texte); font-variant-numeric: tabular-nums; }
.tableau-valeurs { margin-top: 8px; font-size: 13px; }
.tableau-valeurs summary { cursor: pointer; color: var(--texte-2); }
.tableau-defilement { max-height: 260px; overflow: auto; margin-top: 6px; }
.tableau-valeurs table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tableau-valeurs th, .tableau-valeurs td { padding: 4px 8px; border-bottom: 1px solid var(--bordure); text-align: right; }
.tableau-valeurs th:first-child { text-align: left; font-weight: 500; }
.grille-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.barres { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.barre-ligne {
  display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(60px, 1fr) auto; align-items: center; gap: 10px;
  width: 100%; padding: 5px 6px; border: 0; border-radius: 6px; background: none; text-align: left; font-size: 13px;
}
button.barre-ligne:hover { background: var(--survol); }
.barre-nom { display: flex; align-items: center; gap: 4px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barre-nom .pastille { width: 8px; height: 8px; }
.barre-piste { display: flex; gap: 2px; height: 10px; }
.barre-seg { width: var(--l); height: 100%; border-radius: 0 4px 4px 0; background: var(--c, var(--accent)); }
.barre-seg.recus { --c: var(--serie-recus); border-radius: 0; }
.barre-seg.envoyes { --c: var(--serie-envoyes); }
.barre-valeur { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.barre-valeur .discret { font-weight: 400; }

/* --- Organisation : À traiter, abonnements, liste noire, spams, épingles ------------------ */

.ligne-desabo { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0 0 12px; font-size: 13px; color: var(--texte-2); }
.ligne-desabo .ic { width: 14px; height: 14px; color: var(--texte-3); }
.ligne-desabo a { font-weight: 600; }
.etiquette.noire { color: var(--rouge); background: var(--rouge-doux); }


.bandeau-spam {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin: 0 0 16px; padding: 12px 14px;
  border: 1px solid color-mix(in srgb, #d97706 40%, var(--bordure)); border-radius: var(--rayon);
  background: color-mix(in srgb, #f59e0b 10%, var(--surface));
}
.bandeau-spam > .ic { width: 20px; height: 20px; color: #d97706; }
.bandeau-spam.juge { padding: 8px 12px; border-color: var(--bordure); background: var(--surface); font-size: 13px; }
.bandeau-spam.juge > .ic { width: 16px; height: 16px; color: var(--texte-3); }
.bandeau-spam p { margin: 0; color: var(--texte-2); }
.bandeau-spam.juge p { flex: 1; }
.bandeau-texte { flex: 1 1 220px; }
.bandeau-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.tri-ligne.fait > .ic { color: var(--vert); }
.tri-ligne.fait p { text-decoration: line-through; color: var(--texte-3); }
.tri-pied { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.tri-pied .tri-source { margin-left: auto; }

.menu-options { width: 260px; padding: 4px; }
.menu-entree { color: var(--texte); text-decoration: none; font-size: 13px; }
.menu-entree .ic { color: var(--texte-3); }
.menu-entree.danger, .menu-entree.danger .ic { color: var(--rouge); }
.menu-entree.seulement-mobile { display: none; }
.t-section.verifier .carte-traiter.urgent { border-left-color: #d97706; }

.marque-spam { display: inline-grid; color: #d97706; }

/* À traiter */
.vue-atraiter { display: grid; grid-template-columns: minmax(340px, 480px) minmax(0, 1fr); gap: 12px; padding: 0 12px 12px; }
.colonne-atraiter { display: flex; flex-direction: column; min-height: 0; }
.t-tete {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  padding: 0 2px 10px;
}
.t-resume { margin: 0; font-size: 13px; }
.t-titre h1 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.t-titre p { margin: 0; font-size: 12px; }
.t-liste { display: grid; gap: 14px; padding: 2px 0 24px; }
.t-section { display: grid; gap: 8px; }
.t-section h2 { display: flex; align-items: center; gap: 6px; margin: 4px 4px 0; font-size: 12px; font-weight: 650;
  text-transform: uppercase; letter-spacing: .06em; color: var(--texte-2); }
.t-section h2 .ic { width: 14px; height: 14px; color: var(--accent); }
.t-section.urgents h2 .ic { color: var(--rouge); }
.t-section.verifier h2 .ic { color: #d97706; }
.t-section h2 .compte { margin-left: 2px; }
.t-aide { margin: -4px 4px 2px; font-size: 12px; color: var(--texte-3); }
.carte-traiter {
  display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 8px; padding: 10px 12px 10px 8px;
  border: 1px solid var(--verre-bord); border-radius: var(--rayon-carte); background: var(--carte); cursor: pointer;
  transition: opacity .16s, transform .16s, background-color .12s;
}
.carte-traiter:hover { background: var(--carte-forte); box-shadow: var(--ombre); }
.carte-traiter.ouverte { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.carte-traiter.urgent { border-left: 3px solid var(--rouge); }
.carte-traiter.sortie { opacity: 0; transform: translateX(16px); }
.case-fait {
  position: relative; display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%;
  background: none; color: var(--texte-3);
}
.case-fait .ic { grid-area: 1 / 1; width: 20px; height: 20px; }
.case-fait .plein { opacity: 0; color: var(--vert); }
.case-fait:hover .vide, .case-fait:focus-visible .vide { opacity: 0; }
.case-fait:hover .plein, .case-fait:focus-visible .plein { opacity: 1; }
.case-fait.inerte { color: #d97706; }
.carte-corps { display: grid; gap: 3px; min-width: 0; }
.carte-haut { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; }
.carte-de { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--texte-2); font-weight: 550; }
.carte-haut time { flex: none; font-size: 12px; color: var(--texte-3); font-variant-numeric: tabular-nums; }
.carte-haut .marque-urgent .ic { width: 14px; height: 14px; }
.avatar.mini { width: 20px; height: 20px; font-size: 9px; }
.carte-sujet { font-weight: 650; overflow-wrap: anywhere; }
.carte-action { display: flex; gap: 6px; margin: 2px 0 0; padding: 6px 8px; border-radius: 8px; background: var(--tri-fond); font-size: 13px; }
.carte-action .ic { width: 15px; height: 15px; margin-top: 2px; color: var(--accent); }
.urgent .carte-action { background: var(--rouge-doux); }
.urgent .carte-action .ic { color: var(--rouge); }
.carte-resume { margin: 0; font-size: 13px; color: var(--texte-2); }
.carte-pied { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 2px; font-size: 11px; color: var(--texte-3); }
.carte-boutons { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.t-vide { display: grid; justify-items: center; gap: 4px; padding: 48px 16px; text-align: center; }
.t-vide > .ic { width: 40px; height: 40px; color: var(--vert); stroke-width: 1.4; margin-bottom: 6px; }
.t-vide p { margin: 0; }
.t-anciens {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px;
  border: 1px dashed var(--bordure); border-radius: var(--rayon); font-size: 13px; color: var(--texte-2);
}
.t-anciens p { margin: 0; }
.t-anciens-actions { display: flex; gap: 6px; }
.t-faits { font-size: 13px; }
.t-faits summary { padding: 4px; cursor: pointer; color: var(--texte-2); }
.t-faits ul { list-style: none; margin: 4px 0 0; padding: 0; }
.t-faits li { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-top: 1px solid var(--bordure); }
.t-faits li > .ic { width: 15px; height: 15px; color: var(--vert); }
.lien-fait { flex: 1; min-width: 0; padding: 0; border: 0; background: none; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fait-sujet { text-decoration: line-through; color: var(--texte-2); }


/* Liste noire, filtres enregistrés */
.dialogue-large { width: min(620px, calc(100vw - 24px)); }
.ln-tete { display: flex; align-items: center; justify-content: space-between; }
.ln-tete h2 { margin: 0; }
.ln-aide { margin: 4px 0 10px; font-size: 13px; }
.ln-filtre {
  width: 100%; height: 34px; margin-bottom: 8px; padding: 0 10px; border: 1px solid var(--bordure); border-radius: 8px;
  background: var(--surface-2);
}
.ln-compte { margin: 0 0 4px; font-size: 12px; color: var(--texte-3); }
.ln-liste { list-style: none; margin: 0; padding: 0; max-height: min(55dvh, 460px); overflow: auto; }
.ln-ligne { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-top: 1px solid var(--bordure); }
.ln-texte { flex: 1; min-width: 0; display: grid; gap: 1px; }
.ln-adresse { font-weight: 600; overflow-wrap: anywhere; }
.ln-detail { display: flex; flex-wrap: wrap; gap: 0 10px; font-size: 12px; color: var(--texte-3); }
.ln-source { padding: 0 6px; border-radius: 6px; font-weight: 600; background: var(--surface-2); color: var(--texte-2); }
.ln-source.ia { background: var(--tri-fond); color: var(--accent); }
.ln-raison { font-size: 12px; color: var(--texte-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ln-corps .vide-liste { display: grid; justify-items: center; gap: 6px; padding: 28px 12px; }
.ln-corps .vide-liste .ic { width: 28px; height: 28px; }
.ln-corps .vide-liste p { margin: 0; }
.adresse-forte { font-weight: 650; color: var(--texte) !important; overflow-wrap: anywhere; }
.case { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 4px; font-size: 13px; color: var(--texte-2); cursor: pointer; }
.case input { margin-top: 2px; accent-color: var(--accent); }
.dialogue .bouton.danger .ic { color: inherit; }
.entrees .avec-retrait { position: relative; }
.entrees .avec-retrait .entree { padding-right: 34px; }
.retrait {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 24px; height: 24px;
  padding: 0; border: 0; border-radius: 6px; background: none; color: var(--texte-3); opacity: 0;
}
.avec-retrait:hover .retrait, .retrait:focus-visible { opacity: 1; }
.retrait:hover { background: var(--rouge-doux); color: var(--rouge); }
.retrait .ic { width: 13px; height: 13px; }
.entree.ajouter { color: var(--accent); }
.aide-barre { padding: 4px 10px; font-size: 12px; color: var(--texte-3); }

/* --- Envoi : rédaction (puces, suggestions, dépôt), réponse rapide, bulles en cours d'envoi ---------- */

.redaction { position: relative; }
.r-ligne { border-top: 1px solid var(--bordure); }
.r-ligne .r-champ { border-top: 0; }
.r-adresses { position: relative; align-items: flex-start; }
.r-adresses .r-libelle { padding-top: 9px; }
.r-saisie { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 3px 0; cursor: text; }
.r-puces { display: contents; }
.r-puce {
  display: inline-flex; align-items: center; gap: 2px; max-width: 100%; height: 26px; padding: 0 2px 0 9px;
  border-radius: 999px; background: var(--accent-doux); color: var(--texte); font-size: 13px;
}
.r-puce > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-puce button { display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--texte-3); }
.r-puce button:hover { background: color-mix(in srgb, currentColor 15%, transparent); color: var(--texte); }
.r-puce button .ic { width: 12px; height: 12px; }
.r-puce.invalide { background: var(--rouge-doux); color: var(--rouge); }
.r-saisie input { flex: 1 1 120px; min-width: 120px; height: 28px; }
.r-saisie input:focus { border-color: transparent; box-shadow: none; background: none; }
.r-suggestions {
  position: absolute; z-index: 5; top: calc(100% - 2px); left: 54px; right: 0; max-height: 260px; overflow-y: auto;
  margin: 0; padding: 4px; list-style: none; border: 1px solid var(--bordure); border-radius: 10px;
  background: var(--surface); box-shadow: var(--ombre);
}
.r-suggestions li { display: grid; padding: 6px 10px; border-radius: 7px; cursor: pointer; }
.r-suggestions li.actif, .r-suggestions li:hover { background: var(--selection); }
.r-sugg-nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; }
.r-sugg-adresse { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--texte-3); }
.r-citation { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 6px 20px 8px; font-size: 13px; color: var(--texte-2); }
.r-citation .case { display: inline-flex; align-items: center; gap: 6px; }
.r-citation .case input { accent-color: var(--accent); }
.r-citation .citation { margin: 0; }
.r-citation .citation[open] { flex: 1 1 100%; }
.r-citation .citation-texte { max-height: 30vh; overflow-y: auto; }
.r-pieces li.r-pieces-total { border: 0; padding: 2px 4px; color: var(--texte-3); }
.r-pieces li.r-pieces-total.trop { color: var(--rouge); font-weight: 600; }
.r-depot {
  display: none; position: absolute; inset: 8px; z-index: 6; place-content: center; justify-items: center; gap: 8px;
  border: 2px dashed var(--accent); border-radius: 12px; background: color-mix(in srgb, var(--surface) 90%, transparent);
  color: var(--accent); font-weight: 600; pointer-events: none;
}
.redaction.depot .r-depot { display: grid; }
.r-depot .ic { width: 28px; height: 28px; }

.reponse-rapide {
  display: grid; gap: 8px; margin-top: 16px; padding: 12px 14px; border: 1px solid var(--verre-bord);
  border-radius: 18px; background: var(--carte-forte); box-shadow: var(--ombre);
}
.rr-tete { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--texte-3); }
.rr-tete .ic { width: 15px; height: 15px; }
.rr-puce { padding: 1px 10px; border-radius: 999px; background: var(--accent-doux); color: var(--texte); font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr-texte {
  width: 100%; min-height: 72px; max-height: 40vh; padding: 10px 12px; resize: vertical; border: 1px solid var(--bordure);
  border-radius: 12px; background: var(--surface); color: var(--texte); font: 14px/1.5 var(--police);
}
.rr-texte:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-doux); }
.rr-pied { display: flex; align-items: center; gap: 6px; }
.rr-envoyer .ic { width: 15px; height: 15px; }
.rr-aide { margin-left: auto; font-size: 12px; color: var(--texte-3); }
.rr-aide kbd { font-size: 10px; }
.rr-etat { margin: 0; font-size: 13px; color: var(--rouge); }
.rr-envois { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.rr-envois:empty { display: none; }
.rr-envoi {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 7px 10px; border-radius: 10px;
  background: var(--accent-doux); font-size: 13px;
}
.rr-envoi.etat-erreur { background: var(--rouge-doux); }
.rr-envoi-texte { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--texte-2); }
.rr-envoi-etat { display: inline-flex; align-items: center; gap: 4px; color: var(--texte-2); font-variant-numeric: tabular-nums; }
.rr-envoi-etat .ic { width: 13px; height: 13px; }
.rr-envoi.etat-envoye .rr-envoi-etat { color: var(--vert); }
.rr-envoi.etat-erreur .rr-envoi-etat { color: var(--rouge); }
.lien-envoi { padding: 2px 6px; border: 0; border-radius: 6px; background: none; color: var(--accent); font-size: 12px; font-weight: 650; }
.lien-envoi:hover { background: var(--accent-doux); }

@media (max-width: 720px) {
  .reponse-rapide { padding: 6px 8px 8px; }
  .rr-aide { display: none; }
  .r-citation { padding: 6px 14px 8px; }
  .r-suggestions { left: 0; }
  .r-pied .libelle { display: none; }
}

/* --- Écrans moyens : la navigation devient un rail d'icônes, qui s'ouvre en tiroir -------- */

@media (max-width: 1180px) {
  .coquille { grid-template-columns: 76px minmax(0, 1fr); gap: 10px; padding: 10px; }
  .navigation { padding: 14px 8px 10px; align-items: stretch; }
  .nav-tete { justify-content: center; padding: 0 0 12px; }
  .marque span, .onglet span, .bouton.nouveau .libelle, .nav-titre, .nav-mails, .profil-texte, .profil > .ic { display: none; }
  .bouton.nouveau { justify-content: center; padding: 0; margin: 0 4px 6px; }
  .onglet { justify-content: center; padding: 0; }
  .onglet .badge-onglet { position: absolute; top: 2px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; font-size: 10px; line-height: 17px; }
  .profil { justify-content: center; padding: 4px 0; }
  .menu { display: inline-grid; }
  .appli { grid-template-columns: minmax(300px, 360px) minmax(0, 1fr); }
  .vue-atraiter { grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); }
  .ac-colonnes { grid-template-columns: minmax(0, 1fr); }
  .nav-pied .panneau { left: 0; }

  /* Tiroir ouvert : la navigation complète, par-dessus. */
  body.nav-ouverte .navigation {
    position: fixed; z-index: 25; top: 10px; bottom: 10px; left: 10px; width: 280px; padding: 16px 12px 12px;
    background: var(--verre-flottant); box-shadow: var(--ombre-flottant);
    -webkit-backdrop-filter: blur(24px) saturate(1.4); backdrop-filter: blur(24px) saturate(1.4);
    animation: tiroir .18s ease-out;
  }
  body.nav-ouverte .navigation .marque span, body.nav-ouverte .onglet span, body.nav-ouverte .bouton.nouveau .libelle,
  body.nav-ouverte .nav-titre, body.nav-ouverte .profil-texte, body.nav-ouverte .profil > .ic { display: revert; }
  body.nav-ouverte .nav-mails:not([hidden]) { display: block; }
  body.nav-ouverte .nav-tete { justify-content: space-between; padding: 0 6px 16px; }
  body.nav-ouverte .nav-fermer { display: inline-grid; }
  body.nav-ouverte .bouton.nouveau { justify-content: flex-start; padding: 0 14px; margin: 0 2px 6px; }
  body.nav-ouverte .onglet { justify-content: flex-start; padding: 0 12px; }
  body.nav-ouverte .onglet .badge-onglet { position: static; }
  body.nav-ouverte .profil { justify-content: flex-start; padding: 6px; }
  .voile { display: block; position: fixed; inset: 0; z-index: 20; background: rgb(10 14 24 / .3); }
}
@keyframes tiroir { from { transform: translateX(-12px); opacity: 0; } }

@media (max-width: 900px) {
  .tete-vue { gap: 10px; padding-left: 14px; }
  .grille-stats { grid-template-columns: minmax(0, 1fr); }
  .tete-titre p { display: none; }
}

/* --- Téléphone : une colonne à la fois, onglets en bas ---------------------------------- */

@media (max-width: 720px) {
  .coquille { display: block; padding: 0; }
  .principal { height: 100dvh; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  /* La navigation est un tiroir hors de l'écran ; ses onglets restent en barre fixe en bas
     (pas de transform ni de filtre sur le tiroir : la barre resterait prisonnière de lui). */
  .navigation {
    position: fixed; z-index: 25; top: 0; bottom: 0; left: -320px; width: min(300px, 86vw);
    border-radius: 0 22px 22px 0; background: var(--verre-flottant); transition: left .2s ease;
  }
  body.nav-ouverte .navigation { left: 0; top: 0; bottom: 0; border-radius: 0 22px 22px 0; animation: none; }
  .navigation .marque span, .navigation .bouton.nouveau .libelle, .navigation .nav-titre,
  .navigation .profil-texte, .navigation .profil > .ic { display: revert; }
  .navigation .nav-mails:not([hidden]) { display: block; }
  .nav-tete { justify-content: space-between; padding: 6px 6px 16px; }
  .nav-fermer { display: inline-grid; }
  .bouton.nouveau { justify-content: flex-start; padding: 0 14px; margin: 0 2px 6px; }
  .profil { justify-content: flex-start; padding: 6px; }
  .navigation > .nav-defilement > .nav-titre:first-child { display: none; }
  .onglets {
    position: fixed; z-index: 15; inset: auto 8px calc(8px + env(safe-area-inset-bottom)) 8px; display: flex;
    justify-content: space-around; gap: 0; padding: 4px; border: 1px solid var(--verre-bord); border-radius: 22px;
    background: var(--verre-flottant); box-shadow: var(--ombre-flottant);
    -webkit-backdrop-filter: blur(20px) saturate(1.4); backdrop-filter: blur(20px) saturate(1.4);
  }
  .onglet { flex: 1; flex-direction: column; justify-content: center; gap: 2px; height: 52px; padding: 0 2px; font-size: 10.5px; border-radius: 17px; }
  .onglet span { display: inline; flex: none; }
  .onglet .ic { width: 21px; height: 21px; }
  .onglet.actif { box-shadow: none; }
  .onglet .badge-onglet { position: absolute; top: 3px; left: calc(50% + 5px); right: auto; }
  .onglet .badge-onglet:not(.urgent) { background: var(--accent); color: var(--sur-accent); }

  .tete-vue { margin: calc(8px + env(safe-area-inset-top)) 8px 8px; padding: 6px 6px 6px 4px; border-radius: 16px; gap: 6px; }
  .ouvrir-navigation { display: inline-grid; }
  .tete-titre h1 { font-size: 17px; }
  .filtre-adresses { flex: 1; }
  .puce-adresse { height: 30px; padding: 0 10px; font-size: 12px; }
  .puce-adresse .puce-nom { max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
  .nouveau-court { display: inline-grid !important; }
  body[data-vue="mails"] .filtre-adresses, body[data-vue="atraiter"] .filtre-adresses { display: none; }
  .vues { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }

  .appli { grid-template-columns: minmax(0, 1fr); padding: 0 8px 8px; }
  .vue-mails.mode-lecture .colonne-liste { display: none; }
  .vue-mails.mode-liste .lecture { display: none; }
  .vue-atraiter { grid-template-columns: minmax(0, 1fr); padding: 0 8px 8px; }
  .vue-atraiter.mode-lecture .colonne-atraiter { display: none; }
  .vue-atraiter:not(.mode-lecture) .lecture { display: none; }
  .retour { display: inline-grid; }
  .message-ouvert { padding: 8px 14px 32px; }
  .lecture-tete h1 { font-size: 19px; }
  .actions .bouton { padding: 0 9px; }
  .indice { display: none; }
  .raccourcis { display: none; }
  .t-liste { padding: 10px 2px 24px; }
  .retrait { opacity: 1; }
  .menu-entree.seulement-mobile { display: flex; }
  .stats { padding: 4px 8px 32px; }
  .tuile-valeur { font-size: 20px; }
  .ac { padding: 0 8px 16px; }
  .ac-sections { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .ac-tuile { padding: 12px; gap: 10px; flex-direction: column; }
  .ac-tuile-icone { width: 34px; height: 34px; }
  .ac-tuile-valeur { font-size: 22px; }
  .dialogue-redaction { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
  .redaction { height: 100%; max-height: none; }
  .r-champs { padding: 0 14px; }
  .r-corps { padding: 12px 14px; }
  .toasts { bottom: calc(86px + env(safe-area-inset-bottom)); }
}

/* --- Logos des expéditeurs : icône de la marque sur sa couleur, ou favicon sur fond blanc ---------- */

.avatar { position: relative; overflow: hidden; }
.avatar > img { position: absolute; inset: 22%; width: 56%; height: 56%; object-fit: contain; pointer-events: none; }
.avatar.avec-logo { background: var(--fond-logo, #fff); box-shadow: inset 0 0 0 1px rgb(16 24 40 / .1); }
.avatar.avec-logo .initiales { visibility: hidden; }
.avatar.logo-site { background: #fff; }
.avatar.logo-site > img { inset: 17%; width: 66%; height: 66%; }
.avatar.mini > img { inset: 18%; width: 64%; height: 64%; }
.avatar-vide { display: block; width: 28px; height: 28px; }
@media (prefers-color-scheme: dark) {
  /* Fond de marque presque noir (GitHub, X, Apple…) : un liseré pour qu'il se détache du thème sombre. */
  .avatar.avec-logo { box-shadow: inset 0 0 0 1px rgb(255 255 255 / .16); }
}

/* --- Sélection multiple : la case prend la place de l'avatar, barre d'actions flottante -------------- */

.zone-choix { position: relative; display: inline-grid; place-items: center; flex: none; }
.zone-choix > * { grid-area: 1 / 1; }
.zone-choix > .avatar, .zone-choix > .avatar-vide { transition: opacity .12s; }
.zone-choix .choix {
  z-index: 1; width: 18px; height: 18px; margin: 0; accent-color: var(--accent); cursor: pointer;
  opacity: 0; pointer-events: none; transition: opacity .12s;
}
.zone-choix.avec-avatar { cursor: pointer; }
.zone-choix.avec-avatar::before {
  content: ""; grid-area: 1 / 1; width: 100%; height: 100%; border-radius: 50%; background: var(--accent-doux); opacity: 0;
}
.en-selection .zone-choix .choix, .choisi .zone-choix .choix { opacity: 1; pointer-events: auto; }
.en-selection .zone-choix.avec-avatar > .avatar { opacity: .18; }
.choisi .zone-choix.avec-avatar > .avatar { opacity: 0; }
.choisi .zone-choix.avec-avatar::before { opacity: 1; }
@media (hover: hover) {
  .selectionnable:hover .zone-choix .choix { opacity: 1; pointer-events: auto; }
  .selectionnable:hover .zone-choix.avec-avatar > .avatar { opacity: .18; }
}
.carte-haut .zone-choix .choix { width: 15px; height: 15px; }
.message.choisi { background: var(--selection); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.carte-traiter.choisi { border-color: var(--accent); background: color-mix(in srgb, var(--accent-doux) 60%, var(--surface)); }
.ln-ligne { cursor: pointer; }
.ln-liste .zone-choix .choix { opacity: 1; pointer-events: auto; }
.ln-ligne.choisi { background: var(--selection); }

.barre-selection {
  position: fixed; z-index: 40; left: 50%; bottom: 20px; transform: translateX(-50%);
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; width: max-content; max-width: calc(100vw - 24px);
  padding: 6px 8px 6px 6px; border: 1px solid var(--verre-bord); border-radius: 18px; background: var(--verre-flottant);
  box-shadow: var(--ombre-flottant); font-size: 13px; animation: monte-centre .18s ease-out;
  -webkit-backdrop-filter: blur(22px) saturate(1.4); backdrop-filter: blur(22px) saturate(1.4);
}
@keyframes monte-centre { from { transform: translate(-50%, 8px); opacity: 0; } }
.en-selection .selectionnable { -webkit-user-select: none; user-select: none; }
.selectionnable { -webkit-tap-highlight-color: transparent; }
.selection-compte { font-weight: 650; white-space: nowrap; }
.selection-tout { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.selection-tout:empty { display: none; }
.lien-selection { padding: 4px 6px; border: 0; border-radius: 6px; background: none; color: var(--accent); font-size: 13px; font-weight: 600; }
.lien-selection:hover { background: var(--accent-doux); }
.selection-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.selection-actions:empty { display: none; }
.barre-selection.integree { position: static; transform: none; width: auto; max-width: none; margin-top: 10px; box-shadow: none; animation: none; }
body.avec-selection .toasts { bottom: 86px; }
/* Les derniers éléments d'une liste restent accessibles au-dessus de la barre. */
body.avec-selection .liste-defilement, body.avec-selection .fil-defilement { padding-bottom: 88px; }
.dialogue:focus-visible { outline: none; }
.t-tete .t-selection { margin-left: auto; }

@media (max-width: 720px) {
  .barre-selection { bottom: calc(66px + env(safe-area-inset-bottom)); width: calc(100vw - 16px); max-width: none; justify-content: space-between; }
  .barre-selection:not(.integree) .libelle-action { display: none; }
  .barre-selection .bouton.petit { height: 32px; padding: 0 10px; }
  body.avec-selection .toasts { bottom: calc(150px + env(safe-area-inset-bottom)); }
  body.avec-selection .liste-defilement, body.avec-selection .fil-defilement { padding-bottom: 140px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
