#live-chat-container {
    position: fixed;
    right: 22px;
    bottom: 94px;
    z-index: 10000;
    display: flex;
    width: min(390px, calc(100vw - 28px));
    height: min(580px, calc(100vh - 125px));
    overflow: hidden;
    flex-direction: column;
    border: 1px solid rgba(125, 211, 252, .2);
    border-radius: 20px;
    background: #0d171b;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .4);
    color: #e8f5f6;
    opacity: 0;
    transform: translateY(16px) scale(.98);
    visibility: hidden;
    transition: opacity .2s ease, transform .2s ease, visibility .2s;
}

#live-chat-container.visible { opacity: 1; transform: translateY(0) scale(1); visibility: visible; }
#live-chat-container.hidden { pointer-events: none; }

.chat-header {
    display: flex;
    min-height: 72px;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 13px 18px;
    background: linear-gradient(135deg, #102c33, #123d46);
    border-bottom: 1px solid rgba(125, 211, 252, .15);
}
.chat-header h3 { margin: 0; color: #fff; font-size: 17px; font-weight: 800; line-height: 1.2; }
.chat-status { display: flex; align-items: center; gap: 6px; margin-top: 5px; color: #a7f3d0; font-size: 12px; }
.chat-status::before { width: 7px; height: 7px; border-radius: 50%; background: #34d399; content: ''; box-shadow: 0 0 0 3px rgba(52, 211, 153, .12); }
.chat-status[data-state="waiting_staff"] { color: #fde68a; }
.chat-status[data-state="waiting_staff"]::before { background: #fbbf24; }
.chat-status[data-state="closed"] { color: #cbd5e1; }
.chat-status[data-state="closed"]::before { background: #94a3b8; }
.close-chat { width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(255,255,255,.08); color: #fff; cursor: pointer; font-size: 24px; line-height: 1; }

.chat-messages { display: flex; min-height: 0; flex: 1; flex-direction: column; gap: 12px; overflow-y: auto; padding: 18px 15px; background: radial-gradient(circle at top right, rgba(34,211,238,.05), transparent 42%), #0b1418; }
.chat-message { display: flex; max-width: 87%; flex-direction: column; gap: 4px; }
.chat-message.user { align-self: flex-end; align-items: flex-end; }
.chat-message.assistant, .chat-message.staff { align-self: flex-start; align-items: flex-start; }
.chat-message__label { padding: 0 5px; color: #80979d; font-size: 10px; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
.message-content { padding: 10px 13px; border: 1px solid rgba(148,163,184,.12); border-radius: 15px 15px 15px 4px; background: #18262b; color: #e6f1f2; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; white-space: pre-wrap; }
.chat-message.user .message-content { border-color: rgba(34,211,238,.24); border-radius: 15px 15px 4px 15px; background: #0d6671; color: #fff; }
.chat-message.staff .message-content { border-color: rgba(52,211,153,.25); background: #15352f; }
.chat-message.is-pending { opacity: .58; }
.chat-payment-link { display:block; margin-top:9px; padding:10px 12px; border-radius:10px; background:#635bff; color:#fff; text-align:center; text-decoration:none; font-weight:850; }
.chat-payment-link:hover { background:#5149e8; color:#fff; }

.chat-form-container { margin: 0; padding: 12px; border-top: 1px solid rgba(148,163,184,.12); background: #101c20; }
.chat-input-area { display: flex; align-items: flex-end; gap: 8px; }
#chat-input { min-height: 44px; max-height: 112px; flex: 1; box-sizing: border-box; resize: vertical; border: 1px solid rgba(148,163,184,.25); border-radius: 13px; outline: 0; background: #0a1317; color: #fff; padding: 11px 12px; font: inherit; font-size: 14px; }
#chat-input::placeholder { color: #72868c; }
#chat-input:focus { border-color: #22d3ee; box-shadow: 0 0 0 3px rgba(34,211,238,.1); }
#send-message-btn { min-height: 44px; border: 0; border-radius: 12px; background: linear-gradient(135deg, #22d3ee, #14b8a6); color: #061216; padding: 0 15px; cursor: pointer; font-weight: 850; }
#send-message-btn:disabled { cursor: wait; opacity: .55; }

#toggle-chat { position: fixed; right: 22px; bottom: 22px; z-index: 9999; display: grid; width: 58px; height: 58px; place-items: center; border: 1px solid rgba(255,255,255,.22); border-radius: 50%; background: linear-gradient(135deg, #18bccc, #137b89); color: #fff; cursor: pointer; box-shadow: 0 13px 34px rgba(3, 20, 25, .38); font-size: 24px; transition: transform .18s ease; }
#toggle-chat:hover { transform: translateY(-2px); }
#toggle-chat.is-open { transform: scale(.92); }

@media (max-width: 560px) {
    #live-chat-container { right: 10px; bottom: 82px; width: calc(100vw - 20px); height: min(620px, calc(100dvh - 98px)); border-radius: 16px; }
    #toggle-chat { right: 14px; bottom: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    #live-chat-container, #toggle-chat { transition: none; }
}
