.csia-chat-root {
    --csia-color: #006d77;
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 9999;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    margin: 0;
    padding: 0;
    pointer-events: auto;
    transform: translateZ(0);
    will-change: transform;
}

.csia-chat-root.csia-left {
    right: auto;
    left: 20px;
    align-items: flex-start;
}

.csia-chat-prompt {
    background: var(--csia-color);
    color: #fff;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    max-width: 200px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    line-height: 1.3;
}

.csia-chat-toggle {
    border: 0;
    border-radius: 999px;
    background: var(--csia-color);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 72px;
    height: 72px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    pointer-events: auto;
}

.csia-chat-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}

.csia-chat-toggle-icon {
    font-size: 28px;
    line-height: 1;
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.csia-chat-toggle-label {
    font-size: 11px;
    line-height: 1.2;
}

.csia-chat-panel {
    margin-top: 10px;
    width: min(360px, calc(100vw - 32px));
    background: #fff;
    border-radius: 14px;
    border: 1px solid #d4d7dd;
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.16);
    overflow: hidden;
    pointer-events: auto;
}

.csia-chat-header {
    background: var(--csia-color);
    color: #fff;
    padding: 12px;
    font-weight: 700;
}

.csia-chat-messages {
    max-height: 300px;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.csia-msg {
    padding: 10px;
    border-radius: 10px;
    line-height: 1.4;
    font-size: 14px;
    animation: csia-msg-entrance 0.4s ease-out;
}

@keyframes csia-msg-entrance {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.csia-msg-user {
    background: #e7f5f7;
}

.csia-msg-bot {
    background: #f1f3f6;
}

.csia-msg-bot a {
    color: #0073aa;
    word-break: break-all;
    text-decoration: underline;
}

.csia-msg-bot a:hover {
    color: #005177;
}

.csia-msg-typing {
    padding: 10px;
    border-radius: 10px;
    background: #f1f3f6;
    animation: csia-msg-entrance 0.4s ease-out;
}

.csia-typing-indicator {
    display: flex;
    gap: 3px;
    align-items: center;
    height: 14px;
}

.csia-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #999;
    animation: csia-typing-blink 1.4s infinite;
}

.csia-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.csia-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes csia-typing-blink {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-4px);
    }
}

.csia-chat-form {
    border-top: 1px solid #e5e7ec;
    padding: 10px;
    display: grid;
    gap: 8px;
}

#csia-chat-input {
    resize: vertical;
    min-height: 64px;
}

.csia-chat-send {
    justify-self: end;
    border: 0;
    border-radius: 8px;
    background: var(--csia-color);
    color: #fff;
    padding: 8px 14px;
    cursor: pointer;
}
