/* ==========================================================================
   PROSPECTMAPS PRO — EXECUTIVE EDITION (IMPECCABLE DESIGN SYSTEM)
   Paleta de Alto Padrão Executivo: Preto Ônix, Dourado Imperial e Branco Puro
   Tipografia: Outfit (Títulos & KPIs) + Plus Jakarta Sans + JetBrains Mono
   ========================================================================== */

/* --------------------------------------------------------------------------
   VARIÁVEIS DE TEMA: MODO ESCURO (ÔNIX & OURO POLIDO)
   -------------------------------------------------------------------------- */
:root,
html.dark {
  /* Superfícies & Fundos (Carvão Nobre / Preto Ônix) */
  --bg-main: #08090B;
  --bg-sidebar: #0D0F14;
  --bg-card: #13161D;
  --bg-card-glass: rgba(19, 22, 29, 0.82);
  --bg-card-hover: #1A1E27;
  --table-header-bg: #0F1218;
  --input-bg: #0C0E13;

  /* Bordas de Ouro Fino e Acabamentos */
  --border-color: rgba(212, 175, 55, 0.18);
  --border-glass: rgba(212, 175, 55, 0.12);
  --border-subtle: rgba(255, 255, 255, 0.06);

  /* Paleta Tipográfica de Alto Contraste */
  --text-primary: #F8F9FB;
  --text-secondary: #9EA6B8;
  --text-muted: #656C7D;

  /* Dourado Imperial & Metais Nobres */
  --gold-primary: #D4AF37;
  --gold-light: #F3E5AB;
  --gold-rich: #DFB15B;
  --gold-deep: #9E7C1B;
  --primary: #D4AF37;
  --primary-gradient: linear-gradient(135deg, #F3E5AB 0%, #DFB15B 35%, #C59B27 70%, #9E7C1B 100%);
  --primary-glow: rgba(212, 175, 55, 0.28);
  --primary-hover: #E5C378;

  /* Verde Esmeralda Executivo (WhatsApp & Confirmações) */
  --whatsapp: #10B981;
  --whatsapp-hover: #059669;
  --whatsapp-glow: rgba(16, 185, 129, 0.25);

  /* Níveis de Oportunidade (Calibração Nobre) */
  --score-critical: #E11D48;        /* Borgonha Ruby Real */
  --score-critical-glow: rgba(225, 29, 72, 0.3);
  --score-high: #D97706;            /* Âmbar Imperial */
  --score-high-glow: rgba(217, 119, 6, 0.25);
  --score-medium: #D4AF37;          /* Ouro Polido */
  --score-medium-glow: rgba(212, 175, 55, 0.22);
  --score-low: #64748B;             /* Platina Titânio */

  /* Status CRM */
  --status-new: #38BDF8;
  --status-contacted: #A855F7;
  --status-negotiation: #D4AF37;
  --status-won: #10B981;
  --status-lost: #64748B;

  /* Geometria & Sombras */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.55), 0 0 1px rgba(212, 175, 55, 0.25);
  --shadow-lg: 0 16px 44px rgba(0, 0, 0, 0.7), 0 0 2px rgba(212, 175, 55, 0.35);
  --modal-backdrop: rgba(4, 5, 7, 0.85);

  --sidebar-width: 260px;
  --transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --------------------------------------------------------------------------
   VARIÁVEIS DE TEMA: MODO CLARO (MÁRMORE BRANCO & OURO IMPERIAL)
   -------------------------------------------------------------------------- */
html.light {
  color-scheme: light;

  /* Superfícies & Fundos (Mármore & Branco Platina) */
  --bg-main: #F7F8FA;
  --bg-sidebar: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-card-glass: rgba(255, 255, 255, 0.95);
  --bg-card-hover: #FDFBF7;
  --table-header-bg: #F4F5F8;
  --input-bg: #F9FAFC;

  /* Fio de Ouro & Delimitações Claras */
  --border-color: rgba(184, 134, 11, 0.22);
  --border-glass: rgba(184, 134, 11, 0.12);
  --border-subtle: #E8EBF0;

  /* Tipografia em Preto Ônix e Cinza Nobre */
  --text-primary: #0A0D12;
  --text-secondary: #475062;
  --text-muted: #8690A3;

  /* Dourado Nobre para Fundo Branco (Legibilidade Perfeita) */
  --gold-primary: #B8860B;
  --gold-light: #DFB15B;
  --gold-rich: #9E7307;
  --gold-deep: #7A5703;
  --primary: #B8860B;
  --primary-gradient: linear-gradient(135deg, #DFB15B 0%, #B8860B 55%, #8C6207 100%);
  --primary-glow: rgba(184, 134, 11, 0.22);
  --primary-hover: #9E7307;

  --whatsapp: #059669;
  --whatsapp-hover: #047857;
  --whatsapp-glow: rgba(5, 150, 105, 0.2);

  /* Oportunidade com Alto Contraste */
  --score-critical: #BE123C;
  --score-critical-glow: rgba(190, 18, 60, 0.18);
  --score-high: #B45309;
  --score-high-glow: rgba(180, 83, 9, 0.18);
  --score-medium: #8A6409;
  --score-medium-glow: rgba(138, 100, 9, 0.18);
  --score-low: #475569;

  --status-new: #0284C7;
  --status-contacted: #7E22CE;
  --status-negotiation: #8A6409;
  --status-won: #047857;
  --status-lost: #64748B;

  --shadow-sm: 0 1px 3px rgba(10, 13, 18, 0.05), 0 1px 2px rgba(184, 134, 11, 0.03);
  --shadow-md: 0 6px 16px -2px rgba(10, 13, 18, 0.07), 0 2px 6px -2px rgba(184, 134, 11, 0.04);
  --shadow-lg: 0 14px 34px -4px rgba(10, 13, 18, 0.1), 0 4px 12px -4px rgba(184, 134, 11, 0.06);
  --modal-backdrop: rgba(10, 13, 18, 0.58);
}

/* ==========================================================================
   RESET & FUNDAÇÃO TIPOGRÁFICA
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}

/* Títulos executivos com Outfit */
h1, h2, h3, h4, .brand-info h1, #page-title, .kpi-value, .score-big {
  font-family: 'Outfit', sans-serif;
}

/* Scrollbar refinada com tom ouro sutil */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.25);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gold-primary);
}

