/* FILE: ai-chatbot-crm/includes/assets/css/chatbot.css */
/*
 * Master chatbot CSS
 * Updated to style both the "shortcode" chatbot (#ai-chatbot-crm-...)
 * and the "floating" chatbot (#ai-floating-chatbot-...).
 */

:root {
    --chat-bg-color: #f9f9f9;
    --text-color: #333333;
    --bot-bubble-bg: #f5f5f5;
    --bot-bubble-text: #333333;
    --user-bubble-bg: #e0f3ff;
    --user-bubble-text: #333333;
    --button-bg: #4CAF50;
    --button-text: #ffffff;
    --float-icon-bg: #0b93d5;
    --float-icon-color: #ffffff;
}

/* Container styling (both shortcode & floating) */
#ai-chatbot-crm-container,
#ai-floating-chatbot-container {
    background-color: var(--chat-bg-color);
    color: var(--text-color);
    border: 1px solid #ccc;
    padding: 20px;
    max-width: 700px;
    margin: 20px auto;
    border-radius: 5px;
    font-family: Arial, sans-serif;
    position: relative;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* The messages area (both) */
#ai-chatbot-crm-messages,
#ai-floating-chatbot-messages {
    height: 400px;
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 10px;
    background-color: #fff;
    border-radius: 5px;
    word-break: break-word;
    position: relative;
    margin-bottom: 10px;
}

/* Common chat message bubble class (shared by both). */
.ai-chatbot-crm-message {
    margin-bottom: 10px;
    padding: 10px;
    border-radius: 5px;
    max-width: 80%;
    font-size: 14px;
    line-height: 1.5;
    clear: both;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* user vs bot bubble colors */
.ai-chatbot-crm-message.user {
    background-color: var(--user-bubble-bg);
    color: var(--user-bubble-text);
    border-left: 3px solid #0b93d5;
    float: right;
    text-align: right;
}
.ai-chatbot-crm-message.bot {
    background-color: var(--bot-bubble-bg);
    color: var(--bot-bubble-text);
    border-left: 3px solid #66a1d2;
    float: left;
    text-align: left;
}
.ai-chatbot-crm-message a {
    color: #0066cc;
    text-decoration: underline;
}
.ai-chatbot-crm-message a:hover {
    text-decoration: none;
    color: #004a99;
}

/* The text input and send button row (both) */
#ai-chatbot-crm-input,
#ai-floating-chatbot-input {
    display: flex;
    align-items: flex-end;
}

/* The message textarea (both) */
#ai-chatbot-crm-message-input,
#ai-floating-chatbot-message-input {
    flex: 1;
    padding: 10px;
    font-size: 14px;
    border-radius: 5px;
    border: 1px solid #ccc;
    resize: none;
    overflow: hidden;
	min-height: auto;
}

/* The send & voice buttons (both) */
#ai-chatbot-crm-input button,
#ai-floating-chatbot-input button {
    padding: 8px 12px;
    font-size: 14px;
    margin-left: 5px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    height: 36px;
    box-sizing: border-box;
}
#ai-chatbot-crm-send-button,
#ai-floating-chatbot-send-button {
    background-color: var(--button-bg);
    color: var(--button-text);
}
.ai-chatbot-voice-btn {
    background-color: #f4c57a;
    color: white;
    transition: background-color 0.2s ease;
}
.ai-chatbot-voice-btn.ai-listening {
    background-color: #e53935 !important; /* indicate active listening */
}

/* Language & voice controls row (both) */
.ai-chatbot-crm-lang-voice-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
}
.ai-chatbot-crm-lang-select,
.ai-chatbot-crm-audio-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* The user info form / initial screen (both) */
#ai-chatbot-crm-user-info,
#ai-floating-chatbot-user-info {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 15px;
}
.ai-chatbot-welcome-header h3 {
    margin: 0;
    padding: 0;
    font-size: 1.25em;
    color: #333;
}
.ai-chatbot-welcome-subtext {
    margin: 5px 0 10px;
    font-size: 0.95em;
    color: #666;
}
.ai-chatbot-user-form .ai-chatbot-form-field {
    margin-bottom: 4px;
}
.ai-chatbot-form-field label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 0.95em;
}
.ai-chatbot-form-field input[type="text"],
.ai-chatbot-form-field input[type="email"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}
.ai-chatbot-consent {
    margin-top: 10px;
}
.ai-chatbot-start-btn {
    margin-top: 5px;
    background-color: var(--button-bg);
    color: var(--button-text) !important;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}
.ai-chatbot-start-btn:hover {
    opacity: 0.9;
}

/* The typing/listening indicators (both) */
#ai-chatbot-crm-typing-indicator,
#ai-floating-chatbot-typing-indicator,
#ai-chatbot-crm-listening-indicator,
#ai-floating-chatbot-listening-indicator {
    margin: 5px 0;
    clear: both;
    font-size: 0.95em;
    color: #666;
    display: none; /* default hidden, toggled in JS */
}

/* The help modal overlay styling is similarly applied. */
#ai-chatbot-crm-help-overlay,
#ai-floating-chatbot-help-overlay {
    display: none;
    position: fixed;
    top:0; left:0;
    width:100%; height:100%;
    background: rgba(0,0,0,0.5);
    z-index: 9998;
}

/* Chatbot floating button & container */
.ai-chatbot-float-btn {
    position: fixed;
    bottom: 20px;
    /* Default right position handled by next rule */
    z-index: 9999;
    width: 60px;
    height: 60px;
    background-color: var(--float-icon-bg);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    text-align: center;
    line-height: 60px;
    color: var(--float-icon-color);
    font-size: 24px;
}

/* *** ADDED POSITIONING RULES *** */
.ai-chatbot-float-btn.ai-chatbot-float-btn-right {
    right: 20px;
    left: auto;
}
.ai-chatbot-float-btn.ai-chatbot-float-btn-left {
    left: 20px;
    right: auto;
}
/* *** END POSITIONING RULES *** */


.ai-chatbot-float-icon {
    display: inline-block;
    vertical-align: middle;
}

.ai-chatbot-floating-container {
    position: fixed;
    bottom: 75px; /* Above the button */
    z-index: 9999;
    width: 360px;
    max-width: 90%;
    /* background: #fff; 
    border: 1px solid #ccc;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);  */
    max-height: calc(100vh - 120px); /* Avoid overlap with button and top */
    overflow-y: auto;
}

/* *** ADDED POSITIONING FOR CONTAINER *** */
.ai-chatbot-floating-container.ai-chatbot-float-btn-right {
    right: 20px;
    left: auto;
}
.ai-chatbot-floating-container.ai-chatbot-float-btn-left {
    left: 20px;
    right: auto;
}
/* *** END CONTAINER POSITIONING *** */

/* Additional controls & rating UI inside each message. */
.ai-chatbot-crm-controls button {
    background: #eee;
    color: #333;
    border: 1px solid #ccc;
    margin-right: 3px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 5px;
}
.ai-chatbot-crm-rating {
    margin-top: 5px;
    display: inline-block;
    margin-left: 10px;
    vertical-align: middle;
}
.ai-chatbot-crm-rating button {
    background: #eee;
    color: #333;
    border: 1px solid #ccc;
    margin-left: 3px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 5px;
}
.button-danger {
    background: #dc3232;
    color: #fff;
    border: none;
    cursor: pointer;
}

/* (existing content retained) */

