.craft-chatbot {
    --chat-ink: #29251f;
    --chat-muted: #746d62;
    --chat-accent: #a55f3d;
    --chat-paper: #fbf8f1;
    --chat-border: rgba(73, 62, 48, .18);

    font-family: inherit;
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 1200;
    box-sizing: border-box;
}

.craft-chatbot *,
.guided-tour-card,
.guided-tour-card * {
    box-sizing: border-box;
}

[data-chatbot] button {
    height: auto;
    letter-spacing: normal;
    margin: 0;
    max-width: 100%;
    min-height: 0;
    min-width: 0;
    text-transform: none;
    width: auto;
}

.chatbot-launcher,
.chatbot-panel,
.chatbot-idle-prompt {
    box-shadow: 0 14px 40px rgba(27, 24, 20, .2);
}

/* =========================================================
   CHATBOT LAUNCHER
   ========================================================= */

.craft-chatbot .chatbot-launcher {
    align-items: center;
    background: #5b2d1a;
    border: 0;
    border-radius: 999px;
    color: #fff;
    cursor: pointer;
    display: flex;
    font: inherit;
    font-size: 15px;
    font-weight: 650;
    gap: 12px;
    height: 58px;
    justify-content: flex-start;
    min-height: 58px;
    overflow: hidden;
    padding: 0 20px 0 13px;

    transition:
        width 180ms ease,
        padding 180ms ease,
        transform 160ms ease,
        background-color 160ms ease;

    width: 190px;
}

.craft-chatbot .chatbot-launcher-icon {
    align-items: center;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .72);
    border-radius: 50%;
    display: inline-flex;
    flex: 0 0 34px;
    font-size: 19px;
    height: 34px;
    justify-content: center;
    line-height: 1;
    width: 34px;
}

.craft-chatbot .chatbot-launcher-label {
    flex: 1;
    opacity: 1;
    text-align: center;
    white-space: nowrap;

    transition:
        opacity 120ms ease,
        width 180ms ease;
}

.craft-chatbot:not(.is-open) .chatbot-launcher:hover {
    background: #472113;
    transform: translateY(-2px);
}

.craft-chatbot .chatbot-launcher:focus-visible {
    outline: 3px solid #c9916e;
    outline-offset: 3px;
}

/*
 * DESKTOP OPEN STATE
 *
 * Keep the launcher visible while the chatbot is open,
 * but reduce it to a compact X button.
 */
.craft-chatbot.is-open .chatbot-launcher {
    gap: 0;
    justify-content: center;
    padding: 0;
    width: 58px;
}

.craft-chatbot.is-open .chatbot-launcher-label {
    display: none;
}

.craft-chatbot.is-open .chatbot-launcher:hover {
    background: #472113;
}

/* =========================================================
   CHATBOT PANEL
   ========================================================= */

.chatbot-panel,
.chatbot-idle-prompt {
    background: var(--chat-paper);
    border: 1px solid var(--chat-border);
    border-radius: 18px;
    bottom: 68px;
    color: var(--chat-ink);
    position: absolute;
    right: 0;
    width: min(370px, calc(100vw - 28px));
}

.chatbot-panel {
    display: flex;
    flex-direction: column;
    height: 470px;
}

.chatbot-panel[hidden],
.chatbot-idle-prompt[hidden] {
    display: none;
}

/* =========================================================
   HEADER
   ========================================================= */

.chatbot-header {
    align-items: center;
    background: #f4efe8;
    border-radius: 17px 17px 0 0;
    display: flex;
    flex: 0 0 56px;
    height: auto;
    justify-content: space-between;
    min-height: 0;
    padding: 15px 17px;
}

.chatbot-header strong {
    font-size: 15px;
}

.chatbot-header button {
    background: transparent;
    border: 0;
    border-radius: 6px;
    color: var(--chat-ink);
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
}

[data-chatbot] .chatbot-header button {
    height: 36px;
    padding: 0;
    width: 36px;
}

.chatbot-header-close {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 6px;
    color: var(--chat-ink);
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 36px;
    font-size: 24px;
    height: 36px;
    justify-content: center;
    line-height: 1;
    padding: 0;
    width: 36px;
}

.chatbot-header-close:hover {
    background: rgba(41, 37, 31, .07);
}

/* =========================================================
   CONVERSATION
   ========================================================= */

.chatbot-conversation {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 9px;
    max-height: 270px;
    min-height: 0;
    overflow-y: auto;
    padding: 15px;
}

.chatbot-message {
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
    max-width: 92%;
    overflow-wrap: anywhere;
    padding: 10px 12px;
    white-space: pre-wrap;
}

.chatbot-message-assistant {
    align-self: flex-start;
    background: #f3efe9;
}

