.hl-chat {
    position: static;
    right: auto;
    bottom: auto;
    z-index: auto;
    width: auto;
    font-family: inherit;
    touch-action: auto;
    user-select: none;
}

.hl-chat-launcher { position: relative; width: 100%; }

.hl-chat-toggle {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    box-shadow: none;
    cursor: pointer;
    touch-action: manipulation;
}

.hl-chat-toggle:focus-visible { outline: 2px dashed #7b1113; outline-offset: 3px; }
.hl-chat-toggle img { display: block; width: 26px; height: 26px; max-width: none; margin: 0; object-fit: contain; pointer-events: none; }

.noi .hl-chat-toggle {
    position: relative;
    overflow: hidden;
    border: 2px solid transparent;
    background: radial-gradient(circle at 30% 25%, #c41e1e 0%, #8c0c0c 45%, #3d0505 100%) padding-box, linear-gradient(135deg, #fff1a8 0%, #e6c200 25%, #9a7410 50%, #f6d76a 75%, #b8860b 100%) border-box;
    box-shadow: 0 6px 14px rgba(0, 0, 0, .45), 0 0 16px rgba(212, 175, 55, .40), inset 0 1px 3px rgba(255, 255, 255, .30), inset 0 -3px 6px rgba(0, 0, 0, .45);
}

.noi .hl-chat-toggle::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -120%;
    width: 60%;
    height: 200%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .55), transparent);
    transform: rotate(20deg);
    pointer-events: none;
    animation: noi-sang 4.5s ease-in-out infinite;
}

.noi .hl-chat-toggle:hover { transform: translateY(-3px) scale(1.1); }

.hl-chat-panel {
    position: fixed;
    right: 74px;
    bottom: 28px;
    display: flex;
    flex-direction: column;
    width: min(410px, calc(100vw - 88px));
    height: min(610px, calc(100dvh - 88px));
    overflow: hidden;
    border: 1px solid #eadfca;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 12px 40px #0003;
    touch-action: auto;
    user-select: text;
}

.hl-chat-panel[hidden] { display: none; }

.hl-chat-header { display: flex; justify-content: space-between; align-items: center; flex: 0 0 auto; min-height: 68px; padding: 14px 17px; background: #761012; color: #fff; }
.hl-chat-header strong, .hl-chat-header small { display: block; }
.hl-chat-header small { margin-top: 4px; color: #f4dfb3; font-size: 12px; }
.hl-chat-header button { border: 0; background: transparent; color: #fff; font-size: 26px; line-height: 1; cursor: pointer; }
.hl-chat-messages { display: flex; flex: 1 1 auto; flex-direction: column; gap: 14px; min-height: 0; overflow: auto; padding: 18px 16px; background: #fcfaf6; }
.hl-chat-bubble { max-width: 82%; margin: 0; padding: 11px 14px; border-radius: 13px; font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.hl-chat-bubble.assistant { border: 1px solid #eee5d7; border-bottom-left-radius: 4px; background: #fff; }
.hl-chat-row { display: flex; align-items: flex-start; gap: 10px; width: 100%; }
.hl-chat-row .hl-chat-bubble { flex: 1 1 auto; min-width: 0; max-width: none; }
.hl-chat-messages .hl-chat-avatar {
    display: block;
    flex: 0 0 44px;
    width: 44px !important;
    min-width: 44px;
    max-width: 44px !important;
    height: 44px !important;
    min-height: 44px;
    max-height: 44px !important;
    border: 1px solid #eadfca;
    border-radius: 50%;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
}
.hl-chat-messages .hl-chat-avatar img {
    display: block;
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    object-fit: cover;
    object-position: center;
    transform: scale(1.65);
    transform-origin: 50% 28%;
}
.hl-chat-bubble.user { align-self: flex-end; border-bottom-right-radius: 4px; background: #7b1113; color: #fff; }
.hl-chat-bubble.error { color: #8d1a1a; }
.hl-chat-form { display: flex; gap: 8px; padding: 11px; border-top: 1px solid #eee5d7; }
.hl-chat-form input { min-width: 0; flex: 1; padding: 10px 12px; border: 1px solid #d8d0c4; border-radius: 9px; }
.hl-chat-form button { padding: 0 15px; border: 0; border-radius: 9px; background: #7b1113; color: #fff; font-weight: 600; }
.hl-chat-note { padding: 0 12px 10px; color: #777; font-size: 11px; }
.hl-chat button:focus-visible, .hl-chat input:focus-visible { outline: 3px solid #d9aa35; outline-offset: 2px; }

@media (max-width: 480px) {
    .noi .hl-chat-toggle { width: 42px; height: 42px; }
    .hl-chat-panel { height: min(75dvh, 600px, calc(100dvh - 96px)); }
    .hl-chat-panel { bottom: calc(16px + env(safe-area-inset-bottom)); }
}

