#tt-chat-widget,
#tt-chat-widget * {
    box-sizing: border-box !important;
}

#tt-chat-widget {
    position: fixed !important;
    right: 20px !important;
    bottom: 20px !important;
    z-index: 999999 !important;
    width: auto;
    height: auto;
    margin: 0;
    padding: 0;
    font-family: Arial, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.35;
    isolation: isolate;
}

#tt-chat-widget button,
#tt-chat-widget input,
#tt-chat-widget [contenteditable="true"] {
    margin: 0;
    box-shadow: none;
    text-indent: 0;
    text-transform: none;
    letter-spacing: normal;
    font-family: inherit;
    line-height: normal;
}

#tt-chat-widget button::before,
#tt-chat-widget button::after {
    content: none !important;
}

#tt-chat-widget [hidden] {
    display: none !important;
}

#tt-chat-widget .ttc-window,
#tt-chat-widget .ttc-header,
#tt-chat-widget .ttc-footer,
#tt-chat-widget .ttc-content,
#tt-chat-widget .ttc-toolbar,
#tt-chat-widget .ttc-input-wrapper,
#tt-chat-widget .ttc-group {
    margin: 0;
}

/* ==========================================================================
   ICON MỞ CHAT
   - Bình thường: nhịp thở nhẹ.
   - Có .has-unread: nổi bật và rung nhẹ theo chu kỳ.
   ========================================================================== */

#tt-chat-widget .ttc-toggle {
    position: relative;
    width: 64px;
    min-width: 64px;
    max-width: 64px;
    height: 64px;
    min-height: 64px;
    max-height: 64px;
    margin-left: auto;
    padding: 0;
    display: grid;
    place-items: center;
    overflow: visible;
    border: 3px solid #fff;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(135deg, #159cff 0%, #0787f8 48%, #006ed4 100%);
    cursor: pointer;
    box-shadow:
        0 9px 28px rgba(0, 132, 255, .42),
        0 3px 9px rgba(0, 0, 0, .18);
    animation: ttc-focus-pulse 3.8s ease-in-out infinite;
    transform-origin: center;
    will-change: transform, box-shadow, filter;
    transition:
        transform .18s ease,
        box-shadow .18s ease,
        filter .18s ease;
    appearance: none;
}

#tt-chat-widget .ttc-toggle-icon,
#tt-chat-widget .ttc-toggle-icon svg {
    display: block;
    width: 34px;
    height: 34px;
}

#tt-chat-widget .ttc-toggle-icon {
    position: relative;
    z-index: 2;
    transform-origin: center;
    will-change: transform;
}

#tt-chat-widget .ttc-toggle.has-unread {
    animation: ttc-unread-attention 2.8s ease-in-out infinite;
}

#tt-chat-widget .ttc-toggle.has-unread .ttc-toggle-icon {
    animation: ttc-icon-attention 2.8s ease-in-out infinite;
}

#tt-chat-widget .ttc-toggle:hover {
    animation: none;
    filter: brightness(1.08) saturate(1.06);
    transform: translateY(-3px) scale(1.06);
    box-shadow:
        0 14px 36px rgba(0, 132, 255, .52),
        0 5px 13px rgba(0, 0, 0, .2);
}

#tt-chat-widget .ttc-toggle:hover .ttc-toggle-icon {
    animation: none;
}

#tt-chat-widget .ttc-toggle:active {
    animation: none;
    transform: translateY(0) scale(.95);
}

#tt-chat-widget .ttc-toggle:focus-visible {
    outline: 4px solid rgba(255, 166, 33, .48);
    outline-offset: 4px;
}

#tt-chat-widget .ttc-toggle[aria-expanded="true"],
#tt-chat-widget .ttc-toggle[aria-expanded="true"] .ttc-toggle-icon {
    animation: none;
}

#tt-chat-widget .ttc-unread-badge {
    position: absolute;
    z-index: 5;
    top: -5px;
    right: -5px;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    display: grid;
    place-items: center;
    border: 2px solid #fff;
    border-radius: 999px;
    background: #f02821;
    color: #fff;
    box-shadow:
        0 3px 10px rgba(240, 40, 33, .52),
        0 0 0 3px rgba(240, 40, 33, .12);
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    animation: ttc-unread-badge-pulse 1.4s ease-in-out infinite;
}

