/**
 * Media Boutique Chat Widget — современный вид в стиле Telegram / Discord / Notion.
 * Структура сохранена, оформление обновлено.
 */
.cw-root {
  --cw-bg: var(--mb-bg-panel, #1c1c1e);
  --cw-bg-elevated: rgba(44, 44, 46, 0.95);
  --cw-bg-hover: rgba(255, 255, 255, 0.06);
  --cw-bg-active: rgba(255, 255, 255, 0.08);
  --cw-border: rgba(255, 255, 255, 0.08);
  --cw-border-subtle: rgba(255, 255, 255, 0.04);
  --cw-accent: var(--mb-accent, #f97316);
  --cw-accent-soft: rgba(249, 115, 22, 0.14);
  --cw-text: var(--mb-text, #f2f2f7);
  --cw-text-secondary: rgba(235, 235, 245, 0.72);
  --cw-text-muted: var(--mb-text-muted, #8e8e93);
  --cw-success: var(--mb-success, #30d158);
  --cw-radius: 12px;
  --cw-radius-sm: 8px;
  --cw-radius-xs: 6px;
  --cw-radius-full: 9999px;
  --cw-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --cw-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', system-ui, sans-serif;
}

.cw-root {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  box-sizing: border-box;
  background: var(--cw-bg);
  font-family: var(--cw-font);
  color: var(--cw-text);
  border: none;
  border-radius: 0;
}

/* Standalone: заполняем #chat-mount (flex), не fixed — иначе перекрываем шапку и ломаем 100vh на iOS */
.cw-root.cw-standalone {
  position: relative;
  flex: 1 1 auto;
  align-self: stretch;
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  border-radius: 0;
}

.cw-layout {
  display: flex;
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

/* ——— Сайдбар каналов (Discord-стиль) ——— */
.cw-channels-wrap {
  flex-shrink: 0;
  width: 56px;
  min-width: 56px;
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(249, 115, 22, 0.08), transparent 55%),
    linear-gradient(180deg, rgba(39, 39, 42, 0.96), rgba(24, 24, 27, 0.96));
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.2s ease, min-width 0.2s ease;
}
.cw-channels-wrap.cw-has-live-voice {
  box-shadow: inset -1px 0 0 rgba(249, 115, 22, 0.22), inset 0 0 0 1px rgba(249, 115, 22, 0.04);
}
.cw-channels-wrap.cw-expanded {
  width: 200px;
  min-width: 200px;
}
.cw-channels-wrap.cw-collapsed {
  width: 56px;
  min-width: 56px;
}
.cw-channels-wrap.cw-collapsed .cw-channel-section-title,
.cw-channels-wrap.cw-collapsed .cw-channel-name,
.cw-channels-wrap.cw-collapsed .cw-channel-unread {
  display: none !important;
}
/* В свёрнутом виде: квадратные кнопки, счётчик войса виден, тултип справа при наведении */
.cw-channels-wrap.cw-collapsed .cw-channel-item {
  position: relative;
  margin: 4px auto;
  width: 44px;
  padding-left: 0;
  padding-right: 0;
  justify-content: center;
  flex-direction: column;
  gap: 3px;
  min-height: 56px;
  height: 56px;
  box-sizing: border-box;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.cw-channels-wrap.cw-collapsed .cw-channel-item .cw-voice-count {
  display: block !important;
  margin-left: 0;
  font-size: 9px;
  line-height: 1.1;
  min-width: 0;
  text-align: center;
}
.cw-channels-wrap.cw-collapsed .cw-channel-item .cw-voice-avatars,
.cw-channels-wrap.cw-expanded.cw-collapsed .cw-channel-item .cw-voice-avatars {
  margin-left: 0;
  margin-top: 0;
  justify-content: center;
  max-width: 30px;
}
.cw-channels-wrap.cw-collapsed .cw-channel-item .cw-voice-avatar,
.cw-channels-wrap.cw-expanded.cw-collapsed .cw-channel-item .cw-voice-avatar {
  width: 12px;
  height: 12px;
  margin-left: -4px;
  border-width: 1px;
}
.cw-channels-wrap.cw-collapsed .cw-channel-item .cw-voice-avatar:first-child,
.cw-channels-wrap.cw-expanded.cw-collapsed .cw-channel-item .cw-voice-avatar:first-child {
  margin-left: 0;
}
.cw-channel-tooltip {
  display: none;
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 10px;
  padding: 6px 12px;
  background: var(--cw-bg-elevated);
  border: 1px solid var(--cw-border);
  border-radius: var(--cw-radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--cw-text);
  white-space: nowrap;
  pointer-events: none;
  z-index: 1000;
  box-shadow: var(--cw-shadow-sm);
}
.cw-channels-wrap.cw-collapsed .cw-channel-item:hover .cw-channel-tooltip,
.cw-channels-wrap.cw-expanded.cw-collapsed .cw-channel-item:hover .cw-channel-tooltip {
  display: block;
}
.cw-channels-wrap.cw-collapsed .cw-channel-add {
  padding-left: 0;
  padding-right: 0;
}
.cw-channels-wrap.cw-hidden {
  display: none !important;
}
.cw-channels-wrap:not(.cw-expanded) .cw-channel-section-title {
  display: none;
}

.cw-sidebar-toggle {
  flex-shrink: 0;
  width: 100%;
  height: 36px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--cw-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: color 0.15s, background 0.15s;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.cw-sidebar-toggle:hover {
  color: var(--cw-text);
  background: rgba(255, 255, 255, 0.06);
}
.cw-channels-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 0;
}

.cw-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 99;
}
.cw-sidebar-backdrop.cw-hidden {
  display: none !important;
}
.cw-channels-wrap.cw-overlay + .cw-sidebar-backdrop:not(.cw-hidden) {
  display: block;
}

.cw-channel-unread {
  margin-left: auto;
  padding: 2px 6px;
  min-width: 18px;
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  background: var(--cw-accent);
  color: #fff;
  border-radius: var(--cw-radius-full);
  flex-shrink: 0;
}
.cw-voice-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--cw-text-muted);
  font-weight: 500;
  flex-shrink: 0;
  min-width: 18px;
  text-align: right;
}

.cw-channel-add {
  flex-shrink: 0;
  width: 100%;
  padding: 8px;
  border: none;
  background: transparent;
  color: var(--cw-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: color 0.15s, background 0.15s;
}
.cw-channel-add:hover {
  color: var(--cw-text);
  background: var(--cw-bg-hover);
}
.cw-channel-section {
  margin-bottom: 8px;
}
.cw-channel-section:last-of-type {
  margin-bottom: 0;
}
.cw-channel-section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.58);
  padding: 14px 12px 7px;
  opacity: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
}
.cw-channel-section-live-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(249, 115, 22, 0.2);
  color: #fdba74;
  border: 1px solid rgba(249, 115, 22, 0.38);
}
.cw-channel-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  margin: 0 8px 4px;
  border-radius: 10px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.74);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.12s;
  min-height: 32px;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.04);
}
.cw-channel-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--cw-text);
  transform: translateX(1px);
  border-color: rgba(255, 255, 255, 0.14);
}
.cw-channel-item.active {
  background: linear-gradient(90deg, rgba(249, 115, 22, 0.24), rgba(249, 115, 22, 0.08));
  color: var(--cw-text);
  font-weight: 600;
  border-color: rgba(249, 115, 22, 0.45);
  box-shadow: 0 6px 14px rgba(249, 115, 22, 0.18), inset 0 0 0 1px rgba(249, 115, 22, 0.14);
}
.cw-channel-item.cw-channel-voice .cw-channel-emoji {
  color: var(--cw-accent);
}
.cw-channel-item.cw-channel-voice.cw-voice-live {
  background: linear-gradient(90deg, rgba(249, 115, 22, 0.18), rgba(249, 115, 22, 0.06));
  border-color: rgba(249, 115, 22, 0.34);
  color: var(--cw-text);
}
.cw-channel-item.cw-channel-voice.cw-voice-live .cw-channel-name {
  font-weight: 600;
}
.cw-channel-item.cw-channel-voice.cw-voice-live .cw-voice-count {
  color: #fdba74;
  font-weight: 700;
}
.cw-voice-avatars {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  flex-shrink: 0;
  max-width: 36px;
  overflow: hidden;
}
.cw-voice-avatar {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  overflow: hidden;
  border: 1.5px solid rgba(10, 10, 12, 0.95);
  margin-left: -5px;
  background: #27272a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
}
.cw-voice-avatar:first-child { margin-left: 0; }
.cw-voice-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cw-voice-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fb923c;
  box-shadow: 0 0 0 0 rgba(251, 146, 60, 0.55);
  animation: cw-voice-live-pulse 1.4s ease-out infinite;
  flex-shrink: 0;
}
@keyframes cw-voice-live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(251, 146, 60, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(251, 146, 60, 0); }
  100% { box-shadow: 0 0 0 0 rgba(251, 146, 60, 0); }
}
.cw-channel-item .cw-channel-emoji {
  font-size: 17px;
  flex-shrink: 0;
  line-height: 1;
  width: 20px;
  text-align: center;
}
.cw-channel-item .cw-channel-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: inherit;
}
.cw-channels-wrap:not(.cw-expanded) .cw-channel-name {
  display: none;
}

