.hm-tg-widget,
.hm-tg-widget * { box-sizing: border-box; }

.hm-tg-widget {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.hm-tg-panel {
    position: absolute;
    right: 0;
    bottom: 72px;
    width: 340px;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 14px 45px rgba(0,0,0,.22);
    border: 1px solid rgba(0,0,0,.06);
}

.hm-tg-header,
.hm-tg-chat-header {
    min-height: 58px;
    background: #29a4dc;
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0 14px;
}

.hm-tg-header-title { font-size: 16px; font-weight: 700; flex: 1; }
.hm-tg-close,
.hm-tg-icon-btn {
    border: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.hm-tg-close:hover,
.hm-tg-icon-btn:hover { background: rgba(255,255,255,.15); }

.hm-tg-intro-body { padding: 18px 16px 14px; }
.hm-tg-intro-body p {
    margin: 0 0 16px;
    color: #4f4f4f;
    font-size: 13px;
    line-height: 1.5;
}

.hm-tg-primary-btn {
    width: 100%;
    min-height: 42px;
    border: 0;
    border-radius: 9px;
    background: #29a4dc;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}
.hm-tg-primary-btn:hover { filter: brightness(.96); }

.hm-tg-chat-header { gap: 8px; }
.hm-tg-agent { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hm-tg-agent strong { font-size: 14px; line-height: 1.2; }
.hm-tg-agent span { font-size: 11px; opacity: .95; margin-top: 3px; display: flex; align-items: center; gap: 5px; }
.hm-tg-agent span i { width: 7px; height: 7px; background: #52d273; border-radius: 50%; display: inline-block; }

.hm-tg-messages {
    height: 330px;
    overflow-y: auto;
    background: #f6f7f9;
    padding: 14px;
    scroll-behavior: smooth;
}

.hm-tg-bubble-row { display: flex; margin: 7px 0; }
.hm-tg-bubble-row.customer { justify-content: flex-end; }
.hm-tg-bubble-row.support { justify-content: flex-start; }
.hm-tg-bubble {
    max-width: 82%;
    padding: 9px 11px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.4;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
}
.hm-tg-bubble-row.customer .hm-tg-bubble {
    background: #29a4dc;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.hm-tg-bubble-row.support .hm-tg-bubble {
    background: #fff;
    color: #222;
    border: 1px solid #e6e7e9;
    border-bottom-left-radius: 4px;
}
.hm-tg-time { font-size: 9px; opacity: .68; margin-top: 4px; text-align: right; }

.hm-tg-status {
    padding: 6px 12px;
    font-size: 11px;
    color: #8a4b00;
    background: #fff4df;
    border-top: 1px solid #f3e1c0;
}

.hm-tg-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px;
    background: #fff;
    border-top: 1px solid #e9eaec;
}
.hm-tg-form textarea {
    flex: 1;
    resize: none;
    max-height: 90px;
    min-height: 38px;
    border: 1px solid #dfe2e6;
    border-radius: 18px;
    outline: none;
    padding: 9px 12px;
    font: inherit;
    font-size: 13px;
    line-height: 18px;
    background: #fff;
}
.hm-tg-form textarea:focus { border-color: #29a4dc; }
.hm-tg-form button {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 0;
    background: #29a4dc;
    color: #fff;
    cursor: pointer;
    font-size: 16px;
    flex: 0 0 38px;
}
.hm-tg-form button:disabled { opacity: .55; cursor: default; }

.hm-tg-fab {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: 0;
    background: #29a4dc;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 22px rgba(0,0,0,.25);
    margin-left: auto;
    transition: transform .18s ease;
}
.hm-tg-fab:hover { transform: scale(1.06); }
.hm-tg-fab svg { width: 29px; height: 29px; fill: currentColor; }

@media (max-width: 480px) {
    .hm-tg-widget { right: 14px; bottom: 14px; }
    .hm-tg-panel {
        position: fixed;
        right: 12px;
        left: 12px;
        bottom: 82px;
        width: auto;
        max-height: calc(100vh - 100px);
    }
    .hm-tg-messages { height: min(360px, 48vh); }
}