/* === RTL SUPPORT ===================================================== */
[dir="rtl"] .ai-chatbot-crm-message {
    text-align: right;
}

[dir="rtl"] .ai-chatbot-crm-message.bot {
    float: right;
    border-right: 3px solid #66a1d2;
    border-left: none;
}

[dir="rtl"] .ai-chatbot-crm-message.user {
    float: left;
    border-right: 3px solid #0b93d5;
    border-left: none;
}
/* ==================================================================== */

/* ------------------------------------------------------------------------
   If you’ve uploaded a custom button image, make sure it stays contained
------------------------------------------------------------------------- */
.ai-chatbot-float-icon img {
    max-width: 100%;
    max-height: 100%;
    display: inline-block;
    vertical-align: middle;
}

/* === Enterprise frontend UX upgrade (4.5.0) =========================== */
#ai-chatbot-crm-container.ai-chatbot-layout-enterprise,
#ai-floating-chatbot-container.ai-chatbot-layout-enterprise {
    border: 0;
    border-radius: 22px;
    background: linear-gradient(180deg, #ffffff 0%, var(--chat-bg-color) 100%);
    box-shadow: 0 22px 60px rgba(15, 23, 42, 0.18);
    overflow: hidden;
}
#ai-chatbot-crm-container.ai-chatbot-layout-modern,
#ai-floating-chatbot-container.ai-chatbot-layout-modern {
    border-radius: 16px;
    border-color: rgba(15, 23, 42, 0.12);
}
.ai-chatbot-layout-enterprise .ai-chatbot-welcome-header,
.ai-chatbot-layout-modern .ai-chatbot-welcome-header {
    margin: -20px -20px 16px;
    padding: 24px 24px 18px;
    background: linear-gradient(135deg, var(--button-bg), #1f7aec);
    color: var(--button-text);
}
.ai-chatbot-layout-enterprise .ai-chatbot-welcome-header h3,
.ai-chatbot-layout-modern .ai-chatbot-welcome-header h3,
.ai-chatbot-layout-enterprise .ai-chatbot-welcome-subtext,
.ai-chatbot-layout-modern .ai-chatbot-welcome-subtext { color: inherit; }
.ai-chatbot-density-compact #ai-chatbot-crm-messages,
.ai-chatbot-density-compact #ai-floating-chatbot-messages { height: 360px; }
.ai-chatbot-density-spacious #ai-chatbot-crm-messages,
.ai-chatbot-density-spacious #ai-floating-chatbot-messages { height: 460px; }
.ai-chatbot-layout-enterprise #ai-chatbot-crm-messages,
.ai-chatbot-layout-enterprise #ai-floating-chatbot-messages {
    border: 0;
    background: rgba(255,255,255,0.7);
    padding: 16px;
}
.ai-chatbot-layout-enterprise .ai-chatbot-crm-message,
.ai-chatbot-layout-modern .ai-chatbot-crm-message {
    border: 0 !important;
    border-radius: 18px;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
    animation: aiMessageIn .22s ease-out both;
}
.ai-chatbot-motion-none .ai-chatbot-crm-message { animation: none; }
.ai-chatbot-motion-delight .ai-chatbot-crm-message { animation-duration: .34s; }
@keyframes aiMessageIn { from { opacity:0; transform: translateY(8px); } to { opacity:1; transform: translateY(0); } }
.ai-chatbot-suggested-prompts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 10px 4px;
}
.ai-chatbot-suggestion-chip {
    border: 1px solid rgba(11,147,213,.22);
    background: rgba(11,147,213,.08);
    color: var(--text-color);
    border-radius: 999px;
    padding: 7px 12px;
    cursor: pointer;
    font-size: 13px;
    transition: transform .15s ease, background .15s ease;
}
.ai-chatbot-suggestion-chip:hover { transform: translateY(-1px); background: rgba(11,147,213,.15); }
.ai-chatbot-rich-media {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
    margin-top: 12px;
}
.ai-chatbot-rich-media.is-compact { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.ai-chatbot-rich-card {
    background: #fff;
    border: 1px solid rgba(15,23,42,.08);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 24px rgba(15,23,42,.10);
}
.ai-chatbot-rich-image { width: 100%; height: 120px; object-fit: cover; display: block; }
.ai-chatbot-rich-body { padding: 12px; }
.ai-chatbot-rich-title { font-weight: 700; color: #111827; margin-bottom: 5px; }
.ai-chatbot-rich-meta { font-size: 13px; font-weight: 600; color: #0f766e; margin-bottom: 6px; }
.ai-chatbot-rich-description, .ai-chatbot-rich-sku { font-size: 12px; color: #4b5563; margin-bottom: 8px; }
.ai-chatbot-rich-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 4px;
    padding: 7px 10px;
    border-radius: 999px;
    background: var(--button-bg);
    color: var(--button-text) !important;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
}
.ai-chatbot-float-btn.ai-chatbot-has-label::after {
    content: attr(data-label);
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
    background: #111827;
    color: #fff;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    box-shadow: 0 10px 20px rgba(0,0,0,.15);
}
.ai-chatbot-float-btn-left.ai-chatbot-has-label::after { left: calc(100% + 10px); right: auto; }
@media (max-width: 520px) {
    #ai-chatbot-crm-container,
    #ai-floating-chatbot-container { margin: 8px; padding: 14px; }
    .ai-chatbot-rich-media { grid-template-columns: 1fr; }
    .ai-chatbot-float-btn.ai-chatbot-has-label::after { display:none; }
}

/* 4.5.1 enterprise frontend polish and reliability fixes */
#ai-chatbot-crm-container.ai-chatbot-layout-enterprise,
#ai-floating-chatbot-container.ai-chatbot-layout-enterprise {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 24px;
    background:
        radial-gradient(circle at top left, rgba(11, 147, 213, 0.10), transparent 34%),
        var(--chat-bg-color);
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.16);
    overflow: hidden;
}
.ai-chatbot-crm-lang-voice-controls {
    position: sticky;
    top: 0;
    z-index: 4;
    margin: -20px -20px 18px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.88);
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    justify-content: space-between;
}
.ai-chatbot-crm-lang-select,
.ai-chatbot-crm-audio-controls {
    gap: 8px;
    flex-wrap: wrap;
}
.ai-chatbot-control-label,
.ai-chatbot-control-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 7px 10px;
    border: 1px solid rgba(15, 23, 42, 0.10);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.86);
    color: #334155;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}
.ai-chatbot-control-label span { white-space: nowrap; }
.ai-chatbot-crm-lang-select select,
#ai-chatbot-crm-lang,
#ai-floating-chatbot-lang {
    min-height: 36px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 999px;
    padding: 0 28px 0 12px;
    background-color: #fff;
    color: #0f172a;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}
.ai-chatbot-crm-audio-controls button,
#ai-chatbot-crm-end-chat,
#ai-chatbot-crm-help-btn,
#ai-floating-chatbot-end-chat,
#ai-floating-chatbot-help-btn {
    min-height: 34px;
    border: 1px solid rgba(15, 23, 42, 0.10);
    border-radius: 999px;
    padding: 7px 12px;
    background: #fff;
    color: #0f172a;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
