.mpcw-floating-root,
.mpcw-inline-root {
    --mpcw-accent: #111827;
    --mpcw-accent-contrast: #ffffff;
    font-family: Arial, Helvetica, sans-serif;
    color: #111827;
}

.mpcw-floating-root {
    position: fixed;
    bottom: 24px;
    z-index: 99999;
}

.mpcw-floating-root[data-position="right"] {
    right: 24px;
}

.mpcw-floating-root[data-position="left"] {
    left: 24px;
}

.mpcw-launcher {
    border: 0;
    border-radius: 999px;
    padding: 14px 18px;
    background: var(--mpcw-accent);
    color: var(--mpcw-accent-contrast);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(17, 24, 39, 0.18);
}

.mpcw-panel {
    width: 360px;
    max-width: calc(100vw - 24px);
    height: 560px;
    max-height: calc(100vh - 110px);
    background: #ffffff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.20);
    display: none;
    flex-direction: column;
}

.mpcw-inline-root .mpcw-panel,
.mpcw-floating-root.is-open .mpcw-panel {
    display: flex;
}

.mpcw-floating-root.is-open .mpcw-launcher {
    display: none;
}

.mpcw-header {
    background: var(--mpcw-accent);
    color: var(--mpcw-accent-contrast);
    padding: 16px 18px;
}

.mpcw-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.mpcw-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.mpcw-subtitle {
    margin: 6px 0 0;
    font-size: 12px;
    line-height: 1.45;
    opacity: 0.92;
}

.mpcw-close {
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.mpcw-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
}

.mpcw-status {
    min-height: 18px;
    padding: 10px 16px 0;
    font-size: 12px;
    color: #6b7280;
}

.mpcw-prechat {
    padding: 16px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

.mpcw-prechat-copy {
    margin: 0 0 14px;
    font-size: 13px;
    line-height: 1.5;
    color: #374151;
}

.mpcw-field {
    margin-bottom: 12px;
}

.mpcw-label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 700;
    color: #374151;
}

.mpcw-input,
.mpcw-textarea {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 14px;
    background: #ffffff;
    box-sizing: border-box;
}

.mpcw-textarea {
    min-height: 86px;
    resize: vertical;
}

.mpcw-btn {
    border: 0;
    background: var(--mpcw-accent);
    color: var(--mpcw-accent-contrast);
    border-radius: 12px;
    padding: 11px 14px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.mpcw-btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

.mpcw-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mpcw-message {
    display: flex;
    flex-direction: column;
    max-width: 86%;
}

.mpcw-message[data-sender="visitor"] {
    align-self: flex-end;
}

.mpcw-message[data-sender="agent"],
.mpcw-message[data-sender="system"] {
    align-self: flex-start;
}

.mpcw-bubble {
    border-radius: 16px;
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
    background: #ffffff;
    color: #111827;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.mpcw-message[data-sender="visitor"] .mpcw-bubble {
    background: var(--mpcw-accent);
    color: var(--mpcw-accent-contrast);
}

.mpcw-meta {
    margin-top: 4px;
    font-size: 11px;
    color: #6b7280;
}

.mpcw-composer {
    padding: 12px;
    border-top: 1px solid #e5e7eb;
    background: #ffffff;
}

.mpcw-composer-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.mpcw-composer .mpcw-textarea {
    min-height: 52px;
    max-height: 140px;
}

.mpcw-empty {
    text-align: center;
    font-size: 13px;
    color: #6b7280;
    padding: 28px 16px;
}

@media (max-width: 600px) {
    .mpcw-floating-root[data-position="right"],
    .mpcw-floating-root[data-position="left"] {
        left: 12px;
        right: 12px;
        bottom: 12px;
    }

    .mpcw-panel {
        width: auto;
        max-width: none;
        height: min(72vh, 560px);
    }

    .mpcw-launcher {
        width: 100%;
    }
}
