/* ==========================================================================
   CentralZAP - Design System & UI Styling
   Focado em ergonomia, alta produtividade e conforto para as operadoras
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Tema Claro (Padrão Sofisticado) */
  --bg-app: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-sidebar: #0f172a;
  --bg-chat: #e2e8f0;
  --bg-chat-bubble-in: #ffffff;
  --bg-chat-bubble-out: #dcf8c6;
  --bg-chat-bubble-note: #fef3c7;
  --bg-chat-bubble-bot: #e0f2fe;

  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-inverse: #ffffff;

  --primary: #10b981;
  --primary-hover: #059669;
  --primary-light: #d1fae5;
  --primary-dark: #047857;

  --accent-ai: #6366f1;
  --accent-ai-light: #e0e7ff;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;
  --accent-info: #0ea5e9;

  --border: #e2e8f0;
  --border-focus: #10b981;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-app: #090d16;
  --bg-surface: #111827;
  --bg-surface-elevated: #1e293b;
  --bg-sidebar: #050811;
  --bg-chat: #0b1120;
  --bg-chat-bubble-in: #1e293b;
  --bg-chat-bubble-out: #064e3b;
  --bg-chat-bubble-note: #451a03;
  --bg-chat-bubble-bot: #1e1b4b;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --text-inverse: #ffffff;

  --primary: #10b981;
  --primary-hover: #34d399;
  --primary-light: rgba(16, 185, 129, 0.15);

  --accent-ai: #818cf8;
  --accent-ai-light: rgba(99, 102, 241, 0.15);
  --accent-warning: #fbbf24;
  --accent-danger: #f87171;

  --border: #1e293b;
  --border-focus: #10b981;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  scrollbar-gutter: stable;
}

/* Teclas de Atalho (KBD) */
kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  background: var(--bg-app);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 4px;
  box-shadow: 0 1px 0 var(--border);
}

/* ==========================================================================
   Header Superior
   ========================================================================== */
.app-header {
  height: 56px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 30;
  box-shadow: var(--shadow-sm);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-main);
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

.brand span.unit-badge {
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-left: 6px;
}

[data-theme="dark"] .brand span.unit-badge {
  color: var(--primary);
}

.header-status-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-app);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
}

.status-dot.online {
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.status-dot.warning {
  background: #f59e0b;
}

.status-dot.offline {
  background: #ef4444;
}

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

.operator-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-app);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.operator-badge:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon:hover {
  background: var(--bg-app);
  color: var(--text-main);
  border-color: var(--text-light);
}

/* ==========================================================================
   Layout Principal da Aplicação
   ========================================================================== */
.app-container {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Barra Lateral de Navegação (Módulos) */
.nav-sidebar {
  width: 68px;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  gap: 12px;
  z-index: 20;
}

.nav-item {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  text-decoration: none;
  font-size: 0.7rem;
  gap: 3px;
}

.nav-item i {
  font-size: 1.25rem;
}

.nav-item:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.nav-item.active {
  color: #ffffff;
  background: var(--primary);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

#btnAutoAssign {
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
}

#btnAutoAssign:hover {
  background: var(--accent-ai);
  color: white;
}

.nav-item .badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--accent-danger);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: var(--radius-full);
  line-height: 1;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* ==========================================================================
   Coluna de Conversas (Inbox)
   ========================================================================== */
.inbox-panel {
  width: 360px;
  min-width: 320px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.inbox-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.search-box {
  position: relative;
  margin-bottom: 12px;
}

.search-box input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-app);
  color: var(--text-main);
  font-size: 0.875rem;
  outline: none;
  transition: var(--transition);
}

.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.search-box i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  font-size: 0.9rem;
}

.tab-nav {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.tab-nav::-webkit-scrollbar {
  height: 0;
}

.tab-btn {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 5px;
}

.tab-btn:hover {
  background: var(--bg-app);
  color: var(--text-main);
}

.tab-btn.active {
  background: var(--primary-light);
  color: var(--primary-dark);
}

[data-theme="dark"] .tab-btn.active {
  color: var(--primary);
}

.tab-btn .tab-count {
  background: rgba(0, 0, 0, 0.08);
  font-size: 0.7rem;
  padding: 1px 5px;
  border-radius: var(--radius-full);
}

[data-theme="dark"] .tab-btn .tab-count {
  background: rgba(255, 255, 255, 0.1);
}

/* Lista de Chats */
.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

.chat-card:hover {
  background: var(--bg-app);
}

.chat-card.active {
  background: var(--primary-light);
  border-color: rgba(16, 185, 129, 0.3);
}

.chat-card .card-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #cbd5e1;
  color: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
  position: relative;
}

[data-theme="dark"] .chat-card .card-avatar {
  background: #334155;
  color: #f1f5f9;
}

