/* ============================================================
   CHAT WIDGET — Milatex Prod Impex
   Faza 5.2 — Foloseste variabile per-tema:
   - default:   --c-teal / --c-teal-dark
   - corporate: --c-petrol / --c-petrol-dark
   - immersive: --c-accent / --c-accent-hover

   Daca tema activa nu defineste --mlx-chat-primary, fallback la #15c1b8.
============================================================ */

:root {
    --mlx-chat-z: 9990;
    --mlx-chat-bubble-size: 60px;
    --mlx-chat-shadow: 0 8px 28px rgba(0,0,0,.18);
    --mlx-chat-radius: 14px;
    --mlx-chat-radius-bubble: 18px;

    /* Fallback (default theme) — temele override --mlx-chat-primary */
    --mlx-chat-primary:      var(--c-teal,       #15c1b8);
    --mlx-chat-primary-dark: var(--c-teal-dark,  #11a59d);

    --mlx-chat-text:        #1f2937;
    --mlx-chat-text-muted:  #6b7280;
    --mlx-chat-border:      #e5e7eb;
    --mlx-chat-bg:          #ffffff;
    --mlx-chat-bg-alt:      #f9fafb;
    --mlx-chat-success:     #10b981;
}

/* Override per tema (set body class via root): la milatextrade temele
   sunt incluse separat ca link rel=stylesheet; selectorul de mai jos
   se aplica daca tema corporate sau immersive a definit propriile vars. */
body[data-theme="corporate"], html[data-theme="corporate"] {
    --mlx-chat-primary:      var(--c-petrol,      #0a5d80);
    --mlx-chat-primary-dark: var(--c-petrol-dark, #084c69);
}
body[data-theme="immersive"], html[data-theme="immersive"] {
    --mlx-chat-primary:      var(--c-accent,       #06b6d4);
    --mlx-chat-primary-dark: var(--c-accent-hover, #22d3ee);
    /* Popup dark variant ca sa se integreze cu tema dark a site-ului */
    --mlx-chat-text:        #e5e7eb;
    --mlx-chat-text-muted:  #9ca3af;
    --mlx-chat-border:      rgba(255,255,255,.10);
    --mlx-chat-bg:          #111827;
    --mlx-chat-bg-alt:      #0b1220;
}
/* Immersive Light — varianta cu ~15% lightness peste Immersive */
body[data-theme="immersive-light"], html[data-theme="immersive-light"] {
    --mlx-chat-primary:      var(--c-accent,       #06b6d4);
    --mlx-chat-primary-dark: var(--c-accent-hover, #22d3ee);
    --mlx-chat-text:        #f0f4f8;
    --mlx-chat-text-muted:  #b6c2d1;
    --mlx-chat-border:      rgba(255,255,255,.16);
    --mlx-chat-bg:          #262a35;
    --mlx-chat-bg-alt:      #1d2028;
}
body[data-theme="editorial"], html[data-theme="editorial"] {
    --mlx-chat-primary:      var(--c-accent, #00d4ff);
    --mlx-chat-primary-dark: #0088aa;
    --mlx-chat-text:        #fafaf7;
    --mlx-chat-text-muted:  #6b7785;
    --mlx-chat-border:      rgba(255,255,255,.10);
    --mlx-chat-bg:          #0a0e14;
    --mlx-chat-bg-alt:      #050810;
}
body[data-theme="schematic"], html[data-theme="schematic"] {
    --mlx-chat-primary:      var(--c-steam, #2d7a8a);
    --mlx-chat-primary-dark: #1f5f6b;
    /* Light cream theme — variabilele default merg in mare parte */
    --mlx-chat-text:        #1c1f1f;
    --mlx-chat-text-muted:  #5c6266;
    --mlx-chat-border:      #d7d3c4;
    --mlx-chat-bg:          #f0ede4;
    --mlx-chat-bg-alt:      #e8e4d5;
}

/* Bubble overrides pe dark theme — AI message bubble nu mai e alb */
body[data-theme="immersive"] .mlx-chat-msg.ai .mlx-chat-msg-bubble,
html[data-theme="immersive"] .mlx-chat-msg.ai .mlx-chat-msg-bubble {
    background: rgba(255,255,255,.06);
    color: #e5e7eb;
    border-color: rgba(255,255,255,.10);
}
body[data-theme="immersive"] .mlx-chat-msg.system .mlx-chat-msg-bubble,
html[data-theme="immersive"] .mlx-chat-msg.system .mlx-chat-msg-bubble {
    background: rgba(255,255,255,.04);
    color: #9ca3af;
    border-color: rgba(255,255,255,.08);
}
body[data-theme="immersive"] .mlx-chat-typing,
html[data-theme="immersive"] .mlx-chat-typing {
    background: rgba(255,255,255,.06);
    border-color: rgba(255,255,255,.10);
}
/* Form fields pe dark */
body[data-theme="immersive"] #mlxChatRoot .mlx-chat-form-field input,
body[data-theme="immersive"] #mlxChatRoot .mlx-chat-form-field select,
body[data-theme="immersive"] #mlxChatRoot .mlx-chat-form-field textarea,
html[data-theme="immersive"] #mlxChatRoot .mlx-chat-form-field input,
html[data-theme="immersive"] #mlxChatRoot .mlx-chat-form-field select,
html[data-theme="immersive"] #mlxChatRoot .mlx-chat-form-field textarea {
    background: rgba(255,255,255,.06) !important;
    color: #e5e7eb !important;
    -webkit-text-fill-color: #e5e7eb !important;  /* peste reset-ul general care forteaza dark text */
    color-scheme: dark !important;  /* forteaza browser sa render-eze autocomplete cu tema dark */
}
/* Chrome autocomplete background — fallback peste fill-color galben/albastru auto */
body[data-theme="immersive"] #mlxChatRoot .mlx-chat-form-field input:-webkit-autofill,
body[data-theme="immersive"] #mlxChatRoot .mlx-chat-form-field input:-webkit-autofill:hover,
body[data-theme="immersive"] #mlxChatRoot .mlx-chat-form-field input:-webkit-autofill:focus,
html[data-theme="immersive"] #mlxChatRoot .mlx-chat-form-field input:-webkit-autofill,
html[data-theme="immersive"] #mlxChatRoot .mlx-chat-form-field input:-webkit-autofill:hover,
html[data-theme="immersive"] #mlxChatRoot .mlx-chat-form-field input:-webkit-autofill:focus {
    -webkit-text-fill-color: #e5e7eb !important;
    -webkit-box-shadow: 0 0 0 1000px rgba(20, 30, 50, 0.95) inset !important;
    caret-color: #e5e7eb !important;
}
/* Optiuni dropdown <select> pe tema dark (browser ignora color-scheme pe option) */
body[data-theme="immersive"] #mlxChatRoot .mlx-chat-form-field select option,
html[data-theme="immersive"] #mlxChatRoot .mlx-chat-form-field select option {
    background: #1f2937 !important;
    color: #e5e7eb !important;
    border-color: rgba(255,255,255,.10) !important;
    -webkit-text-fill-color: #e5e7eb !important;
}
body[data-theme="immersive"] .mlx-chat-form h3,
html[data-theme="immersive"] .mlx-chat-form h3,
body[data-theme="immersive"] .mlx-chat-form-field label,
html[data-theme="immersive"] .mlx-chat-form-field label {
    color: #e5e7eb !important;
}
body[data-theme="immersive"] .mlx-chat-form p,
html[data-theme="immersive"] .mlx-chat-form p,
body[data-theme="immersive"] .mlx-chat-form-field label small,
html[data-theme="immersive"] .mlx-chat-form-field label small {
    color: #9ca3af !important;
}
body[data-theme="immersive"] .mlx-chat-input,
html[data-theme="immersive"] .mlx-chat-input {
    background: rgba(255,255,255,.06) !important;
    color: #e5e7eb !important;
    border-color: rgba(255,255,255,.10) !important;
    -webkit-text-fill-color: #e5e7eb !important;
}
body[data-theme="immersive"] .mlx-chat-input-row,
html[data-theme="immersive"] .mlx-chat-input-row,
body[data-theme="immersive"] .mlx-chat-footer,
html[data-theme="immersive"] .mlx-chat-footer {
    background: #111827;
    border-color: rgba(255,255,255,.08);
}

/* ─── Immersive-Light theme overrides (acelasi pattern ca immersive, culori ajustate ~15% lighter) ── */
body[data-theme="immersive-light"] .mlx-chat-msg.ai .mlx-chat-msg-bubble,
html[data-theme="immersive-light"] .mlx-chat-msg.ai .mlx-chat-msg-bubble {
    background: rgba(255,255,255,.08);
    color: #f0f4f8;
    border-color: rgba(255,255,255,.16);
}
body[data-theme="immersive-light"] .mlx-chat-msg.system .mlx-chat-msg-bubble,
html[data-theme="immersive-light"] .mlx-chat-msg.system .mlx-chat-msg-bubble {
    background: rgba(255,255,255,.05);
    color: #b6c2d1;
    border-color: rgba(255,255,255,.12);
}
body[data-theme="immersive-light"] .mlx-chat-typing,
html[data-theme="immersive-light"] .mlx-chat-typing {
    background: rgba(255,255,255,.08);
    border-color: rgba(255,255,255,.16);
    color: #f0f4f8;
}
body[data-theme="immersive-light"] #mlxChatRoot .mlx-chat-form-field input,
body[data-theme="immersive-light"] #mlxChatRoot .mlx-chat-form-field select,
body[data-theme="immersive-light"] #mlxChatRoot .mlx-chat-form-field textarea,
html[data-theme="immersive-light"] #mlxChatRoot .mlx-chat-form-field input,
html[data-theme="immersive-light"] #mlxChatRoot .mlx-chat-form-field select,
html[data-theme="immersive-light"] #mlxChatRoot .mlx-chat-form-field textarea {
    background: rgba(255,255,255,.08) !important;
    color: #f0f4f8 !important;
    color-scheme: dark !important;
    -webkit-text-fill-color: #f0f4f8 !important;
}
body[data-theme="immersive-light"] #mlxChatRoot .mlx-chat-form-field select option,
html[data-theme="immersive-light"] #mlxChatRoot .mlx-chat-form-field select option {
    background: #262a35 !important;
    color: #f0f4f8 !important;
    border-color: rgba(255,255,255,.16) !important;
    -webkit-text-fill-color: #f0f4f8 !important;
}
body[data-theme="immersive-light"] .mlx-chat-form h3,
html[data-theme="immersive-light"] .mlx-chat-form h3,
body[data-theme="immersive-light"] .mlx-chat-form-field label,
html[data-theme="immersive-light"] .mlx-chat-form-field label {
    color: #f0f4f8 !important;
}
body[data-theme="immersive-light"] .mlx-chat-form p,
html[data-theme="immersive-light"] .mlx-chat-form p,
body[data-theme="immersive-light"] .mlx-chat-form-field label small,
html[data-theme="immersive-light"] .mlx-chat-form-field label small {
    color: #b6c2d1 !important;
}
body[data-theme="immersive-light"] .mlx-chat-input,
html[data-theme="immersive-light"] .mlx-chat-input {
    background: rgba(255,255,255,.08) !important;
    color: #f0f4f8 !important;
    border-color: rgba(255,255,255,.16) !important;
    -webkit-text-fill-color: #f0f4f8 !important;
}
body[data-theme="immersive-light"] .mlx-chat-input:focus,
html[data-theme="immersive-light"] .mlx-chat-input:focus {
    background: rgba(255,255,255,.12) !important;
}
body[data-theme="immersive-light"] .mlx-chat-input-row,
html[data-theme="immersive-light"] .mlx-chat-input-row,
body[data-theme="immersive-light"] .mlx-chat-footer,
html[data-theme="immersive-light"] .mlx-chat-footer {
    background: #262a35;
    border-color: rgba(255,255,255,.12);
}
body[data-theme="immersive-light"] .mlx-chat-dept-banner,
html[data-theme="immersive-light"] .mlx-chat-dept-banner {
    color: #f0f4f8;
}

/* ─── Editorial dark theme overrides (acelasi pattern ca immersive) ── */
body[data-theme="editorial"] .mlx-chat-msg.ai .mlx-chat-msg-bubble,
html[data-theme="editorial"] .mlx-chat-msg.ai .mlx-chat-msg-bubble {
    background: rgba(255,255,255,.05);
    color: #fafaf7;
    border-color: rgba(255,255,255,.10);
}
body[data-theme="editorial"] .mlx-chat-msg.system .mlx-chat-msg-bubble,
html[data-theme="editorial"] .mlx-chat-msg.system .mlx-chat-msg-bubble {
    background: rgba(255,255,255,.04);
    color: #9ca3af;
    border-color: rgba(255,255,255,.08);
}
body[data-theme="editorial"] .mlx-chat-typing,
html[data-theme="editorial"] .mlx-chat-typing {
    background: rgba(255,255,255,.06);
    border-color: rgba(255,255,255,.10);
    color: #fafaf7;
}
body[data-theme="editorial"] #mlxChatRoot .mlx-chat-form-field input,
body[data-theme="editorial"] #mlxChatRoot .mlx-chat-form-field select,
body[data-theme="editorial"] #mlxChatRoot .mlx-chat-form-field textarea,
html[data-theme="editorial"] #mlxChatRoot .mlx-chat-form-field input,
html[data-theme="editorial"] #mlxChatRoot .mlx-chat-form-field select,
html[data-theme="editorial"] #mlxChatRoot .mlx-chat-form-field textarea {
    background: rgba(255,255,255,.06) !important;
    color: #fafaf7 !important;
    color-scheme: dark !important;  /* forteaza browser sa render-eze autocomplete cu tema dark */
}
body[data-theme="editorial"] #mlxChatRoot .mlx-chat-form-field select option,
html[data-theme="editorial"] #mlxChatRoot .mlx-chat-form-field select option {
    background: #1c1c1a !important;
    color: #fafaf7 !important;
    border-color: rgba(255,255,255,.10) !important;
    -webkit-text-fill-color: #fafaf7 !important;
}
body[data-theme="editorial"] .mlx-chat-form h3,
html[data-theme="editorial"] .mlx-chat-form h3,
body[data-theme="editorial"] .mlx-chat-form-field label,
html[data-theme="editorial"] .mlx-chat-form-field label {
    color: #fafaf7 !important;
}
body[data-theme="editorial"] .mlx-chat-form p,
html[data-theme="editorial"] .mlx-chat-form p,
body[data-theme="editorial"] .mlx-chat-form-field label small,
html[data-theme="editorial"] .mlx-chat-form-field label small {
    color: #9ca3af !important;
}
body[data-theme="editorial"] .mlx-chat-input,
html[data-theme="editorial"] .mlx-chat-input {
    background: rgba(255,255,255,.06) !important;
    color: #fafaf7 !important;
    border-color: rgba(255,255,255,.10) !important;
    -webkit-text-fill-color: #fafaf7 !important;
}
body[data-theme="editorial"] .mlx-chat-input-row,
html[data-theme="editorial"] .mlx-chat-input-row,
body[data-theme="editorial"] .mlx-chat-footer,
html[data-theme="editorial"] .mlx-chat-footer {
    background: #0a0e14;
    border-color: rgba(255,255,255,.08);
}

/* ─── RESET izolare CSS ──────────────────────────── */
#mlxChatRoot,
#mlxChatRoot * {
    box-sizing: border-box;
}
#mlxChatRoot input,
#mlxChatRoot select,
#mlxChatRoot textarea,
#mlxChatRoot button {
    color: #1f2937;
    -webkit-text-fill-color: #1f2937;
    font-family: inherit;
}
#mlxChatRoot input::placeholder,
#mlxChatRoot textarea::placeholder {
    color: #9ca3af !important;
    opacity: 1 !important;
}

