:root {
    --ae-chat-radius: 20px;
    --ae-chat-primary: #0E3950;
    --ae-chat-primary-gradient: linear-gradient(135deg, #0E3950 0%, #164E63 100%);
    --ae-chat-accent: #ECAD20;
    --ae-chat-cyan: #06B6D4;
    --ae-chat-cyan-light: #38BDF8;
    --ae-chat-surface: #FFFFFF;
    --ae-chat-bg-messages: #F8FAFC;
    --ae-chat-border: #E2E8F0;
    --ae-chat-shadow-panel: 0 20px 60px -15px rgba(14, 57, 80, 0.28), 0 10px 25px -5px rgba(0, 0, 0, 0.08);
    --ae-chat-shadow-bubble: 0 4px 14px rgba(14, 57, 80, 0.16);
    --ae-chat-shadow-toggle: 0 10px 28px rgba(14, 57, 80, 0.35);

    /* Soporte Portal Moderno */
    --ae-status-abierto-bg: #fee2e2;
    --ae-status-abierto-text: #b91c1c;
    --ae-status-en-proceso-bg: #e0f2fe;
    --ae-status-en-proceso-text: #0369a1;
    --ae-status-esperando-bg: #fef3c7;
    --ae-status-esperando-text: #b45309;
    --ae-status-resuelto-bg: #dcfce7;
    --ae-status-resuelto-text: #15803d;
    --ae-status-cerrado-bg: #f1f5f9;
    --ae-status-cerrado-text: #475569;
}

.ae-chat-widget {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    z-index: 999990;
    -webkit-font-smoothing: antialiased;
    box-sizing: border-box;
}

.ae-chat-widget *,
.ae-chat-widget *::before,
.ae-chat-widget *::after {
    box-sizing: border-box;
}

/* ── MODO WIDGET FLOTANTE (Cotizaciones, etc.) ────────────────────── */
.ae-chat-widget.ae-chat-mode-widget {
    position: fixed !important;
    z-index: 999990 !important;
    display: flex !important;
    flex-direction: column !important;
    pointer-events: none !important;
    width: auto !important;
    height: auto !important;
}

.ae-chat-widget.ae-chat-mode-widget.ae-chat-bottom-right {
    bottom: 24px !important;
    right: 24px !important;
    left: auto !important;
    top: auto !important;
    align-items: flex-end !important;
}

.ae-chat-widget.ae-chat-mode-widget.ae-chat-bottom-left {
    bottom: 24px !important;
    left: 24px !important;
    right: auto !important;
    top: auto !important;
    align-items: flex-start !important;
}

.ae-chat-widget.ae-chat-mode-widget > * {
    pointer-events: auto !important;
}

/* El botón circular launcher queda abajo */
.ae-chat-widget.ae-chat-mode-widget .ae-chat-toggle {
    order: 2 !important;
    margin-top: 14px !important;
    flex-shrink: 0 !important;
}

/* El panel del chat flota arriba del botón */
.ae-chat-widget.ae-chat-mode-widget .ae-chat-panel {
    order: 1 !important;
    width: 390px !important;
    max-width: calc(100vw - 32px) !important;
    height: 570px !important;
    max-height: calc(100vh - 120px) !important;
    background: #FFFFFF !important;
    border: 1px solid rgba(226, 232, 240, 0.95) !important;
    border-radius: var(--ae-chat-radius, 20px) !important;
    box-shadow: var(--ae-chat-shadow-panel) !important;
    flex-direction: column !important;
    overflow: hidden !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    position: relative !important;
    margin: 0 !important;
}

.ae-chat-widget.ae-chat-mode-widget:not(.ae-is-open) .ae-chat-panel {
    display: none;
}

.ae-chat-widget.ae-chat-mode-widget.ae-is-open .ae-chat-panel {
    display: flex !important;
}

/* ── MODO INLINE (Panel de Clientes) ────────────────────────────────── */
.ae-chat-mode-inline {
    width: 100%;
    max-width: 100% !important;
    margin: 0 auto;
    position: relative;
    background: #ffffff;
    border-radius: var(--ae-chat-radius);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    border: 1px solid var(--ae-chat-border);
}

.ae-chat-mode-inline .ae-chat-panel {
    width: 100% !important;
    max-height: 600px !important;
    border: none !important;
    box-shadow: none !important;
    background: #FFFFFF !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Minimal state styling - Ultra clean */
.ae-chat-widget.ae-chat--minimal.ae-chat-mode-inline {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    margin: 20px 0 !important;
}

.ae-chat--minimal.ae-chat-mode-inline .ae-chat-header,
.ae-chat--minimal.ae-chat-mode-inline .ae-chat-messages {
    display: none !important;
}

.ae-chat--minimal.ae-chat-mode-inline .ae-chat-panel {
    min-height: auto !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 0 !important;
}

.ae-chat--minimal.ae-chat-mode-inline .ae-chat-input-area {
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
}

.ae-chat--minimal.ae-chat-mode-inline .ae-chat-input-wrapper {
    background: #FFFFFF !important;
    border: 2px solid #E2E8F0 !important;
    border-radius: 50px !important;
    padding: 8px 12px 8px 22px !important;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    box-shadow: 0 8px 25px rgba(14, 57, 80, 0.06) !important;
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
}

.ae-chat--minimal.ae-chat-mode-inline .ae-chat-input-wrapper:focus-within {
    border-color: var(--ae-chat-primary) !important;
    box-shadow: 0 10px 30px rgba(14, 57, 80, 0.12), 0 0 0 3px rgba(14, 57, 80, 0.08) !important;
}

/* ==========================================================
   PANEL BASE ESTILO MODERN AI COPILOT
========================================================== */
.ae-chat-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Header Modern Copilot */
.ae-chat-header {
    background: var(--ae-chat-primary-gradient) !important;
    color: #FFFFFF !important;
    padding: 13px 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 4px 16px rgba(14, 57, 80, 0.18) !important;
    z-index: 10 !important;
    position: relative !important;
    width: 100% !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
}

.ae-chat-header-info {
    display: flex !important;
    align-items: center !important;
    gap: 11px !important;
    min-width: 0 !important;
    overflow: hidden !important;
}

/* Avatar Animado con Aura y Radar Ping */
.ae-chat-avatar {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ae-avatar-aura {
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ae-chat-cyan), var(--ae-chat-accent), var(--ae-chat-primary));
    opacity: 0.85;
    filter: blur(3px);
    animation: aeAuraSpin 6s linear infinite;
    z-index: 0;
}

@keyframes aeAuraSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.ae-avatar-svg-container {
    position: relative;
    z-index: 1;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #0E3950;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) inset;
}

.ae-online-badge {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 12px;
    height: 12px;
    background: #10B981;
    border: 2px solid #0E3950;
    border-radius: 50%;
    z-index: 2;
}

.ae-online-badge .ae-ping {
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 1.5px solid #10B981;
    animation: aePingRadar 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes aePingRadar {
    0% {
        transform: scale(0.9);
        opacity: 0.9;
    }
    70%, 100% {
        transform: scale(2.4);
        opacity: 0;
    }
}

.ae-chat-header-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ae-chat-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ae-chat-header-title {
    font-weight: 700 !important;
    font-size: 15px !important;
    color: #FFFFFF !important;
    letter-spacing: 0.3px;
    line-height: 1.2;
}

.ae-chat-badge-copilot {
    background: rgba(236, 173, 32, 0.18);
    border: 1px solid #ECAD20;
    color: #ECAD20;
    font-size: 9.5px;
    font-weight: 800;
    padding: 1px 7px;
    border-radius: 20px;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}

.ae-chat-header-status {
    font-size: 11.5px !important;
    color: rgba(255, 255, 255, 0.82) !important;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ae-status-dot-mini {
    width: 6px;
    height: 6px;
    background: #10B981;
    border-radius: 50%;
    box-shadow: 0 0 6px #10B981;
}

.ae-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ae-chat-header-action {
    background: rgba(255, 255, 255, 0.12) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #FFFFFF !important;
    cursor: pointer;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 0;
}

.ae-chat-header-action:hover {
    background: rgba(255, 255, 255, 0.25) !important;
    transform: scale(1.08);
}

.ae-chat-close:hover {
    transform: rotate(90deg) scale(1.08);
}

/* ==========================================================
   WELCOME SECTION & MINIMAL STATE
========================================================== */
.ae-chat-welcome-container {
    padding: 28px 24px 20px;
    text-align: center;
    background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
    border-bottom: 1px solid #F1F5F9;
}

.ae-chat-widget:not(.ae-chat--minimal) .ae-chat-welcome-container {
    display: none;
}

.ae-chat-welcome-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(14, 57, 80, 0.05);
    border: 1px solid rgba(14, 57, 80, 0.1);
    color: #0E3950;
    font-size: 11.5px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 12px;
}

.ae-chat-welcome-badge .ae-spark-mini {
    color: #ECAD20;
}

.ae-chat-welcome-title {
    margin: 0;
    font-size: 26px;
    font-weight: 400;
    color: #0E3950;
    line-height: 1.3;
}

.ae-sofia-name {
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #0E3950;
}

.ae-ia-highlight {
    color: var(--ae-chat-accent, #ECAD20);
    text-shadow: 0 0 12px rgba(236, 173, 32, 0.3);
}

.ae-chat-welcome-subtitle {
    margin: 10px auto 0;
    font-size: 14.5px;
    color: #64748B;
    line-height: 1.5;
    max-width: 480px;
}

/* ==========================================================
   MESSAGES CONTAINER & BUBBLES
========================================================== */
.ae-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: #F8FAFC;
    scroll-behavior: smooth;
    min-height: 300px;
}

/* Custom modern scrollbar */
.ae-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.ae-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.ae-chat-messages::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 10px;
}

.ae-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

.ae-chat-message {
    max-width: 86%;
    display: flex;
    flex-direction: column;
    position: relative;
    animation: aeMessageIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes aeMessageIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ae-chat-bot {
    align-self: flex-start;
}

.ae-chat-user {
    align-self: flex-end;
}

.ae-chat-role-label {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: #0E3950;
}

.ae-chat-user .ae-chat-role-label {
    justify-content: flex-end;
    color: #64748B !important;
}

.ae-mini-bot-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: #0E3950;
    border-radius: 50%;
    border: 1px solid rgba(6, 182, 212, 0.4);
    box-shadow: 0 0 6px rgba(6, 182, 212, 0.25);
    flex-shrink: 0;
}

.ae-mini-bot-icon svg {
    display: block;
}

.ae-chat-bubble {
    padding: 12px 16px;
    font-size: 13.8px;
    line-height: 1.62;
    position: relative;
    transition: all 0.2s ease;
    word-break: break-word;
}

.ae-chat-bot .ae-chat-bubble {
    background: #FFFFFF;
    color: #1E293B;
    border: 1px solid #E2E8F0;
    border-radius: 18px 18px 18px 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

#ae-chat-widget .ae-chat-user .ae-chat-bubble {
    background: var(--ae-chat-primary-gradient) !important;
    color: #FFFFFF !important;
    border-radius: 18px 18px 4px 18px;
    box-shadow: var(--ae-chat-shadow-bubble);
    border: none;
}

#ae-chat-widget .ae-chat-user .ae-chat-bubble strong {
    color: #FFFFFF;
}

