/* Coffre du chat chiffré (#1409) : la maquette validée (docs-transverses
   maquettes/pilot-chat-chiffre.html), jetons de PILOT. La fenêtre remplit
   l'iframe ; PILOT la place et la dimensionne selon le mode. */
@font-face{font-family:'DM Sans';font-style:normal;font-weight:100 1000;font-display:swap;src:url('/polices/dm-sans-latin.woff2') format('woff2-variations');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:'DM Sans';font-style:normal;font-weight:100 1000;font-display:swap;src:url('/polices/dm-sans-latin-ext.woff2') format('woff2-variations');unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}
:root{
  --police:'DM Sans',system-ui,-apple-system,sans-serif;
  --ink:#1e2c3c;--ink-fort:#172230;--muted:#5e6c7c;--muted-3:#8a94a1;
  --signal:#c74722;--bleu:#285c83;--bleu-clair:#3573a0;--succes:#377d6f;--alerte:#b57930;--danger:#b6443b;
  --ligne:#dce3e9;--ligne-douce:#edf0f4;--surface:#fff;--surface-2:#f7f9fb;--encre:#1e2c3c;
  --survol:#f1f4f7;--actif:#e8eff6;--outils:#fff;--outils-bord:#d3dbe3;--actif-texte:#285c83;--mention:#fff0e9;--mention-texte:#a63a1b;
  --rayon-sm:5px;--rayon:7px;--rayon-lg:10px;--rayon-xl:14px;
  color-scheme:light;
}
[data-theme=sombre]{
  --ink:#dfe6ee;--ink-fort:#f2f5f8;--muted:#9aa7b5;--muted-3:#76828f;
  --ligne:#2b3644;--ligne-douce:#232d39;--surface:#18212c;--surface-2:#1d2733;--encre:#0d141c;
  --survol:#1f2935;--actif:#22354a;--outils:#273340;--outils-bord:#36434f;--actif-texte:#9cc4e6;--mention:#3a2419;--mention-texte:#ffb595;
  color-scheme:dark;
}
*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%;background:transparent;overflow:hidden}
body{font-family:var(--police);color:var(--ink);font-size:14px;-webkit-font-smoothing:antialiased}
button,input,textarea{font:inherit;color:inherit}
button{cursor:pointer;border:0;background:none}
[hidden]{display:none !important}
.sprite{position:absolute}
svg.i{width:16px;height:16px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;flex:none}

