.ai-page {
    min-height: calc(100vh - var(--nav-top-h));
    padding-bottom: 2px;
    background:
        linear-gradient(180deg, rgba(var(--c-primary-rgb), 0.07), transparent 34%),
        var(--c-page-bg);
}

body[data-module="ai_concierge"] .site-footer {
    display: none;
}

.ai-shell {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    width: min(920px, calc(100% - 24px));
    height: calc(100vh - var(--nav-top-h) - 24px);
    min-height: 0;
    margin: 0 auto;
    padding: var(--sp-3) 0;
}

@supports (height: 100dvh) {
    .ai-page {
        min-height: calc(100dvh - var(--nav-top-h));
    }

    .ai-shell {
        height: calc(100dvh - var(--nav-top-h) - 24px);
    }
}

@media (max-width: 899.98px) {
    .ai-page {
        min-height: calc(100vh - 48px - var(--nav-bottom-h));
    }

    .ai-shell {
        height: calc(100vh - 48px - var(--nav-bottom-h));
    }

    @supports (height: 100dvh) {
        .ai-page {
            min-height: calc(100dvh - 48px - var(--nav-bottom-h));
        }

        .ai-shell {
            height: calc(100dvh - 48px - var(--nav-bottom-h));
        }
    }
}

.ai-scroll {
    display: flex;
    min-height: 0;
    flex-direction: column;
    overflow-y: auto;
}

.ai-header {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) 84px var(--sp-3) 0;
}

.ai-header__back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(var(--c-primary-rgb), 0.18);
    border-radius: var(--r-full);
    background: var(--c-bg);
    color: var(--c-text);
    text-decoration: none;
}

.ai-header__copy {
    min-width: 0;
}

.ai-header__avatar {
    display: grid;
    position: fixed;
    top: calc(var(--nav-top-h) + var(--sp-4));
    right: max(12px, calc((100vw - 920px) / 2));
    z-index: 3;
    place-items: center start;
    overflow: visible;
    flex: 0 0 auto;
    width: 76px;
    height: 64px;
    margin-left: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.ai-header__avatar img {
    display: block;
    width: 76px;
    max-width: 100%;
    height: auto;
    max-height: 64px;
    object-fit: contain;
    image-rendering: auto;
    transform: none;
}

.ai-shell.is-busy .ai-header__avatar {
    animation: aiHeaderAvatarThink 1.05s ease-in-out infinite;
}

.ai-shell.is-busy .ai-header__avatar img {
    transform-origin: 50% 70%;
    animation: aiHeaderAvatarFloat 1.05s ease-in-out infinite;
}

.ai-header__copy p {
    margin: 0 0 2px;
    color: var(--c-primary);
    font-size: var(--text-xs);
    font-weight: var(--fw-bold);
    text-transform: uppercase;
}

.ai-header__copy h1 {
    margin: 0;
    color: var(--c-text);
    font-size: 1.4rem;
    line-height: var(--lh-tight);
}

.ai-thread {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    padding: var(--sp-3) 2px var(--sp-5);
}

.ai-message {
    display: flex;
}

.ai-message--user {
    justify-content: flex-end;
}

.ai-message__bubble {
    width: fit-content;
    max-width: min(680px, 88%);
    padding: var(--sp-3) var(--sp-4);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: var(--r-md);
    background: var(--c-bg);
    color: var(--c-text);
    box-shadow: var(--sh-xs);
}

.ai-message--user .ai-message__bubble {
    border-color: rgba(var(--c-primary-rgb), 0.22);
    background: rgba(var(--c-primary-rgb), 0.08);
    color: var(--c-text);
}

.ai-message__bubble p {
    margin: 0;
    line-height: var(--lh-relaxed);
}

.ai-message--error .ai-message__bubble {
    border-color: rgba(220, 38, 38, 0.22);
    background: rgba(220, 38, 38, 0.06);
    color: var(--c-error);
}

.ai-message--loading .ai-message__bubble {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 74px;
}

.ai-loading-avatar {
    display: grid;
    place-items: center;
    overflow: hidden;
    width: 34px;
    height: 34px;
    padding: 4px;
    border: 1px solid rgba(var(--c-primary-rgb), 0.14);
    border-radius: var(--r-full);
    background:
        radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.92), rgba(var(--c-primary-rgb), 0.08)),
        var(--c-bg);
    animation: aiAvatarPulse 1.35s ease-in-out infinite;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.10);
}

.ai-loading-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: saturate(1.06) contrast(1.04);
}

.ai-typing {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 24px;
}

