@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ─── RESET & BASE ──────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-darkest: #060a13;
  --bg-dark: #0b1120;
  --bg-mid: #111a2e;
  --bg-panel: #162032;
  --bg-hover: #1a2740;
  --bg-active: #1e2f4d;
  --border: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.10);
  --border-glow: rgba(6, 182, 212, 0.15);
  --text-primary: #eaf0f6;
  --text-sec: #8899b0;
  --text-muted: #4a5c75;
  --accent: #06b6d4;
  --accent-dark: #0891b2;
  --accent-glow: rgba(6, 182, 212, 0.12);
  --accent-soft: rgba(6, 182, 212, 0.08);
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.15);
  --warning: #f59e0b;
  --danger: #ef4444;
  --wa-green: #25D366;
  --ig-pink: #E1306C;
  --purple: #8b5cf6;
  --purple-glow: rgba(139, 92, 246, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 64px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(6, 182, 212, 0.08);
  --glass: rgba(11, 17, 32, 0.7);
  --glass-border: rgba(255, 255, 255, 0.06);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);

  /* Variáveis de balão de mensagem para permitir sobrescrita via tema */
  --msg-out-bg: linear-gradient(135deg, var(--accent-dark), #065f73);
  --msg-out-text: #ffffff;
  --msg-in-bg: var(--bg-hover);
  --msg-in-text: var(--text-primary);
  --msg-sys-bg: rgba(255, 255, 255, 0.05);
  --msg-sys-text: var(--text-sec);
}

/* ─── TEMA: WHATSAPP CLARO ────────────────────────────────────────────────── */
body[data-theme="whatsapp-light"] {
  --bg-darkest: #e5ddd5;
  --bg-dark: #f0f2f5;
  --bg-mid: #ffffff;
  --bg-panel: #ffffff;
  --bg-hover: #f5f6f6;
  --bg-active: #ebebeb;
  --border: #d1d7db;
  --border-light: #e9edef;
  --text-primary: #111b21;
  --text-sec: #3b4a54;
  --text-muted: #667781;
  --accent: #008069;
  --accent-dark: #00a884;
  --glass: rgba(240, 242, 245, 0.95);
  --chat-bg-pattern: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='%23cdcacc' stroke-width='1.5' fill='none' d='M20,20 c10,-10 20,-10 30,0 c10,-10 20,-10 30,0 M20,50 c10,-10 20,-10 30,0 c10,-10 20,-10 30,0 M20,80 c10,-10 20,-10 30,0 c10,-10 20,-10 30,0 M35,35 circle(2) M65,65 rect(2,2,4,4) M80,20 circle(1.5) M20,80 rect(1.5,1.5,3,3)' opacity='0.5'/%3E%3C/svg%3E");

  --msg-out-bg: #d9fdd3;
  --msg-out-text: #111b21;
  --msg-in-bg: #ffffff;
  --msg-in-text: #111b21;
}

/* ─── TEMA: WHATSAPP ESCURO ───────────────────────────────────────────────── */
body[data-theme="whatsapp-dark"] {
  --bg-darkest: #0b141a;
  --bg-dark: #111b21;
  --bg-mid: #202c33;
  --bg-panel: #202c33;
  --bg-hover: #2a3942;
  --bg-active: #2a3942;
  --border: #222d34;
  --border-light: #2a3942;
  --text-primary: #e9edef;
  --text-sec: #aebac1;
  --text-muted: #8696a0;
  --accent: #00a884;
  --accent-dark: #008069;
  --glass: rgba(17, 27, 33, 0.95);
  --chat-bg-pattern: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='%2319262e' stroke-width='1.5' fill='none' d='M20,20 c10,-10 20,-10 30,0 c10,-10 20,-10 30,0 M20,50 c10,-10 20,-10 30,0 c10,-10 20,-10 30,0 M20,80 c10,-10 20,-10 30,0 c10,-10 20,-10 30,0 M35,35 circle(2) M65,65 rect(2,2,4,4) M80,20 circle(1.5) M20,80 rect(1.5,1.5,3,3)' opacity='0.5'/%3E%3C/svg%3E");

  --msg-out-bg: #005c4b;
  --msg-out-text: #e9edef;
  --msg-in-bg: #202c33;
  --msg-in-text: #e9edef;
}

