.tedi-chat-root {
    --tedi-chat-primary: #00a40c;
    --tedi-chat-primary-deep:
        color-mix(
            in srgb,
            var(--tedi-chat-primary) 78%,
            #0c2530 22%
        );
    --tedi-chat-primary-soft:
        color-mix(
            in srgb,
            var(--tedi-chat-primary) 10%,
            white 90%
        );
    --tedi-chat-surface: #ffffff;
    --tedi-chat-canvas: #f4f7f8;
    --tedi-chat-text: #1f2937;
    --tedi-chat-muted: #7b8794;
    --tedi-chat-line: #e8edf0;

    position: fixed;
    z-index: 1500;
    right:
        var(--tedi-chat-right, 30px);
    bottom:
        var(--tedi-chat-bottom, 35px);
    direction: rtl;
    font-family: inherit;
}

.tedi-chat-root[hidden],
.tedi-chat-panel[hidden],
.tedi-chat-auto-prompt[hidden],
.tedi-chat-view[hidden],
.tedi-chat-status[hidden],
.tedi-chat-welcome[hidden],
.tedi-chat-delay-message[hidden],
.tedi-chat-emoji-panel[hidden] {
    display: none !important;
}

.tedi-chat-launcher {
    position: relative;
    width: 62px;
    height: 62px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 22px;
    background:
        linear-gradient(
            145deg,
            var(--tedi-chat-primary),
            var(--tedi-chat-primary-deep)
        );
    color: #fff;
    box-shadow:
        0 15px 35px
        color-mix(
            in srgb,
            var(--tedi-chat-primary) 28%,
            transparent
        ),
        0 7px 18px
        rgba(15, 23, 42, .16);
    cursor: pointer;
    transition:
        transform .2s ease,
        box-shadow .2s ease;
}

.tedi-chat-launcher:hover {
    transform:
        translateY(-2px)
        scale(1.02);
}

.tedi-chat-launcher:active {
    transform: scale(.96);
}

.tedi-chat-launcher svg {
    width: 31px;
    height: 31px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tedi-chat-launcher__pulse {
    position: absolute;
    inset: -5px;
    border:
        2px solid
        color-mix(
            in srgb,
            var(--tedi-chat-primary) 35%,
            transparent
        );
    border-radius: 25px;
    animation:
        tedi-chat-pulse
        2.4s
        ease-out
        infinite;
    pointer-events: none;
}

@keyframes tedi-chat-pulse {
    0% {
        opacity: .65;
        transform: scale(.92);
    }

    70%,
    100% {
        opacity: 0;
        transform: scale(1.22);
    }
}

.tedi-chat-auto-prompt {
    position: absolute;
    right: 76px;
    bottom: 3px;
    width: max-content;
    max-width: 310px;
    padding: 9px 11px 9px 14px;
    display: flex;
    align-items: center;
    gap: 9px;
    border: 1px solid var(--tedi-chat-line);
    border-radius: 16px;
    background: #fff;
    color: var(--tedi-chat-text);
    box-shadow:
        0 13px 40px
        rgba(15, 23, 42, .16);
    text-align: right;
    font: inherit;
    line-height: 1.7;
    cursor: pointer;
}

.tedi-chat-auto-prompt__avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background:
        var(--tedi-chat-primary);
    color: #fff;
    font-weight: 900;
}

.tedi-chat-panel {
    position: absolute;
    right: 0;
    bottom: 0;
    width:
        min(
            420px,
            calc(100vw - 28px)
        );
    height:
        min(
            680px,
            calc(100vh - 48px)
        );
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border:
        1px solid
        rgba(15, 23, 42, .08);
    border-radius: 24px;
    background:
        var(--tedi-chat-surface);
    box-shadow:
        0 28px 80px
        rgba(15, 23, 42, .22),
        0 8px 28px
        rgba(15, 23, 42, .12);
    animation:
        tedi-chat-panel-in
        .2s
        ease-out;
}

@keyframes tedi-chat-panel-in {
    from {
        opacity: 0;
        transform:
            translateY(12px)
            scale(.97);
    }

    to {
        opacity: 1;
        transform:
            translateY(0)
            scale(1);
    }
}