html.light ::-webkit-scrollbar-thumb {
  background: rgba(184, 134, 11, 0.3);
}

/* ==========================================================================
   LAYOUT GERAL & SIDEBAR
   ========================================================================== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.25rem;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.15);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
}

.brand-icon {
  font-size: 1.6rem;
  background: linear-gradient(135deg, #F3E5AB 0%, #DFB15B 50%, #9E7C1B 100%);
  color: #0A0D12;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 14px var(--primary-glow);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-info h1 {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #FFFFFF 0%, #F5E6BE 45%, #DFB15B 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.badge-pro {
  font-size: 0.62rem;
  font-weight: 800;
  background: rgba(212, 175, 55, 0.14);
  color: #DFB15B;
  border: 1px solid rgba(212, 175, 55, 0.45);
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  background: transparent;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  width: 100%;
}

.nav-item:hover {
  background: rgba(212, 175, 55, 0.08);
  color: var(--text-primary);
  transform: translateX(4px);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.16), rgba(212, 175, 55, 0.02));
  color: #DFB15B;
  border-left: 3px solid #D4AF37;
  font-weight: 700;
}

.nav-item .icon {
  font-size: 1.15rem;
}

.sidebar-footer {
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.theme-toggle-sidebar-box {
  margin-bottom: 0.75rem;
}

.btn-theme-sidebar {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-theme-sidebar:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.btn-theme-sidebar .theme-icon {
  font-size: 1.1rem;
}

.system-status {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-indicator.online {
  background: #10B981;
  box-shadow: 0 0 8px #10B981;
}

/* ==========================================================================
   CONTEÚDO PRINCIPAL & HEADER EXECUTIVO
   ========================================================================== */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 1.75rem 1.85rem;
  max-width: 1800px;
}

.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  gap: 1.5rem;
}

.header-titles h2 {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

.header-titles p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  margin-top: 0.25rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

/* ==========================================================================
   BOTÕES & AÇÕES (ESTILO CARTÃO BLACK / GOLD EXECUTIVO)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.72rem 1.35rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  text-decoration: none;
  letter-spacing: 0.01em;
}

/* Botão Ouro Metálico */
.btn-primary {
  background: var(--primary-gradient);
  color: #0A0D12;
  box-shadow: 0 4px 18px var(--primary-glow);
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #FFFFFF 0%, #F5E6BE 35%, #DFB15B 75%, #B8860B 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px var(--primary-glow);
  color: #0A0D12;
}

/* Botão Secundário Ônix/Branco com Fio de Ouro */
.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.btn-whatsapp {
  background: linear-gradient(135deg, #10B981, #059669);
  color: #FFFFFF;
  box-shadow: 0 4px 14px var(--whatsapp-glow);
}
.btn-whatsapp:hover {
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-1px);
}

.btn-danger {
  background: rgba(225, 29, 72, 0.12);
  color: #FB7185;
  border: 1px solid rgba(225, 29, 72, 0.35);
}
.btn-danger:hover {
  background: rgba(225, 29, 72, 0.25);
  color: #FFFFFF;
}

.btn-sm {
  padding: 0.42rem 0.8rem;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
}

.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.theme-toggle-btn .theme-icon {
  font-size: 1.1rem;
}

/* Dropdown de Exportação */
.export-dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
  min-width: 175px;
  overflow: hidden;
  z-index: 50;
}

.export-dropdown:hover .dropdown-menu,
.dropdown-menu.show {
  display: flex;
}

.dropdown-item {
  padding: 0.7rem 1.1rem;
  font-size: 0.86rem;
  color: var(--text-primary);
  text-decoration: none;
  transition: var(--transition);
}
.dropdown-item:hover {
  background: rgba(212, 175, 55, 0.12);
  color: var(--primary);
}

/* ==========================================================================
   KPI CARDS GRID (PAINEL EXECUTIVO)
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.35rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.5rem;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

/* Filete dourado superior no hover */
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  opacity: 0;
  transition: var(--transition);
}

