:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-tertiary: #1f2937;
  --bg-elevated: #263345;
  --border-color: #2e3a4e;
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --accent-emerald: #10b981;
  --accent-emerald-dark: #059669;
  --accent-emerald-subtle: rgba(16, 185, 129, 0.15);
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --msg-incoming: #1e293b;
  --msg-outgoing: #064e3b;
  --msg-outgoing-border: #047857;
  --header-height: 58px;
  --bottom-nav-height: 64px;
  --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

/* ----------------------------------------------------
   HEADER
---------------------------------------------------- */
.app-header {
  box-sizing: border-box;
  height: calc(var(--header-height) + env(safe-area-inset-top, 0px));
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: 10px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  z-index: 30;
  flex-shrink: 0;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.3);
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-pro {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  background: var(--accent-emerald-subtle);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-full);
}

.badge-version {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: var(--radius-full);
  cursor: pointer;
  letter-spacing: 0.5px;
}
.badge-version:active {
  transform: scale(0.95);
  background: rgba(59, 130, 246, 0.3);
}

.connection-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.connection-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-amber);
}

.connection-pill.connected .dot {
  background-color: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
}

.btn-badge {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-badge:hover {
  background: rgba(59, 130, 246, 0.25);
}

/* ----------------------------------------------------
   MAIN BODY & LAYOUT
---------------------------------------------------- */
.main-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

/* SIDEBAR / CHAT LIST */
.sidebar {
  width: 380px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100%;
}

.instances-filter-bar {
  padding: 10px 12px;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  white-space: nowrap;
}

.filter-scroll {
  display: flex;
  gap: 8px;
}

.filter-pill {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  padding: 5px 12px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.filter-pill:hover, .filter-pill.active {
  background: var(--accent-emerald-subtle);
  color: var(--text-primary);
  border-color: rgba(16, 185, 129, 0.4);
}

.filter-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.filter-pill .dot.all {
  background: #9ca3af;
}

.search-bar-container {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.search-input-wrapper input {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 32px 8px 34px;
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  transition: border 0.2s;
}

.search-input-wrapper input:focus {
  border-color: var(--accent-emerald);
}

.stage-dropdown {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
}

/* CHAT LIST ITEMS */
.chat-list {
  flex: 1;
  overflow-y: auto;
}

.chat-item {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}

.chat-item:hover {
  background: var(--bg-tertiary);
}

.chat-item.active {
  background: rgba(16, 185, 129, 0.1);
  border-left: 3px solid var(--accent-emerald);
}

.chat-item-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  margin-right: 12px;
  flex-shrink: 0;
  position: relative;
}

.chat-item-avatar .instance-indicator-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--bg-secondary);
}

.chat-item-content {
  flex: 1;
  min-width: 0;
}

