.support-chat {
    --sc-launcher-bottom: 24px;
    --sc-launcher-right: 16px;
    --sc-panel-bottom: 88px;
    --sc-panel-right: 16px;
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 12050;
}

/* Контейнер на весь экран только для позиционирования — клики ловят кнопка и панель */
.support-chat__launcher,
.support-chat__panel {
    pointer-events: auto;
}

.support-chat__launcher {
    position: fixed;
    right: var(--sc-launcher-right);
    bottom: var(--sc-launcher-bottom);
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(145deg, #1d4ed8, #2563eb);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(29, 78, 216, 0.45);
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.support-chat__launcher:hover {
    filter: brightness(1.06);
}

.support-chat__badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    line-height: 20px;
    text-align: center;
}

.support-chat__panel {
    position: fixed;
    right: var(--sc-panel-right);
    bottom: var(--sc-panel-bottom);
    width: min(380px, calc(100vw - 24px));
    height: min(520px, calc(100vh - 120px));
    background: #fff;
    border: 1px solid #dbe3ee;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(15, 23, 42, 0.22);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    pointer-events: auto;
    transform: translateY(12px) scale(0.98);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.support-chat--open .support-chat__panel {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
}

.support-chat__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 14px 10px;
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    color: #fff;
}

.support-chat__title {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
}

.support-chat__sub {
    margin: 4px 0 0;
    font-size: 12px;
    opacity: 0.9;
}

.support-chat__close {
    border: none;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
}

.support-chat__guest {
    padding: 20px 16px;
    text-align: center;
    font-size: 14px;
    color: #334155;
}

.support-chat__guest-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 14px;
    flex-wrap: wrap;
}

.support-chat__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #0f172a;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
}

.support-chat__btn--primary {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #fff;
}

.support-chat__messages {
    flex: 1;
    overflow: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f8fafc;
}

.support-chat__msg {
    max-width: 88%;
    padding: 9px 12px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    word-break: break-word;
}

.support-chat__msg--user {
    align-self: flex-end;
    background: #dbeafe;
    color: #0f172a;
    border-bottom-right-radius: 4px;
}

.support-chat__msg--admin {
    align-self: flex-start;
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #0f172a;
    border-bottom-left-radius: 4px;
}

.support-chat__msg-time {
    display: block;
    margin-top: 4px;
    font-size: 10px;
    opacity: 0.65;
}

.support-chat__composer {
    display: flex;
    gap: 8px;
    padding: 10px 12px 12px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}

.support-chat__input {
    flex: 1;
    resize: none;
    min-height: 42px;
    max-height: 120px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
    font-size: 14px;
}

.support-chat__send {
    width: 42px;
    min-width: 42px;
    border: none;
    border-radius: 10px;
    background: #1d4ed8;
    color: #fff;
    cursor: pointer;
    font-size: 16px;
}

.support-chat__send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.support-chat__empty {
    margin: auto;
    text-align: center;
    color: #64748b;
    font-size: 13px;
    padding: 16px;
}

@media (max-width: 768px) {
    .support-chat {
        --sc-launcher-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
        --sc-panel-bottom: calc(132px + env(safe-area-inset-bottom, 0px));
    }
}