#ai-chatbot-crm-end-chat,
#ai-floating-chatbot-end-chat {
    background: #fff7ed;
    border-color: rgba(234, 88, 12, 0.18);
    color: #9a3412;
}
#ai-chatbot-crm-help-btn,
#ai-floating-chatbot-help-btn {
    background: #eff6ff;
    border-color: rgba(37, 99, 235, 0.16);
    color: #1d4ed8;
}
.ai-chatbot-crm-audio-controls button:hover,
#ai-chatbot-crm-end-chat:hover,
#ai-chatbot-crm-help-btn:hover,
#ai-floating-chatbot-end-chat:hover,
#ai-floating-chatbot-help-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
}
#ai-chatbot-crm-messages,
#ai-floating-chatbot-messages {
    border: 0;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.96), #fff);
    border-radius: 20px;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.07);
}
.ai-chatbot-crm-message.has-avatar {
    position: relative;
    padding-top: 30px;
}
.ai-chatbot-message-avatar {
    position: absolute;
    top: 8px;
    left: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .02em;
    background: #e0f2fe;
    color: #0369a1;
}
.ai-chatbot-crm-message.user .ai-chatbot-message-avatar {
    left: auto;
    right: 10px;
    background: #dcfce7;
    color: #166534;
}
.ai-chatbot-message-time {
    display: block;
    margin-top: 7px;
    opacity: .58;
    font-size: 11px;
    font-weight: 600;
}
#ai-chatbot-crm-input,
#ai-floating-chatbot-input {
    gap: 8px;
    padding: 10px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 14px 38px rgba(15, 23, 42, 0.08);
}
#ai-chatbot-crm-message-input,
#ai-floating-chatbot-message-input {
    border: 0;
    background: #f8fafc;
    border-radius: 16px;
    min-height: 44px;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}
#ai-chatbot-crm-send-button,
#ai-floating-chatbot-send-button,
#ai-chatbot-crm-voice-button,
#ai-floating-chatbot-voice-button {
    border-radius: 16px !important;
    min-height: 44px;
    height: 44px !important;
    padding: 0 16px !important;
    font-weight: 800;
}
#ai-chatbot-crm-send-button.is-busy,
#ai-floating-chatbot-send-button.is-busy,
#ai-chatbot-crm-voice-button.is-busy,
#ai-floating-chatbot-voice-button.is-busy {
    opacity: .62;
    cursor: progress;
}
.ai-chatbot-suggested-prompts {
    margin: 8px 0;
    padding: 0 2px;
    max-height: 78px;
    overflow: auto;
}
.ai-chatbot-suggestion-chip {
    background: #fff;
    border-color: rgba(15, 23, 42, 0.10);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}
@media (max-width: 520px) {
    .ai-chatbot-crm-lang-voice-controls {
        margin: -14px -14px 14px;
        padding: 10px;
        align-items: stretch;
    }
    .ai-chatbot-crm-lang-select,
    .ai-chatbot-crm-audio-controls {
        width: 100%;
    }
    #ai-chatbot-crm-input,
    #ai-floating-chatbot-input {
        align-items: stretch;
    }
    #ai-chatbot-crm-send-button,
    #ai-floating-chatbot-send-button,
    #ai-chatbot-crm-voice-button,
    #ai-floating-chatbot-voice-button {
        padding: 0 12px !important;
    }
}

/* 4.5.2 frontend UX refinements */
.ai-chatbot-layout-enterprise .ai-chatbot-welcome-header,
.ai-chatbot-layout-modern .ai-chatbot-welcome-header {
    background: linear-gradient(135deg, var(--prechat-header-bg, var(--button-bg)), var(--button-bg));
    color: var(--prechat-header-text, var(--button-text));
}
.ai-chatbot-controls-toggle {
    display: none;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    border: 1px solid rgba(15,23,42,.12);
    border-radius: 999px;
    background: #fff;
    color: #0f172a;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    padding: 7px 12px;
    box-shadow: 0 8px 18px rgba(15,23,42,.08);
    cursor: pointer;
}
.ai-chatbot-crm-lang-voice-controls.is-collapsed {
    display: flex;
    justify-content: flex-end;
    gap: 0;
    padding: 8px 12px;
}
.ai-chatbot-crm-lang-voice-controls.is-collapsed .ai-chatbot-controls-toggle { display: inline-flex; }
.ai-chatbot-crm-lang-voice-controls.is-collapsed .ai-chatbot-crm-lang-select,
.ai-chatbot-crm-lang-voice-controls.is-collapsed .ai-chatbot-crm-audio-controls { display: none; }
.ai-chatbot-crm-lang-voice-controls:not(.is-collapsed) .ai-chatbot-controls-toggle {
    display: inline-flex;
    order: 99;
    opacity: .82;
}
.ai-chatbot-crm-lang-voice-controls:not(.is-collapsed) .ai-chatbot-controls-toggle span::after { content: ' -'; }
.ai-chatbot-help-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .52);
    z-index: 99998;
    backdrop-filter: blur(4px);
}
.ai-chatbot-help-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 99999;
    width: min(720px, calc(100vw - 28px));
    max-height: min(82vh, 760px);
    overflow: auto;
    border: 1px solid rgba(15,23,42,.10);
    border-radius: 24px;
    background: linear-gradient(180deg, #fff 0%, var(--chat-bg-color) 100%);
    box-shadow: 0 30px 90px rgba(15,23,42,.28);
    color: var(--text-color);
    padding: 0;
}
.ai-chatbot-help-header {
    padding: 22px 24px;
    background: linear-gradient(135deg, var(--prechat-header-bg, var(--button-bg)), var(--button-bg));
    color: var(--prechat-header-text, var(--button-text));
}
.ai-chatbot-help-header h2 { margin: 0; color: inherit; font-size: 24px; line-height: 1.2; }
.ai-chatbot-help-body { padding: 20px 24px 8px; font-size: 15px; line-height: 1.55; }
.ai-chatbot-help-body ul,
.ai-chatbot-help-body ol { margin: 8px 0 16px 1.25em; padding: 0; }
.ai-chatbot-help-body li { margin: 5px 0; padding: 0; }
.ai-chatbot-help-close {
    margin: 8px 24px 22px !important;
    border-radius: 999px !important;
    padding: 8px 18px !important;
    font-weight: 800 !important;
}
.ai-chatbot-crm-message ul,
.ai-chatbot-crm-message ol {
    margin: .45em 0 .55em 1.2em;
    padding: 0;
}
.ai-chatbot-crm-message li {
    margin: .18em 0;
    padding-inline-start: .1em;
    line-height: 1.45;
}
.ai-chatbot-crm-message p { margin: .35em 0; }
.ai-chatbot-crm-message br + br { display: none; }
.ai-chatbot-crm-message[dir="rtl"] ul,
.ai-chatbot-crm-message[dir="rtl"] ol {
    margin: .45em 1.2em .55em 0;
    padding: 0;
    text-align: right;
}
.ai-chatbot-rich-card-link .ai-chatbot-rich-title::before { content: none; }
.ai-chatbot-float-btn.ai-chatbot-label-hidden::after { display: none !important; }
.ai-chatbot-float-btn.ai-chatbot-label-timed.ai-chatbot-label-expired::after { opacity: 0; visibility: hidden; transform: translateY(-50%) translateX(6px); pointer-events: none; }
.ai-chatbot-float-btn::after { transition: opacity .22s ease, visibility .22s ease, transform .22s ease; }
@media (max-width: 520px) {
    .ai-chatbot-controls-toggle { width: auto; justify-content: center; }
    .ai-chatbot-crm-lang-voice-controls:not(.is-collapsed) .ai-chatbot-controls-toggle { width: 100%; }
    .ai-chatbot-help-modal { width: calc(100vw - 18px); border-radius: 18px; }
    .ai-chatbot-help-body { padding: 16px 18px 6px; }
}

