#erpChatRoot [hidden]{display:none!important}#erpChatRoot[hidden]{display:none!important}
#chatToggle{position:fixed;right:18px;bottom:140px;z-index:10012;width:48px;height:48px;border:1px solid #cbd5e1;border-radius:10px;background:#fff;color:#152c45;display:flex;align-items:center;justify-content:center;box-shadow:0 3px 12px #0002}
#chatBadge,.chatUnread{background:#c62828;color:white;font-size:11px;border-radius:12px;padding:2px 6px}#chatBadge{position:absolute;right:-7px;top:-7px}
#chatPanel{position:fixed;right:78px;bottom:20px;z-index:10013;width:min(380px,calc(100vw - 30px));height:min(570px,calc(100dvh - 40px));background:white;color:#172b40;border:1px solid #cbd5e1;border-radius:12px;box-shadow:0 8px 35px #0003;display:flex;flex-direction:column;overflow:hidden;font-size:14px}
#chatPanel header,.chatPeer{display:flex;align-items:center;justify-content:space-between;padding:12px;border-bottom:1px solid #e2e8f0}#chatClose,#chatBack{background:transparent;border:0;color:#111;font-size:24px;font-weight:bold;padding:0 8px}#chatDirectory{display:flex;flex-direction:column;gap:8px;padding:12px;flex:1;min-height:0}#chatSearch,#chatDepartment,#chatText{box-sizing:border-box;width:100%;padding:9px;border:1px solid #cbd5e1;border-radius:6px;background:white;color:#172b40}#chatUsers{overflow:auto;flex:1}#chatUsers>button{display:flex;align-items:center;justify-content:space-between;width:100%;text-align:left;border:0;border-bottom:1px solid #edf0f3;background:white;color:#172b40;padding:12px 5px}#chatUsers>button:hover{background:#f3f6f9}#chatUsers small{display:block;color:#64748b;margin-top:4px}#chatConversation{display:flex;flex-direction:column;flex:1;min-height:0}.chatPeer{justify-content:flex-start;gap:12px}#chatMessages{overflow:auto;flex:1;padding:12px;background:#f7f9fb}#chatMessages article{width:fit-content;max-width:85%;padding:9px 12px;border-radius:9px;margin-bottom:10px;overflow-wrap:anywhere}#chatMessages article>div{white-space:pre-wrap}#chatMessages small{font-size:10px;display:block;margin-top:6px;color:#57677a}.chatMine{margin-left:auto;background:#e2edf7}.chatTheirs{background:#fff;border:1px solid #e2e8f0}#chatForm{display:flex;gap:8px;padding:10px;border-top:1px solid #e2e8f0}#chatText{resize:vertical;max-height:130px}#chatSend{background:#173b5b;color:white;border:0;border-radius:6px;padding:8px 12px}#chatSend:disabled{opacity:.5}#chatStatus{padding:5px 12px 10px;color:#526174}#chatOlder{background:white;border:0;padding:7px;color:#17456b}#chatPanel button{cursor:pointer}#chatPanel button:focus-visible,#chatToggle:focus-visible{outline:2px solid #173b5b;outline-offset:2px}@media(max-width:540px){#chatPanel{right:15px;bottom:12px}#chatToggle{right:14px}}

#chatAttach{position:relative;align-self:center;overflow:hidden;font-size:24px;cursor:pointer;flex:0 0 28px}#chatFile{position:absolute;inset:0;opacity:0;width:100%;cursor:pointer}#chatFilePreview{display:flex;align-items:center;justify-content:space-between;gap:6px;padding:8px 12px;border-top:1px solid #eee;font-size:12px;overflow-wrap:anywhere}#chatFilePreview button{border:0;background:transparent;font-size:20px}.chatFileLink{display:block;color:#173b5b;font-size:12px;margin-top:6px}.chatFileLink img{display:block;max-width:100%;max-height:190px;border-radius:5px;margin-bottom:5px}

/* .58: distinct, confirmed chat lifecycle controls. */
#erpChatRoot .chatPeer{flex-wrap:wrap;row-gap:5px}
#erpChatRoot .chatPeer #chatPeerName{min-width:90px;flex:1;overflow-wrap:anywhere}
#erpChatRoot #chatClear{font-size:.85em;white-space:normal}
#erpChatRoot .group-lifecycle{border-top:1px solid #cedbea;margin-top:20px;padding-top:12px;display:flex;flex-wrap:wrap;gap:10px}
#erpChatRoot .group-lifecycle h4,#erpChatRoot .group-lifecycle small{width:100%;margin:0}
#erpChatRoot .chat-danger{border:1px solid #c62539;background:#fff3f4;color:#9c1625}
#erpChatRoot #confirmGroupExit{margin:12px 0;padding:12px}
