#cc-ai-chat {
    --cc-ai-bg: #0f172a;
    --cc-ai-panel: #111827;
    --cc-ai-panel-2: #182033;
    --cc-ai-border: rgba(148, 163, 184, 0.28);
    --cc-ai-text: #e5e7eb;
    --cc-ai-muted: #94a3b8;
    --cc-ai-accent: #38bdf8;
    --cc-ai-user: #1e40af;
    color: var(--cc-ai-text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    position: fixed;
    z-index: 99999;
}

#cc-ai-chat[hidden] {
    display: block;
}

.cc-ai-chat__launcher {
    align-items: center;
    background: linear-gradient(135deg, #0ea5e9, #22c55e);
    border: 0;
    border-radius: 999px;
    bottom: 24px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.42);
    color: white;
    cursor: pointer;
    display: flex;
    font-weight: 800;
    height: 56px;
    justify-content: center;
    letter-spacing: 0;
    position: fixed;
    right: 24px;
    width: 56px;
}

.cc-ai-chat__panel {
    background: var(--cc-ai-panel);
    border: 1px solid var(--cc-ai-border);
    border-radius: 8px;
    bottom: 92px;
    box-shadow: 0 24px 80px rgba(2, 6, 23, 0.58);
    display: none;
    flex-direction: column;
    max-height: min(720px, calc(100vh - 120px));
    min-height: 520px;
    overflow: hidden;
    position: fixed;
    right: 24px;
    width: min(440px, calc(100vw - 32px));
}

#cc-ai-chat.is-open .cc-ai-chat__panel {
    display: flex;
}

.cc-ai-chat__header,
.cc-ai-chat__sessions-header {
    align-items: center;
    border-bottom: 1px solid var(--cc-ai-border);
    display: flex;
    justify-content: space-between;
    padding: 12px 14px;
}

.cc-ai-chat__header strong {
    display: block;
    font-size: 14px;
}

.cc-ai-chat__header small,
.cc-ai-chat__sessions-header,
.cc-ai-chat__session small {
    color: var(--cc-ai-muted);
    font-size: 12px;
}

.cc-ai-chat__actions {
    display: flex;
    gap: 6px;
}

.cc-ai-chat__actions button,
.cc-ai-chat__session button,
.cc-ai-chat__composer button {
    align-items: center;
    background: var(--cc-ai-panel-2);
    border: 1px solid var(--cc-ai-border);
    border-radius: 6px;
    color: var(--cc-ai-text);
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    justify-content: center;
}

.cc-ai-chat__actions button {
    height: 30px;
    min-width: 30px;
    padding: 0 8px;
}

.cc-ai-chat__sessions {
    background: #0b1220;
    border-bottom: 1px solid var(--cc-ai-border);
    max-height: 220px;
    overflow: auto;
}

.cc-ai-chat__session {
    align-items: center;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr auto;
    padding: 10px 14px;
}

.cc-ai-chat__session.is-active {
    background: rgba(14, 165, 233, 0.14);
}

.cc-ai-chat__session-title {
    color: var(--cc-ai-text);
    cursor: pointer;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cc-ai-chat__session button {
    color: var(--cc-ai-muted);
    height: 28px;
    width: 34px;
}

.cc-ai-chat__messages {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    padding: 14px;
}

.cc-ai-chat__message {
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.45;
    max-width: 88%;
    padding: 10px 12px;
    white-space: pre-wrap;
}

.cc-ai-chat__message--assistant {
    align-self: flex-start;
    background: var(--cc-ai-panel-2);
    border: 1px solid rgba(148, 163, 184, 0.18);
}

.cc-ai-chat__message--user {
    align-self: flex-end;
    background: var(--cc-ai-user);
}

.cc-ai-chat__message--system {
    align-self: center;
    background: transparent;
    color: var(--cc-ai-muted);
    font-size: 12px;
    padding: 4px;
}

.cc-ai-chat__composer {
    border-top: 1px solid var(--cc-ai-border);
    display: grid;
    gap: 10px;
    grid-template-columns: 1fr auto;
    padding: 12px;
}

.cc-ai-chat__composer textarea {
    background: #0b1220;
    border: 1px solid var(--cc-ai-border);
    border-radius: 6px;
    color: var(--cc-ai-text);
    font: inherit;
    min-height: 44px;
    padding: 10px;
    resize: vertical;
}

.cc-ai-chat__composer button {
    background: var(--cc-ai-accent);
    border-color: transparent;
    color: #082f49;
    font-weight: 700;
    min-width: 72px;
    padding: 0 14px;
}

@media (max-width: 640px) {
    .cc-ai-chat__launcher {
        bottom: 16px;
        right: 16px;
    }

    .cc-ai-chat__panel {
        bottom: 82px;
        max-height: calc(100vh - 98px);
        min-height: 60vh;
        right: 16px;
        width: calc(100vw - 32px);
    }
}
