.faq-chat { position: fixed; right: var(--s-5, 24px); bottom: var(--s-5, 24px); z-index: 90; font-family: var(--f-body, sans-serif); font-size: 15px; color: var(--c-ink, #241c16); }
.faq-chat [hidden], .faq-chat[hidden] { display: none !important; }
.faq-chat .faq-chat__launcher { display: flex; align-items: center; gap: 10px; margin-left: auto; padding: 14px 20px; border-radius: 40px; background: var(--c-oxide, #a63d2f); color: white; box-shadow: 0 6px 24px #241c1626; }
.faq-chat__panel { display: flex; flex-direction: column; width: min(360px, calc(100vw - 32px)); height: min(520px, calc(100dvh - 120px)); margin-bottom: 12px; background: var(--c-paper, #fbf6ef); border: 1px solid var(--c-rule, #e4d5c1); border-radius: 20px; box-shadow: 0 16px 48px #241c1626; overflow: hidden; }
.faq-chat { display: flex; flex-direction: column-reverse; align-items: flex-end; }
.faq-chat__header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; background: var(--c-ink, #241c16); color: white; }
.faq-chat__header h2 { margin: 0 0 3px; color: white; font-size: 21px; }
.faq-chat__header p { margin: 0; font-size: 12px; color: var(--c-rule, #e4d5c1); }
.faq-chat .faq-chat__close { width: 36px; height: 36px; padding: 0; border: 1px solid #ffffff40; border-radius: 50%; color: white; background: transparent; font-size: 24px; }
.faq-chat__messages { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px; }
.faq-chat__message { max-width: 94%; margin-bottom: 12px; padding: 12px 14px; background: white; border: 1px solid var(--c-rule, #e4d5c1); border-radius: 14px 14px 14px 3px; line-height: 1.55; overflow-wrap: anywhere; }
.faq-chat__message p { margin: 0; }
.faq-chat__message a { display: block; margin-top: 10px; color: var(--c-oxide, #a63d2f); text-decoration: underline; }
.faq-chat__message--user { margin-left: auto; background: var(--c-raised, #f2e8da); border-radius: 14px 14px 3px 14px; }
.faq-chat .faq-chat__question { display: block; width: 100%; padding: 10px; margin-top: 8px; white-space: normal; text-align: left; font: inherit; color: var(--c-oxide, #a63d2f); background: transparent; border: 1px solid var(--c-rule, #e4d5c1); border-radius: 9px; line-height: 1.4; }
.faq-chat .faq-chat__question:hover { background: var(--c-raised, #f2e8da); }
.faq-chat__topics { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 16px 10px; }
.faq-chat__topics .button { padding: 6px 10px; font-size: 12px; border-radius: 20px; border: 1px solid var(--c-rule, #e4d5c1); background: white; color: var(--c-ink, #241c16); }
.faq-chat__form { display: flex; align-items: center; gap: 8px; margin: 0; padding: 12px 16px; border-top: 1px solid var(--c-rule, #e4d5c1); background: white; }
.faq-chat .faq-chat__form input { width: 100%; min-width: 0; flex: 1; margin: 0; padding: 10px; border: 1px solid var(--c-rule, #e4d5c1); border-radius: 9px; font-size: 16px; }
.faq-chat .faq-chat__send { flex: 0 0 40px; width: 40px; height: 40px; padding: 0; border-radius: 50%; font-size: 22px; }
.faq-chat__footer { padding: 0 16px 12px; font-size: 11px; color: var(--c-ink-soft, #5c4f45); background: white; }
.faq-chat .faq-chat__reset { padding: 2px 4px; margin-left: 4px; background: transparent; border: 0; color: var(--c-oxide, #a63d2f); text-decoration: underline; font-size: 11px; }
.faq-chat button { cursor: pointer; }
.faq-chat :focus-visible { outline: 3px solid var(--c-focus, #2f6e63); outline-offset: 2px; }
.faq-chat__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 600px) { .faq-chat { right: 16px; bottom: max(12px, env(safe-area-inset-bottom)); } }

.faq-chat__message p { white-space: pre-line; }

/* Database-driven topic browsing and compact question results. */
.faq-chat__browse { padding: 12px 16px 4px; border-top: 1px solid var(--c-rule); }
.faq-chat__browse label { display: block; margin-bottom: 6px; color: var(--c-ink-soft); font-size: 12px; font-weight: 600; }
.faq-chat__browse select { width: 100%; min-width: 0; margin: 0 0 8px; padding: 8px 32px 8px 10px; border-radius: 9px; font-size: 14px; text-overflow: ellipsis; background-color: white; }
.faq-chat .faq-chat__topics { padding: 0 0 8px; flex-wrap: wrap; }
.faq-chat .faq-chat__topics .button { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.faq-chat .faq-chat__question { padding: 11px 12px; background: var(--c-paper); }
.faq-chat__question small { display: block; margin-bottom: 3px; color: var(--c-ink-soft); font-size: 10px; font-weight: 400; }
.faq-chat__question span { display: block; }
.faq-chat .faq-chat__more { width: 100%; margin-top: 10px; padding: 8px; background: transparent; border: 0; color: var(--c-oxide); font-size: 12px; }
.faq-chat .faq-chat__more:hover { background: var(--c-oxide-tint); }

/* Rise from the help button each time the chat opens. */
@keyframes faq-chat-pop-up {
    0% { opacity: 0; transform: translateY(24px) scale(.95); }
    75% { opacity: 1; transform: translateY(-3px) scale(1.005); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}
.faq-chat__panel:not([hidden]) {
    transform-origin: bottom right;
    animation: faq-chat-pop-up 380ms cubic-bezier(.2, .75, .3, 1) both;
}
@media (prefers-reduced-motion: reduce) {
    .faq-chat__panel:not([hidden]) { animation: none; }
}

.faq-chat__panel.is-closing { animation: none; pointer-events: none; }

.faq-chat.faq-chat--debug { bottom: 76px; }

.faq-chat--movable .faq-chat__launcher { touch-action: none; user-select: none; cursor: grab; }
.faq-chat--movable.is-dragging .faq-chat__launcher { cursor: grabbing; box-shadow: 0 12px 32px #241c1640; }
.faq-chat--movable .faq-chat__panel { position: fixed; margin: 0; }
.faq-chat--movable.is-dragging .faq-chat__panel { animation: none; }