@media (min-width: 700px) {
  .cw-channels-wrap {
    width: 200px;
    min-width: 200px;
  }
  .cw-channels-wrap.cw-expanded {
    width: 200px;
    min-width: 200px;
  }
  .cw-channels-wrap.cw-expanded.cw-collapsed {
    width: 56px;
    min-width: 56px;
  }
  .cw-channels-wrap.cw-expanded.cw-collapsed .cw-channel-section-title,
  .cw-channels-wrap.cw-expanded.cw-collapsed .cw-channel-name,
  .cw-channels-wrap.cw-expanded.cw-collapsed .cw-channel-unread {
    display: none !important;
  }
  .cw-channels-wrap.cw-expanded.cw-collapsed .cw-channel-item {
    position: relative;
    flex-direction: column;
    min-height: 56px;
    height: 56px;
  }
  .cw-channels-wrap.cw-expanded.cw-collapsed .cw-channel-item .cw-voice-count {
    display: block !important;
    margin-left: 0;
    font-size: 10px;
  }
}
@media (max-width: 699px) {
  .cw-channels-wrap {
    width: 56px !important;
    min-width: 56px !important;
  }
  .cw-channels-wrap:not(.cw-overlay) {
    width: 56px !important;
    min-width: 56px !important;
  }
  .cw-channels-wrap.cw-expanded.cw-overlay {
    position: fixed;
    left: 0;
    top: env(safe-area-inset-top, 0px);
    bottom: 0;
    width: 260px !important;
    min-width: 260px !important;
    z-index: 100;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.35);
  }
}

/* ——— Основная область ——— */
.cw-main {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cw-main.cw-voice-active {
  --cw-voice-height: 70%;
}
.cw-main.cw-voice-active .cw-voice-channel-panel:not(.cw-voice-full) {
  flex: none;
  height: var(--cw-voice-height);
  min-height: 100px;
  max-height: 85%;
  overflow: hidden;
}
.cw-main.cw-voice-active .cw-voice-channel-panel.cw-voice-full {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 0;
}
.cw-main.cw-voice-active .cw-voice-channel-panel.cw-voice-full .cw-voice-room-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}
.cw-main.cw-voice-active .cw-voice-channel-panel.cw-voice-full .cw-voice-iframe {
  flex: 1;
  min-height: 0;
  max-height: none;
}
.cw-main.cw-voice-active .cw-voice-channel-panel.cw-voice-full .cw-voice-iframe.cw-hidden {
  flex: none;
}
.cw-main.cw-voice-active .cw-voice-channel-panel.cw-voice-full .cw-voice-join-prompt,
.cw-main.cw-voice-active .cw-voice-channel-panel.cw-voice-full .cw-voice-not-configured {
  flex: 1;
  min-height: 200px;
}
.cw-main.cw-voice-active .cw-box.cw-hidden {
  display: none !important;
}
.cw-main.cw-voice-active .cw-box:not(.cw-hidden) {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.cw-voice-resize-handle {
  flex-shrink: 0;
  height: 4px;
  cursor: ns-resize;
  background: var(--cw-border-subtle);
  transition: background 0.15s;
  display: none;
}
.cw-voice-resize-handle:hover {
  background: var(--cw-accent);
}
.cw-main.cw-voice-active .cw-voice-resize-handle:not(.cw-hidden) {
  display: block;
}
.cw-main.cw-voice-active .cw-voice-channel-panel.cw-voice-full ~ .cw-voice-resize-handle {
  display: none !important;
}
.cw-voice-channel-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: var(--cw-text-muted);
  text-align: center;
  background: var(--cw-bg);
}
.cw-voice-channel-panel.cw-visible {
  display: flex;
}
.cw-voice-channel-panel.cw-visible.cw-with-chat:not(.cw-voice-full) {
  flex: none;
  min-height: 200px;
  max-height: 400px;
  overflow: hidden;
}
.cw-main.cw-voice-active .cw-voice-channel-panel.cw-visible.cw-with-chat:not(.cw-voice-full) {
  flex: none;
  height: var(--cw-voice-height);
  min-height: 100px;
  max-height: 85%;
  overflow: hidden;
}
/* Полоска с бейджами и плавающими баблами в голосовом канале */
.cw-voice-floating-strip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 16px 20px;
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 16px;
  pointer-events: none;
  min-height: 72px;
}
.cw-voice-bubble-slot {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  pointer-events: auto;
  opacity: 0;
  transform: scale(0.6) translateY(12px);
  transition: opacity 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.cw-voice-bubble-slot.cw-voice-bubble-slot-visible {
  opacity: 1;
  transform: scale(1) translateY(0);
}
.cw-voice-bubble-slot.cw-voice-bubble-slot-leave {
  opacity: 0;
  transform: scale(0.85) translateY(8px);
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.55, 0, 0.55, 0.2);
  pointer-events: none;
}
.cw-voice-badge {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid var(--cw-border);
  background: var(--cw-bg-elevated);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.cw-voice-bubble-slot.cw-voice-bubble-slot-visible .cw-voice-badge:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
.cw-voice-badge-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cw-voice-badge-avatar.cw-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}
.cw-voice-bubbles {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}
@keyframes cw-voice-bubble-float {
  0%, 100% { transform: translateY(-6px); }
  50% { transform: translateY(-10px); }
}
.cw-voice-float-bubble {
  max-width: 220px;
  padding: 8px 12px;
  border-radius: 14px;
  background: var(--cw-bg-elevated);
  border: 1px solid var(--cw-border);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  font-size: 13px;
  line-height: 1.4;
  color: var(--cw-text);
  opacity: 0;
  transform: translateY(12px) scale(0.88);
  transition: opacity 0.28s cubic-bezier(0.34, 1.2, 0.64, 1), transform 0.35s cubic-bezier(0.34, 1.2, 0.64, 1), box-shadow 0.25s ease;
}
.cw-voice-float-bubble.cw-voice-float-bubble-visible {
  opacity: 1;
  transform: translateY(-6px) scale(1);
  animation: cw-voice-bubble-float 3s ease-in-out infinite;
}
.cw-voice-float-bubble.cw-voice-float-bubble-leave {
  opacity: 0;
  transform: translateY(-18px) scale(0.9);
  transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.55, 0, 0.55, 0.2);
  animation: none;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}
