.support-chat {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-inline-start: 0.5rem;
    z-index: 80;
}

.support-chat--fab {
    position: fixed;
    inset-inline-end: 1.25rem;
    bottom: 1.25rem;
    margin: 0;
    z-index: 80;
}

.support-chat-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-width: 3.25rem;
    height: 3.25rem;
    padding: 0 1rem;
    border-radius: 999px;
    border: 0;
    background: #2563eb;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 12px 30px rgba(37, 99, 235, 0.35);
}

.support-chat-toggle:hover {
    background: #1d4ed8;
}

.support-chat-toggle-label {
    font-size: 0.875rem;
    font-weight: 700;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .support-chat-toggle-label {
        display: none;
    }

    .support-chat-toggle {
        width: 3.25rem;
        padding: 0;
    }
}

.dark .support-chat-toggle {
    background: #3b82f6;
}

.support-chat-badge {
    position: absolute;
    top: -0.2rem;
    inset-inline-end: -0.15rem;
    min-width: 1.2rem;
    height: 1.2rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 0.7rem;
    line-height: 1.2rem;
    text-align: center;
    font-weight: 700;
}

.support-chat-panel {
    position: absolute;
    bottom: calc(100% + 0.75rem);
    inset-inline-end: 0;
    width: min(22rem, calc(100vw - 1.5rem));
    height: min(32rem, calc(100vh - 6rem));
    display: flex;
    flex-direction: column;
    border-radius: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: #fff;
    color: #0f172a;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.18);
    z-index: 81;
    overflow: hidden;
}

.dark .support-chat-panel {
    background: #0f172a;
    color: #e2e8f0;
    border-color: rgba(148, 163, 184, 0.2);
}

.support-chat-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.support-chat-header-text {
    flex: 1;
    min-width: 0;
}

.support-chat-title {
    font-weight: 700;
    font-size: 0.95rem;
}

.support-chat-subtitle {
    font-size: 0.75rem;
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.support-chat-back,
.support-chat-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    border-radius: 0.5rem;
}

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

.support-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.support-chat-bubble {
    max-width: 88%;
    padding: 0.55rem 0.7rem;
    border-radius: 0.85rem;
    background: rgba(148, 163, 184, 0.15);
}

.support-chat-bubble.is-mine {
    align-self: flex-end;
    background: rgba(37, 99, 235, 0.15);
}

.support-chat-bubble.is-theirs {
    align-self: flex-start;
}

.support-chat-bubble-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    font-size: 0.7rem;
    opacity: 0.75;
    margin-bottom: 0.2rem;
}

.support-chat-bubble-body {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.875rem;
    line-height: 1.35;
}

.support-chat-read-status {
    margin-top: 0.25rem;
    font-size: 0.72rem;
    text-align: end;
    opacity: 0.65;
    letter-spacing: -0.05em;
}

.support-chat-read-status.is-read {
    color: #2563eb;
    opacity: 1;
}

.support-chat-bubble.is-mine .support-chat-read-status.is-read {
    color: #1d4ed8;
}

.support-chat-admin-actions {
    padding: 0.65rem 0.9rem 0;
}

.support-chat-new-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.55rem 0.75rem;
    border-radius: 0.7rem;
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
}

.support-chat-new-link:hover {
    background: rgba(37, 99, 235, 0.16);
}

.support-chat-role {
    display: inline-flex;
    align-items: center;
    padding: 0.05rem 0.35rem;
    border-radius: 999px;
    background: rgba(14, 165, 233, 0.15);
    color: #0369a1;
    font-size: 0.65rem;
    font-weight: 600;
}

.dark .support-chat-role {
    color: #7dd3fc;
}

.support-chat-composer {
    display: flex;
    gap: 0.4rem;
    padding: 0.65rem;
    border-top: 1px solid rgba(148, 163, 184, 0.25);
}

.support-chat-input {
    flex: 1;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 0.7rem;
    padding: 0.55rem 0.7rem;
    background: transparent;
    color: inherit;
}

.support-chat-send {
    border: 0;
    border-radius: 0.7rem;
    padding: 0.55rem 0.8rem;
    background: #2563eb;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

.support-chat-thread {
    width: 100%;
    text-align: start;
    border: 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    background: transparent;
    color: inherit;
    padding: 0.75rem 0.9rem;
    cursor: pointer;
}

.support-chat-thread:hover,
.support-chat-thread.is-unread {
    background: rgba(37, 99, 235, 0.08);
}

.support-chat-thread-top,
.support-chat-thread-meta {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.75rem;
}

.support-chat-thread-name {
    font-weight: 700;
    font-size: 0.875rem;
}

.support-chat-thread-preview {
    margin-top: 0.25rem;
    font-size: 0.8rem;
    opacity: 0.75;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.support-chat-empty {
    padding: 1.5rem 1rem;
    text-align: center;
    opacity: 0.7;
    font-size: 0.875rem;
}

.support-chat-toast {
    position: fixed;
    top: 1rem;
    inset-inline-end: 1rem;
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    width: min(22rem, calc(100vw - 2rem));
    padding: 0.85rem 1rem;
    border-radius: 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: #fff;
    color: #0f172a;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
    animation: support-chat-toast-in 0.25s ease-out;
}

.dark .support-chat-toast {
    background: #0f172a;
    color: #e2e8f0;
    border-color: rgba(148, 163, 184, 0.25);
}

.support-chat-toast-content {
    flex: 1;
    min-width: 0;
}

.support-chat-toast-title {
    font-weight: 700;
    font-size: 0.875rem;
    margin-bottom: 0.2rem;
}

.support-chat-toast-body {
    font-size: 0.8rem;
    opacity: 0.85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.support-chat-toast-open {
    flex-shrink: 0;
    border: 0;
    border-radius: 0.55rem;
    padding: 0.4rem 0.65rem;
    background: #2563eb;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}

.support-chat-toast-close {
    flex-shrink: 0;
    border: 0;
    background: transparent;
    color: inherit;
    opacity: 0.6;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.support-chat-toast-close:hover {
    opacity: 1;
}

@keyframes support-chat-toast-in {
    from {
        opacity: 0;
        transform: translateY(-0.5rem);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