/* ==========================================================================
   CỬA SỔ CHAT
   ========================================================================== */

#tt-chat-widget .ttc-window {
    width: 370px;
    height: 540px;
    max-width: calc(100vw - 30px);
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #dce2e8;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .22);
    transition: width .2s ease, height .2s ease;
}

#tt-chat-widget .ttc-window.is-expanded {
    width: min(720px, calc(100vw - 40px));
    height: min(780px, calc(100vh - 40px));
}

/* ==========================================================================
   HEADER
   ========================================================================== */

#tt-chat-widget .ttc-header {
    width: 100%;
    min-height: 52px;
    padding: 7px 6px 7px 11px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    flex: 0 0 auto;
    border: 0;
    border-radius: 0;
    background: #0787f8;
    color: #fff;
}

#tt-chat-widget .ttc-header-title {
    margin: 0;
    padding: 0;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
}

#tt-chat-widget .ttc-header-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    min-width: 0;
    gap: 3px;
}

#tt-chat-widget .ttc-header-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: rgba(255, 255, 255, .95);
    font-size: 11px;
    line-height: 1.25;
    white-space: nowrap;
}

#tt-chat-widget .ttc-online-dot {
    position: relative;
    display: inline-block;
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #41ed79;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .3);
}

#tt-chat-widget .ttc-online-dot::after {
    content: "";
    position: absolute;
    inset: -5px;
    border: 1.5px solid rgba(94, 255, 148, .8);
    border-radius: inherit;
    pointer-events: none;
    animation: ttc-online-ring 2.4s ease-out infinite;
}

@keyframes ttc-online-ring {
    0% { opacity: .95; transform: scale(.55); }
    75%, 100% { opacity: 0; transform: scale(1.35); }
}

/* Tín hiệu online luôn hiển thị trên nút chat khi khung đang thu gọn. */
#tt-chat-widget .ttc-toggle-online.ttc-online-dot {
    position: absolute;
    z-index: 4;
    width: 15px;
    height: 15px;
    top: -3px;
    left: -3px;
    border: 2px solid #fff;
}

#tt-chat-widget .ttc-header-actions {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 1px;
}

#tt-chat-widget .ttc-header-btn {
    position: relative;
    z-index: 3;
    width: 30px;
    min-width: 30px;
    max-width: 30px;
    height: 30px;
    min-height: 30px;
    max-height: 30px;
    padding: 5px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #fff;
    cursor: pointer;
    appearance: none;
}

#tt-chat-widget .ttc-header-btn:hover {
    background: rgba(255, 255, 255, .16);
}

#tt-chat-widget .ttc-header-btn svg {
    display: block;
    width: 18px;
    height: 18px;
}

/* ==========================================================================
   NỘI DUNG HỘI THOẠI
   ========================================================================== */

#tt-chat-widget .ttc-content {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 8px;
    border: 0;
    background: #f7f8fa;
    color: #25282b;
    font-size: 14px;
    scrollbar-width: thin;
}

#tt-chat-widget .ttc-msg-row {
    display: flex;
    width: 100%;
    margin: 5px 0;
    padding: 0;
}

#tt-chat-widget .ttc-msg-row-user {
    justify-content: flex-end;
}

#tt-chat-widget .ttc-msg-row-bot {
    justify-content: flex-start;
}

#tt-chat-widget .ttc-msg-box {
    max-width: 82%;
    margin: 0;
    padding: 7px 10px;
    border: 0;
    border-radius: 13px;
    overflow-wrap: anywhere;
    word-break: break-word;
}

#tt-chat-widget .ttc-msg-user {
    background: #0787f8;
    color: #fff;
    border-bottom-right-radius: 5px;
}

#tt-chat-widget .ttc-msg-bot {
    background: #e8eaed;
    color: #25282b;
    border-bottom-left-radius: 5px;
}

#tt-chat-widget .ttc-msg-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin: 0 0 2px;
    padding: 0;
}

#tt-chat-widget .ttc-msg-meta strong {
    margin: 0;
    color: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
}

