:root {
    --support-assistant-z: 10040;
    --support-assistant-width: 390px;
    --support-assistant-height: min(76vh, 680px);
}

.support-top-actions {
    margin-bottom: 14px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
}

.support-top-actions.support-top-actions-cadastros {
    margin-top: -10px;
    margin-bottom: 6px;
}

.support-top-btn {
    position: relative;
    border: 1px solid rgba(22, 163, 74, 0.5);
    background: linear-gradient(135deg, #22c55e, #16a34a 52%, #15803d);
    color: #f8fafc;
    border-radius: 999px;
    padding: 9px 17px;
    min-height: 41px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.01em;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow:
        0 12px 26px rgba(22, 163, 74, 0.3),
        0 2px 0 rgba(255, 255, 255, 0.22) inset;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    isolation: isolate;
}

.support-top-btn:hover {
    transform: translateY(-1px) scale(1.015);
    box-shadow:
        0 16px 30px rgba(22, 163, 74, 0.38),
        0 2px 0 rgba(255, 255, 255, 0.28) inset;
    filter: saturate(1.07);
}

.support-top-btn i {
    font-size: 12px;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18) inset;
}

.support-top-btn::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #22c55e;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55);
    animation: supportTopBtnPulse 2.2s infinite;
}

.support-top-btn:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 3px rgba(45, 212, 191, 0.3),
        0 16px 30px rgba(22, 163, 74, 0.4);
}

.support-top-btn-guide {
    border-color: rgba(14, 116, 144, 0.44);
    background: linear-gradient(135deg, #0ea5e9, #0284c7 52%, #0369a1);
    box-shadow:
        0 12px 26px rgba(3, 105, 161, 0.28),
        0 2px 0 rgba(255, 255, 255, 0.2) inset;
}

.support-top-btn-guide:hover {
    box-shadow:
        0 16px 30px rgba(3, 105, 161, 0.36),
        0 2px 0 rgba(255, 255, 255, 0.24) inset;
}

.support-top-btn-guide::after {
    background: #38bdf8;
    box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.5);
}

@keyframes supportTopBtnPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55);
    }
    70% {
        box-shadow: 0 0 0 7px rgba(34, 197, 94, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

.support-assistant-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.28);
    z-index: calc(var(--support-assistant-z) - 1);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
}

.support-assistant-backdrop.active {
    opacity: 1;
    pointer-events: all;
}

.support-assistant {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: var(--support-assistant-width);
    height: var(--support-assistant-height);
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    overflow: hidden;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    box-shadow: 0 24px 52px rgba(15, 23, 42, 0.3);
    z-index: var(--support-assistant-z);
    display: flex;
    flex-direction: column;
    transform: translateY(14px) scale(0.985);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.24s ease, opacity 0.24s ease;
}

.support-assistant.active {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
}

.support-assistant-header {
    padding: 14px 14px 12px;
    color: #f8fafc;
    background: radial-gradient(circle at top right, rgba(56, 189, 248, 0.34), rgba(15, 23, 42, 0) 60%), linear-gradient(125deg, #0f172a, #1e293b 52%, #334155);
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.support-assistant-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.support-assistant-title strong {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    letter-spacing: 0.01em;
}

.support-assistant-meta {
    font-size: 12px;
    opacity: 0.88;
}

.support-assistant-close {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 10px;
    color: #f8fafc;
    background: rgba(248, 250, 252, 0.12);
}

.support-assistant-close:hover {
    background: rgba(248, 250, 252, 0.2);
}

.support-assistant-context {
    margin-top: 4px;
    background: rgba(248, 250, 252, 0.09);
    border: 1px solid rgba(248, 250, 252, 0.16);
    border-radius: 12px;
    padding: 10px;
}

.support-assistant-context p {
    margin: 0;
    font-size: 12px;
    line-height: 1.45;
}

.support-assistant-body {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}

.support-assistant-tabs {
    padding: 10px 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    overflow-x: visible;
    border-bottom: 1px solid rgba(148, 163, 184, 0.22);
    background: linear-gradient(180deg, #f8fafc, #eef2f7);
}

.support-assistant-tab {
    border: 1px solid rgba(14, 116, 144, 0.28);
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
    color: #0f4c5c;
    background: linear-gradient(135deg, #ecfeff, #cffafe);
    box-shadow: 0 3px 8px rgba(8, 145, 178, 0.16);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease, border-color 0.18s ease;
}

.support-assistant-tab:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(8, 145, 178, 0.24);
    border-color: rgba(14, 116, 144, 0.44);
    filter: saturate(1.06);
}

.support-assistant-tab.active {
    color: #f8fafc;
    border-color: transparent;
    background: linear-gradient(135deg, #0f766e, #155e75 55%, #164e63);
    box-shadow: 0 10px 22px rgba(15, 118, 110, 0.36);
}

.support-assistant-tab:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.28), 0 8px 18px rgba(8, 145, 178, 0.28);
}

.support-assistant-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.support-message {
    max-width: 88%;
    border-radius: 14px;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.5;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.09);
    white-space: pre-line;
}

.support-message.bot {
    align-self: flex-start;
    color: #0f172a;
    border: 1px solid rgba(148, 163, 184, 0.23);
    background: #ffffff;
}

.support-message.user {
    align-self: flex-end;
    color: #f8fafc;
    border: 1px solid rgba(30, 64, 175, 0.38);
    background: linear-gradient(135deg, #1d4ed8, #1e3a8a);
}

.support-message ul {
    margin: 6px 0 0;
    padding-left: 16px;
}

.support-message-text {
    white-space: pre-line;
}

.support-message-rich p {
    margin: 0;
}

.support-message-rich p + p {
    margin-top: 6px;
}

.support-message-rich strong {
    font-weight: 800;
}

.support-message-rich em {
    font-style: italic;
}

.support-message-rich code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
    font-size: 0.92em;
    padding: 1px 5px;
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.08);
}

