.support-chat-widget {
    --sc-blue: #1769aa;
    --sc-blue-dark: #12558e;
    --sc-navy: #111827;
    --sc-ink: #172334;
    --sc-muted: #718096;
    --sc-line: #e5eaf0;
    --sc-bg: #f4f7fb;
    color: var(--sc-ink);
    font: 14px/1.55 Tahoma, "Noto Sans Thai", Arial, sans-serif;
}

.support-chat-widget [hidden] {
    display: none !important;
}

.support-chat-widget *,
.support-chat-widget *::before,
.support-chat-widget *::after {
    box-sizing: border-box;
}

.support-chat-widget .sc-launcher {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1001;
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: #050505;
    color: #fff;
    box-shadow: 0 8px 24px #0d223c40;
    cursor: pointer;
    font: 700 11px/1 Tahoma, Arial, sans-serif;
    letter-spacing: 0.3px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.support-chat-widget .sc-launcher::after {
    position: absolute;
    inset: -5px;
    border: 2px solid #1769aa55;
    border-radius: 50%;
    animation: sc-pulse 2.4s infinite;
    content: "";
    pointer-events: none;
}

.support-chat-widget .sc-unread-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    z-index: 1;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border: 2px solid #fff;
    border-radius: 99px;
    color: #fff;
    background: #d32f2f;
    font: 700 10px/14px Tahoma, Arial, sans-serif;
    text-align: center;
}

.support-chat-widget .sc-unread-badge[hidden] {
    display: none;
}

.support-chat-widget .sc-launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px #0d223c55;
}

.support-chat-widget .sc-window {
    position: fixed;
    right: calc(24px + env(safe-area-inset-right, 0px));
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
    z-index: 1000;
    display: flex;
    width: min(
        380px,
        calc(100vw - 28px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px))
    );
    height: min(
        590px,
        calc(100vh - 110px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px))
    );
    height: min(
        590px,
        calc(100dvh - 110px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px))
    );
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #dfe6ee;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 18px 55px #102a4440;
    transform-origin: bottom right;
    animation: sc-pop 0.24s ease-out;
}

.support-chat-widget .sc-head {
    display: flex;
    height: 70px;
    min-height: 70px;
    flex: 0 0 70px;
    align-items: center;
    gap: 11px;
    padding: 14px 15px;
    background: var(--sc-navy);
    color: #fff;
}

.support-chat-widget .sc-brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    flex: none;
    place-items: center;
    overflow: hidden;
    border-radius: 9px;
    background: #000;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
}

.support-chat-widget .sc-brand {
    min-width: 0;
    flex: 1;
}

.support-chat-widget .sc-brand strong,
.support-chat-widget .sc-brand small {
    display: block;
}

.support-chat-widget .sc-brand strong {
    font-size: 14px;
    letter-spacing: 0.3px;
}

.support-chat-widget .sc-brand small {
    margin-top: 4px;
    color: #cbd5e1;
    font-size: 11px;
}

.support-chat-widget .sc-icon-button {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #eaf2fb;
    cursor: pointer;
    font: 22px/1 Tahoma, Arial, sans-serif;
}

.support-chat-widget .sc-icon-button:hover {
    background: #ffffff1a;
}

.support-chat-widget .sc-chat-body {
    display: flex;
    min-height: 0;
    flex: 1 1 0%;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px 13px;
    background: var(--sc-bg);
}

.support-chat-widget .sc-chat-body.sc-has-room {
    overflow: hidden;
}

.support-chat-widget .sc-chat-body.sc-has-room > .sc-system-caption,
.support-chat-widget .sc-chat-body.sc-has-room > .sc-bubble,
.support-chat-widget .sc-chat-body.sc-has-room > .sc-identity-confirmation {
    display: none;
}

.support-chat-widget .sc-system-caption {
    margin: 1px 0 2px;
    color: #8290a1;
    font-size: 11px;
    text-align: center;
}

.support-chat-widget .sc-bubble {
    max-width: 88%;
    padding: 11px 12px;
    border-radius: 13px;
    font-size: 13px;
    line-height: 1.65;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.support-chat-widget .sc-bubble b,
.support-chat-widget .sc-bubble span {
    display: block;
}

.support-chat-widget .sc-bubble b {
    margin-bottom: 4px;
    font-size: 12px;
}

.support-chat-widget .sc-bot {
    align-self: flex-start;
    border: 1px solid #e8edf3;
    border-top-left-radius: 4px;
    background: #fff;
}

.support-chat-widget .sc-user {
    align-self: flex-end;
    border-top-right-radius: 4px;
    background: var(--sc-blue);
    color: #fff;
}

.support-chat-widget .sc-message-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    margin-top: 5px;
}

.support-chat-widget .sc-message-time {
    color: #8290a1;
    font-size: 10px;
}

.support-chat-widget .sc-user .sc-message-time {
    color: #dceeff;
}

.support-chat-widget .sc-message-receipt {
    color: #dceeff;
    font: 700 12px/1 Tahoma, Arial, sans-serif;
    letter-spacing: -2px;
}

.support-chat-widget .sc-message-receipt[data-status="READ"] {
    color: #8bd7ff;
}

.support-chat-widget .sc-guest-form,
.support-chat-widget .sc-guest-form label {
    display: grid;
    gap: 7px;
}

.support-chat-widget .sc-guest-form {
    width: 100%;
    gap: 10px;
    padding: 13px;
    border: 1px solid #e8edf3;
    border-radius: 12px;
    background: #fff;
}