.kpi-card:hover {
  border-color: rgba(212, 175, 55, 0.45);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-card:hover::before {
  opacity: 1;
}

.kpi-card.highlight-critical {
  border-color: rgba(225, 29, 72, 0.4);
  background: linear-gradient(145deg, var(--bg-card), rgba(225, 29, 72, 0.08));
}

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

.kpi-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.kpi-icon {
  font-size: 1.3rem;
}

.kpi-value {
  font-size: 2.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0.45rem 0 0.15rem;
}

.kpi-subtext {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.text-critical { color: var(--score-critical); }
.text-warning { color: var(--score-high); }
.text-success { color: var(--whatsapp); }

/* ==========================================================================
   LIVE SCRAPER PROGRESS BAR (BARRA DE RASPAGEM COM AURA DOURADA)
   ========================================================================== */
.live-progress-card {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.12), var(--bg-card));
  border: 1px solid rgba(212, 175, 55, 0.4);
  box-shadow: 0 0 30px rgba(212, 175, 55, 0.18);
  border-radius: var(--radius-lg);
  padding: 1.3rem 1.6rem;
  margin-bottom: 1.5rem;
  animation: fadeIn 0.3s ease;
}

.live-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.85rem;
}

.live-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--text-primary);
}

.pulse-dot {
  width: 10px;
  height: 10px;
  background: var(--whatsapp);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--whatsapp);
  animation: pulse 1.4s infinite;
}

.live-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.live-count {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 0.92rem;
  color: #DFB15B;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 0.65rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #DFB15B, #F3E5AB, #10B981);
  border-radius: 99px;
  transition: width 0.35s ease;
}

.live-log {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
}

/* ==========================================================================
   BARRA DE FERRAMENTAS & FILTROS
   ========================================================================== */
.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0.68rem 1.1rem;
  border-radius: var(--radius-md);
  flex: 1;
  min-width: 280px;
  box-shadow: var(--shadow-sm);
}

.search-input-wrapper input {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  width: 100%;
}

.toolbar-filters {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.select-filter {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.68rem 0.95rem;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.select-filter:hover {
  border-color: var(--primary);
}

/* Seletor de Campanha Dourado na Toolbar */
.campaign-select-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.14), var(--bg-card));
  border: 1px solid rgba(212, 175, 55, 0.35);
  padding: 0.22rem 0.6rem 0.22rem 0.75rem;
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.campaign-select-icon {
  font-size: 1.1rem;
}

.search-batch-select {
  background: transparent !important;
  border: none !important;
  font-weight: 700;
  color: #DFB15B !important;
  cursor: pointer;
  padding-left: 0.2rem !important;
  font-size: 0.88rem;
  outline: none;
}

.search-batch-select option {
  background: #121820;
  color: #FFFFFF;
}

/* Modo Claro: Alto Contraste Imperial Bronze / Ouro Escuro */
html.light .campaign-select-group {
  background: #FFF9EB;
  border: 1px solid rgba(184, 134, 11, 0.45);
  box-shadow: 0 1px 3px rgba(184, 134, 11, 0.08);
}

html.light .search-batch-select {
  color: #7A5703 !important; /* Bronze imperial de altíssimo contraste */
}

html.light .search-batch-select option {
  background: #FFFFFF;
  color: #0A0D12;
}

/* Banner de Campanha Ativa */
.campaign-banner {
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.14), var(--bg-card));
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: var(--radius-lg);
  padding: 0.9rem 1.35rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  animation: fadeIn 0.25s ease;
  gap: 1rem;
  flex-wrap: wrap;
}

.campaign-banner-info {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.campaign-icon {
  font-size: 1.5rem;
  background: rgba(212, 175, 55, 0.18);
  color: #DFB15B;
  padding: 0.4rem 0.55rem;
  border-radius: var(--radius-sm);
}

.campaign-banner-info h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.campaign-banner-info p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

.campaign-banner-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

/* ==========================================================================
   TABELA DE LEADS (ROSTER EXECUTIVO)
   ========================================================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 1.45rem 1.85rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.card-header h3 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.015em;
}

.card-header p {
  font-size: 0.86rem;
  color: var(--text-secondary);
  margin: 0.35rem 0 0;
  line-height: 1.45;
}

.card-body {
  padding: 1.5rem 1.85rem;
}

.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-lg);
}

.table-container.card,
.card.table-container {
  overflow-x: auto;
  overflow-y: hidden;
}

.leads-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.82rem;
}

.leads-table th {
  background: var(--table-header-bg);
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.70rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.72rem 0.42rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.leads-table td {
  padding: 0.65rem 0.42rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  transition: var(--transition);
}

.leads-table tbody tr:hover td {
  background: var(--bg-card-hover);
}

/* Pílulas de Score Executivas */
.score-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.24rem 0.48rem;
  border-radius: 99px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.74rem;
  cursor: pointer;
  position: relative;
  transition: var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}
.score-badge-pill:hover {
  transform: scale(1.03);
}

.score-badge-pill.critical {
  background: rgba(225, 29, 72, 0.15);
  color: #FB7185;
  border: 1px solid rgba(225, 29, 72, 0.45);
  box-shadow: 0 0 12px var(--score-critical-glow);
}