/* 4.5.3 toolbar reliability and rich media controls */
.ai-floating-chatbot-lang-voice-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-bottom: 1px solid rgba(15,23,42,.08);
    background: rgba(255,255,255,.55);
}
.ai-floating-chatbot-lang-voice-controls.is-collapsed,
.ai-chatbot-crm-lang-voice-controls.is-collapsed {
    min-height: 42px;
}
.ai-floating-chatbot-lang-voice-controls.is-collapsed {
    display: flex;
    justify-content: flex-end;
    gap: 0;
    padding: 8px 12px;
}
.ai-floating-chatbot-lang-voice-controls.is-collapsed .ai-chatbot-controls-toggle { display: inline-flex; }
.ai-floating-chatbot-lang-voice-controls.is-collapsed .ai-floating-chatbot-lang-select,
.ai-floating-chatbot-lang-voice-controls.is-collapsed .ai-chatbot-crm-audio-controls { display: none; }
.ai-floating-chatbot-lang-voice-controls:not(.is-collapsed) .ai-chatbot-controls-toggle {
    display: inline-flex;
    order: 99;
    opacity: .82;
}
.ai-floating-chatbot-lang-voice-controls:not(.is-collapsed) .ai-chatbot-controls-toggle span::after { content: ' -'; }
.ai-chatbot-crm-lang-voice-controls[style*="display:none"],
.ai-floating-chatbot-lang-voice-controls[style*="display:none"] { display: none !important; }
.ai-chatbot-rich-media.layout-list,
.ai-chatbot-rich-media.layout-grid { width: 100%; }
.ai-chatbot-rich-media.layout-list .ai-chatbot-rich-card { width: 100%; }
.ai-chatbot-rich-media.layout-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
}
.ai-chatbot-rich-media.layout-grid .ai-chatbot-rich-card { min-width: 0; }
.ai-chatbot-rich-card.no-image .ai-chatbot-rich-image { display: none; }
.ai-chatbot-rich-card .ai-chatbot-rich-cta { white-space: nowrap; }
@media (max-width: 520px) {
    .ai-floating-chatbot-lang-voice-controls:not(.is-collapsed),
    .ai-chatbot-crm-lang-voice-controls:not(.is-collapsed) {
        gap: 8px;
        padding: 10px;
    }
    .ai-floating-chatbot-lang-voice-controls:not(.is-collapsed) .ai-chatbot-controls-toggle,
    .ai-chatbot-crm-lang-voice-controls:not(.is-collapsed) .ai-chatbot-controls-toggle { width: 100%; justify-content: center; }
}

/* 4.5.4 rich media and pre-chat surface refinements */
.ai-chatbot-layout-enterprise #ai-chatbot-crm-user-info,
.ai-chatbot-layout-modern #ai-chatbot-crm-user-info,
.ai-chatbot-layout-enterprise #ai-floating-chatbot-user-info,
.ai-chatbot-layout-modern #ai-floating-chatbot-user-info {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
}
.ai-chatbot-layout-enterprise .ai-chatbot-user-form,
.ai-chatbot-layout-modern .ai-chatbot-user-form {
    background: rgba(255, 255, 255, .88);
    border: 1px solid rgba(15, 23, 42, .08);
    border-top: 0;
    border-radius: 0 0 20px 20px;
    padding: 20px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .10);
}
.ai-chatbot-layout-enterprise .ai-chatbot-welcome-header,
.ai-chatbot-layout-modern .ai-chatbot-welcome-header {
    border-radius: 20px 20px 0 0;
}
.ai-chatbot-rich-media {
    align-items: stretch;
}
.ai-chatbot-rich-card {
    position: relative;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid rgba(15, 23, 42, .10);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.ai-chatbot-rich-card:hover {
    transform: translateY(-2px);
    border-color: rgba(11, 147, 213, .28);
    box-shadow: 0 16px 34px rgba(15, 23, 42, .15);
}
.ai-chatbot-rich-card-link .ai-chatbot-rich-title::before { content: none !important; }
.ai-chatbot-rich-card-link .ai-chatbot-rich-body {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 12px;
    align-items: start;
}
.ai-chatbot-rich-card-link .ai-chatbot-rich-icon {
    grid-row: span 3;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--button-bg), #0ea5e9);
    color: var(--button-text);
    font-weight: 900;
    font-size: 20px;
    box-shadow: 0 10px 24px rgba(14, 165, 233, .22);
}
.ai-chatbot-rich-card-link .ai-chatbot-rich-title,
.ai-chatbot-rich-card-link .ai-chatbot-rich-meta,
.ai-chatbot-rich-card-link .ai-chatbot-rich-description,
.ai-chatbot-rich-card-link .ai-chatbot-rich-cta {
    grid-column: 2;
}
.ai-chatbot-rich-card-link .ai-chatbot-rich-title {
    font-size: 15px;
    color: #0f172a;
    margin: 0;
}
.ai-chatbot-rich-card-link .ai-chatbot-rich-meta {
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    margin: -2px 0 0;
}
.ai-chatbot-rich-card-link .ai-chatbot-rich-description {
    color: #475569;
    font-size: 12px;
    line-height: 1.45;
    margin: 0;
}
.ai-chatbot-rich-card-link .ai-chatbot-rich-cta {
    width: fit-content;
    margin-top: 4px;
    padding: 8px 12px;
}
.ai-chatbot-rich-media.is-compact .ai-chatbot-rich-card-link .ai-chatbot-rich-body {
    grid-template-columns: auto 1fr;
}
@media (max-width: 520px) {
    .ai-chatbot-layout-enterprise .ai-chatbot-user-form,
    .ai-chatbot-layout-modern .ai-chatbot-user-form {
        padding: 10px;
    }
    .ai-chatbot-rich-card-link .ai-chatbot-rich-body {
        grid-template-columns: 38px 1fr;
    }
    .ai-chatbot-rich-card-link .ai-chatbot-rich-icon {
        width: 38px;
        height: 38px;
        border-radius: 12px;
    }
}

