/* Messages depuis la migration (2026-09-20) : ce qui s'ajoute au fil de style.css. */
/* 1. « Messages plus anciens » : en tête du fil, centré, discret. */
.dm-older{align-self:center;margin:2px 0 8px;font-size:var(--fs-sm)}

/* 2. En-tête du fil : photo et pseudo d'un seul tenant, touchables quand la
   vitrine est publique (Messages.tsx renderThreadHead). */
.dm-head-id{flex:1;min-width:0;display:flex;align-items:center;gap:12px;margin:0;padding:0;border:0;background:none;color:inherit;font:inherit;text-align:left;border-radius:12px}
.dm-head-id b{overflow-wrap:anywhere}   /* pseudo très long sans espace : à la ligne plutôt que dehors */
button.dm-head-id{cursor:pointer}
button.dm-head-id:focus-visible b{color:var(--mint)}
@media (hover:hover){button.dm-head-id:hover b{color:var(--mint)}}   /* au doigt, iOS garderait le survol après l'appui */
button.dm-head-id:focus-visible{outline:2px solid var(--mint);outline-offset:4px}
/* Téléphone : « Proposer un échange » monte sur la ligne de « ← Conversations »
   (layout.css), à moitié vide ; photo et pseudo ont la ligne d'en dessous pour eux.
   Sur une ligne commune, le bouton prenait la moitié de la place et le pseudo
   passait dessous. */
@media (max-width:760px){
  .dm-layout.is-open .dm-back{flex:1 1 auto}
  .dm-layout.is-open .dm-head-actions{order:1}
  .dm-layout.is-open .dm-head-id{order:2;flex-basis:100%}
}

/* 3. Téléphone, conversation ouverte : le fil remplit l'écran entre la barre du
   haut et celle du bas, et la page ne défile plus. Avant, il gardait 62 vh
   (style.css) sous l'introduction, et la place que la bannière de parrainage
   réserve sous <main> (parrainage.css §12, gardée après sa fermeture) laissait
   la page défiler : le fil remontait, un vide restait au-dessus de la barre du
   bas. Introduction masquée, marges de main posées ici, la hauteur du fil en est
   déduite. Ce qui dépend de la bannière (sa place sous le fil, la réserve
   retirée) est dans parrainage.css §12 : elle s'affiche aussi sur l'accueil. */
@media (max-width:760px){
  /* --dm-bottom : du bas du fil au bas de l'écran. Il compte déjà la zone du geste
     d'accueil (dans --mobile-nav-h) ; <body> la remet en marge basse (safe-area.css §2),
     on la retire donc de celle de main pour ne pas la compter deux fois. min-height:0 :
     les 100vh de style.css, plus les marges d'encoche de <body>, dépassaient l'écran. */
  main:has(.view.is-active .dm-layout.is-open){min-height:0;--dm-top:64px;--dm-bottom:calc(var(--mobile-nav-h) + 10px);padding-top:var(--dm-top);padding-bottom:calc(var(--dm-bottom) - env(safe-area-inset-bottom))}
  /* <body> aussi : son min-height:100vh (style.css) vaut sur téléphone le GRAND écran, barre
     d'adresse repliée. Barre visible, la page dépassait de sa hauteur (~56 px) et défilait
     d'elle-même autour du fil, qui a son propre défilement (2026-11-02). */
  body:has(main .view.is-active .dm-layout.is-open){min-height:0}
  .view:has(.dm-layout.is-open)>.section-head{display:none}
  .dm-layout.is-open .dm-thread{height:max(320px,calc(100dvh - env(safe-area-inset-top) - var(--dm-top) - var(--dm-bottom)))}
}

/* 4. Répondre à un message (2026-10-13, Messages.tsx setReply / jumpTo).
   Au-dessus d'une réponse, le message cité, comme Messenger : une étiquette
   (« Vous avez répondu à … »), puis une bulle pâle que la réponse recouvre en
   partie. La toucher ramène au message d'origine, qui s'éclaire un instant. */
