:root {
    --fs-chat-green: #176d38;
    --fs-chat-green-dark: #10562b;
    --fs-chat-purple: #6f2c91;
    --fs-chat-border: #dce7df;
    --fs-chat-ink: #25362b;
}

.fs-chat-launcher {
    -webkit-appearance: none !important;
    align-items: center !important;
    background: linear-gradient(145deg, var(--fs-chat-green) 0%, var(--fs-chat-green-dark) 72%, var(--fs-chat-purple) 100%) !important;
    border: 2px solid rgba(255, 255, 255, .92) !important;
    border-radius: 50% !important;
    bottom: max(20px, env(safe-area-inset-bottom)) !important;
    box-shadow: 0 12px 30px rgba(18, 84, 43, .28), 0 0 0 4px rgba(23, 109, 56, .10) !important;
    box-sizing: border-box !important;
    color: #fff !important;
    cursor: pointer;
    display: inline-flex !important;
    flex: 0 0 54px !important;
    font-size: 20px !important;
    gap: 0 !important;
    height: 54px !important;
    justify-content: center !important;
    left: auto !important;
    line-height: 1 !important;
    margin: 0 !important;
    max-height: 54px !important;
    max-width: 54px !important;
    min-height: 54px !important;
    min-width: 54px !important;
    overflow: visible !important;
    padding: 0 !important;
    position: fixed !important;
    right: max(22px, env(safe-area-inset-right)) !important;
    top: auto !important;
    transition: box-shadow .18s ease, transform .18s ease, opacity .18s ease;
    width: 54px !important;
    z-index: 1040 !important;
}

.fs-chat-launcher:hover {
    box-shadow: 0 15px 34px rgba(18, 84, 43, .34), 0 0 0 5px rgba(111, 44, 145, .12) !important;
    color: #fff !important;
    transform: translateY(-2px);
}

.fs-chat-launcher:focus-visible {
    outline: 3px solid rgba(111, 44, 145, .35) !important;
    outline-offset: 4px;
}

.fs-chat-launcher:active {
    transform: translateY(0) scale(.97);
}

.fs-chat-launcher[aria-expanded="true"] {
    opacity: 0;
    pointer-events: none;
    transform: scale(.9);
}

.fs-chat-launcher::after {
    background: var(--fs-chat-ink);
    border-radius: 8px;
    box-shadow: 0 7px 18px rgba(24, 46, 31, .16);
    color: #fff;
    content: attr(data-label);
    font-size: 11px;
    font-weight: 700;
    opacity: 0;
    padding: 7px 9px;
    pointer-events: none;
    position: absolute;
    right: calc(100% + 11px);
    top: 50%;
    transform: translate(5px, -50%);
    transition: opacity .15s ease, transform .15s ease;
    white-space: nowrap;
}

.fs-chat-launcher:hover::after,
.fs-chat-launcher:focus-visible::after {
    opacity: 1;
    transform: translate(0, -50%);
}

.fs-chat-label {
    border: 0 !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    height: 1px !important;
    margin: -1px !important;
    overflow: hidden !important;
    padding: 0 !important;
    position: absolute !important;
    white-space: nowrap !important;
    width: 1px !important;
}

.fs-chat-unread {
    align-items: center;
    background: #d93443;
    border: 2px solid #fff;
    border-radius: 999px;
    box-shadow: 0 3px 9px rgba(70, 20, 26, .24);
    color: #fff;
    display: inline-flex;
    font-size: 9px;
    font-weight: 800;
    height: 21px;
    justify-content: center;
    line-height: 1;
    min-width: 21px;
    padding: 0 4px;
    position: absolute;
    right: -5px;
    top: -5px;
}

.fs-chat-unread[hidden] {
    display: none !important;
}

.fs-chat-drawer {
    animation: fs-chat-arrive .18s ease-out;
    background: #fff;
    border: 1px solid var(--fs-chat-border);
    border-radius: 18px;
    bottom: max(86px, calc(env(safe-area-inset-bottom) + 72px));
    box-shadow: 0 22px 58px rgba(24, 58, 34, .22);
    color: var(--fs-chat-ink);
    display: flex;
    flex-direction: column;
    height: min(620px, calc(100vh - 125px));
    max-height: calc(100vh - 125px);
    max-width: calc(100vw - 30px);
    overflow: hidden;
    position: fixed;
    right: max(22px, env(safe-area-inset-right));
    width: 390px;
    z-index: 1041;
}

.fs-chat-drawer[hidden] {
    display: none !important;
}

.fs-chat-header {
    align-items: center;
    background: linear-gradient(120deg, var(--fs-chat-green), var(--fs-chat-green-dark) 70%, var(--fs-chat-purple));
    color: #fff;
    display: flex;
    justify-content: space-between;
    padding: 14px 16px;
}

.fs-chat-header strong,
.fs-chat-header small {
    display: block;
}

