:root {
    --es-chat-brown: #6e4333;
    --es-chat-brown-dark: #543226;
    --es-chat-beige: #f5efeb;
    --es-chat-beige-2: #ede4df;
    --es-chat-text: #302a27;
    --es-chat-muted: #857a74;
    --es-chat-border: #ded4cf;
    --es-chat-bg: #ffffff;
}


/* Launcher */

.es23-launcher {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 2147481000;

    width: 58px;
    height: 58px;

    border: 0;
    border-radius: 50%;

    background:
        var(--es-chat-brown);

    color: #fff;

    box-shadow:
        0 12px 30px
        rgba(70, 42, 31, .26);

    cursor: pointer;

    font-size: 23px;
}


/* Window */

.es23-chat {
    position: fixed;
    right: 24px;
    bottom: 94px;

    z-index: 2147481001;

    width:
        min(
            390px,
            calc(100vw - 20px)
        );

    height:
        min(
            650px,
            calc(100vh - 110px)
        );

    display: none;
    flex-direction: column;

    overflow: hidden;

    border:
        1px solid
        var(--es-chat-border);

    border-radius: 16px;

    background:
        var(--es-chat-bg);

    box-shadow:
        0 20px 60px
        rgba(65, 42, 32, .22);

    font-family:
        Arial,
        sans-serif;
}

.es23-chat.is-open {
    display: flex;
}


/* Header — фирменный EUROSPACE, без элементов Jivo */

.es23-head {
    position: relative;

    padding:
        16px
        52px
        14px
        17px;

    background:
        var(--es-chat-brown);

    color: #fff;
}

.es23-head::after {
    display: none;
}

.es23-head strong {
    display: block;

    font-size: 15px;
    font-weight: 800;

    letter-spacing: .08em;
}

.es23-head span {
    display: block;

    margin-top: 3px;

    color:
        rgba(255,255,255,.76);

    font-size: 11px;
    font-weight: 400;
}

.es23-close {
    position: absolute;
    top: 50%;
    right: 11px;

    width: 34px;
    height: 34px;

    transform:
        translateY(-50%);

    border:
        1px solid
        rgba(255,255,255,.16);

    border-radius: 9px;

    background:
        rgba(255,255,255,.08);

    color: #fff;

    cursor: pointer;

    font-size: 24px;
    line-height: 30px;
}

.es23-close:hover {
    background:
        rgba(255,255,255,.15);
}

.es23-brand {
    display: none !important;
}


/* Messages */

.es23-messages {
    min-height: 0;
    flex: 1 1 auto;

    padding: 15px 13px;

    overflow-y: auto;

    background:
        #faf9f8;
}

.es23-msg {
    width: fit-content;
    max-width: 84%;

    margin-bottom: 9px;

    padding:
        9px
        11px;

    border:
        1px solid
        #ebe5e1;

    border-radius:
        12px
        12px
        12px
        4px;

    background:
        #fff;

    color:
        var(--es-chat-text);

    box-shadow:
        0 2px 7px
        rgba(65,42,32,.04);

    white-space:
        pre-wrap;

    overflow-wrap:
        anywhere;

    font-size: 12px;
    line-height: 1.4;
}

.es23-msg.is-user {
    margin-left: auto;

    border-color:
        var(--es-chat-brown);

    border-radius:
        12px
        12px
        4px
        12px;

    background:
        var(--es-chat-brown);

    color: #fff;
}

.es23-msg a {
    color: inherit;

    font-weight: 700;
}


/* Быстрые ответы — оставляем функцию, но не Jivo-стиль */

.es23-quick {
    display: flex;
    flex-wrap: wrap;

    gap: 6px;

    padding:
        4px
        12px
        10px;

    background:
        #faf9f8;
}

.es23-quick button {
    padding:
        7px
        10px;

    border:
        1px solid
        #cdbbb1;

    border-radius: 9px;

    background:
        #fff;

    color:
        var(--es-chat-brown);

    cursor: pointer;

    font-size: 10px;
    font-weight: 700;
}

.es23-quick button:hover {
    border-color:
        var(--es-chat-brown);

    background:
        var(--es-chat-beige);
}


/* Guest / identity bar */

