/* ═══ Espace Qualitest — la messagerie (21/11/2026) ═══
   Même matière que l'Espace (noir, verre, traits fins). Le mode clair retourne la page entière (clair.css) : les
   couleurs d'ici restent lisibles dans les deux. Ordre des plans : logiciel en grand 70 < checklist 76 < télécommande
   80 < déroulant 86 < porte 90 < Cloodine 110. */

/* ── Le bouton du bandeau ── */
.ms-bouton { position: relative; min-width: 38px; padding: 8px 10px; letter-spacing: 0; }
.ms-bouton svg { display: block; }
.ms-pastille { position: absolute; top: -5px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #ff3b30; color: #fff;
  font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; letter-spacing: 0; font-variant-numeric: tabular-nums; box-shadow: 0 0 0 2px #000; }
.plein-barre .ms-bouton { min-height: 34px; }

/* ── Le déroulant ── */
.ms-deroulant { position: fixed; z-index: 86; top: 64px; right: max(16px, env(safe-area-inset-right)); width: min(860px, calc(100vw - 32px));
  height: min(620px, calc(100dvh - 88px)); border-radius: 20px; overflow: hidden; background: rgba(12, 12, 14, .94); border: 1px solid #2a2b30;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .03) inset; -webkit-backdrop-filter: blur(26px) saturate(1.2); backdrop-filter: blur(26px) saturate(1.2);
  animation: ms-tombe .16s ease-out; }
@keyframes ms-tombe { from { opacity: 0; transform: translateY(-8px) scale(.99); } to { opacity: 1; transform: none; } }

/* ── L'écran de messages (déroulant ou onglet) ── */
.ms { display: grid; grid-template-columns: 290px minmax(0, 1fr); height: 100%; min-height: 0; color: var(--froid, #f2f2f2); font-size: 14px; position: relative; }
.ms-gauche { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid #222327; background: rgba(255, 255, 255, .015); }
.ms-tete-g { display: flex; align-items: center; gap: 6px; padding: 14px 12px 8px 16px; }
.ms-tete-g b { flex: 1; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.ms-mini { border: 1px solid #2e3035; background: rgba(255, 255, 255, .04); color: #e6e6e8; border-radius: 999px; padding: 5px 10px; font-size: 12px; cursor: pointer; line-height: 1.2; min-height: 30px; }
.ms-mini:hover { background: rgba(255, 255, 255, .1); border-color: #4a4c52; }
.ms-mini.ms-plein { background: #f2f2f2; color: #000; border-color: #f2f2f2; font-weight: 600; }
.ms-cherche { margin: 0 12px 8px; padding: 8px 12px; border-radius: 10px; border: 1px solid #26272b; background: rgba(255, 255, 255, .04); color: inherit; font: 14px var(--police, system-ui); outline: none; }
.ms-cherche:focus { border-color: #4a4c52; }
.ms-liste { flex: 1; min-height: 0; overflow-y: auto; padding: 2px 6px 10px; overscroll-behavior: contain; }
.ms-sep { font-size: 11px; color: #8b8d92; text-transform: uppercase; letter-spacing: .08em; padding: 12px 10px 4px; }
.ms-ligne { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 12px; background: none; color: inherit; text-align: left; cursor: pointer; }
.ms-ligne:hover { background: rgba(255, 255, 255, .05); }
.ms-ligne.on { background: rgba(255, 255, 255, .09); }
.ms-l-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ms-l-haut { display: flex; align-items: baseline; gap: 8px; }
.ms-l-haut b { flex: 1; min-width: 0; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-l-haut time { font-size: 11px; color: #8b8d92; flex: none; }
.ms-l-bas { font-size: 12.5px; color: #9a9ca2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-l-n { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #ff3b30; color: #fff; font-size: 11.5px; font-weight: 600; line-height: 20px; text-align: center; }
.ms-l-point { flex: none; width: 8px; height: 8px; border-radius: 50%; background: #8b8d92; }
.ms-rien { color: #8b8d92; font-size: 13px; text-align: center; padding: 24px 12px; margin: 0; }

.ms-av { position: relative; flex: none; width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; color: #fff; letter-spacing: .02em; }
.ms-av-g { background: #2a2c31; color: #d8d9dc; font-size: 16px; font-weight: 400; }
.ms-en-ligne { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; background: #34c759; box-shadow: 0 0 0 2px #0c0c0e; }

.ms-droite { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.ms-tete { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; border-bottom: 1px solid #222327; min-height: 58px; }
.ms-tete-av:empty { display: none; }
.ms-tete-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ms-tete-nom { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-tete-sous { font-size: 12px; color: #8b8d92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-retour { display: none; font-size: 18px; padding: 2px 11px 4px; }
.ms-tete-g [data-a="fermer"] { display: none; }

.ms-fil { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 16px 6px; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 3px; }
.ms-vide-d { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: #8b8d92; padding: 24px; text-align: center; }
.ms-vide-d svg { width: 34px; height: 34px; opacity: .6; }
.ms-vide-d p { margin: 4px 0; max-width: 360px; }
.ms-astuce { font-size: 12.5px; line-height: 1.45; color: #9a9ca2; }
.ms.ms-a-fil .ms-vide-d { display: none; }
.ms:not(.ms-a-fil) .ms-fil, .ms:not(.ms-a-fil) .ms-ecrire { display: none; }
.ms-jour { align-self: center; font-size: 11.5px; color: #8b8d92; padding: 10px 0 6px; text-transform: none; }
.ms-m { display: flex; align-items: flex-end; gap: 8px; max-width: 82%; margin-top: 8px; }
.ms-m.suite { margin-top: 0; }
.ms-m.moi { align-self: flex-end; flex-direction: row-reverse; }
.ms-m .ms-av { width: 28px; height: 28px; font-size: 11px; }
.ms-bulle { background: #1c1d21; border: 1px solid #26272c; border-radius: 16px; padding: 7px 11px 5px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ms-m.moi .ms-bulle { background: #2a5bd7; border-color: #2a5bd7; color: #fff; }
.ms-m.pour-moi .ms-bulle { border-color: #c7a23a; box-shadow: 0 0 0 1px rgba(199, 162, 58, .35); }
.ms-m.eclat .ms-bulle { animation: ms-eclat 2.2s ease-out; }
@keyframes ms-eclat { 0%, 30% { box-shadow: 0 0 0 3px rgba(255, 214, 92, .8); } 100% { box-shadow: 0 0 0 0 rgba(255, 214, 92, 0); } }
.ms-auteur { font-size: 12px; font-weight: 600; color: #c9cacf; }
.ms-texte { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.42; font-size: 14px; }
.ms-nom { font-weight: 700; }
.ms-heure { align-self: flex-end; font-size: 10.5px; color: rgba(255, 255, 255, .5); }
.ms-puce-t { margin-top: 4px; font-size: 11.5px; padding: 3px 8px; border-radius: 8px; background: rgba(255, 214, 92, .12); color: #ffd65c; align-self: flex-start; }
.ms-puce-t.fait { background: rgba(52, 199, 89, .12); color: #5fd47e; }

.ms-ecrire { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid #222327; }
.ms-ecrire textarea { flex: 1; resize: none; min-height: 40px; max-height: 140px; padding: 10px 14px; border-radius: 20px; border: 1px solid #2e3035; background: rgba(255, 255, 255, .04);
  color: inherit; font: 15px/1.35 var(--police, system-ui); outline: none; }
.ms-ecrire textarea:focus { border-color: #50535a; }
.ms-photo { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 1px solid #2e3035; background: rgba(255, 255, 255, .04); font-size: 17px; cursor: pointer; line-height: 1; }
.ms-photo:hover { background: rgba(255, 255, 255, .1); } .ms-photo:disabled { opacity: .6; cursor: progress; }
.ms-pieces { display: flex; gap: 8px; padding: 10px 12px 0; overflow-x: auto; border-top: 1px solid #222327; }
.ms-pieces + .ms-ecrire { border-top: 0; }
.ms-piece { position: relative; flex: none; }
.ms-piece img { display: block; height: 64px; max-width: 130px; object-fit: cover; border-radius: 10px; border: 1px solid #2e3035; cursor: zoom-in; }
.ms-piece-x { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: #f2f2f2; color: #000; font-size: 11px; cursor: pointer; line-height: 20px; padding: 0; }
.ms-imgs { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0; }
.ms-imgs img { display: block; max-width: min(260px, 100%); max-height: 200px; border-radius: 10px; cursor: zoom-in; background: #111; }
.ms-loupe { position: fixed; inset: 0; z-index: 140; background: rgba(0, 0, 0, .88); display: flex; align-items: center; justify-content: center; cursor: zoom-out; padding: 24px; }
.ms-loupe img { max-width: 100%; max-height: 100%; border-radius: 10px; box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }
.ms-envoyer { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; background: #2a5bd7; color: #fff; font-size: 18px; font-weight: 700; cursor: pointer; }
.ms-envoyer:disabled { opacity: .5; cursor: progress; }

.ms-groupe { position: absolute; inset: 0; z-index: 3; background: rgba(10, 10, 12, .97); display: flex; flex-direction: column; gap: 10px; padding: 18px; overflow-y: auto; }
.ms-groupe b { font-size: 16px; }
.ms-g-nom { padding: 10px 12px; border-radius: 10px; border: 1px solid #2e3035; background: rgba(255, 255, 255, .04); color: inherit; font: 15px var(--police, system-ui); outline: none; }
.ms-g-membres { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; }
.ms-g-m { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 10px; cursor: pointer; }
.ms-g-m:hover { background: rgba(255, 255, 255, .05); }
.ms-g-m .ms-av { width: 28px; height: 28px; font-size: 11px; }
.ms-g-actions { display: flex; gap: 8px; justify-content: flex-end; }
.ms-g-err { color: #ff6b6b; font-size: 13px; margin: 0; min-height: 1em; }

/* ── L'onglet « Messages » : le même écran, en grand ── */
.ms-vue { height: calc(100dvh - 190px); min-height: 420px; border-radius: 20px; overflow: hidden; border: 1px solid #222327; background: rgba(12, 12, 14, .6); }
.ms-vue .ms-seul-deroulant { display: none !important; }
.ms-rail-n { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #ff3b30; color: #fff; font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; }

/* ── La checklist « À faire » : en haut à droite, translucide, partout ── */
.ms-taches { position: fixed; z-index: 76; top: 70px; right: max(16px, env(safe-area-inset-right)); width: 300px; max-height: min(46vh, 420px); display: flex; flex-direction: column;
  border-radius: 16px; background: rgba(16, 16, 19, .9); border: 1px solid rgba(255, 255, 255, .09); color: #f2f2f2;
  -webkit-backdrop-filter: blur(16px) saturate(1.2); backdrop-filter: blur(16px) saturate(1.2); box-shadow: 0 14px 36px rgba(0, 0, 0, .4);
  opacity: .84; transition: opacity .15s, transform .2s; font-size: 13px; }
.ms-taches:hover, .ms-taches:focus-within { opacity: 1; }
.ms-taches.neuf { animation: ms-neuf 2.4s ease-out; opacity: 1; }
@keyframes ms-neuf { 0%, 25% { box-shadow: 0 0 0 2px rgba(255, 214, 92, .85), 0 14px 36px rgba(0, 0, 0, .4); } 100% { box-shadow: 0 14px 36px rgba(0, 0, 0, .4); } }
html.ms-ouvert .ms-taches { opacity: .35; pointer-events: none; }
html.ms-colonne .contenu { padding-right: 312px; }   /* sa place à elle : elle ne couvre aucun bouton de l'Espace */
html.ms-bande .contenu { padding-top: 50px; }   /* le déroulant passe devant, la liste s'efface */
.ms-t-tete { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 12px; border: 0; background: none; color: inherit; cursor: pointer; text-align: left; }
.ms-t-titre { flex: 1; font-weight: 600; font-size: 13px; letter-spacing: .01em; }
.ms-t-n { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #ffd65c; color: #000; font-size: 11.5px; font-weight: 700; line-height: 20px; text-align: center; }
.ms-taches.tout-fait .ms-t-n { background: #34c759; color: #000; }
.ms-t-pli { color: #8b8d92; transition: transform .15s; }
.ms-taches.plie .ms-t-pli { transform: rotate(-90deg); }
.ms-taches.plie .ms-t-liste, .ms-taches.plie .ms-t-ajout { display: none; }
.ms-taches.plie { width: auto; }
.ms-t-liste { list-style: none; margin: 0; padding: 0 6px; overflow-y: auto; min-height: 0; overscroll-behavior: contain; }
.ms-t { display: flex; align-items: flex-start; gap: 8px; padding: 7px 6px; border-top: 1px solid rgba(255, 255, 255, .06); }
.ms-t input { margin: 2px 0 0; width: 16px; height: 16px; accent-color: #34c759; flex: none; cursor: pointer; }
.ms-t-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.ms-t-quoi { line-height: 1.35; overflow-wrap: anywhere; }
.ms-t-de { font-size: 11px; color: #9a9ca2; line-height: 1.3; }
.ms-t.fait .ms-t-quoi { text-decoration: line-through; color: #8b8d92; }
.ms-t.fait .ms-t-de { color: #5fd47e; }
.ms-t-voir { flex: none; border: 0; background: none; color: #8b8d92; cursor: pointer; font-size: 13px; padding: 0 4px; line-height: 20px; }
.ms-t-voir:hover { color: #fff; }
.ms-t-ajout { padding: 6px 10px 10px; }
.ms-t-ajout input { width: 100%; padding: 7px 10px; border-radius: 9px; border: 1px solid rgba(255, 255, 255, .08); background: rgba(255, 255, 255, .04); color: inherit; font: 13px var(--police, system-ui); outline: none; }
.ms-t-ajout input:focus { border-color: rgba(255, 255, 255, .25); }

/* ── Le petit mot qui arrive (une seule notification, seulement quand on est concerné) ── */
.ms-toast { position: fixed; z-index: 96; top: 70px; left: 50%; transform: translateX(-50%); max-width: min(460px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 2px;
  padding: 10px 16px; border-radius: 16px; background: #f2f2f2; color: #000; box-shadow: 0 16px 40px rgba(0, 0, 0, .55); cursor: pointer; font-size: 13.5px; animation: ms-tombe .18s ease-out; }
.ms-toast b { font-size: 13px; }
.ms-toast span { color: #333; overflow-wrap: anywhere; }

/* ── Téléphone : une seule colonne (la liste, puis la conversation) ── */
@media (max-width: 760px) {
  .ms-deroulant { top: 60px; left: 8px; right: 8px; width: auto; height: calc(100dvh - 72px - env(safe-area-inset-bottom)); border-radius: 18px; }
  .ms { grid-template-columns: minmax(0, 1fr); }
  .ms-gauche { border-right: 0; }
  .ms.ms-a-fil .ms-gauche { display: none; }
  .ms:not(.ms-a-fil) .ms-droite { display: none; }
  .ms-retour { display: inline-block; }
  .ms-tete-g [data-a="fermer"] { display: inline-block; }
  .ms-tete-g [data-a="grand"] { display: none; }
  .ms-m { max-width: 90%; }
  .ms-vue { height: calc(100dvh - 190px); border-radius: 16px; }
  .ms-taches { top: 66px; right: 8px; width: min(300px, calc(100vw - 16px)); }
  html.ms-bande .contenu { padding-top: 56px; }
  .ms-toast { top: 64px; }
}
/* Les avis du CRM (22/11/2026) : leur lien vers le CRM */
.ms-lien-crm { margin-top: 4px; font-size: 12px; color: #73d9ff; align-self: flex-start; text-decoration: none; border-bottom: 1px dotted currentColor; }
