/* V330 — habillage et outils communs aux chats de partie, latéral et salons. */
:root{--chat-fond:#eef3ef;--chat-moi:#176649;--chat-moi-texte:#fff;--chat-eux:#fff;--chat-eux-texte:#20372e;--chat-meta:#63756a;}
#chat-messages,#tchat-messages,#side-chat-messages{display:flex;flex-direction:column;gap:2px!important;background:var(--chat-fond);padding:14px 12px;min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;}
#side-chat-messages{max-height:340px;min-height:120px;font-size:13px;}
.chat-msg-row{max-width:94%;margin-top:2px;}
.chat-msg-row.chat-debut{margin-top:10px;}
.chat-msg-bundle{max-width:100%;}
.chat-msg{font-size:15px;line-height:1.5;padding:10px 12px 7px;border-radius:18px!important;box-shadow:0 1px 2px #173a2520;overflow-wrap:anywhere;}
.chat-msg.mine{background:var(--chat-moi);color:var(--chat-moi-texte);}
.chat-msg.theirs{background:var(--chat-eux);color:var(--chat-eux-texte);}
.chat-msg-row.is-mine.chat-fin .chat-msg{border-bottom-right-radius:5px!important;}
.chat-msg-row.is-theirs.chat-fin .chat-msg{border-bottom-left-radius:5px!important;}
.chat-msg-avatar{width:28px;height:28px;min-width:28px;background:#d7e7dc;color:#234d38;}
.chat-msg-avatar img{width:100%;height:100%;object-fit:cover;}
.chat-name{color:#366951;font-size:12px;margin-left:4px;}
.chat-msg-meta{gap:6px;margin-top:5px;line-height:1.25;}
.chat-msg.mine .chat-readers{color:#a9f0cf;}
.chat-jour span{background:#dce8df;border:0;color:#435c4b;font-size:12px;border-radius:8px;padding:5px 12px;box-shadow:none;}
.chat-cite{border-left:3px solid #378767;background:#edf5ef;border-radius:8px;line-height:1.4;font-size:13px;}
.chat-reaction-chip{min-height:30px;padding:3px 9px;border-radius:14px;background:#fff;}
.chat-reaction-chip.mine{border-color:#24734f;background:#e4f4e9;}
.chat-msg-outils .chat-msg-actions{width:32px;min-width:32px;height:40px;opacity:.8;}
.chat-reaction-picker{max-width:100%;flex-wrap:wrap;}
.chat-reaction-picker button{min-width:36px;min-height:36px;}
.chat-search-filtered{display:none!important;}
.chat-tools{display:flex;align-items:center;gap:8px;flex:0 0 auto;padding:5px 12px;border-bottom:1px solid #d6e5da;background:#f8fbf8;}
.chat-tools-note{font-size:11px;color:#4e6657;flex:1 1 auto;min-width:0;line-height:1.25;}
.chat-tools button,.chat-search-row button{width:40px;height:40px;min-width:40px;min-height:40px;padding:0;display:grid;place-items:center;border:0;box-shadow:none;background:#e5f0e8;color:#205b3e;border-radius:10px;}
.chat-tools svg{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:2;}
.chat-search-row{display:flex;flex:0 0 auto;gap:7px;padding:8px 12px;background:#f8fbf8;align-items:center;}
.chat-search-row input{min-width:0;flex:1 1 auto;width:100%;font-size:16px;border:1px solid #bccfc2;border-radius:10px;padding:9px 11px;}
.chat-search-info{flex:0 0 auto;padding:0 12px 6px;color:#466650;font-size:12px;}
#panel-chat[aria-modal="true"] .panel-chat-header,.modern-chat-header{background:#185b41;color:#fff;min-height:60px;padding:8px 12px;}
#panel-chat[aria-modal="true"] .panel-chat-header b,.modern-chat-header h3{color:#fff!important;font-size:17px!important;line-height:1.25;}
.modern-chat-header #tchat-close{width:44px;height:44px;min-width:44px;min-height:44px;border:1px solid #ffffff50;border-radius:12px;background:#ffffff18;color:#fff;box-shadow:none;font-size:23px;}
.chat-composeur,.modern-chat-compose.chat-composeur,#panel-chat[aria-modal="true"] .chat-composeur{display:grid!important;grid-template-columns:40px minmax(0,1fr) 44px;align-items:end;gap:8px;padding:9px 10px;background:#f8fbf8;margin:0!important;border-top:1px solid #d6e5da;}
.chat-composeur .chat-ta261,#panel-chat[aria-modal="true"] #chat-input{grid-column:2;grid-row:1;min-width:0;width:100%;min-height:44px;border:1px solid #c4d5c9;border-radius:16px;padding:10px 12px;background:#fff;font-size:16px;line-height:1.35;max-height:clamp(44px,calc(var(--messagerie-vv-height,100dvh)*.20),120px);box-sizing:border-box;resize:none;overflow-y:auto;}
.chat-composeur .emoji-picker-btn,#panel-chat[aria-modal="true"] .chat-btn-rond{grid-column:1;grid-row:1;min-width:0!important;width:40px!important;min-height:44px;height:44px;border:0;border-radius:12px!important;padding:0;color:#38664b;background:#e6efe8;box-shadow:none;font-size:24px;}
.chat-composeur .chat-btn-envoi,#panel-chat[aria-modal="true"] .chat-btn-envoi{grid-column:3;grid-row:1;width:44px!important;min-width:0!important;height:44px;min-height:44px;border-radius:14px!important;padding:0!important;background:#176649!important;color:#fff!important;box-shadow:none;}
.chat-composeur .chat-ta261:focus{outline:none;border-color:#267a55;box-shadow:0 0 0 3px #267a5520;}
.chat-composeur>*{box-sizing:border-box;}
.chat-reponse-bar{flex:0 0 auto;min-height:40px;margin:0;padding:8px 12px;background:#e6f2e9;border-left:4px solid #277954;box-sizing:border-box;}
.chat-reponse-bar__txt{min-width:0;max-height:42px;overflow:auto;line-height:1.3;font-size:12px;}
.chat-reponse-bar__x{width:40px;min-width:40px;height:40px;min-height:40px;}
.chat-compteur,.chat-copie-note,#tchat-send-status{flex:0 0 auto;background:#f8fbf8;}
#tchat-send-status{padding:0 10px;font-size:12px;margin:0!important;}
.chat-copie-note:empty{display:none;}
#side-chat-messages .chat-msg{font-size:13px;padding:8px 10px;}
#side-chat-messages .chat-msg-avatar{width:22px;height:22px;min-width:22px;font-size:10px;}
#side-chat-messages .chat-msg-row{max-width:98%;}
.side-chat-card{padding:0;overflow:hidden;}
.side-chat-card .side-card-title-row{padding:10px 12px;margin:0;background:#185b41;color:#fff;}
.side-chat-card .side-card-title-row h3{color:#fff;}
.side-chat-card .chat-tools{padding:4px 6px;gap:5px;}
.side-chat-card .chat-tools-note{font-size:10px;}
.side-chat-card .chat-composeur{gap:4px;padding:8px 6px;grid-template-columns:36px minmax(0,1fr) 38px;}
.side-chat-card .chat-composeur .emoji-picker-btn{width:36px!important;}
.side-chat-card .chat-composeur .chat-btn-envoi{width:38px!important;}
.side-chat-card .chat-composeur .chat-ta261{font-size:14px;padding:11px 8px;}
#chat-actions-menu{width:min(344px,calc(100vw - 24px));padding:10px;border:1px solid #cddfd2;border-radius:18px;background:#fff;box-shadow:0 16px 42px #173a253b;}
#chat-actions-menu .chat-actions-emojis{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:2px;}
#chat-actions-menu .chat-actions-emoji,#chat-actions-menu .chat-actions-plus{min-width:0;width:100%;min-height:42px;height:42px;box-shadow:none;}
#chat-actions-menu .chat-actions-item{min-height:44px;border-radius:10px;color:#244c36;}
#chat-actions-menu .chat-actions-danger{color:#a3342b;}
#emoji-picker-panel{display:flex;flex-direction:column;width:360px;max-width:calc(100vw - 24px);padding:10px;gap:8px;background:#fff;border:1px solid #cddfd2;border-radius:18px;box-shadow:0 14px 40px #173a2538;box-sizing:border-box;overflow:hidden;}
.emoji-palette-head{display:flex;align-items:center;justify-content:space-between;flex:0 0 auto;font-size:15px;color:#244c36;}
.emoji-palette-close{width:36px;min-width:36px;height:36px;min-height:36px;padding:0;border:0;border-radius:10px;background:#edf4ee;color:#244c36;box-shadow:none;font-size:25px;}
.emoji-palette-search{flex:0 0 auto;width:100%;min-width:0;font-size:16px;padding:9px 10px;border:1px solid #c4d5c9;border-radius:10px;box-sizing:border-box;}
.emoji-palette-tabs{display:flex;flex:0 0 auto;gap:4px;overflow-x:auto;scrollbar-width:thin;padding-bottom:3px;}
.emoji-palette-tabs button{width:38px;min-width:38px;height:38px;min-height:38px;padding:0;border:0;border-radius:10px;background:#f1f6f2;box-shadow:none;font-size:20px;}
.emoji-palette-tabs button[aria-pressed="true"]{background:#cee8d8;outline:2px solid #347553;outline-offset:-2px;}
.emoji-palette-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:3px;min-height:0;overflow-y:auto;overscroll-behavior:contain;}
#emoji-picker-panel .emoji-picker-item{width:100%;min-width:0;min-height:38px;height:40px;padding:0;font-size:25px;box-shadow:none;}
.emoji-palette-status{font-size:11px;color:#4e6657;flex:0 0 auto;min-height:14px;}
body.partie-chat-ouvert #partie-sac-fond{background:rgba(21,40,31,.12);}
@media(max-width:860px){
 body.partie-chat-ouvert>#panel-chat{left:calc(var(--partie-vv-left,0px) + 12px);top:calc(var(--partie-vv-top,0px) + var(--partie-chat-top-gap,108px));width:calc(var(--partie-vv-width,100vw) - 24px);height:calc(var(--partie-vv-height,100dvh) - var(--partie-chat-top-gap,108px) - var(--partie-chat-bottom-gap,76px));border:1px solid #b9cebf;border-radius:20px;box-shadow:0 12px 34px #173a2545;transform:none;}
 .modern-chat-overlay{padding:12px;align-items:center;backdrop-filter:none;background:#173a2526;}
 .modern-chat-dialog{height:calc(var(--messagerie-vv-height,100dvh) - 24px);max-height:820px;width:100%;border:1px solid #b9cebf;border-radius:20px;}
 .chat-msg-outils .chat-react-btn:not(.chat-msg-actions){display:none;}
 .chat-msg-outils .chat-msg-actions{display:flex;opacity:.85;}
}
@media(max-height:500px){
 .chat-tools{padding-top:2px;padding-bottom:2px;}
 .chat-tools button{height:32px;min-height:32px;}
 #panel-chat[aria-modal="true"] .panel-chat-header,.modern-chat-header{min-height:48px;padding:3px 10px;}
 .chat-search-row{padding:3px 10px;}
 .chat-search-row input{padding:6px 8px;}
 .chat-search-info{padding-bottom:2px;}
 .chat-compteur{padding-bottom:0;}
}
:where(.chat-tools,.chat-search-row,#emoji-picker-panel,#chat-actions-menu) button:focus-visible{outline:3px solid #b27916;outline-offset:2px;}
@media(forced-colors:active){.chat-msg.mine,.chat-msg.theirs{background:Canvas!important;color:CanvasText!important;border:1px solid CanvasText!important;}.modern-chat-header,#panel-chat[aria-modal="true"] .panel-chat-header{background:Canvas!important;color:CanvasText!important;}.modern-chat-header h3,#panel-chat[aria-modal="true"] .panel-chat-header b{color:CanvasText!important;}}

@media(max-width:860px){.modern-chat-overlay{inset:auto;left:var(--messagerie-vv-left,0px);top:var(--messagerie-vv-top,0px);width:var(--messagerie-vv-width,100vw);height:var(--messagerie-vv-height,100dvh);box-sizing:border-box;}}
/* Un menu visible sur chaque bulle, aussi au clavier : tous les outils y sont accessibles. */
.chat-msg-outils{opacity:1;pointer-events:auto;flex:0 0 auto;}
.chat-msg-outils .chat-react-btn:not(.chat-msg-actions){display:none;}
.chat-msg-outils .chat-msg-actions{display:inline-flex;}
.chat-msg-ligne>.chat-msg{min-width:0;}
