.progdash-ai-chatbox {
    border: 1px solid #d6d8dc;
    border-radius: 12px;
    background: #fff;
    max-width: 860px;
    overflow: hidden;
    box-shadow: 0 10px 28px rgba(18, 28, 45, 0.08);
}

.progdash-ai-floating {
    position: fixed;
    right: 18px;
    bottom: 18px;
    width: min(420px, calc(100vw - 24px));
    z-index: 9999;
}

.progdash-ai-floating .progdash-ai-chatbox {
    max-width: 100%;
}

.progdash-ai-floating.is-collapsed .progdash-ai-messages,
.progdash-ai-floating.is-collapsed .progdash-ai-input-row {
    display: none;
}

.progdash-ai-floating.is-hidden {
    display: none;
}

@media (max-width: 782px) {
    .progdash-ai-floating {
        right: 8px;
        left: 8px;
        bottom: 8px;
        width: auto;
    }

    .progdash-ai-floating .progdash-ai-messages {
        max-height: 300px;
    }
}

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

.progdash-ai-header-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.progdash-ai-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.progdash-ai-minimize,
.progdash-ai-close {
    width: 24px;
    height: 24px;
    border: 1px solid #d6d8dc;
    border-radius: 6px;
    background: #fff;
    color: #50575e;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.progdash-ai-minimize:hover,
.progdash-ai-close:hover,
.progdash-ai-minimize:focus,
.progdash-ai-close:focus {
    border-color: #2271b1;
    color: #2271b1;
}

.progdash-ai-header-title {
    font-weight: 600;
    color: #1d2327;
}

.progdash-ai-header-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #50575e;
    font-size: 12px;
}

.progdash-ai-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #28a745;
}