/* ─── ICON FLOTANT ────────────────────────── */
.mlx-chat-icon {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: var(--mlx-chat-bubble-size);
    height: var(--mlx-chat-bubble-size);
    border-radius: 50%;
    background: var(--mlx-chat-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--mlx-chat-shadow);
    z-index: var(--mlx-chat-z);
    transition: transform .15s ease, background .15s ease;
    border: none;
    font-family: inherit;
}
.mlx-chat-icon:hover {
    transform: scale(1.05);
    background: var(--mlx-chat-primary-dark);
}
.mlx-chat-icon svg {
    color: white;
}
.mlx-chat-icon-status {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--mlx-chat-success);
    border: 2px solid white;
}
.mlx-chat-icon-status.offline {
    background: var(--mlx-chat-text-muted);
}

/* Tooltip pe hover */
.mlx-chat-tooltip {
    position: absolute;
    right: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--mlx-chat-text);
    color: white;
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.mlx-chat-icon:hover .mlx-chat-tooltip { opacity: 1; }

.mlx-chat-icon.proactive-pulse {
    animation: mlxProactive 1s ease-in-out 3;
}
@keyframes mlxProactive {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); box-shadow: 0 0 30px rgba(21,193,184,.45); }
}

@keyframes mlxSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ─── POPUP ────────────────────────── */
.mlx-chat-popup {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 540px;
    max-height: calc(100vh - 110px);
    background: var(--mlx-chat-bg);
    border-radius: var(--mlx-chat-radius);
    box-shadow: var(--mlx-chat-shadow);
    z-index: var(--mlx-chat-z);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--mlx-chat-text);
    transform-origin: bottom right;
    animation: mlxPopupOpen .25s ease-out;
}
@keyframes mlxPopupOpen {
    from { transform: scale(.85) translateY(20px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

@media (max-width: 640px) {
    .mlx-chat-popup {
        bottom: 0;
        right: 0;
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    .mlx-chat-icon {
        bottom: 16px;
        right: 16px;
    }
}

/* ─── HEADER ────────────────────────── */
.mlx-chat-header {
    background: var(--mlx-chat-primary);
    color: white;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.mlx-chat-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
}
.mlx-chat-header-info {
    flex: 1;
    min-width: 0;
}
.mlx-chat-header-name {
    font-weight: 600;
    font-size: 14px;
    margin: 0;
}
.mlx-chat-header-status {
    font-size: 11px;
    opacity: .85;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}
.mlx-chat-header-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--mlx-chat-success);
    display: inline-block;
}
.mlx-chat-header-status.offline::before {
    background: rgba(255,255,255,.4);
}
.mlx-chat-header-close {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 20px;
    line-height: 1;
    transition: background .1s;
}
.mlx-chat-header-close:hover {
    background: rgba(255,255,255,.15);
}

/* ─── BODY ────────────────────────── */
.mlx-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--mlx-chat-bg-alt);
    display: flex;
    flex-direction: column;
    gap: 8px;
    -webkit-overflow-scrolling: touch;
}

