.chat-widget{position:fixed;right:18px;bottom:18px;z-index:1000;font:14px Inter,Arial,sans-serif}.chat-widget button,.chat-admin button{background:#103e85;color:#fff;border:0;border-radius:10px;padding:12px;cursor:pointer}.chat-widget button:disabled,.chat-admin button:disabled{opacity:.5}.chat-widget #chat-panel{width:350px;max-width:calc(100vw - 36px);max-height:75vh;overflow:auto;background:white;color:#172b49;border:1px solid #d7e0ec;border-radius:16px;padding:16px;box-shadow:0 10px 40px #102d4933;margin-top:10px}.chat-widget [hidden]{display:none!important}#chat-messages{height:260px;overflow-y:auto;border:1px solid #dbe4ee;border-radius:8px;padding:8px;background:#f6f9fc}.chat-bubble{padding:10px;border-radius:10px;background:#e8eff9;overflow-wrap:anywhere}.chat-bubble.support{background:#e2f5ed}.chat-bubble strong,.chat-bubble span{display:block}.chat-bubble strong{font-size:11px;margin-bottom:5px}.chat-bubble span{white-space:pre-wrap}#chat-form label{display:block;margin-top:12px}#chat-input{box-sizing:border-box;width:100%;margin:8px 0;padding:10px}#chat-status{font-size:12px}#chat-inbox{display:flex;gap:8px;overflow:auto;padding:12px 0}.chat-admin{margin-top:22px}

/* Refined visitor chat: scoped to avoid changing the admin inbox */
.chat-widget{right:clamp(12px,3vw,24px);bottom:calc(16px + env(safe-area-inset-bottom,0px));display:flex;flex-direction:column;align-items:flex-end;gap:12px;font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;max-width:calc(100vw - 24px)}
.chat-widget #chat-toggle{display:flex;align-items:center;justify-content:center;gap:10px;min-width:58px;min-height:58px;padding:14px 16px;border:1px solid #ffffff45;border-radius:999px;background:linear-gradient(145deg,#2878ff,#0c398e);color:#fff;box-shadow:0 10px 30px #0c398e55;transition:transform .2s,box-shadow .2s;font-size:14px;font-weight:700}
.chat-widget #chat-toggle:hover{transform:translateY(-2px);box-shadow:0 14px 32px #0c398e66}
.chat-widget #chat-toggle svg{height:26px;width:26px;flex-shrink:0}
.chat-widget #chat-panel{order:-1;box-sizing:border-box;width:min(380px,calc(100vw - 24px));max-width:100%;height:min(530px,calc(100dvh - 120px));max-height:calc(100dvh - 120px);display:flex;flex-direction:column;overflow:hidden;margin:0;padding:0;border:1px solid #d7e4f4;border-radius:20px;background:#fff;box-shadow:0 18px 55px #0b2c5b42;color:#1a3152}
.chat-widget .chat-panel-header{display:flex;align-items:center;gap:12px;flex-shrink:0;padding:15px 16px;background:linear-gradient(115deg,#0b2d69,#1758bd);color:white}
.chat-widget .chat-panel-avatar{display:grid;place-items:center;width:40px;height:40px;flex-shrink:0;border-radius:13px;background:#fff2;color:#fff;font-weight:800;font-size:22px}
.chat-widget .chat-panel-header div{flex:1;min-width:0}.chat-widget .chat-panel-header strong{display:block;font-size:15px}.chat-widget .chat-panel-header small{display:block;margin-top:4px;font-size:11px;line-height:1.35;color:#e0edff}
.chat-widget .chat-panel-header #chat-close{background:transparent;border:0;padding:3px 7px;font-size:27px;line-height:1;color:#fff;border-radius:8px}
.chat-widget #chat-messages{flex:1;min-height:70px;height:auto;overflow-y:auto;overscroll-behavior:contain;border:0;border-radius:0;padding:16px;background:#f5f8fd;font-size:14px}
.chat-widget .chat-bubble{max-width:90%;width:fit-content;border-radius:14px 14px 14px 4px;margin:0 0 12px;padding:11px 13px;line-height:1.5;background:#e7eef8}
.chat-widget .chat-bubble.customer{margin-left:auto;border-radius:14px 14px 4px 14px;background:#dcecff}
.chat-widget .chat-bubble.support{background:#e3f5ed}
.chat-widget #chat-form{flex-shrink:0;padding:12px 15px 5px;background:#fff;border-top:1px solid #e5edf7}
.chat-widget #chat-form label{font-size:12px;font-weight:650;margin:0}
.chat-widget #chat-input{display:block;min-height:65px;max-height:100px;resize:vertical;border:1px solid #d7e1ef;border-radius:12px;padding:12px;margin:7px 0;font:16px/1.4 inherit;font-size:16px;background:#f9fbff;color:#1a3152;outline-offset:2px}
.chat-widget #chat-send{border-radius:10px;padding:10px 16px;font-size:14px;font-weight:650;background:#1554b8}
.chat-widget #chat-status{flex-shrink:0;margin:0;padding:6px 15px 12px;font-size:11px;line-height:1.5;color:#52647d;background:white}
@media(max-width:600px){.chat-widget{right:12px;bottom:calc(12px + env(safe-area-inset-bottom,0px))}.chat-widget #chat-toggle{width:58px;height:58px;padding:14px}.chat-widget .chat-toggle-label{display:none}.chat-widget #chat-panel{width:calc(100vw - 24px);height:min(500px,calc(100dvh - 110px));max-height:calc(100dvh - 110px)}.chat-widget #chat-input{font-size:16px}}
@media(prefers-reduced-motion:reduce){.chat-widget #chat-toggle{transition:none}}