.chat-card .ai-mode-indicator {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.chat-card-info {
  flex: 1;
  min-width: 0;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 3px;
}

.card-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-time {
  font-size: 0.72rem;
  color: var(--text-light);
  white-space: nowrap;
}

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

.card-msg {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 190px;
}

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

.card-agent-tag {
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-app);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ==========================================================================
   Área Principal do Chat
   ========================================================================== */
.chat-main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-chat);
  position: relative;
  overflow: hidden;
  height: 100%;
  min-height: 0;
}

#activeChatWrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

/* Tela Vazia */
.empty-chat-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  gap: 16px;
  padding: 20px;
  text-align: center;
}

.empty-icon-circle {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.8rem;
  color: var(--primary);
  box-shadow: var(--shadow-md);
}

.empty-chat-state h3 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-main);
}

.quick-tips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 10px;
}

.quick-tips span {
  font-size: 0.8rem;
  background: var(--bg-surface);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Header do Chat */
.chat-header {
  height: 64px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 10;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

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

.chat-header-user .header-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #3b82f6;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
}

.chat-user-details h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.chat-user-details p {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Seletor de Modo de IA (Auto / Copilot / Manual) */
.ai-mode-selector {
  display: flex;
  background: var(--bg-app);
  border: 1px solid var(--border);
  padding: 2px;
  border-radius: var(--radius-full);
}

.ai-mode-btn {
  padding: 5px 12px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
}

.ai-mode-btn.active.auto {
  background: var(--accent-ai);
  color: white;
}

.ai-mode-btn.active.copilot {
  background: var(--accent-warning);
  color: #1e293b;
}

.ai-mode-btn.active.manual {
  background: #64748b;
  color: white;
}

/* Botões de Ação de Atendimento */
.btn {
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.btn-primary {
  background: var(--primary);
  color: white;
}

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

.btn-secondary {
  background: var(--bg-app);
  border-color: var(--border);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--accent-danger);
  border-color: rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: var(--accent-danger);
  color: white;
}

/* ==========================================================================
   Feed de Mensagens
   ========================================================================== */
.messages-container {
  flex: 1 1 0%;
  min-height: 0;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message-bubble {
  max-width: 65%;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  line-height: 1.45;
  position: relative;
  word-break: break-word;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

/* Mensagem recebida (Cliente) */
.message-bubble.incoming {
  align-self: flex-start;
  background: var(--bg-chat-bubble-in);
  color: var(--text-main);
  border-bottom-left-radius: 4px;
}

/* Mensagem enviada (Atendente ou Bot) */
.message-bubble.outgoing {
  align-self: flex-end;
  background: var(--bg-chat-bubble-out);
  color: #064e3b;
  border-bottom-right-radius: 4px;
}

[data-theme="dark"] .message-bubble.outgoing {
  color: #ecfdf5;
}

/* Mensagem enviada por Bot de IA */
.message-bubble.outgoing.bot {
  background: var(--bg-chat-bubble-bot);
  color: #1e3a8a;
}

[data-theme="dark"] .message-bubble.outgoing.bot {
  color: #e0e7ff;
}

/* Nota Interna Privada (Post-it Amarelo) */
.message-bubble.internal-note {
  align-self: center;
  max-width: 80%;
  background: var(--bg-chat-bubble-note);
  border: 1px dashed var(--accent-warning);
  color: #78350f;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
}

[data-theme="dark"] .message-bubble.internal-note {
  color: #fef08a;
}

.message-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  font-size: 0.7rem;
  margin-top: 4px;
  opacity: 0.7;
}

.message-sender-name {
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 2px;
  opacity: 0.85;
}

.message-body {
  font-size: 0.88rem;
  line-height: 1.5;
  word-break: break-word;
}

.message-body strong,
.copilot-text strong {
  font-weight: 700;
}

.message-body em,
.copilot-text em {
  font-style: italic;
}

.message-body del,
.copilot-text del {
  text-decoration: line-through;
  opacity: 0.8;
}

.chat-code-inline {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  background: rgba(0, 0, 0, 0.08);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.82rem;
}

[data-theme="dark"] .chat-code-inline {
  background: rgba(255, 255, 255, 0.12);
}

.chat-code-block {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  background: rgba(0, 0, 0, 0.07);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  overflow-x: auto;
  margin: 6px 0;
  white-space: pre;
}

[data-theme="dark"] .chat-code-block {
  background: rgba(0, 0, 0, 0.3);
}

.chat-link {
  color: inherit;
  text-decoration: underline;
  font-weight: 500;
  word-break: break-all;
}

.chat-link:hover {
  opacity: 0.85;
}

/* ==========================================================================
   Mídia no Chat (Imagens, Vídeos, Áudio, Documentos)
   ========================================================================== */
.message-media {
  margin-bottom: 6px;
  border-radius: var(--radius-md);
  overflow: hidden;
  max-width: 100%;
}

.chat-media-img-wrapper {
  position: relative;
  display: inline-block;
  cursor: pointer;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.chat-media-img-wrapper:hover .media-zoom-overlay {
  opacity: 1;
}

.media-zoom-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
  opacity: 0;
  transition: var(--transition);
  backdrop-filter: blur(2px);
}

.chat-media-img {
  display: block;
  max-width: 100%;
  max-height: 320px;
  width: auto;
  height: auto;
  border-radius: var(--radius-md);
  object-fit: cover;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.chat-media-img-wrapper:hover .chat-media-img {
  transform: scale(1.02);
}

.chat-media-video {
  display: block;
  max-width: 100%;
  max-height: 320px;
  border-radius: var(--radius-md);
  outline: none;
  background: #000;
}

.chat-media-audio {
  display: block;
  width: 100%;
  min-width: 260px;
  height: 42px;
  outline: none;
  border-radius: var(--radius-full);
}

.chat-media-doc {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
}

[data-theme="dark"] .chat-media-doc {
  background: rgba(255, 255, 255, 0.06);
}

.chat-media-doc:hover {
  background: rgba(0, 0, 0, 0.1);
  border-color: var(--primary);
  transform: translateY(-1px);
}

[data-theme="dark"] .chat-media-doc:hover {
  background: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .chat-media-doc:hover {
  background: rgba(255, 255, 255, 0.12);
}

.chat-media-doc .doc-icon {
  font-size: 1.8rem;
  color: var(--primary);
}

.chat-media-doc .doc-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.chat-media-doc .doc-name {
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.chat-media-doc .doc-action {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ==========================================================================
   Card de Sugestão da IA (Co-Piloto AnythingLLM)
   ========================================================================== */
.copilot-suggestion-card {
  margin: 0 20px 10px 20px;
  background: var(--bg-surface);
  border: 1px solid var(--accent-ai);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.15);
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: slideUp 0.3s ease-out;
}

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

.copilot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 700;
}

.copilot-badge {
  color: var(--accent-ai);
  display: flex;
  align-items: center;
  gap: 6px;
}

.copilot-text {
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--text-main);
  background: var(--bg-app);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-ai);
  max-height: 120px;
  overflow-y: auto;
}

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

.btn-copilot {
  font-size: 0.75rem;
  height: 30px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: var(--transition);
}

.btn-copilot.use {
  background: var(--accent-ai-light);
  color: var(--accent-ai);
}

.btn-copilot.use:hover {
  background: var(--accent-ai);
  color: white;
}

.btn-copilot.send-direct {
  background: var(--primary);
  color: white;
}

.btn-copilot.send-direct:hover {
  background: var(--primary-hover);
}

.btn-copilot.regen {
  background: transparent;
  color: var(--text-muted);
}

.btn-copilot.regen:hover {
  color: var(--text-main);
}

.btn-copilot.close {
  background: transparent;
  color: var(--text-light);
  width: 24px;
  height: 24px;
  padding: 0;
  justify-content: center;
}

.btn-copilot.close:hover {
  color: var(--accent-danger);
}

/* ==========================================================================
   Área de Envio de Mensagem
   ========================================================================== */
.chat-composer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  flex-shrink: 0;
  z-index: 10;
}

.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.composer-mode-toggle {
  display: flex;
  gap: 6px;
}

.composer-mode-btn {
  padding: 4px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: transparent;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
}

.composer-mode-btn.active.whatsapp {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
}

[data-theme="dark"] .composer-mode-btn.active.whatsapp {
  color: var(--primary);
}

.composer-mode-btn.active.note {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}

.composer-hints {
  display: flex;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.composer-input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.composer-textarea {
  flex: 1;
  min-height: 72px;
  max-height: 150px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-app);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
  outline: none;
  line-height: 1.45;
  transition: var(--transition);
}

.composer-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.btn-send {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

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

/* ==========================================================================
   Compositor - Botão de Anexo e Preview de Arquivo
   ========================================================================== */
.btn-attach {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.btn-attach:hover {
  color: var(--primary);
  background: var(--primary-light);
  border-color: var(--primary);
  transform: scale(1.05);
}

.composer-attachment-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  animation: slideUp 0.2s ease-out;
}

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

.composer-attachment-preview .attachment-icon {
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.composer-attachment-preview .attachment-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.composer-attachment-preview .attachment-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

.composer-attachment-preview .attachment-size {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.btn-attachment-remove {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-attachment-remove:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-danger);
}

.chat-main-area.drag-over {
  outline: 3px dashed var(--primary);
  outline-offset: -8px;
  background: rgba(16, 185, 129, 0.05);
}

/* ==========================================================================
   Menu Popover de Respostas Rápidas ('/')
   ========================================================================== */
.canned-popover {
  position: absolute;
  bottom: 74px;
  left: 20px;
  width: 340px;
  max-height: 250px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
  z-index: 50;
  display: none;
}

.canned-popover.show {
  display: block;
}

.canned-popover-item {
  padding: 9px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

.canned-popover-item:hover {
  background: var(--primary-light);
}

.canned-item-top {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--primary);
}

.canned-item-preview {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   Painel Lateral de Contexto do Cliente
   ========================================================================== */
.context-panel {
  width: 280px;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 16px;
  overflow-y: auto;
}

.context-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  color: white;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

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

.tag-badge .remove-tag:hover {
  opacity: 1;
}

/* ==========================================================================
   Cards de Métricas
   ========================================================================== */
.metric-card {
  background: var(--bg-surface);
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.metric-val {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-main);
}

.metric-val.primary { color: var(--primary); }
.metric-val.info { color: var(--accent-info); }
.metric-val.ai { color: var(--accent-ai); }

/* ==========================================================================
   Atalhos de Teclado Modal
   ========================================================================== */
.shortcut-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-app);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-main);
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
  pointer-events: none;
}

.toast {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInRight 0.25s ease-out;
  pointer-events: auto;
}

.toast.success { border-left: 4px solid var(--primary); }
.toast.info { border-left: 4px solid var(--accent-info); }
.toast.warning { border-left: 4px solid var(--accent-warning); }

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ==========================================================================
   Modal Genérico
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  width: 90%;
  max-width: 520px;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

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

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-body {
  padding: 20px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-app);
}

/* Formulários */
.form-group {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-control {
  height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-app);
  color: var(--text-main);
  font-size: 0.875rem;
  outline: none;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

textarea.form-control {
  height: 80px;
  padding: 10px 12px;
}

/* ==========================================================================
   Tela de Login
   ========================================================================== */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.3s ease-out;
}

.login-overlay.hidden {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.login-card {
  width: 90%;
  max-width: 400px;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
  padding: 40px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  animation: slideUp 0.4s ease-out;
}

.login-brand {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.login-brand h2 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-main);
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-form .form-group label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.login-btn {
  width: 100%;
  height: 44px;
  font-size: 0.95rem;
  font-weight: 700;
  margin-top: 4px;
}

.login-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--accent-danger);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  width: 100%;
}