.cw-voice-float-bubble-text {
  display: block;
  word-break: break-word;
}
.cw-voice-float-bubble-text .mention {
  color: var(--cw-accent);
}
.cw-voice-float-bubble-label {
  display: block;
}
.cw-voice-bubble-img {
  max-width: 200px;
  max-height: 140px;
  width: auto;
  height: auto;
  border-radius: 10px;
  display: block;
  object-fit: contain;
}
.cw-voice-channel-panel.cw-hidden {
  display: none !important;
}
.cw-voice-channel-panel .cw-join-btn {
  margin-top: 16px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--cw-radius-sm);
  background: var(--cw-accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.cw-voice-channel-panel .cw-join-btn:hover {
  opacity: 0.92;
}
.cw-voice-join-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
}
.cw-voice-join-prompt.cw-hidden {
  display: none !important;
}
.cw-voice-join-text {
  margin: 0;
  font-size: 15px;
  color: var(--cw-text);
}
.cw-voice-join-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.cw-voice-join-actions .cw-btn {
  padding: 10px 20px;
  border-radius: var(--cw-radius-sm);
  border: none;
  font-size: 14px;
  cursor: pointer;
}
.cw-voice-join-btn {
  background: var(--cw-accent);
  color: #fff;
}
.cw-voice-join-cancel {
  background: var(--cw-bg-elevated);
  color: var(--cw-text);
}
.cw-voice-channel-panel .cw-voice-iframe {
  flex: 1;
  width: 100%;
  min-height: 320px;
  border: none;
  border-radius: var(--cw-radius-sm);
  background: var(--cw-bg);
}
.cw-voice-channel-panel .cw-voice-iframe.cw-hidden {
  display: none !important;
}
@media (max-width: 400px) {
  .cw-voice-channel-panel.cw-visible.cw-with-chat {
    min-height: 280px;
    max-height: 320px;
    padding: 16px;
  }
  .cw-voice-join-prompt {
    padding: 16px;
  }
  .cw-voice-join-text {
    font-size: 14px;
  }
}
.cw-voice-channel-panel .cw-voice-not-configured {
  flex: 1;
  padding: 24px;
  color: var(--cw-text-muted);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cw-voice-channel-panel .cw-voice-not-configured.cw-hidden {
  display: none;
}

/* ——— Шапка (компактная, как Telegram) ——— */
.cw-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--cw-border-subtle);
  font-size: 15px;
  font-weight: 600;
  color: var(--cw-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  min-height: 44px;
  box-sizing: border-box;
  background: var(--cw-bg);
}

.cw-online-count {
  font-size: 12px;
  color: var(--cw-success);
  font-weight: 500;
}
.cw-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.cw-fullscreen-btn,
.cw-voice-btn,
.cw-dm-call-btn,
.cw-dm-call-reset-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--cw-text-muted);
  border-radius: var(--cw-radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.cw-fullscreen-btn:hover,
.cw-voice-btn:hover,
.cw-dm-call-btn:hover {
  background: var(--cw-bg-hover);
  color: var(--cw-text);
}
.cw-dm-call-btn {
  padding: 0;
  border: none;
  background: transparent;
  color: var(--cw-accent);
  border-radius: var(--cw-radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.cw-dm-call-btn i {
  font-size: 18px;
}
.cw-dm-call-reset-btn {
  color: #f87171;
  flex-shrink: 0;
}
.cw-dm-call-reset-btn:hover {
  background: rgba(248, 113, 113, 0.12);
  color: #fca5a5;
}
.cw-dm-call-reset-btn i {
  font-size: 18px;
}

.cw-notify-wrap {
  position: relative;
}
.cw-notify-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--cw-text-muted);
  border-radius: var(--cw-radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.cw-notify-btn:hover {
  background: var(--cw-bg-hover);
  color: var(--cw-text);
}
.cw-notify-btn.cw-notify-active {
  color: var(--cw-accent);
}
.cw-notify-panel {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  min-width: 228px;
  padding: 8px;
  background: var(--cw-bg-elevated);
  border: 1px solid var(--cw-border);
  border-radius: var(--cw-radius-sm);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  z-index: 300;
}
.cw-notify-panel.cw-hidden {
  display: none !important;
}
.cw-notify-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--cw-text-muted);
  padding: 4px 8px 8px;
}
.cw-notify-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: none;
  border-radius: var(--cw-radius-xs);
  background: transparent;
  color: var(--cw-text);
  font-size: 13px;
  cursor: pointer;
}
.cw-notify-option:hover {
  background: var(--cw-bg-hover);
}
.cw-notify-option.active {
  background: var(--cw-accent-soft);
  color: var(--cw-accent);
}
.cw-notify-hint {
  font-size: 11px;
  color: var(--cw-text-muted);
  margin: 8px 6px 4px;
  line-height: 1.4;
}
.cw-notify-hint-warn {
  color: #f87171;
}

