/* =========================================================
   KINENIK
   STAGE 8A + 8B
   ========================================================= */


/* =========================================================
   CHATBOT WRAPPER
   ========================================================= */

   #kinenik-chatbot {
    position: fixed;

    right: 24px;
    bottom: 24px;

    z-index: 999999;

    font-family: inherit;
}


/* =========================================================
   FLOATING CHAT BUTTON
   ========================================================= */

#kinenik-toggle {
    position: relative;

    width: 60px;
    height: 60px;

    padding: 0;

    border: none;
    border-radius: 50%;

    cursor: pointer;

    background: #111111;
    color: #ffffff;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 24px;

    overflow: visible;

    box-shadow:
        0 8px 30px
        rgba(0, 0, 0, 0.22);

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
}


#kinenik-toggle:hover {
    transform:
        translateY(-2px);

    box-shadow:
        0 12px 35px
        rgba(0, 0, 0, 0.26);
}


/* =========================================================
   FLOATING BUTTON BECOMES X WHEN CHAT IS OPEN
   ========================================================= */

#kinenik-toggle.kinenik-toggle-open {
    font-size: 0;
}


/*
 * Build X from CSS.
 */

#kinenik-toggle.kinenik-toggle-open::before,
#kinenik-toggle.kinenik-toggle-open::after {
    content: "";

    position: absolute;

    left: 50%;
    top: 50%;

    width: 22px;
    height: 2px;

    background: #ffffff;

    border-radius: 4px;

    opacity: 1;

    animation: none;

    transform-origin: center;
}


#kinenik-toggle.kinenik-toggle-open::before {
    transform:
        translate(-50%, -50%)
        rotate(45deg);
}


#kinenik-toggle.kinenik-toggle-open::after {
    transform:
        translate(-50%, -50%)
        rotate(-45deg);
}


/* =========================================================
   UNREAD BADGE
   ========================================================= */

.kinenik-unread-badge {
    position: absolute;

    top: -4px;
    right: -3px;

    width: 20px;
    height: 20px;

    display: flex;
    align-items: center;
    justify-content: center;

    box-sizing: border-box;

    border-radius: 50%;

    background: #e82e3f;
    color: #ffffff;

    border: 2px solid #ffffff;

    font-size: 11px;
    font-weight: 700;
    line-height: 1;

    opacity: 0;

    transform:
        scale(0.65);

    pointer-events: none;

    transition:
        opacity 0.18s ease,
        transform 0.22s ease;

    z-index: 5;
}


.kinenik-unread-badge.kinenik-badge-visible {
    opacity: 1;

    transform:
        scale(1);
}


/*
 * Hide badge once button is serving as close control.
 */

.kinenik-toggle-open
.kinenik-unread-badge {
    display: none;
}


/* =========================================================
   CHAT BUTTON ATTENTION ANIMATION
   ========================================================= */

#kinenik-toggle.kinenik-attention:not(
    .kinenik-toggle-open
) {
    animation:
        kinenik-attention-shake
        0.62s
        ease-in-out
        3;
}


#kinenik-toggle.kinenik-attention:not(
    .kinenik-toggle-open
)::before,
#kinenik-toggle.kinenik-attention:not(
    .kinenik-toggle-open
)::after {
    content: "";

    position: absolute;

    inset: -8px;

    border:
        2px solid
        rgba(17, 17, 17, 0.55);

    border-radius: 50%;

    opacity: 0;

    pointer-events: none;

    animation:
        kinenik-attention-ring
        1.15s
        ease-out
        2;
}


#kinenik-toggle.kinenik-attention:not(
    .kinenik-toggle-open
)::after {
    animation-delay:
        0.28s;
}


@keyframes kinenik-attention-shake {

    0%,
    100% {
        transform:
            rotate(0deg)
            scale(1);
    }

    15% {
        transform:
            rotate(-9deg)
            scale(1.03);
    }

    30% {
        transform:
            rotate(8deg)
            scale(1.04);
    }

    45% {
        transform:
            rotate(-6deg)
            scale(1.03);
    }

    60% {
        transform:
            rotate(5deg)
            scale(1.02);
    }

    75% {
        transform:
            rotate(-3deg)
            scale(1.01);
    }

}


@keyframes kinenik-attention-ring {

    0% {
        transform:
            scale(0.82);

        opacity:
            0.32;
    }

    100% {
        transform:
            scale(1.35);

        opacity:
            0;
    }

}


/* =========================================================
   STAGE 8A WELCOME TEASER
   ========================================================= */

.kinenik-teaser {
    position: absolute;

    right: 0;
    bottom: 76px;

    width: 300px;

    box-sizing: border-box;

    padding: 18px;

    background: #ffffff;
    color: #171717;

    border:
        1px solid
        rgba(17, 17, 17, 0.07);

    border-radius: 16px;

    box-shadow:
        0 18px 50px
        rgba(0, 0, 0, 0.18),
        0 4px 12px
        rgba(0, 0, 0, 0.08);

    cursor: pointer;

    transform-origin:
        bottom right;

    z-index: 2;

    transition:
        opacity 0.25s ease,
        transform 0.28s
            cubic-bezier(
                .2,
                .8,
                .2,
                1
            ),
        visibility 0.25s ease;
}