.chat-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.chat-item-name {
  font-size: 0.92rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.chat-item-time {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.chat-item-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-item-snippet {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.chat-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.unread-badge {
  background: var(--accent-emerald);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.stage-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  text-transform: capitalize;
}

.stage-badge.lead { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.stage-badge.atendimento { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.stage-badge.proposta { background: rgba(139, 92, 246, 0.15); color: #c084fc; border: 1px solid rgba(139, 92, 246, 0.3); }
.stage-badge.fechado { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.stage-badge.pos_venda { background: rgba(6, 182, 212, 0.15); color: #22d3ee; border: 1px solid rgba(6, 182, 212, 0.3); }
.stage-badge.perdido { background: rgba(244, 63, 94, 0.15); color: #fb7185; border: 1px solid rgba(244, 63, 94, 0.3); }

/* ----------------------------------------------------
   CHAT PANE & CONVERSATION
---------------------------------------------------- */
.chat-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  height: 100%;
  position: relative;
}

.chat-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 30px;
  text-align: center;
  color: var(--text-secondary);
}

.placeholder-icon {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-emerald);
  margin-bottom: 16px;
}

.chat-placeholder h3 {
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.chat-placeholder p {
  max-width: 420px;
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 24px;
}

.active-chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  position: relative;
}

.chat-header {
  height: var(--header-height);
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
}

.chat-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-title {
  font-size: 0.95rem;
  font-weight: 600;
}

.chat-sub-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.instance-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}

.instance-indicator .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-emerald);
}

.chat-header-actions {
  display: flex;
  gap: 6px;
}

/* MESSAGES */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: radial-gradient(circle at 50% 50%, rgba(17, 24, 39, 0.4) 0%, rgba(11, 15, 25, 0.9) 100%);
}

.message-row {
  display: flex;
  width: 100%;
}

.message-row.incoming {
  justify-content: flex-start;
}

.message-row.outgoing {
  justify-content: flex-end;
}

.message-bubble {
  max-width: 75%;
  min-width: 120px;
  padding: 8px 12px 6px;
  border-radius: var(--radius-md);
  position: relative;
  font-size: 0.88rem;
  line-height: 1.45;
  box-shadow: var(--shadow-sm);
  word-break: break-word;
}

.message-row.incoming .message-bubble {
  background-color: var(--msg-incoming);
  color: var(--text-primary);
  border-bottom-left-radius: 3px;
  border: 1px solid var(--border-color);
}

.message-row.outgoing .message-bubble {
  background-color: var(--msg-outgoing);
  color: #ecfdf5;
  border-bottom-right-radius: 3px;
  border: 1px solid var(--msg-outgoing-border);
}

.message-text {
  white-space: pre-wrap;
}

.message-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.message-row.outgoing .message-footer {
  color: #a7f3d0;
}

.message-status-icon {
  font-size: 0.75rem;
}

/* MEDIA ATTACHMENTS RENDERING */
.media-image-container {
  margin-bottom: 6px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  max-width: 320px;
  cursor: pointer;
}

.media-image {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  display: block;
  transition: transform 0.2s;
}

.media-image:hover {
  transform: scale(1.02);
}

.media-video-container {
  margin-bottom: 6px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  max-width: 320px;
}

.media-video {
  width: 100%;
  max-height: 260px;
  display: block;
}

.media-audio-player {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  min-width: 220px;
}

.media-audio-player audio {
  width: 100%;
  height: 36px;
}

.media-doc-container {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  min-width: 240px;
  max-width: 340px;
}

.pdf-icon-badge {
  width: 38px;
  height: 42px;
  background: #dc2626;
  color: #fff;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.7rem;
  letter-spacing: 0.5px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.4);
}

.pdf-icon-badge i {
  width: 16px;
  height: 16px;
  margin-bottom: 1px;
}

.doc-details {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.doc-name {
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #f8fafc;
}

.doc-actions-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
}

.doc-view-btn {
  color: #38bdf8;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s;
}

.doc-view-btn:hover {
  text-decoration: underline;
  color: #7dd3fc;
}

.doc-download-btn {
  color: #94a3b8;
  font-size: 0.78rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s;
}

.doc-download-btn:hover {
  color: #cbd5e1;
  text-decoration: underline;
}

/* ========================================================
   WHATSAPP NATIVE PIX CARD (Idêntico ao WhatsApp Oficial)
   ======================================================== */
.message-pix-card {
  background: #dcf8c6;
  color: #111827;
  border-radius: 12px;
  padding: 12px 14px 10px;
  min-width: 250px;
  max-width: 320px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  margin-bottom: 4px;
}

body.dark .message-pix-card {
  background: #064e3b;
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #f1f5f9;
}

.pix-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pix-card-icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #10b981;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

.pix-card-title-group {
  flex: 1;
  overflow: hidden;
}

.pix-card-beneficiary {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.25;
  color: #111827;
}

body.dark .pix-card-beneficiary {
  color: #f8fafc;
}

.pix-card-key-details {
  font-size: 0.82rem;
  color: #4b5563;
  margin-top: 2px;
  word-break: break-all;
}

body.dark .pix-card-key-details {
  color: #94a3b8;
}

.pix-card-action-bar {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
}

body.dark .pix-card-action-bar {
  border-top-color: rgba(255, 255, 255, 0.12);
}

.btn-copy-pix {
  background: transparent;
  border: none;
  color: #059669;
  font-weight: 700;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.15s ease;
  width: 100%;
  justify-content: center;
}

body.dark .btn-copy-pix {
  color: #34d399;
}

.btn-copy-pix:hover {
  background: rgba(16, 185, 129, 0.15);
}

.btn-copy-pix:active {
  transform: scale(0.97);
}

.btn-copy-pix.copied {
  color: #10b981;
}

/* ----------------------------------------------------
   QUICK REPLIES AUTOCOMPLETE & POPOVER
---------------------------------------------------- */
.quick-replies-autocomplete {
  position: absolute;
  bottom: 68px;
  left: 14px;
  right: 14px;
  max-width: 480px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45), 0 4px 10px rgba(0, 0, 0, 0.25);
  z-index: 50;
  overflow: hidden;
  animation: qrSlideUp 0.15s ease-out;
}