html,
body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-darkest);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── SCROLLBAR ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ─── LAYOUT PRINCIPAL ──────────────────────────────────────────────────────── */
.app-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  height: 60px;
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
  position: relative;
}

.app-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-glow), transparent);
}

.app-header .logo {
  height: 36px;
  width: auto;
  border-radius: 6px;
  filter: drop-shadow(0 2px 8px rgba(6, 182, 212, 0.2));
}

.app-header .brand {
  display: flex;
  flex-direction: column;
}

.app-header .brand-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 1px;
  text-transform: uppercase;
  background: linear-gradient(135deg, #eaf0f6, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.app-header .brand-sub {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.header-spacer {
  flex: 1;
}

.status-dot {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-sec);
  background: var(--bg-mid);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.status-dot .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: var(--transition);
}

.status-dot .dot.connected {
  background: var(--success);
  box-shadow: 0 0 8px var(--success), 0 0 16px rgba(16, 185, 129, 0.3);
}

.status-dot .dot.disconnected {
  background: var(--danger);
  box-shadow: 0 0 8px var(--danger);
}

.header-nav {
  display: flex;
  gap: 4px;
  margin-left: 16px;
}

.header-nav a {
  color: var(--text-sec);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
}

.header-nav a:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border);
}

.header-nav a.active {
  background: var(--accent-glow);
  color: var(--accent);
  border-color: var(--border-glow);
  box-shadow: var(--shadow-glow);
}

.header-nav a .nav-icon {
  width: 16px;
  height: 16px;
  stroke-width: 2;
  flex-shrink: 0;
}

/* ─── CHAT LAYOUT ───────────────────────────────────────────────────────────── */
.chat-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ─── SIDEBAR ───────────────────────────────────────────────────────────────── */
.sidebar {
  width: 320px;
  flex-shrink: 0;
  background: var(--bg-dark);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-search {
  padding: 14px;
  border-bottom: 1px solid var(--border);
}

.search-input {
  width: 100%;
  background: var(--bg-mid);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px 10px 14px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: var(--transition);
}

.search-input:focus {
  border-color: var(--accent);
  background: var(--bg-panel);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.sidebar-filter {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.filter-btn {
  flex: 1;
  padding: 6px 0;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-sec);
  font-size: 11px;
  cursor: pointer;
  transition: var(--transition);
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.filter-btn:hover {
  border-color: var(--border-light);
  color: var(--text-primary);
  background: var(--bg-hover);
}

.filter-btn.active {
  background: var(--accent-glow);
  border-color: rgba(6, 182, 212, 0.25);
  color: var(--accent);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.08);
}

.leads-list {
  flex: 1;
  overflow-y: auto;
}

.lead-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
  position: relative;
}

.lead-item:hover {
  background: var(--bg-hover);
}

.lead-item.active {
  background: var(--bg-active);
  border-left: 3px solid var(--accent);
}

.lead-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  position: relative;
}

.lead-avatar.wa {
  background: linear-gradient(135deg, #128C7E, #25D366);
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.2);
}

.lead-avatar.ig {
  background: linear-gradient(135deg, #833ab4, #fd1d1d, #fcb045);
  box-shadow: 0 4px 12px rgba(225, 48, 108, 0.2);
}

.channel-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--bg-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
}

.channel-badge.wa {
  background: var(--wa-green);
}

.channel-badge.ig {
  background: var(--ig-pink);
}

.lead-info {
  flex: 1;
  min-width: 0;
}