.dm-reply-ctx{display:flex;flex-direction:column;align-items:flex-start;gap:3px;max-width:min(72%,520px);align-self:flex-start;margin:8px 0 -14px;animation:content-in 180ms var(--ease-out) both}
.dm-reply-ctx.mine{align-self:flex-end;align-items:flex-end}
.dm-reply-ctx small{display:flex;align-items:center;gap:5px;padding:0 6px;color:var(--dim);font-size:var(--fs-xs)}
.dm-reply-ctx small .line-icon{width:13px;height:13px;flex:none}
.dm-quote{display:block;max-width:100%;padding:8px 13px 20px;border:1px solid var(--line);border-radius:14px;background:color-mix(in srgb,var(--surface2) 55%,transparent);color:var(--muted);font:inherit;font-size:var(--fs-sm);line-height:1.4;text-align:left;overflow-wrap:anywhere;cursor:pointer;transition:color 160ms ease,background-color 160ms ease}
/* Deux lignes au plus. Sur le span, pas sur le bouton : Safari ne coupe pas un <button> en -webkit-box. */
.dm-quote>span{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}
.dm-quote.is-mine{background:color-mix(in srgb,var(--mint) 7%,transparent);border-color:color-mix(in srgb,var(--mint) 12%,transparent)}
.dm-quote:disabled{font-style:italic;cursor:default}
@media (hover:hover){.dm-quote:not(:disabled):hover{color:var(--text)}}
.dm-msg{transition:background-color 600ms var(--ease-out)}
.dm-msg.is-flash{background-color:color-mix(in srgb,var(--mint) 26%,var(--surface2));transition-duration:120ms}

/* Le bandeau « Répondre à … » au-dessus du champ, croix pour renoncer. */
.dm-reply-draft{display:flex;align-items:center;gap:10px;padding:2px 2px 10px 6px;animation:content-in 180ms var(--ease-out) both}
.dm-reply-draft[hidden]{display:none}
.dm-reply-draft>.line-icon{width:18px;height:18px;flex:none;color:var(--mint)}
.dm-reply-label{flex:1;min-width:0;display:flex;flex-direction:column;line-height:1.3}
.dm-reply-label b{font-size:var(--fs-sm)}
.dm-reply-label span{overflow:hidden;color:var(--dim);font-size:var(--fs-xs);text-overflow:ellipsis;white-space:nowrap}
.dm-reply-draft>button{width:28px;height:28px;display:grid;place-items:center;padding:0;border:1px solid var(--line);border-radius:50%;background:transparent;color:var(--muted);cursor:pointer}
.dm-reply-draft>button .line-icon{width:14px;height:14px}
@media (hover:hover){.dm-reply-draft>button:hover{color:var(--text);border-color:color-mix(in srgb,var(--mint) 30%,transparent)}}

/* Glisser la bulle vers le centre pour répondre (ui/dm-gestures.ts) : la flèche
   apparaît derrière elle avec le geste (--reply-p, de 0 à 1) et se remplit au
   seuil. Le défilement vertical et le zoom restent au navigateur (pan-y pinch-zoom). Au doigt, pas de
   sélection ni de menu iOS sur la bulle : « Copier » est dans le menu du message. */
