.mwt-live-support {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 2147483000;
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

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

.mwt-support-fab {
    position: relative;
    width: 58px;
    height: 58px;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: #2563eb;
    box-shadow: 0 18px 40px rgba(37, 99, 235, 0.34);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    cursor: pointer;
}

.mwt-support-fab:hover {
    background: #1d4ed8;
}

.mwt-support-pulse {
    position: absolute;
    right: 7px;
    top: 7px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid #fff;
}

.mwt-support-panel {
    position: absolute;
    right: 0;
    bottom: 74px;
    width: min(370px, calc(100vw - 28px));
    max-height: min(620px, calc(100vh - 118px));
    display: none;
    overflow: hidden;
    border: 1px solid #dbe5f0;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 22px 60px rgba(15, 23, 42, 0.22);
}

.mwt-live-support.is-open .mwt-support-panel {
    display: flex;
    flex-direction: column;
}

.mwt-support-head {
    min-height: 68px;
    padding: 14px 16px;
    color: #fff;
    background: linear-gradient(135deg, #1d4ed8 0%, #0f172a 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.mwt-support-title {
    font-size: 1rem;
    font-weight: 850;
    line-height: 1.2;
}

.mwt-support-subtitle {
    color: rgba(255, 255, 255, 0.76);
    font-size: 0.78rem;
    line-height: 1.35;
}

.mwt-support-close {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.mwt-support-body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 14px;
    background: #f8fafc;
}

.mwt-support-start,
.mwt-support-reply {
    margin: 0;
}

.mwt-support-start label {
    display: block;
    margin-bottom: 10px;
}

.mwt-support-start span {
    display: block;
    margin-bottom: 5px;
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 850;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.mwt-support-start input,
.mwt-support-start textarea,
.mwt-support-reply textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    color: #0f172a;
    font-size: 0.9rem;
    outline: 0;
    box-shadow: none;
}

.mwt-support-start input {
    min-height: 42px;
    padding: 0 12px;
}

.mwt-support-start textarea,
.mwt-support-reply textarea {
    resize: none;
    padding: 10px 12px;
}

.mwt-support-start input:focus,
.mwt-support-start textarea:focus,
.mwt-support-reply textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.mwt-support-start input[readonly] {
    background: #eef2f7;
    color: #475569;
}

.mwt-support-primary {
    width: 100%;
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    background: #2563eb;
    color: #fff;
    font-weight: 850;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mwt-support-primary:hover {
    background: #1d4ed8;
}

.mwt-support-alert {
    display: none;
    margin-top: 10px;
    border-radius: 8px;
    padding: 9px 10px;
    background: #fee2e2;
    color: #991b1b;
    font-size: 0.82rem;
    font-weight: 700;
}

.mwt-support-alert.is-visible {
    display: block;
}

.mwt-support-messages {
    flex: 1 1 auto;
    height: auto;
    max-height: none;
    min-height: 220px;
    overflow-y: auto;
    padding: 4px 2px 10px;
}

.mwt-support-chat {
    min-height: 0;
}

.mwt-support-chat:not(.d-none) {
    display: flex;
    flex-direction: column;
    max-height: calc(min(620px, 100vh - 118px) - 96px);
}

.mwt-message {
    display: flex;
    margin: 8px 0;
}

.mwt-message.visitor {
    justify-content: flex-end;
}

.mwt-message.operator,
.mwt-message.system {
    justify-content: flex-start;
}

.mwt-message-bubble {
    max-width: 82%;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 0.86rem;
    line-height: 1.38;
    word-break: break-word;
}

.mwt-message.visitor .mwt-message-bubble {
    background: #2563eb;
    color: #fff;
    border-bottom-right-radius: 3px;
}

.mwt-message.operator .mwt-message-bubble {
    background: #fff;
    color: #0f172a;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 3px;
}

.mwt-message.system .mwt-message-bubble {
    max-width: 96%;
    background: #e0ecff;
    color: #1e40af;
    font-size: 0.78rem;
    font-weight: 750;
}

.mwt-support-image-preview {
    display: block;
    max-width: min(240px, 100%);
    max-height: 170px;
    margin-top: 7px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.34);
    object-fit: cover;
}

.mwt-support-file-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 100%;
    margin-top: 6px;
    border-radius: 8px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.16);
    color: inherit;
    text-decoration: none;
    font-weight: 800;
    word-break: break-word;
}

.mwt-message.operator .mwt-support-file-link,
.mwt-message.system .mwt-support-file-link {
    background: #f1f5f9;
    color: #1d4ed8;
}

.mwt-message-meta {
    margin-bottom: 3px;
    opacity: 0.76;
    font-size: 0.68rem;
    font-weight: 800;
}

.mwt-support-typing {
    min-height: 19px;
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 750;
}

.mwt-support-reply {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    gap: 8px;
    align-items: end;
}

.mwt-support-reply button {
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 8px;
    color: #fff;
    background: #16a34a;
}

.mwt-support-reply button:hover {
    background: #15803d;
}

.mwt-support-reply textarea:disabled,
.mwt-support-reply button:disabled {
    opacity: 0.62;
    cursor: not-allowed;
}

.mwt-support-end {
    flex: 0 0 auto;
    width: 100%;
    margin-top: 9px;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 850;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.mwt-support-end:hover {
    border-color: #ef4444;
    color: #dc2626;
}

.mwt-support-end:disabled {
    opacity: 0.62;
    cursor: not-allowed;
}

@media (max-width: 575px) {
    .mwt-live-support {
        right: 14px;
        bottom: 14px;
    }

    .mwt-support-fab {
        width: 54px;
        height: 54px;
    }

    .mwt-support-panel {
        right: -1px;
        bottom: 66px;
    }
}