.kinenik-teaser::after {
    content: "";

    position: absolute;

    right: 26px;
    bottom: -8px;

    width: 16px;
    height: 16px;

    background: #ffffff;

    border-right:
        1px solid
        rgba(17, 17, 17, 0.07);

    border-bottom:
        1px solid
        rgba(17, 17, 17, 0.07);

    transform:
        rotate(45deg);
}


.kinenik-teaser-hidden {
    opacity: 0;

    visibility: hidden;

    pointer-events: none;

    transform:
        translateY(10px)
        scale(0.96);
}


.kinenik-teaser-visible {
    opacity: 1;

    visibility: visible;

    pointer-events: auto;

    transform:
        translateY(0)
        scale(1);
}


.kinenik-teaser-message {
    position: relative;

    z-index: 1;

    margin-bottom: 14px;

    font-size: 15px;
    font-weight: 500;
    line-height: 1.42;
}


.kinenik-teaser-input {
    position: relative;

    z-index: 1;

    min-height: 44px;

    box-sizing: border-box;

    padding:
        0
        13px
        0
        14px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;

    border:
        1px solid
        #d9dee8;

    border-radius: 12px;

    background: #ffffff;

    color: #8b96aa;

    font-size: 13px;

    transition:
        border-color 0.18s ease,
        box-shadow 0.18s ease;
}


.kinenik-teaser:hover
.kinenik-teaser-input,
.kinenik-teaser:focus
.kinenik-teaser-input {
    border-color:
        #aeb7c6;

    box-shadow:
        0 0 0 3px
        rgba(17, 17, 17, 0.04);
}


.kinenik-teaser:focus {
    outline: none;
}


.kinenik-teaser-arrow {
    color: #9ba4b5;

    font-size: 15px;
}


/* =========================================================
   CHAT WINDOW
   ========================================================= */

#kinenik-window {
    position: absolute;

    right: 0;
    bottom: 76px;

    width: 390px;
    height: 620px;

    max-height:
        calc(100vh - 120px);

    background: #ffffff;

    border:
        1px solid
        rgba(0, 0, 0, 0.07);

    border-radius: 22px;

    overflow: hidden;

    display: flex;
    flex-direction: column;

    box-shadow:
        0 24px 70px
        rgba(0, 0, 0, 0.20),
        0 8px 24px
        rgba(0, 0, 0, 0.10);

    transform-origin:
        bottom right;

    animation:
        kinenik-window-open
        0.28s
        cubic-bezier(
            0.2,
            0.8,
            0.2,
            1
        );
}


@keyframes kinenik-window-open {

    from {
        opacity: 0;

        transform:
            translateY(14px)
            scale(0.96);
    }

    to {
        opacity: 1;

        transform:
            translateY(0)
            scale(1);
    }

}


/* =========================================================
   HIDDEN STATE
   ========================================================= */

.kinenik-hidden {
    display: none !important;
}


/* =========================================================
   HEADER
   ========================================================= */

.kinenik-header {
    position: relative;

    min-height: 82px;

    box-sizing: border-box;

    padding:
        16px
        18px;

    background:
        linear-gradient(
            135deg,
            #101010 0%,
            #181818 55%,
            #111111 100%
        );

    color: #ffffff;

    display: flex;
    align-items: center;
    justify-content: space-between;

    flex-shrink: 0;

    border-bottom:
        1px solid
        rgba(255, 255, 255, 0.07);
}


/*
 * Small subtle brand highlight.
 */

.kinenik-header::before {
    content: "";

    position: absolute;

    left: 0;
    top: 0;

    width: 100%;
    height: 2px;

    background:
        linear-gradient(
            90deg,
            transparent,
            rgba(213, 186, 140, 0.85),
            transparent
        );

    opacity: 0.7;
}


/* =========================================================
   HEADER INFO
   ========================================================= */

.kinenik-header-info {
    display: flex;

    align-items: center;

    gap: 12px;

    min-width: 0;
}


/* =========================================================
   HEADER AVATAR
   ========================================================= */

.kinenik-avatar {
    position: relative;

    width: 46px;
    height: 46px;

    flex:
        0
        0
        46px;

    border-radius: 50%;

    background:
        linear-gradient(
            145deg,
            #ffffff,
            #efefef
        );

    color: #111111;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 19px;

    border:
        2px solid
        rgba(255, 255, 255, 0.18);

    box-shadow:
        0 4px 14px
        rgba(0, 0, 0, 0.24);
}


/*
 * Single online indicator beside avatar.
 */