.mlx-chat-msg {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    word-wrap: break-word;
    word-break: break-word;
}
.mlx-chat-msg-bubble {
    padding: 10px 14px;
    border-radius: var(--mlx-chat-radius-bubble);
    font-size: 13.5px;
    line-height: 1.5;
    white-space: pre-wrap;
}
.mlx-chat-msg-bubble .mlx-chat-link {
    color: var(--mlx-chat-primary);
    text-decoration: underline;
    word-break: break-all;
}
.mlx-chat-msg-bubble .mlx-chat-link:hover {
    text-decoration: none;
    opacity: .85;
}
/* PDF-urile primesc un chip mai vizibil */
.mlx-chat-msg-bubble .mlx-chat-link-pdf {
    display: inline-block;
    background: rgba(0,0,0,.05);
    padding: 3px 9px;
    border-radius: 6px;
    margin: 2px 0;
    border: 1px solid rgba(0,0,0,.08);
    text-decoration: none;
}
.mlx-chat-msg-bubble .mlx-chat-link-pdf:hover {
    background: rgba(0,0,0,.08);
    opacity: 1;
}
/* Dark theme variant pentru chip PDF */
body[data-theme="immersive"] .mlx-chat-msg-bubble .mlx-chat-link-pdf,
html[data-theme="immersive"] .mlx-chat-msg-bubble .mlx-chat-link-pdf,
body[data-theme="immersive-light"] .mlx-chat-msg-bubble .mlx-chat-link-pdf,
html[data-theme="immersive-light"] .mlx-chat-msg-bubble .mlx-chat-link-pdf,
body[data-theme="editorial"] .mlx-chat-msg-bubble .mlx-chat-link-pdf,
html[data-theme="editorial"] .mlx-chat-msg-bubble .mlx-chat-link-pdf {
    background: rgba(255,255,255,.08);
    border-color: rgba(255,255,255,.16);
}
body[data-theme="immersive"] .mlx-chat-msg-bubble .mlx-chat-link-pdf:hover,
html[data-theme="immersive"] .mlx-chat-msg-bubble .mlx-chat-link-pdf:hover,
body[data-theme="immersive-light"] .mlx-chat-msg-bubble .mlx-chat-link-pdf:hover,
html[data-theme="immersive-light"] .mlx-chat-msg-bubble .mlx-chat-link-pdf:hover,
body[data-theme="editorial"] .mlx-chat-msg-bubble .mlx-chat-link-pdf:hover,
html[data-theme="editorial"] .mlx-chat-msg-bubble .mlx-chat-link-pdf:hover {
    background: rgba(255,255,255,.14);
}
.mlx-chat-msg-time {
    font-size: 10px;
    color: var(--mlx-chat-text-muted);
    margin-top: 3px;
    padding: 0 4px;
}
.mlx-chat-msg.visitor {
    align-self: flex-end;
    align-items: flex-end;
}
.mlx-chat-msg.visitor .mlx-chat-msg-bubble {
    background: var(--mlx-chat-primary);
    color: white;
    border-bottom-right-radius: 6px;
}
.mlx-chat-msg.ai,
.mlx-chat-msg.system {
    align-self: flex-start;
    align-items: flex-start;
}
.mlx-chat-msg.ai .mlx-chat-msg-bubble {
    background: white;
    color: var(--mlx-chat-text);
    border: 1px solid var(--mlx-chat-border);
    border-bottom-left-radius: 6px;
}
.mlx-chat-msg.system .mlx-chat-msg-bubble {
    background: rgba(0,0,0,.04);
    color: var(--mlx-chat-text);
    border: 1px solid rgba(0,0,0,.06);
    font-size: 12.5px;
    font-style: italic;
}
.mlx-chat-msg.operator .mlx-chat-msg-bubble {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    border-bottom-left-radius: 6px;
}
.mlx-chat-msg-sender {
    font-size: 10px;
    color: var(--mlx-chat-text-muted);
    font-weight: 600;
    margin-bottom: 3px;
    padding: 0 4px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* Typing indicator cu text rotativ */
.mlx-chat-typing {
    align-self: flex-start;
    background: white;
    border: 1px solid var(--mlx-chat-border);
    border-radius: var(--mlx-chat-radius-bubble);
    border-bottom-left-radius: 6px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 85%;
}
.mlx-chat-typing-dots { display: flex; gap: 4px; align-items: center; }
.mlx-chat-typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--mlx-chat-text-muted);
    opacity: .5;
    animation: mlxTyping 1.4s infinite ease-in-out;
}
.mlx-chat-typing-dots span:nth-child(1) { animation-delay: 0s; }
.mlx-chat-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.mlx-chat-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
.mlx-chat-typing-text {
    font-size: 11.5px;
    font-style: italic;
    color: var(--mlx-chat-text-muted);
    letter-spacing: 0.2px;
}
@keyframes mlxTyping {
    0%, 60%, 100% { opacity: .35; transform: scale(0.8); }
    30% { opacity: 1; transform: scale(1); }
}