.es23-who {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 10px;

    padding:
        8px
        12px;

    border-top:
        1px solid
        var(--es-chat-border);

    background:
        #fff;

    color:
        var(--es-chat-muted);

    font-size: 10px;
}

.es23-who button {
    border: 0;

    background:
        transparent;

    color:
        var(--es-chat-brown);

    cursor: pointer;

    font-size: 10px;
    font-weight: 800;
}

.es23-who button:hover {
    text-decoration: underline;
}


/* Status */

.es23-status-line {
    color:
        #8b4c34;

    background:
        #fff7f3;

    font-size: 10px;
}

.es23-status-line:not(:empty) {
    padding:
        6px
        12px;
}


/* Composer */

.es23-compose {
    display: grid;

    grid-template-columns:
        auto
        1fr
        auto;

    gap: 7px;

    padding:
        10px;

    border-top:
        1px solid
        var(--es-chat-border);

    background:
        #fff;
}

.es23-compose textarea {
    min-height: 40px;
    max-height: 105px;

    padding:
        9px
        8px;

    border:
        0;

    outline: 0;

    resize: vertical;

    color:
        var(--es-chat-text);

    font:
        12px/1.35
        Arial,
        sans-serif;
}

.es23-compose textarea::placeholder {
    color:
        #9c938e;
}

.es23-file,
.es23-send {
    align-self: center;

    width: 40px;
    height: 40px;

    border: 0;
    border-radius: 10px;

    cursor: pointer;
}

.es23-file {
    background:
        var(--es-chat-beige);

    color:
        var(--es-chat-brown);

    font-size: 18px;
}

.es23-file:hover {
    background:
        var(--es-chat-beige-2);
}

.es23-send {
    background:
        var(--es-chat-brown);

    color: #fff;

    font-size: 20px;
    font-weight: 800;
}

.es23-send:hover {
    background:
        var(--es-chat-brown-dark);
}


/* Consent modal */

.es23-modal {
    position: fixed;
    inset: 0;

    z-index: 2147482500;

    display: none;
    align-items: center;
    justify-content: center;

    padding: 16px;

    background:
        rgba(35,27,23,.46);
}

.es23-modal.is-open {
    display: flex;
}

.es23-modal-card {
    position: relative;

    width:
        min(
            430px,
            100%
        );

    max-height:
        calc(100vh - 32px);

    overflow-y: auto;

    padding: 20px;

    border:
        1px solid
        var(--es-chat-border);

    border-radius: 14px;

    background: #fff;

    box-shadow:
        0 24px 70px
        rgba(45,31,25,.25);
}

.es23-modal-card h3 {
    margin:
        0
        0
        7px;

    color:
        var(--es-chat-brown);

    font-size: 16px;
}

.es23-modal-card p {
    color:
        var(--es-chat-muted);

    font-size: 11px;
    line-height: 1.45;
}

.es23-modal-card label {
    display: block;

    margin-bottom: 10px;
}

.es23-modal-card label > span {
    display: block;

    margin-bottom: 4px;

    font-size: 10px;
    font-weight: 800;
}

.es23-modal-card input[type="text"],
.es23-modal-card input[type="tel"],
.es23-modal-card input[type="email"] {
    box-sizing:
        border-box;

    width: 100%;

    padding:
        9px
        10px;

    border:
        1px solid
        var(--es-chat-border);

    border-radius: 8px;

    outline: none;
}

.es23-modal-card input:focus {
    border-color:
        var(--es-chat-brown);
}

.es23-consent {
    display: flex !important;
    align-items: flex-start;

    gap: 7px;
}

.es23-consent span {
    font-weight:
        400 !important;
}

.es23-consent a {
    color:
        var(--es-chat-brown);

    font-weight: 800;
}

.es23-primary,
.es23-secondary {
    width: 100%;

    margin-top: 7px;

    padding:
        10px
        12px;

    border-radius: 8px;

    cursor: pointer;

    font-size: 11px;
    font-weight: 800;
}

.es23-primary {
    border: 0;

    background:
        var(--es-chat-brown);

    color: #fff;
}

.es23-primary:hover {
    background:
        var(--es-chat-brown-dark);
}