@keyframes qrSlideUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.qr-ac-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.75rem;
}

.qr-ac-title {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-emerald);
  font-weight: 700;
}

.qr-ac-hint {
  color: var(--text-muted);
  font-size: 0.7rem;
}

.qr-ac-list {
  max-height: 220px;
  overflow-y: auto;
  padding: 6px;
}

.qr-ac-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  gap: 10px;
  border: 1px solid transparent;
}

.qr-ac-item:hover,
.qr-ac-item.selected {
  background: var(--bg-tertiary);
  border-color: var(--accent-emerald);
}

.qr-ac-item-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
  flex: 1;
}

.qr-ac-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qr-pill {
  background: var(--accent-emerald-subtle);
  color: var(--accent-emerald);
  font-weight: 700;
  font-size: 0.75rem;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-family: monospace;
  white-space: nowrap;
}

.qr-ac-item-title {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qr-ac-item-snippet {
  font-size: 0.74rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qr-ac-empty {
  padding: 16px 12px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.8rem;
}

/* QUICK REPLIES POPOVER */
.quick-replies-popover {
  position: absolute;
  bottom: 68px;
  left: 14px;
  width: calc(100% - 28px);
  max-width: 440px;
  max-height: 420px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 55;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: qrSlideUp 0.15s ease-out;
}

.qr-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
}

.qr-popover-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}

.qr-popover-title i {
  color: var(--accent-emerald);
  width: 16px;
  height: 16px;
}

.qr-badge-counter {
  background: var(--accent-emerald-subtle);
  color: var(--accent-emerald);
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-weight: 700;
}

.qr-popover-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.qr-popover-search {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.qr-popover-search .search-icon {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.qr-popover-search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.82rem;
}

.qr-popover-search input::placeholder {
  color: var(--text-muted);
}

.qr-popover-items {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 250px;
}

.qr-popover-card {
  padding: 8px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.qr-popover-card:hover {
  border-color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.08);
  transform: translateY(-1px);
}

.qr-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.qr-card-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}

.qr-card-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qr-card-snippet {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.qr-popover-footer {
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.btn-xs-primary {
  background: var(--accent-emerald);
  color: #fff;
  border: none;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-xs-primary:hover {
  background: var(--accent-emerald-dark);
}

#btn-quick-reply-composer {
  color: var(--text-secondary);
  transition: color 0.15s, transform 0.15s, background 0.15s;
}

#btn-quick-reply-composer:hover,
#btn-quick-reply-composer.active {
  color: var(--accent-emerald);
  background: var(--accent-emerald-subtle);
}

/* QUICK REPLIES MODAL ENHANCEMENTS */
.qr-search-bar-modal {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  margin-bottom: 14px;
}

.qr-search-bar-modal .search-icon {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.qr-search-bar-modal input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.85rem;
}

.quick-replies-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 4px;
  margin-bottom: 16px;
}

.qr-manage-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.15s ease;
}

.qr-manage-card:hover {
  border-color: rgba(16, 185, 129, 0.4);
}

.qr-manage-card-info {
  flex: 1;
  overflow: hidden;
}

.qr-manage-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.qr-manage-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.qr-manage-text {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.qr-manage-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.qr-form-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.qr-form-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.qr-form-header h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.qr-form-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .flex-1 { flex: 1; }
.form-row .flex-2 { flex: 2; }

.input-with-prefix {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.input-with-prefix .prefix {
  padding: 0 10px;
  font-weight: 700;
  color: var(--accent-emerald);
  background: var(--accent-emerald-subtle);
  border-right: 1px solid var(--border-color);
  font-family: monospace;
}

.input-with-prefix input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 8px 10px;
  color: var(--text-primary);
  outline: none;
  font-size: 0.85rem;
}

.field-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 3px;
  display: block;
}

