/* Floating bottom-right Community & Support Hub (Discord-style) */

/* ── Floating circle launcher ── */
.ch-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 950;
  width: 58px;
  height: 58px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #ffffff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow:
    0 10px 26px -8px rgba(234, 88, 12, 0.55),
    0 2px 6px rgba(24, 24, 27, 0.16);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, opacity 0.25s ease, visibility 0.25s;
  font-family: var(--font-body, "Inter", "Segoe UI", system-ui, sans-serif);
}

/* The home page cover (logo, Log in, Sign up) stays clean: the launcher
   shows once the visitor has scrolled past it to the site itself. */
html.has-intro:not(.intro-done) .ch-fab {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(12px);
}

.ch-fab:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow:
    0 14px 32px -8px rgba(234, 88, 12, 0.62),
    0 4px 10px rgba(24, 24, 27, 0.2);
}

.ch-fab:active {
  transform: translateY(0) scale(0.98);
}

.ch-fab:focus-visible {
  outline: 3px solid rgba(234, 88, 12, 0.42);
  outline-offset: 3px;
}

.ch-fab svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ch-fab .ch-fab-ico-close {
  display: none;
}

.ch-fab.is-open {
  background: var(--ink, #18181b);
  box-shadow: 0 10px 24px -8px rgba(24, 24, 27, 0.45);
}

html[data-theme="dark"] .ch-fab.is-open {
  background: #27272a;
  border: 1px solid var(--line-strong, #3b3b42);
}

.ch-fab.is-open .ch-fab-ico-chat {
  display: none;
}

.ch-fab.is-open .ch-fab-ico-close {
  display: block;
}

.ch-fab-badge {
  position: absolute;
  top: 0;
  right: 0;
  width: 15px;
  height: 15px;
  border-radius: 999px;
  background: #16a34a;
  border: 2.5px solid var(--page, #fafaf9);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.ch-fab-badge[hidden] {
  display: none !important;
}

.ch-fab-tip {
  position: absolute;
  right: 68px;
  top: 50%;
  transform: translateY(-50%) translateX(6px);
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--ink, #18181b);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  box-shadow: 0 8px 20px -6px rgba(24, 24, 27, 0.35);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

html[data-theme="dark"] .ch-fab-tip {
  background: #27272a;
  border: 1px solid var(--line-strong, #3b3b42);
}

.ch-fab:hover .ch-fab-tip,
.ch-fab:focus-visible .ch-fab-tip {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.ch-fab.is-open .ch-fab-tip {
  display: none;
}

/* Keep recent-activation toast from colliding with bottom-right circle on phones. */
@media (max-width: 560px) {
  .act-card {
    right: 84px;
  }
  .ch-fab {
    right: 14px;
    bottom: 14px;
    width: 52px;
    height: 52px;
  }
}

/* ── Main floating Discord-style hub window ── */
.ch-panel {
  position: fixed;
  right: 22px;
  bottom: 92px;
  z-index: 980;
  width: min(880px, calc(100vw - 44px));
  height: min(630px, calc(100vh - 116px));
  border-radius: 18px;
  border: 1px solid var(--line-strong, #d4d4d8);
  background: var(--paper, #ffffff);
  color: var(--ink, #18181b);
  box-shadow:
    0 24px 60px -16px rgba(24, 24, 27, 0.28),
    0 2px 8px rgba(24, 24, 27, 0.08);
  display: grid;
  grid-template-columns: 228px 1fr;
  overflow: hidden;
  font-family: var(--font-body, "Inter", "Segoe UI", system-ui, sans-serif);
  animation: ch-pop-in 0.18s ease-out;
}

.ch-panel[hidden] {
  display: none !important;
}

@keyframes ch-pop-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.ch-panel *,
.ch-panel *::before,
.ch-panel *::after {
  box-sizing: border-box;
}

/* ── Left server & channels sidebar ── */
.ch-sidebar {
  background: var(--paper-deep, #f4f4f5);
  border-right: 1px solid var(--line, #e4e4e7);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  position: relative;
}

html[data-theme="dark"] .ch-sidebar {
  background: #141417;
}

.ch-server-head {
  padding: 13px 13px 12px;
  border-bottom: 1px solid var(--line, #e4e4e7);
  display: flex;
  align-items: center;
  gap: 10px;
}

.ch-server-logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  flex: none;
  object-fit: cover;
  background: #18181b;
}

.ch-server-meta {
  min-width: 0;
  flex: 1;
}

.ch-server-name {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: var(--ink, #18181b);
  line-height: 1.2;
}

.ch-online-row {
  margin: 3px 0 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--ink-soft, #52525b);
}

.ch-online-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.16);
}

.ch-sidebar-close {
  display: none;
  border: 0;
  background: none;
  color: var(--ink-soft, #52525b);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  place-items: center;
}

.ch-channel-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 8px;
}

.ch-cat {
  margin: 12px 8px 5px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink-faint, #71717a);
  text-transform: uppercase;
}

.ch-cat:first-child {
  margin-top: 2px;
}

.ch-chan {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink-soft, #52525b);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  margin-bottom: 2px;
  border-radius: 9px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.ch-chan:hover {
  background: rgba(24, 24, 27, 0.05);
  color: var(--ink, #18181b);
}

html[data-theme="dark"] .ch-chan:hover {
  background: rgba(255, 255, 255, 0.06);
}

.ch-chan.is-active {
  background: var(--accent-soft, #fff4ec);
  color: var(--accent-deep, #c2410c);
  font-weight: 600;
}

html[data-theme="dark"] .ch-chan.is-active {
  background: rgba(249, 115, 22, 0.16);
  color: #fdba74;
}

.ch-chan-ico {
  width: 15px;
  height: 15px;
  flex: none;
  opacity: 0.78;
}

.ch-chan-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ch-chan-lock {
  width: 12px;
  height: 12px;
  flex: none;
  opacity: 0.55;
}

.ch-chan-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 999px;
  background: var(--accent, #ea580c);
}

.ch-chan-dot[hidden] {
  display: none !important;
}

.ch-quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 8px 10px;
  border-top: 1px solid var(--line, #e4e4e7);
}

.ch-quick-links a {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-soft, #52525b);
  background: var(--paper, #ffffff);
  border: 1px solid var(--line, #e4e4e7);
  border-radius: 999px;
  padding: 3px 9px;
  text-decoration: none;
  transition: border-color 0.12s ease, color 0.12s ease;
}

.ch-quick-links a:hover {
  border-color: var(--accent, #ea580c);
  color: var(--accent-deep, #c2410c);
}

/* ── Bottom Discord-style user bar ── */
.ch-user-bar {
  padding: 10px 10px;
  border-top: 1px solid var(--line, #e4e4e7);
  background: rgba(24, 24, 27, 0.03);
  display: flex;
  align-items: center;
  gap: 9px;
}

html[data-theme="dark"] .ch-user-bar {
  background: rgba(255, 255, 255, 0.03);
}

.ch-avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  color: #ffffff;
  font-weight: 700;
  font-size: 13.5px;
  display: grid;
  place-items: center;
  flex: none;
  user-select: none;
}

.ch-avatar.is-small {
  width: 30px;
  height: 30px;
  font-size: 12px;
}

.ch-user-meta {
  min-width: 0;
  flex: 1;
}

.ch-user-name {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink, #18181b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.ch-user-sub {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--ink-faint, #71717a);
  display: flex;
  align-items: center;
  gap: 5px;
}

.ch-user-edit,
.ch-login-pill {
  border: 1px solid var(--line-strong, #d4d4d8);
  background: var(--paper, #ffffff);
  color: var(--ink, #18181b);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  display: inline-grid;
  place-items: center;
  flex: none;
}

.ch-user-edit {
  width: 28px;
  height: 28px;
  padding: 0;
}

.ch-user-edit:hover,
.ch-login-pill:hover {
  border-color: var(--accent, #ea580c);
  color: var(--accent-deep, #c2410c);
}

.ch-login-pill {
  padding: 5px 11px;
  background: var(--accent, #ea580c);
  border-color: var(--accent, #ea580c);
  color: #ffffff;
}

.ch-login-pill:hover {
  background: var(--accent-deep, #c2410c);
  border-color: var(--accent-deep, #c2410c);
  color: #ffffff;
}

/* ── Main chat column ── */
.ch-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  position: relative;
  background: var(--paper, #ffffff);
}

.ch-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line, #e4e4e7);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
}

.ch-menu-btn {
  display: none;
  border: 1px solid var(--line, #e4e4e7);
  background: var(--paper-deep, #f4f4f5);
  color: var(--ink, #18181b);
  width: 32px;
  height: 32px;
  border-radius: 9px;
  cursor: pointer;
  flex: none;
  place-items: center;
}

.ch-header-title {
  min-width: 0;
  flex: 1;
}

.ch-header-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ch-header-name {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink, #18181b);
}

.ch-header-desc {
  margin: 1px 0 0;
  font-size: 12px;
  color: var(--ink-faint, #71717a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ch-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.ch-slowmode-pill {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--paper-deep, #f4f4f5);
  border: 1px solid var(--line, #e4e4e7);
  color: var(--ink-soft, #52525b);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.ch-slowmode-pill[hidden] {
  display: none !important;
}

.ch-icon-btn {
  position: relative;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft, #52525b);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.ch-icon-btn:hover,
.ch-icon-btn[aria-expanded="true"] {
  background: var(--paper-deep, #f4f4f5);
  color: var(--ink, #18181b);
}

.ch-pin-count {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--accent, #ea580c);
  color: #ffffff;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
}

.ch-pin-count[hidden] {
  display: none !important;
}

/* ── Live Announcement Banner & Channel Quick Strips ── */
.ch-live-announce {
  margin: 10px 14px 0;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid rgba(234, 88, 12, 0.28);
  background: var(--accent-soft, #fff4ec);
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  line-height: 1.4;
}

html[data-theme="dark"] .ch-live-announce {
  background: var(--dk-warm, rgba(249, 115, 22, 0.12));
  border-color: var(--dk-warm-line, rgba(251, 146, 60, 0.35));
}

.ch-live-announce[hidden] {
  display: none !important;
}

.ch-live-badge {
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent, #ea580c);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  flex: none;
}

.ch-live-text {
  flex: 1;
  min-width: 0;
  color: var(--ink, #18181b);
  font-weight: 500;
}

.ch-live-link {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--ink, #18181b);
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 700;
  text-decoration: none;
  flex: none;
}

html[data-theme="dark"] .ch-live-link {
  background: #f4f4f5;
  color: #18181b;
}

.ch-quick-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line, #e4e4e7);
  background: var(--paper, #ffffff);
}

.ch-quick-strip[hidden] {
  display: none !important;
}

.ch-strip-pill {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink, #18181b);
  background: var(--paper-deep, #f4f4f5);
  border: 1px solid var(--line, #e4e4e7);
  border-radius: 999px;
  padding: 4px 11px;
  text-decoration: none;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.ch-strip-pill:hover {
  border-color: var(--accent, #ea580c);
  color: var(--accent-deep, #c2410c);
}

/* ── Pinned messages drawer ── */
.ch-pins-drawer {
  position: absolute;
  top: 54px;
  right: 12px;
  width: min(360px, calc(100% - 24px));
  max-height: 320px;
  overflow-y: auto;
  z-index: 30;
  border-radius: 14px;
  border: 1px solid var(--line-strong, #d4d4d8);
  background: var(--paper, #ffffff);
  box-shadow: var(--shadow-lg, 0 18px 40px -12px rgba(0, 0, 0, 0.25));
  padding: 10px;
}

.ch-pins-drawer[hidden] {
  display: none !important;
}

.ch-pins-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px 8px;
  border-bottom: 1px solid var(--line, #e4e4e7);
  margin-bottom: 8px;
  font-size: 12.5px;
  font-weight: 700;
}

.ch-pin-item {
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--paper-deep, #f4f4f5);
  margin-bottom: 6px;
  cursor: pointer;
}

.ch-pin-item:last-child {
  margin-bottom: 0;
}

.ch-pin-item-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 3px;
}

.ch-pin-item-body {
  font-size: 12.5px;
  color: var(--ink-soft, #52525b);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Scrollable messages feed ── */
.ch-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ch-load-more {
  align-self: center;
  margin: 2px 0 10px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong, #d4d4d8);
  background: var(--paper-deep, #f4f4f5);
  color: var(--ink-soft, #52525b);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.ch-load-more:hover {
  border-color: var(--accent, #ea580c);
  color: var(--accent-deep, #c2410c);
}

.ch-empty {
  margin: auto;
  padding: 28px 16px;
  text-align: center;
  color: var(--ink-faint, #71717a);
  font-size: 13.5px;
}

.ch-msg {
  position: relative;
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 0 11px;
  align-items: start;
  padding: 7px 10px;
  border-radius: 10px;
  transition: background 0.12s ease;
}

.ch-msg.is-grouped {
  padding-top: 2px;
  padding-bottom: 2px;
}

.ch-msg:hover {
  background: rgba(24, 24, 27, 0.035);
}

html[data-theme="dark"] .ch-msg:hover {
  background: rgba(255, 255, 255, 0.04);
}

.ch-msg.is-highlight {
  background: var(--accent-soft, #fff4ec);
}

html[data-theme="dark"] .ch-msg.is-highlight {
  background: rgba(249, 115, 22, 0.18);
}

.ch-msg-gutter {
  display: flex;
  justify-content: center;
  padding-top: 1px;
}

.ch-mini-time {
  font-size: 10px;
  color: var(--ink-faint, #71717a);
  opacity: 0;
  padding-top: 3px;
  user-select: none;
}

.ch-msg:hover .ch-mini-time {
  opacity: 1;
}

.ch-msg-col {
  min-width: 0;
}

.ch-reply-ref {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 3px;
  padding: 2px 8px;
  border-radius: 7px;
  border-left: 2.5px solid var(--accent, #ea580c);
  background: rgba(24, 24, 27, 0.035);
  color: var(--ink-soft, #52525b);
  font-size: 11.5px;
  max-width: 100%;
  cursor: pointer;
}

html[data-theme="dark"] .ch-reply-ref {
  background: rgba(255, 255, 255, 0.05);
}

.ch-reply-ref-author {
  font-weight: 700;
  color: var(--ink, #18181b);
  flex: none;
}

.ch-reply-ref-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ch-msg-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.ch-msg-author {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink, #18181b);
}

.ch-role {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  line-height: 1.5;
}

.ch-role.is-admin {
  background: var(--accent, #ea580c);
  color: #ffffff;
}

.ch-role.is-system {
  background: var(--ink, #18181b);
  color: #ffffff;
}

html[data-theme="dark"] .ch-role.is-system {
  background: #f4f4f5;
  color: #18181b;
}

.ch-role.is-max {
  background: rgba(124, 58, 237, 0.14);
  color: #6d28d9;
}

html[data-theme="dark"] .ch-role.is-max {
  background: rgba(167, 139, 250, 0.18);
  color: #c4b5fd;
}

.ch-role.is-pro {
  background: rgba(2, 132, 199, 0.13);
  color: #0369a1;
}

html[data-theme="dark"] .ch-role.is-pro {
  background: rgba(56, 189, 248, 0.16);
  color: #7dd3fc;
}

.ch-role.is-plus {
  background: rgba(21, 128, 61, 0.13);
  color: #15803d;
}

html[data-theme="dark"] .ch-role.is-plus {
  background: rgba(74, 222, 128, 0.16);
  color: #86efac;
}

.ch-role.is-lite {
  background: rgba(113, 113, 122, 0.14);
  color: var(--ink-soft, #52525b);
}

.ch-msg-time {
  font-size: 11px;
  color: var(--ink-faint, #71717a);
}

.ch-pin-tag {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-deep, #c2410c);
  background: var(--accent-soft, #fff4ec);
  padding: 1px 6px;
  border-radius: 999px;
}

.ch-msg-body {
  font-size: 13.75px;
  line-height: 1.5;
  color: var(--ink, #18181b);
  white-space: pre-wrap;
  word-break: break-word;
}

.ch-msg-body a {
  color: var(--accent-deep, #c2410c);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ch-msg-body code {
  font-family: var(--font-mono, ui-monospace, Consolas, monospace);
  font-size: 12.25px;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--paper-deep, #f4f4f5);
  border: 1px solid var(--line, #e4e4e7);
}

.ch-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
}

.ch-react-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--line, #e4e4e7);
  background: var(--paper-deep, #f4f4f5);
  color: var(--ink-soft, #52525b);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.ch-react-pill:hover {
  border-color: var(--line-strong, #d4d4d8);
}

.ch-react-pill.is-mine {
  border-color: var(--accent, #ea580c);
  background: var(--accent-soft, #fff4ec);
  color: var(--accent-deep, #c2410c);
}

html[data-theme="dark"] .ch-react-pill.is-mine {
  background: rgba(249, 115, 22, 0.18);
  color: #fdba74;
}

/* ── Floating message action bar on hover ── */
.ch-msg-actions {
  position: absolute;
  right: 8px;
  top: -12px;
  z-index: 15;
  display: none;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--line-strong, #d4d4d8);
  background: var(--paper, #ffffff);
  box-shadow: var(--shadow, 0 8px 20px -8px rgba(0, 0, 0, 0.22));
}

.ch-msg:hover .ch-msg-actions,
.ch-msg.is-menu-open .ch-msg-actions {
  display: flex;
}

.ch-act-btn {
  border: 0;
  background: transparent;
  color: var(--ink-soft, #52525b);
  height: 26px;
  padding: 0 7px;
  border-radius: 7px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ch-act-btn:hover {
  background: var(--paper-deep, #f4f4f5);
  color: var(--ink, #18181b);
}

.ch-act-btn.is-danger:hover {
  background: rgba(220, 38, 38, 0.12);
  color: #dc2626;
}

.ch-emoji-popover,
.ch-mute-popover {
  position: absolute;
  right: 8px;
  top: 18px;
  z-index: 25;
  display: flex;
  gap: 3px;
  padding: 5px;
  border-radius: 11px;
  border: 1px solid var(--line-strong, #d4d4d8);
  background: var(--paper, #ffffff);
  box-shadow: var(--shadow-lg, 0 16px 36px -10px rgba(0, 0, 0, 0.28));
}

.ch-mute-popover {
  flex-direction: column;
  min-width: 118px;
}

.ch-emoji-choice {
  border: 0;
  background: transparent;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.ch-emoji-choice:hover {
  background: var(--paper-deep, #f4f4f5);
  transform: scale(1.1);
}

.ch-mute-choice {
  border: 0;
  background: transparent;
  color: var(--ink, #18181b);
  padding: 6px 9px;
  border-radius: 7px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.ch-mute-choice:hover {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
}

/* ── Bottom composer & anti-spam bar ── */
.ch-composer-wrap {
  padding: 9px 14px 12px;
  border-top: 1px solid var(--line, #e4e4e7);
  background: var(--paper, #ffffff);
}

.ch-reply-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
  padding: 5px 10px;
  border-radius: 9px;
  background: var(--paper-deep, #f4f4f5);
  font-size: 12px;
  color: var(--ink-soft, #52525b);
}

.ch-reply-bar[hidden] {
  display: none !important;
}

.ch-reply-cancel {
  border: 0;
  background: none;
  color: var(--ink-faint, #71717a);
  cursor: pointer;
  font-weight: 700;
  padding: 2px 6px;
}

.ch-notice {
  margin-bottom: 8px;
  padding: 7px 11px;
  border-radius: 10px;
  border: 1px solid rgba(234, 88, 12, 0.35);
  background: var(--accent-soft, #fff4ec);
  color: var(--accent-deep, #c2410c);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
}

html[data-theme="dark"] .ch-notice {
  background: rgba(249, 115, 22, 0.14);
  color: #fdba74;
}

.ch-notice[hidden] {
  display: none !important;
}

.ch-composer {
  border: 1px solid var(--line-strong, #d4d4d8);
  background: var(--paper-deep, #f4f4f5);
  border-radius: 14px;
  padding: 8px 10px;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.ch-composer:focus-within {
  border-color: var(--accent, #ea580c);
  box-shadow: var(--ring, 0 0 0 3px rgba(234, 88, 12, 0.18));
}

.ch-composer[hidden] {
  display: none !important;
}

.ch-input {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink, #18181b);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.45;
  resize: none;
  min-height: 22px;
  max-height: 128px;
  outline: none;
}

.ch-input::placeholder {
  color: var(--ink-faint, #71717a);
}

.ch-composer-foot {
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ch-composer-hint {
  font-size: 11px;
  color: var(--ink-faint, #71717a);
}

.ch-composer-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ch-char-count {
  font-size: 11px;
  color: var(--ink-faint, #71717a);
  font-variant-numeric: tabular-nums;
}

.ch-char-count.is-over {
  color: #dc2626;
  font-weight: 700;
}

.ch-send-btn {
  border: 0;
  border-radius: 9px;
  background: var(--accent, #ea580c);
  color: #ffffff;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 14px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: background 0.14s ease, opacity 0.14s ease;
}

.ch-send-btn:hover:not(:disabled) {
  background: var(--accent-deep, #c2410c);
}

.ch-send-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ch-composer-locked {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 13px;
  border-radius: 12px;
  background: var(--paper-deep, #f4f4f5);
  border: 1px solid var(--line, #e4e4e7);
  font-size: 13px;
  color: var(--ink-soft, #52525b);
}

.ch-composer-locked[hidden] {
  display: none !important;
}

/* ── Profile editor modal inside panel ── */
.ch-modal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: rgba(24, 24, 27, 0.45);
  display: grid;
  place-items: center;
  padding: 16px;
}

.ch-modal-backdrop[hidden] {
  display: none !important;
}

.ch-modal {
  width: min(360px, 100%);
  border-radius: 16px;
  border: 1px solid var(--line-strong, #d4d4d8);
  background: var(--paper, #ffffff);
  color: var(--ink, #18181b);
  box-shadow: var(--shadow-lg);
  padding: 18px;
}

.ch-modal h3 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
}

.ch-modal-sub {
  margin: 0 0 14px;
  font-size: 12.5px;
  color: var(--ink-faint, #71717a);
}

.ch-field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft, #52525b);
}

.ch-name-input {
  width: 100%;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid var(--line-strong, #d4d4d8);
  background: var(--paper-deep, #f4f4f5);
  color: var(--ink, #18181b);
  font-family: inherit;
  font-size: 13.5px;
  margin-bottom: 12px;
}

.ch-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.ch-swatch {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}

.ch-swatch.is-selected {
  border-color: var(--ink, #18181b);
  transform: scale(1.1);
}

.ch-modal-err {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  color: #dc2626;
}

.ch-modal-err[hidden] {
  display: none !important;
}

.ch-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.ch-btn-ghost,
.ch-btn-primary {
  padding: 7px 14px;
  border-radius: 9px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.ch-btn-ghost {
  border: 1px solid var(--line-strong, #d4d4d8);
  background: transparent;
  color: var(--ink, #18181b);
}

.ch-btn-primary {
  border: 0;
  background: var(--accent, #ea580c);
  color: #ffffff;
}

.ch-drawer-scrim {
  display: none;
}

/* ── Mobile layout (<= 720px) ── */
@media (max-width: 720px) {
  .ch-fab-tip {
    display: none;
  }

  .ch-panel {
    inset: 0;
    width: 100%;
    height: 100dvh;
    border-radius: 0;
    border: 0;
    grid-template-columns: 1fr;
  }

  .ch-menu-btn {
    display: grid;
  }

  .ch-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(275px, 82vw);
    z-index: 50;
    transform: translateX(-102%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-lg);
  }

  .ch-sidebar.is-open {
    transform: translateX(0);
  }

  .ch-sidebar-close {
    display: grid;
  }

  .ch-drawer-scrim.is-open {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 45;
    background: rgba(0, 0, 0, 0.45);
  }

  .ch-msg-actions {
    position: static;
    display: inline-flex;
    margin-top: 6px;
    box-shadow: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ch-fab,
  .ch-fab-tip,
  .ch-panel,
  .ch-sidebar,
  .ch-msg {
    transition: none;
    animation: none;
  }
}