.lead-name {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.lead-preview {
  color: var(--text-sec);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 3px;
}

.lead-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.lead-time {
  font-size: 11px;
  color: var(--text-muted);
}

.unread-badge {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  min-width: 18px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(6, 182, 212, 0.3);
}

.no-leads {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ─── ÁREA DE CHAT ──────────────────────────────────────────────────────────── */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-darkest);
  overflow: hidden;
  position: relative;
}

.chat-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  gap: 16px;
}

.chat-placeholder .icon {
  font-size: 48px;
  opacity: 0.4;
  color: var(--accent);
}

.chat-placeholder .icon svg {
  width: 56px;
  height: 56px;
  stroke: var(--accent);
  opacity: 0.5;
}

.chat-placeholder p {
  font-size: 14px;
  color: var(--text-sec);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
}

.chat-header-info .chat-lead-name {
  font-weight: 600;
  font-size: 14px;
}

.chat-header-info .chat-lead-sub {
  font-size: 12px;
  color: var(--text-sec);
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: transparent;
}

/* ─── BOLHAS ────────────────────────────────────────────────────────────────── */
.msg-row {
  display: flex;
  animation: fadeInUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.msg-row.in {
  justify-content: flex-start;
}

.msg-row.out {
  justify-content: flex-end;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.msg-bubble {
  max-width: 65%;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: 13.5px;
  line-height: 1.55;
  position: relative;
  word-break: break-word;
}

.msg-row.in .msg-bubble {
  background: var(--msg-in-bg);
  color: var(--msg-in-text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.msg-row.out .msg-bubble {
  background: var(--msg-out-bg);
  color: var(--msg-out-text);
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 16px rgba(6, 182, 212, 0.15);
}

.msg-time {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  text-align: right;
  margin-top: 4px;
}

.msg-row.in .msg-time {
  color: var(--text-muted);
  text-align: left;
}

/* ─── MÍDIAS NAS MENSAGENS ──────────────────────────────────────────────────── */
.msg-image {
  max-width: 100%;
  max-height: 220px;
  border-radius: var(--radius-md);
  display: block;
  cursor: pointer;
  object-fit: cover;
}

.msg-video {
  max-width: 100%;
  max-height: 220px;
  border-radius: var(--radius-md);
  display: block;
}

.msg-audio {
  width: 220px;
  accent-color: var(--accent);
}

.msg-doc {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.msg-doc svg {
  width: 16px;
  height: 16px;
  stroke: var(--accent);
  flex-shrink: 0;
}

/* ─── INPUT DE ENVIO ────────────────────────────────────────────────────────── */
.chat-input-area {
  padding: 14px 24px;
  background: var(--bg-dark);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg-mid);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 8px 14px;
  transition: var(--transition);
}

.input-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.msg-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 13.5px;
  font-family: 'Inter', sans-serif;
  resize: none;
  min-height: 22px;
  max-height: 120px;
  overflow-y: auto;
}

.msg-input::placeholder {
  color: var(--text-muted);
}

.input-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.action-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-sec);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.action-btn svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.action-btn:hover {
  background: var(--bg-hover);
  color: var(--accent);
  transform: scale(1.05);
}

.send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border: none;
  cursor: pointer;
  color: #fff;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(6, 182, 212, 0.3);
}

.send-btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.5;
}

.send-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 20px rgba(6, 182, 212, 0.4);
}

.send-btn:disabled {
  background: var(--bg-active);
  color: var(--text-muted);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.file-preview {
  margin-bottom: 8px;
  padding: 10px 14px;
  background: var(--bg-panel);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-sec);
}

.file-preview svg {
  width: 16px;
  height: 16px;
  stroke: var(--accent);
  flex-shrink: 0;
}