.qr-form-buttons {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

@media (max-width: 640px) {
  .form-row {
    flex-direction: column;
    gap: 8px;
  }
  .quick-replies-popover,
  .quick-replies-autocomplete {
    left: 8px;
    right: 8px;
    width: calc(100% - 16px);
  }
}

/* COMPOSER */
.chat-composer {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  position: relative;
  z-index: 35;
}

.composer-normal-content {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  width: 100%;
}

.btn-pix-action {
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.btn-pix-action:hover {
  color: var(--accent-emerald);
  transform: scale(1.08);
}

.input-wrapper {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 8px 14px;
  display: flex;
  align-items: center;
}

.input-wrapper textarea {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.92rem;
  resize: none;
  max-height: 120px;
  line-height: 1.4;
  cursor: text;
  -webkit-user-select: text;
  user-select: text;
}

.btn-mic {
  width: 38px;
  height: 38px;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.btn-mic:hover {
  color: var(--accent-emerald);
  background: var(--accent-emerald-subtle);
  transform: scale(1.08);
}

.btn-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-emerald);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
  transition: transform 0.15s, background 0.15s;
}

.btn-send:hover {
  background: var(--accent-emerald-dark);
  transform: scale(1.05);
}

.btn-send:active {
  transform: scale(0.95);
}

/* WHATSAPP-LIKE AUDIO RECORDING BAR */
.audio-recording-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  animation: qrSlideUp 0.15s ease-out;
  gap: 12px;
}

.recording-live-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 80px;
}

.recording-pulse-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ef4444;
  display: inline-block;
  animation: recordPulse 0.9s infinite alternate;
}

@keyframes recordPulse {
  0% { transform: scale(0.85); opacity: 0.4; }
  100% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 10px rgba(239, 68, 68, 0.9); }
}

.recording-timer {
  font-size: 0.95rem;
  font-weight: 700;
  color: #f87171;
  font-family: monospace;
}

.recording-waves {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 28px;
  flex: 1;
  justify-content: center;
}

.wave-bar {
  width: 3px;
  border-radius: 2px;
  background: var(--accent-emerald);
  animation: waveBounce 0.7s ease-in-out infinite alternate;
}

.wave-bar:nth-child(1) { height: 8px; animation-delay: 0.1s; }
.wave-bar:nth-child(2) { height: 16px; animation-delay: 0.25s; }
.wave-bar:nth-child(3) { height: 24px; animation-delay: 0.4s; }
.wave-bar:nth-child(4) { height: 12px; animation-delay: 0.15s; }
.wave-bar:nth-child(5) { height: 22px; animation-delay: 0.3s; }
.wave-bar:nth-child(6) { height: 15px; animation-delay: 0.5s; }
.wave-bar:nth-child(7) { height: 26px; animation-delay: 0.2s; }
.wave-bar:nth-child(8) { height: 10px; animation-delay: 0.35s; }

@keyframes waveBounce {
  0% { transform: scaleY(0.4); opacity: 0.5; }
  100% { transform: scaleY(1.3); opacity: 1; }
}

