.ai-assistant-trigger {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 12050;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: none;
    border-radius: 999px;
    background: #be8474;
    color: #fff;
    padding: 10px 14px 10px 10px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.2);
}

.ai-assistant-trigger img {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
}

.ai-assistant-highlight {
    position: fixed;
    right: 22px;
    bottom: 74px;
    z-index: 12049;
    background: #fff;
    color: #5a3f38;
    border: 1px solid #ead8d2;
    border-radius: 12px;
    padding: 8px 10px;
    box-shadow: 0 6px 14px rgba(0,0,0,0.08);
    max-width: 250px;
    font-size: 13px;
}

.ai-assistant-modal {
    position: fixed;
    right: 18px;
    bottom: 78px;
    display: none;
    z-index: 12060;
}

.ai-assistant-modal.active {
    display: block;
}

.ai-assistant-modal.expanded .ai-assistant-panel {
    width: min(920px, calc(100vw - 28px));
    height: min(88vh, 820px);
    max-height: min(88vh, 820px);
}

.ai-assistant-panel {
    position: relative;
    width: min(560px, calc(100vw - 24px));
    height: min(82vh, 720px);
    max-height: min(82vh, 720px);
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid #ead8d2;
    box-shadow: 0 14px 30px rgba(0,0,0,0.22);
}

.ai-assistant-panel::after {
    content: "";
    position: absolute;
    right: 28px;
    bottom: -8px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-right: 1px solid #ead8d2;
    border-bottom: 1px solid #ead8d2;
    transform: rotate(45deg);
}

.ai-assistant-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid #eee;
}

.ai-assistant-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ai-assistant-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: #3f2d2a;
}

.ai-assistant-title img {
    width: 34px;
    height: 34px;
    border-radius: 50%;
}

.ai-assistant-close {
    border: none;
    background: transparent;
    font-size: 20px;
    cursor: pointer;
    color: #777;
}

.ai-assistant-expand {
    border: none;
    background: #f5f5f5;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    cursor: pointer;
    color: #666;
}

.ai-assistant-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    flex: 1;
    overflow: hidden;
}

.ai-assistant-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: #f3ece9;
    color: #7a4f46;
    font-size: 12px;
    font-weight: 600;
}

.ai-assistant-form {
    display: grid;
    gap: 10px;
    border-top: 1px solid #eee;
    padding-top: 10px;
    background: #fff;
}

.ai-assistant-conv-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 2px 0 4px;
    background: #faf7f6;
    border: 1px solid #ead8d2;
    border-radius: 10px;
    padding: 8px;
}

.ai-conv-select-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
}

.ai-conv-select {
    width: 100%;
    min-width: 0;
    border: 1px solid #d7c5bf;
    border-radius: 8px;
    padding: 8px 36px 8px 10px;
    background: #fff;
    color: #5a3f38;
    font-weight: 600;
}

.ai-conv-menu-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 6px;
    background: #f3ece9;
    color: #7a4f46;
    cursor: pointer;
}

.ai-conv-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 170px;
    background: #fff;
    border: 1px solid #ead8d2;
    border-radius: 10px;
    box-shadow: 0 10px 24px rgba(0,0,0,0.12);
    z-index: 20;
    padding: 6px;
}

.ai-conv-menu button {
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    color: #5a3f38;
    font-weight: 600;
}

.ai-conv-menu button:hover {
    background: #f7f1ef;
}

.ai-conv-menu button.danger {
    color: #c2410c;
}

.ai-inline-title-editor {
    position: absolute;
    inset: 0;
    display: none;
    gap: 8px;
    align-items: center;
    padding: 4px;
    border: 1px solid #d7c5bf;
    border-radius: 10px;
    background: #fff;
    z-index: 9;
}

.ai-inline-title-editor.active {
    display: flex;
}

.ai-inline-title-editor input {
    flex: 1;
    min-width: 0;
    border: 1px solid #d7c5bf;
    border-radius: 8px;
    padding: 8px 10px;
}

.ai-conv-help {
    margin-top: -2px;
    color: #7a4f46;
    font-size: 12px;
}

.ai-delete-confirm-card {
    margin: 2px 0 4px;
    padding: 10px;
    border: 1px solid #f3c9bb;
    border-radius: 10px;
    background: linear-gradient(180deg, #fff, #fff8f6);
}

.ai-delete-confirm-card .title {
    font-weight: 700;
    color: #7a4f46;
    margin-bottom: 4px;
}

.ai-delete-confirm-card p {
    margin: 0 0 8px;
    color: #7a4f46;
    font-size: 13px;
}

.ai-delete-confirm-card .actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.ai-assistant-guest-lock {
    margin-top: 8px;
    border: 1px solid #ead8d2;
    border-radius: 12px;
    padding: 14px;
    background: #fcf8f6;
}

.ai-assistant-guest-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.ai-assistant-ghost-btn {
    border: 1px solid #be8474;
    border-radius: 10px;
    color: #7a4f46;
    padding: 10px 14px;
    text-decoration: none;
    font-weight: 700;
    background: #fff;
    cursor: pointer;
}

#aiNewConversationBtn {
    cursor: pointer !important;
}

.ai-assistant-ghost-btn.danger {
    border-color: #c2410c;
    color: #c2410c;
}

.ai-assistant-form textarea {
    width: 100%;
    min-height: 64px;
    max-height: 140px;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 10px;
    resize: vertical;
}

.ai-assistant-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.ai-assistant-file {
    font-size: 13px;
    color: #666;
}