/* 4.5.5 rich media value cards and transparent pre-chat surface */
.ai-chatbot-layout-enterprise #ai-chatbot-crm-user-info,
.ai-chatbot-layout-modern #ai-chatbot-crm-user-info,
.ai-chatbot-layout-enterprise #ai-floating-chatbot-user-info,
.ai-chatbot-layout-modern #ai-floating-chatbot-user-info,
.ai-chatbot-layout-enterprise .ai-chatbot-initial-screen,
.ai-chatbot-layout-modern .ai-chatbot-initial-screen {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}
.ai-chatbot-layout-enterprise .ai-chatbot-user-form,
.ai-chatbot-layout-modern .ai-chatbot-user-form {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 20px clamp(16px, 4vw, 28px) !important;
}
.ai-chatbot-layout-enterprise .ai-chatbot-form-field input,
.ai-chatbot-layout-modern .ai-chatbot-form-field input {
    background: rgba(255,255,255,.92);
}
.ai-chatbot-layout-enterprise .ai-chatbot-consent,
.ai-chatbot-layout-modern .ai-chatbot-consent {
    background: rgba(255,255,255,.16);
    border-radius: 16px;
    padding: 8px 10px;
}
.ai-chatbot-rich-card-link {
    overflow: hidden;
    padding: 0;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(248,250,252,.96));
}
.ai-chatbot-rich-card-link .ai-chatbot-rich-body {
    display: grid !important;
    grid-template-columns: 54px minmax(0,1fr);
    gap: 8px 14px;
    align-items: center;
    padding: 16px !important;
}
.ai-chatbot-rich-link-media {
    grid-row: 1 / span 4;
    width: 54px;
    height: 54px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, color-mix(in srgb, var(--button-bg) 82%, white), #0ea5e9);
    box-shadow: 0 10px 24px rgba(14,165,233,.20);
    overflow: hidden;
}
.ai-chatbot-rich-link-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: #fff;
}
.ai-chatbot-rich-link-media .ai-chatbot-rich-icon {
    width: auto !important;
    height: auto !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--button-text) !important;
    font-size: 24px !important;
}
.ai-chatbot-rich-card-link .ai-chatbot-rich-title,
.ai-chatbot-rich-card-link .ai-chatbot-rich-meta,
.ai-chatbot-rich-card-link .ai-chatbot-rich-description,
.ai-chatbot-rich-card-link .ai-chatbot-rich-cta {
    grid-column: 2 !important;
}
.ai-chatbot-rich-card-link .ai-chatbot-rich-title {
    font-size: 16px !important;
    line-height: 1.25 !important;
    color: #0f172a !important;
}
.ai-chatbot-rich-card-link .ai-chatbot-rich-meta {
    font-size: 12px !important;
    color: #667085 !important;
    letter-spacing: .01em;
}
.ai-chatbot-rich-card-link .ai-chatbot-rich-description {
    font-size: 13px !important;
    line-height: 1.45 !important;
    color: #475569 !important;
    margin-top: 2px !important;
}
.ai-chatbot-rich-card-link .ai-chatbot-rich-cta {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: fit-content !important;
    min-height: 34px;
    padding: 8px 14px !important;
    margin-top: 6px !important;
    border-radius: 999px !important;
    text-decoration: none !important;
    font-weight: 800 !important;
}
.ai-chatbot-rich-media.is-compact .ai-chatbot-rich-card-link .ai-chatbot-rich-body {
    grid-template-columns: 44px minmax(0,1fr);
    padding: 12px !important;
}
.ai-chatbot-rich-media.is-compact .ai-chatbot-rich-link-media {
    width: 44px;
    height: 44px;
}
@media (max-width: 520px) {
    .ai-chatbot-rich-card-link .ai-chatbot-rich-body {
        grid-template-columns: 46px minmax(0,1fr);
        padding: 14px !important;
    }
    .ai-chatbot-rich-link-media {
        width: 46px;
        height: 46px;
    }
}

/* WooCommerce Sales & Support Engine */
.ai-chatbot-progressive-note {
    margin: 10px 0 8px !important;
    color: #475569 !important;
    font-size: 13px !important;
    line-height: 1.45 !important;
}
.ai-chatbot-anonymous-start {
    width: 100% !important;
    margin-top: 4px !important;
}
.ai-chatbot-rich-labels,
.ai-chatbot-commerce-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    margin-top: 8px !important;
}
.ai-chatbot-rich-label {
    display: inline-flex !important;
    align-items: center !important;
    min-height: 22px !important;
    padding: 3px 8px !important;
    border-radius: 999px !important;
    background: rgba(15, 23, 42, 0.07) !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    color: #334155 !important;
}
.ai-chatbot-rich-rating,
.ai-chatbot-rich-attributes {
    margin-top: 5px !important;
    font-size: 12px !important;
    color: #475569 !important;
    line-height: 1.35 !important;
}
.ai-chatbot-commerce-action {
    appearance: none !important;
    border: 1px solid rgba(15, 23, 42, 0.14) !important;
    border-radius: 999px !important;
    background: #fff !important;
    color: #0f172a !important;
    cursor: pointer !important;
    font-size: 12px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    min-height: 32px !important;
    padding: 8px 11px !important;
}
.ai-chatbot-commerce-action:hover,
.ai-chatbot-commerce-action:focus {
    border-color: rgba(37, 99, 235, 0.65) !important;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12) !important;
    outline: none !important;
}
.ai-chatbot-commerce-action.is-busy,
.ai-chatbot-commerce-action:disabled {
    cursor: wait !important;
    opacity: .65 !important;
}
[dir="rtl"] .ai-chatbot-rich-labels,
[dir="rtl"] .ai-chatbot-commerce-actions {
    direction: rtl !important;
}
@media (max-width: 520px) {
    .ai-chatbot-commerce-action {
        min-height: 36px !important;
        padding: 9px 12px !important;
    }
}

/* WooCommerce continuation: variation picker and cart summary controls */
.ai-chatbot-variation-picker {
    display: grid;
    gap: 8px;
    margin: 10px 0 0;
}
.ai-chatbot-variation-option,
.ai-chatbot-commerce-action {
    cursor: pointer;
}
.ai-chatbot-variation-option {
    width: 100%;
    border: 1px solid rgba(0,0,0,.14);
    border-radius: 10px;
    background: #fff;
    padding: 9px 11px;
    text-align: start;
    font-size: 13px;
    line-height: 1.35;
}
.ai-chatbot-variation-option:hover,
.ai-chatbot-variation-option:focus {
    border-color: currentColor;
    outline: 2px solid transparent;
}
.ai-chatbot-variation-option.is-busy,
.ai-chatbot-commerce-action.is-busy {
    opacity: .65;
    pointer-events: none;
}
[dir="rtl"] .ai-chatbot-variation-option,
.rtl .ai-chatbot-variation-option {
    text-align: right;
}