.support-message-rich mark {
    background: #fef3c7;
    color: #92400e;
    padding: 0 4px;
    border-radius: 4px;
}

.support-message-list {
    margin: 6px 0 0;
    padding-left: 18px;
}

.support-message-list li + li {
    margin-top: 4px;
}

.support-message-actions {
    margin-top: 9px;
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.support-message-group-label {
    width: 100%;
    margin-top: 2px;
    padding-top: 8px;
    border-top: 1px dashed rgba(148, 163, 184, 0.5);
    color: #334155;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.support-message-group-label:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.support-message-action {
    border: 1px solid rgba(15, 23, 42, 0.2);
    background: #f8fafc;
    color: #0f172a;
    border-radius: 10px;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
}

.support-message-action:hover {
    filter: brightness(0.98);
}

.support-message-action.is-copy {
    border-color: rgba(14, 116, 144, 0.3);
    background: linear-gradient(135deg, #ecfeff, #cffafe);
    color: #0f4c5c;
}

.support-message-action.is-link {
    border-color: rgba(5, 150, 105, 0.3);
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    color: #065f46;
}

.support-message-action.is-ask {
    border-color: rgba(37, 99, 235, 0.28);
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    color: #1e3a8a;
}

.support-message-action.is-human {
    border-color: rgba(16, 185, 129, 0.34);
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    color: #065f46;
}

.support-typing {
    align-self: flex-start;
}

.support-typing-bubble {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.23);
    background: #ffffff;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.09);
}

.support-typing-bubble span {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #64748b;
    opacity: 0.45;
    animation: supportTypingPulse 1s infinite ease-in-out;
}

.support-typing-bubble span:nth-child(2) {
    animation-delay: 0.15s;
}

.support-typing-bubble span:nth-child(3) {
    animation-delay: 0.3s;
}

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

.support-assistant-flow-cta {
    margin: 0 12px 10px;
}

.support-assistant-flow-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    color: #0f172a;
    text-decoration: none;
    border: 1px dashed rgba(15, 23, 42, 0.35);
    border-radius: 12px;
    padding: 8px 10px;
    background: rgba(248, 250, 252, 0.75);
}

.support-assistant-compose {
    padding: 10px 12px 12px;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    background: #ffffff;
    display: flex;
    gap: 8px;
}

.support-assistant-input {
    flex: 1;
    border: 1px solid rgba(148, 163, 184, 0.55);
    border-radius: 11px;
    font-size: 13px;
    padding: 10px 12px;
    color: #0f172a;
}

.support-assistant-input:focus {
    outline: none;
    border-color: #334155;
    box-shadow: 0 0 0 3px rgba(51, 65, 85, 0.14);
}

