
.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 {
    color-scheme: light;
    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-welcome-view {
    height: auto;
    max-height: min(36rem, calc(100dvh - 2rem));
}

.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);
    border-bottom: 1px solid var(--hf-color-navy, #1e3f74);
}

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

.hf-chat-header h2 {
    font-family: var(--hf-font-heading, 'Readex Pro', Arial, sans-serif);
    font-size: var(--hf-type-body, 1rem);
    font-weight: 700;
}

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

.hf-chat-header p {
    color: var(--hf-color-on-dark, #dbe6f5);
}

.hf-chat-close, .hf-chat-back {
    position: relative;
    flex: 0 0 44px;
    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 { margin-inline-start: auto; }

.hf-chat-close:hover, .hf-chat-back: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-back::before {
    content: "";
    position: absolute;
    inset: 50% auto auto 50%;
    width: 10px;
    height: 10px;
    border: solid currentColor;
    border-width: 0 0 2px 2px;
    transform: translate(-35%, -50%) rotate(45deg);
}

.hf-chat-welcome {
    overflow: auto;
    overscroll-behavior: contain;
    padding: var(--hf-space-4, 1rem);
    background: var(--hf-color-warm, #fcfaf4);
}

.hf-chat-welcome-intro {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(70px, 34%);
    column-gap: var(--hf-space-2, .5rem);
    align-items: center;
    min-height: 148px;
    overflow: hidden;
    padding: var(--hf-space-4, 1rem);
    border-radius: var(--hf-radius-md, 10px);
    background: var(--hf-color-warm, #fcfaf4);
    background: color-mix(in srgb, var(--hf-color-warm, #fcfaf4) 66%, var(--hf-color-yellow-soft, #fff4a5));
    color: var(--hf-color-navy-deep, #071f46);
}

.hf-chat-welcome-intro h3 {
    margin: 0;
    font-family: var(--hf-font-heading, 'Readex Pro', Arial, sans-serif);
    font-size: var(--hf-type-prose-h3, 1.5rem);
    font-weight: 700;
    line-height: 1.28;
    color: inherit;
}

.hf-chat-welcome-intro h3 span { display: inline-block; }

.hf-chat-welcome-intro p {
    margin: var(--hf-space-2, .5rem) 0 0;
    font-size: var(--hf-type-small, .875rem);
    color: var(--hf-color-ink, #24344a);
}

.hf-chat-welcome-art {
    position: relative;
    align-self: stretch;
    display: grid;
    place-items: center;
}

.hf-chat-welcome-art::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset-inline-start: 2%;
    top: 50%;
    width: 149%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--hf-color-yellow-soft, #fff4a5);
    transform: translateY(-38%);
}

.hf-chat-welcome-art img {
    display: block;
    width: 100%;
    height: auto;
}

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

.hf-chat-topics button {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 12px;
    align-items: center;
    gap: 0 var(--hf-space-3, .75rem);
    min-height: 60px;
    padding: var(--hf-space-2, .5rem) var(--hf-space-3, .75rem);
    border: 1px solid var(--hf-color-line, #d5dfeb);
    border-radius: var(--hf-radius-md, 10px);
    background: var(--hf-color-white, #fff);
    color: var(--hf-color-navy-deep, #071f46);
    text-align: start;
    font: inherit;
    line-height: 1.3;
    cursor: pointer;
    transition: background-color var(--hf-motion-fast, 160ms), border-color var(--hf-motion-fast, 160ms);
}

.hf-chat-topics button:hover {
    background: var(--hf-color-pale, #f6f9fc);
    border-color: var(--hf-color-control-border, #647184);
}

.hf-chat-topics button::after {
    content: "";
    grid-column: 2;
    grid-row: 1 / span 2;
    justify-self: center;
    width: 8px;
    height: 8px;
    border: solid currentColor;
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(-45deg);
}

.hf-chat-topics strong, .hf-chat-topics span { grid-column: 1; }
.hf-chat-topics span {
    font-size: var(--hf-type-small, .875rem);
    color: var(--hf-color-muted, #647184);
}

.hf-chat-welcome-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0 var(--hf-space-2, .5rem);
    margin-top: var(--hf-space-1, .25rem);
}

.hf-chat-welcome-links a, .hf-chat-resume {
    display: inline-flex;
    align-items: center;
    min-height: var(--hf-control-target, 44px);
    color: var(--hf-color-navy, #1e3f74);
    font: inherit;
    font-size: var(--hf-type-small, .875rem);
    text-decoration: underline;
    text-underline-offset: .15em;
}

.hf-chat-resume { margin-top: var(--hf-space-2, .5rem); padding: 0; border: 0; background: transparent; cursor: pointer; }

.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-guided ol > li:first-child,
.hf-chat-direct-care :is(ol, .hf-chat-starter, .hf-chat-review, .hf-chat-cases) { display: none; }

.hf-chat-starter {
    width: fit-content;
    max-width: 94%;
    padding: var(--hf-space-3, .75rem);
    margin: var(--hf-space-2, .5rem) 0 0;
    border: 1px solid var(--hf-color-line, #d5dfeb);
    border-radius: var(--hf-radius-md, 10px);
    background: var(--hf-color-white, #fff);
}

.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-topics button { transition: none; }
    .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-composer form button:hover:not(:disabled) {
    background: var(--hf-color-yellow-hover, #ffe43a);
}

.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-header button:focus-visible {
    outline-color: var(--hf-color-on-dark, #dbe6f5);
}

@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-welcome,
    .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)));
    }
}
