[hidden].visitor-chat, [hidden].chat-unread, [hidden].chat-composer, [hidden].chat-quick-replies { display: none; }
.floating-chat { position: fixed; right: calc(max(20px, env(safe-area-inset-right)) + 74px); bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 1100; width: 60px; height: 60px; border: 0; border-radius: 50%; background: #4dbf73; color: white; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 24px #2f292440; cursor: pointer; }
.floating-chat:hover { background: #389b59; }
.chat-unread { position: absolute; top: -4px; right: -4px; border-radius: 20px; background: #d53b4e; color: white; padding: 3px 6px; font: 700 12px system-ui; }
.visitor-chat { position: fixed; right: max(20px, env(safe-area-inset-right)); bottom: calc(94px + env(safe-area-inset-bottom)); z-index: 1500; width: min(390px, calc(100vw - 32px)); height: min(620px, calc(100dvh - 120px)); display: flex; flex-direction: column; background: white; border-radius: 16px; box-shadow: 0 8px 45px #16142d40; overflow: hidden; }
.visitor-chat__header { display: flex; align-items: center; gap: 18px; padding: 20px 16px; background: #414363; color: white; flex-shrink: 0; }
.visitor-chat__header h2 { margin: 0; font-size: 17px; font-weight: 500; }
.visitor-chat__header p { margin: 5px 0 0; color: #c5c7d8; font-size: 13px; }
.visitor-chat__header button { border: 0; background: transparent; color: white; cursor: pointer; font-size: 32px; line-height: 1; padding: 4px; }
.chat-messages { flex: 1; min-height: 0; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.chat-empty { margin: auto; color: #747783; text-align: center; }
.chat-message { max-width: 85%; border-radius: 16px 16px 16px 4px; padding: 10px 13px; background: #f0f1f5; align-self: flex-start; overflow-wrap: anywhere; white-space: pre-wrap; color: #292420; }
.chat-message--own { align-self: flex-end; background: #e2f5e7; border-radius: 16px 16px 4px 16px; }
.chat-message small { display: block; color: #777; font-size: 11px; margin-top: 4px; white-space: normal; }
.chat-quick-replies { padding: 8px 16px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.chat-quick-replies button { border: 1px solid #4dbf73; background: white; color: #2e8a48; border-radius: 30px; padding: 8px 12px; cursor: pointer; font: inherit; font-size: 13px; }
.chat-composer { display: flex; align-items: flex-end; padding: 12px; gap: 8px; border-top: 1px solid #eee; margin: 0; }
.chat-composer textarea { flex: 1; min-width: 0; max-height: 120px; resize: none; border: 0; border-radius: 24px; padding: 14px 16px; background: #f0f2f4; font: inherit; font-size: 16px; }
.chat-composer button { width: 44px; height: 44px; flex-shrink: 0; border: 0; border-radius: 50%; color: white; background: #4dbf73; cursor: pointer; font-size: 22px; }
.chat-composer button:disabled { opacity: .5; cursor: wait; }
.chat-status { color: #9d3541; margin: 0; padding: 0 16px; font-size: 13px; }
.chat-status:empty { display: none; }
.chat-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.floating-chat:focus-visible, .visitor-chat button:focus-visible { outline: 3px solid #7a76ae; outline-offset: 3px; }
.admin-chats { display: grid; grid-template-columns: 300px minmax(0,1fr); min-height: 500px; height: 70dvh; gap: 16px; }
.admin-chat-list { overflow: auto; border: 1px solid #ddd; border-radius: 10px; }
.admin-chat-list a { display: block; padding: 14px; text-decoration: none; color: #292420; border-bottom: 1px solid #eee; overflow-wrap: anywhere; }
.admin-chat-list a.active { background: #e2f5e7; }
.admin-chat-list p { margin: 6px 0 0; font-size: 13px; }
.admin-chat-thread { display: flex; min-height: 0; flex-direction: column; border: 1px solid #ddd; border-radius: 10px; overflow: hidden; }
@media (max-width: 600px) {
    .visitor-chat { inset: 0; width: 100%; height: 100dvh; border-radius: 0; z-index: 3000; }
    .visitor-chat__header { padding-top: calc(18px + env(safe-area-inset-top)); }
    .visitor-chat .chat-composer { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
    html.visitor-chat-open, body.visitor-chat-open { overflow: hidden; }
    .admin-chats { grid-template-columns: minmax(0,1fr); height: auto; }
    .admin-chat-list { max-height: 220px; }
    .admin-chat-thread { height: 65dvh; }
}