.support-assistant-send {
    border: 0;
    border-radius: 11px;
    width: 40px;
    height: 40px;
    color: #f8fafc;
    background: linear-gradient(135deg, #0f172a, #1e293b);
}

.support-assistant-send:hover {
    filter: brightness(1.05);
}

.support-assistant-notice {
    font-size: 11px;
    color: #475569;
    margin: 0 12px 10px;
}

.theme-dark .support-assistant,
html[data-theme="dark"] .support-assistant {
    background: linear-gradient(180deg, #0b1222 0%, #111827 100%);
    border-color: rgba(148, 163, 184, 0.18);
}

.theme-dark .support-top-btn,
html[data-theme="dark"] .support-top-btn {
    border-color: rgba(34, 197, 94, 0.55);
    box-shadow:
        0 12px 26px rgba(22, 101, 52, 0.4),
        0 2px 0 rgba(255, 255, 255, 0.2) inset;
}

.theme-dark .support-top-btn-guide,
html[data-theme="dark"] .support-top-btn-guide {
    border-color: rgba(56, 189, 248, 0.48);
    background: linear-gradient(135deg, #0c4a6e, #075985 52%, #0369a1);
    box-shadow:
        0 12px 26px rgba(3, 37, 65, 0.45),
        0 2px 0 rgba(255, 255, 255, 0.16) inset;
}

.theme-dark .support-assistant-tabs,
html[data-theme="dark"] .support-assistant-tabs {
    background: linear-gradient(180deg, #0f172a, #111827);
    border-bottom-color: rgba(148, 163, 184, 0.2);
}

.theme-dark .support-assistant-tab,
html[data-theme="dark"] .support-assistant-tab {
    background: linear-gradient(135deg, #0b2530, #0f3a4b);
    color: #9eeaf9;
    border-color: rgba(34, 211, 238, 0.28);
    box-shadow: 0 3px 9px rgba(8, 145, 178, 0.24);
}

.theme-dark .support-assistant-tab:hover,
html[data-theme="dark"] .support-assistant-tab:hover {
    border-color: rgba(34, 211, 238, 0.45);
    box-shadow: 0 8px 18px rgba(8, 145, 178, 0.32);
}

.theme-dark .support-message.bot,
html[data-theme="dark"] .support-message.bot {
    background: #0f172a;
    color: #e2e8f0;
    border-color: rgba(148, 163, 184, 0.2);
}

.theme-dark .support-message-action,
html[data-theme="dark"] .support-message-action {
    border-color: rgba(148, 163, 184, 0.28);
    background: #111827;
    color: #e2e8f0;
}

.theme-dark .support-message-group-label,
html[data-theme="dark"] .support-message-group-label {
    border-top-color: rgba(148, 163, 184, 0.35);
    color: #cbd5e1;
}

.theme-dark .support-message-rich code,
html[data-theme="dark"] .support-message-rich code {
    background: rgba(148, 163, 184, 0.2);
}

.theme-dark .support-message-rich mark,
html[data-theme="dark"] .support-message-rich mark {
    background: rgba(245, 158, 11, 0.28);
    color: #fde68a;
}

.theme-dark .support-message-action.is-copy,
html[data-theme="dark"] .support-message-action.is-copy {
    border-color: rgba(34, 211, 238, 0.36);
    background: linear-gradient(135deg, rgba(8, 145, 178, 0.18), rgba(14, 116, 144, 0.2));
    color: #a5f3fc;
}

.theme-dark .support-message-action.is-link,
html[data-theme="dark"] .support-message-action.is-link {
    border-color: rgba(16, 185, 129, 0.38);
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.2), rgba(4, 120, 87, 0.18));
    color: #6ee7b7;
}

.theme-dark .support-message-action.is-ask,
html[data-theme="dark"] .support-message-action.is-ask {
    border-color: rgba(96, 165, 250, 0.42);
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.28), rgba(30, 58, 138, 0.24));
    color: #bfdbfe;
}

.theme-dark .support-message-action.is-human,
html[data-theme="dark"] .support-message-action.is-human {
    border-color: rgba(16, 185, 129, 0.38);
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.2), rgba(4, 120, 87, 0.18));
    color: #6ee7b7;
}

.theme-dark .support-typing-bubble,
html[data-theme="dark"] .support-typing-bubble {
    background: #0f172a;
    border-color: rgba(148, 163, 184, 0.2);
}

.theme-dark .support-typing-bubble span,
html[data-theme="dark"] .support-typing-bubble span {
    background: #cbd5e1;
}

.theme-dark .support-assistant-compose,
html[data-theme="dark"] .support-assistant-compose {
    background: #0f172a;
    border-top-color: rgba(148, 163, 184, 0.2);
}

.theme-dark .support-assistant-input,
html[data-theme="dark"] .support-assistant-input {
    background: #111827;
    color: #e2e8f0;
    border-color: rgba(148, 163, 184, 0.3);
}

.theme-dark .support-assistant-notice,
html[data-theme="dark"] .support-assistant-notice {
    color: #94a3b8;
}

@media (max-width: 992px) {
    .support-assistant {
        right: 14px;
        bottom: 14px;
        width: min(calc(100vw - 28px), 420px);
        height: min(78vh, 640px);
    }

    .support-assistant-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }
}

@media (max-width: 680px) {
    .support-top-actions {
        margin-bottom: 10px;
    }

    .support-top-btn {
        min-height: 37px;
        padding: 7px 13px;
        font-size: 12px;
    }

    .support-assistant {
        right: 0;
        bottom: 0;
        width: 100vw;
        height: min(85vh, 720px);
        border-radius: 18px 18px 0 0;
        border-left: 0;
        border-right: 0;
        border-bottom: 0;
    }
}
