.lena-chat-button {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9998;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 96px;
    height: 52px;
    padding: 0 18px;
    border: 0;
    border-radius: 999px;
    background: #c81e2a;
    color: #fff;
    font: 700 15px/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    box-shadow: 0 12px 28px rgba(200, 30, 42, 0.3);
    cursor: pointer;
}

.lena-chat-button:hover {
    background: #ad1722;
}

.lena-chat-button:focus-visible {
    outline: 3px solid rgba(200, 30, 42, 0.28);
    outline-offset: 3px;
}

.lena-chat-button-icon {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.lena-chat-button-icon path:first-child {
    fill: rgba(255, 255, 255, 0.14);
}

.lena-chat-button-text {
    white-space: nowrap;
}

.lena-chat-window {
    position: fixed;
    right: 24px;
    bottom: 96px;
    z-index: 9999;
    display: none;
    width: min(380px, calc(100vw - 32px));
    max-height: min(720px, 85vh);
    overflow: hidden;
    border: 1px solid #d7dde8;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.22);
    color: #172033;
    font: 14px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.lena-chat-window.is-open {
    display: flex;
    flex-direction: column;
}

.lena-chat-header {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    background: #172033;
    color: #fff;
}

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

.lena-chat-close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    cursor: pointer;
}

.lena-chat-body {
    display: flex;
    min-height: 0;
    flex-direction: column;
    gap: 12px;
    padding: 14px 16px;
    overflow: hidden;
}

.lena-chat-field {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    gap: 6px;
}

.lena-chat-field label {
    color: #526071;
    font-size: 12px;
}

.lena-chat-details {
    flex: 0 0 auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fbfcfe;
}

.lena-chat-details summary {
    cursor: pointer;
    padding: 9px 10px;
    color: #344054;
    font-size: 13px;
    font-weight: 700;
    list-style-position: inside;
}

.lena-chat-details-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-top: 1px solid #edf0f5;
    padding: 10px;
}

.lena-chat-help {
    margin: -2px 0 0;
    color: #6a7686;
    font-size: 11px;
    line-height: 1.35;
}

.lena-chat-field input,
.lena-chat-field textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #c9d2df;
    border-radius: 6px;
    padding: 10px 11px;
    color: #172033;
    font: inherit;
}

.lena-chat-field input[type="file"] {
    padding: 8px;
    background: #fbfcfe;
    font-size: 12px;
}

.lena-chat-field textarea {
    min-height: 74px;
    max-height: 120px;
    resize: vertical;
}

.lena-chat-composer {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    gap: 9px;
    border-top: 1px solid #edf0f5;
    padding-top: 10px;
}

.lena-chat-attachment-field {
    padding: 8px 10px;
    border: 1px dashed #d7dde8;
    border-radius: 8px;
    background: #fbfcfe;
}

.lena-chat-file-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.lena-chat-file-item {
    overflow: hidden;
    border-radius: 6px;
    padding: 6px 8px;
    background: #f2f5f9;
    color: #344054;
    font-size: 12px;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lena-chat-file-list.is-error .lena-chat-file-item {
    background: #fff1f2;
    color: #9f1239;
}

.lena-chat-submit {
    flex: 0 0 auto;
    border: 0;
    border-radius: 6px;
    padding: 11px 14px;
    background: #1f6feb;
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.lena-chat-submit:disabled {
    cursor: wait;
    opacity: 0.72;
}

.lena-chat-history {
    display: flex;
    min-height: 0;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 8px;
    max-height: min(460px, 58vh);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 2px 2px 4px;
}

.lena-chat-message {
    display: flex;
    align-self: flex-start;
    max-width: 86%;
    flex-direction: column;
    gap: 4px;
    border-radius: 8px;
    padding: 9px 10px;
    background: #f2f5f9;
    white-space: pre-wrap;
}

.lena-chat-message.is-operator {
    align-self: flex-end;
    background: #e8f1ff;
}

.lena-chat-message.is-ai {
    background: #eef8f0;
}

.lena-chat-message-sender {
    align-self: flex-start;
    border-radius: 999px;
    padding: 2px 7px;
    background: rgba(23, 32, 51, 0.08);
    color: #344054;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.25;
}

.lena-chat-message.is-ai .lena-chat-message-sender {
    background: rgba(26, 127, 55, 0.12);
    color: #1a7f37;
}

.lena-chat-message-body {
    white-space: pre-wrap;
}

.lena-chat-message-status {
    align-self: flex-start;
    margin-top: -4px;
    color: #7a8697;
    font-size: 11px;
    line-height: 1.2;
}

.lena-chat-typing {
    align-self: flex-end;
    max-width: 86%;
    border-radius: 8px;
    padding: 8px 10px;
    background: #eef8f0;
    color: #526071;
    font-size: 12px;
    line-height: 1.35;
}

.lena-chat-status {
    flex: 0 0 auto;
    min-height: 18px;
    color: #526071;
    font-size: 12px;
}

@media (max-width: 480px) {
    .lena-chat-button {
        right: 16px;
        bottom: 16px;
        min-width: 88px;
        height: 48px;
        padding: 0 15px;
    }

    .lena-chat-window {
        right: 16px;
        bottom: 88px;
        max-height: calc(100vh - 104px);
    }

    .lena-chat-body {
        gap: 8px;
        padding: 12px 14px;
    }

    .lena-chat-field textarea {
        min-height: 64px;
        max-height: 96px;
    }

    .lena-chat-composer {
        gap: 8px;
        padding-top: 9px;
    }

    .lena-chat-attachment-field {
        padding: 9px;
    }
}