.chatbot-welcome {
    font-size: 14px;
    line-height: 1.4;
    max-width: 100%;
    padding: 10px 13px;
    white-space: normal;
    width: min(320px, 100%);
}

.chatbot-welcome p {
    margin: 0 0 4px;
}

.chatbot-welcome ul {
    list-style: disc;
    margin: 0;
    padding-left: 19px;
}

.chatbot-welcome li {
    line-height: 1.35;
    margin: 0;
}

.chatbot-welcome li:last-child {
    margin-bottom: 0;
}

.chatbot-welcome p:last-child {
    margin: 6px 0 0;
}

.chatbot-message-customer {
    align-self: flex-end;
    background: #e8daca;
}

.chatbot-enquiry-link {
    color: var(--chat-accent);
    font-size: 13px;
    font-weight: 700;
}

/* =========================================================
   QUICK ACTIONS
   ========================================================= */

.chatbot-quick-actions,
.chatbot-tour-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 0 15px 13px;
}

.chatbot-quick-actions {
    flex: 0 0 80px;
}

.chatbot-quick-actions button,
.chatbot-quick-actions a,
.chatbot-tour-choices button {
    background: #fff;
    border: 1px solid var(--chat-border);
    border-radius: 999px;
    color: var(--chat-ink);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    padding: 7px 10px;
    text-decoration: none;
}

.craft-chatbot .chatbot-quick-actions button,
.craft-chatbot .chatbot-quick-actions a,
.craft-chatbot .chatbot-tour-choices button {
    height: auto;
    margin: 0;
    min-height: 0;
    width: auto;
}

.chatbot-quick-actions button:hover,
.chatbot-quick-actions a:hover,
.chatbot-tour-choices button:hover {
    border-color: var(--chat-accent);
}

/* =========================================================
   CHAT INPUT
   ========================================================= */

.chatbot-form {
    background: transparent;
    backdrop-filter: none;
    border: 0;
    border-radius: 0 0 17px 17px;
    border-top: 1px solid var(--chat-border);
    box-shadow: none;
    flex: 0 0 89px;
    height: 89px;
    margin: 0;
    max-width: none;
    min-height: 0;
    padding: 12px 15px 15px;
    width: auto;
}

.chatbot-form label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
}

.chatbot-form > div {
    display: flex;
    gap: 7px;
    height: 41px;
    margin: 0;
    width: 100%;
}

.chatbot-form input {
    border: 1px solid var(--chat-border);
    border-radius: 9px;
    box-sizing: border-box;
    flex: 1;
    font: inherit;
    min-width: 0;
    padding: 10px;
}

[data-chatbot] .chatbot-form input {
    height: 41px;
    margin: 0;
    min-height: 41px;
    width: auto;
}

.chatbot-form button,
.chatbot-idle-prompt button {
    background: var(--chat-accent);
    border: 0;
    border-radius: 9px;
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 9px 12px;
}

.craft-chatbot .chatbot-form button,
.craft-chatbot .chatbot-idle-prompt button {
    height: auto;
    letter-spacing: normal;
    margin: 0;
    min-height: 0;
    text-transform: none;
    width: auto;
}

.craft-chatbot .chatbot-form button {
    background: var(--chat-accent);
    border: 0;
    border-radius: 9px;
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    height: 41px;
    line-height: normal;
    min-height: 41px;
    padding: 9px 12px;
    text-align: center;
    text-transform: none;
    white-space: nowrap;
}

/* =========================================================
   IDLE PROMPT
   ========================================================= */

.chatbot-idle-prompt {
    bottom: 68px;
    padding: 15px;
    width: min(340px, calc(100vw - 28px));
}

.chatbot-idle-prompt p {
    font-size: 14px;
    line-height: 1.45;
    margin: 0 0 12px;
}

.chatbot-idle-prompt > div {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.chatbot-idle-prompt button:last-child {
    background: #ece8e3;
    color: var(--chat-ink);
}

/* =========================================================
   ACCESSIBILITY
   ========================================================= */

.craft-chatbot button:focus-visible,
.craft-chatbot a:focus-visible,
.craft-chatbot input:focus-visible {
    outline: 3px solid #c9916e;
    outline-offset: 2px;
}

/* =========================================================
   GUIDED TOUR
   ========================================================= */

.guided-tour-backdrop {
    inset: 0;
    pointer-events: none;
    position: fixed;
    z-index: 11990;
}

.guided-tour-backdrop-pane {
    background: rgba(20, 18, 16, .66);
    pointer-events: none;
    position: fixed;
}

.guided-tour-highlight {
    outline: 4px solid #c9916e !important;
    outline-offset: 3px !important;
    position: relative !important;
    z-index: 11995 !important;
    box-shadow:
        0 0 0 7px rgba(201, 145, 110, .24) !important;
}

.guided-tour-card {
    background: #fff;
    border: 1px solid #e5ded5;
    border-radius: 15px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, .28);
    box-sizing: border-box;
    color: #242321;
    max-width: min(380px, calc(100vw - 24px));
    padding: 18px;
    position: fixed;
    width: 380px;
    z-index: 12005;
}