.kinenik-avatar::after {
    content: "";

    position: absolute;

    right: -1px;
    bottom: 1px;

    width: 10px;
    height: 10px;

    box-sizing: border-box;

    border-radius: 50%;

    background:
        #55c77a;

    border:
        2px solid
        #151515;
}


/* =========================================================
   HEADER TITLE
   ========================================================= */

.kinenik-title {
    color: #ffffff;

    font-size: 15px;
    font-weight: 650;

    line-height: 1.25;

    letter-spacing:
        -0.1px;

    white-space: nowrap;

    overflow: hidden;

    text-overflow:
        ellipsis;
}


/* =========================================================
   HEADER STATUS
   ========================================================= */

.kinenik-status {
    margin-top: 5px;

    color:
        rgba(
            255,
            255,
            255,
            0.62
        );

    font-size: 11px;
    font-weight: 400;

    line-height: 1.2;

    display: flex;
    align-items: center;

    gap: 6px;
}


/*
 * We already have the green dot
 * attached to the avatar.
 */

.kinenik-status span {
    display: none;
}


/* =========================================================
   HEADER CLOSE BUTTON
   ========================================================= */

#kinenik-close {
    width: 36px;
    height: 36px;

    min-width: 36px;

    padding: 0;

    border:
        1px solid
        rgba(255, 255, 255, 0.08);

    border-radius: 50%;

    background:
        rgba(255, 255, 255, 0.06);

    color:
        rgba(255, 255, 255, 0.72);

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 24px;
    font-weight: 300;

    line-height: 1;

    cursor: pointer;

    opacity: 1;

    transition:
        background 0.18s ease,
        color 0.18s ease,
        transform 0.18s ease;
}


#kinenik-close:hover {
    background:
        rgba(255, 255, 255, 0.13);

    color: #ffffff;

    transform:
        scale(1.05);
}


#kinenik-close:active {
    transform:
        scale(0.94);
}


/* =========================================================
   MESSAGE AREA
   ========================================================= */

.kinenik-messages {
    flex: 1;

    padding:
        20px
        18px
        16px;

    overflow-y: auto;

    background:
        linear-gradient(
            180deg,
            #f8f8f8 0%,
            #fbfbfb 70%,
            #ffffff 100%
        );

    scrollbar-width:
        thin;

    scrollbar-color:
        #d5d5d5
        transparent;
}


.kinenik-messages::-webkit-scrollbar {
    width: 5px;
}


.kinenik-messages::-webkit-scrollbar-track {
    background: transparent;
}


.kinenik-messages::-webkit-scrollbar-thumb {
    background:
        #d5d5d5;

    border-radius: 20px;
}


/* =========================================================
   MESSAGES
   ========================================================= */

.kinenik-message {
    display: flex;

    gap: 8px;

    margin-bottom: 14px;

    max-width: 90%;
}


.kinenik-bot-message {
    align-items:
        flex-start;
}


.kinenik-user-message {
    margin-left: auto;

    justify-content:
        flex-end;
}


/* =========================================================
   BOT MESSAGE AVATAR
   ========================================================= */

.kinenik-message-avatar {
    width: 28px;
    height: 28px;

    flex:
        0
        0
        28px;

    border-radius: 50%;

    background:
        #151515;

    color: #ffffff;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 13px;

    border:
        1px solid
        rgba(255, 255, 255, 0.08);

    box-shadow:
        0 3px 8px
        rgba(0, 0, 0, 0.12);
}


/* =========================================================
   MESSAGE BUBBLES
   ========================================================= */

.kinenik-bubble {
    padding:
        10px
        13px;

    border-radius: 14px;

    font-size: 14px;

    line-height: 1.5;

    word-wrap:
        break-word;
}


.kinenik-bot-message
.kinenik-bubble {
    background: #ffffff;

    border:
        1px solid
        rgba(0, 0, 0, 0.07);

    color: #242424;

    border-top-left-radius:
        4px;

    box-shadow:
        0 3px 10px
        rgba(0, 0, 0, 0.035);
}


.kinenik-user-message
.kinenik-bubble {
    background:
        #111111;

    color:
        #ffffff;

    border-top-right-radius:
        4px;
}


/* =========================================================
   TYPING INDICATOR — STAGE 8C
   ========================================================= */

.kinenik-typing {
    display: flex;
    align-items: center;
    gap: 8px;

    padding:
        8px
        18px
        14px;

    background: #ffffff;
}


.kinenik-typing-avatar {
    width: 30px;
    height: 30px;

    flex:
        0
        0
        30px;

    border-radius: 50%;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #111111;
    color: #ffffff;

    font-size: 13px;

    box-shadow:
        0 3px 9px
        rgba(0, 0, 0, 0.12);
}


.kinenik-typing-bubble {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    min-height: 38px;

    padding:
        0
        13px;

    width: auto;
    max-width: max-content;

    border:
        1px solid
        rgba(0, 0, 0, 0.04);

    border-radius: 15px;
    border-bottom-left-radius: 5px;

    background: #f1f2f4;
    color: #707888;

    font-size: 13px;
    line-height: 1;

    overflow: visible;

    box-shadow:
        0 3px 9px
        rgba(0, 0, 0, 0.025);
}