/* ─── FORM ────────────────────────── */
.mlx-chat-form {
    padding: 16px;
    background: var(--mlx-chat-bg-alt);
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.mlx-chat-form h3 {
    margin: 0 0 4px !important;
    font-size: 16px !important;
    color: #1f2937 !important;
    font-weight: 700 !important;
}
.mlx-chat-form p {
    margin: 0 0 8px !important;
    font-size: 12.5px !important;
    color: #6b7280 !important;
    line-height: 1.5 !important;
}
.mlx-chat-form-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.mlx-chat-form-field label {
    font-size: 11px !important;
    font-weight: 600 !important;
    color: #1f2937 !important;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.mlx-chat-form-field label small {
    font-weight: normal;
    text-transform: none;
    color: #6b7280;
}
.mlx-chat-form-field input,
.mlx-chat-form-field select,
.mlx-chat-form-field textarea {
    width: 100% !important;
    padding: 9px 12px !important;
    color: #1f2937 !important;        /* text dark explicit pentru autocomplete preview */
    color-scheme: light !important;   /* dropdown browser tema light */
    border: 1px solid #e5e7eb !important;
    border-radius: 8px !important;
    background: white !important;
    color: #1f2937 !important;
    font-family: inherit !important;
    font-size: 13px !important;
    box-sizing: border-box !important;
    outline: none !important;
    transition: border-color .15s !important;
    line-height: 1.4 !important;
    -webkit-text-fill-color: #1f2937 !important;
    opacity: 1 !important;
}
.mlx-chat-form-field input:focus,
.mlx-chat-form-field select:focus,
.mlx-chat-form-field textarea:focus {
    border-color: var(--mlx-chat-primary) !important;
}
.mlx-chat-form-field textarea {
    resize: vertical !important;
    min-height: 70px !important;
}

/* ─── INPUT + SEND ────────────────────────── */
.mlx-chat-input-row {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: white;
    border-top: 1px solid var(--mlx-chat-border);
    align-items: flex-end;
}
.mlx-chat-input {
    flex: 1 !important;
    border: 1px solid #e5e7eb !important;
    background: #f9fafb !important;
    border-radius: 20px !important;
    padding: 9px 14px !important;
    font-family: inherit !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    outline: none !important;
    resize: none !important;
    max-height: 90px !important;
    color: #1f2937 !important;
    box-sizing: border-box !important;
    -webkit-text-fill-color: #1f2937 !important;
    opacity: 1 !important;
}
.mlx-chat-input:focus {
    border-color: var(--mlx-chat-primary) !important;
    background: white !important;
}
.mlx-chat-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--mlx-chat-primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .1s;
    flex-shrink: 0;
}
.mlx-chat-send:hover:not(:disabled) {
    background: var(--mlx-chat-primary-dark);
}
.mlx-chat-send:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* ─── GDPR consent checkbox ──────────── */
.mlx-gdpr-field { margin-top: 4px !important; }
.mlx-gdpr-label {
    display: flex !important;
    align-items: flex-start;
    gap: 8px;
    font-size: 11.5px !important;
    line-height: 1.5 !important;
    color: var(--mlx-chat-text-muted) !important;
    cursor: pointer;
    font-weight: normal !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
}
.mlx-gdpr-label input[type="checkbox"] {
    flex-shrink: 0;
    margin-top: 2px;
    width: 14px !important;
    height: 14px !important;
    padding: 0 !important;
}
.mlx-gdpr-label a { color: var(--mlx-chat-primary); text-decoration: underline; }

