
.hf-chat-case-tools, .hf-chat-care-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.hf-chat-care, .hf-chat-cases article { display: grid; gap: .65rem; margin: .75rem 0; padding: .8rem; border: 1px solid var(--hf-color-line, #d5dfeb); border-radius: var(--hf-radius-md, .65rem); background: var(--hf-color-white, #fff); }
.hf-chat-care h3, .hf-chat-care p, .hf-chat-cases p { margin: 0; }
.hf-chat-care p, .hf-chat-cases p { font-size: .875rem; }
.hf-chat-care label { display: grid; gap: .25rem; font-size: .875rem; }
.hf-chat-care :is(input:not([type=checkbox]), select, textarea) { box-sizing: border-box; display: block; width: 100%; min-height: 2.5rem; padding: .4rem; font: inherit; border: 1px solid var(--hf-color-line, #d5dfeb); border-radius: .375rem; color: var(--hf-color-ink, #24344a); background: var(--hf-color-white, #fff); }
.hf-chat-care .hf-care-check { display: flex; align-items: baseline; gap: .4rem; }
.hf-chat-care-actions button, .hf-chat-cases button { min-height: 2.6rem; padding: .4rem .7rem; color: var(--hf-color-navy-deep, #071f46); background: var(--hf-color-white, #fff); border: 1px solid var(--hf-color-line, #d5dfeb); border-radius: .5rem; cursor: pointer; }
.hf-chat-care-actions button[type=submit] { color: var(--hf-color-white, #fff); background: var(--hf-color-navy-deep, #071f46); }

.hf-chat-ready .zalo-float {
    display: none;
}

#hf-website-chat [hidden] {
    display: none !important;
}

.hf-chat-launcher {
    position: fixed;
    right: max(var(--hf-space-4, 1rem), env(safe-area-inset-right));
    bottom: max(var(--hf-space-4, 1rem), env(safe-area-inset-bottom));
    z-index: var(--hf-layer-sticky, 20);
    display: flex;
    align-items: center;
    gap: var(--hf-space-2, .5rem);
    padding: var(--hf-space-1, .25rem) var(--hf-space-4, 1rem) var(--hf-space-1, .25rem) var(--hf-space-1, .25rem);
    min-height: 48px;
    color: var(--hf-color-white, #fff);
    background: var(--hf-color-navy-deep, #071f46);
    border: 1px solid var(--hf-color-line, #d5dfeb);
    border-radius: 999px;
    box-shadow: 0 8px 24px rgb(7 31 70 / 17%);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.hf-chat-avatar {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 50%;
    background: var(--hf-color-yellow-soft, #fff4a5);
}

.hf-chat-dialog {
    position: fixed;
    inset: auto max(var(--hf-space-4, 1rem), env(safe-area-inset-right)) max(var(--hf-space-4, 1rem), env(safe-area-inset-bottom)) auto;
    width: min(26rem, calc(100% - 2rem));
    height: min(36rem, calc(100dvh - 2rem));
    margin: 0;
    padding: 0;
    border: 1px solid var(--hf-color-line, #d5dfeb);
    border-radius: var(--hf-radius-lg, 1rem);
    color: var(--hf-color-ink, #24344a);
    background: var(--hf-color-white, #fff);
    box-shadow: 0 16px 48px rgb(7 31 70 / 23%);
    overflow: hidden;
}

.hf-chat-dialog[open] {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
}

.hf-chat-dialog::backdrop {
    background: rgb(7 31 70 / 16%);
}

.hf-chat-header, .hf-chat-composer, .hf-chat-thread {
    padding: var(--hf-space-3, .75rem);
}

.hf-chat-header {
    display: flex;
    align-items: center;
    gap: var(--hf-space-2, .5rem);
    color: var(--hf-color-white, #fff);
    background: var(--hf-color-navy-deep, #071f46);
}

.hf-chat-header h2, .hf-chat-header p, .hf-chat-composer p {
    margin: 0;
    color: inherit;
}

.hf-chat-header h2 {
    font-size: var(--hf-type-body-size, 1rem);
}

.hf-chat-header p, .hf-chat-composer p, .hf-chat-review {
    font-size: var(--hf-type-small-size, .875rem);
}

.hf-chat-close {
    position: relative;
    flex: 0 0 44px;
    margin-inline-start: auto;
    width: 44px;
    height: 44px;
    color: inherit;
    background: var(--hf-color-navy, #1e3f74);
    border: 1px solid rgb(255 255 255 / 38%);
    border-radius: 50%;
    font-size: 0;
    cursor: pointer;
}

.hf-chat-close:hover {
    background: var(--hf-color-navy-strong, #0c2a59);
    border-color: var(--hf-color-white, #fff);
}

.hf-chat-close::before,
.hf-chat-close::after {
    content: "";
    position: absolute;
    inset: 50% auto auto 50%;
    width: 20px;
    height: 2.5px;
    border-radius: 999px;
    background: currentColor;
    transform: translate(-50%, -50%) rotate(45deg);
}

.hf-chat-close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.hf-chat-thread {
    overflow: auto;
    background: var(--hf-color-warm, #fcfaf4);
}

.hf-chat-thread ol {
    display: grid;
    gap: var(--hf-space-2, .5rem);
    margin: 0;
    padding: 0;
    list-style: none;
}

.hf-chat-thread li, .hf-chat-review {
    padding: var(--hf-space-3, .75rem);
    border: 1px solid var(--hf-color-line, #d5dfeb);
    border-radius: var(--hf-radius-md, .75rem);
    background: var(--hf-color-white, #fff);
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.hf-chat-thread li {
    justify-self: start;
    max-width: 94%;
}

.hf-chat-thread li[data-role="customer"] {
    justify-self: end;
    background: var(--hf-color-pale, #f6f9fc);
}

.hf-chat-typing {
    display: flex;
    align-items: center;
    gap: .28rem;
    width: fit-content;
    min-height: 2.25rem;
    margin-top: var(--hf-space-2, .5rem);
    padding: .4rem .68rem;
    border: 1px solid var(--hf-color-line, #d5dfeb);
    border-radius: var(--hf-radius-md, .75rem);
    background: var(--hf-color-white, #fff);
}

.hf-chat-typing span {
    width: .4rem;
    height: .4rem;
    border-radius: 50%;
    background: var(--hf-color-muted, #647184);
    animation: hf-chat-typing-dot 1s ease-in-out infinite;
}

.hf-chat-typing span:nth-child(2) { animation-delay: 120ms; }
.hf-chat-typing span:nth-child(3) { animation-delay: 240ms; }

.hf-chat-reply-enter {
    animation: hf-chat-reply-in 160ms ease-out both;
}

@keyframes hf-chat-typing-dot {
    0%, 65%, 100% { transform: translateY(0); opacity: .45; }
    30% { transform: translateY(-.2rem); opacity: 1; }
}

@keyframes hf-chat-reply-in {
    from { opacity: 0; transform: translateY(.2rem); }
    to { opacity: 1; transform: translateY(0); }
}

.hf-chat-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
    .hf-chat-typing span,
    .hf-chat-reply-enter {
        animation: none;
    }
}

.hf-chat-review {
    margin-top: var(--hf-space-3, .75rem);
    white-space: normal;
}

.hf-chat-review h3 {
    margin: 0 0 var(--hf-space-2, .5rem);
    font-size: var(--hf-type-body-size, 1rem);
}

.hf-chat-review dl {
    display: grid;
    grid-template-columns: 1fr 2fr;
    margin: 0;
    gap: var(--hf-space-2, .5rem);
}

.hf-chat-review dd {
    margin: 0;
}

.hf-chat-handoff {
    display: grid;
    gap: var(--hf-space-2, .5rem);
    margin-top: var(--hf-space-3, .75rem);
}

.hf-chat-follow-up {
    display: grid;
    gap: var(--hf-space-1, .25rem);
}

.hf-chat-follow-up select {
    box-sizing: border-box;
    width: 100%;
    min-height: 44px;
    padding: var(--hf-space-2, .5rem);
    border: 1px solid var(--hf-color-navy, #1e3f74);
    border-radius: var(--hf-radius-sm, .5rem);
    background: var(--hf-color-white, #fff);
    color: var(--hf-color-navy-deep, #071f46);
    font: inherit;
    font-size: max(1rem, 16px);
}

.hf-chat-handoff-reference {
    margin: 0;
    color: var(--hf-color-muted, #647184);
    overflow-wrap: anywhere;
}

.hf-chat-zalo-hint {
    margin: 0;
    color: var(--hf-color-muted, #647184);
}

.hf-chat-zalo-preview summary {
    padding-block: var(--hf-space-2, .5rem);
    color: var(--hf-color-navy, #1e3f74);
    cursor: pointer;
}

.hf-chat-zalo-preview textarea {
    box-sizing: border-box;
    display: block;
    width: 100%;
    min-height: 7rem;
    margin-bottom: var(--hf-space-2, .5rem);
}

.hf-chat-composer {
    border-top: 1px solid var(--hf-color-line, #d5dfeb);
}

.hf-chat-composer form {
    display: flex;
    align-items: flex-end;
    gap: var(--hf-space-2, .5rem);
}

.hf-chat-dialog textarea {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    padding: var(--hf-space-2, .5rem);
    border: 1px solid var(--hf-color-muted, #647184);
    border-radius: var(--hf-radius-sm, .5rem);
    font: inherit;
    color: inherit;
    background: var(--hf-color-white, #fff);
    resize: vertical;
}

.hf-chat-composer textarea {
    box-sizing: border-box;
    display: block;
    max-height: max(44px, min(10rem, 26dvh));
    max-height: max(44px, min(calc(6lh + 1rem + 2px), 26dvh));
    line-height: 1.5;
    overflow-y: auto;
    resize: none;
}

.hf-chat-handoff button, .hf-chat-handoff a, .hf-chat-composer form button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: var(--hf-space-2, .5rem) var(--hf-space-3, .75rem);
    border: 1px solid var(--hf-color-navy, #1e3f74);
    border-radius: var(--hf-radius-sm, .5rem);
    color: var(--hf-color-navy-deep, #071f46);
    background: var(--hf-color-white, #fff);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.hf-chat-handoff a, .hf-chat-handoff [data-confirm], .hf-chat-composer form button {
    background: var(--hf-color-yellow, #fbd90c);
}

.hf-chat-delete {
    display: block;
    min-height: 44px;
    margin-inline-start: auto;
    padding-inline: var(--hf-space-2, .5rem);
    border: 0;
    color: var(--hf-color-navy, #1e3f74);
    background: transparent;
    font: inherit;
    font-size: var(--hf-type-small-size, .875rem);
    text-decoration: underline;
    cursor: pointer;
}

.hf-chat-delete[hidden] {
    display: none;
}

.hf-chat-dialog button:disabled {
    opacity: .55;
    cursor: default;
}

#hf-website-chat :focus-visible {
    outline: 3px solid var(--hf-color-navy, #1e3f74);
    outline-offset: 2px;
}

#hf-website-chat .hf-chat-close:focus-visible {
    outline-color: var(--hf-color-yellow, #fbd90c);
}

@media (max-width: 767px), (hover: none) and (pointer: coarse) and (max-height: 540px) {
    html.hf-chat-page-locked,
    html.hf-chat-page-locked body {
        overflow: hidden;
        overscroll-behavior: none;
    }

    .hf-chat-dialog {
        inset: var(--hf-chat-viewport-top, 0px) 0 auto;
        width: 100%;
        max-width: none;
        height: 100vh;
        height: var(--hf-chat-viewport-height, 100dvh);
        max-height: none;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .hf-chat-header,
    .hf-chat-thread,
    .hf-chat-composer {
        padding-inline-start: max(var(--hf-space-3, .75rem), env(safe-area-inset-left));
        padding-inline-end: max(var(--hf-space-3, .75rem), env(safe-area-inset-right));
    }

    .hf-chat-header {
        padding-block-start: calc(var(--hf-space-3, .75rem) + env(safe-area-inset-top));
    }

    .hf-chat-thread {
        overscroll-behavior: contain;
    }

    .hf-chat-composer {
        padding-block-end: max(var(--hf-space-3, .75rem), env(safe-area-inset-bottom));
    }

    .hf-chat-composer textarea {
        font-size: max(16px, 1em);
        max-height: max(44px, min(calc(6lh + 1rem + 2px), calc(var(--hf-chat-viewport-height, 100dvh) * .28)));
    }

    .hf-chat-close {
        order: -1;
        margin-inline-start: 0;
        border: 0;
        background: transparent;
    }

    .hf-chat-close::before {
        width: 12px;
        height: 12px;
        border: solid currentColor;
        border-width: 0 0 2px 2px;
        border-radius: 0;
        background: transparent;
        transform: translate(-36%, -50%) rotate(45deg);
    }

    .hf-chat-close::after {
        content: none;
    }
}