.ai-typing span {
    display: block;
    width: 7px;
    height: 7px;
    border-radius: var(--r-full);
    background: rgba(var(--c-primary-rgb), 0.58);
    animation: aiTyping 1s ease-in-out infinite;
}

.ai-typing span:nth-child(2) {
    animation-delay: 0.14s;
}

.ai-typing span:nth-child(3) {
    animation-delay: 0.28s;
}

@keyframes aiTyping {
    0%, 80%, 100% {
        opacity: 0.42;
        transform: translateY(0);
    }

    40% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

@keyframes aiAvatarPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 6px 16px rgba(15, 23, 42, 0.10), 0 0 0 0 rgba(var(--c-primary-rgb), 0.18);
    }

    50% {
        transform: scale(1.06);
        box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12), 0 0 0 8px rgba(var(--c-primary-rgb), 0);
    }
}

@keyframes aiHeaderAvatarThink {
    0%, 100% {
        opacity: 1;
        filter: drop-shadow(0 8px 12px rgba(15, 23, 42, 0.12));
    }

    50% {
        opacity: 0.9;
        filter: drop-shadow(0 12px 18px rgba(var(--c-primary-rgb), 0.28));
    }
}

@keyframes aiHeaderAvatarFloat {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }

    25% {
        transform: translateY(-5px) rotate(-3deg);
    }

    50% {
        transform: translateY(1px) rotate(2deg);
    }

    75% {
        transform: translateY(-4px) rotate(3deg);
    }
}

.ai-card-list,
.ai-action-list {
    display: grid;
    gap: var(--sp-2);
    width: min(680px, 100%);
    margin-top: var(--sp-2);
}

.ai-card {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: var(--sp-3);
    align-items: start;
    padding: var(--sp-2);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: var(--r-md);
    background: var(--c-bg);
    box-shadow: var(--sh-xs);
}

.ai-card--event {
    grid-template-columns: 1fr;
}

.ai-card--variant {
    grid-template-columns: 1fr;
}

.ai-card__top {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: var(--sp-3);
    align-items: start;
}

.ai-card__media {
    align-self: start;
    overflow: hidden;
    width: 88px;
    aspect-ratio: 1 / 1;
    border-radius: var(--r-sm);
    background: rgba(var(--c-primary-rgb), 0.08);
}

.ai-card__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ai-card__intro {
    display: grid;
    align-content: start;
    gap: 6px;
    min-width: 0;
}

.ai-card__body {
    display: grid;
    align-content: start;
    gap: 6px;
    min-width: 0;
}

.ai-card__body--full {
    width: 100%;
}

.ai-card__title {
    margin: 0;
    color: var(--c-text);
    font-size: var(--text-sm);
    font-weight: var(--fw-bold);
    line-height: var(--lh-snug);
}

.ai-card__badges,
.ai-card__facts {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.ai-card__badges {
    margin-bottom: 0;
}

.ai-card__badges span {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 8px;
    border-radius: var(--r-full);
    background: rgba(var(--c-primary-rgb), 0.09);
    color: var(--c-primary);
    font-size: 0.68rem;
    font-weight: var(--fw-bold);
    line-height: 1;
}

.ai-card__meta,
.ai-card__price {
    margin: 0;
    color: var(--c-text-muted);
    font-size: var(--text-xs);
    line-height: var(--lh-snug);
}

.ai-card__facts {
    margin-top: 0;
}

.ai-card__facts span {
    color: var(--c-text);
    font-size: var(--text-xs);
    font-weight: var(--fw-bold);
    line-height: var(--lh-snug);
}

.ai-card__facts span + span {
    color: var(--c-text-muted);
    font-weight: var(--fw-medium);
}

.ai-card__actions,
.ai-action-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
}

.ai-card__actions {
    align-items: center;
    flex-wrap: nowrap;
    margin-top: 2px;
}

.ai-action,
.ai-card__action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 var(--sp-3);
    border: 1px solid rgba(var(--c-primary-rgb), 0.22);
    border-radius: var(--r-full);
    background: rgba(var(--c-primary-rgb), 0.08);
    color: var(--c-primary);
    font-size: var(--text-xs);
    font-weight: var(--fw-bold);
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.ai-action:hover,
.ai-card__action:hover {
    border-color: rgba(var(--c-primary-rgb), 0.34);
    background: rgba(var(--c-primary-rgb), 0.13);
}

.ai-card__action[disabled] {
    opacity: 0.52;
    cursor: not-allowed;
}