.cw-user-hover-card {
  position: fixed;
  z-index: 10050;
  width: 288px;
  border-radius: var(--cw-radius);
  overflow: hidden;
  border: 1px solid var(--cw-border);
  /* Непрозрачный фон (раньше был var(--cw-bg-elevated) с alpha — просвечивал чат) */
  background-color: #2c2c2e;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
}
.cw-user-hover-card.cw-hidden {
  display: none !important;
}
.cw-user-hover-banner {
  height: 56px;
  background: linear-gradient(135deg, #18181b 0%, #09090b 55%, #0c0c0f 100%);
  background-size: cover;
  background-position: center;
}
.cw-user-hover-banner.has-img {
  min-height: 56px;
}
.cw-user-hover-body {
  display: flex;
  gap: 12px;
  padding: 10px 12px 12px;
  margin-top: -28px;
  position: relative;
}
.cw-user-hover-avatar-wrap {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
}
.cw-user-hover-avatar-inner {
  position: relative;
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid rgba(28, 28, 30, 0.95);
  overflow: hidden;
  background: var(--cw-bg);
}
.cw-user-hover-avatar-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cw-user-hover-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 22px;
  font-weight: 600;
  color: #fff;
}
.cw-user-hover-avatar-inner .cw-online-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 15px;
  height: 15px;
  border-radius: 999px;
  background: rgba(39, 39, 42, 0.95);
  border: 2px solid var(--cw-bg);
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cw-user-hover-avatar-inner .cw-online-dot i {
  font-size: 9px;
  color: #a3e635;
}
.cw-user-hover-avatar-inner .cw-online-dot.cw-online-dot-bridge i { color: #c084fc; }
.cw-user-hover-main {
  flex: 1;
  min-width: 0;
  padding-top: 30px;
}
.cw-user-hover-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--cw-text);
  line-height: 1.25;
}
.cw-user-hover-username {
  font-size: 12px;
  color: var(--cw-text-muted);
  margin-top: 2px;
}
.cw-user-hover-group {
  margin-top: 6px;
}
.cw-user-hover-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
}
.cw-user-hover-meta {
  font-size: 11px;
  color: var(--cw-text-muted);
  margin-top: 6px;
  line-height: 1.4;
}
.cw-user-hover-bio {
  font-size: 12px;
  color: var(--cw-text-secondary);
  margin-top: 8px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.cw-hover-profile-trigger.cw-who-hover,
.cw-hover-profile-trigger.cw-mention-user {
  cursor: pointer;
}
.cw-msg-avatar.cw-hover-profile-trigger {
  cursor: pointer;
}

.cw-pinned {
  background: var(--cw-accent-soft);
  border: 1px solid rgba(249, 115, 22, 0.22);
  border-radius: var(--cw-radius-sm);
  margin: 8px 16px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
  overflow: hidden;
  flex-shrink: 0;
}
.cw-pinned.cw-hidden {
  display: none !important;
}
.cw-pinned-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  margin: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  border-radius: var(--cw-radius-sm);
}
.cw-pinned-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
}
.cw-pinned-icon {
  flex-shrink: 0;
}
.cw-pinned-preview {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--cw-text);
}
.cw-pinned-chevron {
  flex-shrink: 0;
  opacity: 0.65;
  font-size: 10px;
  line-height: 1;
}
.cw-pinned-detail {
  border-top: 1px solid rgba(249, 115, 22, 0.22);
  padding: 10px 12px 12px;
  background: rgba(0, 0, 0, 0.14);
  font-size: 13px;
  max-height: min(40vh, 320px);
  overflow-y: auto;
}
.cw-pinned-detail.cw-hidden {
  display: none !important;
}
.cw-pinned-detail .cw-text {
  word-break: break-word;
}
.cw-pinned-detail-author {
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--cw-text);
}
.cw-msg-link {
  color: var(--cw-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}
.cw-msg-link:hover {
  filter: brightness(1.12);
}
.cw-text .cw-msg-link {
  color: var(--cw-accent);
}

/* ——— Лента сообщений ——— */
.cw-box {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 16px;
  transition: opacity 0.22s ease;
  background: var(--cw-bg);
}
.cw-box.cw-box-skeleton-out {
  opacity: 0;
}
.cw-box.cw-box-content-in {
  opacity: 1;
}

/* ——— Индикатор набора текста ——— */
.cw-typing-indicator {
  padding: 4px 16px 0;
  font-size: 12px;
  color: var(--cw-text-muted);
  min-height: 20px;
}
.cw-typing-indicator.cw-hidden {
  display: none;
}

/* ——— Поле ввода (Notion/Telegram-стиль) ——— */
.cw-form-wrap {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--cw-border-subtle);
  flex-shrink: 0;
  background: var(--cw-bg);
}
.cw-root.cw-standalone .cw-form-wrap {
  padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
}

.cw-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.cw-input-container {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  display: flex;
  align-items: flex-end;
  padding: 6px 6px 6px 16px;
  border-radius: var(--cw-radius-full);
  background: rgba(120, 120, 128, 0.16);
  border: 1px solid transparent;
  position: relative;
  transition: border-color 0.2s, background 0.2s;
}
.cw-input-container:focus-within {
  background: rgba(120, 120, 128, 0.24);
  border-color: var(--cw-border);
}
.cw-input-container:has(.cw-voice-recording.cw-visible) {
  border-color: var(--cw-accent);
}

.cw-input-row {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  gap: 6px;
}
.cw-input-row.cw-hidden {
  display: none !important;
}

.cw-voice-recording {
  display: none;
  flex: 1;
  align-items: center;
  gap: 12px;
  min-width: 0;
  height: 100%;
}
.cw-voice-recording.cw-visible {
  display: flex;
}
.cw-waveform {
  flex: 1;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 80px;
}
.cw-waveform span {
  width: 4px;
  min-height: 6px;
  max-height: 20px;
  border-radius: 2px;
  background: var(--cw-accent);
  opacity: 0.9;
}
.cw-voice-recording-time {
  font-size: 13px;
  font-weight: 600;
  color: var(--cw-accent);
  min-width: 40px;
}
.cw-voice-stop-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--cw-accent);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cw-voice-stop-btn:hover {
  opacity: 0.9;
}

.cw-form input[type="text"],
.cw-form #cw-input {
  flex: 1;
  min-width: 0;
  padding: 0;
  font-size: 15px;
  font-family: inherit;
  line-height: 1.4;
  border: none;
  background: transparent;
  color: var(--cw-text);
  outline: none;
}
.cw-form #cw-input {
  resize: none;
  min-height: 22px;
  max-height: 5.6em;
  overflow-y: auto;
  padding: 9px 0;
}
.cw-form input::placeholder,
.cw-form #cw-input::placeholder {
  color: var(--cw-text-muted);
}
.cw-attach-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--cw-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
.cw-attach-btn:hover {
  color: var(--cw-text);
  background: var(--cw-bg-hover);
}
.cw-video-note-btn {
  flex-shrink: 0;
}
.cw-input-action {
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--cw-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  touch-action: manipulation;
  user-select: none;
  transition: color 0.15s, background 0.15s;
}
.cw-input-action:hover {
  color: var(--cw-accent);
  background: var(--cw-accent-soft);
}
.cw-input-action.cw-send-btn {
  color: var(--cw-accent);
}
.cw-input-action.cw-send-btn:hover {
  background: var(--cw-accent-soft);
}