/* Suggestions Cards */
.ae-chat-suggestions {
    display: flex !important;
    flex-direction: column !important;
    gap: 7px !important;
    margin-top: 10px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.ae-chat-suggestion {
    background: #FFFFFF !important;
    border: 1.5px solid #E2E8F0 !important;
    color: #0E3950 !important;
    padding: 9px 13px !important;
    border-radius: 12px !important;
    font-size: 12.5px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03) !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    text-align: left !important;
    white-space: normal !important;
    line-height: 1.35 !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.ae-chat-suggestion:hover {
    border-color: #0E3950 !important;
    background: #F1F5F9 !important;
    transform: translateY(-1.5px) !important;
    box-shadow: 0 4px 12px rgba(14, 57, 80, 0.12) !important;
    color: #0E3950 !important;
}

.ae-chat-suggestion .ae-spark-mini {
    color: #ECAD20 !important;
    font-size: 11px !important;
    flex-shrink: 0 !important;
}

/* ==========================================================
   INPUT AREA CON DOCK PREMIUM
========================================================== */
.ae-chat-input-area {
    padding: 12px 16px 14px;
    background: #FFFFFF;
    border-top: 1px solid #F1F5F9;
}

.ae-chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #F8FAFC;
    border-radius: 28px;
    padding: 6px 8px 6px 14px;
    border: 1.5px solid #E2E8F0;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.ae-chat-input-wrapper:hover {
    border-color: #CBD5E1;
    background: #FFFFFF;
}