.kinenik-typing-label {
    display: inline-block;

    flex: 0 0 auto;

    white-space: nowrap;

    line-height: 1.2;
}


.kinenik-typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 3px;

    flex: 0 0 auto;

    width: auto;

    margin: 0;
    padding: 0;
}


.kinenik-typing-dots span {
    position: static;

    display: block;

    width: 5px;
    height: 5px;
    min-width: 5px;

    margin: 0;
    padding: 0;

    border-radius: 50%;

    background: #838b9a;

    animation:
        kinenik-typing-dot
        1.15s
        infinite
        ease-in-out;
}


.kinenik-typing-dots span:nth-child(2) {
    animation-delay:
        0.14s;
}


.kinenik-typing-dots span:nth-child(3) {
    animation-delay:
        0.28s;
}


@keyframes kinenik-typing-dot {

    0%,
    60%,
    100% {
        transform:
            translateY(0);

        opacity:
            0.5;
    }

    30% {
        transform:
            translateY(-3px);

        opacity:
            1;
    }

}


/* =========================================================
   MESSAGE INPUT AREA
   ========================================================= */

.kinenik-form {
    display: flex;

    gap: 8px;

    padding:
        13px
        14px
        10px;

    background:
        #ffffff;

    border-top:
        1px solid
        rgba(0, 0, 0, 0.07);
}


#kinenik-input {
    flex: 1;

    min-width: 0;

    border:
        1px solid
        #cfcfcf;

    border-radius: 24px;

    padding:
        10px
        14px;

    font-size: 14px;

    outline: none;

    background:
        #ffffff;

    transition:
        border-color 0.18s ease,
        box-shadow 0.18s ease;
}


#kinenik-input:focus {
    border-color:
        #929292;

    box-shadow:
        0 0 0 3px
        rgba(0, 0, 0, 0.035);
}


/* =========================================================
   SEND BUTTON
   ========================================================= */

#kinenik-send {
    width: 42px;
    height: 42px;

    padding: 0;

    border: none;

    border-radius: 50%;

    background:
        #111111;

    color:
        #ffffff;

    cursor: pointer;

    font-size: 18px;

    flex-shrink: 0;

    transition:
        transform 0.18s ease,
        background 0.18s ease;
}


#kinenik-send:hover {
    background:
        #242424;

    transform:
        scale(1.04);
}


#kinenik-send:disabled {
    opacity: 0.5;

    cursor:
        not-allowed;

    transform: none;
}


/* =========================================================
   DISCLAIMER
   ========================================================= */

.kinenik-disclaimer {
    padding:
        5px
        12px
        9px;

    background:
        #ffffff;

    color:
        #999999;

    text-align: center;

    font-size: 9px;
}


/* =========================================================
   LEAD CAPTURE FORM — STAGE 8D
   ========================================================= */

#kinenik-lead-form {
    position: relative;

    margin:
        0
        18px
        18px;

    padding:
        18px;

    background:
        linear-gradient(
            180deg,
            #ffffff 0%,
            #fbfaf8 100%
        );

    border:
        1px solid
        rgba(0, 0, 0, 0.07);

    border-radius: 18px;

    box-shadow:
        0 10px 28px
        rgba(0, 0, 0, 0.07);

    animation:
        kinenik-lead-in
        0.24s
        ease-out;
}


#kinenik-lead-form.kinenik-hidden {
    display: none;
}


@keyframes kinenik-lead-in {

    from {
        opacity: 0;

        transform:
            translateY(8px);
    }

    to {
        opacity: 1;

        transform:
            translateY(0);
    }

}


/* Decorative accent */

#kinenik-lead-form::before {
    content: "";

    position: absolute;

    left: 18px;
    right: 18px;
    top: 0;

    height: 2px;

    border-radius:
        0
        0
        10px
        10px;

    background:
        linear-gradient(
            90deg,
            transparent,
            rgba(210, 176, 119, 0.9),
            transparent
        );
}


/* Title */

.kinenik-lead-title {
    margin:
        0
        0
        6px;

    color:
        #171717;

    font-size:
        17px;

    font-weight:
        650;

    line-height:
        1.3;

    letter-spacing:
        -0.15px;
}


/* Description */

.kinenik-lead-description {
    margin:
        0
        0
        16px;

    color:
        #6f6f6f;

    font-size:
        12.5px;

    line-height:
        1.5;
}


/* Labels */

#kinenik-lead-form label {
    display: block;

    margin:
        11px
        0
        6px;

    color:
        #333333;

    font-size:
        12px;

    font-weight:
        600;

    line-height:
        1.2;
}


#kinenik-lead-form label:first-of-type {
    margin-top: 0;
}


#kinenik-lead-form label span {
    color:
        #8e8e8e;

    font-weight:
        400;
}