/* ——— Скелетон ——— */
.cw-skeleton-wrap {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0 16px;
  margin-bottom: 2px;
}
.cw-skeleton-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--cw-bg-hover);
}
.cw-skeleton-body {
  flex: 1;
  min-width: 0;
}
.cw-skeleton-line {
  height: 12px;
  border-radius: 4px;
  background: var(--cw-bg-hover);
  margin-bottom: 8px;
}
.cw-skeleton-line:last-child {
  margin-bottom: 0;
}
.cw-skeleton-line.cw-skeleton-name {
  width: 30%;
  max-width: 100px;
  margin-bottom: 6px;
}
.cw-skeleton-line.cw-skeleton-text-1 {
  width: 85%;
}
.cw-skeleton-line.cw-skeleton-text-2 {
  width: 60%;
}
.cw-skeleton-line.cw-skeleton-text-3 {
  width: 45%;
}
@keyframes cw-skeleton-shimmer {
  0% { opacity: 0.4; }
  50% { opacity: 0.8; }
  100% { opacity: 0.4; }
}
.cw-skeleton-wrap .cw-skeleton-avatar,
.cw-skeleton-wrap .cw-skeleton-line {
  animation: cw-skeleton-shimmer 1.2s ease-in-out infinite;
}

.cw-empty {
  padding: 32px 24px;
  text-align: center;
  color: var(--cw-text-muted);
  font-size: 15px;
  line-height: 1.5;
}
.cw-rules-hint {
  font-size: 11px;
  color: var(--cw-text-muted);
  padding: 8px 0 0;
  line-height: 1.4;
  opacity: 0.9;
}