#tt-chat-widget .ttc-msg-bot .ttc-msg-meta strong {
    color: #0074d9;
}

#tt-chat-widget .ttc-msg-meta small {
    flex: 0 0 auto;
    margin: 0;
    color: inherit;
    opacity: .68;
    font-size: 9px;
    line-height: 1.2;
}

#tt-chat-widget .ttc-msg-body {
    margin: 0;
    padding: 0;
    white-space: pre-wrap;
    line-height: 1.4;
}

/* ==========================================================================
   FOOTER + TOOLBAR
   ========================================================================== */

#tt-chat-widget .ttc-footer {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: #fff;
}

#tt-chat-widget .ttc-toolbar {
    width: 100%;
    min-width: 0;
    min-height: 32px;
    padding: 2px 5px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 3px;
    overflow: hidden;
    border-top: 1px solid #eceff2;
    border-bottom: 1px solid #eceff2;
    background: #fff;
}

#tt-chat-widget .ttc-group {
    min-width: 0;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0;
    padding: 0;
    overflow: hidden;
}

#tt-chat-widget .ttc-group:last-child {
    justify-content: flex-end;
    overflow: visible;
}

#tt-chat-widget .ttc-btn,
#tt-chat-widget .ttc-emoji {
    position: static;
    flex: 0 0 25px;
    width: 25px;
    min-width: 25px;
    max-width: 25px;
    height: 27px;
    min-height: 27px;
    max-height: 27px;
    padding: 3px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #3f454b;
    cursor: pointer;
    font-size: 13px;
    appearance: none;
}

#tt-chat-widget .ttc-btn:hover,
#tt-chat-widget .ttc-emoji:hover {
    background: #e7eaee;
}

#tt-chat-widget .ttc-btn svg {
    display: block;
    width: 17px;
    height: 17px;
}

#tt-chat-widget .ttc-format-btn,
#tt-chat-widget .ttc-size-btn {
    font-size: 13px;
    line-height: 1;
}

#tt-chat-widget .ttc-emoji {
    font-size: 18px;
    line-height: 1;
}

#tt-chat-widget #ttc-color-picker {
    position: static;
    flex: 0 0 24px;
    width: 24px;
    min-width: 24px;
    max-width: 24px;
    height: 24px;
    min-height: 24px;
    max-height: 24px;
    margin: 0;
    padding: 3px;
    overflow: hidden;
    border: 0;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    appearance: none;
}

#tt-chat-widget .ttc-more-emoji {
    flex-basis: 24px;
    width: 24px;
    min-width: 24px;
    max-width: 24px;
    border-left: 1px solid #e2e6ea;
    border-radius: 0 6px 6px 0;
}

#tt-chat-widget .ttc-more-emoji svg {
    width: 15px;
    height: 15px;
    transition: transform .18s ease;
}

#tt-chat-widget .ttc-icon-list {
    width: 100%;
    max-height: 82px;
    margin: 0;
    padding: 4px 6px;
    flex-wrap: wrap;
    gap: 2px;
    overflow-y: auto;
    border: 0;
    border-bottom: 1px solid #eceff2;
    background: #fff;
}

#tt-chat-widget .ttc-icon-list[hidden] {
    display: none !important;
}

#tt-chat-widget .ttc-icon-list:not([hidden]) {
    display: flex;
}

#tt-chat-widget .ttc-more-emoji.is-open svg {
    transform: rotate(180deg);
}

/* ==========================================================================
   EDITOR + NÚT GỬI
   ========================================================================== */

#tt-chat-widget .ttc-input-wrapper {
    position: relative;
    width: 100%;
    min-width: 0;
    min-height: 50px;
    margin: 0;
    padding: 5px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 6px;
    overflow: visible;
    border: 0;
    background: #fff;
}

#tt-chat-widget .ttc-editor {
    position: static;
    width: 100%;
    min-width: 0;
    max-width: none;
    min-height: 40px;
    max-height: 112px;
    margin: 0;
    padding: 8px 9px;
    overflow-y: auto;
    outline: none;
    border: 1px solid #cfe0f2;
    border-radius: 10px;
    background: #fff;
    color: #25282b;
    font-size: 14px;
    line-height: 1.35;
}

