.zib-live-chat,
.zib-live-chat * {
    box-sizing: border-box;
}

.zib-live-chat {
    position: fixed;
    z-index: 1300;
    right: 24px;
    bottom: 24px;
    color: #17324d;
    font-family: inherit;
    transition: bottom .22s ease;
}

.zib-live-chat.is-raised {
    bottom: 92px;
}

.zib-chat-launcher {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: #ff5a1f;
    color: #fff;
    box-shadow: 0 8px 24px rgba(0, 47, 74, .25);
    cursor: pointer;
    transition: transform .18s ease, background .18s ease;
}

.zib-chat-launcher:hover {
    transform: translateY(-2px);
    background: #ed4b12;
}

.zib-chat-launcher svg,
.zib-chat-close svg,
.zib-chat-send svg {
    width: 26px;
    height: 26px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.zib-chat-window {
    position: absolute;
    right: 0;
    bottom: 76px;
    width: min(370px, calc(100vw - 32px));
    height: min(560px, calc(100vh - 150px));
    min-height: 360px;
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #dfe8f0;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 18px 55px rgba(10, 35, 58, .22);
}

.zib-chat-window.is-open {
    display: flex;
    animation: zib-chat-enter .18s ease-out;
}

.zib-chat-window[hidden] {
    display: none !important;
}

.zib-chat-header {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: #123765;
    color: #fff;
}

.zib-chat-heading {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 11px;
}

.zib-chat-mark {
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, .13);
}

.zib-chat-mark svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.zib-chat-title {
    overflow: hidden;
    font-size: 15px;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.zib-chat-status {
    margin-top: 3px;
    color: #d7e3ef;
    font-size: 11px;
}

.zib-chat-close {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #fff;
    cursor: pointer;
}

.zib-chat-close:hover {
    background: rgba(255, 255, 255, .12);
}

.zib-chat-content {
    min-height: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f7f9fb;
}

.zib-chat-messages {
    min-height: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    padding: 16px;
    overscroll-behavior: contain;
}

.zib-chat-intro {
    max-width: 92%;
    align-self: flex-start;
    padding: 11px 13px;
    border: 1px solid #e7edf2;
    border-radius: 12px 12px 12px 3px;
    background: #fff;
    color: #41566a;
    font-size: 13px;
    line-height: 1.5;
}

.zib-chat-message {
    max-width: 86%;
    display: flex;
    flex-direction: column;
    align-self: flex-start;
    gap: 4px;
}

.zib-chat-message.is-customer {
    align-self: flex-end;
}

.zib-chat-bubble {
    padding: 10px 12px;
    border: 1px solid #e5ebf0;
    border-radius: 12px 12px 12px 3px;
    background: #fff;
    color: #344b60;
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.zib-chat-message.is-customer .zib-chat-bubble {
    border-color: #f15a24;
    border-radius: 12px 12px 3px 12px;
    background: #f15a24;
    color: #fff;
}

.zib-chat-message.is-system .zib-chat-bubble {
    border-color: transparent;
    background: #edf2f6;
    color: #607487;
}

.zib-chat-message-meta {
    padding: 0 4px;
    color: #8796a4;
    font-size: 10px;
}

.zib-chat-message.is-customer .zib-chat-message-meta {
    text-align: right;
}

.zib-chat-form-area {
    padding: 13px 14px 14px;
    border-top: 1px solid #e5ebf0;
    background: #fff;
}

.zib-chat-start-form,
.zib-chat-send-form {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.zib-chat-start-form[hidden],
.zib-chat-send-form[hidden] {
    display: none !important;
}

.zib-chat-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.zib-chat-field[hidden] {
    display: none !important;
}

.zib-chat-field label {
    color: #52687c;
    font-size: 11px;
    font-weight: 700;
}

.zib-chat-field input,
.zib-chat-field textarea,
.zib-chat-compose {
    width: 100%;
    border: 1px solid #dce5ed;
    border-radius: 7px;
    outline: none;
    background: #fff;
    color: #18334c;
    font: inherit;
    font-size: 13px;
}

.zib-chat-field input {
    min-height: 38px;
    padding: 8px 10px;
}

.zib-chat-field textarea,
.zib-chat-compose {
    min-height: 64px;
    max-height: 120px;
    resize: vertical;
    padding: 9px 10px;
}

.zib-chat-field input:focus,
.zib-chat-field textarea:focus,
.zib-chat-compose:focus {
    border-color: #ff8a5f;
    box-shadow: 0 0 0 3px rgba(255, 90, 31, .1);
}

.zib-chat-submit-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.zib-chat-helper {
    color: #8291a0;
    font-size: 10px;
}

.zib-chat-send {
    min-height: 38px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 13px;
    border: 0;
    border-radius: 7px;
    background: #ff5a1f;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.zib-chat-send:hover {
    background: #ed4b12;
}

.zib-chat-send:disabled {
    opacity: .6;
    cursor: wait;
}

.zib-chat-error {
    display: none;
    color: #ba3030;
    font-size: 12px;
    line-height: 1.4;
}

.zib-chat-error.is-visible {
    display: block;
}

@keyframes zib-chat-enter {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 480px) {
    .zib-live-chat {
        right: 16px;
        bottom: 16px;
    }

    .zib-live-chat.is-raised {
        bottom: 78px;
    }

    .zib-chat-launcher {
        width: 48px;
        height: 48px;
    }

    .zib-chat-window {
        right: -4px;
        bottom: 68px;
        width: min(370px, calc(100vw - 24px));
        height: min(560px, calc(100dvh - 128px));
        min-height: min(360px, calc(100dvh - 128px));
    }
}

@media (prefers-reduced-motion: reduce) {
    .zib-chat-window.is-open,
    .zib-chat-launcher {
        animation: none;
        transition: none;
    }
}
