body.no-scroll {
    overflow: hidden;
    touch-action: none; /* для мобильных */
}

.ai-chat-panel__input {
    font-size: 16px;
}


.ai-chat-launcher,
.ai-chat-panel {
    --ai-chat-primary: #4f46e5;
    --ai-chat-primary-hover: #4338ca;
    --ai-chat-bg: #ffffff;
    --ai-chat-surface: #f9fafb;
    --ai-chat-border: #e5e7eb;
    --ai-chat-text: #111827;
    --ai-chat-text-muted: #6b7280;
    --ai-chat-user-bubble: #4f46e5;
    --ai-chat-user-text: #ffffff;
    --ai-chat-assistant-bubble: #f3f4f6;
    --ai-chat-assistant-text: #111827;
    --ai-chat-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
    --ai-chat-radius: 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    box-sizing: border-box;
}

.ai-chat-launcher *,
.ai-chat-launcher *::before,
.ai-chat-launcher *::after,
.ai-chat-panel *,
.ai-chat-panel *::before,
.ai-chat-panel *::after {
    box-sizing: border-box;
}

.ai-chat-launcher {
    position: fixed;
    right: 15px;
    bottom: 85px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: #fff;
    color: #fff;
    z-index: 9999;
    mix-blend-mode: difference;
}

.ai-chat-launcher svg {
    width: 24px;
    height: 24px;
}

/*.ai-chat-launcher:hover {*/
/*    background: var(--ai-chat-primary-hover);*/
/*    transform: translateY(-1px);*/
/*}*/

/*.ai-chat-launcher:focus-visible {*/
/*    outline: 3px solid rgba(79, 70, 229, 0.4);*/
/*    outline-offset: 2px;*/
/*}*/

/*.ai-chat-launcher__icon {*/
/*    width: 24px;*/
/*    height: 24px;*/
/*    fill: none;*/
/*    stroke: currentColor;*/
/*    stroke-width: 2;*/
/*    stroke-linecap: round;*/
/*    stroke-linejoin: round;*/
/*}*/

.ai-chat-panel {
    position: fixed;
    right: 24px;
    bottom: 96px;
    width: 360px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: var(--ai-chat-bg);
    border-radius: var(--ai-chat-radius);
    box-shadow: var(--ai-chat-shadow);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 2147483001;
    color: var(--ai-chat-text);
}

.ai-chat-panel--open {
    display: flex;
}

.ai-chat-panel__header {
    padding: 14px 16px;
    background: #000;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    border: 1px solid #fff;
    border-radius: 15px;
}

.ai-chat-panel__actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ai-chat-panel__icon-btn,
.ai-chat-panel__close {
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.15s ease;
}

.ai-chat-panel__icon-btn svg {
    width: 18px;
    height: 18px;
}

.ai-chat-panel__close {
    font-size: 22px;
    line-height: 1;
}

.ai-chat-panel__icon-btn:hover,
.ai-chat-panel__close:hover {
    background: rgba(255, 255, 255, 0.18);
}

.ai-chat-panel__icon-btn:focus-visible,
.ai-chat-panel__close:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.7);
    outline-offset: 1px;
}

.ai-chat-panel__messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--ai-chat-surface);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-chat-message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.ai-chat-message--user {
    align-self: flex-end;
    background: #000;
    color: var(--ai-chat-user-text);
    border-bottom-right-radius: 10px;
}

.ai-chat-message--assistant {
    align-self: flex-start;
    background: #eef0f5;
    color: var(--ai-chat-assistant-text);
    border-bottom-left-radius: 4px;
}

.ai-chat-message--assistant a {
    color: var(--ai-chat-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ai-chat-message--assistant a:hover {
    color: var(--ai-chat-primary-hover);
}

.ai-chat-typing {
    align-self: flex-start;
    background: var(--ai-chat-assistant-bubble);
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    padding: 12px 14px;
    display: inline-flex;
    gap: 4px;
}

.ai-chat-typing__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ai-chat-text-muted);
    animation: ai-chat-typing-bounce 1.2s infinite ease-in-out;
}

.ai-chat-typing__dot:nth-child(2) { animation-delay: 0.15s; }
.ai-chat-typing__dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes ai-chat-typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-5px); opacity: 1; }
}

.ai-chat-panel__input-row {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid var(--ai-chat-border);
    background: var(--ai-chat-bg);
    flex-shrink: 0;
    align-items: flex-end;
}

.ai-chat-panel__input {
    flex: 1;
    border: 1px solid var(--ai-chat-border);
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
    font-size: 14px;
    color: var(--ai-chat-text);
    background: var(--ai-chat-bg);
    resize: none;
    outline: none;
    min-height: 40px;
    max-height: 120px;
    line-height: 1.4;
    overflow-y: hidden;
}

/*.ai-chat-panel__input:focus {*/
/*    border-color: #000;*/
/*    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);*/
/*}*/

.ai-chat-panel__send {
    background: #000;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 0 14px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
    height: fit-content;
    padding: 10px 15px;
}

.ai-chat-panel__send:hover:not(:disabled) {
    background: var(--ai-chat-primary-hover);
}

.ai-chat-panel__send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-chat-panel__messages::-webkit-scrollbar {
    width: 8px;
}

.ai-chat-panel__messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

@media (max-width: 480px) {
    .ai-chat-panel {
        right: 12px;
        left: 12px;
        bottom: 84px;
        width: auto;
    }
    .ai-chat-launcher {
        right: 16px;
        bottom: 80px;
    }
}