#tt-chat-widget .ttc-editor:focus {
    border-color: #86bfff;
    box-shadow: 0 0 0 2px rgba(0, 132, 255, .09);
    background: #fbfdff;
}

#tt-chat-widget .ttc-editor:empty::before {
    content: attr(data-placeholder);
    color: #a3a9b0;
    pointer-events: none;
}

#tt-chat-widget .ttc-btn-send {
    position: static;
    align-self: stretch;
    width: auto;
    min-width: 55px;
    max-width: 70px;
    min-height: 40px;
    height: auto;
    margin: 0;
    padding: 0 12px;
    display: inline-grid;
    place-items: center;
    border: 0;
    border-radius: 10px;
    background: #0787f8;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    appearance: none;
}

#tt-chat-widget .ttc-btn-send:hover {
    background: #0074e4;
}

#tt-chat-widget .ttc-btn-send:disabled {
    opacity: .55;
    cursor: wait;
}

/* ==========================================================================
   PREVIEW + ẢNH CHAT
   ========================================================================== */

#tt-chat-widget .ttc-file-preview {
    position: absolute;
    left: 7px;
    bottom: calc(100% + 4px);
    z-index: 5;
    margin: 0;
    padding: 7px;
    border: 1px solid #dfe3e8;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 -5px 18px rgba(0, 0, 0, .12);
}

#tt-chat-widget .ttc-file-preview img {
    display: block;
    width: auto;
    height: 70px;
    max-width: 160px;
    margin: 0;
    object-fit: cover;
    border: 0;
    border-radius: 7px;
}

#tt-chat-widget .ttc-remove-file {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 23px;
    min-width: 23px;
    max-width: 23px;
    height: 23px;
    min-height: 23px;
    max-height: 23px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #e53935;
    color: #fff;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
}

#tt-chat-widget .ttc-chat-img {
    display: block;
    max-width: 230px;
    max-height: 230px;
    margin: 6px 0 0;
    border: 1px solid rgba(0, 0, 0, .12);
    border-radius: 9px;
    object-fit: cover;
}

#tt-chat-widget .ttc-chat-link,
#tt-chat-widget .ttc-chat-file {
    color: inherit;
    text-decoration: underline;
    overflow-wrap: anywhere;
}

#tt-chat-widget .ttc-msg-user .ttc-chat-link,
#tt-chat-widget .ttc-msg-user .ttc-chat-file {
    color: #fff;
}

#tt-chat-widget .ttc-send-error {
    margin: 5px 0 0;
    font-size: 11px;
    font-weight: 600;
    color: #ffe3e1;
}

/* ==========================================================================
   TYPING
   ========================================================================== */

#tt-chat-widget .ttc-typing-box {
    min-width: 108px;
}

#tt-chat-widget .ttc-typing-label {
    margin: 0 0 2px;
    color: #697078;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
}

#tt-chat-widget .ttc-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 2px 3px;
}

#tt-chat-widget .ttc-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #8b9198;
    animation: ttc-bounce 1.2s infinite ease-in-out;
}

#tt-chat-widget .ttc-typing span:nth-child(2) {
    animation-delay: .15s;
}

#tt-chat-widget .ttc-typing span:nth-child(3) {
    animation-delay: .3s;
}

/* ==========================================================================
   ANIMATION
   ========================================================================== */

@keyframes ttc-bounce {
    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-4px);
    }
}

@keyframes ttc-focus-pulse {
    0%,
    100% {
        box-shadow:
            0 0 0 0 rgba(0, 132, 255, .32),
            0 9px 28px rgba(0, 132, 255, .42),
            0 3px 9px rgba(0, 0, 0, .18);
        filter: brightness(1);
        transform: translateY(0) scale(1);
    }

    45% {
        box-shadow:
            0 0 0 10px rgba(0, 132, 255, 0),
            0 11px 31px rgba(0, 132, 255, .48),
            0 4px 10px rgba(0, 0, 0, .17);
        filter: brightness(1.04);
        transform: translateY(-1px) scale(1.015);
    }
}