/* ─── DEPT BANNER (info contextual) ──── */
.mlx-chat-dept-banner {
    padding: 8px 14px;
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.1) 0%, rgba(245, 158, 11, 0.05) 100%);
    border-bottom: 1px solid rgba(245, 158, 11, 0.3);
    font-size: 11px;
    line-height: 1.4;
    color: var(--mlx-chat-text);
}
.mlx-chat-dept-banner strong { color: #92400e; }
.mlx-chat-dept-banner span { font-weight: 700; letter-spacing: 0.5px; }

/* ─── ATTACHMENT ──────────────────────── */
.mlx-chat-attach {
    background: transparent;
    border: none;
    color: var(--mlx-chat-text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color .1s, transform .05s;
    border-radius: 8px;
}
.mlx-chat-attach:hover {
    color: var(--mlx-chat-primary);
    background: var(--mlx-chat-bg-alt);
}
.mlx-chat-attach:active {
    transform: scale(.95);
}
.mlx-chat-attachment {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    padding: 4px 0;
}
.mlx-chat-attachment:hover { opacity: .85; }
.mlx-att-icon { font-size: 24px; flex-shrink: 0; }
.mlx-att-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mlx-att-info strong { word-break: break-all; font-size: 13px; }
.mlx-att-meta { font-size: 11px; opacity: 0.75; }

/* ─── BUTOANE ────────────────────────── */
.mlx-chat-btn {
    padding: 10px 16px;
    border-radius: 8px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background .1s, transform .05s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.mlx-chat-btn-primary {
    background: var(--mlx-chat-primary);
    color: white;
}
.mlx-chat-btn-primary:hover { background: var(--mlx-chat-primary-dark); }
.mlx-chat-btn-primary:active { transform: scale(.98); }
.mlx-chat-btn-primary:disabled { opacity: .7; cursor: wait; }

/* ─── FOOTER ────────────────────────── */
.mlx-chat-footer {
    padding: 6px 12px;
    background: white;
    border-top: 1px solid var(--mlx-chat-border);
    text-align: center;
    font-size: 10px;
    color: var(--mlx-chat-text-muted);
}
.mlx-chat-footer a {
    color: inherit;
    text-decoration: none;
}
.mlx-chat-footer a:hover {
    color: var(--mlx-chat-primary);
}

/* ─── ERRORS ────────────────────────── */
.mlx-chat-error {
    background: #fee2e2;
    color: #991b1b;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    margin: 8px 0;
    text-align: center;
}

.mlx-chat-hidden { display: none !important; }

/* ─── HANDOVER CONTACT CAPTURE CARD ────────────────────────── */
.mlx-chat-handover-card {
    align-self: stretch;
    background: var(--mlx-chat-bg-alt);
    border: 1px solid var(--mlx-chat-primary);
    border-radius: var(--mlx-chat-radius-bubble);
    padding: 14px 16px;
    margin: 10px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.mlx-chat-handover-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--mlx-chat-primary);
}
.mlx-chat-handover-text {
    font-size: 12.5px;
    color: var(--mlx-chat-text);
    margin: 0;
    line-height: 1.5;
}
.mlx-chat-handover-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.mlx-chat-handover-field label {
    font-size: 11px;
    font-weight: 500;
    color: var(--mlx-chat-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.mlx-chat-handover-field label small {
    text-transform: none;
    font-weight: 400;
    letter-spacing: 0;
    color: var(--mlx-chat-text-muted);
    opacity: 0.7;
}
.mlx-chat-handover-field input {
    padding: 8px 10px;
    border: 1px solid var(--mlx-chat-border);
    border-radius: 8px;
    background: var(--mlx-chat-bg);
    color: var(--mlx-chat-text);
    font-size: 13px;
    font-family: inherit;
    outline: none;
}
.mlx-chat-handover-field input:focus {
    border-color: var(--mlx-chat-primary);
    box-shadow: 0 0 0 2px rgba(21, 193, 184, 0.12);
}
.mlx-chat-handover-card .mlx-chat-btn-primary {
    margin-top: 4px;
}

/* Dark theme overrides for handover card */
body[data-theme="immersive"] .mlx-chat-handover-card,
html[data-theme="immersive"] .mlx-chat-handover-card,
body[data-theme="editorial"] .mlx-chat-handover-card,
html[data-theme="editorial"] .mlx-chat-handover-card {
    background: rgba(255,255,255,.04);
    border-color: rgba(255,255,255,.20);
}
body[data-theme="immersive"] .mlx-chat-handover-card input,
html[data-theme="immersive"] .mlx-chat-handover-card input,
body[data-theme="editorial"] .mlx-chat-handover-card input,
html[data-theme="editorial"] .mlx-chat-handover-card input {
    background: rgba(255,255,255,.06) !important;
    color: #e5e7eb !important;
    border-color: rgba(255,255,255,.12) !important;
    -webkit-text-fill-color: #e5e7eb !important;
}