#ae-chat-widget .ae-chat-input-wrapper:focus-within {
    background: #FFFFFF;
    border-color: #0E3950;
    box-shadow: 0 0 0 3px rgba(14, 57, 80, 0.08), 0 6px 16px rgba(0, 0, 0, 0.04);
}

#ae-chat-widget .ae-chat-file-trigger {
    background: transparent;
    border: none;
    color: #64748B;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding: 0;
}

#ae-chat-widget .ae-chat-file-trigger:hover {
    color: #0E3950;
    background: #E2E8F0;
    transform: scale(1.05);
}

.ae-chat-input {
    flex: 1;
    background: transparent;
    border: none !important;
    outline: none !important;
    resize: none !important;
    padding: 6px 0 !important;
    font-size: 14px !important;
    color: #1E293B !important;
    line-height: 1.5 !important;
    max-height: 120px;
    font-family: inherit;
}

.ae-chat-input::placeholder {
    color: #94A3B8;
}

#ae-chat-widget .ae-chat-send {
    background: var(--ae-chat-primary-gradient) !important;
    color: #FFFFFF !important;
    border: none !important;
    width: 38px;
    height: 38px;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 12px rgba(14, 57, 80, 0.25) !important;
    flex-shrink: 0;
    padding: 0;
}

.ae-chat-send svg {
    color: #FFFFFF;
    transition: transform 0.2s ease;
}

