.support-chat {
    --support-accent: #855cff;
    --support-accent-bright: #a774ff;
    --support-cyan: #58e4f3;
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 14px;
    font-family: "Manrope", sans-serif;
}

.support-chat *,
.support-chat *::before,
.support-chat *::after {
    box-sizing: border-box;
}

.support-chat__panel {
    width: min(390px, calc(100vw - 32px));
    height: min(590px, calc(100vh - 116px));
    min-height: 430px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(141, 107, 255, 0.34);
    border-radius: 24px;
    background: #0d1037;
    box-shadow: 0 28px 80px rgba(3, 5, 27, 0.56), 0 0 0 1px rgba(91, 220, 243, 0.06) inset;
    color: #fff;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(18px) scale(0.96);
    transform-origin: bottom right;
    transition: opacity 180ms ease, transform 220ms ease, visibility 180ms ease;
}

.support-chat--open .support-chat__panel {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.support-chat__header {
    display: grid;
    grid-template-columns: 46px 1fr 38px;
    align-items: center;
    gap: 12px;
    padding: 18px;
    background:
        radial-gradient(circle at 10% 0%, rgba(82, 229, 242, 0.24), transparent 42%),
        linear-gradient(135deg, #17184e 0%, #222055 52%, #301d67 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.support-chat__brand {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(145deg, var(--support-cyan), var(--support-accent));
    box-shadow: 0 10px 24px rgba(95, 86, 255, 0.28);
}

.support-chat__brand svg {
    width: 29px;
    height: 29px;
    fill: #fff;
}

.support-chat__heading {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.support-chat__heading strong {
    overflow: hidden;
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.support-chat__heading span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #bbc2eb;
    font-size: 11px;
    font-weight: 600;
}

.support-chat__heading i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ff3ad;
    box-shadow: 0 0 10px rgba(79, 243, 173, 0.75);
}

.support-chat__close,
.support-chat__launcher,
.support-chat__send {
    -webkit-tap-highlight-color: transparent;
}

.support-chat__close {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.06);
    color: #dbe0ff;
    cursor: pointer;
    transition: background 160ms ease, color 160ms ease;
}

.support-chat__close:hover {
    background: rgba(255, 255, 255, 0.13);
    color: #fff;
}

.support-chat__close svg,
.support-chat__launcher svg,
.support-chat__send svg {
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.9;
}

.support-chat__close svg {
    width: 18px;
    height: 18px;
}

.support-chat__status {
    padding: 10px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(10, 12, 43, 0.9);
    color: #8f99c9;
    font-size: 11px;
    line-height: 1.4;
}

.support-chat__status[data-state="loading"] {
    color: #75dfea;
}

.support-chat__status[data-state="error"] {
    color: #ff939f;
}

.support-chat__messages {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 11px;
    min-height: 0;
    padding: 18px;
    overflow-y: auto;
    scrollbar-color: rgba(139, 105, 255, 0.54) transparent;
    scrollbar-width: thin;
    background:
        radial-gradient(circle at 100% 0%, rgba(127, 88, 255, 0.1), transparent 34%),
        #0b0e30;
}

.support-chat__welcome {
    margin: auto 0;
    padding: 26px 20px;
    border: 1px solid rgba(131, 106, 255, 0.19);
    border-radius: 20px;
    background: rgba(26, 28, 75, 0.64);
    text-align: center;
}

.support-chat__welcome span {
    display: block;
    margin-bottom: 5px;
    color: var(--support-cyan);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.support-chat__welcome strong {
    display: block;
    color: #fff;
    font-size: 19px;
}

.support-chat__welcome p {
    margin: 9px 0 0;
    color: #9da6d3;
    font-size: 12px;
    line-height: 1.55;
}

.support-chat__message {
    max-width: 84%;
    padding: 11px 13px 8px;
    border-radius: 16px;
}

.support-chat__message p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.support-chat__message small {
    display: block;
    margin-top: 5px;
    font-size: 9px;
    line-height: 1.3;
    opacity: 0.68;
}

.support-chat__message--visitor {
    align-self: flex-end;
    border-bottom-right-radius: 5px;
    background: linear-gradient(135deg, #6f4dea, #9665ff);
    color: #fff;
    box-shadow: 0 8px 22px rgba(83, 51, 193, 0.2);
}

.support-chat__message--visitor small {
    text-align: right;
}

.support-chat__message--operator {
    align-self: flex-start;
    border: 1px solid rgba(104, 222, 238, 0.17);
    border-bottom-left-radius: 5px;
    background: #181c4a;
    color: #eef1ff;
}

.support-chat__message--operator small {
    color: #82dce8;
}

.support-chat__composer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 46px;
    align-items: end;
    gap: 10px;
    padding: 13px 14px 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    background: #10133b;
}

.support-chat__input {
    width: 100%;
    min-height: 46px;
    max-height: 112px;
    resize: none;
    overflow-y: auto;
    border: 1px solid rgba(139, 151, 210, 0.24);
    border-radius: 15px;
    outline: none;
    background: rgba(8, 10, 37, 0.78);
    color: #fff;
    padding: 13px 14px;
    font: 500 12px/1.5 "Manrope", sans-serif;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.support-chat__input::placeholder {
    color: #6f78a8;
}

.support-chat__input:focus {
    border-color: rgba(94, 220, 239, 0.64);
    box-shadow: 0 0 0 3px rgba(94, 220, 239, 0.08);
}

.support-chat__input:disabled {
    cursor: wait;
    opacity: 0.6;
}

.support-chat__send {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 15px;
    background: linear-gradient(145deg, var(--support-cyan), var(--support-accent));
    color: #fff;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(101, 81, 232, 0.28);
    transition: transform 160ms ease, filter 160ms ease;
}

.support-chat__send:hover:not(:disabled) {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.support-chat__send:disabled {
    cursor: wait;
    filter: grayscale(0.35);
    opacity: 0.56;
}

.support-chat__send svg {
    width: 21px;
    height: 21px;
}

.support-chat__privacy {
    margin: 0;
    padding: 0 16px 12px;
    background: #10133b;
    color: #68719f;
    font-size: 9px;
    text-align: center;
}

.support-chat__launcher {
    position: relative;
    width: 64px;
    height: 64px;
    display: grid;
    place-items: center;
    overflow: visible;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 20px;
    background: linear-gradient(145deg, #704bea, #9b63ff 58%, #58d9ee);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 16px 38px rgba(68, 43, 162, 0.44), 0 0 0 5px rgba(118, 83, 241, 0.1);
    transition: transform 180ms ease, border-radius 180ms ease, filter 180ms ease;
}

.support-chat__launcher:hover {
    filter: brightness(1.07);
    transform: translateY(-2px);
}

.support-chat--open .support-chat__launcher {
    border-radius: 50%;
}

.support-chat__launcher svg {
    position: absolute;
    width: 29px;
    height: 29px;
    transition: opacity 150ms ease, transform 180ms ease;
}

.support-chat__launcher-chat {
    opacity: 1;
    transform: scale(1);
}

.support-chat__launcher-close {
    opacity: 0;
    transform: rotate(-45deg) scale(0.65);
}

.support-chat--open .support-chat__launcher-chat {
    opacity: 0;
    transform: rotate(45deg) scale(0.65);
}

.support-chat--open .support-chat__launcher-close {
    opacity: 1;
    transform: rotate(0) scale(1);
}

.support-chat__launcher-pulse {
    position: absolute;
    inset: -6px;
    z-index: -1;
    border: 1px solid rgba(117, 222, 243, 0.34);
    border-radius: 25px;
    animation: support-pulse 2.4s ease-out infinite;
}

.support-chat--open .support-chat__launcher-pulse {
    display: none;
}

.support-chat__badge {
    position: absolute;
    top: -7px;
    right: -7px;
    min-width: 23px;
    height: 23px;
    display: grid;
    place-items: center;
    padding: 0 6px;
    border: 2px solid #0b0e30;
    border-radius: 999px;
    background: #ff5574;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
}

.support-chat__badge[hidden] {
    display: none;
}

@keyframes support-pulse {
    0% { opacity: 0.75; transform: scale(0.9); }
    70%, 100% { opacity: 0; transform: scale(1.18); }
}

@media (max-width: 640px) {
    .support-chat {
        right: 14px;
        bottom: 14px;
    }

    .support-chat__panel {
        position: fixed;
        right: 10px;
        bottom: 86px;
        width: calc(100vw - 20px);
        height: min(620px, calc(100dvh - 102px));
        min-height: 0;
        border-radius: 21px;
    }

    .support-chat__launcher {
        width: 58px;
        height: 58px;
        border-radius: 18px;
    }

    .support-chat__header {
        grid-template-columns: 42px 1fr 36px;
        padding: 14px;
    }

    .support-chat__brand {
        width: 42px;
        height: 42px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .support-chat__panel,
    .support-chat__launcher,
    .support-chat__launcher svg {
        transition: none;
    }

    .support-chat__launcher-pulse {
        animation: none;
    }
}
