#vema-widget-root {
    --vema-accent: #1E88E5;
    --vema-accent-dark: #1565C0;
    --vema-accent-soft: #E3F2FD;
    --vema-accent-shadow: rgba(30, 136, 229, 0.34);
    --vema-accent-glow: rgba(30, 136, 229, 0.2);
    --vema-accent-ring: rgba(30, 136, 229, 0.16);
    --vema-bg: #ffffff;
    --vema-text: #1f2937;
    --vema-bot-bg: rgba(238, 243, 248, 0.72);
    --vema-border: rgba(15, 23, 42, 0.08);
    font-family: 'Roboto Condensed', 'Segoe UI', system-ui, -apple-system, sans-serif;
    position: fixed;
    right: 0;
    bottom: 0;
    width: 0;
    height: 0;
    overflow: visible;
    z-index: 2147483647;
    pointer-events: none;
}

#vema-launcher-dock,
#vema-launcher-restore,
#vema-chat-box,
#vema-chat-box * {
    pointer-events: auto;
}

#vema-launcher-dock {
    position: fixed;
    bottom: 22px;
    right: 22px;
    z-index: 2147483647;
    display: inline-flex;
    align-items: stretch;
    border-radius: 999px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--vema-accent) 0%, var(--vema-accent-dark) 100%);
    border: 1px solid rgba(255, 255, 255, 0.28);
    box-shadow:
        0 10px 28px var(--vema-accent-shadow),
        0 2px 8px rgba(15, 23, 42, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.22);
    transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.24s ease;
}

#vema-launcher-dock:hover {
    transform: translateY(-3px);
    box-shadow:
        0 16px 34px var(--vema-accent-shadow),
        0 4px 12px rgba(15, 23, 42, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

#vema-widget-root.vema-launcher-hidden #vema-launcher-dock {
    opacity: 0;
    transform: translateX(calc(100% + 28px));
    pointer-events: none;
}

#vema-launcher-hide {
    flex: 0 0 auto;
    width: 38px;
    min-height: 54px;
    border: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(15, 23, 42, 0.18);
    color: #fff;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

#vema-launcher-hide:hover,
#vema-launcher-hide:focus-visible {
    background: rgba(15, 23, 42, 0.34);
    outline: none;
}

.vema-hide-icon {
    font-size: 22px;
    line-height: 1;
    font-weight: 400;
    display: block;
    margin-top: -2px;
}

#vema-launcher-restore {
    position: fixed;
    right: 0;
    bottom: 96px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px 10px 8px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-right: none;
    border-radius: 999px 0 0 999px;
    background: linear-gradient(135deg, var(--vema-accent) 0%, var(--vema-accent-dark) 100%);
    color: #fff;
    cursor: pointer;
    z-index: 2147483647;
    box-shadow:
        -4px 8px 22px var(--vema-accent-shadow),
        0 2px 8px rgba(15, 23, 42, 0.12);
    transform: translateX(110%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease, visibility 0.3s ease, box-shadow 0.2s ease;
}

#vema-widget-root.vema-launcher-hidden #vema-launcher-restore {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

#vema-launcher-restore:hover {
    box-shadow:
        -6px 12px 26px var(--vema-accent-shadow),
        0 4px 12px rgba(15, 23, 42, 0.14);
}

.vema-restore-logo-wrap {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.96);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.vema-restore-logo {
    width: 26px;
    height: 26px;
    object-fit: contain;
}

.vema-restore-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.45px;
    padding-right: 4px;
    white-space: nowrap;
}

#vema-chat-button {
    position: relative;
    bottom: auto;
    right: auto;
    display: inline-flex;
    align-items: center;
    gap: 11px;
    min-height: 54px;
    padding: 7px 14px 7px 7px;
    border-radius: 0;
    background: transparent;
    color: #fff;
    border: 0;
    cursor: pointer;
    z-index: 1;
    box-shadow: none;
    transition: filter 0.2s ease;
    pointer-events: auto;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

#vema-chat-button:hover {
    transform: none;
    box-shadow: none;
    filter: brightness(1.04);
}

#vema-chat-button:active {
    transform: none;
    filter: brightness(0.98);
}

