.felix-launcher,
.felix-chat {
    --felix-navy: var(--forest, #0d1f30);
    --felix-gold: var(--gold-lt, #dbbe7a);
    --felix-muted: var(--text-mid, #2a4a6b);
    --felix-paper: var(--white, #fdfaf6);
    --felix-sand: var(--ivory-2, #ede6d8);
    font-family: var(--ff-body, system-ui, sans-serif);
    color: var(--felix-navy);
}

.felix-launcher,
.felix-chat {
    position: fixed;
    right: max(1rem, env(safe-area-inset-right));
    bottom: max(1rem, env(safe-area-inset-bottom));
}

.felix-launcher {
    z-index: 950;
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    padding: .35rem 1rem .35rem .35rem;
    border: 1px solid var(--felix-gold);
    border-radius: 100px;
    background: var(--felix-navy);
    color: var(--felix-paper);
    box-shadow: 0 .4rem 1.2rem #0d1f3033;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.felix-avatar {
    display: block;
    width: 2.5rem;
    height: 2.5rem;
    overflow: hidden;
    border-radius: 50%;
    background: var(--felix-sand);
    flex: none;
}

.felix-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 24% 14%;
    transform: scale(2.55);
    transform-origin: 32% 19%;
}

.felix-chat {
    top: auto;
    left: auto;
    margin: 0;
    padding: 0;
    width: min(26rem, calc(100vw - 2rem));
    max-width: none;
    height: min(40rem, calc(100dvh - 2rem));
    max-height: none;
    border: 1px solid var(--felix-sand);
    border-radius: 1.1rem;
    background: var(--felix-paper);
    box-shadow: 0 1rem 3rem #0d1f303b;
    overflow: hidden;
}

.felix-chat[open] {
    display: flex;
    flex-direction: column;
}

.felix-chat::backdrop { background: #0d1f3030; }
.felix-chat [hidden] { display: none !important; }

@media (prefers-reduced-motion: no-preference) {
    .felix-launcher { transition: transform 140ms ease-out; }
    .felix-launcher:active { transform: scale(.97); }

    .felix-chat[open] {
        transform-origin: right bottom;
        animation: felix-panel-in 280ms cubic-bezier(.2, .8, .2, 1) both;
    }

    .felix-chat[open]::backdrop {
        animation: felix-backdrop-in 200ms ease-out both;
    }

    .felix-chat[open].is-closing {
        animation: felix-panel-out 200ms cubic-bezier(.4, 0, 1, 1) both;
    }

    .felix-chat[open].is-closing::backdrop {
        animation: felix-backdrop-out 200ms ease-in both;
    }

    @keyframes felix-panel-in {
        from { opacity: 0; transform: translateY(.85rem) scale(.94); }
        to { opacity: 1; transform: translateY(0) scale(1); }
    }

    @keyframes felix-backdrop-in {
        from { opacity: 0; }
        to { opacity: 1; }
    }

    @keyframes felix-panel-out {
        to { opacity: 0; transform: translateY(.85rem) scale(.94); }
    }

    @keyframes felix-backdrop-out {
        to { opacity: 0; }
    }
}

.felix-header {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex: none;
    padding: .85rem 1rem;
    background: var(--felix-navy);
    color: var(--felix-paper);
}

.felix-title {
    flex: 1;
    font-size: 1.1rem;
    line-height: 1.2;
    font-weight: 600;
}

.felix-title small {
    display: block;
    margin-top: .2rem;
    color: var(--felix-gold);
    font-size: .78rem;
    font-weight: 400;
}

.felix-header button {
    min-width: 44px;
    min-height: 44px;
    padding: 0 .6rem;
    border: 1px solid #ffffff38;
    border-radius: .45rem;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.felix-header .felix-close { font-size: 1.55rem; }

.felix-scroll {
    flex: 1;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    padding: 1rem;
}

.felix-welcome {
    margin: 0 0 1rem;
    padding: .85rem 1rem;
    border-left: 2px solid var(--felix-gold);
    background: #f5f0e8;
    color: var(--felix-muted);
    font-size: .98rem;
    line-height: 1.5;
}

.felix-categories {
    display: flex;
    gap: .4rem;
    flex-wrap: wrap;
    margin-bottom: .65rem;
}

.felix-categories button {
    min-height: 44px;
    padding: .35rem .75rem;
    border: 1px solid var(--felix-sand);
    border-radius: 100px;
    background: transparent;
    color: var(--felix-muted);
    font: inherit;
    font-size: .9rem;
    cursor: pointer;
}

.felix-categories button[aria-pressed="true"] {
    background: var(--felix-navy);
    border-color: var(--felix-navy);
    color: var(--felix-paper);
}

.felix-actions {
    display: grid;
    gap: .45rem;
}

.felix-action {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-height: 48px;
    padding: .5rem .75rem;
    border: 1px solid var(--felix-sand);
    border-radius: .55rem;
    background: transparent;
    color: var(--felix-navy);
    font: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.felix-action:hover { background: #f5f0e8; }
.felix-action strong { display: block; font-weight: 600; }
.felix-action small { display: block; color: var(--felix-muted); font-size: .84rem; line-height: 1.3; }

.felix-action svg {
    width: 1.25rem;
    height: 1.25rem;
    flex: none;
    color: #826526;
}

.felix-action-arrow { margin-left: auto; color: var(--felix-muted); }
.felix-action--booking { background: #f5f0e8; border-color: #ae9050; }
.felix-chat button:disabled { opacity: .56; cursor: wait; }

.felix-messages {
    display: flex;
    align-items: flex-start;
    flex-direction: column;
    gap: .65rem;
}

.felix-message {
    max-width: 93%;
    margin: 0;
    padding: .65rem .85rem;
    border-radius: .6rem;
    background: #f5f0e8;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.felix-message strong { display: block; font-size: .78rem; font-weight: 600; }
.felix-message--user { align-self: flex-end; background: var(--felix-navy); color: var(--felix-paper); }

.felix-status {
    margin: 0;
    color: var(--felix-muted);
    font-size: .88rem;
}

.felix-status:not(:empty) { padding: .35rem 1rem; }
.felix-status[data-error="true"] { color: #8a3131; }

.felix-compose {
    display: flex;
    align-items: end;
    gap: .45rem;
}

.felix-bottom {
    flex: none;
    padding: .7rem .8rem max(.65rem, env(safe-area-inset-bottom));
    border-top: 1px solid var(--felix-sand);
    background: var(--felix-paper);
}

.felix-compose textarea {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    max-height: 6rem;
    margin: 0;
    padding: .55rem .7rem;
    resize: none;
    border: 1px solid #9eafa6;
    border-radius: .5rem;
    background: #fff;
    color: var(--felix-navy);
    font: inherit;
    font-size: 16px;
    line-height: 1.4;
}

.felix-compose button {
    min-width: 44px;
    min-height: 44px;
    border: 0;
    border-radius: .5rem;
    background: var(--felix-navy);
    color: var(--felix-paper);
    font: inherit;
    font-size: 1.25rem;
    cursor: pointer;
}

.felix-note {
    margin: .35rem 0 0;
    color: var(--felix-muted);
    font-size: .76rem;
    line-height: 1.3;
}
.felix-note a { color: inherit; text-decoration: underline; }
.felix-chat :focus-visible, .felix-launcher:focus-visible { outline: 2px solid #a5842e; outline-offset: 2px; }

@media (max-width: 480px) {
    .felix-chat {
        right: .5rem;
        bottom: .5rem;
        width: calc(100% - 1rem);
        height: min(46rem, calc(100dvh - 1rem));
        border-radius: .8rem;
    }
    .felix-scroll { padding: .75rem; }
    .felix-header { padding: .7rem .75rem; }
}