.ae-chat-send:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: #94A3B8 !important;
    box-shadow: none !important;
}

.ae-chat-send:not(:disabled):hover {
    transform: scale(1.08) translateY(-1px);
    box-shadow: 0 6px 18px rgba(14, 57, 80, 0.35) !important;
}

.ae-chat-footer-note {
    font-size: 10.5px;
    color: #94A3B8;
    text-align: center;
    margin-top: 8px;
    letter-spacing: 0.4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.ae-footer-sparkle {
    color: #ECAD20;
    font-size: 11px;
}

/* ==========================================================
   FLOATING LAUNCHER TOGGLE BUTTON
========================================================== */
.ae-chat-toggle {
    width: 58px;
    height: 58px;
    background: var(--ae-chat-primary-gradient) !important;
    border-radius: 50%;
    box-shadow: var(--ae-chat-shadow-toggle), 0 0 0 1px rgba(255, 255, 255, 0.15) inset;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF !important;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 999;
    position: relative;
}

.ae-chat-toggle-pulse {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(6, 182, 212, 0.6);
    animation: aeToggleRadar 2.5s cubic-bezier(0.16, 1, 0.3, 1) infinite;
    pointer-events: none;
}

@keyframes aeToggleRadar {
    0% {
        transform: scale(0.95);
        opacity: 0.8;
    }
    70%, 100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

.ae-chat-toggle:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 14px 32px rgba(14, 57, 80, 0.45);
}

.ae-chat-icon-open,
.ae-chat-icon-close {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Floating Tooltip Pill beside the launcher */
.ae-chat-toggle-tooltip {
    position: absolute;
    right: 70px;
    background: #0E3950;
    color: #FFFFFF;
    font-size: 12.5px;
    padding: 7px 14px;
    border-radius: 30px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.15);
    white-space: nowrap;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 6px;
    animation: aeTooltipFloat 3s ease-in-out infinite;
    transition: opacity 0.3s ease;
}

.ae-chat-bottom-left .ae-chat-toggle-tooltip {
    right: auto;
    left: 70px;
}

.ae-tooltip-spark {
    color: #ECAD20;
    font-size: 13px;
}

@keyframes aeTooltipFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}