.ai-assistant-submit {
    border: none;
    border-radius: 10px;
    background: #be8474;
    color: #fff;
    font-weight: 700;
    padding: 10px 14px;
    cursor: pointer;
}

.ai-assistant-result {
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 10px;
    min-height: 140px;
    flex: 1;
    overflow-y: auto;
    background: #fcfcfc;
}

.ai-chat-row {
    display: flex;
    margin-bottom: 10px;
}

.ai-chat-row.is-user {
    justify-content: flex-end;
}

.ai-chat-row.is-assistant {
    justify-content: flex-start;
}

.ai-chat-bubble {
    max-width: 88%;
    border-radius: 12px;
    padding: 10px 12px;
    line-height: 1.45;
    border: 1px solid #ead8d2;
    background: #fff;
    color: #3f2d2a;
}

.ai-chat-row.is-user .ai-chat-bubble {
    background: #be8474;
    color: #fff;
    border-color: #be8474;
}

.ai-chat-bubble h5 {
    margin: 8px 0 6px;
    font-size: 14px;
}

.ai-chat-bubble p {
    margin: 0 0 8px;
}

.ai-chat-bubble p:last-child {
    margin-bottom: 0;
}

.ai-user-file {
    margin-top: 6px;
    font-size: 12px;
    opacity: 0.9;
}

.ai-typing {
    color: #777;
    font-style: italic;
}

.ai-products-list ol {
    margin: 6px 0 0 16px;
}

.ai-products-list li {
    margin-bottom: 6px;
}

.ai-products-list .promo {
    color: #0f766e;
    font-weight: 600;
}

.mini-add-cart {
    margin-left: 6px;
    border: 1px solid #be8474;
    background: #fff;
    color: #be8474;
    border-radius: 6px;
    padding: 2px 7px;
    font-size: 11px;
    cursor: pointer;
}

.ai-analysis-actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ai-action-btn {
    border: none;
    border-radius: 8px;
    padding: 7px 10px;
    background: #be8474;
    color: #fff;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
}

.ai-action-btn.ghost {
    background: #fff;
    color: #7a4f46;
    border: 1px solid #be8474;
}

.ai-action-btn.danger {
    background: #c2410c;
    color: #fff;
}

.ai-alert {
    margin-top: 8px;
    color: #b45309;
    font-weight: 600;
}

.ai-toast-host {
    position: fixed;
    right: 16px;
    bottom: 96px;
    z-index: 13050;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.ai-toast {
    min-width: 240px;
    max-width: min(90vw, 360px);
    border-radius: 12px;
    padding: 10px 12px;
    color: #fff;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
    opacity: 0;
    transform: translateY(8px) scale(0.98);
    transition: opacity 0.22s ease, transform 0.22s ease;
    font-size: 13px;
    font-weight: 600;
}

.ai-toast.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.ai-toast.success {
    background: linear-gradient(135deg, #0f766e, #14b8a6);
}

.ai-toast.error {
    background: linear-gradient(135deg, #b91c1c, #ef4444);
}

.ai-chat-bubble details {
    margin-top: 8px;
}

.ai-chat-bubble details pre {
    white-space: pre-wrap;
    word-break: break-word;
    background: #fff5f5;
    border: 1px solid #fecaca;
    padding: 10px;
    margin-top: 8px;
    font-size: 12px;
    color: #7f1d1d;
    max-height: 220px;
    overflow: auto;
}

.ai-sales-head h4 {
    margin: 8px 0 6px;
    color: #3f2d2a;
}

.ai-sales-cta {
    margin-top: 10px;
    padding: 10px;
    background: #f8f3f1;
    border: 1px solid #ead8d2;
    border-radius: 10px;
    color: #5a3f38;
    font-weight: 600;
}

.ai-kit-cta {
    margin-top: 10px;
    display: flex;
    justify-content: flex-start;
}

.ai-assistant-products {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

@media (max-width: 640px) {
    .ai-assistant-modal {
        right: 0;
        left: 0;
        bottom: 0;
    }

    .ai-assistant-panel {
        width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        border: none;
    }

    .ai-assistant-modal.expanded .ai-assistant-panel {
        width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
    }

    .ai-assistant-panel::after {
        display: none;
    }

    .ai-assistant-body {
        padding: 10px;
    }

    .ai-assistant-form textarea {
        min-height: 56px;
        max-height: 110px;
    }

    .ai-assistant-conv-toolbar {
        align-items: stretch;
    }

    .ai-assistant-conv-toolbar .ai-assistant-ghost-btn {
        white-space: nowrap;
        padding-left: 10px;
        padding-right: 10px;
    }

    .ai-inline-title-editor {
        flex-wrap: nowrap;
    }

    .ai-inline-title-editor input {
        min-width: 80px;
    }

    .ai-toast-host {
        left: 10px;
        right: 10px;
        bottom: 88px;
    }

    .ai-toast {
        max-width: 100%;
        min-width: 0;
    }
}

.ai-assistant-product {
    border: 1px solid #ead8d2;
    border-radius: 10px;
    padding: 10px;
}

.ai-assistant-product h5 {
    margin: 0 0 6px;
    color: #3f2d2a;
    font-size: 14px;
}

.ai-assistant-product .btns {
    margin-top: 8px;
    display: flex;
    gap: 8px;
}

.ai-assistant-product .btns button,
.ai-assistant-product .btns a {
    border: 1px solid #be8474;
    color: #be8474;
    background: transparent;
    border-radius: 8px;
    padding: 6px 8px;
    text-decoration: none;
    font-size: 12px;
    cursor: pointer;
}

.ai-assistant-product .btns button.primary {
    background: #be8474;
    color: #fff;
}