/* Inputs */

#kinenik-lead-form input {
    width: 100%;

    min-height: 44px;

    box-sizing:
        border-box;

    padding:
        10px
        13px;

    border:
        1px solid
        #d8d8d8;

    border-radius:
        12px;

    outline:
        none;

    background:
        #ffffff;

    color:
        #222222;

    font-family:
        inherit;

    font-size:
        13.5px;

    line-height:
        1.3;

    transition:
        border-color
        0.18s
        ease,
        box-shadow
        0.18s
        ease,
        background
        0.18s
        ease;
}


#kinenik-lead-form input::placeholder {
    color:
        #a5a5a5;
}


#kinenik-lead-form input:hover {
    border-color:
        #c4c4c4;
}


#kinenik-lead-form input:focus {
    border-color:
        #b28d54;

    background:
        #ffffff;

    box-shadow:
        0 0 0 3px
        rgba(178, 141, 84, 0.12);
}


/* Continue button */

#kinenik-lead-submit {
    width:
        100%;

    min-height:
        44px;

    margin-top:
        16px;

    padding:
        11px
        16px;

    border:
        1px solid
        #111111;

    border-radius:
        12px;

    background:
        #111111;

    color:
        #ffffff;

    font-family:
        inherit;

    font-size:
        13.5px;

    font-weight:
        650;

    line-height:
        1;

    cursor:
        pointer;

    box-shadow:
        0 6px 16px
        rgba(0, 0, 0, 0.12);

    transition:
        transform
        0.18s
        ease,
        background
        0.18s
        ease,
        box-shadow
        0.18s
        ease;
}


#kinenik-lead-submit:hover {
    background:
        #242424;

    transform:
        translateY(-1px);

    box-shadow:
        0 8px 20px
        rgba(0, 0, 0, 0.15);
}


#kinenik-lead-submit:active {
    transform:
        translateY(0);
}


#kinenik-lead-submit:disabled {
    opacity:
        0.58;

    cursor:
        not-allowed;

    transform:
        none;

    box-shadow:
        none;
}


/* Error */

#kinenik-lead-error {
    margin-top:
        10px;

    padding:
        9px
        11px;

    border:
        1px solid
        rgba(176, 53, 53, 0.14);

    border-radius:
        10px;

    background:
        #fff6f6;

    color:
        #a33939;

    font-size:
        12px;

    line-height:
        1.4;
}


#kinenik-lead-error.kinenik-hidden {
    display:
        none;
}


/* Small privacy reassurance */

#kinenik-lead-form::after {
    content:
        "Your details are used only to assist with your inquiry.";

    display:
        block;

    margin-top:
        11px;

    color:
        #9a9a9a;

    text-align:
        center;

    font-size:
        9.5px;

    line-height:
        1.35;
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 600px) {

    #kinenik-chatbot {
        right: 14px;

        bottom: 14px;
    }


    #kinenik-toggle {
        width: 56px;
        height: 56px;
    }


    #kinenik-window {
        right: 0;

        bottom: 68px;

        width:
            calc(100vw - 28px);

        height:
            min(
                680px,
                calc(100vh - 100px)
            );

        max-height:
            calc(100vh - 100px);

        border-radius: 20px;
    }


    .kinenik-header {
        min-height: 76px;

        padding:
            14px
            15px;
    }


    .kinenik-avatar {
        width: 42px;
        height: 42px;

        flex-basis:
            42px;
    }


    .kinenik-title {
        font-size: 14px;
    }


    .kinenik-status {
        font-size: 10px;
    }


    #kinenik-close {
        width: 34px;
        height: 34px;

        min-width: 34px;
    }


    .kinenik-teaser {
        right: 0;

        bottom: 70px;

        width:
            min(
                300px,
                calc(100vw - 28px)
            );

        padding: 16px;

        border-radius: 15px;
    }


    .kinenik-teaser-message {
        font-size: 14px;
    }


    #kinenik-lead-form {
        margin:
            0
            14px
            14px;

        padding:
            16px;

        border-radius:
            16px;
    }


    .kinenik-lead-title {
        font-size:
            16px;
    }


    #kinenik-lead-form input,
    #kinenik-lead-submit {
        min-height:
            43px;
    }

}


/* =========================================================
   REDUCED MOTION ACCESSIBILITY
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    #kinenik-window {
        animation: none;
    }


    #kinenik-toggle.kinenik-attention,
    #kinenik-toggle.kinenik-attention::before,
    #kinenik-toggle.kinenik-attention::after {
        animation: none;
    }


    .kinenik-teaser,
    .kinenik-unread-badge {
        transition: none;
    }

}

/* =========================================================
   STAGE 8C — CONVERSATION POLISH
   ========================================================= */


/* =========================================================
   MESSAGE LAYOUT
   ========================================================= */

   .kinenik-message {
    display: flex;

    align-items: flex-end;

    gap: 8px;

    margin-bottom: 14px;

    max-width: 88%;

    opacity: 0;

    transform:
        translateY(7px);

    transition:
        opacity 0.2s ease,
        transform 0.2s ease;
}