@media (max-width: 600px) {
    .ae-chat-toggle-tooltip {
        display: none !important;
    }
    .ae-chat-widget.ae-chat-mode-widget {
        bottom: 16px !important;
        right: 16px !important;
        left: auto !important;
    }
    .ae-chat-widget.ae-chat-mode-widget .ae-chat-panel {
        position: fixed !important;
        inset: 16px 16px 86px 16px !important;
        width: auto !important;
        max-width: none !important;
        height: auto !important;
        max-height: none !important;
        border-radius: 20px !important;
    }
}

/* ==========================================================
   TYPING ANIMATION
========================================================== */
#ae-chat-typing .typing-dots {
    display: flex;
    gap: 5px;
    padding: 10px 14px !important;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: #06B6D4;
    border-radius: 50%;
    animation: aeTyping 1.4s infinite both;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
    background: #0E3950;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
    background: #ECAD20;
}

@keyframes aeTyping {
    0%, 80%, 100% {
        transform: scale(0.4);
        opacity: 0.3;
    }
    40% {
        transform: scale(1.15);
        opacity: 1;
    }
}

/* Mini Formulario de Tickets */
.ae-chat-bubble--form {
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid var(--ae-border);
    padding: 20px !important;
    max-width: 320px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    color: var(--ae-text-dark) !important;
    border-radius: 15px !important;
    margin-top: 10px;
}

/* Premium Generation Card */
.ae-generation-card-premium {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 20px !important;
    padding: 0 !important;
    overflow: hidden;
    width: 100% !important;
    max-width: 100% !important;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1) !important;
    margin: 10px 0;
}

.ae-gen-card-header {
    background: linear-gradient(135deg, #0E3950 0%, #1a5c80 100%);
    color: #fff;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ae-gen-card-header h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.ae-gen-card-form {
    padding: 20px;
}

.ae-gen-field {
    margin-bottom: 15px;
}

.ae-gen-field label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 6px;
}

.ae-gen-field select,
.ae-gen-field textarea {
    width: 100% !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 12px !important;
    padding: 10px 12px !important;
    font-size: 14px !important;
    background: #f8fafc !important;
    transition: border-color 0.2s;
}

.ae-gen-field textarea {
    height: 100px;
    resize: none;
}

.ae-gen-field select:focus,
.ae-gen-field textarea:focus {
    border-color: #0E3950 !important;
    outline: none !important;
    background: #fff !important;
}

.ae-gen-submit {
    width: 100%;
    padding: 14px !important;
    font-size: 14px !important;
    border-radius: 12px !important;
    margin-top: 5px;
}

.ae-chat-form-fields {
    margin-bottom: 15px;
}

.ae-field {
    margin-bottom: 12px;
}

.ae-field label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--ae-text-light);
}

.ae-field input,
.ae-field select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--ae-border);
    border-radius: 8px;
    font-size: 13px;
    background: #f8fafc;
}

.ae-form-desc {
    font-size: 11px;
    color: var(--ae-text-light);
    font-style: italic;
    margin: 10px 0;
}

.ae-btn-confirm-ticket {
    width: 100%;
    background: var(--ae-primary) !important;
    color: #fff !important;
    border: none !important;
    padding: 12px !important;
    border-radius: 10px !important;
    font-weight: 600 !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.ae-btn-confirm-ticket:hover {
    background: var(--ae-primary-dark) !important;
    transform: translateY(-2px);
}

.ae-chat-bubble--success {
    background: #ecfdf5 !important;
    border: 1px solid #10b981 !important;
    color: #065f46 !important;
    text-align: center;
    padding: 15px !important;
    border-radius: 15px !important;
}

/* Support Portal Redesign */
.ae-support-layout {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--ae-text-dark);
}

.ae-fade-up {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.ae-fade-up.ae-is-visible {
    opacity: 1;
    transform: translateY(0);
}

.ae-glass-panel {
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.ae-ticket-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08) !important;
    border-color: var(--ae-primary) !important;
}

