/* ============================================
   Chat Dock — Floating channel circles + chat windows
   ============================================ */

html.demo-hide-chat-dock .chat-dock,
html.demo-hide-chat-dock .chat-channel-panel,
html.demo-hide-chat-dock .chat-float-window {
  display: none !important;
}

/* --- Dock Container (vertical bar, center-left) --- */
.chat-dock {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: var(--z-dock-shell, 10005);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 4px;
  width: 6px;
  overflow: visible;
  transition: width 0.2s ease;
  will-change: width;
}

/* Only expand via JS .expanded class — no hover */
.chat-dock.expanded {
  width: 66px;
}

/* --- Collapsed tab — the visible handle on the left edge --- */
.chat-dock-tab {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  padding: 16px 0;
  background: var(--color-bg-primary, #fff);
  border: 1px solid var(--color-border-primary, #e5e7eb);
  border-left: none;
  border-radius: 0 10px 10px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 2px 0 8px color-mix(in srgb, var(--color-text-primary) 6%, transparent);
  transition: transform 0.2s, opacity 0.2s, background 0.15s;
  z-index: 2;
  color: var(--color-text-secondary, #6B6B6B);
}

.chat-dock-tab:hover {
  background: var(--color-bg-secondary, #F5F5F5);
  color: var(--color-text-primary, #1A1A1A);
  transform: translateY(-50%) translateX(2px);
  box-shadow: 3px 0 12px color-mix(in srgb, var(--color-text-primary) 8%, transparent);
}

.chat-dock-tab svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.chat-dock-tab-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  writing-mode: vertical-lr;
  text-orientation: mixed;
  line-height: 1;
}

/* Hide tab when dock is expanded */
.chat-dock.expanded .chat-dock-tab {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(-32px);
}

/* Keep dock expanded when a chat panel or window is open */
body:has(.chat-channel-panel.visible) .chat-dock,
body:has(.chat-float-window.visible) .chat-dock {
  width: 66px;
  overflow: visible;
}

body:has(.chat-channel-panel.visible) .chat-dock .chat-dock-tab,
body:has(.chat-float-window.visible) .chat-dock .chat-dock-tab {
  opacity: 0;
  pointer-events: none;
}

body:has(.chat-channel-panel.visible) .chat-dock .chat-dock-rail,
body:has(.chat-float-window.visible) .chat-dock .chat-dock-rail {
  opacity: 1;
}

/* When a modal is open, the dock must recede behind the modal backdrop so
   the backdrop dims/blurs it like the rest of the page. The dock normally
   floats above everything (10000 scale); open modals are the one exception.
   1090 sits just below --z-modal-system-backdrop (1100), so the backdrop
   covers the dock while it still stays above ordinary page content. Covers
   the generic Modal.* system plus the study page's custom overlays. */
body:has(.modal-backdrop.active) .chat-dock,
body:has(.tag-filter-overlay.is-open) .chat-dock,
body:has(.deck-modal-overlay.is-open) .chat-dock {
  z-index: 1090;
}

/* --- Collapse button at top of rail --- */
.chat-dock-collapse-btn {
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  border-radius: var(--radius-md, 6px);
  color: var(--color-text-secondary, #6B6B6B);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
  margin-bottom: 4px;
  flex-shrink: 0;
}

.chat-dock-collapse-btn:hover {
  background: var(--color-bg-hover, #EBEBEB);
  color: var(--color-text-primary, #1A1A1A);
}

/* --- Dock rail (the background strip) --- */
.chat-dock-rail {
  background: var(--color-bg-primary, #fff);
  border: 1px solid var(--color-border-primary, #e5e7eb);
  border-left: none;
  border-radius: 0 16px 16px 0;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  box-shadow: 2px 0 16px color-mix(in srgb, var(--color-text-primary) 6%, transparent);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.chat-dock.expanded .chat-dock-rail {
  opacity: 1;
}

/* --- Individual circle (channel or DM) --- */
.chat-dock-item {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  aspect-ratio: 1;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: border-radius 0.2s, background 0.2s, transform 0.15s;
  background: var(--color-bg-secondary, #f3f4f6);
  color: var(--color-text-secondary, #6b7280);
  border: none;
  font-weight: 600;
  font-size: var(--font-size-md);
  overflow: visible;
  flex-shrink: 0;
}

.chat-dock-item:hover {
  border-radius: 16px;
  background: var(--color-accent, #3b82f6);
  color: var(--color-text-inverse);
  transform: scale(1.05);
}

.chat-dock-item.active {
  border-radius: 16px;
  background: var(--color-accent, #3b82f6);
  color: var(--color-text-inverse);
}

.chat-dock-item svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.chat-dock-item img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* Active indicator pip on the left edge */
.chat-dock-item::before {
  content: '';
  position: absolute;
  left: -8px;
  width: 4px;
  height: 0;
  border-radius: 0 4px 4px 0;
  background: var(--color-text-primary, #111827);
  transition: height 0.2s;
  will-change: height;
}

.chat-dock-item:hover::before {
  height: 20px;
}

.chat-dock-item.active::before {
  height: 36px;
}

/* Unread dot on a circle */
.chat-dock-item .dock-unread {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-danger);
  border: 2px solid var(--color-bg-primary, #fff);
  font-size: 0;
}

/* Tooltip for hover */
.chat-dock-item .dock-tooltip {
  position: absolute;
  left: 60px;
  background: var(--color-bg-inverse, #1f2937);
  color: var(--color-text-inverse);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.15s, transform 0.15s;
  z-index: var(--z-dock-tooltip, 10015);
}

.chat-dock-item .dock-tooltip::before {
  content: '';
  position: absolute;
  left: -4px;
  top: 50%;
  transform: translateY(-50%);
  border: 4px solid transparent;
  border-right-color: var(--color-bg-inverse, #1f2937);
}

.chat-dock-item:hover .dock-tooltip {
  opacity: 1;
  transform: translateX(0);
}

/* Separator line inside the dock */
.chat-dock-separator {
  width: 32px;
  height: 2px;
  background: var(--color-border-primary, #e5e7eb);
  border-radius: 1px;
  margin: 4px 0;
  flex-shrink: 0;
}

/* Add-channel button */
.chat-dock-add {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-secondary, #f3f4f6);
  color: var(--color-text-tertiary, #9ca3af);
  border: none;
  font-size: 20px;
  transition: border-radius 0.2s, background 0.2s, color 0.2s;
  flex-shrink: 0;
}

.chat-dock-add:hover {
  border-radius: 16px;
  background: var(--color-success);
  color: var(--color-text-inverse);
}

/* --- Channel list panel (slides out from dock) --- */
.chat-channel-panel {
  position: fixed;
  left: 68px;
  top: 50%;
  transform: translateY(-50%);
  width: 240px;
  max-height: 70vh;
  background: var(--color-bg-primary, #fff);
  border: 1px solid var(--color-border-primary, #e5e7eb);
  border-radius: var(--radius-xl);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.08);
  z-index: var(--z-dock-panel, 10008);
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: channelPanelIn 0.15s ease-out;
}

.chat-channel-panel.visible {
  display: flex;
}

@keyframes channelPanelIn {
  from { opacity: 0; transform: translateY(-50%) translateX(-8px); }
  to   { opacity: 1; transform: translateY(-50%) translateX(0); }
}

.channel-panel-header {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--color-border-primary, #e5e7eb);
}

.channel-panel-header h3 {
  font-size: var(--font-size-md, 15px);
  font-weight: 700;
  color: var(--color-text-primary, #111827);
  margin: 0 0 2px;
}

.channel-panel-header p {
  font-size: var(--font-size-xs, 12px);
  color: var(--color-text-tertiary, #9ca3af);
  margin: 0;
}

.channel-panel-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.channel-panel-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius-lg);
  background: transparent;
  cursor: pointer;
  font-size: var(--font-size-md);
  font-family: inherit;
  color: var(--color-text-secondary, #6b7280);
  transition: background 0.15s, color 0.15s;
  width: 100%;
  text-align: left;
}

.channel-panel-item:hover {
  background: var(--color-bg-secondary, #f3f4f6);
  color: var(--color-text-primary, #111827);
}

.channel-panel-item.active {
  background: var(--color-accent-subtle, rgba(59, 130, 246, 0.08));
  color: var(--color-accent, #3b82f6);
}

.channel-panel-item .channel-hash {
  font-weight: 600;
  font-size: var(--font-size-lg);
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.channel-panel-item .channel-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-panel-item .channel-unread {
  background: var(--color-danger);
  color: var(--color-text-inverse);
  font-size: var(--font-size-xs);
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  flex-shrink: 0;
}

/* ============================================
   Channel Panel — Folder Groups
   ============================================ */
.cpanel-folder {
  margin-bottom: 4px;
}

.cpanel-folder-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  cursor: pointer;
  border-radius: var(--radius-lg);
  user-select: none;
  transition: background 0.15s;
}

.cpanel-folder-header:hover {
  background: var(--color-bg-secondary, #f3f4f6);
}

.cpanel-folder-toggle {
  width: 16px;
  height: 16px;
  border: none;
  background: none;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text-tertiary, #9ca3af);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.cpanel-folder-toggle.collapsed {
  transform: rotate(-90deg);
}

.cpanel-folder-icon {
  flex-shrink: 0;
  color: var(--color-text-tertiary, #9ca3af);
}

.cpanel-folder-name {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cpanel-folder-count {
  font-size: 11px;
  color: var(--color-text-tertiary, #9ca3af);
  flex-shrink: 0;
}

.cpanel-folder-contents {
  overflow: hidden;
  max-height: 2000px;
  transition: max-height 0.2s ease;
  will-change: max-height;
}

.cpanel-folder-contents.collapsed {
  max-height: 0;
}

/* --- Detached Chat Window --- */
.chat-float-window {
  position: fixed;
  width: 520px;
  height: 600px;
  background: var(--color-bg-primary, #fff);
  border: 1px solid var(--color-border-primary, #e5e7eb);
  border-radius: var(--radius-xl);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  z-index: var(--z-dock-window, 10010);
  display: none;
  flex-direction: column;
  overflow: hidden;
  min-width: 380px;
  min-height: 300px;
  isolation: isolate;
}

.chat-float-window.visible {
  display: flex;
}

/* Window header (draggable) */
.chat-float-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 48px;
  background: var(--color-bg-primary, #fff);
  border-bottom: 1px solid var(--color-border-primary, #e5e7eb);
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
}

.chat-float-header:active {
  cursor: grabbing;
}

.chat-float-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.chat-float-header-left .channel-hash-icon {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text-tertiary, #9ca3af);
}

.chat-float-header-left .window-channel-name {
  font-size: var(--font-size-md, 15px);
  font-weight: 600;
  color: var(--color-text-primary, #111827);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-float-header-left .window-channel-desc {
  font-size: var(--font-size-xs, 12px);
  color: var(--color-text-tertiary, #9ca3af);
  margin-left: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-float-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.chat-float-controls button {
  width: 44px;
  height: 44px;
  padding: 10px;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-tertiary, #9ca3af);
  transition: background 0.15s, color 0.15s;
}

.chat-float-controls button svg {
  width: 16px;
  height: 16px;
}

.chat-float-controls button:hover {
  background: var(--color-bg-secondary, #f3f4f6);
  color: var(--color-text-primary, #111827);
}

/* Call button — green accent */
.chat-float-controls .call-btn {
  color: var(--color-accent, #5a7a6a);
}

.chat-float-controls .call-btn:hover {
  background: var(--color-accent-subtle, rgba(90, 122, 106, 0.1));
  color: var(--color-accent-dark, #4a6a5a);
}

/* --- Colloq bar inside dock window --- */
.dock-colloq-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: var(--color-colloq-bg, #1c1c1e);
  color: var(--color-colloq-text, rgba(255, 255, 255, 0.95));
  font-size: 12px;
  flex-shrink: 0;
}

.dock-colloq-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.dock-colloq-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-success);
  flex-shrink: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .dock-colloq-dot {
    animation: colloq-active-dot 1.5s ease-in-out infinite;
  }
}

@keyframes colloq-active-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.dock-colloq-label {
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
}

.dock-colloq-timer {
  font-size: 11px;
  color: var(--color-colloq-muted, rgba(255, 255, 255, 0.55));
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dock-colloq-divider {
  width: 1px;
  height: 14px;
  background: var(--color-colloq-border, rgba(255, 255, 255, 0.12));
  flex-shrink: 0;
}

.dock-colloq-avatars {
  display: flex;
  align-items: center;
  gap: 0;
}

.dock-colloq-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--color-colloq-bg, #1c1c1e);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dock-colloq-avatar + .dock-colloq-avatar {
  margin-left: -5px;
}

.dock-colloq-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

.dock-colloq-avatar-fb {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--color-avatar-fallback, #5C6F5B);
  color: var(--color-text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.dock-colloq-avatar-overflow {
  background: var(--color-colloq-border, rgba(255, 255, 255, 0.15));
  color: var(--color-colloq-muted, rgba(255, 255, 255, 0.7));
  font-size: 9px;
  font-weight: 600;
}

.dock-colloq-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.dock-colloq-mute,
.dock-colloq-leave {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s;
}

.dock-colloq-mute {
  background: var(--color-colloq-hover, rgba(255, 255, 255, 0.1));
  color: var(--color-colloq-text, rgba(255, 255, 255, 0.85));
}

.dock-colloq-mute:hover {
  background: var(--color-colloq-border, rgba(255, 255, 255, 0.2));
}

.dock-colloq-mute svg,
.dock-colloq-leave svg {
  width: 13px;
  height: 13px;
}

.dock-colloq-leave {
  background: var(--color-danger);
  color: var(--color-text-inverse);
}

.dock-colloq-leave:hover {
  background: var(--color-danger-dark, #b91c1c);
}

.dock-colloq-join {
  height: 24px;
  padding: 0 10px;
  border: none;
  border-radius: 12px;
  background: var(--color-success);
  color: var(--color-text-inverse);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.dock-colloq-join:hover {
  background: var(--color-success);
}

/* --- Colloq notice in message stream --- */
.cfm-colloq-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 0;
}

.cfm-colloq-notice-line {
  flex: 1;
  height: 1px;
  background: var(--color-success-subtle);
}

.cfm-colloq-notice-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  background: var(--color-success-subtle);
  border-radius: 10px;
  border: 1px solid var(--color-success-subtle);
  white-space: nowrap;
  font-size: 11px;
  font-weight: 500;
  color: var(--color-success);
}

.cfm-colloq-notice-pill svg {
  width: 11px;
  height: 11px;
  color: var(--color-success);
  flex-shrink: 0;
}

/* Ended notice — muted styling */
.cfm-colloq-notice-pill.ended {
  background: var(--color-bg-secondary);
  border-color: var(--color-border-primary);
  color: var(--color-text-tertiary, #888);
}

.cfm-colloq-notice-pill.ended svg {
  color: var(--color-text-tertiary, #aaa);
}

.cfm-colloq-notice-time {
  color: var(--color-success, #5C6F5B);
  font-size: 10px;
}

/* --- Loading older messages spinner --- */
.cfm-loading-older {
  display: flex;
  justify-content: center;
  padding: 8px;
}

.cfm-spinner-small {
  width: 18px;
  height: 18px;
  border: 2px solid var(--color-border-primary, rgba(0, 0, 0, 0.08));
  border-top-color: var(--color-accent, #5a7a6a);
  border-radius: 50%;
  animation: cfm-spin 0.6s linear infinite;
}

@keyframes cfm-spin {
  to { transform: rotate(360deg); }
}

/* Messages area */
.chat-float-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--color-bg-primary, #fff);
  position: relative;
  z-index: 1;
}

/* Prevent flex-column from collapsing grouped messages (min-height:0 in slack-messages.css) */
.chat-float-messages > .message,
.chat-float-messages > .date-separator,
.chat-float-messages > .colloq-chat-notice {
  flex-shrink: 0;
}

.chat-float-messages::-webkit-scrollbar {
  width: 6px;
}
.chat-float-messages::-webkit-scrollbar-thumb {
  background: var(--color-border-primary, #e5e7eb);
  border-radius: 3px;
}

/* ============================================
   Date Separators
   ============================================ */
.cfm-date-separator {
  display: flex;
  align-items: center;
  margin: 16px 0 8px 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-tertiary, rgba(44, 41, 37, 0.5));
  user-select: none;
}

.cfm-date-separator::before,
.cfm-date-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border-primary, rgba(44, 41, 37, 0.12));
}

.cfm-date-separator span {
  padding: 0 12px;
  white-space: nowrap;
}

/* ============================================
   Grouped (continuation) messages
   ============================================ */
.cfm-message-grouped {
  padding-top: 1px !important;
  padding-bottom: 1px !important;
  min-height: auto;
}

.cfm-grouped-ts {
  width: 36px;
  flex-shrink: 0;
  font-size: 10px;
  color: var(--color-text-tertiary, #9ca3af);
  opacity: 0;
  transition: opacity 0.15s ease;
  text-align: right;
  padding-top: 3px;
  line-height: 1.5;
}

.cfm-message-grouped:hover .cfm-grouped-ts,
.cfm-message-grouped:focus-within .cfm-grouped-ts,
.cfm-message:focus-within .cfm-grouped-ts {
  opacity: 1;
}

/* Message item (Slack-style) */
.cfm-message {
  display: flex;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius-lg);
  position: relative;
  transition: background 0.1s;
}

.cfm-message:hover {
  background: var(--color-bg-secondary, #f9fafb);
}

.cfm-message:hover .cfm-actions,
.cfm-message:focus-within .cfm-actions {
  opacity: 1;
  pointer-events: auto;
}

/* New renderer message actions bar in dock */
.chat-float-messages .message {
  position: relative;
}

.chat-float-messages .message-actions-bar {
  position: absolute;
  top: -12px;
  right: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 10;
}

.chat-float-messages .message:hover .message-actions-bar,
.chat-float-messages .message-grouped:hover .message-actions-bar,
.chat-float-messages .message-actions-bar:hover,
.chat-float-messages .message:focus-within .message-actions-bar,
.chat-float-messages .message-grouped:focus-within .message-actions-bar {
  opacity: 1;
  pointer-events: auto;
}

/* Extend the message's hover zone upward to cover the actions bar */
.chat-float-messages .message::before {
  content: '';
  position: absolute;
  top: -16px;
  left: 0;
  right: 0;
  height: 16px;
}

.cfm-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-lg);
  flex-shrink: 0;
  overflow: hidden;
  background: var(--color-bg-secondary, #f3f4f6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: var(--font-size-md);
  color: var(--color-text-secondary, #6b7280);
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.15s;
}

.cfm-avatar:hover {
  opacity: 0.8;
}

.cfm-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cfm-body {
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: visible;
}

.cfm-meta {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 0;
  line-height: 1.1;
}

.cfm-username {
  font-weight: 600;
  font-size: var(--font-size-md);
  color: var(--color-text-primary, #111827);
  text-decoration: none;
  cursor: pointer;
}

.cfm-username:hover {
  color: var(--color-info);
  text-decoration: underline;
}

.cfm-time {
  font-size: var(--font-size-sm);
  color: var(--color-text-tertiary, #9ca3af);
}

.cfm-text {
  font-size: var(--font-size-md);
  color: var(--color-text-primary, #111827);
  line-height: 1.5;
  word-wrap: break-word;
  overflow: hidden;
}

.cfm-text p { margin: 0 0 4px; font-size: inherit; }
.cfm-text p:last-child { margin: 0; }
.cfm-text code {
  background: var(--color-bg-secondary, #f3f4f6);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 13px;
}

/* Reactions row on a message */
.cfm-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.cfm-reaction {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-xl);
  font-size: 13px;
  cursor: pointer;
  border: 1px solid var(--color-border-primary, #e5e7eb);
  background: var(--color-bg-primary, #fff);
  transition: background 0.15s, border-color 0.15s;
}

.cfm-reaction:hover {
  background: var(--color-bg-secondary, #f3f4f6);
  border-color: var(--color-accent, #3b82f6);
}

.cfm-reaction.active {
  background: var(--color-accent-subtle, rgba(59, 130, 246, 0.08));
  border-color: var(--color-accent, #3b82f6);
}

.cfm-reaction .reaction-count {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-secondary, #6b7280);
}

/* Thread indicator */
.cfm-thread {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  margin-top: 4px;
  cursor: pointer;
  color: var(--color-accent, #3b82f6);
  font-size: var(--font-size-sm);
  font-weight: 500;
  transition: opacity 0.15s;
}

.cfm-thread:hover {
  opacity: 0.8;
}

.cfm-thread svg {
  width: 14px;
  height: 14px;
}

.cfm-thread-avatars {
  display: flex;
}

.cfm-thread-avatars .mini-avatar {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-sm);
  margin-right: -4px;
  border: 2px solid var(--color-bg-primary, #fff);
  background: var(--color-bg-secondary, #f3f4f6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  overflow: hidden;
}

.cfm-thread-avatars .mini-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Hover action bar */
.cfm-actions {
  position: absolute;
  top: -12px;
  right: 8px;
  display: flex;
  align-items: center;
  background: var(--color-bg-primary, #fff);
  border: 1px solid var(--color-border-primary, #e5e7eb);
  border-radius: var(--radius-md);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 2;
}

.cfm-action-btn {
  width: 44px;
  height: 44px;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--color-text-tertiary, #9ca3af);
  transition: background 0.1s, color 0.1s;
}

.cfm-action-btn:first-child { border-radius: 6px 0 0 6px; }
.cfm-action-btn:last-child  { border-radius: 0 6px 6px 0; }

.cfm-action-btn:hover {
  background: var(--color-bg-secondary, #f3f4f6);
  color: var(--color-text-primary, #111827);
}

.cfm-action-btn svg {
  width: 16px;
  height: 16px;
}

/* Input area */
.chat-float-input {
  padding: 12px 16px;
  border-top: 1px solid var(--color-border-primary, #e5e7eb);
  flex-shrink: 0;
}

.chat-float-input-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-bg-secondary, #f3f4f6);
  border: 1px solid var(--color-border-primary, #e5e7eb);
  border-radius: var(--radius-lg);
  padding: 4px 4px 4px 12px;
  transition: border-color 0.15s;
}

.chat-float-input-inner:focus-within {
  border-color: var(--color-accent, #3b82f6);
  box-shadow: 0 0 0 3px var(--focus-ring-subtle, rgba(26, 26, 26, 0.35));
}

.chat-float-input-inner .attach-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-tertiary, #9ca3af);
  border-radius: var(--radius-md);
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.chat-float-input-inner .attach-btn:hover {
  background: var(--color-bg-primary, #fff);
  color: var(--color-text-secondary, #6b7280);
}

/* Dock attachment preview cards */
.dock-attachments {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  margin-bottom: 4px;
  background: var(--color-bg-tertiary, #F7F6F3);
  border-radius: 8px;
  border: 1px solid var(--color-border-primary, #E5E2DC);
}
.dock-attachments.has-items { display: flex; }
.dock-att-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: var(--color-bg-primary, #fff);
  border: 1px solid var(--color-border-primary, #E5E2DC);
  border-radius: 6px;
  max-width: 180px;
}
.dock-att-card img {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
}
.dock-att-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.dock-att-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dock-att-size {
  font-size: 10px;
  color: var(--color-text-tertiary);
}
.dock-att-remove {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  background: var(--color-text-tertiary, #7A756E);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s;
}
.dock-att-card:hover .dock-att-remove { opacity: 1; }
.dock-att-remove:hover { background: var(--color-danger, #8A6060); }

.chat-float-input-inner textarea,
.chat-float-input-inner input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: var(--font-size-md);
  color: var(--color-text-primary, #111827);
  outline: none;
  min-width: 0;
  resize: none;
  font-family: inherit;
  line-height: 1.4;
  padding: 0;
  overflow: hidden;
}

.chat-float-input-inner textarea::placeholder,
.chat-float-input-inner input::placeholder {
  color: var(--color-text-placeholder, #8A8A8A);
}

.chat-float-input-btns {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.chat-float-input-inner .emoji-btn,
.chat-float-input-inner .send-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.chat-float-input-inner .emoji-btn {
  background: transparent;
  color: var(--color-text-tertiary, #9ca3af);
}

.chat-float-input-inner .emoji-btn:hover {
  background: var(--color-bg-primary, #fff);
  color: var(--color-text-secondary, #6b7280);
}

.chat-float-input-inner .send-btn {
  background: var(--color-accent, #3b82f6);
  color: var(--color-text-inverse);
}

.chat-float-input-inner .send-btn:hover {
  opacity: 0.9;
}

.chat-float-input-inner .send-btn svg {
  width: 16px;
  height: 16px;
}

/* Thread splitter (draggable resize handle between main and thread) */
.chat-float-thread-splitter {
  display: none;
  width: 5px;
  cursor: col-resize;
  background: transparent;
  flex-shrink: 0;
  transition: background 0.15s;
  position: relative;
}
.chat-float-thread-splitter::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: 1px;
  width: 1px;
  background: var(--color-border-primary, #e5e7eb);
}
.chat-float-thread-splitter.visible {
  display: block;
}
.chat-float-thread-splitter:hover,
.chat-float-thread-splitter:active {
  background: var(--color-accent, #3b82f6);
}
.chat-float-thread-splitter:hover::after,
.chat-float-thread-splitter:active::after {
  background: var(--color-accent, #3b82f6);
}

/* Thread panel (split right pane inside the window) */
.chat-float-thread {
  display: none;
  flex-direction: column;
  width: 300px;
  min-width: 180px;
  flex-shrink: 0;
  background: var(--color-bg-primary, #fff);
}

.chat-float-thread.visible {
  display: flex;
}

.chat-float-thread-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border-primary, #e5e7eb);
  flex-shrink: 0;
}

.chat-float-thread-header h4 {
  font-size: var(--font-size-md);
  font-weight: 600;
  color: var(--color-text-primary, #111827);
  margin: 0;
}

.chat-float-thread-header .close-thread {
  width: 44px;
  height: 44px;
  padding: 10px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-tertiary, #9ca3af);
}

.chat-float-thread-header .close-thread:hover {
  background: var(--color-bg-secondary, #f3f4f6);
  color: var(--color-text-primary, #111827);
}

.chat-float-thread-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.chat-float-thread-input {
  padding: 8px 12px;
  border-top: 1px solid var(--color-border-primary, #e5e7eb);
}

.chat-float-thread-input-inner {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--color-bg-secondary, #f3f4f6);
  border: 1px solid var(--color-border-primary, #e5e7eb);
  border-radius: var(--radius-md);
  padding: 4px 4px 4px 10px;
}

.chat-float-thread-input-inner:focus-within {
  border-color: var(--color-accent, #3b82f6);
}

.chat-float-thread-input-inner textarea,
.chat-float-thread-input-inner input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 13px;
  color: var(--color-text-primary, #111827);
  outline: none;
  resize: none;
  font-family: inherit;
  line-height: 1.4;
  padding: 0;
  overflow: hidden;
}

.chat-float-thread-input-inner button {
  width: 44px;
  height: 44px;
  padding: 10px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--color-accent, #3b82f6);
  color: var(--color-text-inverse);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Emoji picker */
.chat-dock-emoji-picker {
  position: fixed;
  z-index: var(--z-dock-popover, 10020);
  background: var(--color-bg-primary, #fff);
  border: 1px solid var(--color-border-primary, #e5e7eb);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  padding: 8px;
  width: 318px;
}

.chat-dock-emoji-picker .emoji-picker-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-text-tertiary, #9ca3af);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 4px 8px;
}

.chat-dock-emoji-picker .emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
}

.chat-dock-emoji-picker .emoji-option {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--font-size-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s;
}

.chat-dock-emoji-picker .emoji-option:hover {
  background: var(--color-bg-secondary, #f3f4f6);
}

/* Window resize handles */
.chat-float-window .cfr-handle {
  position: absolute;
  z-index: 3;
}

.cfr-handle-n  { top: -3px; left: 8px; right: 8px; height: 6px; cursor: n-resize; }
.cfr-handle-s  { bottom: -3px; left: 8px; right: 8px; height: 6px; cursor: s-resize; }
.cfr-handle-e  { right: -3px; top: 8px; bottom: 8px; width: 6px; cursor: e-resize; }
.cfr-handle-w  { left: -3px; top: 8px; bottom: 8px; width: 6px; cursor: w-resize; }
.cfr-handle-ne { top: -3px; right: -3px; width: 12px; height: 12px; cursor: ne-resize; }
.cfr-handle-nw { top: -3px; left: -3px; width: 12px; height: 12px; cursor: nw-resize; }
.cfr-handle-se { bottom: -3px; right: -3px; width: 12px; height: 12px; cursor: se-resize; }
.cfr-handle-sw { bottom: -3px; left: -3px; width: 12px; height: 12px; cursor: sw-resize; }

/* Colloq join/leave notices in chat */
.cfm-colloq-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  margin: 4px 0;
}

.cfm-colloq-notice-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cfm-colloq-join .cfm-colloq-notice-dot { background: var(--color-success); }
.cfm-colloq-leave .cfm-colloq-notice-dot { background: var(--color-danger); }

.cfm-colloq-notice-text {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-tertiary, #6b7280);
}

.cfm-colloq-notice-time {
  font-size: 11px;
  color: var(--color-text-tertiary, #9ca3af);
  opacity: 0.7;
}

/* ============================================
   Responsive — phone (full-screen sheet) & tablet
   ============================================ */

/* Phone — full-screen sheet mode */
@media (max-width: 768px) {
  /* Hide chat dock entirely on mobile — navigation uses bottom tab bar */
  .chat-dock {
    display: none !important;
  }
}

@media (max-width: 480px) {
  /* Dock becomes a floating action button bottom-right. Higher-specificity
     selectors override the base `body:has(...)` rail-expand rules. */
  body .chat-dock,
  body:has(.chat-channel-panel.visible) .chat-dock,
  body:has(.chat-float-window.visible) .chat-dock {
    left: auto;
    right: 16px;
    bottom: 16px;
    top: auto;
    transform: none;
    width: 56px;
    height: 56px;
    padding: 0;
  }

  body .chat-dock.expanded {
    width: 56px;
  }

  /* Hide the vertical tab handle on phones */
  .chat-dock-tab {
    display: none;
  }

  /* Channel panel becomes full-viewport sheet */
  .chat-channel-panel {
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    max-width: none;
    height: 100vh;
    max-height: none;
    transform: none;
    border-radius: 0;
    border: none;
  }

  /* Chat window becomes full-screen. !important overrides JS-set inline drag styles. */
  .chat-float-window {
    left: 0 !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none;
    max-height: none;
    min-width: 0;
    min-height: 0;
    border-radius: 0;
    border: none;
  }

  /* Disable resize handles on phones */
  .chat-float-window .cfr-handle {
    display: none;
  }
}

/* Tablet — compact window */
@media (min-width: 481px) and (max-width: 768px) {
  .chat-float-window {
    width: min(520px, calc(100vw - 32px));
    height: min(600px, calc(100vh - 80px));
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 80px);
  }

  .chat-channel-panel {
    width: min(240px, calc(100vw - 80px));
    max-width: calc(100vw - 80px);
  }
}

/* Empty state inside messages */
.cfm-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--color-text-tertiary, #9ca3af);
  text-align: center;
  padding: 40px;
}

.cfm-empty svg {
  width: 40px;
  height: 40px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.cfm-empty h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-secondary, #6b7280);
  margin: 0 0 4px;
}

.cfm-empty p {
  font-size: 13px;
  margin: 0;
}

/* Window body wraps messages + optional thread side-by-side */
.chat-float-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  background: var(--color-bg-primary, #fff);
  position: relative;
}

.chat-float-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

/* ============================================
   Context Menu
   ============================================ */
.cfm-context-menu {
  background: var(--color-bg-primary, #fff);
  border: 1px solid var(--color-border-primary, #e5e7eb);
  border-radius: var(--radius-lg);
  padding: 4px;
  min-width: 180px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
  animation: cfm-fade-in 0.12s ease;
}

@keyframes cfm-fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.cfm-ctx-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 13px;
  color: var(--color-text-primary, #1f2937);
  transition: background 0.15s;
  text-align: left;
}

.cfm-ctx-item:hover {
  background: var(--color-bg-secondary, #f3f4f6);
}

.cfm-ctx-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.cfm-ctx-chevron {
  margin-left: auto;
  color: var(--color-text-tertiary, #8b949e);
  font-size: 16px;
  line-height: 1;
}

.cfm-ctx-danger {
  color: var(--color-danger);
}

.cfm-ctx-danger:hover {
  background: var(--color-danger-subtle, #fef2f2);
}

/* ============================================
   Edited indicator
   ============================================ */
.cfm-edited {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary, #9ca3af);
  font-style: italic;
  font-weight: 400;
}

/* ============================================
   Inline Edit Form
   ============================================ */
.cfm-edit-textarea {
  width: 100%;
  min-height: 60px;
  max-height: 200px;
  padding: 8px 12px;
  border: 1px solid var(--color-border-primary, #e2e8f0);
  border-radius: var(--radius-md, 6px);
  background: var(--color-bg-secondary, #f8fafc);
  color: var(--color-text-primary, #1f2937);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.cfm-edit-textarea:focus {
  border-color: var(--color-border-focus);
  background: var(--color-bg-primary);
  box-shadow: var(--shadow-focus);
}

.cfm-edit-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.cfm-edit-hint {
  font-size: 12px;
  color: var(--color-text-tertiary, #9ca3af);
  flex: 1;
}

.cfm-edit-cancel,
.cfm-edit-save {
  padding: 6px 12px;
  border-radius: var(--radius-md, 6px);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
}

.cfm-edit-cancel {
  background: var(--color-bg-secondary, #f7fafc);
  color: var(--color-text-secondary, #4a5568);
  border: 1px solid var(--color-border-primary, #e2e8f0);
}

.cfm-edit-cancel:hover {
  background: var(--color-bg-tertiary, #edf2f7);
  border-color: var(--color-border-secondary, #cbd5e0);
}

.cfm-edit-save {
  background: var(--color-dark);
  color: var(--color-text-inverse);
  border: none;
}

.cfm-edit-save:hover {
  background: var(--color-black);
}

/* ============================================
   UCR Content Rendering in Dock
   ============================================ */
.cfm-text .content-renderer {
  font-size: var(--font-size-md);
  line-height: 1.6;
}

.cfm-text .content-renderer .rendered-markdown-content {
  /* Ensure inline elements don't break the layout */
  overflow-wrap: break-word;
  word-break: break-word;
}

.cfm-text .content-renderer .rendered-markdown-content p {
  margin: 0 0 4px;
  font-size: inherit;
}

.cfm-text .content-renderer .rendered-markdown-content p:last-child {
  margin-bottom: 0;
}

.cfm-text .content-renderer .rendered-markdown-content pre {
  margin: 4px 0;
  padding: 8px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-size: 13px;
}

.cfm-text .content-renderer .rendered-markdown-content code {
  font-size: 13px;
}

.cfm-text .content-renderer .rendered-markdown-content img {
  max-width: 100%;
  max-height: 300px;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-md);
  display: block;
}

/* Constrain any unexpected large elements inside messages */
.cfm-text .content-renderer .rendered-markdown-content h1,
.cfm-text .content-renderer .rendered-markdown-content h2,
.cfm-text .content-renderer .rendered-markdown-content h3 {
  font-size: var(--font-size-md);
  margin: 0;
}

.cfm-text .content-renderer .rendered-markdown-content blockquote {
  margin: 4px 0;
  padding: 4px 8px;
  border-left: 3px solid var(--color-border-primary, #e5e7eb);
  color: var(--color-text-secondary, #6b7280);
}

.cfm-text .content-renderer .rendered-markdown-content table {
  font-size: 13px;
  max-width: 100%;
  overflow-x: auto;
  display: block;
}

/* DM header icon sizing */
.chat-float-header-left svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

/* ============================================
   Mention Toast Notifications
   ============================================ */
.chat-mention-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 320px;
  background: var(--color-bg-primary, #fff);
  border: 1px solid var(--color-border-primary, #e5e7eb);
  border-radius: var(--radius-xl);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  padding: 14px 16px;
  z-index: var(--z-dock-tooltip, 10015);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s, transform 0.3s;
}

.chat-mention-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.cmt-header {
  font-size: 13px;
  color: var(--color-text-secondary, #6b7280);
  margin-bottom: 6px;
}

.cmt-header strong {
  color: var(--color-accent, #3b82f6);
}

.cmt-channel {
  font-weight: 600;
  color: var(--color-text-primary, #111827);
}

.cmt-content {
  font-size: var(--font-size-md);
  color: var(--color-text-primary, #111827);
  line-height: 1.4;
  margin-bottom: 6px;
}

.cmt-meta {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary, #6b7280);
}

/* ============================================
   Minimized window state — collapse to header only
   ============================================ */
.chat-float-window.minimized {
  min-height: 0;
  height: 48px !important;
  resize: none;
}

.chat-float-window.minimized .chat-float-body,
.chat-float-window.minimized .dock-colloq-bar {
  display: none;
}

.chat-float-window.minimized .cfr-handle {
  display: none;
}

/* ─── User Hover Card (shared with workspace) ─── */
.user-hover-card { position: fixed; z-index: var(--z-dock-popover, 10000); width: 300px; background: var(--color-bg-primary, #fff); border: 1px solid var(--color-border-primary, #DCE0E5); border-radius: 12px; box-shadow: 0 8px 30px rgba(44,41,37,0.12), 0 2px 8px rgba(44,41,37,0.06); opacity: 0; pointer-events: none; transform: translateY(4px); transition: opacity 0.18s ease, transform 0.18s ease; overflow: auto; }
.user-hover-card.uhc-visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.user-hover-card.uhc-above { transform: translateY(-4px); }
.user-hover-card.uhc-above.uhc-visible { transform: translateY(0); }
.uhc-inner { display: block; padding: 16px; text-decoration: none; color: inherit; cursor: pointer; }
.uhc-inner:hover { text-decoration: none; color: inherit; }
.uhc-header { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 8px; }
.uhc-avatar { flex-shrink: 0; width: 48px; height: 48px; border-radius: var(--radius-sm, 4px); overflow: hidden; }
.uhc-avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-sm, 4px); }
.uhc-avatar-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: var(--color-avatar-fallback, #5C6F5B); color: var(--color-text-inverse); font-size: 20px; font-weight: 700; border-radius: var(--radius-sm, 4px); }
.uhc-identity { flex: 1; min-width: 0; }
.uhc-name { font-size: 15px; font-weight: 700; color: var(--color-text-primary, #1D2433); line-height: 1.3; display: flex; align-items: center; gap: 6px; }
.uhc-username { font-size: 12px; color: var(--color-text-tertiary, #7C8694); margin-top: 1px; }
.uhc-meta { margin-top: 3px; font-size: 11px; color: var(--color-text-tertiary, #7C8694); display: flex; gap: 8px; flex-wrap: wrap; }
.uhc-badge { font-size: 10px; padding: 1px 6px; border-radius: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.uhc-badge-staff { background: var(--color-accent-subtle, rgba(79, 70, 229, 0.12)); color: var(--color-accent, #4f46e5); }
.uhc-bio { font-size: 13px; color: var(--color-text-secondary, #5E6978); line-height: 1.45; margin: 6px 0 8px; padding: 0; }
.uhc-areas { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.uhc-area-tag { font-size: 11px; padding: 2px 8px; border-radius: 12px; background: var(--color-bg-secondary, #F0F2F5); color: var(--color-text-secondary, #5E6978); font-weight: 500; }
.uhc-stats { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--color-text-tertiary, #7C8694); margin-bottom: 6px; }
.uhc-stat strong { color: var(--color-text-primary, #1D2433); font-weight: 600; }
.uhc-stat-sep { color: var(--color-border-primary, #DCE0E5); margin: 0 2px; }
.uhc-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 8px; border-top: 1px solid var(--color-border-primary, #DCE0E5); font-size: 11px; color: var(--color-text-tertiary, #7C8694); }
.uhc-view-profile { color: var(--color-accent, #5C6F5B); font-weight: 600; }
.uhc-loading { display: flex; align-items: center; justify-content: center; padding: 32px; }
.uhc-spinner { width: 20px; height: 20px; border: 2px solid var(--color-border-primary, #DCE0E5); border-top-color: var(--color-accent, #5C6F5B); border-radius: 50%; animation: uhc-spin 0.6s linear infinite; }
@keyframes uhc-spin { to { transform: rotate(360deg); } }
.uhc-error { padding: 20px; text-align: center; font-size: 13px; color: var(--color-text-tertiary, #7C8694); }
.uhc-actions { display: flex; gap: 8px; padding: 0 16px 14px; }
.uhc-action-btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 12px; font-size: 12px; font-weight: 600; border-radius: 6px; text-decoration: none; transition: background 0.15s; }
.uhc-action-message { background: var(--color-accent, #5c6b5a); color: var(--color-text-inverse); }
.uhc-action-message:hover { opacity: 0.9; color: var(--color-text-inverse); text-decoration: none; }
.uhc-action-profile { background: var(--color-bg-secondary, #f0f0f0); color: var(--color-text-primary, #333); }
.uhc-action-profile:hover { background: var(--color-bg-hover, #e0e0e0); text-decoration: none; color: var(--color-text-primary, #333); }

/* ============================================
   Keyboard focus rings — every custom interactive control
   ============================================ */
.chat-dock-item:focus-visible,
.chat-dock-add:focus-visible,
.chat-dock-tab:focus-visible,
.chat-dock-collapse-btn:focus-visible,
.channel-panel-item:focus-visible,
.cpanel-folder-header:focus-visible,
.cpanel-folder-toggle:focus-visible,
.chat-float-controls button:focus-visible,
.cfm-action-btn:focus-visible,
.cfm-reaction:focus-visible,
.cfm-ctx-item:focus-visible,
.chat-dock-emoji-picker .emoji-option:focus-visible,
.chat-float-thread-header .close-thread:focus-visible,
.chat-float-input-inner .attach-btn:focus-visible,
.chat-float-input-inner .emoji-btn:focus-visible,
.chat-float-input-inner .send-btn:focus-visible,
.chat-float-thread-input-inner button:focus-visible,
.dock-colloq-mute:focus-visible,
.dock-colloq-leave:focus-visible,
.dock-colloq-join:focus-visible,
.cfm-edit-cancel:focus-visible,
.cfm-edit-save:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px var(--focus-ring, #1A1A1A),
    0 0 0 4px var(--focus-ring-subtle, rgba(26, 26, 26, 0.25));
}