.recording-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-recording-cancel {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-recording-cancel:hover {
  background: #ef4444;
  color: #fff;
  transform: scale(1.08);
}

.btn-recording-send {
  background: var(--accent-emerald);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

.btn-recording-send:hover {
  background: var(--accent-emerald-dark);
  transform: scale(1.08);
}

/* ----------------------------------------------------
   CRM DRAWER
---------------------------------------------------- */
.crm-drawer {
  width: 320px;
  background-color: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.drawer-header {
  height: var(--header-height);
  padding: 0 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.drawer-profile {
  text-align: center;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

.drawer-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bg-elevated);
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
}

.crm-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.crm-field label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-select, .crm-field textarea, .crm-field input {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 8px 10px;
  font-size: 0.85rem;
  outline: none;
}

.form-select:focus, .crm-field textarea:focus, .crm-field input:focus {
  border-color: var(--accent-emerald);
}

.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.tag-badge {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-full);
  padding: 3px 8px;
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tag-badge .remove-tag {
  cursor: pointer;
}

.tag-input-row {
  display: flex;
  gap: 6px;
}

.tag-input-row input {
  flex: 1;
}

/* ----------------------------------------------------
   BOTTOM NAVIGATION (Mobile-First)
---------------------------------------------------- */
.bottom-nav {
  box-sizing: border-box;
  height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: flex-start;
  justify-content: space-around;
  padding-top: 8px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: max(4px, env(safe-area-inset-left, 0px));
  padding-right: max(4px, env(safe-area-inset-right, 0px));
  z-index: 40;
  flex-shrink: 0;
}

.nav-item {
  flex: 1;
  height: 100%;
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: color 0.15s;
}

.nav-item i {
  width: 20px;
  height: 20px;
}

.nav-item.active {
  color: var(--accent-emerald);
}

.nav-item.active i {
  stroke-width: 2.5;
}

.nav-badge {
  position: absolute;
  top: 6px;
  right: calc(50% - 18px);
  background: var(--accent-rose);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  min-width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ----------------------------------------------------
   MODALS
---------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.modal-box.modal-lg {
  max-width: 720px;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-title-group h2 {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

/* INSTANCES CARDS GRID */
.instances-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.instance-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.instance-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.instance-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
}

.instance-status-tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.instance-status-tag.connected {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.instance-status-tag.qr_ready {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.instance-status-tag.disconnected {
  background: rgba(156, 163, 175, 0.15);
  color: var(--text-muted);
  border: 1px solid rgba(156, 163, 175, 0.3);
}

.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px;
  background: #fff;
  border-radius: var(--radius-md);
  margin: 6px 0;
}

.qr-image {
  width: 180px;
  height: 180px;
  display: block;
}

.qr-tip {
  color: #333;
  font-size: 0.72rem;
  font-weight: 600;
  margin-top: 4px;
}

.instance-card-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.add-instance-bar {
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}

.input-inline {
  display: flex;
  gap: 8px;
}

.input-inline input {
  flex: 1;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-primary);
}

/* REVZAP MODAL */
.revzap-banner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 16px;
}

.revzap-banner-icon {
  color: var(--accent-emerald);
  flex-shrink: 0;
}

.webhook-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 16px;
}

.webhook-card label {
  font-size: 0.8rem;
  font-weight: 600;
  display: block;
  margin-bottom: 6px;
}

.copy-box {
  display: flex;
  gap: 8px;
}

.copy-box input {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--accent-emerald);
  font-family: monospace;
  font-size: 0.85rem;
}

.hint {
  display: block;
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.revzap-actions-row {
  display: flex;
  gap: 8px;
}

.revzap-logs-table-wrapper {
  margin-top: 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

.logs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.logs-table th, .logs-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.logs-table th {
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-weight: 600;
}

/* CLOUD 24H GUIDE MODAL */
.guide-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.guide-step {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
}

.highlight-step {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.05);
}

.step-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-emerald);
  margin-bottom: 4px;
}

.mobile-ip-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-top: 8px;
}

.ip-url {
  font-family: monospace;
  font-weight: 600;
  color: #60a5fa;
}

.guide-list {
  padding-left: 20px;
  margin-top: 8px;
  font-size: 0.85rem;
  line-height: 1.6;
}

.guide-step ul {
  padding-left: 20px;
  margin-top: 8px;
  font-size: 0.85rem;
  line-height: 1.6;
}

/* ----------------------------------------------------
   LIGHTBOX MODAL & IMAGE ZOOM
---------------------------------------------------- */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 22, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
  animation: fadeIn 0.15s ease-out;
}

.lightbox-toolbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 58px;
  padding: 0 16px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.92) 0%, rgba(15, 23, 42, 0.5) 80%, transparent 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 20;
  pointer-events: auto;
}

.lightbox-toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lightbox-zoom-badge {
  background: rgba(255, 255, 255, 0.12);
  color: #f8fafc;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 9999px;
  letter-spacing: 0.5px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  min-width: 52px;
  text-align: center;
}

.lightbox-hint {
  color: #94a3b8;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 5px;
}

.lightbox-hint i {
  width: 14px;
  height: 14px;
}

.lightbox-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lightbox-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.lightbox-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  transform: translateY(-1px);
}

.lightbox-btn:active {
  transform: translateY(0);
  background: rgba(255, 255, 255, 0.15);
}

.lightbox-btn i {
  width: 18px;
  height: 18px;
}

.lightbox-btn-close {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  margin-left: 6px;
}

.lightbox-btn-close:hover {
  background: rgba(239, 68, 68, 0.4);
  color: #ffffff;
}

.lightbox-viewport {
  flex: 1;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  touch-action: none;
}

.lightbox-viewport.is-zoomed {
  cursor: grab;
}

.lightbox-viewport.is-dragging {
  cursor: grabbing !important;
}

