/* ============================================
   BRANO INTERCOM - Push-to-Talk widget v2
   Two channels: "Wszyscy" + "Grupa"
   ============================================ */

/* Nigdy nie drukuj widgetu intercom ani powiązanych elementów */
@media print {
  .intercom-widget,
  [class*="intercom-"],
  #icSettingsTab,
  #icSettingsPanel,
  #icChatPanel,
  #icCallBar,
  #icCallMinTab,
  #icPassiveBanner {
    display: none !important;
    visibility: hidden !important;
  }
}

.intercom-widget {
  position: fixed;
  bottom: 50px;
  left: 20px;
  z-index: 10000;
  font-family: 'Space Grotesk', -apple-system, sans-serif;
}

/* ── OFF button (before enabling) ── */
.intercom-btn-off {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid #333;
  background: #1a1a2e;
  color: #555;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transition: all 0.2s;
  padding: 0;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.intercom-btn-off svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  pointer-events: none;
}

.intercom-btn-off:hover {
  border-color: #ef4444;
  color: #ef4444;
  background: #3b1111;
}

/* ── PTT bar (vertical: all on top, group+arrow on bottom) ── */
.intercom-ptt-bar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  position: relative;
}

.intercom-ptt-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.intercom-ptt {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.15s;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.intercom-ptt svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  pointer-events: none;
}

/* All button — off=gray, active=green */
.intercom-ptt-all {
  background: #1a1a2e;
  border-color: #444;
  color: #666;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.intercom-ptt-all:hover {
  background: #252545;
  color: #999;
}

.intercom-ptt-all.active {
  background: #14532d;
  border-color: #22c55e;
  color: #fff;
  transform: scale(1.25);
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.5);
  animation: ic-pulse-green 0.8s infinite;
}

.intercom-ptt-all.listening {
  background: #14532d;
  border-color: #22c55e;
  color: #22c55e;
  animation: ic-pulse-green 1s infinite;
}

/* Group button — off=gray, active=green */
.intercom-ptt-group {
  background: #1a1a2e;
  border-color: #444;
  color: #666;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border-radius: 50% 0 0 50%;
}

.intercom-ptt-group:hover {
  background: #252545;
  color: #999;
}

.intercom-ptt-group.active {
  background: #14532d;
  border-color: #22c55e;
  color: #fff;
  transform: scale(1.25);
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.5);
  animation: ic-pulse-green 0.8s infinite;
}

.intercom-ptt-group.listening {
  background: #14532d;
  border-color: #22c55e;
  color: #22c55e;
  animation: ic-pulse-green 1s infinite;
}

.intercom-ptt-group.disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* ── Settings button (gear icon, opens mode popup) ── */
.intercom-settings-btn {
  height: 48px;
  width: 24px;
  border-radius: 0 8px 8px 0;
  border: 1px solid #444;
  border-left: none;
  background: #1a1a2e;
  color: #555;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  touch-action: manipulation;
  position: relative;
}

.intercom-settings-btn:hover {
  color: #ccc;
  background: #252545;
}

.intercom-settings-btn.mode-continuous::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
}

/* ── Mode popup ── */
.intercom-mode-popup {
  position: absolute;
  left: 80px;
  bottom: 0;
  width: 240px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: #1a1a2e;
  border: 1px solid #2a2a4e;
  border-radius: 10px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
  display: none;
  z-index: 2;
}

.intercom-mode-popup.open {
  display: block;
  animation: ic-fade-in 0.12s ease;
}

.intercom-mode-popup-title {
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  color: #888;
  border-bottom: 1px solid #2a2a4e;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.intercom-mode-opt {
  display: flex;
  align-items: center;
  gap: 6px;
  width: calc(100% - 16px);
  margin: 4px 8px;
  padding: 10px 12px;
  border: 1px solid #333;
  border-radius: 8px;
  background: #12122a;
  color: #999;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: all 0.12s;
}

.intercom-mode-opt svg {
  flex-shrink: 0;
}