/* WooCommerce cart drawer, quantity controls, and comparison table. */
.ai-chatbot-product-qty,
.ai-chatbot-cart-qty,
.ai-chatbot-cart-coupon-code,
.ai-chatbot-cart-ship-country,
.ai-chatbot-cart-ship-postcode {
    border: 1px solid rgba(15, 23, 42, 0.16);
    border-radius: 8px;
    padding: 6px 8px;
    min-height: 34px;
    background: #fff;
    color: #111827;
}
.ai-chatbot-product-qty { width: 64px; }
.ai-chatbot-cart-drawer,
.ai-chatbot-comparison-table-wrap {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 14px;
    background: rgba(255,255,255,0.96);
    box-shadow: 0 10px 24px rgba(15,23,42,0.08);
    overflow-x: auto;
}
.ai-chatbot-cart-title {
    font-weight: 700;
    margin-bottom: 8px;
}
.ai-chatbot-cart-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    padding: 8px 0;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
}
.ai-chatbot-cart-row:first-of-type { border-top: 0; }
.ai-chatbot-cart-name { font-weight: 600; }
.ai-chatbot-cart-line-total { white-space: nowrap; font-size: 0.92em; opacity: 0.82; }
.ai-chatbot-cart-controls,
.ai-chatbot-cart-coupon,
.ai-chatbot-cart-shipping,
.ai-chatbot-cart-save {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.ai-chatbot-cart-controls button,
.ai-chatbot-cart-coupon button,
.ai-chatbot-cart-shipping button,
.ai-chatbot-cart-save button,
.ai-chatbot-cart-checkout {
    border: 0;
    border-radius: 999px;
    padding: 7px 12px;
    cursor: pointer;
    background: #0f172a;
    color: #fff;
}
.ai-chatbot-cart-controls button:hover,
.ai-chatbot-cart-coupon button:hover,
.ai-chatbot-cart-shipping button:hover,
.ai-chatbot-cart-save button:hover,
.ai-chatbot-cart-checkout:hover { opacity: 0.9; }
.ai-chatbot-cart-checkout:disabled { opacity: 0.45; cursor: not-allowed; }
.ai-chatbot-cart-totals,
.ai-chatbot-cart-note,
.ai-chatbot-cart-empty { margin-top: 8px; font-size: 0.95em; }
.ai-chatbot-comparison-table {
    width: 100%;
    min-width: 520px;
    border-collapse: collapse;
    font-size: 0.92em;
}
.ai-chatbot-comparison-table th,
.ai-chatbot-comparison-table td {
    border: 1px solid rgba(15, 23, 42, 0.10);
    padding: 8px;
    text-align: start;
    vertical-align: top;
}
.ai-chatbot-comparison-table th { background: rgba(15, 23, 42, 0.06); font-weight: 700; }
[dir="rtl"] .ai-chatbot-cart-row,
.rtl .ai-chatbot-cart-row { direction: rtl; }
@media (max-width: 560px) {
    .ai-chatbot-cart-row { grid-template-columns: 1fr; }
    .ai-chatbot-cart-line-total { white-space: normal; }
    .ai-chatbot-cart-coupon input,
    .ai-chatbot-cart-shipping input { flex: 1 1 120px; min-width: 0; }
}
.ai-chatbot-quiz {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 14px;
    background: rgba(255,255,255,0.96);
    box-shadow: 0 10px 24px rgba(15,23,42,0.08);
}
.ai-chatbot-quiz-title {
    font-weight: 700;
    margin-bottom: 10px;
}
.ai-chatbot-quiz-field {
    display: block;
    margin: 10px 0;
    font-size: 0.94em;
}
.ai-chatbot-quiz-field span {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}
.ai-chatbot-quiz-field textarea {
    width: 100%;
    min-height: 54px;
    border: 1px solid rgba(15, 23, 42, 0.16);
    border-radius: 10px;
    padding: 8px;
    resize: vertical;
}
.ai-chatbot-quiz-submit {
    border: 0;
    border-radius: 999px;
    padding: 8px 14px;
    cursor: pointer;
    background: #0f172a;
    color: #fff;
}
.ai-chatbot-quiz-submit:hover { opacity: 0.9; }
[dir="rtl"] .ai-chatbot-quiz,
.rtl .ai-chatbot-quiz { direction: rtl; }

.ai-chatbot-order-card {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 14px;
    background: rgba(255,255,255,0.96);
    box-shadow: 0 10px 24px rgba(15,23,42,0.08);
}
.ai-chatbot-order-title {
    font-weight: 700;
    margin-bottom: 6px;
}
.ai-chatbot-order-meta,
.ai-chatbot-order-note {
    font-size: 0.92em;
    color: #475569;
    margin-top: 6px;
}
.ai-chatbot-order-items {
    margin: 8px 0;
    padding-inline-start: 20px;
}
.ai-chatbot-order-tracking,
.ai-chatbot-order-reorder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 8px 8px 0 0;
    border-radius: 999px;
    padding: 7px 12px;
    text-decoration: none;
}
.ai-chatbot-order-tracking {
    border: 1px solid rgba(15, 23, 42, 0.14);
}
.ai-chatbot-order-reorder {
    border: 0;
    background: #0f172a;
    color: #fff;
    cursor: pointer;
}
.ai-chatbot-order-reorder:disabled { opacity: 0.55; cursor: wait; }
.ai-chatbot-order-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.ai-chatbot-order-badges span {
    border-radius: 999px;
    background: rgba(15,23,42,0.06);
    padding: 4px 8px;
    font-size: 0.84em;
}
[dir="rtl"] .ai-chatbot-order-card,
.rtl .ai-chatbot-order-card { direction: rtl; }

/* 5.0.41 mobile safe-area, bottom-navigation offset, and scroll containment fixes. */
:root {
    --ai-chatbot-mobile-bottom-offset: 0px;
}
.ai-chatbot-float-btn {
    top: auto !important;
    bottom: calc(20px + var(--ai-chatbot-mobile-bottom-offset, 0px) + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 2147483000;
}
.ai-chatbot-floating-container {
    top: auto !important;
    bottom: calc(75px + var(--ai-chatbot-mobile-bottom-offset, 0px) + env(safe-area-inset-bottom, 0px)) !important;
    max-height: calc(100dvh - 120px - var(--ai-chatbot-mobile-bottom-offset, 0px) - env(safe-area-inset-bottom, 0px));
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
#ai-floating-chatbot-container,
#ai-floating-chatbot-chatbox {
    overscroll-behavior: contain;
}
#ai-chatbot-crm-messages,
#ai-floating-chatbot-messages,
.ai-chatbot-cart-drawer,
.ai-chatbot-comparison-table-wrap {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}
@media (max-width: 782px) {
    html.ai-chatbot-floating-open,
    body.ai-chatbot-floating-open {
        overflow: hidden !important;
        overscroll-behavior: none;
        touch-action: none;
    }
    body.ai-chatbot-floating-open {
        min-height: 100%;
        width: 100%;
    }
    body.ai-chatbot-floating-open .ai-chatbot-floating-container,
    body.ai-chatbot-floating-open #ai-floating-chatbot-container,
    body.ai-chatbot-floating-open #ai-floating-chatbot-chatbox {
        touch-action: none;
        overscroll-behavior: contain;
    }
    body.ai-chatbot-floating-open #ai-floating-chatbot-messages,
    body.ai-chatbot-floating-open .ai-chatbot-cart-drawer,
    body.ai-chatbot-floating-open .ai-chatbot-comparison-table-wrap,
    body.ai-chatbot-floating-open .ai-chatbot-quiz,
    body.ai-chatbot-floating-open textarea {
        touch-action: pan-y;
    }
    .ai-chatbot-float-btn {
        top: auto !important;
        bottom: calc(16px + var(--ai-chatbot-mobile-bottom-offset, 0px) + env(safe-area-inset-bottom, 0px)) !important;
    }
    .ai-chatbot-floating-container {
        left: 12px !important;
        right: 12px !important;
        top: auto !important;
        bottom: calc(86px + var(--ai-chatbot-mobile-bottom-offset, 0px) + env(safe-area-inset-bottom, 0px)) !important;
        width: auto;
        max-width: none;
        max-height: min(82dvh, calc(100dvh - 108px - var(--ai-chatbot-mobile-bottom-offset, 0px) - env(safe-area-inset-bottom, 0px)));
        overflow: hidden;
        border-radius: 22px;
    }
    #ai-floating-chatbot-container {
        max-height: inherit;
        display: flex;
        flex-direction: column;
        margin: 0;
        padding: 14px;
        overflow: hidden;
    }
    #ai-floating-chatbot-chatbox {
        display: flex;
        flex-direction: column;
        min-height: 0;
        overflow: hidden;
    }
    #ai-floating-chatbot-messages {
        flex: 1 1 auto;
        height: auto !important;
        min-height: 190px;
        max-height: none;
        overflow-y: auto;
    }
}
@media (max-width: 782px) and (max-height: 680px) {
    .ai-chatbot-floating-container {
        max-height: calc(100dvh - 102px - var(--ai-chatbot-mobile-bottom-offset, 0px) - env(safe-area-inset-bottom, 0px));
    }
    #ai-floating-chatbot-messages {
        min-height: 140px;
    }
}
@media (max-width: 782px) and (orientation: landscape) {
    .ai-chatbot-floating-container {
        max-height: calc(100dvh - 92px - var(--ai-chatbot-mobile-bottom-offset, 0px) - env(safe-area-inset-bottom, 0px));
    }
}