.progdash-ai-messages {
    min-height: 320px;
    max-height: 520px;
    overflow-y: auto;
    padding: 16px 14px;
    background: linear-gradient(180deg, #fbfcff 0%, #f6f8fb 100%);
}

.progdash-ai-message {
    display: flex;
    margin-bottom: 12px;
}

.progdash-ai-message.user {
    justify-content: flex-end;
}

.progdash-ai-message .progdash-ai-bubble {
    max-width: 82%;
    border-radius: 12px;
    padding: 10px 13px;
    line-height: 1.4;
    font-size: 14px;
}

.progdash-ai-message.assistant .progdash-ai-bubble {
    background: #fff;
    border: 1px solid #dfe3e8;
}

.progdash-ai-message.user .progdash-ai-bubble {
    background: #2271b1;
    color: #fff;
}

.progdash-ai-sources {
    font-size: 12px;
    color: #50575e;
    background: #fff;
    border: 1px solid #dfe3e8;
    border-radius: 10px;
    padding: 8px 10px;
    margin: 6px 0 10px;
}

.progdash-ai-sources ul {
    margin: 6px 0 0 16px;
}

.progdash-ai-input-row {
    display: flex;
    gap: 8px;
    padding: 12px 12px;
    border-top: 1px solid #e8eaee;
    background: #fff;
}

.progdash-ai-input {
    flex: 1;
    min-height: 40px;
    max-height: 132px;
    border: 1px solid #d6d8dc;
    border-radius: 10px;
    padding: 10px 12px;
    resize: vertical;
    line-height: 1.3;
    font-size: 14px;
}

.progdash-ai-send {
    min-width: 42px;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 10px;
    background: #2271b1;
    color: #fff;
    cursor: pointer;
}

.progdash-ai-send:hover,
.progdash-ai-send:focus {
    background: #135e96;
}

.progdash-ai-send:disabled {
    opacity: 0.6;
    cursor: default;
}

.progdash-ai-typing .progdash-ai-bubble {
    color: #646970;
}

.progdash-ai-chatbox[data-theme="dark"] {
    border-color: #2f3642;
    background: #171a21;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.progdash-ai-chatbox[data-theme="dark"] .progdash-ai-header {
    border-bottom-color: #2b3140;
    background: #1e2430;
}

.progdash-ai-chatbox[data-theme="dark"] .progdash-ai-header-title,
.progdash-ai-chatbox[data-theme="dark"] .progdash-ai-header-status {
    color: #e7ebf3;
}

.progdash-ai-chatbox[data-theme="dark"] .progdash-ai-minimize,
.progdash-ai-chatbox[data-theme="dark"] .progdash-ai-close {
    border-color: #3a4355;
    background: #202633;
    color: #e7ebf3;
}

.progdash-ai-chatbox[data-theme="dark"] .progdash-ai-messages {
    background: linear-gradient(180deg, #171c24 0%, #131720 100%);
}

.progdash-ai-chatbox[data-theme="dark"] .progdash-ai-message.assistant .progdash-ai-bubble {
    background: #202633;
    border-color: #31394a;
    color: #e7ebf3;
}

.progdash-ai-chatbox[data-theme="dark"] .progdash-ai-message.user .progdash-ai-bubble {
    background: #2271b1;
    color: #fff;
}

.progdash-ai-chatbox[data-theme="dark"] .progdash-ai-sources {
    background: #1f2633;
    border-color: #31394a;
    color: #d5dceb;
}

.progdash-ai-chatbox[data-theme="dark"] .progdash-ai-input-row {
    border-top-color: #2b3140;
    background: #171a21;
}

.progdash-ai-chatbox[data-theme="dark"] .progdash-ai-input {
    border-color: #3a4355;
    background: #202633;
    color: #e7ebf3;
}

.progdash-ai-chatbox[data-theme="dark"] .progdash-ai-input::placeholder {
    color: #a9b2c3;
}

.progdash-ai-chatbox[data-theme="dark"] .progdash-ai-typing .progdash-ai-bubble {
    color: #b6c0d4;
}

@media (prefers-color-scheme: dark) {
    .progdash-ai-chatbox[data-theme="auto"] {
        border-color: #2f3642;
        background: #171a21;
        box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
    }

    .progdash-ai-chatbox[data-theme="auto"] .progdash-ai-header {
        border-bottom-color: #2b3140;
        background: #1e2430;
    }

    .progdash-ai-chatbox[data-theme="auto"] .progdash-ai-header-title,
    .progdash-ai-chatbox[data-theme="auto"] .progdash-ai-header-status {
        color: #e7ebf3;
    }

    .progdash-ai-chatbox[data-theme="auto"] .progdash-ai-minimize,
    .progdash-ai-chatbox[data-theme="auto"] .progdash-ai-close {
        border-color: #3a4355;
        background: #202633;
        color: #e7ebf3;
    }

    .progdash-ai-chatbox[data-theme="auto"] .progdash-ai-messages {
        background: linear-gradient(180deg, #171c24 0%, #131720 100%);
    }

    .progdash-ai-chatbox[data-theme="auto"] .progdash-ai-message.assistant .progdash-ai-bubble {
        background: #202633;
        border-color: #31394a;
        color: #e7ebf3;
    }

    .progdash-ai-chatbox[data-theme="auto"] .progdash-ai-sources {
        background: #1f2633;
        border-color: #31394a;
        color: #d5dceb;
    }

    .progdash-ai-chatbox[data-theme="auto"] .progdash-ai-input-row {
        border-top-color: #2b3140;
        background: #171a21;
    }

    .progdash-ai-chatbox[data-theme="auto"] .progdash-ai-input {
        border-color: #3a4355;
        background: #202633;
        color: #e7ebf3;
    }

    .progdash-ai-chatbox[data-theme="auto"] .progdash-ai-input::placeholder {
        color: #a9b2c3;
    }

    .progdash-ai-chatbox[data-theme="auto"] .progdash-ai-typing .progdash-ai-bubble {
        color: #b6c0d4;
    }
}