.kinenik-message.kinenik-message-visible {
    opacity: 1;

    transform:
        translateY(0);
}


/* Existing static welcome message may not get the JS class */
.kinenik-messages
.kinenik-message:not(
    .kinenik-message-visible
) {
    opacity: 1;

    transform: none;
}


.kinenik-bot-message {
    margin-right: auto;
}


.kinenik-user-message {
    margin-left: auto;
    margin-right: 0;

    justify-content: flex-end;
    flex-direction: row;

    text-align: left;
}


/* =========================================================
   MESSAGE CONTENT
   ========================================================= */

.kinenik-message-content {
    display: flex;

    flex-direction: column;

    max-width: 100%;
}


.kinenik-user-message .kinenik-message-content {
    align-items: flex-end;
}


/* =========================================================
   BOT AVATAR
   ========================================================= */

.kinenik-message-avatar {
    width: 30px;
    height: 30px;

    flex:
        0
        0
        30px;

    border-radius: 50%;

    display: flex;

    align-items: center;
    justify-content: center;

    background:
        #111111;

    color:
        #ffffff;

    font-size: 13px;

    border:
        1px solid
        rgba(255, 255, 255, 0.08);

    box-shadow:
        0 3px 9px
        rgba(0, 0, 0, 0.12);
}


/* =========================================================
   BUBBLES
   ========================================================= */

.kinenik-bubble {
    padding:
        11px
        14px;

    border-radius: 16px;

    font-size: 14px;

    line-height: 1.5;

    word-break: break-word;
}


/* AI messages */

.kinenik-bot-message
.kinenik-bubble {
    background:
        #ffffff;

    color:
        #202020;

    border:
        1px solid
        rgba(0, 0, 0, 0.07);

    border-bottom-left-radius:
        5px;

    box-shadow:
        0 4px 12px
        rgba(0, 0, 0, 0.04);
}


/* User messages */

.kinenik-user-message
.kinenik-bubble {
    width: fit-content;
    max-width: 100%;

    background:
        linear-gradient(
            135deg,
            #f3e6cf 0%,
            #ead4ae 100%
        );

    color:
        #1d1d1d;

    border:
        1px solid
        rgba(177, 145, 91, 0.22);

    border-radius: 16px;
    border-bottom-right-radius:
        5px;

    box-shadow:
        0 4px 12px
        rgba(0, 0, 0, 0.035);
}


/* =========================================================
   CONVERSATION AREA SPACING
   ========================================================= */

.kinenik-messages {
    padding:
        20px
        18px
        18px;
}


.kinenik-message:last-child {
    margin-bottom: 4px;
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 600px) {

    .kinenik-message {
        max-width:
            92%;
    }


    .kinenik-bubble {
        font-size:
            13.5px;

        padding:
            10px
            12px;
    }


    .kinenik-message-avatar,
    .kinenik-typing-avatar {
        width:
            28px;

        height:
            28px;

        flex-basis:
            28px;
    }


    .kinenik-typing-bubble {
        font-size:
            12.5px;
    }

}


/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    .kinenik-message,
    .kinenik-typing-dots span {
        animation: none;

        transition: none;
    }

}


/* =========================================================
   STAGE 8E — QUICK ACTIONS + MOBILE POLISH
   ========================================================= */


/* =========================================================
   QUICK ACTIONS
   ========================================================= */

.kinenik-quick-actions {
    display: flex;
    flex-wrap: wrap;

    gap: 8px;

    margin:
        -2px
        0
        18px
        38px;

    max-width:
        calc(100% - 38px);

    opacity: 1;

    transition:
        opacity 0.18s ease,
        transform 0.18s ease;
}


.kinenik-quick-actions-hidden {
    opacity: 0;

    transform:
        translateY(-4px);

    pointer-events: none;
}


.kinenik-quick-action {
    min-height: 34px;

    padding:
        7px
        12px;

    border:
        1px solid
        rgba(178, 141, 84, 0.34);

    border-radius:
        999px;

    background:
        #ffffff;

    color:
        #393126;

    font-family:
        inherit;

    font-size:
        11.5px;

    font-weight:
        550;

    line-height:
        1;

    cursor:
        pointer;

    box-shadow:
        0 3px 10px
        rgba(0, 0, 0, 0.035);

    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        transform 0.18s ease,
        box-shadow 0.18s ease;
}


.kinenik-quick-action:hover {
    background:
        #f7f0e5;

    border-color:
        rgba(178, 141, 84, 0.58);

    transform:
        translateY(-1px);

    box-shadow:
        0 5px 12px
        rgba(0, 0, 0, 0.05);
}


.kinenik-quick-action:active {
    transform:
        translateY(0);
}


