#khnq-social-chatting,
#khnq-social-chatting * {
    box-sizing: border-box;
}

#khnq-social-chatting {
    --khnq-sc-primary: #0f766e;
    --khnq-sc-primary-dark: #115e59;
    --khnq-sc-facebook: #1877f2;
    --khnq-sc-zalo: #0068ff;
    --khnq-sc-phone: #f59e0b;
    --khnq-sc-text: #172033;
    --khnq-sc-muted: #667085;
    --khnq-sc-line: #e5e7eb;
    --khnq-sc-soft: #f5f7fb;
    --khnq-sc-white: #ffffff;
    position: fixed;
    right: calc(22px + env(safe-area-inset-right));
    bottom: calc(22px + env(safe-area-inset-bottom));
    z-index: 999999;
    color: var(--khnq-sc-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    letter-spacing: 0;
}

#khnq-social-chatting [hidden] {
    display: none !important;
}

#khnq-social-chatting svg {
    display: block;
    fill: currentColor;
}

#khnq-social-chatting a,
#khnq-social-chatting button,
#khnq-social-chatting textarea {
    font: inherit;
    letter-spacing: 0;
}

#khnq-social-chatting a {
    text-decoration: none;
}

#khnq-social-chatting .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.khnq-sc__launcher {
    position: relative;
    display: inline-flex;
    width: 62px;
    height: 62px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 999px;
    color: var(--khnq-sc-white);
    background: var(--khnq-sc-primary);
    box-shadow: 0 18px 38px rgba(15, 118, 110, 0.28), 0 4px 12px rgba(23, 32, 51, 0.16);
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.khnq-sc__launcher:hover,
.khnq-sc__launcher:focus-visible {
    background: var(--khnq-sc-primary-dark);
    box-shadow: 0 20px 44px rgba(15, 118, 110, 0.34), 0 5px 14px rgba(23, 32, 51, 0.18);
    transform: translateY(-2px);
    outline: none;
}

.khnq-sc__launcher-ring {
    position: absolute;
    inset: -7px;
    border: 2px solid rgba(15, 118, 110, 0.28);
    border-radius: 999px;
    animation: khnq-sc-pulse 1.9s ease-out infinite;
}

.khnq-sc__launcher-icon {
    position: relative;
    z-index: 1;
}

@keyframes khnq-sc-pulse {
    0% {
        opacity: 0.95;
        transform: scale(0.82);
    }
    100% {
        opacity: 0;
        transform: scale(1.22);
    }
}

.khnq-sc__panel {
    position: absolute;
    right: 0;
    bottom: 0;
    display: flex;
    width: min(372px, calc(100vw - 28px));
    height: min(552px, calc(100vh - 44px));
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(23, 32, 51, 0.12);
    border-radius: 8px;
    background: var(--khnq-sc-white);
    box-shadow: 0 24px 70px rgba(23, 32, 51, 0.24), 0 4px 16px rgba(23, 32, 51, 0.12);
    animation: khnq-sc-enter 220ms ease-out;
}

@keyframes khnq-sc-enter {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.khnq-sc__header {
    display: flex;
    min-height: 68px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    color: var(--khnq-sc-white);
    background: var(--khnq-sc-primary);
}

.khnq-sc__identity {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
}

.khnq-sc__identity strong,
.khnq-sc__identity small {
    display: block;
    max-width: 230px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.khnq-sc__identity strong {
    font-size: 15px;
    font-weight: 700;
}

.khnq-sc__identity small {
    margin-top: 1px;
    color: rgba(255, 255, 255, 0.84);
    font-size: 12px;
}

.khnq-sc__avatar {
    display: inline-flex;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.26);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.14);
}

.khnq-sc__close {
    display: inline-flex;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 8px;
    color: var(--khnq-sc-white);
    background: rgba(255, 255, 255, 0.14);
    cursor: pointer;
    transition: background 160ms ease;
}

.khnq-sc__close:hover,
.khnq-sc__close:focus-visible {
    background: rgba(255, 255, 255, 0.24);
    outline: none;
}

.khnq-sc__quick-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--khnq-sc-line);
    background: var(--khnq-sc-white);
}