.es23-secondary {
    border:
        1px solid
        #cdbbb1;

    background: #fff;

    color:
        var(--es-chat-brown);
}

.es23-modal-close {
    position: absolute;
    top: 9px;
    right: 9px;

    width: 30px;
    height: 30px;

    border: 0;
    border-radius: 7px;

    background:
        var(--es-chat-beige);

    color:
        var(--es-chat-brown);

    cursor: pointer;

    font-size: 21px;
}

.es23-modal-error {
    min-height: 17px;

    color: #a12d2d;

    font-size: 10px;
}


/* Mobile */

@media (max-width: 600px) {
    .es23-launcher {
        right: 13px;
        bottom: 13px;
    }

    .es23-chat {
        right: 7px;
        bottom: 80px;

        width:
            calc(100vw - 14px);

        height:
            min(
                670px,
                calc(100vh - 92px)
            );
    }
}

/* ===== EUROSPACE CHAT V2.3 MOBILE ADAPTATION ===== */

.es23-chat,
.es23-modal {
    -webkit-tap-highlight-color:
        transparent;
}

.es23-launcher,
.es23-close,
.es23-file,
.es23-send,
.es23-who button,
.es23-quick button,
.es23-modal-close,
.es23-primary,
.es23-secondary {
    touch-action:
        manipulation;
}

@media (max-width: 600px) {
    .es23-launcher {
        right:
            max(
                12px,
                env(safe-area-inset-right)
            );

        bottom:
            max(
                12px,
                env(safe-area-inset-bottom)
            );

        width: 54px;
        height: 54px;

        font-size: 22px;
    }

    .es23-chat {
        left: 6px;
        right: 6px;

        top:
            calc(
                var(
                    --es23-visual-top,
                    0px
                )
                + 6px
            );

        bottom: auto;

        width: auto;

        height:
            calc(
                var(
                    --es23-visual-height,
                    100dvh
                )
                - 12px
            );

        max-height: 720px;

        border-radius: 14px;

        overscroll-behavior:
            contain;
    }

    .es23-head {
        flex: 0 0 auto;

        padding:
            13px
            58px
            12px
            14px;
    }

    .es23-head strong {
        font-size: 14px;
    }

    .es23-head span {
        margin-top: 2px;

        font-size: 11px;
    }

    .es23-close {
        right: 9px;

        width: 44px;
        height: 44px;

        border-radius: 10px;

        font-size: 25px;
    }

    .es23-messages {
        min-height: 0;

        padding:
            12px
            10px;

        overscroll-behavior-y:
            contain;

        -webkit-overflow-scrolling:
            touch;
    }

    .es23-msg {
        max-width: 88%;

        padding:
            9px
            10px;

        font-size: 13px;
        line-height: 1.42;
    }

    .es23-quick {
        flex: 0 0 auto;

        gap: 6px;

        padding:
            5px
            10px
            9px;

        overflow-x: auto;

        flex-wrap: nowrap;

        -webkit-overflow-scrolling:
            touch;

        scrollbar-width:
            none;
    }

    .es23-quick::-webkit-scrollbar {
        display: none;
    }

    .es23-quick button {
        flex:
            0
            0
            auto;

        min-height: 40px;

        padding:
            8px
            11px;

        white-space:
            nowrap;

        font-size: 11px;
    }

    .es23-who {
        flex: 0 0 auto;

        min-height: 44px;

        box-sizing:
            border-box;

        padding:
            7px
            10px;

        font-size: 11px;
    }

    .es23-who button {
        min-height: 36px;

        padding:
            0
            6px;

        font-size: 11px;
    }

    .es23-status-line {
        flex: 0 0 auto;

        font-size: 11px;
    }

    .es23-compose {
        flex: 0 0 auto;

        grid-template-columns:
            46px
            minmax(
                0,
                1fr
            )
            46px;

        align-items:
            end;

        gap: 6px;

        padding:
            8px
            9px
            calc(
                8px
                + env(
                    safe-area-inset-bottom
                )
            );

        background:
            #fff;
    }

    .es23-compose textarea {
        box-sizing:
            border-box;

        width: 100%;

        min-height: 46px;
        max-height: 112px;

        padding:
            11px
            8px;

        font-size: 16px;
        line-height: 1.28;

        resize: none;
    }

    .es23-file,
    .es23-send {
        width: 46px;
        height: 46px;

        min-width: 46px;
        min-height: 46px;

        border-radius: 12px;
    }

    .es23-file {
        font-size: 19px;
    }

    .es23-send {
        font-size: 23px;
    }

    .es23-modal {
        align-items:
            flex-end;

        padding:
            calc(
                8px
                + var(
                    --es23-visual-top,
                    0px
                )
            )
            6px
            calc(
                8px
                + env(
                    safe-area-inset-bottom
                )
            );

        overflow: hidden;
    }

    .es23-modal-card {
        box-sizing:
            border-box;

        width: 100%;

        max-height:
            calc(
                var(
                    --es23-visual-height,
                    100dvh
                )
                - 16px
            );

        padding:
            17px
            14px
            calc(
                15px
                + env(
                    safe-area-inset-bottom
                )
            );

        border-radius:
            15px
            15px
            12px
            12px;

        -webkit-overflow-scrolling:
            touch;

        overscroll-behavior:
            contain;
    }

    .es23-modal-close {
        width: 44px;
        height: 44px;

        font-size: 24px;
    }

    .es23-modal-card h3 {
        padding-right: 46px;

        font-size: 16px;
    }

    .es23-modal-card p {
        font-size: 12px;
        line-height: 1.45;
    }

    .es23-modal-card label > span {
        font-size: 11px;
    }

    .es23-modal-card input[type="text"],
    .es23-modal-card input[type="tel"],
    .es23-modal-card input[type="email"] {
        min-height: 46px;

        padding:
            10px
            11px;

        font-size: 16px;
    }

    .es23-consent {
        gap: 9px;
    }

    .es23-consent input[type="checkbox"] {
        flex:
            0
            0
            22px;

        width: 22px;
        height: 22px;

        margin-top: 1px;
    }

    .es23-consent span {
        font-size: 12px !important;
        line-height: 1.35;
    }

    .es23-primary,
    .es23-secondary {
        min-height: 46px;

        padding:
            11px
            12px;

        font-size: 12px;
    }
}

