:root{--visitor-chat-line:#d7dfe5;--visitor-chat-shadow:#0002;--visitor-chat-message-bg:#f3f6f7;--visitor-chat-accent:#14b8b0;--visitor-chat-muted:#64748b;--visitor-chat-message-line:#ddd;}
.visitor-chat{position:fixed;right:20px;bottom:20px;z-index:95;max-width:calc(100vw - 24px);font-size:14px}.visitor-chat [hidden]{display:none!important}.visitor-chat>button{min-height:44px}.visitor-chat section{position:absolute;bottom:56px;right:0;width:350px;max-width:calc(100vw - 24px);max-height:calc(100dvh - 100px);overflow:auto;background:#fff;border:1px solid var(--visitor-chat-line);border-radius:12px;box-shadow:0 8px 30px var(--visitor-chat-shadow);padding:16px}.visitor-chat-head{display:flex;align-items:center;justify-content:space-between}.visitor-chat-head button{width:44px;height:44px;border:0;background:transparent;font-size:24px}.visitor-chat form{display:grid;gap:10px}.visitor-chat label{display:block}.visitor-chat input[type=checkbox]{width:20px;height:20px;vertical-align:middle}.visitor-chat textarea{width:100%;min-height:80px;resize:vertical}.visitor-chat p{margin:8px 0;overflow-wrap:anywhere}.visitor-chat #visitor-chat-history{max-height:35dvh;overflow:auto}.visitor-chat .chat-message{padding:10px;border-radius:8px;background:var(--visitor-chat-message-bg);white-space:pre-wrap;margin:8px 0;overflow-wrap:anywhere}.visitor-chat .chat-message.operator{border-left:3px solid var(--visitor-chat-accent)}.chat-message small{display:block;color:var(--visitor-chat-muted)}#operator-chat-list{display:flex;flex-wrap:wrap;gap:8px}#operator-chat-list button{min-height:44px}#operator-chat-messages{max-height:50dvh;overflow:auto;overflow-wrap:anywhere;white-space:pre-wrap}#operator-chat-messages p{padding:12px;border-bottom:1px solid var(--line,var(--visitor-chat-message-line))}#operator-chat textarea{width:100%}#operator-chat-manage{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}@media(max-width:700px){.visitor-chat{right:12px;bottom:12px}.visitor-chat section{bottom:52px}}
/* Keep the existing phone/order bar reachable under the chat. */
@media(max-width:700px){body:has(.mbar,.mbuy) .visitor-chat{bottom:calc(80px + env(safe-area-inset-bottom))}body:has(.mbar,.mbuy) .visitor-chat section{max-height:calc(100dvh - 168px - env(safe-area-inset-bottom))}}
body:has(#consent:not([hidden])) .visitor-chat{visibility:hidden}
@media print{.visitor-chat{display:none!important}}