/* ——— Сообщения (чистые карточки) ——— */
.cw-date-sep {
  text-align: center;
  margin: 16px 0 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--cw-text-muted);
  letter-spacing: 0.02em;
}
.cw-msg-wrap.cw-msg-call-log-wrap {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  padding: 6px 16px 8px;
  margin-top: 4px;
  background: transparent;
  pointer-events: none;
}
.cw-msg-wrap.cw-msg-call-log-wrap:hover {
  background: transparent;
}
.cw-msg-wrap.cw-msg-call-log-wrap.cw-grouped {
  border-top: none;
  margin-top: 2px;
  padding-top: 4px;
}
.cw-msg-call-log {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  max-width: 100%;
  padding: 7px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 12px;
  line-height: 1.35;
  color: var(--cw-text-muted, #a1a1aa);
  text-align: center;
}
.cw-msg-call-log-icon {
  font-size: 13px;
  line-height: 1;
  opacity: 0.85;
}
.cw-msg-call-log-text {
  flex: 1 1 auto;
  min-width: 0;
}
.cw-msg-call-log-time {
  font-size: 11px;
  opacity: 0.8;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.cw-msg-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 8px 12px 10px;
  border-radius: var(--cw-radius-sm);
  background: transparent;
  transition: background 0.15s;
}
.cw-msg-wrap:not(.cw-grouped) {
  margin-top: 4px;
}
.cw-msg-wrap:first-child {
  margin-top: 0;
}
.cw-msg-wrap:hover {
  background: var(--cw-bg-hover);
}
.cw-msg-wrap.cw-grouped {
  margin-top: 0;
  padding-top: 6px;
  border-radius: 0;
  border-top: 1px solid var(--cw-border-subtle);
  background: transparent;
}
.cw-msg-wrap.cw-grouped:hover {
  background: var(--cw-bg-hover);
}
.cw-msg-wrap.cw-grouped .cw-msg {
  display: none;
}
.cw-msg-wrap.cw-grouped .cw-msg-content {
  margin-left: 0;
}
.cw-msg-wrap.cw-grouped:last-child {
  border-radius: 0 0 var(--cw-radius-sm) var(--cw-radius-sm);
}
.cw-msg-wrap.cw-grouped:has(+ .cw-msg-wrap:not(.cw-grouped)) {
  border-radius: 0 0 var(--cw-radius-sm) var(--cw-radius-sm);
}
.cw-msg-wrap:not(.cw-grouped):has(+ .cw-msg-wrap.cw-grouped) {
  border-radius: var(--cw-radius-sm) var(--cw-radius-sm) 0 0;
}
.cw-msg-wrap:not(.cw-grouped) + .cw-msg-wrap.cw-grouped {
  border-radius: var(--cw-radius-sm) var(--cw-radius-sm) 0 0;
}

.cw-msg {
  display: flex;
  gap: 0;
  align-items: flex-start;
  max-width: 100%;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}
.cw-avatar-wrap {
  position: relative;
  flex-shrink: 0;
  margin-right: 12px;
}
.cw-avatar-wrap .cw-online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: rgba(39, 39, 42, 0.95);
  border: 2px solid var(--cw-bg);
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cw-avatar-wrap .cw-online-dot i {
  font-size: 8px;
  color: #a3e635;
}
.cw-avatar-wrap .cw-online-dot.cw-online-dot-bridge i { color: #c084fc; }
.cw-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--cw-bg-elevated);
  object-fit: cover;
  display: block;
}
.cw-msg-avatar.cw-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  text-transform: uppercase;
}
.cw-msg-header {
  flex: 1;
  min-width: 0;
  margin: 0;
  line-height: 1.3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.cw-msg-header-left {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  min-width: 0;
}
.cw-msg-author-inline {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: nowrap;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
}
.cw-msg-author-inline .cw-who {
  min-width: 0;
}
.cw-msg .cw-who {
  font-size: 14px;
  font-weight: 600;
  color: var(--cw-text);
}
.cw-msg-reply .reply-author {
  display: block;
  margin-bottom: 4px;
}
.cw-msg-reply .reply-author .cw-msg-author-inline {
  font-size: 12px;
  font-weight: 600;
  color: var(--cw-text-secondary);
}
.cw-pinned-detail-author .cw-msg-author-inline {
  font-weight: 600;
}
.cw-msg-group-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 0;
  line-height: 1.2;
  flex-shrink: 0;
}
.cw-msg-meta {
  font-size: 12px;
  color: var(--cw-text-muted);
  font-weight: 400;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cw-msg-read {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: #86efac;
  font-size: 11px;
  font-weight: 600;
  cursor: help;
}
.cw-msg-read i {
  font-size: 12px;
  line-height: 1;
}
.cw-msg-content {
  margin-top: 2px;
}
.cw-msg .cw-text {
  font-size: 15px;
  line-height: 1.45;
  margin-top: 0;
  color: var(--cw-text-secondary);
}
.cw-msg-wrap.cw-grouped .cw-msg-content {
  margin-top: 0;
}
.cw-msg-reactions-wrap {
  margin-top: 4px;
}
.cw-msg-edited {
  font-size: 11px;
  color: var(--cw-text-muted);
  font-style: italic;
}
.cw-translated-badge {
  font-size: 10px;
  color: rgba(96, 165, 250, 0.9);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-left: 6px;
  cursor: help;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.cw-translated-badge i {
  font-size: 14px;
}
.cw-msg-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.cw-reaction {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 8px;
  border-radius: var(--cw-radius-full);
  background: var(--cw-bg-hover);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.cw-reaction:hover {
  background: var(--cw-bg-active);
}
.cw-reaction.me {
  border: 1px solid var(--cw-accent);
}

.cw-msg-context {
  position: fixed;
  background: var(--cw-bg-elevated, #2c2c2e);
  color: var(--cw-text, #f2f2f7);
  border: 1px solid var(--cw-border, rgba(255,255,255,0.08));
  border-radius: var(--cw-radius-sm, 12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 10000;
  min-width: 160px;
  padding: 6px;
  outline: none;
  overflow: hidden;
}
.cw-msg-context:focus {
  outline: none;
}
.cw-msg-context-actions {
  padding: 0 2px;
}
.cw-msg-context-divider {
  height: 1px;
  background: var(--cw-border);
  margin: 6px 4px;
}
.cw-msg-context-emoji-block {
  margin-top: 4px;
  padding: 8px;
  background: var(--cw-bg-hover, rgba(255,255,255,0.06));
  border-radius: var(--cw-radius-xs, 10px);
}
.cw-msg-context-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
  border-radius: var(--cw-radius-xs);
  transition: background 0.15s;
}
.cw-msg-context-item i {
  font-size: 16px;
  flex-shrink: 0;
}
.cw-msg-context-item:hover {
  background: var(--cw-bg-hover);
}
.cw-reaction-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.cw-reaction-picker span {
  font-size: 20px;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--cw-radius-sm);
  transition: background 0.15s;
}
.cw-reaction-picker span:hover {
  background: var(--cw-bg-active);
}

/* Hover bubble with emoji (on message hover) */
.cw-msg-reaction-bubble {
  position: fixed;
  z-index: 1000;
  display: flex;
  gap: 2px;
  padding: 6px 10px;
  background: var(--cw-bg-elevated, #2c2c2e);
  color: var(--cw-text, #f2f2f7);
  border: 1px solid var(--cw-border);
  border-radius: var(--cw-radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  pointer-events: auto;
}
.cw-msg-reaction-bubble span {
  font-size: 18px;
  cursor: pointer;
  padding: 4px 2px;
  border-radius: 4px;
  transition: background 0.15s, transform 0.1s;
}
.cw-msg-reaction-bubble span:hover {
  background: var(--cw-bg-hover);
  transform: scale(1.15);
}

/* Tooltip: who placed reaction */
.cw-reaction-tooltip {
  position: fixed;
  z-index: 10001;
  max-width: 220px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--cw-text);
  background: var(--cw-bg-elevated, #2c2c2e);
  border: 1px solid var(--cw-border);
  border-radius: var(--cw-radius-xs);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.cw-reaction-tooltip.cw-hidden,
.cw-msg-reaction-bubble.cw-hidden {
  display: none !important;
}

.cw-reply-preview {
  display: none;
  padding: 8px 12px;
  background: var(--cw-bg-hover);
  border-radius: var(--cw-radius-sm) var(--cw-radius-sm) 0 0;
  font-size: 13px;
  color: var(--cw-text-muted);
  border-bottom: 1px solid var(--cw-border-subtle);
}
.cw-reply-preview.cw-visible {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cw-reply-cancel {
  background: none;
  border: none;
  color: var(--cw-text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}
.cw-reply-cancel:hover {
  color: var(--cw-text);
  background: var(--cw-bg-active);
}

.cw-mention-dropdown {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  margin-bottom: 6px;
  max-height: 200px;
  overflow-y: auto;
  background: var(--cw-bg-elevated);
  border: 1px solid var(--cw-border);
  border-radius: var(--cw-radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  z-index: 50;
}
.cw-mention-dropdown.cw-visible {
  display: block;
}
.cw-mention-item {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 4px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s;
  border-radius: var(--cw-radius-xs);
}
.cw-mention-item:hover,
.cw-mention-item.cw-selected {
  background: var(--cw-bg-hover);
}

.cw-attach-preview-wrap {
  display: none;
}
.cw-attach-preview-wrap.cw-visible {
  display: block;
}
.cw-attach-preview {
  max-width: 120px;
  max-height: 80px;
  border-radius: var(--cw-radius-xs);
  margin-top: 6px;
  object-fit: cover;
}

.cw-msg-reply {
  font-size: 12px;
  color: var(--cw-text-muted);
  border-left: 3px solid var(--cw-accent);
  padding-left: 10px;
  margin-bottom: 6px;
  border-radius: 0 0 0 2px;
}
.cw-msg-reply .reply-author {
  font-weight: 600;
  color: var(--cw-accent);
  margin-bottom: 2px;
}
.cw-msg-attachment-wrap {
  max-width: 100%;
  overflow: hidden;
  border-radius: var(--cw-radius-xs);
  margin-top: 4px;
}
.cw-msg-attachment {
  max-width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: var(--cw-radius-xs);
  display: block;
}

.cw-voice-player {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 140px;
  max-width: 220px;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--cw-radius-full);
  background: var(--cw-bg-hover);
}
.cw-voice-play-btn {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: var(--cw-accent);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cw-voice-seek-bar {
  flex: 1;
  height: 16px;
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
  min-width: 50px;
}
.cw-voice-waveform {
  display: flex;
  align-items: center;
  gap: 1px;
  height: 12px;
  flex: 1;
}
.cw-voice-waveform span {
  width: 2px;
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.35);
}
.cw-voice-progress {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: var(--cw-accent);
  opacity: 0.35;
  border-radius: 2px;
  width: 0%;
  pointer-events: none;
}
.cw-voice-duration {
  font-size: 11px;
  color: var(--cw-text-muted);
  flex-shrink: 0;
}
.cw-video-note-wrap {
  max-width: 200px;
  border-radius: 50%;
  overflow: hidden;
  margin-top: 6px;
}
.cw-video-note {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 50%;
}
.cw-msg-avatar.cw-avatar-clickable {
  cursor: pointer;
}
.cw-msg-avatar.cw-avatar-clickable:hover {
  opacity: 0.9;
}
.cw-channel-item.cw-channel-dm .cw-channel-emoji {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cw-channel-dm .cw-dm-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}
.cw-channel-dm .cw-dm-avatar.cw-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
}
.cw-channel-item.cw-channel-dm .cw-channel-emoji .cw-online-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: rgba(39, 39, 42, 0.95);
  border: 1.5px solid var(--cw-bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cw-channel-item.cw-channel-dm .cw-channel-emoji .cw-online-dot i {
  font-size: 7px;
  color: #a3e635;
}
.cw-channel-item.cw-channel-dm .cw-channel-emoji .cw-online-dot.cw-online-dot-bridge i { color: #c084fc; }

/* ——— Модалки профиля и диалогов ——— */
.cw-profile-modal {
  display: none;
}
.cw-profile-modal.cw-visible {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.cw-profile-content {
  max-width: 400px;
  width: 90%;
  height: auto;
  border-radius: var(--cw-radius);
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
}
.cw-profile-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 24px;
  position: relative;
  background: var(--cw-bg-elevated);
}
.cw-profile-avatar {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  position: relative;
}
.cw-profile-avatar .cw-avatar-wrap {
  position: relative;
  display: block;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--cw-bg-hover);
}
.cw-profile-avatar .cw-avatar-wrap .cw-online-dot {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: rgba(39, 39, 42, 0.95);
  border: 3px solid var(--cw-bg-elevated);
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cw-profile-avatar .cw-avatar-wrap .cw-online-dot i {
  font-size: 9px;
  color: #a3e635;
}
.cw-profile-avatar .cw-avatar-wrap .cw-online-dot.cw-online-dot-bridge i { color: #c084fc; }
.cw-profile-avatar img,
.cw-profile-avatar .cw-no-avatar,
.cw-profile-avatar .cw-avatar-placeholder {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cw-profile-avatar .cw-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
}
.cw-profile-info {
  flex: 1;
  min-width: 0;
}
.cw-profile-name {
  font-size: 18px;
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
  color: var(--cw-text);
}
.cw-profile-username {
  font-size: 14px;
  color: var(--cw-text-muted);
  display: block;
  margin-bottom: 8px;
}
.cw-profile-bio {
  font-size: 14px;
  line-height: 1.5;
  color: var(--cw-text-secondary);
  margin: 0;
}
.cw-profile-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--cw-border-subtle);
  background: var(--cw-bg-elevated);
}
.cw-dm-write-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Video note modal */
.cw-video-note-modal {
  display: none;
}
.cw-video-note-modal.cw-visible {
  display: flex;
  align-items: center;
  justify-content: center;
}
.cw-video-note-content {
  position: relative;
  width: 280px;
  padding: 24px;
  background: var(--cw-bg-elevated);
  border: 1px solid var(--cw-border);
  border-radius: var(--cw-radius);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
}
.cw-video-note-preview-wrap {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto 16px;
  border-radius: 50%;
  overflow: hidden;
  background: #000;
  border: 3px solid var(--cw-accent);
}
.cw-video-note-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}
.cw-video-note-timer {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}
.cw-video-note-stop-btn {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--cw-accent);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cw-video-note-stop-btn:hover {
  opacity: 0.9;
}
.cw-video-note-hint {
  font-size: 13px;
  color: var(--cw-text-muted);
  text-align: center;
  margin: 0 0 12px;
}
.cw-video-note-cancel {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: none;
  background: var(--cw-bg-hover);
  color: var(--cw-text-muted);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cw-video-note-cancel:hover {
  background: var(--cw-bg-active);
  color: var(--cw-text);
}

.cw-root.cw-fullscreen {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: 100%;
  z-index: 1000;
  border: none;
  max-height: none;
}

.cw-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 2000;
}
.cw-modal-overlay.cw-visible {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.cw-modal-content {
  background: var(--cw-bg-elevated);
  border: 1px solid var(--cw-border);
  border-radius: var(--cw-radius);
  max-width: 900px;
  width: 100%;
  height: 500px;
  overflow: hidden;
}
.cw-modal-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--cw-border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cw-modal-close {
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  color: var(--cw-text-muted);
  border-radius: var(--cw-radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.cw-modal-close:hover {
  background: var(--cw-bg-hover);
  color: var(--cw-text);
}
.cw-modal-iframe {
  width: 100%;
  height: calc(500px - 54px);
  border: none;
}

.cw-dialog-modal .cw-dialog-content {
  max-width: min(400px, 95vw);
  width: 100%;
  height: auto;
  max-height: 90vh;
}
.cw-dialog-modal .cw-modal-body {
  padding: 20px;
  color: var(--cw-text);
  font-size: 15px;
}
.cw-dialog-modal .cw-modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--cw-border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.cw-dialog-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  background: var(--cw-bg-hover);
  border: 1px solid var(--cw-border);
  border-radius: var(--cw-radius-sm);
  color: var(--cw-text);
  margin-top: 12px;
  box-sizing: border-box;
}
.cw-dialog-input:focus {
  outline: none;
  border-color: var(--cw-accent);
}
.cw-dialog-message {
  font-size: 15px;
  line-height: 1.5;
}

.cw-btn {
  height: 40px;
  padding: 0 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--cw-radius-sm);
  background: var(--cw-accent);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}
.cw-btn:hover {
  opacity: 0.92;
}
.cw-hidden {
  display: none !important;
}

@keyframes cw-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.cw-voice-recording-dot {
  width: 8px;
  height: 8px;
  background: var(--cw-accent);
  border-radius: 50%;
  animation: cw-pulse 1s infinite;
}

.cw-user-verified {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0;
  vertical-align: middle;
  color: #38bdf8;
  line-height: 1;
  flex-shrink: 0;
}
.cw-user-verified i {
  font-size: 0.95em;
}

#cw-header-title {
  display: inline-flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
  min-width: 0;
}

/* Входящий звонок: в document.body — весь viewport (клуб, шапка, сайдбар) */
.cw-private-call-incoming-layer {
  position: fixed;
  inset: 0;
  width: 100vw;
  min-height: 100vh;
  min-height: 100dvh;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  box-sizing: border-box;
  pointer-events: auto;
}
.cw-private-call-incoming-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 35%, rgba(249, 115, 22, 0.18), transparent 55%),
    radial-gradient(ellipse 100% 80% at 50% 100%, rgba(59, 130, 246, 0.08), transparent 45%),
    rgba(9, 9, 11, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  pointer-events: none;
}
.cw-private-call-incoming-modal {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  pointer-events: auto;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}
.cw-private-call-incoming-modal:has(#cw-private-voice-iframe-callee:not(.cw-hidden)) {
  max-width: min(520px, calc(100vw - 32px));
}
.cw-private-call-incoming-content {
  text-align: center;
  padding: 28px 24px 26px;
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(39, 39, 42, 0.95), rgba(24, 24, 27, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 0 1px rgba(249, 115, 22, 0.15), 0 24px 80px rgba(0, 0, 0, 0.65), 0 0 60px rgba(249, 115, 22, 0.08);
}
.cw-private-call-incoming-visual {
  position: relative;
  width: 112px;
  height: 112px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cw-private-call-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(249, 115, 22, 0.45);
  animation: cw-call-pulse 2s ease-out infinite;
  pointer-events: none;
}
.cw-private-call-pulse--delayed {
  animation-delay: 0.65s;
  border-color: rgba(96, 165, 250, 0.35);
}
@keyframes cw-call-pulse {
  0% {
    transform: scale(0.72);
    opacity: 0.9;
  }
  100% {
    transform: scale(1.65);
    opacity: 0;
  }
}
.cw-private-call-avatar-wrap {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.35), rgba(59, 130, 246, 0.25));
  padding: 3px;
  box-sizing: border-box;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
.cw-private-call-avatar-img,
.cw-private-call-avatar-fallback {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: var(--cw-bg-elevated, #18181b);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cw-accent, #f97316);
  font-size: 36px;
}
.cw-private-call-avatar-fallback i {
  line-height: 1;
}
.cw-private-call-avatar-letter {
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
  color: #fafafa;
  letter-spacing: -0.02em;
}
.cw-private-call-incoming-kicker {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(249, 115, 22, 0.95);
}
.cw-private-call-incoming-name {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--cw-text, #fafafa);
  word-break: break-word;
}
.cw-private-call-incoming-hint {
  margin: 0 0 22px;
  font-size: 13px;
  color: var(--cw-text-muted, #a1a1aa);
}
.cw-private-call-actions--incoming {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 28px;
  margin-top: 4px;
}
.cw-private-call-btn-decline,
.cw-private-call-btn-accept {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 3;
}
.cw-private-call-btn-decline i,
.cw-private-call-btn-accept i {
  pointer-events: none;
}
.cw-private-call-btn-decline {
  background: linear-gradient(180deg, #ef4444, #b91c1c);
  color: #fff;
}
.cw-private-call-btn-decline:hover {
  transform: scale(1.06);
  box-shadow: 0 10px 28px rgba(239, 68, 68, 0.45);
}
.cw-private-call-btn-accept {
  background: linear-gradient(180deg, #22c55e, #15803d);
  color: #fff;
}
.cw-private-call-btn-accept:hover {
  transform: scale(1.06);
  box-shadow: 0 10px 28px rgba(34, 197, 94, 0.45);
}
.cw-private-call-incoming-modal .cw-private-voice-iframe {
  margin-top: 12px;
  border-radius: 16px;
  min-height: 240px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

/* Активный разговор (после ответа): как экран телефона на смартфоне */
.cw-private-call-incoming-content.cw-private-call-phase-connected .cw-private-call-pulse {
  display: none !important;
}
.cw-private-call-incoming-content.cw-private-call-phase-connected .cw-private-call-incoming-hint {
  display: none;
}
.cw-private-call-incoming-content.cw-private-call-phase-connected .cw-private-call-actions--incoming {
  display: none;
}
.cw-private-call-kicker--live {
  color: #6ee7b7 !important;
  letter-spacing: 0.12em;
  text-shadow: 0 0 28px rgba(52, 211, 153, 0.45);
}
.cw-private-call-active-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 8px 20px 16px;
  flex-shrink: 0;
}
.cw-private-call-hangup-fab {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #f87171, #b91c1c);
  color: #fff;
  font-size: 28px;
  box-shadow: 0 14px 36px rgba(239, 68, 68, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.cw-private-call-hangup-fab:hover {
  transform: scale(1.05);
}
.cw-private-call-hangup-fab i {
  pointer-events: none;
}
.cw-private-call-hangup-caption {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.72);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

@media (max-width: 768px) {
  .cw-private-call-incoming-layer.cw-private-call-active {
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
  }
  .cw-private-call-incoming-layer.cw-private-call-active .cw-private-call-incoming-backdrop {
    background: linear-gradient(168deg, #0a1628 0%, #020617 42%, #1e1b4b 78%, #0c4a6e 100%);
  }
  .cw-private-call-incoming-layer.cw-private-call-active .cw-private-call-incoming-modal {
    position: relative;
    z-index: 2;
    max-width: none !important;
    width: 100%;
    min-height: 100dvh;
    min-height: 100vh;
    height: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
    box-sizing: border-box;
  }
  .cw-private-call-incoming-layer.cw-private-call-active .cw-private-call-incoming-content.cw-private-call-phase-connected {
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
    padding: max(12px, env(safe-area-inset-top)) 20px 16px;
    flex-shrink: 0;
  }
  .cw-private-call-incoming-layer.cw-private-call-active .cw-private-call-incoming-visual {
    width: 148px;
    height: 148px;
    margin-bottom: 12px;
  }
  .cw-private-call-incoming-layer.cw-private-call-active .cw-private-call-avatar-wrap {
    width: 124px;
    height: 124px;
  }
  .cw-private-call-incoming-layer.cw-private-call-active .cw-private-call-avatar-letter {
    font-size: 46px;
  }
  .cw-private-call-incoming-layer.cw-private-call-active .cw-private-call-incoming-name {
    font-size: clamp(1.35rem, 5vw, 1.75rem);
    font-weight: 700;
    margin-bottom: 4px;
  }
  .cw-private-call-incoming-layer.cw-private-call-active .cw-private-call-incoming-kicker {
    font-size: 10px;
    margin-bottom: 8px;
  }
  .cw-private-call-incoming-layer.cw-private-call-active #cw-private-voice-iframe-callee {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    margin-top: 4px;
    border-radius: 0;
    border: none;
    box-shadow: none;
    min-height: min(52vh, 420px);
  }
  .cw-private-call-incoming-layer.cw-private-call-active .cw-private-call-active-bar:not(.cw-hidden) {
    position: sticky;
    bottom: 0;
    margin-top: auto;
    padding-top: 12px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    background: linear-gradient(180deg, transparent, rgba(2, 6, 23, 0.92) 35%);
  }
  .cw-private-call-incoming-layer.cw-private-call-active .cw-private-call-hangup-fab {
    width: 76px;
    height: 76px;
    font-size: 30px;
  }

  .cw-private-call-outgoing-panel.cw-private-call-active {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    max-width: none !important;
    height: 100dvh !important;
    min-height: 100vh !important;
    z-index: 999998 !important;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    background: linear-gradient(168deg, #0a1628 0%, #020617 45%, #1e3a5f 100%);
    align-items: stretch;
    justify-content: stretch;
  }
  .cw-private-call-outgoing-panel.cw-private-call-active .cw-private-call-card--inchat {
    max-width: none;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  .cw-private-call-outgoing-panel.cw-private-call-active .cw-private-call-card {
    max-width: none;
    width: 100%;
    height: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin: 0;
    padding: 12px 0 0;
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
  }
  .cw-private-call-outgoing-panel.cw-private-call-active #cw-private-voice-iframe-caller {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    margin-top: 0;
    border-radius: 0;
    border: none;
    min-height: min(58vh, 480px);
  }
  .cw-private-call-outgoing-panel.cw-private-call-active .cw-private-call-outgoing-active-bar:not(.cw-hidden) {
    flex-shrink: 0;
    padding-top: 8px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    background: linear-gradient(180deg, transparent, rgba(2, 6, 23, 0.92) 40%);
  }
  .cw-private-call-outgoing-panel.cw-private-call-active .cw-private-call-hangup-fab {
    width: 76px;
    height: 76px;
  }
}
/* Исходящий звонок: только поверх основной колонки чата (.cw-main) */
.cw-private-call-outgoing-panel {
  position: absolute;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  padding: 12px;
  box-sizing: border-box;
}
.cw-private-call-card--inchat {
  max-width: 100%;
  width: 100%;
}
.cw-private-call-card {
  width: 100%;
  max-width: 400px;
  background: var(--cw-bg-elevated);
  border: 1px solid var(--cw-border);
  border-radius: var(--cw-radius);
  padding: 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}
.cw-private-call-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 16px;
  text-align: center;
  color: var(--cw-text);
}
.cw-private-call-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.cw-btn-muted {
  background: rgba(255, 255, 255, 0.12);
  color: var(--cw-text);
}
.cw-btn-muted:hover {
  background: rgba(255, 255, 255, 0.18);
}
.cw-private-voice-iframe {
  width: 100%;
  min-height: 220px;
  border: none;
  border-radius: var(--cw-radius-sm);
  margin-top: 12px;
  background: #000;
}
.cw-private-call-block + .cw-private-voice-iframe {
  margin-top: 0;
}
