.ai-assist-root {
    --ai-assist-header-color: #5a32d5;
    --ai-assist-assistant-bubble: #e9eef5;
    --ai-assist-user-bubble: #6f3cdf;
    --ai-assist-send-button: #5c35d8;
    --ai-assist-assistant-text: #20232a;
    --ai-assist-user-text: #ffffff;
    --ai-assist-launcher-bg: #5a32d5;
    --ai-assist-launcher-pad: 10px;
    --ai-assist-launcher-size: 56px;
    --ai-assist-panel-width: 360px;
    position: fixed;
    right: 24px;
    bottom: 24px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.ai-assist-launcher {
    width: var(--ai-assist-launcher-size, 56px);
    height: var(--ai-assist-launcher-size, 56px);
    border-radius: 50%;
    border: 0;
    background: var(--ai-assist-launcher-bg);
    color: #fff;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(61, 27, 124, 0.35);
    box-sizing: border-box;
    padding: var(--ai-assist-launcher-pad, 10px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-assist-panel {
    width: var(--ai-assist-panel-width, 360px);
    max-width: calc(100vw - 24px);
    height: 520px;
    background: #f7f7fa ;
    border-radius: 12px;
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.2);
    margin-bottom: 0;
    display: none;
    overflow: hidden;
}

.ai-assist-panel.is-open {
    display: flex;
    flex-direction: column;
}

.ai-assist-header {
    background: var(--ai-assist-header-color);
    color: #fff;
    padding: 14px 16px;
}

.ai-assist-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ai-assist-header h3 {
    margin: 0;
    font-size: 18px;
    color: #fff;
}

.ai-assist-header-close {
    border: 0;
    background: transparent;
    color: #ffffff;
    font-size: 30px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ai-assist-header-close:hover {
    opacity: 0.85;
}

.ai-assist-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    background: #f7f7fa;
    scrollbar-width: thin;
    scrollbar-color: #9a9a9a #f7f7fa;
    border-bottom: 1px solid #e4e4e4
}

.ai-assist-messages::-webkit-scrollbar {
    width: 11px;
}

.ai-assist-messages::-webkit-scrollbar-track {
    background: #f7f7fa;
    border-left: 1px solid #ececf2;
}

.ai-assist-messages::-webkit-scrollbar-thumb {
    background: #9a9a9a;
    border-radius: 10px;
    border: 2px solid #f7f7fa;
}

.ai-assist-messages::-webkit-scrollbar-thumb:hover {
    background: #7f7f7f;
}

.ai-assist-row {
    margin-bottom: 10px;
    display: flex;
}

.ai-assist-bubble {
    max-width: 84%;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.45;
    white-space: pre-wrap;
}

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

.ai-assist-row.user .ai-assist-bubble {
    background: var(--ai-assist-user-bubble);
    color: var(--ai-assist-user-text);
}

.ai-assist-row.assistant .ai-assist-bubble {
    background: var(--ai-assist-assistant-bubble);
    color: var(--ai-assist-assistant-text);
}

.ai-assist-input {
    margin: 10px;
    padding: 4px 6px 4px 12px;
    display: flex;
    gap: 6px;
    background: #fff;
    border: 1px solid #b7bcc5;
    border-radius: 999px;
    min-height: 46px;
    align-items: center;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ai-assist-input:focus-within {
    border-color: #8a93a3;
    box-shadow: 0 0 0 2px rgba(33, 50, 79, 0.08);
}

.ai-assist-input input {
    flex: 1;
    min-width: 0;
    border: 1px solid #d7dbe3;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.2;
    color: #2d3748;
}

/* Hard override against theme/form-builder input borders */
.ai-assist-root .ai-assist-composer-input,
.ai-assist-root .ai-assist-composer-input:hover,
.ai-assist-root .ai-assist-composer-input:focus,
.ai-assist-root .ai-assist-input input,
.ai-assist-root .ai-assist-input input:hover,
.ai-assist-root .ai-assist-input input:focus {
    border: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    background: transparent !important;
}

.ai-assist-input button {
    border: 0;
    border-radius: 999px;
    width: 34px;
    height: 34px;
    padding: 0;
    color: #8a94a8;
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.ai-assist-input button:hover:enabled {
    background: #eef1f5;
    color: #5a6578;
}

.ai-assist-input button:focus-visible {
    outline: 2px solid #8a93a3;
    outline-offset: 1px;
}

.ai-assist-input button:disabled {
    opacity: 0.45;
    cursor: default;
}

.ai-assist-privacy {
    margin: 0 10px;
}

.ai-assist-privacy-inner {
    background: #f5f6f8;
    border-top: 1px solid #e4e6eb;
    border-bottom: 1px solid #e4e6eb;
    padding: 10px 28px 10px 10px;
    font-size: 12px;
    line-height: 1.5;
    color: #2c3a4b;
    position: relative;
}

.ai-assist-privacy-inner a {
    color: #0b57b7;
    text-decoration: underline;
}

.ai-assist-privacy-close {
    position: absolute;
    right: 8px;
    top: 6px;
    border: 0;
    background: transparent;
    color: #5a6573;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.ai-assist-disclaimer {
    text-align: center;
    font-size: 12px;
    color: #31343a;
    margin: 0 10px 10px;
}

.ai-assist-launcher-icon {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 0;
    display: block;
    flex: 0 0 auto;
}

.ai-assist-lead-wrap {
    padding: 10px;
    display: grid;
    gap: 8px;
}

.ai-assist-lead-wrap input {
    border: 1px solid #d7dbe3;
    border-radius: 8px;
    padding: 8px 10px;
}

.ai-assist-lead-wrap button {
    border: 0;
    border-radius: 8px;
    padding: 9px 12px;
    color: #fff;
    background: var(--ai-assist-send-button);
    cursor: pointer;
}

.ai-assist-lead-title {
    font-size: 13px;
    font-weight: 600;
    color: #3c434a;
}

.ai-assist-cta-wrap {
    margin: 6px 0 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ai-assist-cta-btn {
    border: 1px solid #c9ced8;
    border-radius: 999px;
    padding: 8px 12px;
    background: #fff;
    color: #20232a;
    font-size: 13px;
    cursor: pointer;
}

.ai-assist-cta-btn:hover {
    background: #f2f4f8;
}

.ai-assist-loader-bubble {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.ai-assist-loader-text {
    animation: aiAssistBlink 1.2s infinite;
}

.ai-assist-loader-dots {
    display: inline-flex;
    gap: 4px;
}

.ai-assist-loader-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    display: inline-block;
    animation: aiAssistDots 1s infinite ease-in-out;
}

.ai-assist-loader-dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.ai-assist-loader-dots span:nth-child(3) {
    animation-delay: 0.3s;
}

.ai-assist-endsession-wrap {
    margin: 8px 10px 10px;
}

.ai-assist-endsession-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
}

.ai-assist-endsession-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-start;
}

.ai-assist-endsession-actions button {
    border: 1px solid #c9ced8;
    border-radius: 8px;
    padding: 6px 10px;
    background: #fff;
    cursor: pointer;
}

.ai-assist-endsession-actions #ai-assist-endsession-confirm {
    background: #20232a;
    color: #fff;
    border-color: #20232a;
}

@keyframes aiAssistDots {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.35; }
    40% { transform: translateY(-3px); opacity: 1; }
}

@keyframes aiAssistBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