.intercom-mode-opt:hover {
  background: #252545;
  border-color: #555;
  color: #ccc;
}

.intercom-mode-opt.selected {
  color: #22c55e;
  background: #0d2818;
  border-color: #22c55e;
}

.intercom-mode-opt.selected::before {
  content: '\2713';
  margin-right: 2px;
  font-weight: 700;
}

.intercom-mode-popup-divider {
  height: 1px;
  background: #2a2a4e;
  margin: 4px 0;
}

.intercom-popup-users {
  padding: 2px 0;
}

/* ── Arrow button (open panel, next to group btn) ── */
.intercom-panel-arrow {
  width: 22px;
  height: 48px;
  border-radius: 0 8px 8px 0;
  border: 1px solid #444;
  border-left: none;
  background: #1a1a2e;
  color: #888;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.15s;
  touch-action: manipulation;
}

.intercom-panel-arrow:hover {
  border-color: #818cf8;
  color: #818cf8;
  background: #1e1b4b;
}

/* ── Badge ── */
.intercom-badge {
  position: absolute;
  top: -8px;
  left: 38px;
  background: #3b82f6;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid #0a0a0f;
  line-height: 1;
  pointer-events: none;
  cursor: pointer;
}

.intercom-badge.hidden {
  display: none;
}

/* ── Talker bar ── */
.intercom-talker-bar {
  position: absolute;
  bottom: 110px;
  left: 0;
  background: rgba(239, 68, 68, 0.92);
  color: #fff;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.25);
  display: none;
  backdrop-filter: blur(8px);
}

.intercom-talker-bar.visible {
  display: block;
  animation: ic-fade-in 0.2s ease;
}

/* ── Panel ── */
.intercom-panel {
  position: absolute;
  bottom: 0;
  left: 80px;
  width: 230px;
  background: #1a1a2e;
  border: 1px solid #2a2a4e;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  display: none;
  overflow: hidden;
}

.intercom-panel.open {
  display: block;
  animation: ic-fade-in 0.15s ease;
}

.intercom-panel-header {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #2a2a4e;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.intercom-online-count {
  font-size: 11px;
  color: #14b8a6;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.intercom-user-list {
  max-height: 220px;
  overflow-y: auto;
  padding: 4px 0;
}

.intercom-user {
  padding: 6px 14px;
  font-size: 13px;
  color: #ccc;
  display: flex;
  align-items: center;
  gap: 8px;
}

.intercom-user.intercom-empty {
  color: #555;
  font-style: italic;
  padding: 12px 14px;
}

.intercom-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
}

.intercom-user.talking .intercom-dot {
  background: #ef4444;
  animation: ic-blink 0.7s infinite;
}

.intercom-user-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.intercom-talk-label {
  font-size: 10px;
  color: #ef4444;
  font-weight: 600;
  text-transform: uppercase;
}

/* DM mic button (talk to one person) */
.intercom-dm-ptt {
  background: none;
  border: 1px solid #333;
  border-radius: 50%;
  cursor: pointer;
  color: #555;
  width: 28px;
  height: 28px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.intercom-dm-ptt:hover {
  color: #14b8a6;
  border-color: #14b8a6;
  background: #0d3d38;
}

.intercom-dm-ptt.active {
  color: #fff;
  border-color: #ef4444;
  background: #7f1d1d;
  animation: ic-pulse-red 0.8s infinite;
}

/* Group toggle star */
.intercom-group-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: #444;
  padding: 2px 4px;
  line-height: 1;
  transition: color 0.15s;
  flex-shrink: 0;
}

.intercom-group-toggle:hover {
  color: #a78bfa;
}

.intercom-group-toggle.in-group {
  color: #818cf8;
}

.intercom-panel-footer {
  padding: 8px 14px;
  border-top: 1px solid #2a2a4e;
}

.intercom-disconnect-btn {
  width: 100%;
  padding: 6px;
  border-radius: 6px;
  border: 1px solid #444;
  background: transparent;
  color: #888;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.intercom-disconnect-btn:hover {
  background: #7f1d1d;
  border-color: #ef4444;
  color: #ef4444;
}