/* Botones Premium Refinados */
.ae-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    text-decoration: none !important;
}

.ae-btn--primary {
    background: linear-gradient(135deg, var(--ae-primary) 0%, #1a5c80 100%);
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(14, 57, 80, 0.12);
}

.ae-btn--primary:hover {
    box-shadow: 0 8px 20px rgba(14, 57, 80, 0.2);
    transform: translateY(-2px);
}

.ae-btn--secondary {
    background: #f8fafc;
    color: #64748b !important;
    border: 1px solid #e2e8f0;
}

.ae-btn--secondary:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: var(--ae-primary) !important;
}

.ae-btn--sm {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 10px;
}

.ae-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* Support Portal Modern Overhaul */
.ae-support-layout {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: #1e293b;
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px;
}

.ae-ticket-card-modern:hover {
    transform: translateY(-8px) scale(1.01);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08) !important;
    border-color: #cbd5e1 !important;
}

/* Modern Badges */
.ae-modern-badge {
    display: inline-block;
}

.ae-modern-badge--abierto {
    background: var(--ae-status-abierto-bg);
    color: var(--ae-status-abierto-text);
}

.ae-modern-badge--en_proceso {
    background: var(--ae-status-en-proceso-bg);
    color: var(--ae-status-en-proceso-text);
}

.ae-modern-badge--esperando {
    background: var(--ae-status-esperando-bg);
    color: var(--ae-status-esperando-text);
}

.ae-modern-badge--resuelto {
    background: var(--ae-status-resuelto-bg);
    color: var(--ae-status-resuelto-text);
}

.ae-modern-badge--cerrado {
    background: var(--ae-status-cerrado-bg);
    color: var(--ae-status-cerrado-text);
}

/* Custom Scrollbar for modern look */
.ae-support-layout ::-webkit-scrollbar {
    width: 6px;
}

.ae-support-layout ::-webkit-scrollbar-track {
    background: transparent;
}

.ae-support-layout ::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 10px;
}

.ae-support-layout ::-webkit-scrollbar-thumb:hover {
    background: #cbd5e1;
}

/* Responsive Grid Fix */
@media (max-width: 1024px) {
    .ae-ticket-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
    }
}

@media (max-width: 768px) {
    .ae-support-toolbar-modern {
        padding: 16px !important;
    }

    .ae-toolbar-title-box {
        text-align: center;
        width: 100%;
    }

    .ae-toolbar-actions {
        flex-direction: column;
        width: 100%;
    }

    .ae-toolbar-actions form {
        width: 100%;
        max-width: 100% !important;
    }
}

/* Chat Bubbles within Support */
.ae-msg-bubble {
    position: relative;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    word-break: break-word;
}

.ae-msg--client .ae-msg-bubble::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: -8px;
    width: 20px;
    height: 20px;
    background: #0E3950;
    clip-path: polygon(0 0, 0% 100%, 100% 100%);
    z-index: -1;
}

.ae-msg--admin .ae-msg-bubble::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -8px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-left: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    clip-path: polygon(100% 0, 0 100%, 100% 100%);
    z-index: -1;
}

/* Attachment Styles */
.ae-attachment-zone:hover {
    border-color: var(--ae-primary) !important;
    background: rgba(14, 57, 80, 0.04) !important;
}

.ae-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-top: 5px;
    font-size: 12px;
    color: var(--ae-text-dark);
}

.ae-file-remove {
    cursor: pointer;
    color: #ef4444;
    transition: transform 0.2s ease;
}

.ae-file-remove:hover {
    transform: scale(1.2);
}

/* responsive */
@media (max-width: 768px) {
    .ae-ticket-grid {
        grid-template-columns: 1fr !important;
    }

    .ae-msg-bubble {
        max-width: 95% !important;
    }
}

/* Pending File Tag */
.ae-chat-pending-tag {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(14, 57, 80, 0.1);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(14, 57, 80, 0.2);
    padding: 6px 12px;
    border-radius: 10px;
    margin: 0 15px 10px;
    font-size: 13px;
    color: #0E3950;
    animation: ae-slide-up 0.3s ease-out;
}

