.fcb-widget {
    --fcb-primary: #1267d8;
    --fcb-text: #172033;
    --fcb-muted: #667085;
    --fcb-line: #e5eaf2;
    --fcb-surface: #ffffff;
    --fcb-soft: #f6f8fb;
    position: fixed;
    bottom: 24px;
    z-index: 99999;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.fcb-position-right {
    right: 24px;
}

.fcb-position-left {
    left: 24px;
}

.fcb-widget * {
    box-sizing: border-box;
    letter-spacing: 0;
}

.fcb-bubble {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 54px;
    max-width: calc(100vw - 48px);
    border: 0;
    border-radius: 999px;
    padding: 10px 18px 10px 10px;
    color: #fff;
    background: var(--fcb-primary);
    box-shadow: 0 16px 36px rgba(16, 24, 40, .22), 0 0 0 1px rgba(255, 255, 255, .2) inset;
    cursor: pointer;
    font-size: 15px;
    font-weight: 800;
    line-height: 1.1;
    transition: transform .18s ease, box-shadow .18s ease;
}

.fcb-bubble:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 44px rgba(16, 24, 40, .26), 0 0 0 1px rgba(255, 255, 255, .22) inset;
}

.fcb-bubble:focus-visible,
.fcb-close:focus-visible,
.fcb-question:focus-visible,
.fcb-back:focus-visible {
    outline: 3px solid rgba(18, 103, 216, .22);
    outline-offset: 3px;
}

.fcb-bubble-icon,
.fcb-agent-avatar,
.fcb-mini-avatar {
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-weight: 900;
}

.fcb-bubble-icon {
    width: 34px;
    height: 34px;
    color: var(--fcb-primary);
    background: #fff;
}

.fcb-bubble-icon span {
    width: 15px;
    height: 13px;
    border: 2px solid currentColor;
    border-radius: 5px;
    position: relative;
}

.fcb-bubble-icon span::after {
    content: "";
    position: absolute;
    right: 1px;
    bottom: -6px;
    width: 6px;
    height: 6px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(35deg);
    background: #fff;
}

.fcb-chat-panel {
    position: absolute;
    bottom: 72px;
    width: min(390px, calc(100vw - 32px));
    overflow: hidden;
    color: var(--fcb-text);
    background: var(--fcb-surface);
    border: 1px solid rgba(16, 24, 40, .08);
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(16, 24, 40, .24);
    transform-origin: bottom right;
    animation: fcb-panel-in .2s ease both;
}

.fcb-position-right .fcb-chat-panel {
    right: 0;
}

.fcb-position-left .fcb-chat-panel {
    left: 0;
    transform-origin: bottom left;
}

.fcb-chat-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 16px;
    color: #fff;
    background: var(--fcb-primary);
}

.fcb-agent-avatar {
    width: 42px;
    height: 42px;
    color: var(--fcb-primary);
    background: #fff;
}

.fcb-chat-header strong,
.fcb-chat-header span {
    display: block;
}

.fcb-chat-header strong {
    overflow: hidden;
    font-size: 16px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fcb-chat-header span {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-top: 4px;
    opacity: .9;
    font-size: 13px;
}

.fcb-chat-header i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #7cf0b2;
    box-shadow: 0 0 0 3px rgba(124, 240, 178, .18);
}

.fcb-close {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: rgba(255, 255, 255, .16);
    cursor: pointer;
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
    transition: background .18s ease;
}

.fcb-close:hover {
    background: rgba(255, 255, 255, .24);
}

.fcb-chat-body {
    max-height: min(560px, calc(100vh - 160px));
    overflow-y: auto;
    padding: 16px;
    background: var(--fcb-soft);
}

.fcb-view {
    animation: fcb-view-in .18s ease both;
}

.fcb-agent-row {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 9px;
    align-items: end;
    margin-bottom: 12px;
}

.fcb-mini-avatar {
    width: 28px;
    height: 28px;
    color: #fff;
    background: var(--fcb-primary);
    font-size: 13px;
}

.fcb-agent-message,
.fcb-user-message {
    max-width: 100%;
    border-radius: 8px;
    padding: 11px 13px;
    font-size: 14px;
    line-height: 1.48;
}

.fcb-agent-message {
    color: var(--fcb-text);
    background: #fff;
    border: 1px solid var(--fcb-line);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
    white-space: pre-line;
}

.fcb-user-message {
    width: fit-content;
    max-width: 86%;
    margin: 0 0 12px auto;
    color: #fff;
    background: var(--fcb-primary);
    box-shadow: 0 8px 18px rgba(16, 24, 40, .14);
}

.fcb-question-list {
    display: grid;
    gap: 9px;
}

.fcb-question {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--fcb-line);
    border-radius: 8px;
    padding: 12px 13px;
    color: var(--fcb-text);
    background: #fff;
    cursor: pointer;
    font: inherit;
    font-size: 14px;
    line-height: 1.35;
    text-align: left;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
    transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.fcb-question span {
    overflow-wrap: anywhere;
}

.fcb-question b {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    color: var(--fcb-primary);
    background: rgba(18, 103, 216, .08);
    font-size: 20px;
    line-height: 1;
}

.fcb-question:hover {
    border-color: rgba(18, 103, 216, .5);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(16, 24, 40, .08);
}

.fcb-back {
    display: inline-flex;
    gap: 5px;
    align-items: center;
    margin-bottom: 12px;
    border: 0;
    color: var(--fcb-primary);
    background: transparent;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
}

.fcb-back span {
    font-size: 20px;
    line-height: 1;
}

.fcb-agent-message a {
    color: var(--fcb-primary);
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.fcb-typing {
    display: inline-flex;
    gap: 5px;
    align-items: center;
    margin: 0 0 12px 37px;
    border: 1px solid var(--fcb-line);
    border-radius: 8px;
    padding: 12px 14px;
    background: #fff;
}

.fcb-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #98a2b3;
    animation: fcb-dot 1s infinite ease-in-out;
}

.fcb-typing span:nth-child(2) {
    animation-delay: .12s;
}

.fcb-typing span:nth-child(3) {
    animation-delay: .24s;
}

@keyframes fcb-panel-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes fcb-view-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fcb-dot {
    0%, 80%, 100% {
        opacity: .35;
        transform: translateY(0);
    }
    40% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

@media (max-width: 480px) {
    .fcb-widget {
        right: 16px;
        bottom: 16px;
        left: 16px;
    }

    .fcb-bubble {
        float: right;
    }

    .fcb-position-left .fcb-bubble {
        float: left;
    }

    .fcb-chat-panel,
    .fcb-position-right .fcb-chat-panel,
    .fcb-position-left .fcb-chat-panel {
        right: 0;
        left: 0;
        width: 100%;
    }
}
