/* Chat follows the existing Intranet palette. No conversation content is persisted here. */
body:has(#chat-root) { min-width: 0; }
.chat-page { min-width: 0; }
.chat-page h1, .chat-page h2, .chat-page h3, .chat-page p, .chat-page strong, .chat-page label, .chat-dialog h2, .chat-dialog p, .chat-dialog strong { overflow-wrap: anywhere; }
.chat-page .button, .chat-dialog .button { min-height: 42px; max-width: 100%; padding: 10px 14px; line-height: 1.35; white-space: normal; }
.chat-page button:disabled, .chat-dialog button:disabled { opacity: .5; cursor: not-allowed; }
.chat-page :focus-visible, .chat-dialog :focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.chat-page button, .chat-dialog button { transition: background var(--motion-fast), color var(--motion-fast), border-color var(--motion-fast), transform var(--motion-fast); cursor: pointer; }
.chat-page button:active:not(:disabled), .chat-dialog button:active:not(:disabled) { transform: translateY(1px); }
.chat-page [hidden], .chat-dialog [hidden] { display: none !important; }
.chat-sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; clip: rect(0,0,0,0); white-space: nowrap; overflow: hidden; border: 0; }
.chat-page-header { margin-bottom: 20px; }
.chat-page-header > div { min-width: 0; }
.chat-workspace { display: grid; grid-template-columns: minmax(240px, 30%) minmax(0, 1fr); min-height: 480px; height: clamp(480px, calc(100dvh - 220px), 920px); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-surface); box-shadow: var(--shadow-sm); overflow: clip; }
.chat-sidebar { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 1px solid var(--border); }
.chat-sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 20px 16px 14px; }
.chat-sidebar-head h2 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.chat-connection { display: inline-flex; align-items: center; gap: 4px; color: var(--success); font-size: 11px; }
.chat-connection .icon { width: 12px; height: 12px; }
.chat-icon-button { flex: 0 0 42px; width: 42px; padding: 10px !important; }
.chat-icon-button .icon { width: 19px; height: 19px; }
.chat-icon-back { display: inline-flex; transform: rotate(180deg); }
.chat-room-filter { display: flex; align-items: center; gap: 8px; margin: 0 16px 14px; padding: 0 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg-app); }
.chat-room-filter .icon { width: 16px; height: 16px; color: var(--text-muted); }
.chat-room-filter input { width: 100%; min-width: 0; height: 42px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; font-size: 13px; }
.chat-room-filter:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.chat-room-filter input:focus-visible { outline: 0; }
.chat-room-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px 12px; overscroll-behavior: contain; }
.chat-room-section + .chat-room-section { margin-top: 14px; }
.chat-room-section h3 { margin: 8px 10px; color: var(--text-secondary); font-size: 10px; letter-spacing: .09em; text-transform: uppercase; }
.chat-room-entry { display: flex; align-items: center; gap: 11px; width: 100%; min-width: 0; padding: 12px 9px; margin-bottom: 3px; border: 1px solid transparent; border-radius: 10px; background: transparent; text-align: left; }
.chat-room-entry:hover { background: var(--bg-hover); }
.chat-room-entry.is-selected { border-color: var(--brand-100); background: var(--brand-50); }
.chat-avatar { display: inline-flex; justify-content: center; align-items: center; flex: 0 0 39px; width: 39px; height: 39px; border-radius: 12px; background: var(--bg-subtle); color: var(--brand-700); font-weight: 750; font-size: 12px; }
.chat-avatar-main { background: var(--brand-100); }
.chat-room-entry-copy { display: grid; gap: 3px; min-width: 0; flex: 1; }
.chat-room-entry-copy strong { font-size: 13px; line-height: 1.4; }
.chat-room-entry-copy > span { font-size: 11px; color: var(--text-secondary); line-height: 1.45; overflow-wrap: anywhere; }
.chat-room-entry-copy > .chat-room-detail { display: flex; min-width: 0; gap: 7px; align-items: baseline; }
.chat-room-preview { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-room-detail > .chat-muted-label { flex: 0 0 auto; }
.chat-muted-label { color: var(--text-muted); font-weight: 600; }
.chat-notification-filter { margin: 8px; padding: 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg-subtle); }
.chat-notification-filter p { margin: 0 0 8px; font-size: 12px; line-height: 1.5; }
.chat-notification-filter .button { min-height: 36px; font-size: 12px; }
.chat-unread { min-width: 22px; padding: 3px 6px; border-radius: 20px; background: var(--brand-700); color: white; font-weight: 700; font-size: 10px; text-align: center; }
.chat-sidebar-footer { padding: 12px 16px; border-top: 1px solid var(--border); }
.chat-sidebar-footer .button { width: 100%; }
.chat-conversation, .chat-room-content { min-height: 0; min-width: 0; height: 100%; }
.chat-room-content { display: flex; flex-direction: column; }
.chat-room-header { display: flex; gap: 12px; align-items: center; min-height: 80px; padding: 14px 20px; border-bottom: 1px solid var(--border); flex: 0 0 auto; }
.chat-room-title { display: grid; gap: 3px; min-width: 0; flex: 1; padding: 3px 0; border: 0; background: transparent; text-align: left; }
.chat-room-title strong { font-size: 15px; line-height: 1.35; }
.chat-room-title > span { color: var(--text-secondary); font-size: 11px; }
.chat-room-title > .chat-typing { display: flex; align-items: baseline; min-width: 0; gap: 2px; color: var(--brand-800); }
.chat-typing > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-typing-dots { display: inline-flex; flex: 0 0 auto; }
.chat-typing-dots i { font-style: normal; animation: chat-typing-dot 1.2s ease-in-out infinite; }
.chat-typing-dots i:nth-child(2) { animation-delay: .15s; }
.chat-typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes chat-typing-dot { 0%, 65%, 100% { opacity: .35; } 30% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .chat-typing-dots i { animation: none; opacity: 1; } }
.chat-header-actions { display: flex; gap: 0; flex: 0 0 auto; }
.chat-back { display: none !important; }
.chat-timeline { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 24px 22px; background: #fcf9fa; }
.chat-history-action { text-align: center; }
.chat-history-action p { margin: 0 0 14px; color: var(--text-muted); font-size: 10px; }
.chat-history-action .button { font-size: 11px; min-height: 36px; }
.chat-date-divider { display: flex; align-items: center; justify-content: center; margin: 18px 0; font-size: 10px; color: var(--text-secondary); }
.chat-date-divider span { padding: 4px 12px; border: 1px solid var(--border); border-radius: 20px; background: var(--bg-surface); }
.chat-message { display: flex; flex-direction: column; align-items: flex-start; margin-bottom: 12px; min-width: 0; }
.chat-message-own { align-items: flex-end; }
.chat-message-bubble { max-width: min(88%, 620px); min-width: 85px; padding: 10px 13px 7px; border: 1px solid var(--border); border-radius: 3px 13px 13px 13px; background: var(--bg-surface); }
.chat-message-own .chat-message-bubble { border-color: #e8c4d1; background: var(--brand-50); border-radius: 13px 3px 13px 13px; }
.chat-message-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.chat-message-top .chat-message-sender { flex: 1; min-width: 0; }
.chat-message-more { position: relative; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 44px; width: 44px; height: 44px; margin: -11px -13px -11px 0; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--text-secondary); }
.chat-message-chevron { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 7px; font-size: 20px; transition: background var(--motion-fast), color var(--motion-fast); }
.chat-message-chevron .icon { width: 17px; height: 17px; }
.chat-message-more:hover .chat-message-chevron, .chat-message-more[aria-expanded="true"] .chat-message-chevron { background: var(--brand-100); color: var(--brand-700); }
.chat-message-more:active:not(:disabled) .chat-message-chevron { background: var(--border); }
.chat-message-menu { position: fixed; z-index: 1100; width: 280px; display: grid; gap: 6px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--brand-300, #c996aa) transparent; padding: 4px; color: var(--text-primary); font-family: inherit; }
.chat-message-menu :focus-visible { outline: 2px solid var(--focus); outline-offset: -3px; }
.chat-message-menu button { cursor: pointer; transition: background var(--motion-fast), color var(--motion-fast); }
.chat-message-menu button:disabled { cursor: not-allowed; opacity: .5; }
.chat-message-actions { display: grid; gap: 0; padding: 5px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-surface); box-shadow: 0 5px 12px #48152b14; }
.chat-message-actions .button { display: flex; align-items: center; justify-content: flex-start; gap: 12px; width: 100%; min-height: 42px; padding: 9px 12px; border: 0; border-radius: 7px; background: transparent; box-shadow: none; color: var(--text-primary); font-size: 13px; font-weight: 500; line-height: 1.4; text-align: left; white-space: normal; }
.chat-message-actions .button .icon { width: 18px; height: 18px; flex: 0 0 18px; color: var(--text-secondary); }
.chat-message-actions .button:hover { background: var(--bg-subtle); }
.chat-message-actions .button:active:not(:disabled) { background: var(--brand-100); }
.chat-message-actions [data-chat-action="message-delete-confirm"], .chat-message-actions [data-chat-action="message-delete-confirm"] .icon { color: var(--danger); }
.chat-reaction-picker { display: flex; gap: 0; padding: 3px; border: 1px solid var(--border); border-radius: 24px; background: var(--bg-surface); box-shadow: 0 3px 10px #48152b12; }
.chat-reaction-picker button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; min-width: 0; flex: 1 1 0; padding: 4px; border: 1px solid transparent; border-radius: 50%; background: transparent; font-size: 22px; line-height: 1; }
.chat-reaction-picker button:hover, .chat-reaction-picker button[aria-checked="true"] { background: var(--brand-100); border-color: var(--brand-700); }
.chat-reaction-picker button:active:not(:disabled) { background: var(--border); }
@media (prefers-reduced-motion: reduce) { .chat-message-menu button, .chat-message-chevron { transition: none; } }
.chat-reactions { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; max-width: 100%; margin: -3px 8px 0; position: relative; }
.chat-reaction-summary { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 3px 8px; border: 1px solid var(--border); border-radius: 16px; background: var(--bg-surface); color: var(--text-secondary); box-shadow: 0 1px 2px #48152b0d; line-height: 1; }
button.chat-reaction-summary:hover { background: var(--brand-50); border-color: var(--brand-300); }
button.chat-reaction-summary:active { background: var(--brand-100); }
.chat-reaction-emojis { display: inline-flex; align-items: center; gap: 2px; font-size: 16px; }
.chat-reaction-count { font-size: 11px; font-weight: 650; }
.chat-reactions > .button { min-height: 32px; padding: 5px 8px; font-size: 11px; }
.chat-pinned-label { display: inline-block; color: var(--brand-800); font-size: 10px; font-weight: 650; margin: 3px 0 6px; }
.chat-pin-bar { flex: 0 0 auto; border-bottom: 1px solid var(--border); background: var(--bg-surface); padding: 8px 16px; }
.chat-pin-summary { display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0; border: 0; border-radius: 6px; padding: 5px 0; color: var(--text-primary); background: transparent; text-align: left; }
.chat-pin-summary > span:nth-child(2) { display: grid; gap: 2px; flex: 1; min-width: 0; }
.chat-pin-summary strong { font-size: 11px; color: var(--brand-800); }
.chat-pin-summary > span:nth-child(2) > span { font-size: 12px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.chat-pin-symbol { color: var(--brand-800); font-size: 22px; }
.chat-organization-pending { flex: 0 0 auto; max-height: 144px; overflow-y: auto; padding: 8px 16px; border-bottom: 1px solid var(--border); background: var(--bg-subtle); }
.chat-organization-pending > div { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 12px; padding: 3px 0; }
.chat-organization-pending span { flex: 1 1 180px; color: var(--text-secondary); font-size: 12px; }
.chat-organization-pending .button { min-height: 36px; padding: 7px 10px; font-size: 12px; }
.chat-pin-entry { display: grid; gap: 7px; padding: 15px 0; border-bottom: 1px solid var(--border); }
.chat-pin-entry:last-child { border-bottom: 0; padding-bottom: 0; }
.chat-pin-entry > strong { font-size: 13px; }
.chat-pin-entry > p { margin: 0; font-size: 13px; white-space: pre-wrap; max-height: 180px; overflow-y: auto; }
.chat-pin-until { color: var(--text-secondary); font-size: 11px; }
.chat-pin-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 3px; }
.chat-pin-actions .button { font-size: 12px; }
.chat-pin-preview { border-left: 3px solid var(--brand-700); border-radius: 7px; background: var(--bg-subtle); padding: 12px; max-height: 180px; overflow: auto; margin-bottom: 12px; }
.chat-pin-preview strong { font-size: 12px; color: var(--brand-800); }
.chat-pin-preview p { font-size: 13px; line-height: 1.5; margin: 6px 0 0; white-space: pre-wrap; }
.chat-pin-custom { margin-top: 14px; }
.chat-info-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chat-info-actions .button { min-width: 0; }
.chat-shared-tabs { display: flex; padding: 4px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg-subtle); gap: 4px; }
.chat-shared-tabs button { flex: 1; min-width: 0; min-height: 40px; padding: 8px 12px; background: transparent; border: 1px solid transparent; border-radius: 6px; color: var(--text-secondary); font-weight: 650; }
.chat-shared-tabs button[aria-pressed="true"] { background: var(--bg-surface); color: var(--brand-800); border-color: var(--border); }
.chat-shared-status { margin: 12px 0; color: var(--text-secondary); font-size: 12px; line-height: 1.55; }
.chat-shared-entry { display: grid; gap: 9px; padding: 15px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.chat-shared-entry:last-child { border-bottom: 0; }
.chat-shared-entry > .button { justify-self: start; font-size: 12px; }
.chat-shared-media { display: flex; align-items: center; gap: 12px; background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 9px; padding: 12px; color: var(--text-primary); text-align: left; width: 100%; min-width: 0; }
.chat-shared-media > span:last-child { display: grid; gap: 5px; min-width: 0; overflow-wrap: anywhere; }
.chat-shared-media strong { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; font-size: 13px; }
.chat-shared-media small, .chat-shared-meta { color: var(--text-secondary); font-size: 11px; }
.chat-shared-symbol { display: flex; align-items: center; justify-content: center; flex: 0 0 36px; width: 36px; height: 36px; border-radius: 9px; background: var(--brand-100); color: var(--brand-800); }
.chat-shared-link { font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; color: var(--brand-800); text-decoration: underline; text-underline-offset: 3px; }
.chat-shared-more { margin-top: 15px; }
.chat-forwarded-label { display: block; margin: 1px 0 8px; color: var(--text-secondary); font-size: 11px; font-style: italic; line-height: 1.5; }
.chat-forward-notice { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; margin-bottom: 14px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-surface); font-size: 12px; line-height: 1.6; }
.chat-forward-notice[hidden] { display: none; }
.chat-forward-notice > span { flex: 1 1 180px; overflow-wrap: anywhere; }
.chat-forward-notice .button { flex: 0 0 auto; }
.chat-forward-preview { max-height: 240px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--border-strong) var(--bg-subtle); padding: 12px 14px; margin: 0 0 20px; border: 1px solid var(--border); border-left: 3px solid var(--brand-700); border-radius: 8px; background: var(--bg-subtle); overflow-wrap: anywhere; }
.chat-forward-preview .chat-forward-text { margin: 0; white-space: pre-wrap; font-size: 14px; line-height: 1.65; }
.chat-forward-media { display: grid; gap: 4px; margin: 0; font-size: 13px; line-height: 1.6; }
.chat-forward-media small { color: var(--text-secondary); }
.chat-forward-preview .chat-forward-media + .chat-forward-text { margin-top: 10px; }
.chat-forward-destination { margin: 12px 0 0; color: var(--text-secondary); font-size: 12px; line-height: 1.65; overflow-wrap: anywhere; }
.chat-forward-status { margin: 14px 0 0; font-size: 12px; line-height: 1.65; overflow-wrap: anywhere; }
.chat-forward-status:empty { display: none; }
.chat-message-editing .chat-message-bubble { outline: 2px solid var(--brand-700); outline-offset: 2px; }
.chat-message:focus { outline: 0; }
.chat-message:focus .chat-message-bubble { outline: 2px solid var(--brand-700); outline-offset: 3px; }
.chat-reply-quote { display: grid; gap: 3px; width: 100%; min-width: 0; margin: 2px 0 8px; padding: 8px 10px; border: 0; border-left: 3px solid var(--brand-700); border-radius: 5px; background: var(--brand-50); color: var(--text-primary); text-align: left; font: inherit; }
.chat-message-own .chat-reply-quote { background: rgb(255 255 255 / 65%); }
.chat-reply-quote > strong { color: var(--brand-700); font-size: 11px; overflow-wrap: anywhere; }
.chat-reply-quote > span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; white-space: normal; color: var(--text-secondary); font-size: 12px; line-height: 1.5; }
button.chat-reply-quote:hover { background: var(--brand-100); }
button.chat-reply-quote:active:not(:disabled) { background: var(--border); }
button.chat-reply-quote:focus-visible { outline: 2px solid var(--brand-700); outline-offset: 2px; }
.chat-composer-reply { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; padding: 7px 0 7px 10px; border-left: 3px solid var(--brand-700); border-radius: 5px; background: var(--brand-50); }
.chat-composer-reply > div { flex: 1; min-width: 0; }
.chat-reply-label { display: block; margin-bottom: 3px; color: var(--text-secondary); font-size: 10px; }
.chat-composer-reply .chat-reply-quote { margin: 0; padding: 0; border: 0; background: transparent; }
.chat-composer-reply .chat-icon-button { align-self: flex-start; min-height: 42px; }
.chat-history-context { margin-bottom: 12px; }
.chat-message-sender { display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--brand-700); font-size: 11px; font-weight: 700; margin-bottom: 5px; overflow-wrap: anywhere; }
.chat-message-sender > span { color: var(--text-secondary); font-weight: 450; }
.chat-message-text { margin: 0; color: var(--text-primary); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.6; }
.chat-message-bubble > footer { display: flex; justify-content: flex-end; align-items: center; gap: 6px; margin-top: 5px; color: var(--text-secondary); font-size: 10px; }
.chat-receipt { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; letter-spacing: -2px; }
.chat-receipt-read { color: var(--info); }
.chat-receipt-failed { color: var(--danger); }
.chat-receipt-count { font-size: 9px; letter-spacing: 0; font-weight: 500; }
.chat-message-unavailable .chat-message-text { color: var(--text-secondary); font-style: italic; }
.chat-message-deleted .chat-message-text { color: var(--text-secondary); font-style: italic; }
.chat-message-edited { color: var(--text-secondary); font-size: 10px; }
.chat-attachment { display: flex; gap: 12px; align-items: center; min-width: 0; width: 100%; border: 0; border-radius: 8px; background: rgb(255 255 255 / 60%); padding: 8px 4px; text-align: left; }
.chat-attachment > span:last-child { min-width: 0; }
.chat-attachment strong { display: block; font-size: 12px; }
.chat-attachment small { display: block; margin-top: 3px; color: var(--text-secondary); font-size: 10px; }
.chat-attachment-icon { display: flex; align-items: center; justify-content: center; width: 40px; height: 44px; flex: 0 0 40px; border-radius: 8px; background: var(--brand-100); color: var(--brand-700); }
.chat-new-slot { height: 0; position: relative; z-index: 1; display: flex; justify-content: center; }
.chat-new-slot > button { position: absolute; bottom: 12px; background: var(--brand-700); color: white; border-color: var(--brand-700); box-shadow: var(--shadow-md); font-size: 12px; }
.chat-composer { flex: 0 0 auto; border-top: 1px solid var(--border); padding: 13px 18px 10px; background: var(--bg-surface); }
.chat-composer-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.chat-composer-heading > label { display: block; font-size: 11px; font-weight: 650; }
.chat-composer-heading .button { min-height: 32px; padding: 5px 10px; font-size: 11px; }
.chat-composer-tools { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; min-width: 0; }
.chat-mention-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.chat-mention-chips > span { display: inline-flex; align-items: center; gap: 3px; max-width: 100%; padding-left: 9px; border: 1px solid var(--brand-100); border-radius: 20px; background: var(--brand-50); color: var(--brand-700); font-size: 11px; }
.chat-mention-chips > span > span { min-width: 0; overflow-wrap: anywhere; }
.chat-mention-chips .button { min-width: 32px; min-height: 32px; padding: 4px 8px; border: 0; border-radius: 20px; background: transparent; color: inherit; }
.chat-mention-indicator { display: block; margin: 0 0 6px; color: var(--brand-700); font-size: 10px; font-weight: 650; }
.chat-info-actions { margin-bottom: 20px; }
.chat-dialog-room-notifications .chat-form-note { margin: 5px 0 12px; }
.chat-compose-input { position: relative; min-width: 0; flex: 1; }
.chat-compose-input textarea { display: block; }
.chat-mention-suggestions { position: absolute; bottom: calc(100% + 8px); left: 0; right: 0; z-index: 5; max-height: min(300px, 40dvh); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--brand-100) transparent; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-surface); box-shadow: var(--shadow-md); padding: 5px; }
.chat-mention-option { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 7px 9px; border: 0; border-radius: 7px; background: transparent; color: var(--text-primary); text-align: left; font: inherit; font-size: 13px; cursor: pointer; }
.chat-mention-option > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.chat-mention-option .chat-avatar { flex: 0 0 30px; width: 30px; height: 30px; font-size: 10px; }
.chat-mention-option[aria-selected="true"], .chat-mention-option:hover { background: var(--brand-50); color: var(--brand-700); }
.chat-mention-option:active { background: var(--brand-100); }
.chat-mention-option:focus-visible { outline: 2px solid var(--brand-700); outline-offset: -2px; }
.chat-mention-suggestions > p { margin: 6px 8px 4px; color: var(--text-secondary); font-size: 10px; line-height: 1.5; }
.chat-composer-editing { border-top-color: var(--brand-700); }
.chat-composer.chat-composer-editing > p { margin-left: 0; }
.chat-composer-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-composer textarea { min-width: 0; width: 100%; flex: 1; min-height: 43px; max-height: 136px; padding: 11px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg-app); font-size: 13px; line-height: 1.5; resize: none; }
/* Keep typing focus inside the field, without the chat buttons' outer ring. */
.chat-composer textarea:focus { outline: none; box-shadow: inset 0 -2px 0 var(--text-secondary); }
@media (forced-colors: active) { .chat-composer textarea:focus { outline: 2px solid Highlight; outline-offset: 2px; box-shadow: none; } }
.chat-composer > p { margin: 6px 0 0 50px; color: var(--text-muted); font-size: 10px; }
.chat-send { display: inline-flex; align-items: center; justify-content: center; align-self: flex-end; gap: 8px; flex: 0 0 auto; min-height: 44px !important; }
.chat-send .icon { display: block; width: 18px; height: 18px; flex: 0 0 18px; margin: 0; }
.chat-send > span { line-height: 18px; }
.chat-selected-file { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 10px; padding: 5px 8px 5px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--brand-50); }
.chat-selected-file > span { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; min-width: 0; font-size: 12px; }
.chat-selected-file strong { min-width: 0; overflow-wrap: anywhere; }
.chat-selected-file small { color: var(--text-secondary); }
.chat-inline-error, .chat-dialog-error { margin: 0; padding: 10px 16px; background: var(--danger-bg); color: var(--danger); font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; }
.chat-dialog-error { border-radius: 8px; margin-bottom: 16px; }
.chat-session-note { display: flex; align-items: flex-start; gap: 6px; margin: 11px 2px 0; color: var(--text-secondary); font-size: 10px; line-height: 1.5; }
.chat-session-note .icon { flex: 0 0 13px; width: 13px; height: 13px; margin-top: 1px; }
.chat-archive-warning { padding: 12px 16px; margin-bottom: 14px; border: 1px solid #e7cf94; border-radius: 10px; background: var(--warning-bg); color: var(--warning); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.chat-start { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; margin: auto; padding: 36px; }
.chat-start-icon, .chat-gate-icon { display: inline-flex; align-items: center; justify-content: center; width: 66px; height: 66px; margin-bottom: 5px; border: 1px solid var(--brand-100); border-radius: 20px; background: var(--brand-50); color: var(--brand-700); }
.chat-start-icon .icon, .chat-gate-icon .icon { width: 30px; height: 30px; }
.chat-start .eyebrow { margin: 0; font-size: 9px; }
.chat-start h2 { margin: 0; font-size: 25px; letter-spacing: -.03em; }
.chat-start p { max-width: 38ch; margin: 0; font-size: 13px; color: var(--text-secondary); line-height: 1.65; }
.chat-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chat-list-empty, .chat-thread-empty { padding: 24px 15px; text-align: center; }
.chat-list-empty strong, .chat-thread-empty h3 { margin: 0; font-size: 14px; font-weight: 650; }
.chat-list-empty p, .chat-thread-empty p { color: var(--text-secondary); font-size: 12px; margin: 8px 0 0; }
.chat-thread-empty { padding-top: 54px; }
.chat-gate { display: flex; flex-direction: column; align-items: center; min-height: 370px; padding: 48px 32px 32px; text-align: center; }
.chat-gate h2 { margin: 10px 0 8px; font-size: 23px; letter-spacing: -.02em; }
.chat-gate > p { max-width: 65ch; margin: 0 0 22px; color: var(--text-secondary); font-size: 14px; line-height: 1.7; }
.chat-gate-features { display: flex; justify-content: center; flex-wrap: wrap; gap: 16px 30px; width: 100%; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--border); color: var(--text-secondary); font-size: 12px; }
.chat-gate-features > span { display: inline-flex; gap: 8px; align-items: center; }
.chat-gate-features .icon { width: 17px; height: 17px; color: var(--brand-700); }
.chat-dialog { width: min(600px, calc(100vw - 36px)); max-width: none; max-height: calc(100dvh - 48px); padding: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-surface); color: var(--text-primary); box-shadow: var(--shadow-lg); overflow: auto; }
.chat-dialog::backdrop { background: rgb(34 17 25 / 46%); }
.chat-dialog-header { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 22px; border-bottom: 1px solid var(--border); background: var(--bg-surface); z-index: 2; }
.chat-dialog-header h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.chat-dialog-body { padding: 22px; }
.chat-dialog-reactions { position: fixed; inset: auto; margin: 0; width: 340px; border-radius: 12px; }
.chat-dialog-reactions::backdrop { background: transparent; }
.chat-dialog-reactions .chat-dialog-header { padding: 7px 10px 7px 16px; gap: 10px; border-bottom: 0; }
.chat-dialog-reactions .chat-dialog-header h2 { font-size: 14px; letter-spacing: 0; }
.chat-dialog-reactions .chat-dialog-body { padding: 0; }
.chat-reaction-filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 12px; border-bottom: 1px solid var(--border); }
.chat-reaction-filters button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 34px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 20px; background: var(--bg-surface); color: var(--text-primary); font: inherit; font-size: 13px; }
.chat-reaction-filters button[aria-pressed="true"] { background: var(--brand-50); border-color: var(--brand-700); color: var(--brand-800); }
.chat-reaction-filters button:hover { background: var(--bg-subtle); }
.chat-reaction-filters button:active { background: var(--brand-100); }
.chat-reaction-people { margin: 0; padding: 6px 12px; list-style: none; }
.chat-reaction-people li { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 2px; }
.chat-reaction-person-avatar { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%; background: var(--brand-50); color: var(--brand-800); font-size: 11px; font-weight: 650; }
.chat-reaction-person-name { min-width: 0; flex: 1; overflow-wrap: anywhere; font-size: 13px; line-height: 1.45; }
.chat-reaction-person-emoji { flex: 0 0 auto; font-size: 22px; line-height: 1; }
.chat-reaction-names-pending { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.chat-form-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 15px; }
.chat-dialog .form-field { min-width: 0; }
.chat-dialog .form-field label { display: block; font-size: 12px; font-weight: 650; margin-bottom: 6px; }
.chat-dialog input:not([type="checkbox"]):not([type="radio"]), .chat-dialog select { width: 100%; min-width: 0; min-height: 43px; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: var(--bg-surface); color: var(--text-primary); font-size: 13px; }
.chat-form-note { color: var(--text-secondary); font-size: 12px; line-height: 1.65; margin: 14px 0 18px; }
.chat-people-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.chat-people-fieldset legend { font-size: 12px; font-weight: 650; margin-bottom: 8px; }
.chat-people-list { max-height: 250px; overflow-y: auto; overscroll-behavior: contain; margin: 10px 0; border: 1px solid var(--border); border-radius: 9px; padding: 5px; }
.chat-people-list > p { padding: 8px; font-size: 12px; color: var(--text-secondary); }
.chat-person { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; cursor: pointer; }
.chat-person:hover { background: var(--bg-hover); }
.chat-person:has(input:checked) { background: var(--brand-50); }
.chat-person input, .chat-check input { width: 18px; height: 18px; flex: 0 0 18px; accent-color: var(--brand-700); }
.chat-person > span:last-child { display: grid; gap: 2px; min-width: 0; }
.chat-person strong { font-size: 13px; }
.chat-person small { font-size: 11px; color: var(--text-secondary); }
.chat-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); }
.chat-discover-entry { display: flex; gap: 12px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--border); }
.chat-discover-entry > div { min-width: 0; flex: 1; }
.chat-discover-entry h3 { margin: 0; font-size: 14px; }
.chat-discover-entry p { margin: 4px 0 0; font-size: 11px; color: var(--text-secondary); }
.chat-info { display: grid; gap: 15px; margin: 0 0 24px; }
.chat-info > div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 15px; font-size: 13px; }
.chat-info dt { color: var(--text-secondary); }
.chat-info dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.chat-members-heading { margin: 0 0 10px; font-size: 14px; }
.chat-members-list { max-height: 300px; overflow-y: auto; overscroll-behavior: contain; scrollbar-color: var(--border-strong) var(--bg-subtle); scrollbar-width: thin; }
.chat-member-entry { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.chat-member-entry > div { flex: 1; min-width: 0; display: grid; gap: 3px; }
.chat-member-entry strong { font-size: 13px; }
.chat-member-entry small { font-size: 11px; color: var(--text-secondary); }
.chat-add-member { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-top: 20px; }
.chat-add-member .form-field { flex: 1 1 200px; }
.chat-search-query { display: flex; gap: 10px; align-items: flex-end; }
.chat-search-query .form-field { flex: 1; }
.chat-search-filters { margin-top: 15px; border-bottom: 1px solid var(--border); padding-bottom: 15px; }
.chat-search-filters summary { color: var(--brand-700); cursor: pointer; min-height: 28px; font-size: 12px; font-weight: 650; }
.chat-search-filters .chat-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 14px; }
.chat-check { display: flex; gap: 8px; align-items: center; font-size: 12px; grid-column: 1 / -1; }
.chat-search-status { margin: 16px 0; font-size: 12px; color: var(--text-secondary); line-height: 1.6; }
.chat-search-results .chat-message { margin-top: 18px; justify-content: flex-start; }
.chat-search-results .chat-message-bubble { width: 100%; max-width: 100%; }
.chat-search-results > .button { font-size: 11px; min-height: 34px; }
.chat-dialog-media { width: min(860px, calc(100vw - 36px)); }
.chat-media-content { min-height: 160px; display: flex; align-items: center; justify-content: center; color: var(--text-secondary); font-size: 13px; }
.chat-media-content img, .chat-media-content video { display: block; max-width: 100%; width: auto; max-height: 70dvh; object-fit: contain; border-radius: 8px; }
.chat-room-list, .chat-timeline, .chat-dialog, .chat-people-list { scrollbar-width: thin; scrollbar-color: var(--border-strong) var(--bg-subtle); }
.chat-room-list::-webkit-scrollbar, .chat-timeline::-webkit-scrollbar, .chat-dialog::-webkit-scrollbar, .chat-people-list::-webkit-scrollbar { width: 8px; height: 8px; }
.chat-room-list::-webkit-scrollbar-track, .chat-timeline::-webkit-scrollbar-track, .chat-dialog::-webkit-scrollbar-track, .chat-people-list::-webkit-scrollbar-track { background: var(--bg-subtle); }
.chat-room-list::-webkit-scrollbar-thumb, .chat-timeline::-webkit-scrollbar-thumb, .chat-dialog::-webkit-scrollbar-thumb, .chat-people-list::-webkit-scrollbar-thumb { border: 2px solid var(--bg-subtle); border-radius: 8px; background: var(--border-strong); }
@media (max-width: 1100px) {
  .chat-workspace { grid-template-columns: minmax(220px, 34%) minmax(0, 1fr); }
  .chat-room-header { padding: 12px; gap: 9px; }
  .chat-timeline { padding: 12px 16px 20px; }
  .chat-header-actions .chat-icon-button:last-child { display: none; }
  .chat-send > span { display: none; }
  .chat-send { width: 44px; padding: 10px !important; }
  .chat-composer-editing .chat-send { width: auto; }
  .chat-composer-editing .chat-send > span { display: inline; }
}
@media (max-width: 760px) {
  .chat-page-header { flex-direction: row; align-items: center; gap: 12px; margin-bottom: 16px; }
  .chat-page-header h1 { font-size: 28px; }
  .chat-page-header p { display: none; }
  .chat-page-header .button { font-size: 12px; padding: 9px 12px; }
  .chat-workspace { display: block; min-height: 430px; height: calc(100dvh - 180px); max-height: 900px; }
  .chat-sidebar { height: 100%; border: 0; }
  .chat-conversation { display: none; }
  .chat-workspace.chat-room-visible .chat-sidebar { display: none; }
  .chat-workspace.chat-room-visible .chat-conversation { display: block; }
  .chat-back { display: inline-flex !important; width: 36px; flex: 0 0 36px; padding: 8px !important; }
  .chat-room-header { min-height: 72px; gap: 7px; padding: 10px 8px; }
  .chat-room-header > .chat-avatar { width: 33px; height: 33px; flex-basis: 33px; border-radius: 10px; }
  .chat-room-title strong { font-size: 13px; }
  .chat-room-title > span { font-size: 10px; }
  .chat-timeline { padding: 10px 12px 18px; }
  .chat-message-bubble { max-width: 93%; }
  .chat-message-text { font-size: 13px; }
  .chat-composer { padding: 10px 9px 9px; }
  .chat-composer-row { gap: 5px; }
  .chat-composer .chat-icon-button { width: 36px; flex-basis: 36px; padding: 8px !important; }
  .chat-composer textarea { padding: 10px; font-size: 16px; }
  .chat-composer > p { margin-left: 41px; font-size: 9px; }
  .chat-session-note { font-size: 9px; }
  .chat-gate { padding: 30px 22px 24px; }
  .chat-gate h2 { font-size: 21px; }
  .chat-gate > p { font-size: 13px; }
  .chat-gate-features { flex-direction: column; align-items: center; gap: 14px; }
}
@media (max-width: 480px) {
  .chat-composer-editing .chat-composer-row { flex-wrap: wrap; gap: 8px; }
  .chat-composer-editing .chat-compose-input { flex: 1 1 100%; }
  .chat-composer-editing .chat-send { margin-left: auto; }
}
@media (max-width: 420px) {
  .chat-dialog { width: calc(100vw - 20px); max-height: calc(100dvh - 24px); border-radius: 12px; }
  .chat-dialog-header { padding: 10px 14px; gap: 8px; }
  .chat-dialog-header h2 { font-size: 18px; }
  .chat-dialog-body { padding: 16px 14px; }
  .chat-dialog input:not([type="checkbox"]):not([type="radio"]), .chat-dialog select { font-size: 16px; }
  .chat-search-filters .chat-form-grid { grid-template-columns: minmax(0, 1fr); }
  .chat-search-query { flex-wrap: wrap; }
  .chat-search-query .form-field { flex-basis: 100%; }
  .chat-search-query > button { width: 100%; }
  .chat-discover-entry { flex-wrap: wrap; }
  .chat-discover-entry > .button { margin-left: 51px; }
  .chat-info > div { grid-template-columns: minmax(0, 1fr); gap: 3px; }
  .chat-room-header { gap: 4px; }
  .chat-room-header > .chat-avatar { display: none; }
  .chat-room-title > span { line-height: 1.5; }
  .chat-gate { padding: 25px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .chat-page *, .chat-dialog * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