.kinenik-quick-action:focus-visible {
    outline:
        2px solid
        rgba(178, 141, 84, 0.55);

    outline-offset:
        2px;
}


/* =========================================================
   MOBILE CHAT WINDOW
   ========================================================= */

@media (max-width: 600px) {

    /*
     * Prevent mobile browsers from making the widget feel
     * cramped while keeping space around it.
     */
    #kinenik-window {
        width:
            calc(100vw - 20px);

        height:
            calc(100dvh - 94px);

        max-height:
            calc(100dvh - 94px);

        right:
            -4px;

        bottom:
            68px;

        border-radius:
            18px;
    }


    /*
     * dvh fallback for older mobile browsers.
     */
    @supports not (height: 100dvh) {

        #kinenik-window {
            height:
                calc(100vh - 94px);

            max-height:
                calc(100vh - 94px);
        }

    }


    .kinenik-messages {
        padding:
            16px
            14px
            16px;

        overscroll-behavior:
            contain;

        -webkit-overflow-scrolling:
            touch;
    }


    .kinenik-quick-actions {
        margin:
            -1px
            0
            16px
            36px;

        max-width:
            calc(100% - 36px);

        gap:
            7px;
    }


    .kinenik-quick-action {
        min-height:
            36px;

        padding:
            8px
            12px;

        font-size:
            11.5px;
    }


    /*
     * Make the input comfortably tappable without forcing
     * focus or opening the keyboard programmatically.
     */
    #kinenik-input {
        min-height:
            44px;

        font-size:
            16px;
    }


    /*
     * 16px input font prevents iOS Safari's automatic
     * page zoom when the field is tapped.
     */
    #kinenik-lead-form input {
        font-size:
            16px;
    }


    .kinenik-form {
        flex-shrink:
            0;

        padding:
            10px
            12px
            8px;

        gap:
            8px;
    }


    .kinenik-disclaimer {
        flex-shrink:
            0;

        padding:
            4px
            10px
            8px;
    }


    /*
     * Keep floating close button clear of the device edge.
     */
    #kinenik-toggle {
        width:
            56px;

        height:
            56px;
    }

}


/* =========================================================
   VERY SMALL PHONES
   ========================================================= */

@media (max-width: 380px) {

    #kinenik-window {
        width:
            calc(100vw - 14px);

        right:
            -7px;
    }


    .kinenik-header {
        padding:
            13px
            13px;
    }


    .kinenik-title {
        font-size:
            13.5px;
    }


    .kinenik-quick-actions {
        margin-left:
            34px;

        max-width:
            calc(100% - 34px);
    }

}


/* =========================================================
   REDUCED MOTION — 8E
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    .kinenik-quick-actions,
    .kinenik-quick-action {
        transition:
            none;
    }

}


/* =========================================================
   STAGE 8E.1 — PERSISTENT CONVERSATION HISTORY
   ========================================================= */


/* Previous conversation divider */
.kinenik-history-divider {
    display: flex;
    align-items: center;

    gap: 10px;

    margin:
        2px
        0
        16px;

    color:
        #8b8b8b;

    font-size:
        10.5px;

    font-weight:
        550;

    letter-spacing:
        0.02em;

    text-transform:
        uppercase;
}


.kinenik-history-divider::before,
.kinenik-history-divider::after {
    content: '';

    flex: 1;

    height: 1px;

    background:
        rgba(0, 0, 0, 0.09);
}


.kinenik-history-divider span {
    white-space: nowrap;
}


/* Header action group */
.kinenik-header-actions {
    display: flex;

    align-items: center;

    gap: 6px;

    margin-left: auto;
}


/*
 * The existing close button is moved into this group by JS.
 */
.kinenik-header-actions #kinenik-close {
    margin-left: 0;
}


/* Start-new-conversation control */
.kinenik-new-conversation {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    width: 34px;
    height: 34px;

    padding: 0;

    border:
        1px solid
        rgba(255, 255, 255, 0.13);

    border-radius:
        50%;

    background:
        rgba(255, 255, 255, 0.07);

    color:
        #ffffff;

    font-family:
        inherit;

    font-size:
        19px;

    font-weight:
        400;

    line-height:
        1;

    cursor:
        pointer;

    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        transform 0.18s ease;
}


.kinenik-new-conversation:hover {
    background:
        rgba(255, 255, 255, 0.14);

    border-color:
        rgba(255, 255, 255, 0.22);

    transform:
        rotate(-20deg);
}


.kinenik-new-conversation:active {
    transform:
        rotate(-20deg)
        scale(0.94);
}


.kinenik-new-conversation:focus-visible {
    outline:
        2px solid
        rgba(235, 210, 166, 0.8);

    outline-offset:
        2px;
}


@media (max-width: 600px) {

    .kinenik-header-actions {
        gap: 5px;
    }


    .kinenik-new-conversation {
        width: 32px;
        height: 32px;

        font-size: 18px;
    }


    .kinenik-history-divider {
        margin-bottom: 14px;

        font-size: 10px;
    }

}