.lightbox-image-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
  will-change: transform;
  transition: transform 0.08s ease-out;
  pointer-events: auto;
}

.lightbox-image-wrapper.no-transition {
  transition: none !important;
}

#lightbox-img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  user-select: none;
  -webkit-user-drag: none;
  display: block;
}

/* Media zoom hint in chat bubbles */
.media-image-container {
  position: relative;
  cursor: zoom-in;
  overflow: hidden;
  border-radius: var(--radius-sm);
  display: inline-block;
  max-width: 100%;
}

.media-image-container:hover .media-zoom-overlay {
  opacity: 1;
}

.media-zoom-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 600;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.media-zoom-overlay i {
  width: 16px;
  height: 16px;
}

@media (max-width: 768px) {
  .lightbox-hint {
    display: none;
  }
  .lightbox-btn {
    width: 34px;
    height: 34px;
  }
}

/* ----------------------------------------------------
   BUTTONS & COMMON
---------------------------------------------------- */
.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-icon:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-icon-sm {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.btn-primary {
  background: var(--accent-emerald);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.15s;
}

.btn-primary:hover {
  background: var(--accent-emerald-dark);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}

.btn-secondary:hover {
  background: #334155;
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
  border: 1px solid rgba(244, 63, 94, 0.3);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.8rem;
  cursor: pointer;
}

.btn-sm {
  padding: 4px 8px;
  font-size: 0.75rem;
}

.full-width {
  width: 100%;
}

.hidden {
  display: none !important;
}

.divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 16px 0;
}

.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.form-group input, .form-group textarea {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--text-primary);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-emerald);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 20px auto 10px;
}

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