.khnq-sc__quick-link {
    display: inline-flex;
    min-width: 0;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 9px;
    border: 1px solid var(--khnq-sc-line);
    border-radius: 8px;
    color: var(--khnq-sc-text);
    background: var(--khnq-sc-white);
    font-size: 13px;
    font-weight: 700;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.khnq-sc__quick-link span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.khnq-sc__quick-link:hover,
.khnq-sc__quick-link:focus-visible {
    border-color: currentColor;
    box-shadow: 0 8px 18px rgba(23, 32, 51, 0.1);
    transform: translateY(-1px);
    outline: none;
}

.khnq-sc__quick-link--phone {
    color: #9a5b00;
}

.khnq-sc__quick-link--zalo {
    color: var(--khnq-sc-zalo);
}

.khnq-sc__quick-link--facebook {
    color: var(--khnq-sc-facebook);
}

.khnq-sc__zalo-mark {
    display: inline-flex;
    width: 18px;
    height: 18px;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    color: var(--khnq-sc-white);
    background: var(--khnq-sc-zalo);
    font-size: 12px;
    font-weight: 800;
}

.khnq-sc__messages {
    display: flex;
    min-height: 0;
    flex: 1;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    padding: 14px 12px;
    background: var(--khnq-sc-soft);
    scroll-behavior: smooth;
}

.khnq-sc__message {
    display: flex;
    width: 100%;
}

.khnq-sc__message--bot,
.khnq-sc__message--notice {
    justify-content: flex-start;
}

.khnq-sc__message--user {
    justify-content: flex-end;
}

.khnq-sc__bubble {
    max-width: 84%;
    min-width: 0;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-line;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.khnq-sc__message--bot .khnq-sc__bubble {
    border: 1px solid var(--khnq-sc-line);
    color: var(--khnq-sc-text);
    background: var(--khnq-sc-white);
}

.khnq-sc__message--user .khnq-sc__bubble {
    color: var(--khnq-sc-white);
    background: #2563eb;
}

.khnq-sc__message--notice .khnq-sc__bubble {
    max-width: 100%;
    border: 1px solid #fde68a;
    color: #7c4a03;
    background: #fffbeb;
    font-size: 12.5px;
}

.khnq-sc__notice-link {
    display: inline-flex;
    margin-top: 7px;
    align-items: center;
    gap: 6px;
    color: var(--khnq-sc-facebook);
    font-weight: 700;
}

.khnq-sc__bubble--notice a {
    color: var(--khnq-sc-facebook);
    font-weight: 700;
    text-decoration: underline;
}

.khnq-sc__bubble--notice a:hover {
    color: var(--khnq-sc-primary-dark);
}

.khnq-sc__composer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    gap: 8px;
    align-items: end;
    padding: 10px 12px 12px;
    border-top: 1px solid var(--khnq-sc-line);
    background: var(--khnq-sc-white);
}

.khnq-sc__composer-input {
    display: block;
    width: 100%;
    min-height: 44px;
    max-height: 118px;
    resize: none;
    overflow-y: auto;
    padding: 11px 12px;
    border: 1px solid #cfd5df;
    border-radius: 8px;
    color: var(--khnq-sc-text);
    background: var(--khnq-sc-white);
    font-size: 14px;
    line-height: 1.45;
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.khnq-sc__composer-input::placeholder {
    color: #8a94a6;
}

.khnq-sc__composer-input:focus {
    border-color: var(--khnq-sc-primary);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.khnq-sc__send {
    display: inline-flex;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 8px;
    color: var(--khnq-sc-white);
    background: var(--khnq-sc-primary);
    cursor: pointer;
    transition: background 160ms ease, transform 160ms ease;
}

.khnq-sc__send:hover,
.khnq-sc__send:focus-visible {
    background: var(--khnq-sc-primary-dark);
    transform: translateY(-1px);
    outline: none;
}

.khnq-sc__send:active {
    transform: translateY(0);
}

@media (max-width: 480px) {
    #khnq-social-chatting {
        right: calc(12px + env(safe-area-inset-right));
        bottom: 50px;
    }

    .khnq-sc__panel {
        width: calc(100vw - 24px);
        height: min(540px, calc(100vh - 24px));
    }

    .khnq-sc__quick-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .khnq-sc__quick-actions .khnq-sc__quick-link:nth-child(3):last-child {
        grid-column: 1 / -1;
    }

    .khnq-sc__identity strong,
    .khnq-sc__identity small {
        max-width: calc(100vw - 170px);
    }
}