.guided-tour-progress {
    color: #81452d;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    margin: 0 0 8px;
}

.guided-tour-card h2 {
    font-size: 19px;
    margin: 0 0 9px;
}

.guided-tour-card > p:not(.guided-tour-progress) {
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}

.guided-tour-actions {
    align-items: center;
    display: flex;
    gap: 7px;
    justify-content: flex-end;
    margin-top: 18px;
}

.guided-tour-actions button {
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    padding: 9px 12px;
}

.guided-tour-actions button {
    height: auto;
    letter-spacing: normal;
    margin: 0;
    min-height: 0;
    min-width: 0;
    text-transform: none;
    width: auto;
}

.guided-tour-primary {
    background: #302c26;
    color: #fff;
}

.guided-tour-secondary,
.guided-tour-end {
    background: #f1ede8;
    color: #2d2925;
}

.guided-tour-card button:focus-visible {
    outline: 3px solid #c9916e;
    outline-offset: 2px;
}

/* =========================================================
   MOBILE FULL-SCREEN CHATBOT
   ========================================================= */

@media (max-width: 520px) {
    body.chatbot-mobile-open {
        overflow: hidden;
    }

    .craft-chatbot {
        bottom: 12px;
        right: 12px;
    }

    /*
     * Mobile closed state:
     * keep the normal Need help? launcher.
     */
    .craft-chatbot:not(.is-open) .chatbot-launcher {
        max-width: calc(100vw - 24px);
        width: min(190px, calc(100vw - 24px));
    }

    /*
     * Mobile open state:
     * hide the floating launcher because the chatbot itself
     * becomes full-screen.
     */
    .craft-chatbot.is-open .chatbot-launcher {
        display: none;
    }

    .chatbot-panel {
        border: 0;
        border-radius: 0;
        bottom: auto;
        height: 100dvh;
        inset: 0;
        max-height: none;
        position: fixed;
        right: auto;
        width: 100vw;
        z-index: 1210;
    }

    .chatbot-header {
        border-radius: 0;
        flex: 0 0 auto;
        min-height: 64px;

        padding:
            max(14px, env(safe-area-inset-top))
            18px
            14px;
    }

    .chatbot-header strong {
        font-size: 17px;
    }

    /*
     * On mobile the header control becomes X.
     */
    .chatbot-header-close {
        align-items: center;
        display: inline-flex;
        flex: 0 0 44px;
        font-size: 30px;
        height: 44px;
        justify-content: center;
        width: 44px;
    }

    .chatbot-conversation {
        flex: 1 1 auto;
        max-height: none;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 18px;
    }

    .chatbot-message {
        font-size: 14px;
    }

    .chatbot-welcome {
        width: min(100%, 420px);
    }

    .chatbot-quick-actions {
        flex: 0 0 auto;
        padding: 12px 18px 14px;
    }

    .chatbot-quick-actions button,
    .chatbot-quick-actions a,
    .chatbot-tour-choices button {
        font-size: 13px;
        padding: 9px 12px;
    }

    .chatbot-tour-choices {
        padding: 0 18px 14px;
    }

    /*
     * Composer stays at the bottom of the full-screen panel.
     */
    .chatbot-form {
        background: var(--chat-paper);
        border-radius: 0;
        flex: 0 0 auto;
        height: auto;

        padding:
            12px
            18px
            max(16px, env(safe-area-inset-bottom));
    }

    .chatbot-form label {
        font-size: 13px;
    }

    .chatbot-form > div {
        height: 46px;
    }

    [data-chatbot] .chatbot-form input {
        height: 46px;
        min-height: 46px;
    }

    .craft-chatbot .chatbot-form button {
        height: 46px;
        min-height: 46px;
        padding-left: 16px;
        padding-right: 16px;
    }

    /*
     * Idle prompt remains floating until the user actually
     * opens the chatbot.
     */
    .chatbot-idle-prompt {
        bottom: 64px;
        right: 0;
        width: calc(100vw - 24px);
    }

    .guided-tour-card {
        max-width: calc(100vw - 24px);
    }
}


@media (prefers-reduced-motion: reduce) {
    .chatbot-launcher,
    .chatbot-launcher-label {
        transition: none;
    }
}