@media (prefers-reduced-motion: reduce) {

    .kinenik-new-conversation {
        transition: none;
    }


    .kinenik-new-conversation:hover,
    .kinenik-new-conversation:active {
        transform: none;
    }

}


/* =========================================================
   Stage 9D — Contextual source links
   ========================================================= */

/* =========================================================
   STAGE 9D — CONTEXTUAL SOURCE LINKS
   ========================================================= */

.kinenik-source-links {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-top: 7px;
    max-width: 100%;
}

.kinenik-source-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    padding: 6px 9px;
    border: 1px solid rgba(176, 137, 77, 0.28);
    border-radius: 9px;
    background: rgba(176, 137, 77, 0.07);
    color: #7b5b2d;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.35;
    text-decoration: none;
    overflow-wrap: anywhere;
    transition: background 0.18s ease,
                border-color 0.18s ease,
                transform 0.18s ease;
}

.kinenik-source-link:hover {
    background: rgba(176, 137, 77, 0.12);
    border-color: rgba(176, 137, 77, 0.42);
    transform: translateY(-1px);
}

.kinenik-source-link:focus-visible {
    outline: 2px solid rgba(176, 137, 77, 0.55);
    outline-offset: 2px;
}

.kinenik-source-link-arrow {
    flex: 0 0 auto;
    font-size: 13px;
    line-height: 1;
    transition: transform 0.18s ease;
}

.kinenik-source-link:hover .kinenik-source-link-arrow {
    transform: translateX(2px);
}

@media (max-width: 600px) {
    .kinenik-source-link {
        padding: 7px 9px;
        font-size: 11.5px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .kinenik-source-link,
    .kinenik-source-link-arrow {
        transition: none;
    }

    .kinenik-source-link:hover,
    .kinenik-source-link:hover .kinenik-source-link-arrow {
        transform: none;
    }
}



/* =========================================================
   Kinenik Stage 9H.1 — Branding fixes
   Replace the previous Stage 9H additions with this block.
   Keep this at the END of chatbot.css.
   ========================================================= */

#kinenik-toggle {
    background: var(--kinenik-toggle-bg, #111111) !important;
    color: var(--kinenik-toggle-text, #ffffff) !important;
}

.kinenik-header {
    background: var(--kinenik-header-bg, #111111) !important;
    color: var(--kinenik-header-text, #ffffff) !important;
}

.kinenik-header #kinenik-close,
.kinenik-header .kinenik-new-conversation {
    color: var(--kinenik-header-text, #ffffff) !important;
}

.kinenik-user-message .kinenik-bubble {
    background: var(--kinenik-user-bg, #111111) !important;
    color: var(--kinenik-user-text, #ffffff) !important;
}

.kinenik-bot-message .kinenik-bubble {
    background: var(--kinenik-ai-bg, #ffffff) !important;
    color: var(--kinenik-ai-text, #222222) !important;
}

#kinenik-send,
#kinenik-lead-submit {
    background: var(--kinenik-send-bg, #111111) !important;
    color: var(--kinenik-send-text, #ffffff) !important;
}

.kinenik-source-link,
.kinenik-quick-action {
    color: var(--kinenik-accent, #b0894d) !important;
    border-color: var(--kinenik-accent, #b0894d) !important;
}

.kinenik-avatar,
.kinenik-message-avatar,
.kinenik-typing-avatar {
    overflow: hidden !important;
    flex: 0 0 auto !important;
}

.kinenik-avatar img,
.kinenik-message-avatar img,
.kinenik-typing-avatar img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
}

/* Keep the header logo comfortably contained. */
.kinenik-avatar {
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
}

/* Keep message/typing avatars small and aligned with the bubble. */
.kinenik-message-avatar,
.kinenik-typing-avatar {
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    border-radius: 50% !important;
}

/* Make sure the first server-rendered welcome message aligns like JS messages. */
#kinenik-messages > .kinenik-bot-message {
    align-items: flex-start !important;
    gap: 8px !important;
}

#kinenik-toggle .kinenik-toggle-icon {
    width: 30px !important;
    height: 30px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
}

#kinenik-toggle .kinenik-toggle-icon img {
    display: block !important;
    width: 30px !important;
    height: 30px !important;
    max-width: 30px !important;
    max-height: 30px !important;
    object-fit: contain !important;
    object-position: center !important;
}

/*
 * Existing chatbot behavior intentionally changes the floating button to X
 * while the chat is open. The custom icon is for the CLOSED state.
 */
#kinenik-toggle:not(.kinenik-toggle-open) .kinenik-toggle-icon {
    opacity: 1 !important;
    visibility: visible !important;
}

.kinenik-booking-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    padding: 9px 14px;
    margin: 2px 0 8px;
    background: var(--kinenik-accent, #b0894d);
    color: #ffffff !important;
    text-decoration: none !important;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
}

.kinenik-booking-action:hover {
    opacity: .9;
}