.score-badge-pill.high {
  background: rgba(217, 119, 6, 0.15);
  color: #FBBF24;
  border: 1px solid rgba(217, 119, 6, 0.45);
}

.score-badge-pill.medium {
  background: rgba(212, 175, 55, 0.14);
  color: #DFB15B;
  border: 1px solid rgba(212, 175, 55, 0.4);
}

.score-badge-pill.low {
  background: rgba(100, 116, 139, 0.15);
  color: #94A3B8;
  border: 1px solid rgba(100, 116, 139, 0.35);
}

/* Modo Claro: Cores Fortes e Nítidas para Pílulas */
html.light .score-badge-pill.critical {
  background: rgba(225, 29, 72, 0.12);
  color: #BE123C;
  border-color: rgba(225, 29, 72, 0.35);
}
html.light .score-badge-pill.high {
  background: rgba(217, 119, 6, 0.12);
  color: #B45309;
  border-color: rgba(217, 119, 6, 0.35);
}
html.light .score-badge-pill.medium {
  background: rgba(184, 134, 11, 0.12);
  color: #7A5703;
  border-color: rgba(184, 134, 11, 0.35);
}
html.light .score-badge-pill.low {
  background: rgba(100, 116, 139, 0.12);
  color: #475569;
  border-color: rgba(100, 116, 139, 0.3);
}

.lead-title-box {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  max-width: 240px;
  min-width: 0;
}

.lead-name {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.88rem;
  max-width: 175px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: middle;
}