@media (max-width: 360px) {
    .es23-chat {
        left: 3px;
        right: 3px;

        top:
            calc(
                var(
                    --es23-visual-top,
                    0px
                )
                + 3px
            );

        height:
            calc(
                var(
                    --es23-visual-height,
                    100dvh
                )
                - 6px
            );

        border-radius: 11px;
    }

    .es23-head {
        padding-left: 11px;
    }

    .es23-msg {
        max-width: 92%;
    }

    .es23-compose {
        grid-template-columns:
            44px
            minmax(
                0,
                1fr
            )
            44px;

        padding-left: 6px;
        padding-right: 6px;
    }

    .es23-file,
    .es23-send {
        width: 44px;
        height: 44px;

        min-width: 44px;
        min-height: 44px;
    }
}

@media
    (max-width: 900px)
    and
    (max-height: 500px)
    and
    (orientation: landscape) {

    .es23-chat {
        left: 8px;
        right: 8px;

        top:
            calc(
                var(
                    --es23-visual-top,
                    0px
                )
                + 4px
            );

        height:
            calc(
                var(
                    --es23-visual-height,
                    100dvh
                )
                - 8px
            );

        max-height: none;
    }

    .es23-head {
        padding-top: 9px;
        padding-bottom: 8px;
    }

    .es23-head strong {
        font-size: 13px;
    }

    .es23-head span {
        font-size: 10px;
    }

    .es23-quick {
        display: none;
    }

    .es23-compose textarea {
        min-height: 44px;
        max-height: 70px;
    }

    .es23-modal-card {
        max-height:
            calc(
                var(
                    --es23-visual-height,
                    100dvh
                )
                - 10px
            );
    }
}


/* ES_CHAT_DELETE_V4 */
.es23-file-delete-v4 {
    display: inline-block;
    margin: 5px 0 0 8px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
    opacity: .82;
}

.es23-file-delete-v4:hover {
    opacity: 1;
}

.es23-file-delete-v4:disabled {
    cursor: default;
    opacity: .55;
}