.support-chat-widget .sc-form-intro {
    margin: 0;
    color: #5b6a7c;
    font-size: 12px;
}

.support-chat-widget .sc-field span {
    color: #536276;
    font-size: 12px;
    font-weight: 700;
}

.support-chat-widget .sc-field input,
.support-chat-widget .sc-compose textarea {
    width: 100%;
    min-width: 0;
    border: 1px solid #d9e1ea;
    background: #fff;
    color: var(--sc-ink);
    font: inherit;
}

.support-chat-widget .sc-field input {
    min-height: 40px;
    padding: 8px 10px;
    border-radius: 9px;
}

.support-chat-widget .sc-field input:focus,
.support-chat-widget .sc-compose textarea:focus {
    border-color: #6ba8df;
    outline: 0;
    box-shadow: 0 0 0 3px #dceeff;
}

.support-chat-widget .sc-primary {
    width: 100%;
    min-height: 40px;
    padding: 9px 14px;
    border: 0;
    border-radius: 9px;
    background: var(--sc-blue);
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

.support-chat-widget .sc-primary:hover {
    background: var(--sc-blue-dark);
}

.support-chat-widget button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.support-chat-widget .sc-room-area {
    display: flex;
    width: 100%;
    min-height: 0;
    flex: 0 0 auto;
    flex-direction: column;
    overflow: visible;
}

.support-chat-widget .sc-chat-body.sc-has-room > .sc-room-area {
    flex: 1 1 0%;
    overflow: hidden;
}

.support-chat-widget .sc-room-area[hidden] {
    display: none !important;
}

.support-chat-widget .sc-room-summary {
    margin-bottom: 8px;
    padding: 10px 11px;
    border: 1px solid #e8edf3;
    border-radius: 11px;
    background: #fff;
}

.support-chat-widget .sc-room-summary p {
    margin: 0;
}

.support-chat-widget .sc-room-summary p + p {
    margin-top: 4px;
}

.support-chat-widget .sc-status-line[data-status="waiting"] {
    color: #946200;
}

.support-chat-widget .sc-status-line[data-status="active"] {
    color: #167247;
}

.support-chat-widget .sc-message-list {
    display: flex;
    min-height: 0;
    flex: 1 1 0%;
    flex-direction: column;
    gap: 10px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 4px 6px 4px 0;
    scrollbar-gutter: stable;
}

.support-chat-widget .sc-compose {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    flex: 0 0 auto;
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--sc-line);
    background: var(--sc-bg);
}

.support-chat-widget .sc-compose textarea {
    min-height: 40px;
    max-height: 110px;
    flex: 1;
    resize: vertical;
    padding: 9px 13px;
    border-radius: 20px;
    font-size: 13px;
}

.support-chat-widget .sc-compose button {
    width: 38px;
    height: 38px;
    flex: none;
    border: 0;
    border-radius: 50%;
    background: var(--sc-blue);
    color: #fff;
    cursor: pointer;
    font-size: 16px;
}

.support-chat-widget .sc-compose .sc-attach-button {
    background: #e8eef5;
    color: #35516b;
}

.support-chat-widget .sc-message-attachment {
    display: block;
    margin-top: 6px;
    color: inherit;
    text-decoration: underline;
}

.support-chat-widget .sc-message-attachment img {
    display: block;
    width: auto;
    max-width: min(250px, 100%);
    max-height: 200px;
    margin-bottom: 4px;
    border-radius: 8px;
    object-fit: contain;
}

.support-chat-widget .sc-error {
    min-height: 16px;
    margin: 4px 0 0;
    color: #b42318;
    font-size: 12px;
}

.support-chat-widget .sc-honeypot {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.support-chat-widget .sc-launcher:focus-visible,
.support-chat-widget .sc-icon-button:focus-visible,
.support-chat-widget button:focus-visible {
    outline: 3px solid #8cc7ff;
    outline-offset: 3px;
}

@keyframes sc-pulse {
    0% {
        opacity: 0.8;
        transform: scale(0.94);
    }

    75%,
    100% {
        opacity: 0;
        transform: scale(1.25);
    }
}

@keyframes sc-pop {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 520px) {
    .support-chat-widget .sc-launcher {
        right: calc(16px + env(safe-area-inset-right, 0px));
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        width: 46px;
        height: 46px;
    }

    .support-chat-widget .sc-window {
        right: calc(10px + env(safe-area-inset-right, 0px));
        bottom: calc(72px + env(safe-area-inset-bottom, 0px));
        width: calc(100vw - 20px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
        height: min(
            620px,
            calc(100vh - 92px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px))
        );
        height: min(
            620px,
            calc(100dvh - 92px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px))
        );
        border-radius: 16px;
    }
}

@media (max-height: 480px) {
    .support-chat-widget .sc-window {
        bottom: calc(8px + env(safe-area-inset-bottom, 0px));
        height: min(
            620px,
            calc(100vh - 16px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px))
        );
        height: min(
            620px,
            calc(100dvh - 16px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px))
        );
    }

    .support-chat-widget .sc-launcher[aria-expanded="true"] {
        z-index: 999;
    }
}

@media (prefers-reduced-motion: reduce) {
    .support-chat-widget .sc-launcher::after,
    .support-chat-widget .sc-window {
        animation-duration: 0.01ms;
        animation-iteration-count: 1;
    }
}