.loading-state {
  text-align: center;
  padding: 30px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ----------------------------------------------------
   MESSAGE ACTIONS, EDIT, FORWARD & FAVORITE
---------------------------------------------------- */
.message-actions-trigger {
  position: absolute;
  top: 4px;
  right: 4px;
  opacity: 0;
  transition: opacity 0.15s;
  background: rgba(17, 24, 39, 0.8);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  border: none;
  cursor: pointer;
  z-index: 5;
}

.message-bubble:hover .message-actions-trigger,
.message-bubble.touch-active .message-actions-trigger,
.message-actions-trigger.active {
  opacity: 1;
}

.message-dropdown {
  position: absolute;
  top: 28px;
  right: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  min-width: 145px;
  z-index: 50;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.message-menu-item {
  padding: 8px 12px;
  font-size: 0.78rem;
  color: var(--text-primary);
  background: transparent;
  border: none;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.message-menu-item:hover {
  background: var(--bg-tertiary);
}

.message-menu-item.starred {
  color: #fbbf24;
}

.star-indicator {
  color: #fbbf24;
  font-size: 0.75rem;
  margin-right: 3px;
  vertical-align: middle;
}

.edited-badge {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-style: italic;
  margin-left: 2px;
}

.forwarded-badge {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
  font-style: italic;
}

/* EDITING BANNER */
.editing-banner {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-left: 3px solid var(--accent-emerald);
}

.editing-info {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.editing-icon {
  color: var(--accent-emerald);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.editing-texts {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.editing-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-emerald);
}

.editing-preview {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

/* FORWARD MODAL */
.forward-preview-box {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.84rem;
  max-height: 90px;
  overflow-y: auto;
  border-left: 3px solid var(--accent-blue);
}

.forward-search-box input {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  margin-bottom: 10px;
}

.forward-targets-list {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.forward-target-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.forward-target-item:hover, .forward-target-item.selected {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.forward-target-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.forward-target-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
}

/* ----------------------------------------------------
   RESPONSIVE DESIGN (Mobile Focus)
---------------------------------------------------- */
@media (max-width: 768px) {
  .desktop-only,
  #btn-open-cloud-guide {
    display: none !important;
  }
  
  .mobile-only {
    display: flex;
  }

  #btn-back-chats {
    display: none !important;
  }

  .app-container.in-chat #btn-back-chats {
    display: flex !important;
  }

  /* Prevent auto-zoom and scaling issues on iOS Safari */
  input[type="text"],
  input[type="search"],
  textarea,
  select {
    font-size: 16px !important;
  }

  .chat-item {
    padding: 14px 16px;
  }

  .instances-filter-bar {
    padding: 10px 14px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .instances-filter-bar::-webkit-scrollbar {
    display: none;
  }

  .sidebar {
    width: 100%;
    border-right: none;
  }

  /* When chat is open on mobile, hide sidebar and bottom nav to give 100% room to composer & keyboard */
  .app-container.in-chat .sidebar {
    display: none !important;
  }

  .app-container.in-chat .chat-pane {
    display: flex !important;
  }

  .app-container.in-chat .bottom-nav {
    display: none !important;
  }

  .app-container:not(.in-chat) .chat-pane {
    display: none !important;
  }

  .crm-drawer {
    position: fixed;
    top: var(--header-height);
    right: 0;
    bottom: var(--bottom-nav-height);
    width: 85%;
    max-width: 320px;
    z-index: 50;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.6);
  }

  .message-bubble {
    max-width: 86%;
  }

  .instances-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 769px) {
  .mobile-only {
    display: none !important;
  }
}

/* ========================================================
   AUTH LOCKSCREEN (TELA DE BLOQUEIO COM SENHA)
   ======================================================== */
.auth-lockscreen {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(10, 15, 29, 0.97);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.auth-lockscreen.hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  display: none !important;
}

.auth-card {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  max-width: 420px;
  width: 100%;
  padding: 36px 28px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 30px rgba(16, 185, 129, 0.1);
  text-align: center;
  position: relative;
  animation: authCardIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes authCardIn {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.auth-icon-wrapper {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.12);
  border: 2px solid rgba(16, 185, 129, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  color: #10b981;
}

.auth-icon-wrapper i {
  width: 32px;
  height: 32px;
}

.auth-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 8px;
}

.auth-subtitle {
  font-size: 0.88rem;
  color: #94a3b8;
  margin-bottom: 24px;
  line-height: 1.45;
}

.auth-field {
  text-align: left;
  margin-bottom: 16px;
}

.auth-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #94a3b8;
  margin-bottom: 8px;
}

.auth-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-icon {
  position: absolute;
  left: 14px;
  color: #64748b;
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.auth-input {
  width: 100%;
  height: 50px;
  background: #1e293b;
  border: 1.5px solid #334155;
  border-radius: 12px;
  padding: 0 46px 0 44px;
  color: #f8fafc;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.auth-input:focus {
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.btn-toggle-pwd {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-toggle-pwd:hover {
  color: #f8fafc;
}

.auth-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  text-align: left;
}

.auth-error.hidden {
  display: none !important;
}

.auth-options {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 22px;
  font-size: 0.85rem;
  color: #94a3b8;
}

.auth-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.auth-checkbox-label input[type="checkbox"] {
  accent-color: #10b981;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.btn-auth-submit {
  width: 100%;
  height: 50px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  border-radius: 12px;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.35);
}

.btn-auth-submit:active {
  transform: scale(0.98);
}

.btn-auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-security-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 24px;
  font-size: 0.75rem;
  color: #64748b;
}

@keyframes shakeCard {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-10px); }
  40%, 80% { transform: translateX(10px); }
}

.shake {
  animation: shakeCard 0.4s ease-in-out;
}

/* ==========================================================================
   MOBILE & IPHONE PUSH NOTIFICATIONS STYLES
   ========================================================================== */

.notif-badge-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background-color: #ef4444;
  border-radius: 50%;
  border: 2px solid #0f172a;
  animation: pulseNotif 2s infinite;
}

@keyframes pulseNotif {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.iphone-notif-banner {
  margin: 8px 12px;
  padding: 10px 12px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(59, 130, 246, 0.15));
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: slideInDown 0.3s ease-out;
}

@keyframes slideInDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.notif-banner-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notif-banner-icon i, .notif-banner-icon svg {
  width: 18px;
  height: 18px;
}

.notif-banner-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.notif-banner-text strong {
  font-size: 0.82rem;
  color: #ffffff;
}

.notif-banner-text span {
  font-size: 0.72rem;
  color: #94a3b8;
}

.btn-banner-action {
  background: #10b981;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.btn-banner-action:hover {
  background: #059669;
}

.btn-banner-close {
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.btn-banner-close:hover {
  color: #cbd5e1;
}

.notif-modal-card {
  max-width: 480px;
}

.notif-modal-icon {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.notif-status-card {
  padding: 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.notif-status-card.granted {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
}

.notif-status-card.denied {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
}

.notif-status-card.default {
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #60a5fa;
}

.notif-status-indicator {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.08);
}

.notif-status-info h4 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #f8fafc;
}

.notif-status-info p {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: #94a3b8;
}

.notif-guide-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 18px;
}