/* Premium voice dictation panel - compact in-input GPT-style control */
#ai-chatbot-crm-input,
#ai-floating-chatbot-input {
    flex-wrap: nowrap;
    max-width: 100%;
    overflow: hidden;
}
#ai-chatbot-crm-input.ai-chatbot-dictating,
#ai-floating-chatbot-input.ai-chatbot-dictating {
    align-items: center;
    gap: 0;
    padding: 8px;
}
#ai-chatbot-crm-input.ai-chatbot-dictating #ai-chatbot-crm-message-input,
#ai-chatbot-crm-input.ai-chatbot-dictating #ai-chatbot-crm-send-button,
#ai-chatbot-crm-input.ai-chatbot-dictating #ai-chatbot-crm-voice-button,
#ai-floating-chatbot-input.ai-chatbot-dictating #ai-floating-chatbot-message-input,
#ai-floating-chatbot-input.ai-chatbot-dictating #ai-floating-chatbot-send-button,
#ai-floating-chatbot-input.ai-chatbot-dictating #ai-floating-chatbot-voice-button {
    display: none !important;
}
.ai-chatbot-dictation-panel {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: 52px;
    margin: 0;
    padding: 0 10px;
    border: 0;
    border-radius: 999px;
    background: #202124;
    color: #e5e7eb;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
    box-sizing: border-box;
    overflow: hidden;
    direction: ltr;
}
.ai-chatbot-dictation-panel.is-paused { background: #1f2937; }
.ai-chatbot-dictation-panel.is-error { background: #3f1d1d; }
.ai-chatbot-dictation-plus {
    flex: 0 0 auto;
    width: 32px !important;
    min-width: 32px !important;
    height: 32px !important;
    min-height: 32px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: transparent !important;
    color: #a3a3a3 !important;
    font-size: 30px !important;
    font-weight: 300 !important;
    line-height: 1 !important;
    cursor: default !important;
}
.ai-chatbot-dictation-wave {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 38px;
    overflow: hidden;
}
.ai-chatbot-dictation-dotline {
    flex: 1 1 60px;
    min-width: 20px;
    max-width: 170px;
    border-top: 5px dotted rgba(229, 231, 235, 0.42);
    transform: translateY(1px);
}
.ai-chatbot-dictation-bar {
    flex: 0 0 auto;
    display: block;
    width: 5px;
    height: 14px;
    border-radius: 999px;
    background: rgba(229, 231, 235, 0.72);
    animation: aiChatbotDictationWave 1.05s ease-in-out infinite;
}
.ai-chatbot-dictation-bar:nth-child(3) { animation-delay: 0.12s; }
.ai-chatbot-dictation-bar:nth-child(4) { animation-delay: 0.24s; }
.ai-chatbot-dictation-bar:nth-child(5) { animation-delay: 0.36s; }
.ai-chatbot-dictation-bar:nth-child(6) { animation-delay: 0.48s; }
.ai-chatbot-dictation-panel.has-live-wave .ai-chatbot-dictation-bar { animation: none; }
.ai-chatbot-dictation-panel.is-paused .ai-chatbot-dictation-bar,
.ai-chatbot-dictation-panel.is-error .ai-chatbot-dictation-bar {
    animation-play-state: paused;
    opacity: 0.48;
}
@keyframes aiChatbotDictationWave {
    0%, 100% { transform: scaleY(0.55); }
    50% { transform: scaleY(1.9); }
}
.ai-chatbot-dictation-meta,
.ai-chatbot-dictation-title,
.ai-chatbot-dictation-status { display: none !important; }
.ai-chatbot-dictation-actions {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}
.ai-chatbot-dictation-actions button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    min-height: 34px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 999px !important;
    cursor: pointer;
    font-size: 25px !important;
    font-weight: 400 !important;
    line-height: 1 !important;
    box-shadow: none !important;
    transition: transform 0.12s ease, opacity 0.12s ease, background 0.12s ease;
}
.ai-chatbot-dictation-actions button:hover,
.ai-chatbot-dictation-actions button:focus-visible {
    transform: scale(1.06);
    outline: 2px solid rgba(255,255,255,.35);
    outline-offset: 2px;
}
.ai-chatbot-dictation-confirm {
    background: transparent !important;
    color: #ffffff !important;
}
.ai-chatbot-dictation-cancel {
    background: transparent !important;
    color: #ffffff !important;
}
.ai-chatbot-dictation-actions button:disabled {
    opacity: .45;
    cursor: progress;
}
#ai-chatbot-crm-voice-button.ai-listening,
#ai-floating-chatbot-voice-button.ai-listening {
    animation: aiChatbotVoicePulse 1.3s ease-in-out infinite;
    box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.12);
}
@keyframes aiChatbotVoicePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}
[dir="rtl"] .ai-chatbot-dictation-panel,
.ai-chatbot-dictation-panel[dir="rtl"] {
    direction: ltr;
}
@media (max-width: 782px) {
    .ai-chatbot-dictation-panel {
        height: 48px;
        gap: 8px;
        padding: 0 8px;
    }
    .ai-chatbot-dictation-dotline {
        min-width: 12px;
    }
    .ai-chatbot-dictation-bar {
        width: 4px;
        gap: 3px;
    }
    .ai-chatbot-dictation-actions {
        gap: 5px;
    }
    .ai-chatbot-dictation-actions button {
        width: 30px !important;
        height: 30px !important;
        min-width: 30px !important;
        min-height: 30px !important;
    }
}

/* Premium cart action confirmation chips */
.ai-chatbot-cart-confirmation {
    margin: 10px 0 8px;
    padding: 12px;
    border: 1px solid rgba(15, 23, 42, 0.10);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}
.ai-chatbot-cart-confirmation-title {
    font-weight: 800;
    font-size: 14px;
    margin-bottom: 4px;
}
.ai-chatbot-cart-confirmation-copy {
    font-size: 13px;
    line-height: 1.45;
    opacity: 0.82;
}
.ai-chatbot-cart-confirmation-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.ai-chatbot-cart-confirmation-actions button {
    border: 0;
    border-radius: 999px;
    padding: 9px 13px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.ai-chatbot-cart-confirmation-actions button:hover,
.ai-chatbot-cart-confirmation-actions button:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.14);
    outline: none;
}
.ai-chatbot-cart-confirmation-actions button:disabled {
    opacity: 0.55;
    cursor: wait;
}
.ai-chatbot-cart-confirm-yes {
    background: #0f172a;
    color: #fff;
}
.ai-chatbot-cart-confirm-no {
    background: #f1f5f9;
    color: #0f172a;
}
[dir="rtl"] .ai-chatbot-cart-confirmation,
.ai-chatbot-cart-confirmation[dir="rtl"] {
    direction: rtl;
}