/* ── Animations ── */
@keyframes ic-pulse-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}

@keyframes ic-pulse-green {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.3); }
  50% { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); }
}

@keyframes ic-pulse-purple {
  0%, 100% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.3); }
  50% { box-shadow: 0 0 0 10px rgba(139, 92, 246, 0); }
}

@keyframes ic-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

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

/* ============================================
   CHAT PANEL
   ============================================ */

/* Chat toggle button */
.intercom-chat-btn {
  width: 100%;
  height: 40px;
  border-radius: 10px;
  border: 1px solid #333;
  background: #1a1a2e;
  color: #666;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0;
  font-size: 12px;
  font-family: inherit;
  font-weight: 600;
  transition: all 0.15s;
  touch-action: manipulation;
  position: relative;
}

.intercom-chat-btn:hover {
  background: #252545;
  color: #999;
}

.intercom-chat-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.intercom-chat-badge {
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}

.intercom-chat-badge.hidden { display: none; }

/* Chat panel — separate layer on body */
.intercom-chat-panel {
  position: fixed;
  bottom: 20px;
  left: 80px;
  width: min(600px, calc(100vw - 100px));
  height: 420px;
  background: #1a1a2e;
  border: 1px solid #2a2a4e;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  display: none;
  flex-direction: row;
  overflow: hidden;
  z-index: 99999;
}

.intercom-chat-panel.open {
  display: flex;
  animation: ic-fade-in 0.15s ease;
}

/* ── Reply row (dynamic PTT when someone talks) ── */
.intercom-reply-row {
  align-items: center;
}

.intercom-ptt-reply {
  background: #1e3a5f !important;
  border-color: #3b82f6 !important;
  color: #60a5fa !important;
  animation: ic-pulse-blue 1s infinite;
}

.intercom-reply-name {
  font-size: 11px;
  font-weight: 600;
  color: #60a5fa;
  margin-left: 4px;
  white-space: nowrap;
}

@keyframes ic-pulse-blue {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(59, 130, 246, 0); }
}

/* ── DM mic in chat sidebar ── */
.intercom-dm-mic {
  background: none;
  border: none;
  color: #555;
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.12s;
}