.vema-launcher-logo-wrap {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.96);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow:
        0 2px 10px rgba(15, 23, 42, 0.14),
        inset 0 0 0 1px rgba(255, 255, 255, 0.8);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

#vema-chat-button:hover .vema-launcher-logo-wrap {
    animation: vema-logo-spin 3.6s linear infinite;
}

.vema-launcher-logo {
    width: 34px;
    height: 34px;
    object-fit: contain;
    display: block;
}

.vema-launcher-text {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.55px;
    line-height: 1;
    white-space: nowrap;
    text-transform: lowercase;
    text-shadow: 0 1px 2px rgba(15, 23, 42, 0.18);
}

@keyframes vema-logo-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

#vema-chat-box {
    position: fixed;
    bottom: 90px;
    right: 22px;
    width: 372px;
    max-width: calc(100vw - 24px);
    max-height: 580px;
    background: var(--vema-bg);
    border-radius: 18px;
    border: 1px solid var(--vema-border);
    box-shadow:
        0 24px 48px rgba(15, 23, 42, 0.18),
        0 8px 20px var(--vema-accent-glow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 2147483647;
    animation: vema-panel-in 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes vema-panel-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

#vema-chat-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--vema-border);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.98) 100%);
}

.vema-lang-label {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.45px;
    white-space: nowrap;
}

#vema-language-select {
    flex: 1;
    min-width: 0;
    height: 34px;
    border: 1px solid var(--vema-border);
    border-radius: 8px;
    background: #fff;
    font-size: 12px;
    padding: 0 10px;
    color: var(--vema-text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#vema-language-select:focus {
    outline: none;
    border-color: var(--vema-accent);
    box-shadow: 0 0 0 3px var(--vema-accent-ring);
}

#vema-chat-input-area {
    display: flex;
    align-items: stretch;
    border-top: 1px solid var(--vema-border);
    background: #fff;
}

.vema-voice-btn {
    width: 46px;
    border: none;
    background: #f8fafc;
    color: #475569;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s ease, color 0.2s ease;
}

.vema-voice-btn:hover {
    background: var(--vema-accent-soft);
    color: var(--vema-accent-dark);
}

.vema-voice-btn.vema-voice-active {
    background: #fde8e8;
    color: #b42318;
}

#vema-voice-status {
    padding: 6px 12px 0;
    font-size: 12px;
    color: #b42318;
    font-weight: 600;
}

#vema-chat-box.vema-hidden {
    display: none;
}

#vema-chat-header {
    background: linear-gradient(135deg, var(--vema-accent) 0%, var(--vema-accent-dark) 100%);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.12);
}

.vema-header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.vema-header-logo-wrap {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.16);
}

#vema-chat-box:not(.vema-hidden) .vema-header-logo-wrap {
    animation: vema-logo-spin 8s linear infinite;
}

.vema-header-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.vema-header-info {
    min-width: 0;
}

.vema-header-info strong,
.vema-header-info small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vema-header-info small {
    display: block;
    opacity: 0.92;
    font-weight: normal;
}

#vema-chat-minimize {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    color: #fff;
    font-size: 20px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    line-height: 1;
    transition: background 0.2s ease, transform 0.2s ease;
}

#vema-chat-minimize:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.04);
}

#vema-chat-messages {
    flex: 1;
    min-height: 260px;
    max-height: 340px;
    overflow-y: auto;
    padding: 14px 12px;
    background:
        radial-gradient(circle at top right, var(--vema-accent-soft) 0%, transparent 42%),
        #f8fafc;
    scrollbar-width: thin;
    scrollbar-color: var(--vema-accent-ring) transparent;
}

#vema-chat-messages::-webkit-scrollbar {
    width: 6px;
}

#vema-chat-messages::-webkit-scrollbar-thumb {
    background: var(--vema-accent-ring);
    border-radius: 999px;
}