.lead-meta-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Status CRM Badges */
.badge-status {
  padding: 0.32rem 0.7rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.status-new { background: rgba(56, 189, 248, 0.15); color: #38BDF8; }
.status-contacted { background: rgba(168, 85, 247, 0.15); color: #A855F7; }
.status-negotiation { background: rgba(212, 175, 55, 0.16); color: #DFB15B; border: 1px solid rgba(212, 175, 55, 0.35); }
.status-won { background: rgba(16, 185, 129, 0.15); color: #10B981; }
.status-lost { background: rgba(100, 116, 139, 0.2); color: #94A3B8; }

html.light .status-negotiation {
  background: rgba(184, 134, 11, 0.12);
  color: #7A5703;
  border: 1px solid rgba(184, 134, 11, 0.35);
}

.status-select-inline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.25rem 0.35rem;
  border-radius: var(--radius-sm);
  font-size: 0.74rem;
  cursor: pointer;
  white-space: nowrap;
  max-width: 95px;
}

html.light .status-select-inline {
  background: #FFFFFF;
  color: #0A0D12;
}

.status-select-inline option {
  background: var(--bg-card);
  color: var(--text-primary);
}

.contact-icons {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.icon-btn-action {
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0;
  font-size: 0.76rem;
  cursor: pointer;
  color: var(--text-primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
  line-height: 1;
  width: 25px;
  height: 25px;
}

.icon-btn-action:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #0A0D12;
  transform: translateY(-1px);
}

.icon-btn-action.wa:hover {
  background: var(--whatsapp);
  border-color: var(--whatsapp);
  color: #FFFFFF;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4.5rem 2rem !important;
}

.empty-illustration {
  font-size: 3.2rem;
  margin-bottom: 1rem;
}

.empty-state h3 {
  font-size: 1.2rem;
  margin-bottom: 0.4rem;
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  max-width: 420px;
  margin: 0 auto;
}

/* ==========================================================================
   KANBAN CRM (FUNIL EXECUTIVO)
   ========================================================================== */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.35rem;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 1.5rem;
}

.kanban-col {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.2rem;
  min-height: 520px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.kanban-col.drag-over {
  border: 2px dashed var(--gold-primary, #d4af37) !important;
  background: rgba(212, 175, 55, 0.08) !important;
  box-shadow: 0 0 16px rgba(212, 175, 55, 0.22) !important;
}

.col-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.1rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--border-color);
}

.count-badge {
  font-size: 0.76rem;
  font-weight: 800;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 2px 9px;
  border-radius: 99px;
  color: var(--primary);
}

.kanban-cards {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  flex: 1;
}

.kanban-card-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.95rem;
  box-shadow: var(--shadow-sm);
  cursor: grab;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
  position: relative;
  user-select: none;
}

.kanban-card-item:hover {
  border-color: rgba(212, 175, 55, 0.45);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kanban-card-item:active {
  cursor: grabbing;
}

.kanban-card-item.dragging {
  opacity: 0.45;
  transform: scale(0.97);
  border: 2px dashed var(--gold-primary, #d4af37);
  box-shadow: var(--shadow-lg);
}

.kanban-card-name {
  font-weight: 700;
  font-size: 0.88rem;
  margin-bottom: 0.2rem;
  color: var(--text-primary);
  line-height: 1.3;
}

.kanban-card-score {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
  font-size: 0.76rem;
}

.kanban-empty-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem;
  border: 1px dashed var(--border-color, rgba(255, 255, 255, 0.1));
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 0.78rem;
  text-align: center;
  gap: 0.4rem;
  min-height: 120px;
}

.kanban-action-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.kanban-action-btn:hover {
  background: var(--bg-hover, rgba(255, 255, 255, 0.08));
  color: var(--text-primary);
  border-color: var(--gold-primary, #d4af37);
}

.kanban-action-btn.delete:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-color: #ef4444;
}

.kanban-action-btn.wa:hover {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border-color: #10b981;
}

.kanban-move-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 2px 7px;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.kanban-move-btn:hover {
  background: rgba(212, 175, 55, 0.15);
  border-color: var(--gold-primary, #d4af37);
  color: var(--gold-primary, #d4af37);
}

/* ==========================================================================
   MODAIS & OVERLAYS EXECUTIVOS
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--modal-backdrop);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.modal-dialog.modal-lg {
  max-width: 860px;
}

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

.modal-header h3 {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-primary);
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.8rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover {
  color: var(--primary);
}

.modal-body {
  padding: 1.9rem;
}

.form-group {
  margin-bottom: 1.3rem;
}

.form-group label {
  display: block;
  font-size: 0.84rem;
  font-weight: 700;
  margin-bottom: 0.45rem;
  color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.78rem 1.05rem;
  font-size: 0.92rem;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-row {
  display: flex;
  gap: 1rem;
}
.col-6 { flex: 1; }
.col-8 { flex: 2.2; }
.col-4 { flex: 1; min-width: 130px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.85rem;
  padding-top: 1.35rem;
  border-top: 1px solid var(--border-color);
  margin-top: 1.6rem;
}

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

/* Card Glass */
.card-glass {
  background: var(--bg-card-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  margin-bottom: 1rem;
}

/* Auditoria de Score no Modal */
.score-audit-card {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: linear-gradient(135deg, rgba(225, 29, 72, 0.12), var(--bg-card));
  border: 1px solid rgba(225, 29, 72, 0.4);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-md);
}

.score-big {
  font-family: 'JetBrains Mono', monospace;
  font-size: 3.2rem;
  font-weight: 800;
  color: var(--score-critical);
  line-height: 1;
}

.deficits-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.85rem;
}

.deficits-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-size: 0.88rem;
  background: var(--bg-sidebar);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--score-critical);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border-color);
  transition: .4s;
  border-radius: 34px;
}
.slider:before {
  position: absolute; content: ""; height: 16px; width: 16px; left: 4px; bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}
input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(20px); }

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.toggle-label {
  font-size: 0.84rem;
  color: var(--text-secondary);
}

/* Grid de Detalhes */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

/* Tab Panes */
.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

/* Toasts Executivos */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  z-index: 200;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  animation: slideInRight 0.3s ease;
}

.toast.success { border-left: 4px solid var(--whatsapp); }
.toast.error { border-left: 4px solid var(--score-critical); }
.toast.info { border-left: 4px solid var(--primary); }

/* Utilitários */
.hidden { display: none !important; }

/* Animações */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

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

/* ==========================================================================
   AJUSTES FINOS EXCLUSIVOS: MODO CLARO (html.light)
   ========================================================================== */
html.light .brand-info h1 {
  background: linear-gradient(90deg, #0A0D12 0%, #2A2312 40%, #B8860B 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

html.light .brand-icon {
  background: linear-gradient(135deg, #F3E5AB 0%, #DFB15B 50%, #B8860B 100%);
  color: #0A0D12;
}

html.light .badge-pro {
  background: rgba(184, 134, 11, 0.1);
  color: #8A6409;
  border: 1px solid rgba(184, 134, 11, 0.35);
}

html.light .nav-item:hover {
  background: rgba(184, 134, 11, 0.07);
  color: #0A0D12;
}

html.light .nav-item.active {
  background: linear-gradient(90deg, rgba(184, 134, 11, 0.12), rgba(184, 134, 11, 0.02));
  color: #8A6409;
  border-left: 3px solid #B8860B;
}

html.light .btn-primary {
  background: linear-gradient(135deg, #DFB15B 0%, #B8860B 60%, #8A6409 100%);
  color: #0A0D12;
  font-weight: 700;
}
html.light .btn-primary:hover {
  background: linear-gradient(135deg, #F3E5AB 0%, #DFB15B 60%, #B8860B 100%);
  color: #0A0D12;
}

html.light .btn-secondary {
  background: #FFFFFF;
  color: #0A0D12;
  border-color: rgba(184, 134, 11, 0.35);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
html.light .btn-secondary:hover {
  background: #FAF7F0;
  color: #8A6409;
  border-color: #B8860B;
}

html.light .select-filter,
html.light .search-input-wrapper {
  background: #FFFFFF;
  border-color: rgba(184, 134, 11, 0.25);
}

html.light .campaign-select-group {
  background: linear-gradient(135deg, rgba(184, 134, 11, 0.09), #FFFFFF);
  border: 1px solid rgba(184, 134, 11, 0.28);
}
html.light .search-batch-select {
  color: #8A6409 !important;
}

html.light .campaign-banner {
  background: linear-gradient(90deg, rgba(184, 134, 11, 0.08), #FFFFFF);
  border: 1px solid rgba(184, 134, 11, 0.28);
}
html.light .campaign-banner-info h4 {
  color: #0A0D12;
}
html.light .campaign-icon {
  background: rgba(184, 134, 11, 0.12);
  color: #B8860B;
}

html.light .live-progress-card {
  background: linear-gradient(135deg, rgba(184, 134, 11, 0.08), #FFFFFF);
  border: 1px solid rgba(184, 134, 11, 0.32);
}
html.light .live-title {
  color: #0A0D12;
}
html.light .live-count {
  color: #8A6409;
}

html.light .kpi-card {
  background: #FFFFFF;
  border-color: rgba(184, 134, 11, 0.2);
}
html.light .kpi-card:hover {
  border-color: rgba(184, 134, 11, 0.45);
}

html.light .leads-table th {
  background: #F4F5F8;
  color: #475062;
  border-bottom: 1px solid rgba(184, 134, 11, 0.2);
}
html.light .leads-table td {
  border-bottom: 1px solid rgba(184, 134, 11, 0.15);
}
html.light .leads-table tbody tr:hover td {
  background: #FAF9F6;
}

html.light .score-badge-pill.critical {
  background: #FFE4E6;
  color: #9F1239;
  border: 1px solid #FDA4AF;
}
html.light .score-badge-pill.high {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FCD34D;
}
html.light .score-badge-pill.medium {
  background: #FAF4E4;
  color: #8A6409;
  border: 1px solid #E5D2A0;
}
html.light .score-badge-pill.low {
  background: #F1F5F9;
  color: #475569;
  border: 1px solid #CBD5E1;
}

html.light .kanban-col {
  background: #F7F8FA;
  border-color: rgba(184, 134, 11, 0.2);
}
html.light .kanban-card-item {
  background: #FFFFFF;
  border-color: rgba(184, 134, 11, 0.18);
}
html.light .modal-dialog {
  background: #FFFFFF;
  border-color: rgba(184, 134, 11, 0.28);
}
html.light .form-group input,
html.light .form-group select,
html.light .form-group textarea {
  background: #F8F9FB;
  border-color: rgba(184, 134, 11, 0.25);
  color: #0A0D12;
}
html.light select option {
  background: #FFFFFF;
  color: #0A0D12;
}
html.light .card-glass {
  background: #FFFFFF;
  border-color: rgba(184, 134, 11, 0.2);
}
html.light .deficits-list li {
  background: #FFFFFF;
  border: 1px solid rgba(184, 134, 11, 0.18);
  border-left: 3px solid var(--score-critical);
}

/* ==========================================================================
   WHATSAPP VALIDAÇÃO, CONEXÃO DIRETA, ÁUDIO & PROSPECÇÃO POR RAIO
   ========================================================================== */

/* Badges de Validação de WhatsApp */
.badge-wa {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  text-decoration: none;
  cursor: default;
  transition: var(--transition);
}
.badge-wa-active {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.35);
}
.badge-wa-inactive {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.badge-wa-unverified {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.25);
  cursor: pointer;
}
.badge-wa-unverified:hover {
  background: rgba(212, 175, 55, 0.18);
  color: var(--gold-primary);
  border-color: var(--gold-primary);
}

/* WhatsApp Baileys Settings Card */
.whatsapp-connect-box {
  background: var(--bg-card-glass);
  border: 1px solid var(--border-gold, rgba(212, 175, 55, 0.25));
  border-radius: 10px;
  padding: 1.5rem;
  margin-top: 1.5rem;
}
.whatsapp-qr-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  border: 1px dashed var(--border-color);
  max-width: 320px;
  margin: 1rem auto;
  text-align: center;
}
.whatsapp-qr-wrapper img {
  border-radius: 8px;
  background: #ffffff;
  padding: 10px;
  width: 220px;
  height: 220px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}

/* Modal de Abordagem: Alternância de Modo (Texto vs Áudio) */
.outreach-mode-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 1rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}
.outreach-mode-btn {
  flex: 1;
  padding: 9px 12px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.outreach-mode-btn.active {
  background: var(--gold-primary);
  color: #08090B;
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
}

/* Teleprompter Box */
.teleprompter-card {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.teleprompter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 0.5rem;
}
.teleprompter-timer {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.15rem;
  font-weight: 700;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 6px;
}
.teleprompter-text {
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--text-primary);
  white-space: pre-wrap;
  max-height: 240px;
  overflow-y: auto;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}
.cue-voice {
  display: inline-block;
  background: rgba(212, 175, 55, 0.22);
  color: var(--gold-primary);
  border: 1px solid rgba(212, 175, 55, 0.45);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.76rem;
  font-weight: 700;
  margin: 0 3px;
  vertical-align: middle;
}
.cue-pause {
  display: inline-block;
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.76rem;
  font-weight: 700;
  margin: 0 3px;
  vertical-align: middle;
}
.audio-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1rem;
}
.btn-record-voice {
  background: #ef4444;
  color: #ffffff;
  border: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.55rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}
.btn-record-voice.recording {
  animation: pulseRecording 1s infinite alternate;
}
@keyframes pulseRecording {
  from { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  to { transform: scale(1.04); box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}

/* Geo Radius & Múltiplas Cidades */
.radius-settings-box {
  background: rgba(212, 175, 55, 0.05);
  border: 1px solid var(--border-gold, rgba(212, 175, 55, 0.25));
  border-radius: 8px;
  padding: 0.9rem;
  margin-top: 0.6rem;
}
.radius-slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}
.nearby-cities-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 0.6rem;
  max-height: 140px;
  overflow-y: auto;
  padding: 4px;
  background: rgba(0,0,0,0.15);
  border-radius: 6px;
}
.city-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  padding: 4px 9px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
}
.city-pill:hover {
  border-color: var(--gold-primary);
}
.city-pill.checked {
  background: rgba(212, 175, 55, 0.2);
  border-color: var(--gold-primary);
  color: var(--gold-primary);
  font-weight: 600;
}

/* Batch Queue Progress Card */
.batch-queue-card {
  background: linear-gradient(135deg, rgba(19, 22, 29, 0.95), rgba(30, 27, 20, 0.95));
  border: 1px solid var(--gold-primary);
  border-radius: 10px;
  padding: 1.1rem 1.35rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* Responsividade Básica */
@media (max-width: 1024px) {
  .sidebar { width: 80px; padding: 1rem 0.5rem; }
  .brand-info, .nav-item span:not(.icon), .sidebar-footer { display: none; }
  .nav-item { justify-content: center; }
  .main-content { margin-left: 80px; padding: 1.5rem; }
  .kanban-board { grid-template-columns: repeat(5, 260px); }
  .detail-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   SISTEMA DE GESTÃO DE TEMPLATES DE WHATSAPP (CARDS, MODAL & PREVIEW)
   ========================================================================== */

/* Banner de Cabeçalho Destacado e Separado para Templates */
.templates-header-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
  padding: 1.45rem 1.85rem;
  margin-bottom: 1.35rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.12) 0%, var(--bg-card) 65%);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-left: 4px solid var(--gold-primary, #d4af37);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  transition: var(--transition);
}

.templates-header-info {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  flex: 1;
  min-width: 280px;
}

.templates-header-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(212, 175, 55, 0.18);
  border: 1px solid rgba(212, 175, 55, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(212, 175, 55, 0.15);
}

.templates-header-text {
  flex: 1;
}

.templates-header-title {
  font-size: 1.32rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.templates-header-subtitle {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-top: 0.35rem;
  margin-bottom: 0;
  line-height: 1.45;
}

.templates-header-action {
  display: flex;
  align-items: center;
}

/* Barra de Filtros e Busca de Templates */
.templates-filter-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.95rem 1.35rem;
  margin-bottom: 1.5rem;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.templates-search-wrapper {
  position: relative;
  flex: 1;
  min-width: 280px;
  display: flex;
  align-items: center;
}

.templates-search-icon {
  position: absolute;
  left: 0.95rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  pointer-events: none;
}

.templates-search-wrapper input {
  padding-left: 2.45rem;
  height: 42px;
  font-size: 0.88rem;
  border-radius: 8px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 100%;
  transition: var(--transition);
}

.templates-search-wrapper input:focus {
  border-color: var(--gold-primary, #d4af37);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
  outline: none;
}

.templates-filter-controls {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.templates-filter-group {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.templates-filter-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.templates-filter-group select {
  height: 42px;
  min-width: 210px;
  padding: 0 0.85rem;
  border-radius: 8px;
  font-size: 0.86rem;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}

.templates-filter-group select:focus {
  border-color: var(--gold-primary, #d4af37);
}

.badge-templates-counter {
  background: rgba(212, 175, 55, 0.12);
  color: var(--gold-primary, #d4af37);
  border: 1px solid var(--border-gold);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  white-space: nowrap;
}

/* Modo Claro: Alto Contraste e Refinamento Visual */
html.light .templates-header-banner {
  background: linear-gradient(135deg, #FFF9EB 0%, #FFFFFF 70%);
  border: 1px solid rgba(184, 134, 11, 0.35);
  border-left: 4px solid #B8860B;
  box-shadow: 0 4px 18px rgba(184, 134, 11, 0.08);
}

html.light .templates-header-icon {
  background: rgba(184, 134, 11, 0.12);
  border-color: rgba(184, 134, 11, 0.28);
}

html.light .templates-header-title {
  color: #0A0D12;
}

html.light .templates-header-subtitle {
  color: #475062;
}

html.light .templates-filter-toolbar {
  background: #FFFFFF;
  border: 1px solid rgba(184, 134, 11, 0.22);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

html.light .templates-search-wrapper input {
  background: #F8F9FB;
  border-color: rgba(184, 134, 11, 0.25);
  color: #0A0D12;
}

html.light .templates-search-wrapper input:focus {
  background: #FFFFFF;
  border-color: #B8860B;
}

html.light .templates-filter-group label {
  color: #475062;
}

html.light .templates-filter-group select {
  background: #F8F9FB;
  border-color: rgba(184, 134, 11, 0.25);
  color: #0A0D12;
}

html.light .templates-filter-group select:focus {
  background: #FFFFFF;
  border-color: #B8860B;
}

html.light .badge-templates-counter {
  background: #FFF9EB;
  color: #7A5703;
  border: 1px solid rgba(184, 134, 11, 0.35);
}

.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.35rem;
  margin-top: 0.25rem;
}

.template-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition);
  position: relative;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.template-card:hover {
  border-color: var(--border-gold);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35);
}

.template-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.template-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.35;
}

.template-category-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  font-weight: 600;
  white-space: nowrap;
}

.category-venda_sites { background: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.3); }
.category-infoprodutos_biblicos { background: rgba(168, 85, 247, 0.15); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.3); }
.category-infoprodutos_saude { background: rgba(34, 197, 94, 0.15); color: #4ade80; border: 1px solid rgba(34, 197, 94, 0.3); }
.category-infoprodutos_educacao { background: rgba(234, 179, 8, 0.15); color: #facc15; border: 1px solid rgba(234, 179, 8, 0.3); }
.category-parcerias_b2b { background: rgba(249, 115, 22, 0.15); color: #fb923c; border: 1px solid rgba(249, 115, 22, 0.3); }
.category-geral, .category-custom { background: rgba(212, 175, 55, 0.15); color: var(--gold-primary); border: 1px solid var(--border-gold); }

.template-content-box {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 0.85rem 1rem;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text-secondary);
  white-space: pre-wrap;
  max-height: 160px;
  overflow-y: auto;
  font-family: inherit;
  margin-bottom: 1rem;
  flex: 1;
}

.light-theme .template-content-box {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
}

.template-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-color);
  gap: 0.5rem;
  flex-wrap: wrap;
}

.template-actions-group {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.btn-template-action {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
}

.btn-template-action:hover {
  background: rgba(212, 175, 55, 0.15);
  border-color: var(--gold-primary);
  color: var(--gold-primary);
}

.btn-template-action.btn-action-delete:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #ef4444;
}

/* Chips de Variáveis Dinâmicas */
.btn-variable-chip {
  background: rgba(212, 175, 55, 0.08);
  border: 1px solid var(--border-gold);
  color: var(--gold-primary);
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  transition: var(--transition);
  user-select: none;
}

.btn-variable-chip:hover {
  background: var(--gold-primary);
  color: #000000;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
}

/* Balão de Pré-visualização WhatsApp */
.whatsapp-bubble-preview {
  background: #005c4b;
  border-radius: 8px 8px 2px 8px;
  padding: 0.85rem 1rem;
  color: #e9edef;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  position: relative;
  min-height: 180px;
  max-height: 250px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.light-theme .whatsapp-bubble-preview {
  background: #d9fdd3;
  color: #111b21;
}

.whatsapp-bubble-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.light-theme .whatsapp-bubble-header {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.whatsapp-bubble-text {
  font-size: 0.88rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ==========================================================================
   RESPONSIVIDADE DAS SEÇÕES E TEMPLATES EM TODAS AS TELAS
   ========================================================================== */

/* Telas Médias e Tablets (<= 1024px) */
@media (max-width: 1024px) {
  .templates-header-banner {
    padding: 1.35rem 1.5rem;
    gap: 1rem;
  }
  .templates-header-title {
    font-size: 1.2rem;
  }
  .templates-filter-toolbar {
    padding: 0.9rem 1.15rem;
  }
  .templates-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.15rem;
  }
}

/* Telas Menores e Celulares (<= 768px) */
@media (max-width: 768px) {
  .templates-header-banner {
    flex-direction: column;
    align-items: stretch;
    padding: 1.25rem 1.2rem;
    gap: 1.1rem;
    margin-bottom: 1.1rem;
  }

  .templates-header-info {
    align-items: flex-start;
    gap: 0.85rem;
    min-width: 0;
  }

  .templates-header-icon {
    width: 42px;
    height: 42px;
    font-size: 1.3rem;
  }

  .templates-header-title {
    font-size: 1.15rem;
  }

  .templates-header-subtitle {
    font-size: 0.82rem;
  }

  .templates-header-action {
    width: 100%;
  }

  .templates-header-action .btn {
    width: 100%;
    justify-content: center;
    padding: 0.75rem 1rem;
  }

  .templates-filter-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
    padding: 1rem;
    margin-bottom: 1.25rem;
  }

  .templates-search-wrapper {
    min-width: 0;
    width: 100%;
  }

  .templates-filter-controls {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 0.75rem;
  }

  .templates-filter-group {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    gap: 0.35rem;
  }

  .templates-filter-group select {
    width: 100%;
    min-width: 0;
  }

  .badge-templates-counter {
    align-self: flex-start;
  }

  .templates-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .template-card {
    padding: 1.1rem;
  }
}

/* Telas Ultra-Pequenas (<= 480px) */
@media (max-width: 480px) {
  .templates-header-banner {
    padding: 1.1rem 1rem;
    border-radius: 10px;
  }

  .templates-header-info {
    flex-direction: column;
    gap: 0.65rem;
  }

  .templates-header-title {
    font-size: 1.05rem;
  }

  .template-card-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .template-actions-group {
    justify-content: space-between;
    width: 100%;
  }

  .btn-template-action {
    flex: 1;
    justify-content: center;
    font-size: 0.75rem;
    padding: 0.4rem 0.3rem;
  }
}
