#clinic-chat { --chat-viewport-height: 100dvh; font-family: var(--font-body, sans-serif); color: #151523; }
.clinic-chat-launcher { position: fixed; bottom: 30px; right: 104px; z-index: 1500; width: 66px; height: 66px; border: 0; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; background: linear-gradient(145deg, #9d294c, #72152f); color: white; box-shadow: 0 7px 26px #65132d40; cursor: pointer; font: inherit; }
.clinic-chat-launcher span { font-size: 10px; font-weight: 600; }
.clinic-chat-panel { position: fixed; z-index: 1501; bottom: 110px; right: 30px; width: min(400px, calc(100vw - 32px)); height: 620px; max-height: calc(var(--chat-viewport-height) - 130px); display: flex; flex-direction: column; overflow: hidden; background: #fffaf7; border: 1px solid #e5cbc5; border-radius: 22px; box-shadow: 0 16px 65px #30101c35; }
.clinic-chat-panel[hidden] { display: none; }
.clinic-chat-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; background: linear-gradient(125deg, #8e1f3f, #65132d); color: white; flex-shrink: 0; }
.clinic-chat-header h2 { font: 600 17px var(--font-body, sans-serif); margin: 0 0 4px; color: white; }
.clinic-chat-header p { font-size: 11px; margin: 0; color: #ffe6e3; }
.clinic-chat-close { width: 44px; height: 44px; border: 0; border-radius: 50%; background: #ffffff15; color: white; font-size: 28px; cursor: pointer; flex-shrink: 0; }
.clinic-chat-note { padding: 10px 18px; margin: 0; background: #f5e8e2; font-size: 10px; line-height: 1.6; color: #65525b; flex-shrink: 0; }
.clinic-chat-log { flex: 1; min-height: 50px; overflow-y: auto; overscroll-behavior: contain; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.clinic-chat-message { max-width: 94%; padding: 12px 14px; align-self: flex-start; border: 1px solid #ead9d3; background: #fff; border-radius: 4px 16px 16px; font-size: 12px; line-height: 1.75; overflow-wrap: anywhere; flex-shrink: 0; }
.clinic-chat-message-label { display: block; color: #8e1f3f; font-weight: 600; font-size: 10px; margin-bottom: 4px; }
.clinic-chat-message p { margin: 0; white-space: pre-line; }
.clinic-chat-message a { display: inline-block; margin-top: 8px; color: #8e1f3f; font-weight: 600; text-underline-offset: 3px; }
.clinic-chat-message--user { align-self: flex-end; background: #f3e5de; border-radius: 16px 4px 16px 16px; }
.clinic-chat-suggestions { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 14px 10px; flex-shrink: 0; }
.clinic-chat-suggestions button { border: 1px solid #dbb4bc; background: transparent; color: #8e1f3f; border-radius: 18px; font: 500 10px var(--font-body, sans-serif); padding: 8px 10px; min-height: 34px; cursor: pointer; }
.clinic-chat-suggestions button:hover { background: #f3e5de; }
.clinic-chat-form { display: flex; gap: 8px; margin: 0 14px; padding: 10px 0; border-top: 1px solid #ead9d3; flex-shrink: 0; }
.clinic-chat-form input { width: 100%; min-width: 0; border: 1px solid #dec8c2; border-radius: 10px; padding: 11px; background: #fff; color: #151523; font: 13px var(--font-body, sans-serif); }
.clinic-chat-form button { border: 0; border-radius: 10px; padding: 0 14px; background: #8e1f3f; color: #fff; font: 600 12px var(--font-body, sans-serif); cursor: pointer; }
.clinic-chat-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 0 16px 12px; flex-shrink: 0; }
.clinic-chat-footer a, .clinic-chat-reset { color: #8e1f3f; font: 500 11px var(--font-body, sans-serif); }
.clinic-chat-reset { border: 0; background: none; padding: 8px 0; cursor: pointer; }
.clinic-chat-sr { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
#clinic-chat :focus-visible { outline: 2px solid #bd4f73; outline-offset: 3px; }
.navbar:has(.nav-menu.active) ~ #clinic-chat { visibility: hidden; }
@media (min-width: 769px) {
    body.clinic-chat-ready .clinic-chat-launcher,
    body.clinic-chat-ready .whatsapp-float,
    body.clinic-chat-ready .back-to-top {
        width: 60px;
        height: 60px;
    }
    body.clinic-chat-ready .clinic-chat-launcher { right: 104px; bottom: 30px; }
    body.clinic-chat-ready .whatsapp-float { right: 30px; bottom: 30px; }
    body.clinic-chat-ready .back-to-top { right: 30px; bottom: 104px; }
}
@media (max-width: 768px) {
    body.clinic-chat-ready .whatsapp-float { display: none; }
    body.clinic-chat-ready .back-to-top { right: 16px; bottom: calc(94px + env(safe-area-inset-bottom, 0px)); }
    .clinic-chat-launcher { right: 16px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); width: 58px; height: 58px; }
    .clinic-chat-panel { right: 12px; bottom: calc(88px + env(safe-area-inset-bottom, 0px)); width: calc(100vw - 24px); max-height: calc(var(--chat-viewport-height) - 110px - env(safe-area-inset-bottom, 0px)); border-radius: 18px; }
    .clinic-chat-form input { font-size: 16px; }
    .clinic-chat-note { font-size: 10px; }
}
@media (max-height: 500px) {
    .clinic-chat-suggestions, .clinic-chat-note { display: none; }
    .clinic-chat-header { padding: 8px 16px; }
    .clinic-chat-log { min-height: 0; }
}

/* Mobile chat occupies the visible screen, including when the keyboard opens. */
@media (max-width: 768px) {
    .clinic-chat-panel {
        top: var(--chat-viewport-top, 0px);
        bottom: auto;
        left: 0;
        right: 0;
        width: 100%;
        height: var(--chat-viewport-height);
        max-height: none;
        box-sizing: border-box;
        border-radius: 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        overscroll-behavior: contain;
    }
    .clinic-chat-log { min-height: 0; -webkit-overflow-scrolling: touch; }
    .clinic-chat-message { font-size: 14px; }
    .clinic-chat-suggestions { flex-wrap: nowrap; overflow-x: auto; }
    .clinic-chat-suggestions button { flex: 0 0 auto; }
    body.clinic-chat-mobile-open .clinic-chat-launcher,
    body.clinic-chat-mobile-open .back-to-top { visibility: hidden; }
    .clinic-chat-compact .clinic-chat-note,
    .clinic-chat-compact .clinic-chat-suggestions { display: none; }
    .clinic-chat-compact .clinic-chat-header { padding: 6px 16px; }
    .clinic-chat-compact .clinic-chat-footer { padding-bottom: 4px; }
}