.ae-chat-pending-tag .ae-file-name {
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}

.ae-chat-pending-tag .ae-remove-file {
    cursor: pointer;
    color: #ef4444;
    font-size: 18px;
    transition: transform 0.2s;
}

.ae-chat-pending-tag .ae-remove-file:hover {
    transform: scale(1.2);
}

@keyframes ae-slide-up {
    from {
        transform: translateY(10px);
        opacity: 0;
    }

}


/* Premium Generation Form Upload */
.ae-gen-upload-container {
    margin-bottom: 20px;
}

.ae-gen-upload-area {
    border: 2px dashed rgba(14, 57, 80, 0.15);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: rgba(248, 250, 252, 0.6);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(4px);
}

.ae-gen-upload-area:hover {
    background: rgba(14, 57, 80, 0.03);
    border-color: #0E3950;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(14, 57, 80, 0.05);
}

.ae-gen-upload-area .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
    color: #0E3950;
    margin-bottom: 10px;
    display: block !important;
    margin-left: auto;
    margin-right: auto;
    opacity: 0.8;
}

.ae-gen-upload-area .ae-upload-text {
    font-size: 14px;
    color: #0E3950;
    font-weight: 700;
    display: block;
    margin-bottom: 4px;
}

.ae-gen-upload-area .ae-upload-subtext {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}

.ae-gen-file-preview {
    background: #f0f9ff;
    padding: 12px 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid #bae6fd;
    margin-bottom: 10px;
}

.ae-gen-file-preview .ae-file-name {
    font-size: 13px;
    color: #0369a1;
    font-weight: 600;
}

.ae-remove-gen-file {
    cursor: pointer;
    color: #ef4444;
    font-size: 18px;
}

/* OCR Styles */
.ae-chat-pending-tag.ae-is-reading {
    background: #f0f9ff;
    border-color: #7dd3fc;
    color: #0369a1;
}

.ae-ocr-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(3, 105, 161, 0.2);
    border-top-color: #0369a1;
    border-radius: 50%;
    display: inline-block;
    animation: ae-spin 0.8s linear infinite;
    margin-right: 8px;
}

.ae-ocr-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    margin-left: 8px;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

@keyframes ae-spin {
    to {
        transform: rotate(360deg);
    }
}

/* SOFIA Typing Animation */
.ae-typing-text {
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid var(--ae-chat-accent, #ECAD20);
    animation:
        ae-typing 15s infinite,
        ae-blink-caret 0.75s step-end infinite;
    max-width: 0;
    vertical-align: bottom;
}

@keyframes ae-typing {
    0% {
        max-width: 0;
        animation-timing-function: steps(30, end);
    }

    10%,
    90% {
        max-width: 300px;
        animation-timing-function: steps(30, end);
    }

    100% {
        max-width: 0;
    }
}

@keyframes ae-blink-caret {

    from,
    to {
        border-color: transparent
    }

    50% {
        border-color: var(--ae-chat-accent, #ECAD20);
    }
}

.ae-chat-welcome-subtitle {
    opacity: 0;
    animation: ae-fadeInFadeOut 15s infinite;
}

@keyframes ae-fadeInFadeOut {

    0%,
    12% {
        opacity: 0;
    }

    15%,
    85% {
        opacity: 1;
    }

    90%,
    100% {
        opacity: 0;
    }
}

.ae-chat-welcome-title {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Action Buttons in Chat (Elegant Links) */
.ae-chat-bubble .ae-chat-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 8px 0 4px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #0E3950 0%, #1a5c80 100%);
    color: #ffffff !important;
    text-decoration: none !important;
    border-radius: 50px;
    font-size: 11.5px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(14, 57, 80, 0.15);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: auto;
}

.ae-chat-bubble .ae-chat-action-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(14, 57, 80, 0.3);
    background: linear-gradient(135deg, #1a5c80 0%, #2476a1 100%);
    color: #ffffff !important;
}

.ae-chat-bubble .ae-chat-action-btn:active {
    transform: scale(0.98);
}

.ae-chat-bubble .ae-chat-action-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}