.fs-chat-header small {
    font-size: 11px;
    margin-top: 2px;
    opacity: .84;
}

.fs-chat-header button {
    align-items: center;
    background: rgba(255, 255, 255, .10);
    border: 0;
    border-radius: 50%;
    color: #fff;
    display: inline-flex;
    font-size: 23px;
    height: 34px;
    justify-content: center;
    line-height: 1;
    padding: 0;
    width: 34px;
}

.fs-chat-header button:hover,
.fs-chat-header button:focus-visible {
    background: rgba(255, 255, 255, .20);
    color: #fff;
}

.fs-chat-safety {
    background: #f8f3fa;
    border-bottom: 1px solid #e9dfed;
    color: #624f69;
    font-size: 11px;
    line-height: 1.4;
    padding: 8px 12px;
}

.fs-chat-tabs {
    border-bottom: 1px solid #e4ebe6;
    display: flex;
    gap: 5px;
    overflow-x: auto;
    padding: 8px;
}

.fs-chat-tabs button {
    background: #f1f5f2;
    border: 0;
    border-radius: 999px;
    color: #536159;
    flex: 0 0 auto;
    font-size: 11px;
    font-weight: 700;
    min-height: 31px;
    padding: 6px 9px;
}

.fs-chat-tabs button.active {
    background: #e8f4ec;
    color: var(--fs-chat-green);
}

.fs-chat-context {
    color: #6d7971;
    font-size: 11px;
    padding: 8px 12px 0;
}

.fs-chat-messages {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 8px;
    min-height: 150px;
    overflow-y: auto;
    padding: 12px;
}

.fs-chat-empty {
    color: #738078;
    font-size: 12px;
    margin: auto;
    max-width: 250px;
    text-align: center;
}

.fs-chat-message {
    align-self: flex-start;
    background: #f0f3f1;
    border-radius: 4px 12px 12px 12px;
    max-width: 82%;
    padding: 7px 9px;
}

.fs-chat-message.mine {
    align-self: flex-end;
    background: #e7f4eb;
    border-radius: 12px 4px 12px 12px;
}

.fs-chat-message b,
.fs-chat-message time {
    color: #647168;
    display: block;
    font-size: 9px;
}

.fs-chat-message p {
    font-size: 12px;
    line-height: 1.4;
    margin: 2px 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.fs-chat-message time {
    text-align: right;
}

.fs-chat-invite {
    background: #f6faf7;
    border-top: 1px solid #e0e9e2;
    padding: 9px 11px;
}

.fs-chat-invite button {
    background: transparent;
    border: 0;
    color: var(--fs-chat-purple);
    font-size: 11px;
    font-weight: 700;
    min-height: 28px;
    padding: 0;
}

.fs-chat-invite small {
    color: #748078;
    display: block;
    font-size: 9px;
    margin-top: 2px;
}

.fs-chat-compose {
    align-items: stretch;
    border-top: 1px solid #e1e8e3;
    display: flex;
    gap: 7px;
    margin: 0;
    padding: 9px;
}

.fs-chat-compose textarea {
    border: 1px solid #cedbd1;
    border-radius: 9px;
    flex: 1;
    font: inherit;
    font-size: 12px;
    max-height: 90px;
    min-height: 42px;
    min-width: 0;
    padding: 9px;
    resize: vertical;
}

.fs-chat-compose button {
    align-items: center;
    background: var(--fs-chat-purple);
    border: 0;
    border-radius: 9px;
    color: #fff;
    display: inline-flex;
    flex: 0 0 44px;
    justify-content: center;
    min-height: 42px;
    padding: 0;
    width: 44px;
}

.fs-chat-compose button:disabled {
    opacity: .5;
}

.fs-chat-status {
    color: #68756d;
    font-size: 10px;
    min-height: 19px;
    padding: 0 11px 7px;
}

@keyframes fs-chat-arrive {
    from { opacity: 0; transform: translateY(8px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 575.98px) {
    .fs-chat-launcher {
        bottom: max(16px, env(safe-area-inset-bottom)) !important;
        flex-basis: 50px !important;
        height: 50px !important;
        max-height: 50px !important;
        max-width: 50px !important;
        min-height: 50px !important;
        min-width: 50px !important;
        right: max(14px, env(safe-area-inset-right)) !important;
        width: 50px !important;
    }

    .fs-chat-launcher::after {
        display: none;
    }

    .fs-chat-drawer {
        border: 0;
        border-radius: 18px 18px 0 0;
        bottom: 0;
        height: 86vh;
        height: 86dvh;
        left: 0;
        max-height: 86vh;
        max-height: 86dvh;
        max-width: none;
        padding-bottom: env(safe-area-inset-bottom);
        right: 0;
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .fs-chat-drawer {
        animation: none;
    }

    .fs-chat-launcher,
    .fs-chat-launcher::after {
        transition: none;
    }
}
