.s-onlinechat {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 2147483000;
    font-family: Arial, sans-serif;
    display: block !important;
    visibility: visible !important;
}

.s-onlinechat * {
    box-sizing: border-box;
}

.s-onlinechat-toggle {
    min-width: 92px;
    height: 48px;
    border: 0;
    border-radius: 24px;
    background: #23201c;
    color: #fff;
    font-weight: 700;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
    cursor: pointer;
}

.s-onlinechat-toggle-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    margin-right: 7px;
    border-radius: 50%;
    background: #4fd36b;
}

.s-onlinechat-panel {
    display: none;
    width: 340px;
    max-width: calc(100vw - 28px);
    height: 520px;
    max-height: calc(100vh - 92px);
    margin-bottom: 12px;
    overflow: hidden;
    border: 1px solid #ded8cf;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 45px rgba(0, 0, 0, .24);
}

.s-onlinechat.is-open .s-onlinechat-panel {
    display: flex;
    flex-direction: column;
}

.s-onlinechat.is-open .s-onlinechat-toggle {
    display: none;
}

.s-onlinechat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: #23201c;
    color: #fff;
}

.s-onlinechat-title {
    font-size: 16px;
    font-weight: 700;
}

.s-onlinechat-state {
    margin-top: 2px;
    color: #c8e6c9;
    font-size: 12px;
}

.s-onlinechat-close {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 15px;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    font-size: 22px;
    line-height: 28px;
    cursor: pointer;
}

.s-onlinechat-intro {
    padding: 12px 16px;
    border-bottom: 1px solid #eee7dc;
    color: #5b554c;
    font-size: 13px;
    line-height: 1.45;
}

.s-onlinechat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    background: #faf8f4;
}

.s-onlinechat-auth {
    flex: 1;
    padding: 22px 18px;
    background: #faf8f4;
}

.s-onlinechat-auth-title {
    margin-bottom: 8px;
    color: #2c2823;
    font-size: 17px;
    font-weight: 700;
}

.s-onlinechat-auth-text {
    margin-bottom: 16px;
    color: #5b554c;
    font-size: 13px;
    line-height: 1.45;
}

.s-onlinechat-auth-button,
.s-onlinechat-auth-link {
    display: block;
    width: 100%;
    height: 38px;
    margin-bottom: 9px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    line-height: 38px;
    text-align: center;
    text-decoration: none;
}

.s-onlinechat-auth-button {
    background: #7a4d2a;
    color: #fff;
}

.s-onlinechat-auth-link {
    border: 1px solid #d8d1c7;
    background: #fff;
    color: #4f3728;
}

.s-onlinechat-user {
    padding: 10px 14px;
    border-bottom: 1px solid #eee7dc;
    background: #fff;
}

.s-onlinechat-user-row {
    display: flex;
    gap: 8px;
    justify-content: space-between;
    margin-bottom: 5px;
    color: #5b554c;
    font-size: 12px;
}

.s-onlinechat-user-row:last-child {
    margin-bottom: 0;
}

.s-onlinechat-user-row strong {
    max-width: 58%;
    overflow: hidden;
    color: #2c2823;
    font-weight: 700;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.s-onlinechat-message {
    max-width: 88%;
    margin-bottom: 10px;
    padding: 9px 11px;
    border-radius: 8px;
    background: #fff;
    color: #2c2823;
    font-size: 14px;
    line-height: 1.35;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .05);
}

.s-onlinechat-message.operator {
    margin-left: auto;
    background: #e7f3df;
}

.s-onlinechat-time {
    display: block;
    margin-top: 4px;
    color: #8b8378;
    font-size: 11px;
}

.s-onlinechat-form {
    padding: 12px;
    border-top: 1px solid #eee7dc;
    background: #fff;
}

.s-onlinechat-form input,
.s-onlinechat-form textarea {
    width: 100%;
    margin-bottom: 8px;
    padding: 9px 10px;
    border: 1px solid #d8d1c7;
    border-radius: 6px;
    font: inherit;
}

.s-onlinechat-form textarea {
    resize: none;
}

.s-onlinechat-form button[type="submit"] {
    width: 100%;
    height: 38px;
    border: 0;
    border-radius: 6px;
    background: #7a4d2a;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.s-onlinechat-error {
    min-height: 16px;
    margin-top: 6px;
    color: #b00020;
    font-size: 12px;
}

@media (max-width: 480px) {
    .s-onlinechat {
        right: max(12px, env(safe-area-inset-right));
        bottom: 72px;
        bottom: max(72px, env(safe-area-inset-bottom));
        left: auto;
    }

    .s-onlinechat-panel {
        position: fixed;
        right: 12px;
        bottom: 132px;
        bottom: calc(max(72px, env(safe-area-inset-bottom)) + 60px);
        left: 12px;
        width: auto;
        max-width: none;
        height: min(520px, calc(100dvh - 150px));
        max-height: calc(100dvh - 150px);
        margin-bottom: 0;
    }

    .s-onlinechat-toggle {
        min-width: 92px;
        width: auto;
        height: 58px;
        padding: 0 18px;
        border-radius: 29px;
        font-size: 14px;
    }

    .s-onlinechat-toggle-dot {
        width: 10px;
        height: 10px;
        margin-right: 7px;
    }
}
