#chatdialog{padding:0;width:min(920px,calc(100vw - 24px));max-width:920px;height:min(740px,90dvh);max-height:90dvh;border:1px solid var(--line);border-radius:22px;overflow:hidden;background:var(--surface);color:var(--text)}
.chat-top{height:70px;padding:16px 22px;border-bottom:1px solid var(--line);display:flex;gap:14px;align-items:center}.chat-top h2{font-size:23px}.chat-top span{font-size:11px;color:var(--muted)}.chat-top>button{margin-left:auto;font-size:30px;min-width:44px;min-height:44px}
.chat-layout{display:grid;grid-template-columns:290px minmax(0,1fr);height:calc(100% - 70px)}.chat-contacts{min-height:0;overflow-y:auto;border-right:1px solid var(--line);padding:14px}.chat-search{display:grid;gap:6px;font-size:11px;color:var(--muted);padding:4px 2px 14px}.chat-search input{font-size:16px;width:100%;padding:12px;border:1px solid var(--line)}
.chat-contact{width:100%;padding:13px 8px;display:flex;gap:10px;align-items:center;text-align:left;border-radius:13px}.chat-contact:hover,.chat-contact.selected{background:var(--soft)}.chat-contact>span:not(.chat-avatar){min-width:0;flex:1}.chat-contact b,.chat-contact small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chat-contact b{font-size:13px}.chat-contact small{font-size:11px;color:var(--muted);margin-top:4px}.chat-contact em{font-style:normal;background:var(--green);color:var(--surface);border-radius:50%;font-size:10px;padding:4px 7px}
.chat-avatar{width:40px;height:40px;border-radius:50%;object-fit:cover;background:var(--soft);color:var(--green);display:grid;place-items:center;font-weight:700;flex-shrink:0}.chat-conversation{display:flex;flex-direction:column;min-width:0;min-height:0}.chat-person{height:64px;display:flex;align-items:center;padding:12px 20px;border-bottom:1px solid var(--line);gap:10px;flex-shrink:0}.chat-person button{display:none;font-size:30px;min-width:40px}.chat-messages{padding:20px;overflow-y:auto;flex:1;min-height:0;background:var(--bg);display:flex;flex-direction:column;gap:10px}.chat-placeholder{font-size:13px;line-height:1.7;color:var(--muted);padding:22px;text-align:center;margin:auto}.chat-bubble{max-width:86%;align-self:flex-start;background:var(--surface);padding:12px 15px;border-radius:17px 17px 17px 4px;border:1px solid var(--line)}.chat-bubble.mine{align-self:flex-end;background:var(--green);color:var(--surface);border:0;border-radius:17px 17px 4px 17px}.chat-bubble p{margin:0;line-height:1.6;white-space:pre-wrap;overflow-wrap:anywhere;font-size:14px}.chat-bubble time{font-size:9px;opacity:.7;display:block;text-align:right;margin-top:6px}.chat-send{display:flex;align-items:flex-end;padding:14px;gap:10px;border-top:1px solid var(--line);flex-shrink:0;background:var(--surface)}.chat-send textarea{flex:1;min-width:0;resize:vertical;min-height:46px;max-height:120px;border:1px solid var(--line);font-size:16px;line-height:1.5}.chat-send button{background:var(--green);color:var(--surface);border-radius:12px;padding:12px 18px;min-height:46px;font-weight:650}.chat-error{margin:0;padding:10px 16px;color:#a33a34;background:#fff3ee;font-size:12px}.chat-older{align-self:center;color:var(--green);padding:10px;font-size:12px}.chat-open-head,.mobile-chat{position:relative}.chat-open-head svg{width:22px;height:22px}[data-chat-count]{position:absolute;top:0;right:0;border-radius:12px;background:#bb4a43;color:white;min-width:17px;line-height:17px;font-size:10px;text-align:center;padding:0 4px}
@media(max-width:700px){#chatdialog{width:100vw;max-width:100vw;height:100dvh;max-height:100dvh;margin:0;border:0;border-radius:0;padding-top:env(safe-area-inset-top,0px)}.chat-top{height:62px;padding:10px 16px}.chat-top span{display:none}.chat-layout{height:calc(100% - 62px);grid-template-columns:1fr}.chat-conversation{display:none}.chat-thread-open .chat-contacts{display:none}.chat-thread-open .chat-conversation{display:flex}.chat-person button{display:block}.chat-send{padding-bottom:max(14px,env(safe-area-inset-bottom,0px))}.chat-messages{padding:14px}.chat-bubble{max-width:88%}.mobile .mobile-chat{display:grid!important}.headtools{gap:5px}.chat-contact{padding:15px 8px}.chat-contact b{font-size:15px}.chat-contact small{font-size:12px}}
