:root {
    --aicp-bg: #ffffff;
    --aicp-card: #f7f7f8;
    --aicp-border: #e7e7ea;
    --aicp-text: #111;
    --aicp-muted: #666;
    --aicp-primary: #ff0000;
    --aicp-primary2: #cc0000;
    --aicp-radius: 18px;
}

.aicp-inline-wrap {
    max-width: 1200px;
    margin: 18px auto;
    padding: 0 10px;
}

.aicp-root {
    border: 1px solid var(--aicp-border);
    border-radius: var(--aicp-radius);
    overflow: hidden;
    background: var(--aicp-bg);
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.06);
}

.aicp-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--aicp-border);
    background: linear-gradient(180deg, #fff, #fbfbfd);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.aicp-header-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.aicp-title {
    font-weight: 800;
    font-size: 16px;
    color: var(--aicp-text);
    letter-spacing: .2px;
}

.aicp-subtitle {
    font-size: 12px;
    color: var(--aicp-muted);
}

.aicp-badge {
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--aicp-border);
    background: rgba(0, 0, 0, 0.03);
    color: var(--aicp-muted);
}

.aicp-toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 12px;
    border-bottom: 1px solid var(--aicp-border);
    background: #fff;
    align-items: center;
}

.aicp-spacer {
    flex: 1 1 auto;
}

.aicp-pill {
    display: flex;
    gap: 8px;
    align-items: center;
    border: 1px solid var(--aicp-border);
    border-radius: 999px;
    padding: 6px 10px;
    background: var(--aicp-card);
    font-size: 13px;
    color: var(--aicp-muted);
}

.aicp-pill select {
    border: 1px solid var(--aicp-border);
    border-radius: 10px;
    padding: 4px 8px;
    background: #fff;
}

.aicp-filebtn input {
    display: none;
}

.aicp-chat {
    height: min(70vh, 540px);
    overflow: auto;
    padding: 14px;
    background: var(--aicp-bg);
}

.aicp-row {
    display: flex;
    gap: 10px;
    margin: 10px 0;
    align-items: flex-start;
}

.aicp-avatar {
    width: 32px;
    height: 32px;
    border-radius: 12px;
    background: var(--aicp-card);
    border: 1px solid var(--aicp-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: var(--aicp-muted);
    flex: 0 0 auto;
}

.aicp-bubble {
    border: 1px solid var(--aicp-border);
    background: var(--aicp-card);
    border-radius: 16px;
    padding: 10px 12px;
    max-width: 900px;
    width: fit-content;
    color: var(--aicp-text);
    line-height: 1.6;
    font-size: 14px;
    white-space: normal;
}

.aicp-row.user {
    justify-content: flex-end;
}

.aicp-row.user .aicp-avatar {
    display: none;
}

.aicp-row.user .aicp-bubble {
    background: #fff;
    margin-left: auto;
    border-color: #e4e4ea;
}

.aicp-footer {
    border-top: 1px solid var(--aicp-border);
    background: #fff;
    padding: 12px;
}

.aicp-inputbox {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.aicp-inputbox textarea {
    width: 100%;
    min-height: 46px;
    max-height: 160px;
    resize: none;
    border: 1px solid var(--aicp-border);
    border-radius: 16px;
    padding: 12px 12px;
    font-size: 14px;
    outline: none;
}

.aicp-inputbox textarea:focus {
    border-color: #d9d9df;
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.03);
}

.aicp-btn {
    border: 1px solid var(--aicp-border);
    background: #fff;
    border-radius: 14px;
    padding: 10px 12px;
    cursor: pointer;
    font-weight: 700;
    color: var(--aicp-text);
}

.aicp-btn-primary {
    background: var(--aicp-primary);
    border-color: var(--aicp-primary);
    color: #fff;
}

.aicp-btn-primary:hover {
    background: var(--aicp-primary2);
    border-color: var(--aicp-primary2);
}

.aicp-btn-ghost {
    color: var(--aicp-muted);
}

.aicp-hint {
    margin-top: 8px;
    color: var(--aicp-muted);
    font-size: 12px;
}

/* Markdown styling */
.aicp-code {
    background: #0f0f0f;
    color: #fff;
    padding: 12px;
    border-radius: 14px;
    overflow: auto;
    font-size: 13px;
    line-height: 1.55;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.aicp-inline-code {
    background: rgba(0, 0, 0, 0.06);
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 13px;
}

.aicp-h3 {
    margin: 10px 0 6px;
    font-size: 15px;
}

.aicp-h4 {
    margin: 10px 0 6px;
    font-size: 14px;
}

/* Typing dots */
.aicp-dots {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.aicp-dots span {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.25);
    animation: aicpDot 1.2s infinite ease-in-out;
}

.aicp-dots span:nth-child(2) {
    animation-delay: .15s;
}

.aicp-dots span:nth-child(3) {
    animation-delay: .3s;
}

@keyframes aicpDot {

    0%,
    80%,
    100% {
        transform: translateY(0);
        opacity: .35;
    }

    40% {
        transform: translateY(-4px);
        opacity: .9;
    }
}

/* ---------------- Floating Widget ---------------- */
.aicp-widget-shell {
    position: fixed;
    z-index: 999999;
    width: auto;
}

.aicp-pos-right {
    right: 16px;
    bottom: 16px;
}

.aicp-pos-left {
    left: 16px;
    bottom: 16px;
}

.aicp-pos-free {
    right: auto;
    bottom: auto;
}

.aicp-fab {
    border: none;
    background: var(--aicp-primary);
    color: #fff;
    border-radius: 999px;
    padding: 12px 14px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22);
    display: flex;
    align-items: center;
    gap: 10px;
}

.aicp-fab-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.18);
}

.aicp-widget-panel {
    margin-top: 10px;
    width: min(440px, calc(100vw - 24px));
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.25);
    border-radius: 18px;
    overflow: hidden;
    background: #fff;
}

.aicp-widget-panel .aicp-chat {
    height: min(60vh, 440px);
}

@media (max-width:600px) {
    .aicp-chat {
        height: min(70vh, 500px);
    }

    .aicp-bubble {
        max-width: 100%;
    }
}