.ai-launcher {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 1200;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 0;
    border-radius: 999px;
    padding: 12px 16px;
    background: var(--gradient-primary, linear-gradient(135deg, #003366, #0056b3));
    color: #fff;
    font: 600 0.95rem/1 system-ui, sans-serif;
    box-shadow: 0 8px 24px rgba(0, 51, 102, 0.28);
    cursor: pointer;
}

.ai-launcher:hover { filter: brightness(1.06); }

.ai-panel {
    position: fixed;
    right: 18px;
    bottom: 74px;
    z-index: 1200;
    width: min(400px, calc(100vw - 24px));
    height: min(640px, calc(100vh - 100px));
    display: none;
    flex-direction: column;
    background: #fff;
    color: var(--text-primary, #0f172a);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 18px;
    box-shadow: 0 16px 48px rgba(15, 23, 42, 0.18);
    overflow: hidden;
}

.ai-panel.open { display: flex; }

.ai-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 14px 10px;
    background: var(--accent-primary, #003366);
    color: #fff;
}

.ai-head h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.ai-head p {
    margin: 2px 0 0;
    font-size: 0.75rem;
    opacity: 0.85;
}

.ai-head-actions { display: flex; gap: 6px; }

.ai-icon-btn {
    border: 0;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.75rem;
}

.ai-links {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.ai-links a {
    flex: 1;
    text-align: center;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 8px 10px;
}

.ai-link-wa {
    background: #128C7E;
    color: #fff;
}

.ai-link-call {
    background: #fff;
    color: var(--accent-primary, #003366);
    border: 1px solid var(--border-color, #e2e8f0);
}

.ai-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ai-choice {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: var(--accent-primary, #003366);
    border-radius: 999px;
    padding: 8px 10px;
    font: 600 0.78rem/1.3 system-ui, sans-serif;
    cursor: pointer;
    text-align: left;
}

.ai-choice:hover { border-color: var(--accent-primary, #003366); }
.ai-choice:disabled { opacity: 0.55; cursor: default; }

.ai-log {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f8fafc;
}

.ai-msg {
    max-width: 88%;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 0.92rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.ai-msg.user {
    align-self: flex-end;
    background: var(--accent-primary, #003366);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.ai-msg.assistant {
    align-self: flex-start;
    background: #fff;
    border: 1px solid var(--border-color, #e2e8f0);
    border-bottom-left-radius: 4px;
}

.ai-msg.rtl { direction: rtl; text-align: right; }

.ai-status {
    font-size: 0.8rem;
    color: var(--text-muted, #64748b);
    padding: 0 4px;
}

.ai-status.error { color: #b91c1c; }

.ai-form {
    display: flex;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid var(--border-color, #e2e8f0);
    background: #fff;
}

.ai-form textarea {
    flex: 1;
    resize: none;
    min-height: 44px;
    max-height: 96px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 12px;
    padding: 10px 12px;
    font: 0.92rem/1.35 system-ui, sans-serif;
}

.ai-form button[type="submit"] {
    border: 0;
    border-radius: 12px;
    padding: 0 14px;
    background: var(--accent-primary, #003366);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.ai-form button:disabled { opacity: 0.55; cursor: default; }

.ai-note {
    margin: 0;
    padding: 0 12px 10px;
    font-size: 0.68rem;
    color: var(--text-muted, #64748b);
    background: #fff;
}

@media (max-width: 640px) {
    .ai-panel {
        right: 8px;
        left: 8px;
        width: auto;
        bottom: 70px;
        height: min(78vh, 640px);
    }
}
