:root{--tm-accent:#25D366;--tm-dark:#075E54;--tm-light:#DCF8C6;--tm-white:#fff;--tm-bg:#ECE5DD;--tm-text:#111;--tm-radius:18px;--tm-shadow:0 4px 24px rgba(0,0,0,.18)}
#tm-fab{position:fixed;bottom:24px;right:24px;width:60px;height:60px;border-radius:50%;background:var(--tm-accent);box-shadow:var(--tm-shadow);cursor:pointer;display:flex;align-items:center;justify-content:center;z-index:99999;transition:transform .2s;border:none}
#tm-fab:hover{transform:scale(1.08)}
#tm-fab svg{width:30px;height:30px;fill:#fff}
#tm-window{position:fixed;bottom:96px;right:24px;width:360px;max-width:calc(100vw - 32px);height:540px;max-height:80vh;background:var(--tm-white);border-radius:16px;box-shadow:var(--tm-shadow);display:flex;flex-direction:column;z-index:99998;overflow:hidden;transform:scale(.92) translateY(20px);opacity:0;pointer-events:none;transition:transform .25s cubic-bezier(.34,1.56,.64,1),opacity .2s}
#tm-window.tm-open{transform:scale(1) translateY(0);opacity:1;pointer-events:all}
#tm-header{background:var(--tm-dark);color:#fff;padding:12px 16px;display:flex;align-items:center;gap:12px;flex-shrink:0}
#tm-avatar{width:42px;height:42px;border-radius:50%;object-fit:cover;background:var(--tm-accent);display:flex;align-items:center;justify-content:center;font-size:20px;flex-shrink:0;overflow:hidden}
#tm-avatar img{width:100%;height:100%;object-fit:cover}
.tm-header-info{flex:1}
.tm-header-info strong{display:block;font-size:15px}
.tm-header-info span{font-size:12px;opacity:.8}
#tm-close{background:none;border:none;color:#fff;font-size:22px;cursor:pointer;padding:0 4px;line-height:1;opacity:.8}
#tm-close:hover{opacity:1}
#tm-messages{flex:1;overflow-y:auto;padding:12px 10px;background:var(--tm-bg);display:flex;flex-direction:column;gap:4px}
#tm-messages::-webkit-scrollbar{width:4px}
#tm-messages::-webkit-scrollbar-thumb{background:#bbb;border-radius:4px}
.tm-bubble-wrap{display:flex;flex-direction:column;max-width:82%;animation:tmFadeIn .2s ease}
.tm-bubble-wrap.tm-user{align-self:flex-end;align-items:flex-end}
.tm-bubble-wrap.tm-bot{align-self:flex-start;align-items:flex-start;flex-direction:row;gap:6px}
.tm-bot-avatar{width:28px;height:28px;border-radius:50%;background:var(--tm-dark);color:#fff;font-size:14px;display:flex;align-items:center;justify-content:center;flex-shrink:0;margin-top:2px}
.tm-bubble{padding:8px 12px;border-radius:var(--tm-radius);font-size:14px;line-height:1.5;word-break:break-word}
.tm-user .tm-bubble{background:var(--tm-light);color:var(--tm-text);border-bottom-right-radius:4px}
.tm-bot .tm-bubble{background:var(--tm-white);color:var(--tm-text);border-bottom-left-radius:4px;box-shadow:0 1px 2px rgba(0,0,0,.1)}
.tm-time{font-size:10px;color:#999;margin-top:2px;padding:0 4px}
.tm-typing .tm-bubble{display:flex;align-items:center;gap:4px;padding:10px 14px}
.tm-dot{width:7px;height:7px;border-radius:50%;background:#aaa;animation:tmBounce 1.2s infinite ease-in-out}
.tm-dot:nth-child(2){animation-delay:.2s}
.tm-dot:nth-child(3){animation-delay:.4s}
#tm-inputbar{padding:10px 12px;background:#f0f0f0;display:flex;align-items:center;gap:8px;flex-shrink:0;border-top:1px solid #ddd}
#tm-input{flex:1;border:none;border-radius:24px;padding:10px 16px;font-size:14px;background:#fff;outline:none;resize:none;max-height:80px;font-family:inherit}
#tm-send{width:42px;height:42px;border-radius:50%;background:var(--tm-accent);border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:background .15s}
#tm-send:hover{background:var(--tm-dark)}
#tm-send svg{width:20px;height:20px;fill:#fff}
#tm-footer{text-align:center;font-size:10px;color:#bbb;padding:4px 0 6px;background:#f9f9f9;flex-shrink:0}
@keyframes tmFadeIn{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}
@keyframes tmBounce{0%,80%,100%{transform:scale(.7);opacity:.5}40%{transform:scale(1);opacity:1}}
@media(max-width:400px){#tm-window{right:8px;bottom:88px;width:calc(100vw - 16px)}#tm-fab{right:16px;bottom:16px}}