.file-preview .remove-file {
  margin-left: auto;
  cursor: pointer;
  color: var(--danger);
  background: none;
  border: none;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.file-preview .remove-file:hover {
  transform: scale(1.15);
}

.file-preview .remove-file svg {
  width: 14px;
  height: 14px;
  stroke: var(--danger);
}

/* ─── MODAL / LIGHTBOX ──────────────────────────────────────────────────────── */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
}

.lightbox.open {
  display: flex;
}

.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: var(--radius-md);
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 28px;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: var(--transition-fast);
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

/* ─── ADMIN LAYOUT ──────────────────────────────────────────────────────────── */
.admin-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.admin-sidebar {
  width: 240px;
  background: var(--bg-dark);
  border-right: 1px solid var(--border);
  padding: 16px 0;
  flex-shrink: 0;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  cursor: pointer;
  color: var(--text-sec);
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
  border-left: 3px solid transparent;
}

.admin-nav-item svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
  flex-shrink: 0;
}

.admin-nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.admin-nav-item.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-glow);
}

.admin-nav-item.active svg {
  stroke: var(--accent);
}

.admin-nav-item .icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title svg {
  width: 22px;
  height: 22px;
  stroke: var(--accent);
  stroke-width: 2;
}

/* ─── TABELA ────────────────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-dark);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}

.data-table th {
  background: var(--bg-panel);
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-sec);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: var(--bg-hover);
}

/* ─── BADGES ────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
}

.badge.wa {
  background: rgba(37, 211, 102, 0.1);
  color: var(--wa-green);
  border-color: rgba(37, 211, 102, 0.2);
}

.badge.ig {
  background: rgba(225, 48, 108, 0.1);
  color: var(--ig-pink);
  border-color: rgba(225, 48, 108, 0.2);
}

.badge.new {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(6, 182, 212, 0.2);
}

.badge.in_progress {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
  border-color: rgba(245, 158, 11, 0.2);
}

.badge.closed {
  background: var(--msg-sys-bg);
  color: var(--msg-sys-text);
  border-color: rgba(100, 100, 100, 0.2);
}

.badge.active {
  background: var(--success-glow);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.2);
}

.badge.inactive {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.2);
}

/* ─── BOTÕES ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: 'Inter', sans-serif;
  transition: var(--transition);
  text-decoration: none;
}

.btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  box-shadow: 0 2px 12px rgba(6, 182, 212, 0.25);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(6, 182, 212, 0.35);
}

.btn-secondary {
  background: var(--bg-panel);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

/* ─── MODAL ─────────────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 500;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--bg-dark);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 440px;
  max-width: 95vw;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(8px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-title svg {
  width: 20px;
  height: 20px;
  stroke: var(--accent);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  transition: var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-primary);
  transform: scale(1.1);
}

/* ─── FORMULÁRIOS ───────────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-sec);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  background: var(--bg-mid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--accent);
  background: var(--bg-panel);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-control::placeholder {
  color: var(--text-muted);
}

select.form-control {
  cursor: pointer;
}

select.form-control option {
  background: var(--bg-panel);
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ─── TOAST NOTIFICATIONS ───────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  min-width: 280px;
  font-size: 13px;
  animation: toastSlideIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  border-left: 3px solid var(--accent);
}

.toast.success {
  border-left-color: var(--success);
}

.toast.error {
  border-left-color: var(--danger);
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(30px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

/* ─── QR CODE PANEL ─────────────────────────────────────────────────────────── */
.qr-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  gap: 16px;
  background: var(--bg-panel);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  text-align: center;
}

.qr-panel img {
  width: 200px;
  height: 200px;
  border-radius: var(--radius-md);
  background: #fff;
  padding: 8px;
}

.qr-panel p {
  color: var(--text-sec);
  font-size: 13px;
}

/* ─── RESPONSIVO ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    display: none;
  }

  .sidebar.open {
    display: flex;
    position: absolute;
    z-index: 100;
    height: calc(100% - 60px);
  }
}

/* ─── SPIN ANIMATION ────────────────────────────────────────────────────────── */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.spin {
  animation: spin 1s linear infinite;
}