.badge{display:inline-block;min-width:18px;height:18px;padding:0 5px;border-radius:9px;background:#e5322d;color:#fff;font-size:11px;font-weight:700;line-height:18px;text-align:center;flex:none}
.av{position:relative;width:32px;height:32px;border-radius:50%;display:grid;place-items:center;color:#fff;font-weight:700;font-size:12px;flex:none;letter-spacing:.02em}
.av.p{width:26px;height:26px;font-size:10.5px}
.tag{font-size:10px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;padding:1px 6px;border-radius:4px;background:#f6ead9;color:#8a5a1f;flex:none}
[data-theme=sombre] .tag{background:#3b2c18;color:#e9b877}
.ib{width:30px;height:30px;border-radius:var(--rayon);display:grid;place-items:center;color:var(--muted);flex:none}
.ib:hover{background:var(--survol);color:var(--ink-fort)}
.ib[aria-pressed=true]{background:var(--actif);color:var(--actif-texte)}
:focus-visible{outline:2px solid var(--bleu-clair);outline-offset:1px}

/* ---------- Fenêtre : elle remplit l'iframe ---------- */
.fen{position:fixed;inset:0;display:flex;flex-direction:column;background:var(--surface);overflow:hidden}
body.m-replie .fen{inset:0 auto auto 0;width:max-content;height:42px;background:var(--encre)}
.fen-barre{display:flex;align-items:center;gap:8px;height:42px;padding:0 6px 0 14px;background:var(--encre);color:#fff;flex:none;cursor:pointer;user-select:none}
.fen-barre .titre{font-weight:650;font-size:13px;display:flex;align-items:center;gap:8px;white-space:nowrap}
.fen-barre .esp{flex:1}
.fen-barre .ib{color:rgba(255,255,255,.8)}
.fen-barre .ib:hover{background:rgba(255,255,255,.12);color:#fff}
body.m-replie .coffre{display:none}
body.m-grand .b-grand,body.m-reduit .b-reduit,body.tel .b-grand,body.tel .b-reduit,body.m-replie .b-replier,body.m-replie .b-grand,body.m-replie .b-reduit{display:none}
.b-deplier{display:none}
body.m-replie .b-deplier{display:grid}
body.m-replie .fen-barre .esp{display:none}
.fen.pulse .fen-barre{animation:pulse-barre .9s ease 2}
@keyframes pulse-barre{50%{background:#2f4d6b}}
.fen-barre .total{display:none}
body.m-replie .fen-barre .total:not([hidden]){display:inline-block}

/* ---------- Coffre : volets ---------- */
.coffre{flex:1;display:flex;min-height:0;background:var(--surface);position:relative}
.volet-liste{width:290px;flex:none;display:flex;flex-direction:column;border-right:1px solid var(--ligne);background:var(--surface-2);min-height:0}
.volet-conv{flex:1;display:flex;flex-direction:column;min-width:0;min-height:0;position:relative}
.volet-membres{width:260px;flex:none;border-left:1px solid var(--ligne);display:none;flex-direction:column;background:var(--surface-2);min-height:0}
body.m-grand:not(.tel) .coffre.membres .volet-membres{display:flex}
body.m-reduit .volet-liste,body.tel .volet-liste{width:100%;border-right:0}
body.m-reduit .coffre:not(.vue-liste) .volet-liste,body.tel .coffre:not(.vue-liste) .volet-liste{display:none}
body.m-reduit .coffre.vue-liste .volet-conv,body.tel .coffre.vue-liste .volet-conv{display:none}
.b-retour{display:none}
body.m-reduit .b-retour,body.tel .b-retour{display:grid}
body.m-reduit .coffre.membres .volet-membres,body.tel .coffre.membres .volet-membres{display:flex;position:absolute;right:0;top:0;bottom:0;width:260px;z-index:20;box-shadow:-12px 0 30px rgba(19,35,59,.14)}

/* Liste des fils */
.l-tete{padding:12px 12px 8px;display:flex;flex-direction:column;gap:10px}
.l-tete .ligne-titre{display:flex;align-items:center;gap:6px}
.l-tete .ligne-titre b{font-size:14px;color:var(--ink-fort)}
.recherche{display:flex;align-items:center;gap:8px;padding:7px 10px;border:1px solid var(--ligne);border-radius:var(--rayon);background:var(--surface);color:var(--muted-3)}
.recherche input{flex:1;border:0;outline:0;background:none;min-width:0;font-size:13px;color:var(--ink)}
.recherche:focus-within{border-color:var(--bleu-clair);box-shadow:0 0 0 3px rgba(53,115,160,.15)}
.l-corps{flex:1;overflow:auto;padding:0 8px 12px}
.sect{display:flex;align-items:center;gap:6px;padding:12px 8px 6px;font-size:10.5px;font-weight:750;text-transform:uppercase;letter-spacing:.07em;color:var(--muted-3)}
.sect .esp{flex:1}
.sect small{text-transform:none;letter-spacing:0;font-weight:500;font-size:11px}
.b-nouvelle{display:inline-grid;place-items:center;width:26px;height:26px;padding:0;border-radius:50%;background:var(--bleu);color:#fff;box-shadow:0 1px 3px rgba(40,92,131,.3);transition:background .15s}
.b-nouvelle:hover{background:var(--bleu-clair)}
.b-nouvelle svg{width:15px;height:15px;stroke-width:2.6}
.vide-liste{padding:6px 8px;font-size:12.5px;color:var(--muted-3)}
.fil{width:100%;display:flex;align-items:center;gap:10px;padding:8px;border-radius:var(--rayon);text-align:left;position:relative}
.fil:hover{background:var(--survol)}
.fil[aria-current=true]{background:var(--actif)}
.fil .trait{width:4px;align-self:stretch;border-radius:3px;flex:none;margin:2px 0}
.fil .corps-fil{flex:1;min-width:0}
.fil .l1{display:flex;align-items:baseline;gap:6px}
.fil .nom{font-weight:600;font-size:13.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--ink-fort)}
.fil .quand{margin-left:auto;font-size:11px;color:var(--muted-3);flex:none}
.fil .l2{display:flex;align-items:center;gap:6px;margin-top:2px}
.fil .apercu{font-size:12.5px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1}
.fil.nonlu .nom{font-weight:750}
.fil.nonlu .apercu{color:var(--ink);font-weight:550}
.sq{display:block;border-radius:6px;background:var(--survol);animation:sq-pulse 1.4s ease-in-out infinite}
.sq-fil:hover{background:none}
.sq-fil .trait.sq{border-radius:3px}
.sq-l1{height:11px;width:58%}
.sq-l2{height:9px;width:82%;margin-top:7px}
@keyframes sq-pulse{50%{opacity:.45}}
@media (prefers-reduced-motion:reduce){.sq{animation:none}}
.l-pied{padding:10px 14px;border-top:1px solid var(--ligne);font-size:11.5px;color:var(--muted-3);display:flex;gap:7px;align-items:flex-start;line-height:1.4}
.l-pied svg{width:13px;height:13px;margin-top:1px;color:var(--succes)}
.personne{width:100%;display:flex;align-items:center;gap:10px;padding:8px;border-radius:var(--rayon);text-align:left}
.personne:hover{background:var(--survol)}
.personne .nom{font-weight:600;font-size:13.5px;color:var(--ink-fort)}
.personne small{display:block;font-size:12px;color:var(--muted)}
.personne .tag{margin-left:auto}

/* En-tête de conversation */
.c-tete{display:flex;align-items:center;gap:10px;min-height:58px;padding:8px 10px 8px 14px;border-bottom:1px solid var(--ligne);flex:none}
.c-tete .ident{flex:1;min-width:0}
.c-tete .ident b{display:flex;align-items:center;gap:7px;font-size:15px;font-weight:700;color:var(--ink-fort);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.c-tete .ident small{display:flex;align-items:center;gap:5px;font-size:12px;color:var(--muted);margin-top:1px}
.c-tete .carre{width:30px;height:30px;border-radius:8px;display:grid;place-items:center;color:#fff;font-weight:750;font-size:13px;flex:none}
.pile{display:flex;margin-right:4px}
.pile .av{width:24px;height:24px;font-size:9.5px;box-shadow:0 0 0 2px var(--surface);margin-left:-6px}
.pile .av:first-child{margin-left:0}
body.m-reduit .pile,body.tel .pile{display:none}
.bandeau-etat{display:flex;align-items:center;gap:8px;padding:7px 14px;font-size:12.5px;background:#fdf5ea;color:#7a5222;border-bottom:1px solid #ecd9bd}
[data-theme=sombre] .bandeau-etat{background:#2e2416;color:#e9c48e;border-color:#4a3a22}
.bandeau-etat svg{width:14px;height:14px}

/* Fil des messages */
.flux{flex:1;overflow:auto;padding:10px 0 6px}
.plus-anciens{display:block;margin:4px auto 8px;font-size:12px;font-weight:650;color:var(--bleu-clair);text-decoration:underline}
.jour{display:flex;align-items:center;gap:12px;margin:10px 18px 6px;font-size:11.5px;font-weight:650;color:var(--muted-3)}
.jour::before,.jour::after{content:"";flex:1;height:1px;background:var(--ligne)}
.nouveaux{display:flex;align-items:center;gap:10px;margin:8px 18px;font-size:11px;font-weight:750;color:var(--signal);text-transform:uppercase;letter-spacing:.05em}
.nouveaux::after{content:"";flex:1;height:1px;background:var(--signal);opacity:.5}
.grp{display:flex;gap:11px;padding:6px 18px 2px}
.grp .av{margin-top:2px}
.grp .contenu{flex:1;min-width:0}
.grp .ent{display:flex;align-items:baseline;gap:7px;margin-bottom:1px}
.grp .ent b{font-weight:700;font-size:13.5px;color:var(--ink-fort)}
.grp .ent .role{font-size:11.5px;color:var(--muted-3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.grp .ent time{font-size:11px;color:var(--muted-3);flex:none}
.m{position:relative;margin:0 -18px 0 -61px;padding:2px 18px 2px 61px}
.m:hover{background:var(--survol)}
.m .txt{font-size:14px;line-height:1.5;color:var(--ink);white-space:pre-wrap;overflow-wrap:anywhere}
.m .hsurvol{position:absolute;left:14px;top:5px;font-size:10.5px;color:var(--muted-3);display:none;width:40px;text-align:right}
.m:not(.premier):hover .hsurvol{display:block}
/* Le premier message porte l'en-tête : sa bande remonte jusqu'au haut du
   groupe, et l'avatar reste AU-DESSUS de la bande au lieu d'être coupé. */
.m.premier{margin-top:-6px;padding-top:6px}
.grp .av{z-index:1}
.m .modif{font-size:11px;color:var(--muted-3);margin-left:4px}
.m.retire .txt,.m.illisible .txt{font-style:italic;color:var(--muted-3);display:flex;align-items:center;gap:6px}
.m.retire .txt svg,.m.illisible .txt svg{width:13px;height:13px}
.m.envoi .txt{opacity:.55}
.m .statut{display:inline-flex;align-items:center;gap:3px;font-size:11px;color:var(--muted-3);margin-left:6px;vertical-align:1px}
.m .statut svg{width:12px;height:12px}
.m.echec .statut{color:var(--danger);font-weight:600}
.m.echec .statut button{text-decoration:underline;color:var(--danger);font-weight:650;font-size:11px}
.mention{background:var(--mention);color:var(--mention-texte);font-weight:650;border-radius:4px;padding:0 3px}
.mention.moi{background:#ffe1d3}
[data-theme=sombre] .mention.moi{background:#57301e}
.m.pour-moi{box-shadow:inset 3px 0 0 var(--signal);background:rgba(199,71,34,.05)}
.citation{display:flex;gap:8px;margin:3px 0;padding:4px 10px;border-left:3px solid var(--ligne);font-size:12.5px;color:var(--muted);cursor:pointer;border-radius:0 6px 6px 0;background:var(--surface-2);max-width:520px}
.citation b{font-weight:650;color:var(--ink);flex:none}
.citation span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.actions{position:absolute;right:12px;top:2px;display:none;gap:1px;background:var(--outils);border:1px solid var(--outils-bord);border-radius:8px;box-shadow:0 2px 8px rgba(13,20,28,.12);padding:2px;z-index:5}
.m:hover .actions,.actions.arme{display:flex}
.actions button{width:28px;height:26px;border-radius:6px;display:inline-grid;place-items:center;color:var(--muted)}
.actions button svg{width:15px;height:15px}
.actions button:hover{background:var(--survol);color:var(--ink-fort)}
.actions button.arme{width:auto;display:inline-flex;align-items:center;gap:5px;padding:0 9px;font-size:12px;font-weight:650;background:var(--danger);color:#fff}
.actions button.arme:hover{background:var(--danger);color:#fff;filter:brightness(1.08)}
.sys{display:flex;align-items:center;justify-content:center;gap:7px;margin:8px 18px;font-size:12px;color:var(--muted)}
.sys svg{width:13px;height:13px;flex:none}

/* États pleins */
.etat{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:30px;gap:10px;color:var(--muted)}
.etat .pic{width:56px;height:56px;border-radius:16px;display:grid;place-items:center;background:var(--actif);color:var(--actif-texte);margin-bottom:6px}
.etat .pic svg{width:26px;height:26px}
.etat h3{font-size:15.5px;font-weight:700;color:var(--ink-fort)}
.etat p{font-size:13px;line-height:1.5;max-width:330px}
.etat .rien{display:inline-flex;align-items:center;gap:6px;font-size:12px;font-weight:650;color:var(--succes);background:rgba(55,125,111,.1);padding:4px 10px;border-radius:20px}
.etat .rien svg{width:13px;height:13px}
.attente-anim{display:flex;gap:5px;margin-top:4px}
.attente-anim i{width:7px;height:7px;border-radius:50%;background:var(--bleu-clair);animation:rebond 1.2s infinite}
.attente-anim i:nth-child(2){animation-delay:.15s}.attente-anim i:nth-child(3){animation-delay:.3s}
@keyframes rebond{0%,60%,100%{transform:none;opacity:.5}30%{transform:translateY(-3px);opacity:1}}
.prep{position:absolute;inset:0;background:var(--surface);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;z-index:40;text-align:center;padding:24px}
.prep .anneau{width:38px;height:38px;border-radius:50%;border:3px solid var(--actif);border-top-color:var(--bleu-clair);animation:tour .8s linear infinite}
@keyframes tour{to{transform:rotate(360deg)}}
.prep b{font-size:15px;color:var(--ink-fort)}
.prep span{font-size:12.5px;color:var(--muted)}

/* Saisie */
.saisie{flex:none;padding:6px 14px 12px}
.puce{display:flex;align-items:center;gap:8px;padding:6px 10px;margin-bottom:-1px;border:1px solid var(--ligne);border-bottom:0;border-radius:var(--rayon-lg) var(--rayon-lg) 0 0;background:var(--surface-2);font-size:12px;color:var(--muted)}
.puce b{color:var(--ink-fort);font-weight:650}
.puce span{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.puce .ib{width:22px;height:22px}
.zone{position:relative;display:flex;align-items:flex-end;gap:8px;padding:8px 8px 8px 12px;border:1px solid var(--ligne);border-radius:var(--rayon-lg);background:var(--surface)}
.puce+.zone{border-radius:0 0 var(--rayon-lg) var(--rayon-lg)}
.zone:focus-within{border-color:var(--bleu-clair);box-shadow:0 0 0 3px rgba(53,115,160,.14)}
.zone textarea{flex:1;border:0;outline:0;resize:none;background:none;font-size:14px;line-height:1.45;max-height:140px;min-height:21px;padding:4px 0;color:var(--ink)}
.zone textarea::placeholder{color:var(--muted-3)}
.envoyer{width:34px;height:34px;border-radius:var(--rayon);display:grid;place-items:center;background:var(--bleu);color:#fff;flex:none;transition:opacity .15s}
.envoyer:disabled{opacity:.35;cursor:default}
.aide{display:flex;align-items:center;gap:6px;margin-top:6px;font-size:11px;color:var(--muted-3)}
.aide svg{width:11px;height:11px;color:var(--succes)}
.aide .esp{flex:1}
kbd{font-family:inherit;font-size:10.5px;padding:0 4px;border:1px solid var(--ligne);border-bottom-width:2px;border-radius:4px;color:var(--muted)}
body.tel .aide .clav,body.m-reduit .aide .clav{display:none}
.menu-mention{position:absolute;left:8px;bottom:calc(100% + 6px);width:270px;background:var(--surface);border:1px solid var(--ligne);border-radius:var(--rayon-lg);box-shadow:0 12px 30px rgba(21,36,56,.16);padding:4px;z-index:10}
.menu-mention .titre-m{font-size:10.5px;font-weight:700;text-transform:uppercase;letter-spacing:.06em;color:var(--muted-3);padding:6px 8px 4px}
.menu-mention button{width:100%;display:flex;align-items:center;gap:9px;padding:6px 8px;border-radius:6px;text-align:left;font-size:13px}
.menu-mention button[aria-selected=true]{background:var(--actif)}
.menu-mention button small{color:var(--muted-3);font-size:11.5px;margin-left:auto}
.clos{flex:none;margin:8px 14px 14px;padding:12px 14px;border-radius:var(--rayon-lg);background:var(--surface-2);border:1px solid var(--ligne);font-size:12.5px;color:var(--muted);display:flex;gap:10px;align-items:flex-start;line-height:1.45}
.clos svg{width:16px;height:16px;color:var(--muted);margin-top:1px}

/* Membres */
.mb-tete{padding:14px 14px 8px;display:flex;align-items:center;gap:8px}
.mb-tete b{font-size:13.5px;color:var(--ink-fort);flex:1}
.mb-corps{flex:1;overflow:auto;padding:0 8px 12px}
.mb{display:flex;align-items:center;gap:10px;padding:7px 8px;border-radius:var(--rayon)}
.mb .nom{font-weight:600;font-size:13px;color:var(--ink-fort);display:flex;gap:6px;align-items:center}
.mb small{display:block;font-size:11.5px;color:var(--muted)}
.mb .cle{margin-left:auto;color:var(--succes)}
.mb .cle svg{width:14px;height:14px}
.mb-pied{padding:10px 14px;border-top:1px solid var(--ligne);font-size:11.5px;color:var(--muted-3);line-height:1.45}