.ai-quote {
    display: grid;
    gap: var(--sp-2);
    width: min(680px, 100%);
    margin-top: var(--sp-3);
    padding: var(--sp-3);
    border: 1px solid rgba(var(--c-primary-rgb), 0.16);
    border-radius: var(--r-md);
    background: rgba(var(--c-primary-rgb), 0.05);
}

.ai-quote__head,
.ai-quote-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
}

.ai-quote__head span {
    color: var(--c-text-muted);
    font-size: var(--text-xs);
    font-weight: var(--fw-bold);
    text-transform: uppercase;
}

.ai-quote__head strong {
    color: var(--c-primary);
    font-size: var(--text-lg);
}

.ai-quote__lines {
    display: grid;
    gap: var(--sp-2);
    padding-top: var(--sp-2);
    border-top: 1px solid rgba(var(--c-primary-rgb), 0.12);
}

.ai-quote-line {
    min-width: 0;
}

.ai-quote-line__title {
    min-width: 0;
    flex: 1;
    color: var(--c-text);
    font-size: var(--text-sm);
    font-weight: var(--fw-bold);
    line-height: var(--lh-snug);
}

.ai-quote-line__meta {
    color: var(--c-text-muted);
    font-size: var(--text-xs);
    white-space: nowrap;
}

.ai-quote-line strong {
    color: var(--c-text);
    font-size: var(--text-sm);
    white-space: nowrap;
}

.ai-quote__note {
    margin: 0;
    color: var(--c-text-muted);
    font-size: var(--text-xs);
    line-height: var(--lh-snug);
}

.ai-composer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px 48px;
    gap: var(--sp-2);
    margin-bottom: 0;
    padding: var(--sp-3);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: var(--r-lg);
    background: rgba(255, 255, 255, 0.86);
    box-shadow: var(--sh-md);
    transform: translateY(3px);
}

.ai-composer__input {
    width: 100%;
    min-width: 0;
    height: 48px;
    padding: 0 var(--sp-3);
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: var(--r-full);
    background: var(--c-bg);
    color: var(--c-text);
    font: inherit;
}

.ai-composer__send,
.ai-composer__voice {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: var(--r-full);
    background: var(--c-primary);
    color: #fff;
    cursor: pointer;
}

.ai-composer__voice {
    border: 1px solid rgba(var(--c-primary-rgb), 0.18);
    background: var(--c-bg);
    color: var(--c-primary);
}

.ai-composer__voice.is-recording {
    border-color: rgba(220, 38, 38, 0.35);
    background: rgba(220, 38, 38, 0.08);
    color: var(--c-error);
}

.ai-composer__voice.is-recording::after {
    width: 8px;
    height: 8px;
    margin-left: -2px;
    border-radius: var(--r-full);
    background: currentColor;
    content: "";
}

.ai-composer__send:disabled,
.ai-composer__voice:disabled,
.ai-composer__input:disabled {
    opacity: 0.62;
    cursor: wait;
}

.ai-shell.is-busy .ai-composer {
    border-color: rgba(var(--c-primary-rgb), 0.18);
}

@media (max-width: 640px) {
    .ai-shell {
        width: calc(100% - 16px);
        height: calc(100vh - 48px - var(--nav-bottom-h));
        min-height: 0;
        padding-top: var(--sp-2);
        padding-bottom: calc(var(--sp-3) + env(safe-area-inset-bottom, 0px));
    }

    @supports (height: 100dvh) {
        .ai-shell {
            height: calc(100dvh - 48px - var(--nav-bottom-h));
        }
    }

    .ai-composer {
        margin-bottom: 0;
    }

    .ai-header__avatar {
        top: calc(48px + var(--sp-2));
        right: 12px;
        width: 64px;
        height: 54px;
        padding: 0;
    }

    .ai-header__avatar img {
        width: 64px;
        max-height: 54px;
    }

    .ai-header {
        padding-right: 72px;
    }

    .ai-card {
        grid-template-columns: 72px minmax(0, 1fr);
    }

    .ai-card--event {
        grid-template-columns: 1fr;
    }

    .ai-card__top {
        grid-template-columns: 72px minmax(0, 1fr);
    }

    .ai-card__media {
        width: 72px;
    }

    .ai-card__actions {
        gap: 6px;
    }

    .ai-card__action {
        min-height: 34px;
        padding: 0 9px;
        font-size: 0.7rem;
    }

    .ai-quote__head,
    .ai-quote-line {
        align-items: flex-start;
        flex-direction: column;
        gap: 2px;
    }
}
