.support-widget {
    position: fixed;
    right: 1.15rem;
    bottom: 1.35rem;
    z-index: 190;
}

.support-fab {
    position: relative;
    width: 3.1rem;
    height: 3.1rem;
    border: 1px solid rgba(244, 114, 182, 0.5);
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(244, 114, 182, 0.96), rgba(16, 185, 129, 0.94));
    color: #fff;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(2, 6, 23, 0.45);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.support-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(244, 114, 182, 0.35);
}

.support-fab:focus-visible {
    outline: 2px solid var(--green, #10b981);
    outline-offset: 3px;
}

.support-fab__badge {
    position: absolute;
    top: -0.15rem;
    right: -0.15rem;
    min-width: 1.2rem;
    height: 1.2rem;
    padding: 0 0.28rem;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.2rem;
    text-align: center;
    border: 2px solid rgba(11, 18, 32, 0.95);
}

.support-alert-settings {
    margin-top: 0.5rem;
    padding-top: 0.35rem;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
}

.support-alert-settings .alert-toggle {
    background: rgba(15, 23, 42, 0.55);
}

.support-alert-settings .alert-toggle__title {
    color: #e2e8f0;
}

.support-panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 0.75rem);
    width: min(24rem, calc(100vw - 1.5rem));
    max-height: min(36rem, calc(100vh - 5rem));
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 1rem;
    background: rgba(11, 18, 32, 0.97);
    box-shadow: 0 18px 40px rgba(2, 6, 23, 0.55);
    overflow: hidden;
}

.support-panel.support-panel--chat {
    width: min(26rem, calc(100vw - 1.5rem));
    max-height: min(44rem, calc(100vh - 4rem));
    min-height: 30rem;
}

.support-panel[hidden] {
    display: none !important;
}

.support-panel__head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.85);
}

.support-panel__title {
    flex: 1;
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #e2e8f0;
}