@keyframes ttc-unread-attention {
    0%,
    62%,
    100% {
        box-shadow:
            0 0 0 0 rgba(255, 152, 24, .5),
            0 10px 30px rgba(0, 132, 255, .46),
            0 3px 9px rgba(0, 0, 0, .18);
        filter: brightness(1);
        transform: translateY(0) scale(1) rotate(0deg);
    }

    70% {
        box-shadow:
            0 0 0 14px rgba(255, 152, 24, 0),
            0 15px 36px rgba(0, 132, 255, .55),
            0 5px 12px rgba(0, 0, 0, .18);
        filter: brightness(1.08);
        transform: translateY(-5px) scale(1.07) rotate(0deg);
    }

    77% {
        transform: translateY(-2px) scale(1.04) rotate(-4deg);
    }

    84% {
        transform: translateY(-3px) scale(1.05) rotate(4deg);
    }

    91% {
        transform: translateY(-1px) scale(1.02) rotate(-2deg);
    }
}

@keyframes ttc-icon-attention {
    0%,
    62%,
    100% {
        transform: scale(1) rotate(0deg);
    }

    70% {
        transform: scale(1.14);
    }

    77% {
        transform: scale(1.12) rotate(-6deg);
    }

    84% {
        transform: scale(1.12) rotate(6deg);
    }

    91% {
        transform: scale(1.06) rotate(-3deg);
    }
}

@keyframes ttc-unread-badge-pulse {
    0%,
    100% {
        transform: scale(1);
        box-shadow:
            0 3px 10px rgba(240, 40, 33, .52),
            0 0 0 0 rgba(240, 40, 33, .34);
    }

    50% {
        transform: scale(1.15);
        box-shadow:
            0 4px 13px rgba(240, 40, 33, .58),
            0 0 0 6px rgba(240, 40, 33, 0);
    }
}

/* ==========================================================================
   ACCESSIBILITY
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    #tt-chat-widget .ttc-toggle,
    #tt-chat-widget .ttc-toggle-icon,
    #tt-chat-widget .ttc-unread-badge,
    #tt-chat-widget .ttc-online-dot::after {
        animation: none;
    }
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 768px) {
    /*
     * MOBILE FULL-SCREEN MODE
     * - Khung chat phủ đúng vùng nhìn thực tế của trình duyệt.
     * - visualViewport (JS) cập nhật kích thước khi thanh trình duyệt/bàn phím thay đổi.
     * - 100dvh/100vw là fallback khi visualViewport không khả dụng.
     */
    #tt-chat-widget {
        right: 0 !important;
        bottom: 0 !important;
        width: 0 !important;
        height: 0 !important;
    }

    #tt-chat-widget .ttc-toggle {
        position: fixed;
        right: max(10px, env(safe-area-inset-right, 0px));
        bottom: max(18px, env(safe-area-inset-bottom, 0px));
        width: 61px;
        min-width: 61px;
        max-width: 61px;
        height: 61px;
        min-height: 61px;
        max-height: 61px;
    }

    #tt-chat-widget .ttc-toggle-icon,
    #tt-chat-widget .ttc-toggle-icon svg {
        width: 32px;
        height: 32px;
    }

    #tt-chat-widget .ttc-window,
    #tt-chat-widget .ttc-window.is-expanded {
        position: fixed !important;
        z-index: 2147483000 !important;
        top: var(--ttc-vv-top, 0px) !important;
        left: var(--ttc-vv-left, 0px) !important;
        right: auto !important;
        bottom: auto !important;
        width: var(--ttc-vv-width, 100vw) !important;
        height: var(--ttc-vv-height, 100vh) !important;
        height: var(--ttc-vv-height, 100dvh) !important;
        min-width: 0 !important;
        min-height: 0 !important;
        max-width: none !important;
        max-height: none !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        transition: none !important;
        overflow: hidden;
        overscroll-behavior: contain;
    }

    /* Header luôn nằm ở đỉnh vùng nhìn và tôn trọng tai thỏ/safe-area. */
    #tt-chat-widget .ttc-header {
        min-height: calc(56px + env(safe-area-inset-top, 0px));
        padding-top: max(4px, env(safe-area-inset-top, 0px));
        padding-right: max(6px, env(safe-area-inset-right, 0px));
        padding-left: max(11px, env(safe-area-inset-left, 0px));
        flex: 0 0 auto;
        position: relative;
        z-index: 20;
        border-radius: 0 !important;
    }

    #tt-chat-widget .ttc-header-actions {
        flex: 0 0 auto;
        position: relative;
        z-index: 21;
    }

    /* Full-screen trên mobile nên nút phóng to không còn cần thiết. */
    #tt-chat-widget #ttc-expand {
        display: none !important;
    }

    #tt-chat-widget .ttc-header-btn {
        width: 38px;
        min-width: 38px;
        max-width: 38px;
        height: 38px;
        min-height: 38px;
        max-height: 38px;
        padding: 9px;
    }

    #tt-chat-widget .ttc-header-btn svg {
        width: 18px;
        height: 18px;
    }

    /*
     * Nút ghim Ẩn độc lập với header.
     * JS đặt top theo visualViewport nên vẫn nằm trong vùng nhìn khi bàn phím hiện.
     */
    #tt-chat-widget .ttc-side-hide {
        position: fixed !important;
        z-index: 2147483640 !important;
        top: var(--ttc-side-hide-top, calc(100dvh - 110px - env(safe-area-inset-bottom, 0px))) !important;
        right: max(0px, env(safe-area-inset-right, 0px)) !important;
        transform: translateY(-50%);
        width: 32px;
        min-width: 32px;
        max-width: 32px;
        height: 48px;
        min-height: 48px;
        max-height: 48px;
        padding: 0 2px 0 0;
        display: grid;
        place-items: center;
        border: 1px solid rgba(255, 255, 255, .9);
        border-right: 0;
        border-radius: 14px 0 0 14px;
        background: #e53935;
        color: #fff;
        box-shadow: -3px 4px 15px rgba(229, 57, 53, .34);
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        backdrop-filter: blur(6px);
    }

    #tt-chat-widget .ttc-side-hide svg {
        display: block;
        width: 19px;
        height: 19px;
    }

    #tt-chat-widget .ttc-side-hide:active {
        transform: translateY(-50%) scale(.94);
    }

    #tt-chat-widget .ttc-content {
        min-height: 0;
        flex: 1 1 auto;
        overscroll-behavior: contain;
    }

    #tt-chat-widget .ttc-footer {
        flex: 0 0 auto;
        padding-bottom: max(0px, env(safe-area-inset-bottom, 0px));
    }

    #tt-chat-widget .ttc-msg-box {
        max-width: 88%;
    }
}