/* ==========================================================================
   Modal Lightbox para Imagens (Tela Cheia)
   ========================================================================== */
.lightbox-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

.lightbox-content {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border);
  animation: scaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.lightbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border);
}

.lightbox-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-main);
}

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

.btn-lightbox {
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: var(--transition);
}

.btn-lightbox:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.btn-lightbox.close {
  background: transparent;
  border-color: transparent;
  font-size: 1.1rem;
  padding: 6px 10px;
}

.btn-lightbox.close:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-danger);
}

.lightbox-body {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  max-height: calc(90vh - 65px);
  background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .lightbox-body {
  background: rgba(0, 0, 0, 0.3);
}

.lightbox-body img {
  max-width: 100%;
  max-height: calc(85vh - 70px);
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
}

@keyframes scaleUp {
  from {
    transform: scale(0.92);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Animação suave para indicador online */
.status-dot.online {
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulseGreen 2s infinite;
}

@keyframes pulseGreen {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* ==========================================================================
   Página do Guia do Atendente
   ========================================================================== */
.guide-container {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 40px;
}

.guide-header-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: var(--shadow-sm);
}

.guide-header-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  flex-shrink: 0;
}

.guide-header-info h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 4px;
}

.guide-header-info p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.guide-search-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.guide-search-box i {
  color: var(--text-light);
  font-size: 1rem;
}

.guide-search-box input {
  border: none;
  background: transparent;
  width: 100%;
  font-size: 0.95rem;
  color: var(--text-main);
  outline: none;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(440px, 1fr));
  gap: 16px;
}

.guide-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.guide-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.guide-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.guide-card-content {
  flex: 1;
}

.guide-card-content h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.guide-card-content p {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.45;
}

.guide-card-content ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-main);
}

.guide-card-content ul li {
  position: relative;
  padding-left: 16px;
  line-height: 1.45;
}

.guide-card-content ul li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: bold;
  font-size: 1.1rem;
  line-height: 1;
}

.guide-shortcuts-card,
.guide-tips-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
}

.guide-shortcuts-card h3,
.guide-tips-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.guide-shortcuts-table {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
}

.guide-shortcut-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-app);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
}

.guide-shortcut-desc {
  font-weight: 500;
  color: var(--text-main);
}

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

.guide-tip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-app);
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
}
