:root { --chat-dock-edge-gap: 1rem; }
.chat-dock { position: fixed; right: max(var(--chat-dock-edge-gap), env(safe-area-inset-right)); bottom: max(var(--chat-dock-edge-gap), env(safe-area-inset-bottom)); display: flex; flex-direction: row-reverse; align-items: flex-end; gap: .65rem; width: calc(100% - 2rem); max-width: calc(100% - 2rem); pointer-events: none; z-index: 1040; }
/* Let bottom-of-page controls scroll above the bubbles, badges and focus rings. */
.page:has(+ .chat-dock .quick-chat-toggle, + .chat-dock .private-chat-bubble) > main {
    padding-bottom: calc(var(--quick-chat-toggle-size) + max(var(--chat-dock-edge-gap), env(safe-area-inset-bottom)) + 1rem);
}
.chat-dock > * { pointer-events: auto; }
.chat-dock .private-chat-panel { max-width: 100%; }
.chat-dock > .quick-chat.quick-chat { position: static; flex: 0 0 auto; max-width: none; }
.chat-dock > .quick-chat .quick-chat-panel { position: absolute; right: 0; bottom: calc(var(--quick-chat-toggle-size) + .65rem); margin: 0; max-width: 100%; }
.private-chat-start { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; vertical-align: middle; width: 24px; height: 24px; padding: 3px; border: 0; border-radius: 50%; color: #49748d; background: transparent; cursor: pointer; }
.private-chat-start svg { width: 17px; height: 17px; }
.forum-last-author .community-presence { margin-left: .25rem; }
.forum-last-author .community-presence :is([data-presence-label], [data-presence-time]) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.private-chat-start:hover { background: #dcebf5; color: #214f70; }
.private-chat-start:focus-visible { outline: 2px solid #dbaa45; outline-offset: 2px; }
html[data-bs-theme="dark"] .private-chat-start { color: #a1c3db; }
html[data-bs-theme="dark"] .private-chat-start:hover { background: #30485a; }
html[data-bs-theme="dark"] .private-chat-panel { color: #dce6ed; }
html[data-bs-theme="dark"] .private-chat-bubble { background: #1c2b36; border-color: #6f94ac; }
html[data-bs-theme="dark"] .private-chat-bubble.is-active { border-color: #9cc9e9; }
html[data-bs-theme="dark"] .private-chat-empty { color: #a2b4c1; }
html[data-bs-theme="dark"] .private-chat-member { background: #273d4e; color: #dce6ed; }
html[data-bs-theme="dark"] .private-chat-member-picker { background: #172731; color: #dce6ed; border-color: #405565; }
html[data-bs-theme="dark"] .private-chat-members { border-color: #405565; }
html[data-bs-theme="dark"] .private-chat-member button,
html[data-bs-theme="dark"] .private-chat-candidate button,
html[data-bs-theme="dark"] .private-chat-member-search input,
html[data-bs-theme="dark"] .private-chat-member-search button,
html[data-bs-theme="dark"] .private-chat-member-pages button { background: #233644; border-color: #567184; color: #dce6ed; }
@media (max-width: 420px) {
    :root { --chat-dock-edge-gap: .65rem; }
    .chat-dock { width: calc(100% - 1.3rem); max-width: calc(100% - 1.3rem); }
    .chat-dock .private-chat-panel, .chat-dock > .quick-chat .quick-chat-panel { max-width: 100%; }
}
.forum-discussion-row .forum-last-author { position: relative; z-index: 4; }

.chat-dock .private-chat-panel.is-maximized {
    width: min(960px, calc(100vw - 2rem));
    height: calc(100dvh - 7rem);
    max-height: none;
}
.page[hidden], .chat-dock[hidden], .chat-reply-required [hidden] { display: none !important; }
body:has(.chat-reply-required) { overflow: hidden; }
.chat-dock.chat-reply-required {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: none;
    height: 100dvh;
    z-index: 1100;
    background: var(--bs-body-bg, #fff);
    pointer-events: auto;
}
.chat-reply-required :is(.quick-chat-toggle, .private-chat-bubble) { display: none !important; }
.chat-reply-required > :not(.quick-chat):not(.private-chats) { display: none !important; }
.chat-reply-required[data-required-chat="community"] > .private-chats,
.chat-reply-required:not([data-required-chat="community"]) > .quick-chat { display: none !important; }
.chat-dock.chat-reply-required :is(#quick-chat-panel, #private-chat-panel) {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: none;
    margin: 0;
    border: 0;
    border-radius: 0;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    box-sizing: border-box;
}
.chat-reply-notice {
    flex: 0 0 auto;
    margin: 0;
    padding: .6rem 1rem;
    color: var(--bs-body-color, #294456);
    background: var(--bs-tertiary-bg, #eef4f8);
    border-bottom: 1px solid var(--bs-border-color, #c5d5df);
}
.chat-reply-loading { padding: 2rem; text-align: center; }
.chat-reply-message { margin: .4rem 0 0; padding-left: .75rem; border-left: 3px solid #88a8bf; max-height: 4.5em; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .9em; }