@media (max-width: 390px) {
    #tt-chat-widget .ttc-toggle {
        right: max(8px, env(safe-area-inset-right, 0px));
        width: 59px;
        min-width: 59px;
        max-width: 59px;
        height: 59px;
        min-height: 59px;
        max-height: 59px;
    }

    #tt-chat-widget .ttc-toggle-icon,
    #tt-chat-widget .ttc-toggle-icon svg {
        width: 31px;
        height: 31px;
    }

    #tt-chat-widget .ttc-btn,
    #tt-chat-widget .ttc-emoji {
        flex-basis: 24px;
        width: 24px;
        min-width: 24px;
        max-width: 24px;
    }

    #tt-chat-widget .ttc-input-wrapper {
        padding: 4px;
        gap: 4px;
    }

    #tt-chat-widget .ttc-btn-send {
        min-width: 52px;
        padding: 0 9px;
    }
}

@media (min-width: 769px) {
    #tt-chat-widget .ttc-side-hide {
        display: none !important;
    }
}

/* ==========================================================================
   BẢO VỆ CLICK/TOUCH
   ========================================================================== */

#tt-chat-widget #chat-toggle,
#tt-chat-widget #ttc-close,
#tt-chat-widget #ttc-side-hide,
#tt-chat-widget #ttc-expand,
#tt-chat-widget #ttc-attach,
#tt-chat-widget #ttc-send {
    pointer-events: auto !important;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}
/* Explicit history failure is not an empty conversation. */
#tt-chat-widget .ttc-history-retry {
    align-self: center;
    max-width: 100%;
    padding: 8px 12px;
    color: #9b2525;
    background: #fff;
    border: 1px solid #d9aaaa;
    border-radius: 8px;
    white-space: normal;
    cursor: pointer;
}