/* ─── ADMIN LAYOUT ──────────────────────────────────────────────────────────── */
.admin-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.admin-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-dark);
  border-right: 1px solid var(--border);
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-sec);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

.admin-nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.admin-nav-item.active {
  background: var(--accent-glow);
  color: var(--accent);
  border-color: var(--border-glow);
  box-shadow: var(--shadow-glow);
}

.admin-nav-item i,
.admin-nav-item svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
  flex-shrink: 0;
}

.admin-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

/* ─── SECTION HEADER ────────────────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title i,
.section-title svg {
  width: 22px;
  height: 22px;
  stroke: var(--accent);
  stroke-width: 2;
}

/* ─── DATA TABLE ────────────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.data-table th {
  text-align: left;
  padding: 12px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg-mid);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 10px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: var(--bg-hover);
}

/* ─── BUTTONS ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn i,
.btn svg {
  width: 14px;
  height: 14px;
  stroke-width: 2;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  border: none;
  box-shadow: 0 2px 12px rgba(6, 182, 212, 0.25);
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(6, 182, 212, 0.35);
}

.btn-secondary {
  background: var(--bg-mid);
  color: var(--text-sec);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-danger {
  background: rgba(239, 68, 68, .1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, .15);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, .2);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 11px;
  border-radius: 6px;
}

.btn-sm svg {
  width: 13px;
  height: 13px;
}

/* ─── FORMS ─────────────────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-sec);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-mid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-control::placeholder {
  color: var(--text-muted);
}

select.form-control {
  cursor: pointer;
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 18px;
}

/* ─── MODAL (Admin) ─────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--bg-dark);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  animation: cardIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
}

.modal-close:hover {
  color: var(--text-primary);
}

/* ─── CHAT HEADER ACTIONS ICONS ─────────────────────────────────────────────── */
.chat-header-actions button i,
.chat-header-actions button svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.8;
}

/* ─── INPUT AREA ICONS ──────────────────────────────────────────────────────── */
.input-actions .action-btn i,
.input-actions .action-btn svg,
.input-actions label i,
.input-actions label svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
  color: var(--text-sec);
  display: block;
}

.mic-btn i,
.mic-btn svg {
  width: 18px;
  height: 18px;
}

.send-btn i,
.send-btn svg {
  width: 16px;
  height: 16px;
}

/* ─── NOTES PANEL ICONS ─────────────────────────────────────────────────────── */
.notes-header h3 i,
.notes-header h3 svg {
  width: 16px;
  height: 16px;
  stroke: var(--accent);
  vertical-align: -2px;
  margin-right: 4px;
}

/* ─── POPUP HEADER ICONS ────────────────────────────────────────────────────── */
.popup-box h3 i,
.popup-box h3 svg,
.modal-box h3 i,
.modal-box h3 svg {
  width: 18px;
  height: 18px;
  stroke: var(--accent);
  vertical-align: -3px;
  margin-right: 6px;
}

/* ─── CHAT PLACEHOLDER ICON ─────────────────────────────────────────────────── */
.chat-placeholder .icon i,
.chat-placeholder .icon svg {
  width: 48px;
  height: 48px;
  stroke: var(--accent);
  stroke-width: 1;
  opacity: 0.4;
}

/* ─── AUDIO TRANSCRIPTION ───────────────────────────────────────────────────── */
.audio-transcription {
  margin-top: 6px;
  padding: 6px 10px;
  background: rgba(6, 182, 212, 0.05);
  border-left: 2px solid var(--accent);
  border-radius: 0 6px 6px 0;
  font-size: 11px;
  color: var(--text-sec);
  font-style: italic;
  line-height: 1.5;
  max-width: 300px;
  word-wrap: break-word;
}

.audio-transcription .transcription-label {
  font-weight: 600;
  font-style: normal;
  color: var(--accent);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}