.notif-guide-card .guide-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  color: #38bdf8;
  margin-bottom: 12px;
}

.guide-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.guide-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.8rem;
  color: #cbd5e1;
  line-height: 1.4;
}

.step-badge {
  background: #1e293b;
  border: 1px solid #334155;
  color: #38bdf8;
  font-weight: 700;
  font-size: 0.75rem;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.guide-footnote {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.75rem;
  color: #10b981;
  display: flex;
  align-items: center;
  gap: 6px;
}

.notif-buttons-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ========================================================
   QUICK REPLIES MEDIA & COMPOSER ATTACHMENT
   ======================================================== */
.composer-attachment-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 8px;
  padding: 6px 12px;
  margin: 6px 14px 4px 14px;
  animation: fadeInDown 0.18s ease-out;
}

.composer-attachment-bar.hidden {
  display: none !important;
}

.attachment-preview-thumb {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.attachment-preview-thumb img,
.attachment-preview-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-preview-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.attachment-preview-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-preview-note {
  font-size: 0.72rem;
  color: #38bdf8;
  margin-top: 1px;
}

.btn-detach {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-detach:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
}

/* Quick Replies Modal Media Section */
.qr-media-section {
  margin-top: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.qr-media-picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.qr-media-preview-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 8px 12px;
  margin-top: 10px;
}

.qr-media-preview-box.hidden {
  display: none !important;
}

.qr-preview-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
}

.qr-preview-thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.qr-preview-thumb img,
.qr-preview-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.qr-preview-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.qr-preview-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qr-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  width: fit-content;
}

.qr-type-badge.image {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.qr-type-badge.video {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.qr-type-badge.audio {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.qr-attach-checkbox-group {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.82rem;
  color: #cbd5e1;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #10b981;
  cursor: pointer;
}

/* Quick Replies Media Pills & Tags */
.qr-media-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 6px;
  vertical-align: middle;
}

.qr-media-pill.image {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
}

.qr-media-pill.video {
  background: rgba(59, 130, 246, 0.18);
  color: #60a5fa;
}

.qr-media-pill.audio {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
}

/* PushName Badge on Leads */
.pushname-tag {
  font-size: 0.74rem;
  font-weight: 500;
  color: #94a3b8;
  background: rgba(148, 163, 184, 0.12);
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  display: inline-block;
  vertical-align: middle;
}

.btn-qr-direct-send {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.btn-qr-direct-send:hover {
  background: #10b981;
  color: #ffffff;
}

/* ========================================================
   BROADCAST MULTI-MESSAGE ROTATION (ANTI-BAN SPAM)
   ======================================================== */
.broadcast-messages-section {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
}

.broadcast-msg-item {
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.broadcast-msg-item:focus-within {
  border-color: rgba(56, 189, 248, 0.5) !important;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.2);
}

.broadcast-message-item-text {
  transition: border-color 0.15s ease;
}

.broadcast-message-item-text:focus {
  border-color: #38bdf8 !important;
  outline: none;
}

/* ========================================================
   TOAST NOTIFICATION (ALERTA FLUTUANTE INFORMATIVO NO TOPO)
   ======================================================== */
#app-toast {
  position: fixed !important;
  top: 24px !important;
  bottom: auto !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
  background: #10b981 !important;
  color: #ffffff !important;
  padding: 9px 18px !important;
  border-radius: 9999px !important;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  z-index: 999999 !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45) !important;
  pointer-events: none !important;
  max-width: min(90vw, 520px) !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  text-align: center !important;
  display: none;
  opacity: 0;
  transition: opacity 0.25s ease !important;
}

@media (max-width: 768px) {
  #app-toast {
    top: 18px !important;
    bottom: auto !important;
    max-width: calc(100vw - 32px) !important;
    font-size: 0.78rem !important;
    padding: 7px 14px !important;
  }
}

/* ========================================================
   SWITCH TOGGLE (BOTÕES DE ALTERNÂNCIA / CONFIGURAÇÕES)
   ======================================================== */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #374151;
  transition: .25s ease;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .25s ease;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #10b981;
}

input:checked + .slider:before {
  transform: translateX(20px);
}