.intercom-dm-mic:hover { color: #14b8a6; }

/* Sidebar always visible — compact select handles small mode */

/* Fullscreen: sidebar + conversation side by side */
.intercom-chat-panel.fullscreen {
  position: fixed;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  width: auto !important;
  height: auto !important;
  border-radius: 16px;
  flex-direction: row;
}

/* ── Sidebar (left) ── */
.intercom-chat-sidebar {
  width: 220px;
  min-width: 220px;
  border-right: 1px solid #2a2a4e;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.intercom-chat-sidebar-header {
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 700;
  color: #ccc;
  border-bottom: 1px solid #2a2a4e;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.intercom-chat-sidebar-close {
  display: none;
  background: none;
  border: none;
  color: #555;
  font-size: 22px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.intercom-chat-sidebar-close:hover { color: #ef4444; }

.intercom-chat-sidebar-label {
  padding: 8px 14px 4px;
  font-size: 10px;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.intercom-chat-channel-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  cursor: pointer;
  font-size: 13px;
  color: #999;
  transition: all 0.1s;
  flex-shrink: 0;
}

.intercom-chat-channel-item:hover { background: #252545; color: #ccc; }

.intercom-chat-channel-item.active {
  background: #14532d;
  color: #22c55e;
}

.intercom-chat-channel-item svg {
  fill: currentColor;
  flex-shrink: 0;
}

/* DM user list in sidebar */
.intercom-chat-dm-list {
  flex: 1;
  overflow-y: auto;
  padding: 2px 0;
}

.intercom-chat-dm-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  color: #ccc;
  transition: background 0.1s;
}

.intercom-chat-dm-item:hover { background: #252545; }

.intercom-chat-dm-item.active {
  background: #1e3a5f;
  color: #fff;
}

.intercom-dot.offline { background: #555; }

.intercom-fav-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: #444;
  padding: 2px 4px;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.12s;
  margin-left: auto;
}

.intercom-fav-toggle:hover { color: #eab308; }
.intercom-fav-toggle.is-fav { color: #eab308; }

/* ── Conversation (right) ── */
.intercom-chat-conv {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Header */
.intercom-chat-header {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid #2a2a4e;
  gap: 8px;
  flex-shrink: 0;
}

/* Channel select — desktop only */
.intercom-chat-channel-select {
  display: none;
}

/* Mobile channel button + dropdown */
.intercom-chat-channel-btn {
  display: none;
  background: #12122a;
  border: 1px solid #333;
  color: #ccc;
  font-size: 13px;
  font-family: inherit;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.intercom-chat-channel-dropdown {
  position: absolute;
  top: 44px;
  left: 0;
  right: 60px;
  max-height: 60vh;
  overflow-y: auto;
  background: #1a1a2e;
  border: 1px solid #2a2a4e;
  border-radius: 10px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
  z-index: 5;
  padding: 4px 0;
}

.intercom-mdd-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  color: #ccc;
  font-size: 14px;
  cursor: pointer;
}

.intercom-mdd-item:hover { background: #252545; }

.intercom-mdd-call {
  margin-left: auto;
  font-size: 16px;
}

.intercom-chat-conv-title {
  font-size: 14px;
  font-weight: 600;
  color: #ccc;
  flex: 1;
}

/* Back button (mobile only) */
.intercom-chat-back {
  display: none;
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  padding: 2px;
  line-height: 1;
}

.intercom-chat-back:hover { color: #14b8a6; }
.intercom-chat-back svg { fill: currentColor; }

.intercom-chat-close {
  background: none;
  border: none;
  color: #555;
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

/* Mic PTT in chat header (for DM) */
.intercom-chat-header-mic {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #14b8a6;
  background: #0d3d38;
  color: #14b8a6;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition: all 0.12s;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.intercom-chat-header-mic:active {
  background: #14532d;
  border-color: #22c55e;
  color: #22c55e;
}

.intercom-chat-header-mic svg { fill: currentColor; }

.intercom-chat-resize-toggle {
  background: none;
  border: none;
  color: #555;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
  transition: color 0.12s;
}

.intercom-chat-resize-toggle:hover { color: #14b8a6; }

.intercom-chat-panel.resizable .intercom-chat-resize-toggle { color: #14b8a6; }

.intercom-chat-close:hover { color: #ef4444; }

/* Resize handle — dot in top-right corner */
.intercom-chat-resize-handle {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  background: #14b8a6;
  border: 2px solid #1a1a2e;
  border-radius: 50%;
  cursor: nwse-resize;
  z-index: 5;
  touch-action: none;
}

.intercom-chat-resize-handle:hover {
  background: #22d3ee;
  transform: scale(1.2);
}

/* Resizable mode */
.intercom-chat-panel.resizable {
  position: fixed;
}

/* Messages */
.intercom-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}

.intercom-chat-msg {
  max-width: 85%;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.4;
  word-wrap: break-word;
}

.intercom-chat-msg.mine {
  align-self: flex-end;
  background: #1e3a5f;
  color: #ddd;
  border-bottom-right-radius: 3px;
}

.intercom-chat-msg.other {
  align-self: flex-start;
  background: #252545;
  color: #ddd;
  border-bottom-left-radius: 3px;
}

.intercom-chat-msg-sender {
  font-size: 10px;
  font-weight: 600;
  color: #14b8a6;
  margin-bottom: 2px;
}

.intercom-chat-msg-text {
  white-space: pre-wrap;
}

.intercom-chat-msg-img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 4px;
  display: block;
}

.intercom-chat-msg-time {
  font-size: 9px;
  color: #555;
  margin-top: 2px;
  text-align: right;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.intercom-chat-msg-del {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  line-height: 1;
  transition: color 0.15s;
}

.intercom-chat-msg-del:hover { color: #ef4444; }

.intercom-chat-typing {
  font-size: 11px;
  color: #888;
  font-style: italic;
  padding: 2px 8px;
  min-height: 18px;
  flex-shrink: 0;
}

.intercom-chat-empty {
  color: #555;
  font-size: 12px;
  text-align: center;
  padding: 40px 10px;
}

/* Input area */
.intercom-chat-input-area {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px;
  border-top: 1px solid #2a2a4e;
  flex-shrink: 0;
}

.intercom-chat-attach {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #333;
  background: transparent;
  color: #666;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition: all 0.12s;
}

.intercom-chat-attach:hover {
  color: #14b8a6;
  border-color: #14b8a6;
}

.intercom-chat-screen-share {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #333;
  background: transparent;
  color: #666;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition: all 0.12s;
}
.intercom-chat-screen-share:hover {
  color: #14b8a6;
  border-color: #14b8a6;
}
.intercom-chat-screen-share.active {
  background: #0d3d38;
  color: #22c55e;
  border-color: #22c55e;
}

.intercom-chat-input {
  flex: 1;
  background: #12122a;
  border: 1px solid #333;
  color: #ddd;
  font-size: 13px;
  font-family: inherit;
  padding: 6px 10px;
  border-radius: 8px;
  outline: none;
  resize: none;
  min-height: 32px;
  max-height: 80px;
}

.intercom-chat-input:focus {
  border-color: #14b8a6;
}

.intercom-chat-send {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #14b8a6;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition: background 0.12s;
}

.intercom-chat-send:hover { background: #0d9488; }

.intercom-chat-send svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* ── Talker bubble (bottom-right, who's speaking) ── */
.intercom-talker-bubble {
  position: fixed;
  bottom: 70px;
  right: 20px;
  padding: 10px 16px;
  border-radius: 12px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
  z-index: 100000;
  animation: ic-toast-in 0.25s ease;
  font-family: 'Space Grotesk', -apple-system, sans-serif;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Channel colors */
.intercom-talker-bubble.ch-all {
  background: #14532d;
  border: 1px solid #22c55e;
}

.intercom-talker-bubble.ch-group {
  background: #2e1065;
  border: 1px solid #a855f7;
}

.intercom-talker-bubble.ch-dm {
  background: #713f12;
  border: 1px solid #eab308;
}

.intercom-talker-bubble-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.intercom-talker-bubble-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ch-all .intercom-talker-bubble-label { color: #22c55e; }
.ch-group .intercom-talker-bubble-label { color: #a855f7; }
.ch-dm .intercom-talker-bubble-label { color: #eab308; }

.intercom-talker-bubble-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.intercom-talker-bubble-mic {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  transition: background 0.12s;
}

.intercom-talker-bubble-mic:hover {
  background: rgba(255,255,255,0.25);
}

.intercom-talker-bubble-mic svg {
  fill: currentColor;
}

/* ── Chat toast (message bubble, bottom-right) ── */
.intercom-chat-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #1e3a5f;
  border: 1px solid #3b82f6;
  border-radius: 12px;
  padding: 10px 16px;
  max-width: 280px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  z-index: 100000;
  animation: ic-toast-in 0.25s ease;
  font-family: 'Space Grotesk', -apple-system, sans-serif;
}

.intercom-chat-toast.hiding {
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
}

.intercom-chat-toast-sender {
  font-size: 11px;
  font-weight: 700;
  color: #14b8a6;
  margin-bottom: 3px;
}

.intercom-chat-toast-text {
  font-size: 13px;
  color: #ddd;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

@keyframes ic-toast-in {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============================================
   VOICE CALLS
   ============================================ */

/* Incoming call popup */
.intercom-call-incoming {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #1a1a2e;
  border: 2px solid #22c55e;
  border-radius: 16px;
  padding: 24px 32px;
  z-index: 100002;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  text-align: center;
  animation: ic-fade-in 0.2s ease;
  font-family: 'Space Grotesk', -apple-system, sans-serif;
}

.intercom-call-incoming-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 16px;
}

.intercom-call-incoming-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.intercom-call-accept,
.intercom-call-decline {
  padding: 10px 24px;
  border-radius: 10px;
  border: none;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  min-width: 100px;
  touch-action: manipulation;
}

.intercom-call-accept {
  background: #14532d;
  color: #22c55e;
  border: 1px solid #22c55e;
}

.intercom-call-accept:hover { background: #166534; }

.intercom-call-decline {
  background: #3b1111;
  color: #ef4444;
  border: 1px solid #ef4444;
}

.intercom-call-decline:hover { background: #5a1a1a; }

/* Active call widget (bottom-left, next to intercom) */
.intercom-call-widget {
  position: fixed;
  bottom: 195px;
  left: 20px;
  background: linear-gradient(135deg, #14532d 0%, #166534 100%);
  border: 1px solid #22c55e;
  border-radius: 14px;
  padding: 0;
  z-index: 10001;
  font-family: 'Space Grotesk', -apple-system, sans-serif;
  animation: ic-fade-in 0.2s ease;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.intercom-call-widget-main {
  display: flex;
  flex-direction: column;
  padding: 8px 12px;
  gap: 8px;
}

.intercom-call-widget-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.intercom-call-widget-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.intercom-call-widget-collapse {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  cursor: pointer;
  background: rgba(0,0,0,0.15);
  border-left: 1px solid rgba(34,197,94,0.3);
  color: #22c55e;
  opacity: 0.6;
  transition: all 0.2s;
  flex-shrink: 0;
}
.intercom-call-widget-collapse:hover {
  opacity: 1;
  background: rgba(0,0,0,0.3);
}

.intercom-call-widget-timer {
  font-size: 14px;
  font-weight: 700;
  color: #22c55e;
  font-variant-numeric: tabular-nums;
}

.intercom-call-widget-info {
  font-size: 11px;
  color: #a7f3d0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100px;
}

/* Call action buttons — large, single row */
.intercom-call-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.15s;
  flex-shrink: 0;
  -webkit-appearance: none;
  appearance: none;
  background: none;
  font: inherit;
  outline: none;
}

.intercom-call-btn.screen {
  background: #0d3d38;
  border-color: #14b8a6;
  color: #14b8a6;
}
.intercom-call-btn.screen:hover { background: #115e56; transform: scale(1.08); }
.intercom-call-btn.screen.active { background: #14b8a6; color: #fff; }

.intercom-call-btn.mute {
  background: #0d3d38;
  border-color: #14b8a6;
  color: #14b8a6;
}
.intercom-call-btn.mute:hover { background: #115e56; transform: scale(1.08); }
.intercom-call-btn.mute.muted {
  background: #7f1d1d;
  border-color: #ef4444;
  color: #ef4444;
}

.intercom-call-btn.hangup {
  background: #7f1d1d;
  border-color: #ef4444;
  color: #ef4444;
}
.intercom-call-btn.hangup:hover { background: #991b1b; transform: scale(1.08); }

.intercom-call-btn svg { fill: currentColor; }

/* Keep old btn-sm class for backwards compat */
.intercom-call-widget-btn-sm {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.12s;
  flex-shrink: 0;
}
.intercom-call-widget-btn-sm svg { fill: currentColor; }

/* Screen preview button in call widget */
.intercom-call-preview-btn {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid #14b8a6;
  background: #0d3d38;
  color: #14b8a6;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  transition: background 0.12s;
  animation: ic-fade-in 0.2s ease;
}

.intercom-call-preview-btn:hover { background: #115e56; }

/* Screen share invite popup (centered) */
.intercom-screen-invite {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100003;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: ic-fade-in 0.2s ease;
  font-family: 'Space Grotesk', -apple-system, sans-serif;
}

.intercom-screen-invite-box {
  background: #1a1a2e;
  border: 2px solid #3b82f6;
  border-radius: 16px;
  padding: 28px 36px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

.intercom-screen-invite-icon {
  color: #3b82f6;
  margin-bottom: 12px;
}

.intercom-screen-invite-icon svg { stroke: currentColor; }

.intercom-screen-invite-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.intercom-screen-invite-text {
  font-size: 14px;
  color: #888;
  margin-bottom: 20px;
}

.intercom-screen-invite-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.intercom-screen-invite-accept,
.intercom-screen-invite-decline {
  padding: 10px 28px;
  border-radius: 10px;
  border: none;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  min-width: 110px;
  touch-action: manipulation;
}

.intercom-screen-invite-accept {
  background: #14532d;
  color: #22c55e;
  border: 1px solid #22c55e;
}

.intercom-screen-invite-accept:hover { background: #166534; }

.intercom-screen-invite-decline {
  background: #3b1111;
  color: #ef4444;
  border: 1px solid #ef4444;
}

.intercom-screen-invite-decline:hover { background: #5a1a1a; }

/* Screen share row in call widget */
.intercom-call-ss-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 11px;
  color: #fca5a5;
}

.intercom-call-ss-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  flex-shrink: 0;
  animation: ic-blink 1.5s infinite;
}

.intercom-call-ss-stop {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid #ef4444;
  background: #7f1d1d;
  color: #fca5a5;
  font-size: 10px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.intercom-call-ss-stop:hover { background: #991b1b; }

/* Screen share widget (without call) */
.intercom-ss-widget {
  position: fixed;
  bottom: 195px;
  left: 20px;
  background: #7f1d1d;
  border: 1px solid #ef4444;
  border-radius: 10px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #fca5a5;
  font-family: 'Space Grotesk', -apple-system, sans-serif;
  z-index: 10001;
  animation: ic-fade-in 0.2s ease;
}

/* Phone icon in DM sidebar */
.intercom-dm-phone {
  background: none;
  border: none;
  color: #22c55e;
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.12s;
}

.intercom-dm-phone:hover { color: #4ade80; }

/* Phone icon in chat header */
.intercom-chat-header-phone {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #22c55e;
  background: #14532d;
  color: #22c55e;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition: all 0.12s;
  touch-action: manipulation;
}

.intercom-chat-header-phone:hover { background: #166534; }
.intercom-chat-header-phone svg { fill: currentColor; }

/* Voice groups in sidebar */
.intercom-vgroup-list {
  padding: 2px 0;
}

.intercom-vgroup-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 13px;
  color: #ccc;
}

.intercom-vgroup-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.intercom-vgroup-call,
.intercom-vgroup-edit {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  flex-shrink: 0;
  transition: color 0.12s;
}

.intercom-vgroup-call { color: #22c55e; }
.intercom-vgroup-call:hover { color: #4ade80; }
.intercom-vgroup-call svg { fill: currentColor; }

.intercom-vgroup-edit { color: #555; font-size: 14px; }
.intercom-vgroup-edit:hover { color: #999; }

.intercom-vgroup-add {
  display: block;
  width: calc(100% - 28px);
  margin: 6px 14px;
  padding: 6px;
  border-radius: 6px;
  border: 1px dashed #444;
  background: transparent;
  color: #666;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  transition: all 0.12s;
}

.intercom-vgroup-add:hover {
  border-color: #14b8a6;
  color: #14b8a6;
}

/* ── Group create/edit modal ── */
.intercom-group-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 100003;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Space Grotesk', -apple-system, sans-serif;
}

.intercom-group-modal {
  background: #1a1a2e;
  border: 1px solid #2a2a4e;
  border-radius: 14px;
  padding: 20px;
  width: min(360px, calc(100vw - 40px));
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.intercom-group-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
}

.intercom-group-modal-input {
  width: 100%;
  padding: 8px 12px;
  background: #12122a;
  border: 1px solid #333;
  border-radius: 8px;
  color: #ddd;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
  margin-bottom: 12px;
}

.intercom-group-modal-input:focus { border-color: #14b8a6; }

.intercom-group-modal-section {
  font-size: 11px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.intercom-group-modal-users {
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.intercom-group-modal-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  color: #ccc;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.1s;
}

.intercom-group-modal-user:hover { background: #252545; }

.intercom-group-modal-user input[type=checkbox] {
  accent-color: #14b8a6;
  width: 16px;
  height: 16px;
}

.intercom-group-modal-privacy {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid #333;
  border-radius: 8px;
  color: #999;
  font-size: 12px;
  cursor: pointer;
  margin-bottom: 14px;
}

.intercom-group-modal-privacy input[type=checkbox] {
  accent-color: #eab308;
  width: 16px;
  height: 16px;
}

.intercom-group-modal-btns {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.intercom-group-modal-cancel,
.intercom-group-modal-save {
  padding: 8px 20px;
  border-radius: 8px;
  border: 1px solid;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.intercom-group-modal-cancel {
  background: transparent;
  color: #888;
  border-color: #444;
}

.intercom-group-modal-cancel:hover { color: #ccc; border-color: #666; }

.intercom-group-modal-save {
  background: #14532d;
  color: #22c55e;
  border-color: #22c55e;
}

.intercom-group-modal-save:hover { background: #166534; }

/* ── Mobile ── */
@media (max-width: 768px) {
  .intercom-widget {
    bottom: 50px;
    left: 14px;
  }

  .intercom-btn-off,
  .intercom-ptt {
    width: 44px;
    height: 44px;
  }

  .intercom-btn-off svg,
  .intercom-ptt svg {
    width: 18px;
    height: 18px;
  }

  .intercom-panel-arrow {
    height: 44px;
    width: 20px;
  }

  .intercom-panel {
    width: 200px;
    left: 72px;
  }

  .intercom-chat-panel {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: auto !important;
    height: auto !important;
    border-radius: 0;
    z-index: 99999 !important;
  }

  /* Mobile: sidebar = full width by default, conv hidden */
  .intercom-chat-sidebar {
    width: 100% !important;
    min-width: 100% !important;
  }

  .intercom-chat-conv {
    display: none;
  }

  /* When conversation is active on mobile, flip: hide sidebar, show conv */
  .intercom-chat-panel.mobile-conv .intercom-chat-sidebar {
    display: none !important;
  }

  .intercom-chat-panel.mobile-conv .intercom-chat-conv {
    display: flex;
  }

  /* Hide desktop select, show mobile button */
  .intercom-chat-select-desktop {
    display: none !important;
  }

  .intercom-chat-channel-btn {
    display: none !important;
  }

  /* Back button — only visible on mobile in conv mode */
  .intercom-chat-back {
    display: flex !important;
  }

  .intercom-chat-sidebar-close {
    display: block !important;
  }

  .intercom-call-widget {
    left: 14px;
    bottom: 180px;
  }

  .intercom-chat-dm-item {
    padding: 14px 16px;
    font-size: 18px;
    gap: 12px;
  }

  .intercom-chat-dm-item .intercom-dot {
    width: 10px;
    height: 10px;
  }

  .intercom-dm-phone,
  .intercom-dm-mic {
    padding: 6px;
  }

  .intercom-dm-phone svg,
  .intercom-dm-mic svg {
    width: 20px;
    height: 20px;
  }

  .intercom-fav-toggle {
    font-size: 22px;
  }

  .intercom-chat-channel-item {
    padding: 14px 16px;
    font-size: 18px;
  }

  .intercom-chat-sidebar-label {
    padding: 12px 16px 6px;
    font-size: 12px;
  }

  .intercom-chat-sidebar-header {
    padding: 14px 16px;
    font-size: 18px;
  }

  .intercom-chat-resize-handle,
  .intercom-chat-resize-toggle {
    display: none !important;
  }

  .intercom-chat-input {
    font-size: 16px;
  }

  .intercom-chat-input-area {
    padding: 6px;
    gap: 3px;
  }

  .intercom-chat-header-mic,
  .intercom-chat-header-phone {
    width: 36px;
    height: 36px;
    min-width: 36px;
  }

  .intercom-call-accept,
  .intercom-call-decline {
    min-height: 44px;
    min-width: 120px;
    font-size: 16px;
  }
}