.tedi-chat-header {
    position: relative;
    min-height: 94px;
    padding: 16px 17px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    overflow: hidden;
    background:
        linear-gradient(
            135deg,
            var(--tedi-chat-primary-deep),
            var(--tedi-chat-primary)
        );
    color: #fff;
}

.tedi-chat-header::after {
    content: "";
    position: absolute;
    width: 180px;
    height: 180px;
    left: -70px;
    top: -95px;
    border-radius: 50%;
    background:
        rgba(255, 255, 255, .10);
}

.tedi-chat-support {
    position: relative;
    z-index: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.tedi-chat-avatar {
    position: relative;
    width: 52px;
    height: 52px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border:
        2px solid
        rgba(255, 255, 255, .9);
    border-radius: 18px;
    background:
        rgba(255, 255, 255, .18);
    box-shadow:
        0 7px 20px
        rgba(0, 0, 0, .12);
    color: #fff;
    font-size: 21px;
    font-weight: 900;
    backdrop-filter: blur(8px);
}

.tedi-chat-avatar__online {
    position: absolute;
    left: -2px;
    bottom: -2px;
    width: 14px;
    height: 14px;
    border:
        3px solid
        var(--tedi-chat-primary-deep);
    border-radius: 50%;
    background: #55e778;
}

.tedi-chat-header-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tedi-chat-header-copy strong {
    overflow: hidden;
    font-size: 16px;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tedi-chat-header-copy > span {
    overflow: hidden;
    max-width: 240px;
    font-size: 11px;
    opacity: .87;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tedi-chat-header-copy small {
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    opacity: .95;
}

.tedi-chat-online-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #58ef79;
    box-shadow:
        0 0 0 3px
        rgba(88, 239, 121, .16);
}

.tedi-chat-close {
    position: relative;
    z-index: 2;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 14px;
    background:
        rgba(255, 255, 255, .13);
    color: #fff;
    cursor: pointer;
    backdrop-filter: blur(6px);
}

.tedi-chat-close:hover {
    background:
        rgba(255, 255, 255, .23);
}

.tedi-chat-close svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

.tedi-chat-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    background:
        radial-gradient(
            circle at top right,
            var(--tedi-chat-primary-soft),
            transparent 40%
        ),
        var(--tedi-chat-canvas);
}

.tedi-chat-content::-webkit-scrollbar {
    width: 5px;
}

.tedi-chat-content::-webkit-scrollbar-thumb {
    border-radius: 99px;
    background: #cfd8dd;
}

.tedi-chat-view {
    min-height: 100%;
    padding: 17px 14px;
}

.tedi-chat-welcome {
    width: fit-content;
    max-width: 87%;
    margin-bottom: 18px;
    padding: 11px 14px;
    border-radius:
        18px
        18px
        6px
        18px;
    background:
        linear-gradient(
            135deg,
            var(--tedi-chat-primary),
            var(--tedi-chat-primary-deep)
        );
    color: #fff;
    box-shadow:
        0 8px 20px
        color-mix(
            in srgb,
            var(--tedi-chat-primary) 18%,
            transparent
        );
    font-size: 13px;
    line-height: 1.9;
    white-space: pre-wrap;
}

.tedi-chat-section-title {
    margin:
        0 2px
        10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.tedi-chat-section-title span {
    color: var(--tedi-chat-text);
    font-size: 12px;
    font-weight: 900;
}

.tedi-chat-section-title small {
    color: var(--tedi-chat-muted);
    font-size: 9px;
}

.tedi-chat-quick-list {
    display: grid;
    gap: 8px;
}

.tedi-chat-quick {
    position: relative;
    width: 100%;
    min-height: 48px;
    padding:
        11px
        14px
        11px
        42px;
    border:
        1px solid
        var(--tedi-chat-line);
    border-radius: 15px;
    background:
        rgba(255, 255, 255, .92);
    color: var(--tedi-chat-text);
    box-shadow:
        0 4px 15px
        rgba(15, 23, 42, .035);
    font: inherit;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.7;
    text-align: right;
    cursor: pointer;
    transition:
        transform .15s ease,
        border-color .15s ease,
        box-shadow .15s ease;
}

.tedi-chat-quick::after {
    content: "‹";
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color:
        var(--tedi-chat-primary);
    font-size: 22px;
    line-height: 1;
}

.tedi-chat-quick:hover {
    transform: translateY(-1px);
    border-color:
        color-mix(
            in srgb,
            var(--tedi-chat-primary) 35%,
            var(--tedi-chat-line)
        );
    box-shadow:
        0 9px 24px
        rgba(15, 23, 42, .07);
}

.tedi-chat-answer-thread,
.tedi-chat-messages {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tedi-chat-bubble {
    position: relative;
    width: fit-content;
    max-width: 84%;
    padding: 10px 13px;
    border-radius: 18px;
    font-size: 13px;
    line-height: 1.85;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.tedi-chat-bubble--customer {
    margin-right: auto;
    border-bottom-left-radius: 6px;
    background:
        linear-gradient(
            135deg,
            var(--tedi-chat-primary),
            var(--tedi-chat-primary-deep)
        );
    color: #fff;
    box-shadow:
        0 6px 18px
        color-mix(
            in srgb,
            var(--tedi-chat-primary) 16%,
            transparent
        );
}

.tedi-chat-bubble--operator,
.tedi-chat-bubble--system {
    margin-left: auto;
    border:
        1px solid
        var(--tedi-chat-line);
    border-bottom-right-radius: 6px;
    background: #fff;
    color: var(--tedi-chat-text);
    box-shadow:
        0 5px 16px
        rgba(15, 23, 42, .055);
}

.tedi-chat-bubble-time {
    display: block;
    margin-top: 4px;
    font-size: 9px;
    opacity: .58;
}

.tedi-chat-back {
    margin-top: 18px;
    min-height: 40px;
    padding: 8px 12px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border:
        1px solid
        color-mix(
            in srgb,
            var(--tedi-chat-primary) 40%,
            transparent
        );
    border-radius: 12px;
    background:
        var(--tedi-chat-primary-soft);
    color:
        var(--tedi-chat-primary-deep);
    font: inherit;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}

.tedi-chat-back svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

.tedi-chat-status,
.tedi-chat-delay-message {
    width: fit-content;
    margin:
        0 auto
        12px;
    padding: 6px 11px;
    border:
        1px solid
        #f2df9b;
    border-radius: 999px;
    background: #fff8d9;
    color: #79620d;
    font-size: 10px;
    line-height: 1.6;
    text-align: center;
}

.tedi-chat-delay-message {
    margin-top: 12px;
}

.tedi-chat-composer {
    position: relative;
    padding:
        9px
        10px
        7px;
    border-top:
        1px solid
        var(--tedi-chat-line);
    background:
        rgba(255, 255, 255, .97);
}

.tedi-chat-composer__inner {
    display: flex;
    align-items: flex-end;
    gap: 7px;
    padding: 5px;
    border:
        1px solid
        #dfe6ea;
    border-radius: 17px;
    background: #f8fafb;
    transition:
        border-color .15s ease,
        box-shadow .15s ease;
}

.tedi-chat-composer__inner:focus-within {
    border-color:
        color-mix(
            in srgb,
            var(--tedi-chat-primary) 45%,
            #dfe6ea
        );
    box-shadow:
        0 0 0 3px
        var(--tedi-chat-primary-soft);
}

.tedi-chat-composer textarea {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 38px;
    max-height: 105px;
    resize: none;
    padding:
        9px
        4px;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--tedi-chat-text);
    font: inherit;
    font-size: 13px;
    line-height: 1.6;
}

.tedi-chat-tool,
.tedi-chat-send {
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 13px;
    cursor: pointer;
}

.tedi-chat-tool {
    background: transparent;
    color: #8a98a4;
    font-size: 23px;
}

.tedi-chat-tool:hover {
    background: #eef2f4;
    color:
        var(--tedi-chat-primary);
}

.tedi-chat-send {
    background:
        linear-gradient(
            135deg,
            var(--tedi-chat-primary),
            var(--tedi-chat-primary-deep)
        );
    color: #fff;
    box-shadow:
        0 5px 12px
        color-mix(
            in srgb,
            var(--tedi-chat-primary) 24%,
            transparent
        );
}

.tedi-chat-send:disabled,
.tedi-chat-composer textarea:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.tedi-chat-send svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tedi-chat-emoji-panel {
    position: absolute;
    right: 10px;
    bottom: 78px;
    width: 230px;
    padding: 9px;
    display: grid;
    grid-template-columns:
        repeat(4, 1fr);
    gap: 5px;
    border:
        1px solid
        var(--tedi-chat-line);
    border-radius: 16px;
    background: #fff;
    box-shadow:
        0 16px 45px
        rgba(15, 23, 42, .18);
    z-index: 4;
}

.tedi-chat-emoji-panel button {
    width: 46px;
    height: 40px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    font-size: 21px;
    cursor: pointer;
}

.tedi-chat-emoji-panel button:hover {
    background: #f0f4f5;
}

.tedi-chat-composer__hint {
    margin-top: 5px;
    padding: 0 7px;
    color: #a0aab3;
    font-size: 8px;
}

@media (max-width: 760px) {
    .tedi-chat-root {
        right:
            var(--tedi-chat-mobile-right, 30px);
        bottom:
            var(--tedi-chat-mobile-bottom, 70px);
    }

    .tedi-chat-launcher {
        width: 56px;
        height: 56px;
        border-radius: 19px;
    }

    .tedi-chat-auto-prompt {
        right: 67px;
        max-width:
            min(
                275px,
                calc(100vw - 92px)
            );
    }

    .tedi-chat-panel {
        position: fixed;
        inset: 0;
        width: 100vw;
        height: 100dvh;
        border: 0;
        border-radius: 0;
    }

    .tedi-chat-header {
        min-height: 84px;
        padding:
            max(
                12px,
                env(safe-area-inset-top)
            )
            13px
            12px;
    }

    .tedi-chat-avatar {
        width: 46px;
        height: 46px;
        border-radius: 16px;
    }

    .tedi-chat-view {
        padding:
            14px
            11px;
    }

    .tedi-chat-bubble {
        max-width: 89%;
    }

    .tedi-chat-composer {
        padding:
            7px
            8px
            max(
                7px,
                env(safe-area-inset-bottom)
            );
    }

    .tedi-chat-composer__hint {
        display: none;
    }

    .tedi-chat-emoji-panel {
        bottom:
            calc(
                69px
                + env(safe-area-inset-bottom)
            );
    }
}


/* ==========================================================
   TEDI_CHAT_FONT_TUNING_V1_1
   Real selectors used by customer Messenger.
   ========================================================== */

.tedi-chat-bubble {
    font-size: 15px;
    line-height: 1.9;
}

.tedi-chat-bubble-time {
    margin-top: 5px;
    font-size: 11px;
    line-height: 1.45;
}

.tedi-chat-composer textarea {
    font-size: 15px;
    line-height: 1.7;
}

.tedi-chat-quick {
    font-size: 14px;
    line-height: 1.75;
}

.tedi-chat-welcome {
    font-size: 14px;
    line-height: 1.9;
}

.tedi-chat-header-copy strong {
    font-size: 17px;
}

.tedi-chat-header-copy > span {
    font-size: 12px;
}

.tedi-chat-header-copy small {
    font-size: 11px;
}

@media (max-width: 760px) {

    .tedi-chat-bubble {
        font-size: 16px;
        line-height: 1.9;
    }

    .tedi-chat-bubble-time {
        font-size: 11px;
    }

    .tedi-chat-composer textarea {
        font-size: 16px;
        line-height: 1.75;
    }

    .tedi-chat-quick {
        font-size: 15px;
        line-height: 1.75;
    }

    .tedi-chat-welcome {
        font-size: 15px;
    }

    .tedi-chat-header-copy strong {
        font-size: 17px;
    }

    .tedi-chat-header-copy > span {
        font-size: 12px;
    }
}


/* ==========================================================
   TEDI_CHAT_MOBILE_VIEWPORT_V1_1
   Keep FAQ/messages scrollable above Android/iOS keyboard.
   ========================================================== */

@media (max-width: 760px) {

    body.tedi-chat-mobile-open {
        overflow: hidden;
        overscroll-behavior: none;
    }


    .tedi-chat-panel {
        inset:
            auto
            0
            auto
            0;

        top:
            var(
                --tedi-chat-visual-top,
                0px
            );

        width: 100vw;

        height:
            var(
                --tedi-chat-visual-height,
                100dvh
            );

        max-height:
            var(
                --tedi-chat-visual-height,
                100dvh
            );

        min-height: 0;
    }


    .tedi-chat-content {
        flex:
            1
            1
            auto;

        min-height: 0;

        overflow-x: hidden;
        overflow-y: auto;

        -webkit-overflow-scrolling:
            touch;

        overscroll-behavior-y:
            contain;

        touch-action:
            pan-y;
    }


    .tedi-chat-view {
        min-height: auto;
    }


    .tedi-chat-quick-list,
    .tedi-chat-answer-thread,
    .tedi-chat-messages {
        min-height: 0;
    }
}


/* TEDI_CHAT_AI_V1 */
.tedi-chat-mode-choice {
    margin: 0 0 16px;
    padding: 13px;
    border: 1px solid rgba(0, 164, 12, 0.18);
    border-radius: 14px;
    background: rgba(0, 164, 12, 0.045);
}

.tedi-chat-mode-choice__title {
    margin-bottom: 9px;
    font-weight: 700;
    font-size: 13px;
}

.tedi-chat-mode-choice__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.tedi-chat-mode-choice__actions button {
    min-height: 42px;
    border-radius: 11px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

.tedi-chat-mode-choice__ai {
    background: var(--tedi-chat-primary);
    color: #fff;
}

.tedi-chat-mode-choice__human {
    background: #fff;
    color: #222;
}

.tedi-chat-ai-handoff {
    align-self: center;
    margin: 0 auto 10px;
    padding: 7px 13px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 999px;
    background: #fff;
    color: #333;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
}

.tedi-chat-bubble--ai {
    align-self: flex-start;
    background: #eef7ff;
    border: 1px solid #d9eaff;
    color: #17324d;
}

@media (max-width: 760px) {
    .tedi-chat-mode-choice__actions {
        grid-template-columns: 1fr;
    }
}


/* TEDI_CHAT_NEW_CONVERSATION_V1 */
.tedi-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.tedi-chat-reset {
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .38);
    border-radius: 14px;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    font: inherit;
    font-size: 25px;
    line-height: 1;
    cursor: pointer;
    transition:
        background .15s ease,
        transform .15s ease;
}

.tedi-chat-reset:hover {
    background: rgba(255, 255, 255, .24);
}

.tedi-chat-reset:active {
    transform: scale(.96);
}

.tedi-chat-reset:disabled {
    cursor: wait;
    opacity: .65;
}

.tedi-chat-reset[hidden] {
    display: none !important;
}

/* TEDI_CHAT_MOBILE_NAV_V2
   Only the bottom-navigation chat entry remains on mobile.
   The temporary highlight leaves original colors untouched. */
@media (max-width: 760px) {
    .tedi-chat-root.tedi-chat-has-mobile-nav .tedi-chat-launcher {
        display: none !important;
    }

    [data-chat-mobile-open].tedi-chat-mobile-attention {
        background: #159957 !important;
        border-color: #159957 !important;
        color: #fff !important;
        box-shadow: 0 0 0 3px rgba(21, 153, 87, 0.22) !important;
    }

    [data-chat-mobile-open].tedi-chat-mobile-attention svg,
    [data-chat-mobile-open].tedi-chat-mobile-attention svg *,
    [data-chat-mobile-open].tedi-chat-mobile-attention span,
    [data-chat-mobile-open].tedi-chat-mobile-attention i {
        color: #fff !important;
    }
}