.support-panel__back,
.support-panel__minimize,
.support-panel__close {
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 0.5rem;
    background: transparent;
    color: #94a3b8;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}

.support-panel__minimize {
    font-size: 1.1rem;
    font-weight: 700;
}

.support-panel__back:hover,
.support-panel__minimize:hover,
.support-panel__close:hover {
    background: rgba(148, 163, 184, 0.15);
    color: #e2e8f0;
}

.support-panel__body {
    flex: 1;
    overflow-y: auto;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 0;
}

.support-panel--chat .support-panel__body {
    overflow: hidden;
}

.support-menu {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.support-menu__btn {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 0.75rem;
    background: rgba(15, 23, 42, 0.6);
    color: #e2e8f0;
    font-size: 0.95rem;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.support-menu__btn:hover {
    border-color: rgba(244, 114, 182, 0.55);
    background: rgba(244, 114, 182, 0.08);
}

.support-phones {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.support-phones__item a {
    display: block;
    padding: 0.65rem 0.75rem;
    border-radius: 0.65rem;
    border: 1px solid rgba(148, 163, 184, 0.25);
    color: #e2e8f0;
    text-decoration: none;
    font-size: 0.92rem;
}

.support-phones__item a:hover {
    border-color: rgba(16, 185, 129, 0.5);
    background: rgba(16, 185, 129, 0.08);
}

.support-phones__label {
    display: block;
    font-size: 0.78rem;
    color: #94a3b8;
    margin-bottom: 0.15rem;
}

.support-form {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.support-form label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.82rem;
    color: #94a3b8;
}

.support-form input,
.support-form textarea {
    padding: 0.55rem 0.65rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 0.55rem;
    background: rgba(15, 23, 42, 0.75);
    color: #e2e8f0;
    font-size: 0.9rem;
    font-family: inherit;
}

.support-form textarea {
    min-height: 4.5rem;
    resize: vertical;
}

.support-form__submit {
    margin-top: 0.25rem;
    padding: 0.65rem;
    border: none;
    border-radius: 0.65rem;
    background: linear-gradient(135deg, rgba(244, 114, 182, 0.95), rgba(16, 185, 129, 0.9));
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

.support-form__submit:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.support-chat-status {
    font-size: 0.82rem;
    color: #94a3b8;
    padding: 0.45rem 0.55rem;
    border-radius: 0.5rem;
    background: rgba(15, 23, 42, 0.55);
}

.support-messages {
    flex: 1;
    min-height: 10rem;
    max-height: 14rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.25rem 0;
}

.support-panel--chat .support-messages {
    flex: 1;
    min-height: 18rem;
    max-height: none;
}

.support-guest-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
}

.support-guest-fields input:first-child {
    grid-column: 1 / -1;
}

.support-guest-fields input {
    padding: 0.5rem 0.6rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 0.55rem;
    background: rgba(15, 23, 42, 0.75);
    color: #e2e8f0;
    font-size: 0.85rem;
    font-family: inherit;
}

.support-note--inline {
    margin: -0.35rem 0 0;
}

.support-msg {
    max-width: 88%;
    padding: 0.5rem 0.65rem;
    border-radius: 0.75rem;
    font-size: 0.88rem;
    line-height: 1.4;
    word-break: break-word;
}

.support-msg--client {
    align-self: flex-end;
    background: rgba(244, 114, 182, 0.22);
    color: #fce7f3;
}

.support-msg--admin {
    align-self: flex-start;
    background: rgba(16, 185, 129, 0.18);
    color: #d1fae5;
}

.support-msg--system {
    align-self: center;
    max-width: 100%;
    background: rgba(148, 163, 184, 0.12);
    color: #94a3b8;
    font-size: 0.78rem;
    text-align: center;
}

.support-msg__meta {
    display: block;
    font-size: 0.72rem;
    opacity: 0.75;
    margin-bottom: 0.15rem;
}

.support-compose {
    display: flex;
    gap: 0.45rem;
    margin-top: auto;
}

.support-compose input {
    flex: 1;
    padding: 0.55rem 0.65rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 0.55rem;
    background: rgba(15, 23, 42, 0.75);
    color: #e2e8f0;
    font-size: 0.9rem;
}

.support-compose button {
    padding: 0.55rem 0.85rem;
    border: none;
    border-radius: 0.55rem;
    background: rgba(16, 185, 129, 0.85);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

.support-compose button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.support-error {
    color: #fca5a5;
    font-size: 0.85rem;
}

.support-note {
    font-size: 0.82rem;
    color: #94a3b8;
    margin: 0;
}

body:has(.support-widget) .scroll-to-top {
    bottom: 5.25rem;
}

html.theme-light .support-panel {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(148, 163, 184, 0.45);
}

html.theme-light .support-panel__head {
    background: #f8fafc;
}

html.theme-light .support-panel__title {
    color: #0f172a;
}

html.theme-light .support-menu__btn,
html.theme-light .support-form input,
html.theme-light .support-form textarea,
html.theme-light .support-compose input,
html.theme-light .support-guest-fields input {
    background: #fff;
    color: #0f172a;
}

html.theme-light .support-alert-settings .alert-toggle {
    background: #f8fafc;
}

html.theme-light .support-alert-settings .alert-toggle__title {
    color: #0f172a;
}

html.theme-light .support-form label {
    color: #64748b;
}

html.theme-light .support-archive-list__preview {
    color: #64748b;
}

html.theme-light .support-error {
    color: #b91c1c;
}

html.theme-light .support-note {
    color: #64748b;
}

.support-menu__btn--archive {
    border-color: rgba(251, 191, 36, 0.45);
}

.support-menu__btn--archive:hover {
    border-color: rgba(251, 191, 36, 0.75);
    background: rgba(251, 191, 36, 0.1);
}

.support-archive-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.support-archive-list__btn {
    width: 100%;
    padding: 0.65rem 0.75rem;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 0.65rem;
    background: rgba(15, 23, 42, 0.55);
    color: #e2e8f0;
    text-align: left;
    cursor: pointer;
    font: inherit;
}

.support-archive-list__btn:hover {
    border-color: rgba(251, 191, 36, 0.55);
    background: rgba(251, 191, 36, 0.08);
}

.support-archive-list__title {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
}

.support-archive-list__date {
    display: block;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 0.15rem;
}

.support-archive-list__preview {
    display: block;
    font-size: 0.82rem;
    color: #cbd5e1;
    margin-top: 0.25rem;
}

.support-chat-status--archive {
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.35);
    background: rgba(251, 191, 36, 0.08);
}

.support-messages--readonly {
    opacity: 0.95;
}

@media (max-width: 640px) {
    .support-widget {
        right: 0.85rem;
        bottom: 1rem;
    }

    .support-panel {
        width: min(22rem, calc(100vw - 1rem));
    }

    .support-panel.support-panel--chat {
        width: min(24rem, calc(100vw - 1rem));
        min-height: 26rem;
        max-height: min(40rem, calc(100vh - 3rem));
    }

    .support-panel--chat .support-messages {
        min-height: 14rem;
    }

    body:has(.support-widget) .scroll-to-top {
        bottom: 4.85rem;
    }
}
