.ai-cs-widget {
    position: fixed;
    right: 18px;
    bottom: 88px;
    z-index: 1200;
}

.ai-cs-fab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    border-radius: 999px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #2f80ed, #56ccf2);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(47, 128, 237, 0.35);
}

.ai-cs-fab i {
    font-size: 18px;
    line-height: 1;
}

.ai-cs-fab-unread {
    position: relative;
    animation: ai-cs-fab-pulse 1.4s infinite;
}

.ai-cs-fab-unread::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #dc2626;
}

.ai-cs-fab-unread::after {
    content: attr(data-unread-count);
    position: absolute;
    top: -8px;
    left: -10px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
    font-weight: 700;
    box-shadow: 0 3px 10px rgba(220, 38, 38, .45);
}

@keyframes ai-cs-fab-pulse {
    0% {
        box-shadow: 0 8px 24px rgba(47, 128, 237, 0.35), 0 0 0 0 rgba(220, 38, 38, .5);
    }
    70% {
        box-shadow: 0 8px 24px rgba(47, 128, 237, 0.35), 0 0 0 12px rgba(220, 38, 38, 0);
    }
    100% {
        box-shadow: 0 8px 24px rgba(47, 128, 237, 0.35), 0 0 0 0 rgba(220, 38, 38, 0);
    }
}

.ai-cs-drawer {
    position: absolute;
    right: 0;
    bottom: 56px;
    width: min(360px, calc(100vw - 24px));
    height: min(580px, calc(100vh - 96px));
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
    display: none;
    overflow: hidden;
}

.ai-cs-drawer.is-open {
    display: flex;
    flex-direction: column;
}

.ai-cs-drawer.is-minimized .ai-cs-body {
    display: none;
}

.ai-cs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid #f1f5f9;
    background: #f8fafc;
}

.ai-cs-header__title {
    display: block;
    font-size: 15px;
    color: #0f172a;
}

.ai-cs-header__status {
    display: block;
    font-size: 12px;
    color: #64748b;
}

.ai-cs-header__actions {
    display: inline-flex;
    gap: 6px;
}

.ai-cs-icon-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #334155;
}

.ai-cs-body {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
}

.ai-cs-hint {
    margin: 10px 12px 0;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 12px;
}

.ai-cs-hint.is-error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

.ai-cs-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai-cs-message {
    max-width: 88%;
    border-radius: 10px;
    padding: 8px 10px;
    line-height: 1.6;
    font-size: 13px;
    word-break: break-word;
    white-space: pre-wrap;
}

.ai-cs-message--user {
    margin-left: auto;
    background: #2563eb;
    color: #fff;
}

.ai-cs-message--ai {
    margin-right: auto;
    background: #f1f5f9;
    color: #1e293b;
}

.ai-cs-message--agent {
    margin-right: auto;
    background: #ecfeff;
    color: #0f766e;
}

.ai-cs-message--system {
    margin-right: auto;
    background: #fff7ed;
    color: #9a3412;
}

.ai-cs-actions {
    padding: 0 12px 8px;
    display: flex;
    gap: 8px;
}

.ai-cs-action-btn {
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #334155;
    border-radius: 8px;
    font-size: 12px;
    padding: 5px 10px;
}

.ai-cs-action-btn:disabled {
    opacity: .6;
}

.ai-cs-action-btn--handover {
    border-color: #fb7185;
    background: #e11d48;
    color: #fff;
}

.ai-cs-action-btn--handover:hover {
    background: #be123c;
}

.ai-cs-action-btn--secondary {
    color: #1d4ed8;
    border-color: #bfdbfe;
    background: #eff6ff;
}

.ai-cs-input-wrap {
    border-top: 1px solid #f1f5f9;
    padding: 10px 12px 12px;
    position: relative;
}

.ai-cs-input {
    width: 100%;
    min-height: 72px;
    max-height: 140px;
    resize: vertical;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 8px;
    font-size: 13px;
    color: #0f172a;
}

.ai-cs-input-footer {
    margin-top: 8px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
}

.ai-cs-input-footer__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-start;
    width: 100%;
}

.ai-cs-hot-words {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    max-width: 240px;
}

.ai-cs-hot-words--empty {
    display: none;
}

.ai-cs-hot-word-btn {
    border: 1px solid #fecdd3;
    background: #fff1f2;
    color: #be123c;
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 12px;
    line-height: 1.5;
}

.ai-cs-hot-word-btn:hover {
    background: #ffe4e6;
}

.ai-cs-counter {
    color: #64748b;
    font-size: 12px;
    position: absolute;
    top: 16px;
    right: 18px;
    opacity: .3;
    pointer-events: none;
    z-index: 2;
}

.ai-cs-send-btn {
    border: none;
    border-radius: 8px;
    background: #2563eb;
    color: #fff;
    font-size: 13px;
    padding: 6px 14px;
    margin-left: auto;
}

.ai-cs-send-btn:disabled {
    opacity: .6;
}

.ai-cs-hidden {
    display: none !important;
}

@media (max-width: 767.98px) {
    .ai-cs-widget {
        right: 10px;
        bottom: 10px;
    }
    .ai-cs-drawer {
        width: calc(100vw - 20px);
        height: min(78vh, 560px);
        right: -2px;
        bottom: 52px;
    }
}
