#cbc-widget-root {
    position: fixed;
    bottom: 24px;
    z-index: 999999;
    font-family: Tahoma, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
#cbc-widget-root.cbc-pos-right { right: 24px; }
#cbc-widget-root.cbc-pos-left { left: 24px; }

.cbc-hidden { display: none !important; }

.cbc-floating-btn {
    width: var(--cbc-btn-size, 60px);
    height: var(--cbc-btn-size, 60px);
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cbc-primary, #0f766e), var(--cbc-accent, #14b8a6));
    color: #ffffff;
    border: none;
    box-shadow: 0 8px 24px rgba(15, 118, 110, 0.38);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    position: relative;
}
.cbc-floating-btn:hover {
    transform: translateY(-3px) scale(1.04);
    box-shadow: 0 12px 28px rgba(15, 118, 110, 0.5);
}
.cbc-unread-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

.cbc-chat-box {
    width: 360px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 110px);
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.2);
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    animation: cbcFadeUp 0.25s ease;
}
@keyframes cbcFadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.cbc-chat-header {
    background: linear-gradient(135deg, var(--cbc-primary, #0f766e), var(--cbc-accent, #14b8a6));
    color: #ffffff;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.cbc-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.cbc-online-dot {
    width: 10px;
    height: 10px;
    background: #4ade80;
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.3);
}
.cbc-header-title {
    font-weight: bold;
    font-size: 15px;
}
.cbc-header-sub {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 2px;
}
.cbc-header-actions {
    display: flex;
    gap: 6px;
}
.cbc-icon-btn {
    background: rgba(255, 255, 255, 0.18);
    border: none;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

.cbc-step-body {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.cbc-welcome-banner {
    background: #f8fafc;
    border-right: 4px solid var(--cbc-primary, #0f766e);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    color: #334155;
    margin: 0;
    line-height: 1.6;
}
.cbc-dept-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cbc-dept-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: right;
    padding: 12px 14px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    cursor: pointer;
    text-decoration: none;
    color: #0f172a;
    transition: all 0.2s ease;
}
.cbc-dept-btn:hover {
    border-color: var(--cbc-primary, #0f766e);
    background: #f0fdfa;
}
.cbc-dept-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.cbc-dept-text strong {
    font-size: 14px;
    color: #0f172a;
}
.cbc-dept-text span {
    font-size: 12px;
    color: #64748b;
}
.cbc-dept-arrow {
    color: var(--cbc-primary, #0f766e);
    font-weight: bold;
}

.cbc-selected-dept-badge {
    background: #f0fdfa;
    color: #0f766e;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
}
#cbc-start-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
#cbc-start-form input,
#cbc-start-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-size: 13px;
    box-sizing: border-box;
}
.cbc-primary-btn {
    background: var(--cbc-primary, #0f766e);
    color: #ffffff;
    border: none;
    padding: 12px;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    font-size: 14px;
    margin-top: auto;
}
.cbc-primary-btn:hover {
    opacity: 0.94;
}

.cbc-step-chat {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}
.cbc-messages-list {
    flex: 1;
    padding: 14px;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.cbc-msg-item {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
}
.cbc-msg-user {
    background: var(--cbc-primary, #0f766e);
    color: #ffffff;
    align-self: flex-start;
    border-bottom-right-radius: 3px;
}
.cbc-msg-agent {
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    align-self: flex-end;
    border-bottom-left-radius: 3px;
}
.cbc-msg-meta {
    display: block;
    font-size: 10px;
    opacity: 0.75;
    margin-top: 4px;
}
.cbc-send-form {
    display: flex;
    padding: 10px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    gap: 8px;
}
.cbc-send-form input {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 9px 12px;
    font-size: 13px;
}
.cbc-send-form button {
    background: var(--cbc-primary, #0f766e);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 0 16px;
    font-weight: bold;
    cursor: pointer;
}