.vema-msg {
    margin-bottom: 10px;
    padding: 10px 13px;
    border-radius: 14px;
    max-width: 85%;
    clear: both;
    line-height: 1.48;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.vema-user {
    background: linear-gradient(135deg, var(--vema-accent) 0%, var(--vema-accent-dark) 100%);
    color: #fff;
    float: right;
    border-bottom-right-radius: 4px;
}

.vema-bot {
    background: var(--vema-bot-bg);
    color: var(--vema-text);
    float: left;
    border: 1px solid var(--vema-border);
    border-bottom-left-radius: 4px;
}

.vema-action-btn {
    display: inline-block;
    margin: 6px 6px 0 0;
    padding: 6px 11px;
    background: #fff;
    border: 1px solid var(--vema-accent);
    color: var(--vema-accent-dark);
    border-radius: 999px;
    font-size: 12px;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.vema-action-btn:hover {
    background: var(--vema-accent);
    color: #fff;
    transform: translateY(-1px);
}

#vema-typing {
    padding: 0 12px 8px;
}

#vema-typing span {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 4px;
    background: var(--vema-accent);
    opacity: 0.55;
    border-radius: 50%;
    animation: vema-bounce 1.2s infinite;
}

#vema-typing span:nth-child(2) { animation-delay: 0.15s; }
#vema-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes vema-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.35; }
    40% { transform: translateY(-5px); opacity: 1; }
}

#vema-quick-replies {
    padding: 0 10px 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.vema-quick-btn {
    border: 1px solid var(--vema-border);
    background: #fff;
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    color: var(--vema-text);
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.vema-quick-btn:hover {
    border-color: var(--vema-accent);
    background: var(--vema-accent-soft);
    color: var(--vema-accent-dark);
    transform: translateY(-1px);
}

#vema-chat-input {
    flex: 1;
    border: none;
    padding: 13px 12px;
    outline: none;
    font-size: 14px;
    color: var(--vema-text);
    background: transparent;
}

#vema-chat-input:focus {
    box-shadow: inset 0 0 0 1px var(--vema-accent-ring);
}

#vema-chat-send {
    border: none;
    background: linear-gradient(135deg, var(--vema-accent) 0%, var(--vema-accent-dark) 100%);
    color: #fff;
    width: 78px;
    cursor: pointer;
    font-weight: 700;
    letter-spacing: 0.3px;
    transition: filter 0.2s ease, transform 0.2s ease;
}

#vema-chat-send:hover {
    filter: brightness(1.05);
}

#vema-chat-send:active {
    transform: scale(0.98);
}

#vema-escalation {
    padding: 12px;
    border-top: 1px solid var(--vema-border);
    background: #fff;
}

#vema-escalation input,
#vema-escalation textarea {
    width: 100%;
    margin-bottom: 7px;
    padding: 9px 10px;
    border: 1px solid var(--vema-border);
    border-radius: 8px;
    font-size: 13px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#vema-escalation input:focus,
#vema-escalation textarea:focus {
    outline: none;
    border-color: var(--vema-accent);
    box-shadow: 0 0 0 3px var(--vema-accent-ring);
}

#vema-esc-submit {
    width: 100%;
    padding: 9px;
    background: linear-gradient(135deg, var(--vema-accent) 0%, var(--vema-accent-dark) 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    transition: filter 0.2s ease, transform 0.2s ease;
}

#vema-esc-submit:hover {
    filter: brightness(1.05);
}

.vema-hidden {
    display: none !important;
}

@media (max-width: 768px) {
    #vema-launcher-dock {
        right: 14px;
        bottom: 16px;
    }

    #vema-launcher-restore {
        bottom: 84px;
    }

    #vema-chat-box {
        right: 12px;
        left: 12px;
        width: auto;
        bottom: 84px;
        border-radius: 16px;
    }

    #vema-launcher-hide {
        width: 34px;
        min-height: 50px;
    }

    #vema-chat-button {
        padding: 7px 12px 7px 7px;
        gap: 9px;
        min-height: 50px;
    }

    .vema-launcher-logo-wrap {
        width: 36px;
        height: 36px;
    }

    .vema-launcher-logo {
        width: 30px;
        height: 30px;
    }

    .vema-launcher-text {
        font-size: 12px;
    }
}

@media print {
    #vema-widget-root,
    #vema-launcher-dock,
    #vema-launcher-restore,
    #vema-chat-box,
    #vema-chat-button,
    #vema-launcher-hide {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
}

#vema-widget-root.vema-print-hidden,
#vema-widget-root.vema-print-hidden * {
    display: none !important;
    visibility: hidden !important;
}