.dm-msg{touch-action:pan-y pinch-zoom}   /* le zoom à deux doigts reste permis */
.dm-scroll{overflow-x:hidden}   /* la flèche d'un message à soi dépasse à droite : elle se découvre au geste, sans barre de défilement */
.dm-msg::before,.dm-msg::after{content:"";position:absolute;top:50%;left:-44px;width:30px;height:30px;margin-top:-15px;opacity:var(--reply-p,0);pointer-events:none}
.dm-msg::before{border-radius:50%;background:color-mix(in srgb,var(--mint) 16%,transparent);scale:calc(.5 + var(--reply-p,0) * .5);transition:background-color 120ms ease}
.dm-msg::after{background:var(--mint);-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9.5 6.5 4 12l5.5 5.5'/%3E%3Cpath d='M4 12h9.5a6.5 6.5 0 0 1 6.5 6.5V20'/%3E%3C/svg%3E") center/17px no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9.5 6.5 4 12l5.5 5.5'/%3E%3Cpath d='M4 12h9.5a6.5 6.5 0 0 1 6.5 6.5V20'/%3E%3C/svg%3E") center/17px no-repeat}
.dm-msg.mine::before,.dm-msg.mine::after{left:auto;right:-44px}
.dm-msg.is-armed::before{background:var(--mint)}
.dm-msg.is-armed::after{background:var(--bg)}
.dm-msg.is-swiping{animation:none;transition:none}
.dm-msg.is-springing{transition:translate 220ms var(--ease-out),background-color 600ms var(--ease-out)}   /* 220 ms : SPRING_BACK_MS */
@media (hover:none){.dm-msg{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}}

/* À la souris : « Réagir » et « Répondre » au survol de la bulle, du côté du
   centre du fil. Le remplissage fait le pont entre la bulle et les boutons. */
.dm-tools{position:absolute;top:50%;left:100%;display:flex;gap:2px;padding-inline:6px;translate:0 -50%;opacity:0;pointer-events:none;transition:opacity 140ms ease}
.dm-msg.mine .dm-tools{left:auto;right:100%;flex-direction:row-reverse}
.dm-msg:hover .dm-tools,.dm-tools:focus-within{opacity:1;pointer-events:auto}
.dm-tools button{width:30px;height:30px;display:grid;place-items:center;padding:0;border:0;border-radius:50%;background:none;color:var(--dim);cursor:pointer;transition:color 140ms ease,background-color 140ms ease}
.dm-tools button:hover,.dm-tools button:focus-visible{background:var(--soft);color:var(--text)}
.dm-tools .line-icon{width:18px;height:18px}
@media (hover:none){.dm-tools{display:none}}

/* 5. Réactions : une pastille posée sur le bas de la bulle, à gauche (l'heure
   est à droite). Deux fois le même émoji : l'émoji et « 2 ». La toucher rouvre
   le menu, où sa propre réaction se retire. */
.dm-msg.has-reacts{margin-bottom:16px}
.dm-reacts{position:absolute;bottom:-17px;left:12px;display:inline-flex;align-items:center;gap:1px;height:26px;padding:0 7px;border:1px solid var(--line);border-radius:999px;background:var(--surface);color:var(--muted);box-shadow:0 4px 10px -4px rgb(0 0 0/.6);cursor:pointer;animation:badge-in 260ms var(--ease-pop) both}
.dm-reacts::before{content:"";position:absolute;inset:-9px -4px}   /* zone de contact : 44 px de haut au doigt */
.dm-msg .dm-reacts .chat-emoji{font-size:var(--fs-md);vertical-align:0}
.dm-reacts b{margin-left:3px;font-size:var(--fs-xs);font-variant-numeric:tabular-nums}

/* 6. Menu d'un message (appui long, clic droit, « Réagir ») : un voile éteint le
   fil, la bulle passe devant, les réactions flottent au-dessus d'elle et les
   actions en dessous, chacune de l'autre côté si la place manque. Messages.tsx
   DmMenu les place. */
.dm-menu-scrim{position:absolute;inset:0;z-index:5;background:color-mix(in srgb,var(--bg) 64%,transparent);animation:fade-in 160ms var(--ease-out) both}
.dm-msg.is-menu{z-index:6;box-shadow:0 14px 34px -14px rgb(0 0 0/.8)}
.dm-menu{position:absolute;top:0;left:0;z-index:7;width:max-content;max-width:calc(100% - 16px);animation:pop-in 180ms var(--ease-out) both}
.dm-react-row{display:flex;align-items:center;gap:2px;max-width:100%;padding:4px;border:1px solid var(--line);border-radius:999px;background:var(--surface);box-shadow:0 12px 32px -14px rgb(0 0 0/.8)}
.dm-react-row button{width:44px;height:44px;display:grid;place-items:center;flex:none;padding:0;border:0;border-radius:50%;background:none;color:var(--muted);font-size:var(--fs-2xl);line-height:1;cursor:pointer;animation:badge-in 240ms var(--ease-pop) both;animation-delay:calc(var(--i,0) * 22ms);transition:scale 160ms var(--ease-pop),background-color 160ms ease}
.dm-react-row button.is-mine{background:color-mix(in srgb,var(--mint) 22%,transparent)}
.dm-react-row button:active{scale:.9}
@media (hover:hover){.dm-react-row button:hover{scale:1.16}}
.dm-react-more{animation-delay:calc(6 * 22ms)}
.dm-react-more .line-icon{width:20px;height:20px}
.dm-menu.is-palette{width:var(--emoji-popover);padding:8px;border:1px solid var(--line);border-radius:14px;background:var(--surface);box-shadow:0 12px 32px -14px rgb(0 0 0/.8)}
.dm-menu-actions{display:grid;min-width:184px;padding:4px;border:1px solid var(--line);border-radius:16px;background:var(--surface);box-shadow:0 12px 32px -14px rgb(0 0 0/.8)}
.dm-menu-actions button{display:flex;align-items:center;gap:12px;min-height:44px;padding:0 12px;border:0;border-radius:12px;background:none;color:var(--text);font:inherit;font-size:var(--fs-md);text-align:left;cursor:pointer}
.dm-menu-actions .line-icon{width:19px;height:19px;color:var(--muted)}
@media (hover:hover){.dm-menu-actions button:hover{background:var(--soft)}}
.dm-menu-actions button:focus-visible,.dm-react-row button:focus-visible{outline:2px solid var(--mint);outline-offset:-2px}

/* 7. Supprimer une conversation (suppression douce, Messages.tsx) : le ⋯ au
   survol/focus d'une ligne sur bureau (toujours visible au doigt), son petit
   menu, le mode sélection avec sa barre de lot, et le dialogue de confirmation.
   Le masquage lui-même est différé avec un toast « Annuler » (aucune route de
   démasquage : la conversation revient d'elle-même au prochain message). */

/* La colonne de gauche porte le menu ⋯ en absolu. */
.dm-inbox{position:relative}

/* En-tête : la recherche prend la place, « Sélectionner » à droite. */
.dm-inbox-head{display:flex;align-items:center;gap:8px}
.dm-inbox-head .dm-search{flex:1;min-width:0}
.dm-select-toggle{flex:0 0 auto;min-height:34px;padding:0 10px;border:1px solid var(--line);border-radius:8px;background:transparent;color:var(--muted);font-size:var(--fs-sm);font-weight:600;cursor:pointer;transition:color 140ms ease,border-color 140ms ease}
.dm-select-toggle:hover,.dm-select-toggle:focus-visible{color:var(--text);border-color:color-mix(in srgb,var(--mint) 40%,transparent)}

/* Le ⋯ d'une ligne : discret, révélé au survol/focus ; au doigt, toujours là. */
.dm-kebab{flex:0 0 auto;display:grid;place-items:center;width:28px;height:28px;border-radius:8px;color:var(--dim);font-size:var(--fs-lg);line-height:1;cursor:pointer;opacity:0;transition:opacity 140ms ease,color 140ms ease,background-color 140ms ease}
.dm-row:hover .dm-kebab,.dm-row:focus-within .dm-kebab,.dm-kebab:focus-visible{opacity:1}
.dm-kebab:hover,.dm-kebab:focus-visible{color:var(--text);background:var(--surface2)}
@media (hover:none){.dm-kebab{opacity:1}}

/* Le menu ⋯ : un voile transparent referme au clic hors, le menu posé sous le ⋯. */
.popmenu-scrim{position:absolute;inset:0;z-index:6}
.popmenu{position:absolute;z-index:7;min-width:200px;max-width:calc(100% - 16px);padding:4px;border:1px solid var(--line);border-radius:12px;background:var(--surface);box-shadow:0 12px 32px -14px rgb(0 0 0/.8);animation:pop-in 160ms var(--ease-out) both}
.popmenu-item{display:flex;align-items:center;gap:10px;width:100%;min-height:42px;padding:0 12px;border:0;border-radius:8px;background:none;color:var(--text);font:inherit;font-size:var(--fs-md);text-align:left;cursor:pointer;transition:background-color 140ms ease}
.popmenu-item:hover,.popmenu-item:focus-visible{background:var(--surface2)}
.popmenu-item.danger{color:var(--danger)}
.popmenu-item.danger:hover,.popmenu-item.danger:focus-visible{background:color-mix(in srgb,var(--danger) 12%,transparent)}

/* Mode sélection : une pastille cochable en tête, une teinte sur la ligne prise. */
.dm-check{flex:0 0 auto;width:20px;height:20px;border-radius:50%;border:2px solid var(--line);display:grid;place-items:center;transition:background-color 140ms ease,border-color 140ms ease}
.dm-row.is-selected{background:color-mix(in srgb,var(--mint) 8%,transparent)}
.dm-row.is-selected .dm-check{background:var(--mint);border-color:var(--mint)}
.dm-row.is-selected .dm-check::after{content:"";width:9px;height:5px;margin-top:-2px;border-left:2px solid var(--on-accent);border-bottom:2px solid var(--on-accent);rotate:-45deg}

/* La barre de lot, collée au bas de la colonne. */
.dm-bulkbar{position:sticky;bottom:0;display:flex;align-items:center;gap:8px;margin-top:4px;padding:10px;border-top:1px solid var(--line);background:var(--surface)}
.dm-bulkcount{flex:1;min-width:0;font-size:var(--fs-sm);color:var(--muted);font-variant-numeric:tabular-nums}

/* Le bouton destructeur, partagé par la barre de lot et le dialogue. */
.dm-bulkdel,.dm-confirm-del{min-height:36px;padding:0 14px;border:0;border-radius:8px;background:var(--danger);color:#fff;font-size:var(--fs-sm);font-weight:700;cursor:pointer;transition:filter 140ms ease}
.dm-bulkdel:hover:not(:disabled),.dm-confirm-del:hover{filter:brightness(1.08)}
.dm-bulkdel:disabled{opacity:.5;cursor:default}

/* Le dialogue de confirmation (contenu de la modale partagée). */
.dm-confirm{display:flex;flex-direction:column;gap:12px;padding:4px 2px}
.dm-confirm-title{font-size:var(--fs-xl);font-weight:800}
.dm-confirm-body{color:var(--muted);font-size:var(--fs-sm);line-height:1.5}
.dm-confirm-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:4px}

/* 8. Le chat v2 (refonte « La Table », lot 2 ; maquette la-table-v2.html).
   Grappes : les bulles d'un même auteur à moins de 5 min se serrent, leurs
   coins côté auteur s'aplatissent, l'heure ne reste que sous la dernière
   (Messages.tsx, lib/messagerie.ts `dansLaMemeGrappe`). La saisie devient une
   pilule qui porte « Montrer une carte » et les émojis ; la table à gauche,
   l'envoi à droite. Couleurs par rôles des thèmes. */
.dm-scroll{padding:14px 16px 8px}
.dm-items{gap:4px}
.dm-msg{padding:10px 14px;border-radius:18px 18px 18px 6px;border-color:color-mix(in srgb,var(--line-ink) 9%,transparent);background:var(--surface2)}
.dm-msg.mine{border-radius:18px 18px 6px 18px;background:color-mix(in srgb,var(--mint) 13%,var(--surface2));border-color:color-mix(in srgb,var(--mint) 24%,transparent)}
.dm-msg:not(.is-fin){border-bottom-left-radius:6px}
.dm-msg.mine:not(.is-fin){border-bottom-right-radius:6px;border-bottom-left-radius:18px}
.dm-msg.is-suite{border-top-left-radius:6px}
.dm-msg.mine.is-suite{border-top-right-radius:6px;border-top-left-radius:18px}
.dm-msg:not(.is-fin){margin-bottom:0}
.dm-msg p{font-size:var(--fs-base);line-height:1.45}
.dm-time{display:block;align-self:flex-start;margin:1px 6px 8px;color:var(--dim);font-size:var(--fs-xs);font-variant-numeric:tabular-nums}
.dm-time.mine{align-self:flex-end}
.dm-msg.has-reacts+.dm-time{margin-top:-2px}
/* Les séparateurs de jour : un filet, la date au milieu, en clair. */
.dm-day{margin:18px 0 10px;color:var(--muted);font-size:var(--fs-sm);font-weight:600;letter-spacing:0}
/* « Messages plus anciens » : une pilule centrée. */
.dm-older{min-height:36px;padding:0 16px;border:1px solid var(--line);border-radius:999px;background:color-mix(in srgb,var(--bg) 30%,transparent);color:var(--text);font-weight:700}
/* Envoi échoué faute de réseau : la bulle reste, pâlie, et « Réessayer » dessous. */
.dm-msg.is-echec{opacity:.62}
.dm-echec{align-self:flex-end;display:inline-flex;align-items:center;gap:5px;min-height:28px;margin:2px 4px 8px;padding:0;border:0;background:none;color:var(--danger-ink);font:inherit;font-size:var(--fs-xs);font-weight:600;cursor:pointer}
.dm-echec b{font-weight:800}
.dm-echec .line-icon{width:13px;height:13px}
.dm-echec:focus-visible{outline:2px solid var(--danger-ink);outline-offset:2px;border-radius:6px}

/* La saisie. */
.dm-compose{padding:10px 12px 12px;border-top-color:color-mix(in srgb,var(--line-ink) 6%,transparent)}
.dm-compose-row{align-items:flex-end;gap:8px}
.dm-table-btn{flex:0 0 44px;width:44px;height:44px;display:grid;place-items:center;padding:0;border:1px solid var(--line);border-radius:50%;background:color-mix(in srgb,var(--bg) 35%,transparent);color:var(--muted);cursor:pointer;transition:color .16s ease,border-color .16s ease}
.dm-table-btn .line-icon{width:20px;height:20px}
.dm-table-btn:hover{color:var(--amber-ink);border-color:color-mix(in srgb,var(--amber) 45%,transparent)}
.dm-pill{flex:1;min-width:0;display:flex;align-items:flex-end;gap:0;min-height:44px;padding:0 4px 0 2px;border:1px solid var(--line);border-radius:22px;background:var(--soft);transition:border-color .16s ease}
.dm-pill:focus-within{border-color:color-mix(in srgb,var(--mint) 48%,transparent)}
.dm-pill textarea{padding:11px 12px;border:0;border-radius:0;background:none}
.dm-pill textarea:focus{border:0}
.dm-pill .dm-card-btn{flex:0 0 36px;width:36px;height:36px;margin:3px 0;display:grid;place-items:center;padding:0;border:0;border-radius:50%;background:none;color:var(--muted)}
.dm-pill .dm-card-btn .line-icon{width:19px;height:19px}
.dm-pill .dm-card-btn:hover{color:var(--text);background:color-mix(in srgb,var(--text) 6%,transparent)}
.dm-pill .emoji-picker{left:auto;right:-48px}
.dm-send{flex:0 0 44px;width:44px;height:44px;border-radius:50%}
.dm-send:disabled{background:color-mix(in srgb,var(--mint) 10%,var(--soft));color:var(--mint);border-color:color-mix(in srgb,var(--mint) 22%,transparent)}
/* « Réponse à … » au-dessus de la saisie : une carte fine, un filet d'accent à gauche du texte. */
.dm-reply-draft{margin:0 0 8px;padding:8px 8px 8px 12px;border:1px solid var(--line);border-radius:14px;background:var(--surface2)}
.dm-reply-label{padding-left:10px;border-left:2px solid var(--mint)}

/* Les icônes du menu ⋯ (Signaler, Supprimer) : à la taille du texte. */
.popmenu-item .line-icon{width:16px;height:16px;flex:0 0 auto;opacity:.9}

/* Dialogues de la messagerie (confirmer une suppression, signaler) : une carte
   compacte, jamais collée aux bords. Ils portent leurs propres boutons
   « Annuler » et l'action : ni la croix ni le « Fermer » bas de la modale. */
.modal.dm-dialog{width:min(420px,100%);padding:22px}
.modal.dm-dialog>.modal-close,.modal.dm-dialog>.modal-close-bottom{display:none}
.modal.dm-dialog :is(.dm-confirm-actions,.dm-report-actions){display:flex;justify-content:flex-end;gap:9px}
.modal.dm-dialog :is(.dm-confirm-actions,.dm-report-actions)>button{flex:0 0 auto;min-height:40px;margin:0;padding:0 16px;border-radius:10px;font:inherit;font-size:var(--fs-sm);font-weight:700;line-height:1}