/* 5.0.29 dictation hardening: keep the old listening indicator disabled and the GPT-style bar within the chat input width. */
#ai-chatbot-crm-listening-indicator,
#ai-floating-chatbot-listening-indicator {
    display: none !important;
}
#ai-chatbot-crm-input.ai-chatbot-dictating,
#ai-floating-chatbot-input.ai-chatbot-dictating {
    min-height: 64px;
    max-width: 100%;
    overflow: hidden !important;
}
#ai-chatbot-crm-input.ai-chatbot-dictating .ai-chatbot-dictation-panel,
#ai-floating-chatbot-input.ai-chatbot-dictating .ai-chatbot-dictation-panel {
    flex: 1 1 auto;
    width: 100%;
    max-width: 100%;
}
@media (max-width: 480px) {
    .ai-chatbot-dictation-panel {
        gap: 6px;
        padding-inline: 8px;
    }
    .ai-chatbot-dictation-plus {
        width: 26px !important;
        min-width: 26px !important;
        font-size: 26px !important;
    }
    .ai-chatbot-dictation-wave {
        gap: 3px;
    }
    .ai-chatbot-dictation-dotline {
        max-width: 90px;
        border-top-width: 4px;
    }
}
@media (prefers-reduced-motion: reduce) {
    .ai-chatbot-dictation-bar,
    #ai-chatbot-crm-voice-button.ai-listening,
    #ai-floating-chatbot-voice-button.ai-listening {
        animation: none !important;
    }
}

/* 5.0.32 smart quick audio stop: appears only while a bot answer is speaking. */
#ai-chatbot-crm-container .ai-chatbot-quick-audio-stop,
#ai-floating-chatbot-container .ai-chatbot-quick-audio-stop {
    position: absolute;
    inset-inline-end: 18px;
    bottom: 92px;
    z-index: 2147483010;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 52px;
    height: 44px;
    padding: 0 12px;
    border: 0;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.92);
    color: #ffffff;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.26), 0 0 0 1px rgba(255,255,255,0.18) inset;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px) scale(0.96);
    transition: opacity 160ms ease, transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
    -webkit-tap-highlight-color: transparent;
}
#ai-chatbot-crm-container .ai-chatbot-quick-audio-stop.is-visible,
#ai-floating-chatbot-container .ai-chatbot-quick-audio-stop.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}
#ai-chatbot-crm-container .ai-chatbot-quick-audio-stop:hover,
#ai-chatbot-crm-container .ai-chatbot-quick-audio-stop:focus-visible,
#ai-floating-chatbot-container .ai-chatbot-quick-audio-stop:hover,
#ai-floating-chatbot-container .ai-chatbot-quick-audio-stop:focus-visible {
    background: rgba(2, 6, 23, 0.96);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.34), 0 0 0 3px rgba(59, 130, 246, 0.28);
    outline: none;
}
.ai-chatbot-quick-audio-stop-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    font-size: 17px;
    line-height: 1;
}
.ai-chatbot-quick-audio-wave {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    height: 22px;
}
.ai-chatbot-quick-audio-wave i {
    display: block;
    width: 3px;
    height: 10px;
    border-radius: 999px;
    background: currentColor;
    opacity: 0.86;
    animation: ai-chatbot-quick-audio-pulse 760ms ease-in-out infinite;
}
.ai-chatbot-quick-audio-wave i:nth-child(2) { animation-delay: 120ms; height: 16px; }
.ai-chatbot-quick-audio-wave i:nth-child(3) { animation-delay: 240ms; height: 20px; }
.ai-chatbot-quick-audio-wave i:nth-child(4) { animation-delay: 360ms; height: 13px; }
@keyframes ai-chatbot-quick-audio-pulse {
    0%, 100% { transform: scaleY(0.58); opacity: 0.56; }
    50% { transform: scaleY(1); opacity: 1; }
}
#ai-chatbot-crm-container .ai-chatbot-quick-audio-stop .screen-reader-text,
#ai-floating-chatbot-container .ai-chatbot-quick-audio-stop .screen-reader-text {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}
[dir="rtl"] #ai-chatbot-crm-container .ai-chatbot-quick-audio-stop,
[dir="rtl"] #ai-floating-chatbot-container .ai-chatbot-quick-audio-stop,
.rtl #ai-chatbot-crm-container .ai-chatbot-quick-audio-stop,
.rtl #ai-floating-chatbot-container .ai-chatbot-quick-audio-stop {
    direction: rtl;
}
@media (max-width: 520px) {
    #ai-chatbot-crm-container .ai-chatbot-quick-audio-stop,
    #ai-floating-chatbot-container .ai-chatbot-quick-audio-stop {
        inset-inline-end: 14px;
        bottom: 82px;
        height: 42px;
        min-width: 48px;
        padding: 0 11px;
    }
}
@media (prefers-reduced-motion: reduce) {
    #ai-chatbot-crm-container .ai-chatbot-quick-audio-stop,
    #ai-floating-chatbot-container .ai-chatbot-quick-audio-stop,
    .ai-chatbot-quick-audio-wave i {
        transition: none;
        animation: none;
    }
}


/* 5.2.2 resilient composer layout: keep text entry usable when commerce tools are enabled. */
#ai-chatbot-crm-input,
#ai-floating-chatbot-input {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 8px;
    max-width: 100%;
    overflow: visible;
    box-sizing: border-box;
}
#ai-chatbot-crm-message-input,
#ai-floating-chatbot-message-input {
    grid-column: 1 / -1;
    grid-row: 1;
    width: 100%;
    min-width: 0;
    min-height: 48px;
    max-height: 150px;
    margin: 0;
    box-sizing: border-box;
}
#ai-chatbot-crm-input .ai-chatbot-commerce-ux-tools,
#ai-floating-chatbot-input .ai-chatbot-commerce-ux-tools {
    grid-column: 1;
    grid-row: 2;
    min-width: 0;
    justify-self: start;
}
#ai-chatbot-crm-send-button,
#ai-floating-chatbot-send-button {
    grid-column: 2;
    grid-row: 2;
    margin: 0 !important;
    white-space: nowrap;
}
#ai-chatbot-crm-voice-button,
#ai-floating-chatbot-voice-button {
    grid-column: 3;
    grid-row: 2;
    margin: 0 !important;
}
#ai-chatbot-crm-input.ai-chatbot-dictating,
#ai-floating-chatbot-input.ai-chatbot-dictating {
    display: flex;
    overflow: hidden !important;
}
#ai-chatbot-crm-input.ai-chatbot-dictating .ai-chatbot-commerce-ux-tools,
#ai-floating-chatbot-input.ai-chatbot-dictating .ai-chatbot-commerce-ux-tools,
#ai-chatbot-crm-input.ai-chatbot-dictating .ai-chatbot-commerce-ux-status,
#ai-floating-chatbot-input.ai-chatbot-dictating .ai-chatbot-commerce-ux-status {
    display: none !important;
}
@media (max-width: 520px) {
    #ai-chatbot-crm-input,
    #ai-floating-chatbot-input {
        grid-template-columns: minmax(0, 1fr) auto auto;
        gap: 7px;
        padding: 9px;
    }
    #ai-chatbot-crm-send-button,
    #ai-floating-chatbot-send-button {
        min-width: 64px;
        padding-inline: 12px !important;
    }
    #ai-chatbot-crm-voice-button,
    #ai-floating-chatbot-voice-button {
        width: 44px;
        min-width: 44px;
        padding: 0 !important;
    }
}
@media (max-width: 380px) {
    #ai-chatbot-crm-input,
    #ai-floating-chatbot-input {
        gap: 6px;
        padding: 8px;
    }
    #ai-chatbot-crm-send-button,
    #ai-floating-chatbot-send-button {
        min-width: 58px;
        padding-inline: 10px !important;
    }
}
