.ai-chat-fab {
    position: fixed;
    bottom: 1.4rem;
    right: 1.4rem;
    left: auto;
    z-index: 1200;
    width: 62px;
    height: 62px;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(145deg, #D4B45C, #C9A84C);
    color: #0B1F3A;
    font-size: 1.45rem;
    cursor: pointer;
    box-shadow: 0 12px 30px rgba(201, 168, 76, 0.45);
    display: grid;
    place-items: center;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.ai-chat-fab:hover { transform: translateY(-3px) scale(1.04); }
.ai-chat-fab-pulse {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid rgba(201, 168, 76, 0.7);
    animation: chatPulse 2s ease-out infinite;
    pointer-events: none;
}
@keyframes chatPulse {
    0% { transform: scale(0.85); opacity: 0.8; }
    100% { transform: scale(1.25); opacity: 0; }
}
.ai-chat-panel {
    position: fixed;
    bottom: 5.6rem;
    right: 1.4rem;
    left: auto;
    z-index: 1201;
    width: min(380px, calc(100vw - 1.6rem));
    height: min(560px, calc(100vh - 7.5rem));
    background: #fff;
    border-radius: 22px;
    box-shadow: 0 24px 60px rgba(11, 31, 58, 0.28);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #E8EDF3;
}
.ai-chat-panel[hidden] {
    display: none !important;
}
.ai-chat-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.95rem 1rem;
    background: linear-gradient(135deg, #0B1F3A, #1A3A63);
    color: #fff;
}
.ai-chat-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(201, 168, 76, 0.2);
    color: #C9A84C;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.ai-chat-head strong { display: block; font-size: 0.98rem; }
.ai-chat-head small { color: rgba(255,255,255,0.72); font-size: 0.78rem; }
.ai-chat-close {
    margin-inline-start: auto;
    background: transparent;
    border: 0;
    color: #fff;
    font-size: 1.6rem;
    cursor: pointer;
    line-height: 1;
}
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: linear-gradient(180deg, #F7F9FC, #fff);
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}
.ai-chat-bubble {
    max-width: 86%;
    padding: 0.7rem 0.9rem;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.7;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.ai-chat-bubble a,
.ai-chat-link {
    color: #A88835;
    font-weight: 700;
    text-decoration: underline;
    word-break: break-all;
}
.ai-chat-bubble.user a { color: #F5E6B8; }
.ai-chat-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0 0.75rem 0.55rem;
    background: #fff;
}
.ai-chat-chip {
    border: 1px solid #E8EDF3;
    background: #F7F9FC;
    color: #0B1F3A;
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
}
.ai-chat-bubble.bot {
    align-self: flex-start;
    background: #fff;
    border: 1px solid #E8EDF3;
    color: #1E2A3A;
    border-start-start-radius: 6px;
}
.ai-chat-bubble.user {
    align-self: flex-end;
    background: #0B1F3A;
    color: #fff;
    border-start-end-radius: 6px;
}
.ai-chat-bubble.err {
    background: #FEF2F2;
    color: #991B1B;
    border-color: #FECACA;
}
.ai-chat-typing {
    align-self: flex-start;
    display: flex;
    gap: 4px;
    padding: 0.7rem 0.9rem;
}
.ai-chat-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #C9A84C;
    animation: chatDot 1s infinite ease-in-out;
}
.ai-chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.ai-chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chatDot {
    0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-3px); }
}
.ai-chat-form {
    display: flex;
    gap: 0.45rem;
    padding: 0.75rem;
    border-top: 1px solid #E8EDF3;
    background: #fff;
}
.ai-chat-form input {
    flex: 1;
    border: 1.5px solid #E8EDF3;
    border-radius: 999px;
    padding: 0.7rem 1rem;
    outline: none;
}
.ai-chat-form input:focus { border-color: #C9A84C; }
.ai-chat-form button {
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: #C9A84C;
    color: #0B1F3A;
    cursor: pointer;
}
@media (max-width: 640px) {
    .ai-chat-fab {
        width: 56px;
        height: 56px;
        right: 1rem;
        bottom: calc(1.1rem + env(safe-area-inset-bottom));
        font-size: 1.28rem;
    }
    #ai-chat-root:has(.ai-chat-panel:not([hidden])) .ai-chat-fab {
        opacity: 0;
        pointer-events: none;
    }
    .ai-chat-panel {
        inset: auto 0 0 0;
        width: 100%;
        height: min(88dvh, 640px);
        border-radius: 22px 22px 0 0;
        padding-bottom: env(safe-area-inset-bottom);
    }
    .ai-chat-form input { font-size: 16px; }
}
