/**
 * PLANIT Publisher PRO v5.0.1 Beta — Estilos Módulos V5
 * CRM, WhatsApp Bot, Messenger Bot, Grupos Facebook
 * Tema: Dark #121214 / Acento Dorado #FFCC29
 */

/* ═══════════════════════════════════════════════════════════════════════════
   SECCIONES V5 (Paneles)
   ═══════════════════════════════════════════════════════════════════════════ */
.section-v5 {
  display: none;
  flex: 1;
  flex-direction: column;
  gap: 20px;
  padding: 20px 24px 60px 24px;
  animation: fadeInSection 0.25s ease;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  box-sizing: border-box;
}
.section-v5.active { display: flex; }

.section-v5::-webkit-scrollbar { width: 6px; }
.section-v5::-webkit-scrollbar-track { background: transparent; }
.section-v5::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 3px; }
.section-v5::-webkit-scrollbar-thumb:hover { background: #FFCC29; }

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

/* ═══════════════════════════════════════════════════════════════════════════
   BENTO GRID — Métricas CRM
   ═══════════════════════════════════════════════════════════════════════════ */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  flex-shrink: 0;
}
@media (max-width: 1200px) { .bento-grid { grid-template-columns: repeat(3, 1fr); } }

.bento-card {
  background: #181922;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.2s, box-shadow 0.2s;
  cursor: default;
  position: relative;
  overflow: hidden;
}
.bento-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: 14px 14px 0 0;
}
.bento-card:hover {
  border-color: rgba(255,204,41,0.3);
  box-shadow: 0 0 20px rgba(255,204,41,0.08);
}
.bento-card.bento-pipeline::before { background: #FFCC29; }
.bento-card.bento-hot::before      { background: #EF4444; }
.bento-card.bento-cooling::before  { background: #F59E0B; }
.bento-card.bento-won::before      { background: #10B981; }
.bento-card.bento-archive::before  { background: #6B7280; }

.bento-label {
  font-size: 11px;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.bento-value {
  font-size: 26px;
  font-weight: 700;
  color: #FFFFFF;
  line-height: 1.1;
}
.bento-sub {
  font-size: 11px;
  color: #9CA3AF;
}
.bento-icon {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 22px;
  opacity: 0.5;
}

/* ═══════════════════════════════════════════════════════════════════════════
   KANBAN PIPELINE CRM
   ═══════════════════════════════════════════════════════════════════════════ */
.kanban-filterbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.kanban-filterbar input,
.kanban-filterbar select {
  background: #1f202c;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: #fff;
  padding: 7px 12px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
.kanban-filterbar input:focus,
.kanban-filterbar select:focus { border-color: #FFCC29; }
.kanban-filterbar input { flex: 1; min-width: 180px; }

.kanban-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
  min-height: 420px;
}
.kanban-board::-webkit-scrollbar { height: 6px; }
.kanban-board::-webkit-scrollbar-track { background: #13141a; border-radius: 4px; }
.kanban-board::-webkit-scrollbar-thumb { background: #2d2e3a; border-radius: 4px; }

.kanban-col {
  min-width: 220px;
  max-width: 250px;
  background: #181922;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: border-color 0.2s;
}
.kanban-col.drag-over { border-color: #FFCC29; background: #1f202c; }

.kanban-col-header {
  position: relative;
  padding: 10px 12px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kanban-col-header-main {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}
.kanban-col-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.kanban-col-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #E5E7EB;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.kanban-stage-info-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  font-size: 10px;
  cursor: pointer;
  padding: 1px 4px;
  line-height: 1.2;
  transition: all 0.15s ease;
  color: #9CA3AF;
  flex-shrink: 0;
}
.kanban-stage-info-btn:hover {
  background: #FFCC29;
  border-color: #FFCC29;
  color: #121214;
}
.kanban-stage-popover {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 6px;
  background: #1e202d;
  border: 1px solid #FFCC29;
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  z-index: 100;
}
.kanban-col-header:hover .kanban-stage-popover,
.kanban-stage-popover.is-pinned {
  display: block;
}
.popover-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 6px;
}
.popover-text {
  font-size: 11px;
  line-height: 1.45;
  color: #E5E7EB;
  margin: 0;
}
.popover-hint {
  font-size: 9px;
  color: #9CA3AF;
  margin-top: 6px;
  font-style: italic;
  border-top: 1px solid rgba(255,255,255,0.06);
  padding-top: 4px;
}
.kanban-col-count {
  font-size: 11px;
  color: #6B7280;
  font-weight: 600;
}

.kanban-cards {
  flex: 1;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow-y: auto;
  min-height: 60px;
}
.kanban-cards::-webkit-scrollbar { width: 4px; }
.kanban-cards::-webkit-scrollbar-thumb { background: #2d2e3a; border-radius: 2px; }

.kanban-card {
  background: #1f202c;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 9px;
  padding: 10px 11px;
  cursor: grab;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.1s;
  position: relative;
}
.kanban-card:hover {
  border-color: rgba(255,204,41,0.35);
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}
.kanban-card.dragging {
  opacity: 0.5;
  transform: scale(0.97);
  cursor: grabbing;
}

.kanban-card-name {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kanban-card-service {
  font-size: 10px;
  color: #9CA3AF;
  margin-bottom: 6px;
}
.kanban-card-footer {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.origin-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.origin-badge-wa       { background: rgba(16,185,129,0.15); color: #10B981; border: 1px solid rgba(16,185,129,0.3); }
.origin-badge-messenger{ background: rgba(59,130,246,0.15); color: #3B82F6; border: 1px solid rgba(59,130,246,0.3); }
.origin-badge-web      { background: rgba(107,114,128,0.15); color: #9CA3AF; border: 1px solid rgba(107,114,128,0.3); }

.sla-badge {
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
}
.sla-hot   { background: rgba(239,68,68,0.15); color: #EF4444; }
.sla-warm  { background: rgba(245,158,11,0.15); color: #F59E0B; }
.sla-cold  { background: rgba(107,114,128,0.15); color: #9CA3AF; }

.kanban-card-actions {
  display: none;
  position: absolute;
  top: 6px; right: 6px;
  gap: 4px;
}
.kanban-card:hover .kanban-card-actions { display: flex; }
.kanban-card-btn {
  background: #2d2e3a;
  border: none;
  color: #9CA3AF;
  width: 22px; height: 22px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.kanban-card-btn:hover { background: #FFCC29; color: #121214; }

/* Stage colors */
.stage-nuevo      .kanban-col-dot { background: #9CA3AF; }
/* 9 Fases Oficiales CRM V6 */
.stage-lead_nuevo        .kanban-col-dot { background: #9CA3AF; }
.stage-lead_calificado   .kanban-col-dot { background: #3B82F6; }
.stage-diagnostico       .kanban-col-dot { background: #8B5CF6; }
.stage-cita_agendada     .kanban-col-dot { background: #F59E0B; }
.stage-oferta_comercial  .kanban-col-dot { background: #FFCC29; }
.stage-negociacion       .kanban-col-dot { background: #F97316; }
.stage-venta_concretada  .kanban-col-dot { background: #10B981; }
.stage-cliente_postventa .kanban-col-dot { background: #06B6D4; }
.stage-descartado        .kanban-col-dot { background: #64748B; }

/* Retrocompatibilidad visual */
.stage-nuevo       .kanban-col-dot { background: #9CA3AF; }
.stage-contactado  .kanban-col-dot { background: #3B82F6; }
.stage-agendado    .kanban-col-dot { background: #F59E0B; }
.stage-cotizado    .kanban-col-dot { background: #FFCC29; }
.stage-seguimiento .kanban-col-dot { background: #F97316; }
.stage-ganado      .kanban-col-dot { background: #10B981; }
.stage-archivado   .kanban-col-dot { background: #64748B; }

/* ═══════════════════════════════════════════════════════════════════════════
   BOTÓN NUEVO LEAD / ACCIÓN PRINCIPAL
   ═══════════════════════════════════════════════════════════════════════════ */
.btn-v5-primary {
  background: #FFCC29;
  color: #121214;
  border: none;
  border-radius: 9px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
}
.btn-v5-primary:hover {
  background: #F59E0B;
  box-shadow: 0 4px 14px rgba(255,204,41,0.35);
  transform: translateY(-1px);
}
.btn-v5-primary:active { transform: translateY(0); }

.btn-v5-secondary {
  background: #1f202c;
  color: #9CA3AF;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 9px;
  padding: 8px 15px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: border-color 0.2s, color 0.2s;
}
.btn-v5-secondary:hover { border-color: rgba(255,204,41,0.5); color: #FFCC29; }

.btn-v5-danger {
  background: rgba(239,68,68,0.1);
  color: #EF4444;
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 7px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-v5-danger:hover { background: rgba(239,68,68,0.2); }

/* ═══════════════════════════════════════════════════════════════════════════
   TOGGLE SWITCHES (módulos ON/OFF)
   ═══════════════════════════════════════════════════════════════════════════ */
.module-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #181922;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 14px 18px;
  gap: 12px;
  flex-shrink: 0;
}
.module-toggle-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.module-toggle-icon { font-size: 20px; }
.module-toggle-label { font-size: 14px; font-weight: 600; color: #fff; }
.module-toggle-sub   { font-size: 11px; color: #6B7280; margin-top: 1px; }
.module-status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 5px;
  background: #EF4444;
  transition: background 0.3s;
}
.module-status-dot.active { background: #10B981; }

/* Toggle Switch */
.toggle-switch {
  position: relative;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: #2d2e3a;
  border-radius: 26px;
  cursor: pointer;
  transition: background 0.3s;
}
.toggle-slider::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #6B7280;
  transition: transform 0.3s, background 0.3s;
}
.toggle-switch input:checked + .toggle-slider { background: rgba(16,185,129,0.25); }
.toggle-switch input:checked + .toggle-slider::after {
  transform: translateX(22px);
  background: #10B981;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SECCIÓN MÓDULO — Contenedor de sub-sección
   ═══════════════════════════════════════════════════════════════════════════ */
.v5-panel-card {
  background: #181922;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  flex-shrink: 0;
}
.v5-panel-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: #13141a;
}
.v5-panel-card-title {
  font-size: 13px;
  font-weight: 700;
  color: #9CA3AF;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.v5-panel-card-body { padding: 16px 18px; }

/* ═══════════════════════════════════════════════════════════════════════════
   TABLAS COMPACTAS (Reglas, Grupos, Triggers, Mensajes)
   ═══════════════════════════════════════════════════════════════════════════ */
.v5-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.v5-table th {
  color: #6B7280;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  text-align: left;
  font-size: 11px;
}
.v5-table td {
  padding: 9px 10px;
  color: #9CA3AF;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}
.v5-table tr:last-child td { border-bottom: none; }
.v5-table tr:hover td { background: rgba(255,255,255,0.02); }
.v5-table td.td-name { color: #fff; font-weight: 600; }

.td-actions { display: flex; gap: 5px; align-items: center; }
.btn-tbl-action {
  background: #1f202c;
  border: 1px solid rgba(255,255,255,0.08);
  color: #9CA3AF;
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 11px;
  transition: border-color 0.15s, color 0.15s;
}
.btn-tbl-action:hover { border-color: #FFCC29; color: #FFCC29; }
.btn-tbl-action.danger:hover { border-color: #EF4444; color: #EF4444; }

/* Badge activo/inactivo */
.badge-active   { background: rgba(16,185,129,0.15); color: #10B981; border: 1px solid rgba(16,185,129,0.25); padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 700; }
.badge-inactive { background: rgba(107,114,128,0.12); color: #6B7280; border: 1px solid rgba(107,114,128,0.2); padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 700; }

/* ═══════════════════════════════════════════════════════════════════════════
   FORMULARIOS INLINE V5
   ═══════════════════════════════════════════════════════════════════════════ */
.v5-form-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.v5-form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.v5-form-group label {
  font-size: 11px;
  color: #6B7280;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.v5-input {
  background: #1f202c;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: #fff;
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
  user-select: text;
}
.v5-input:focus  { border-color: #FFCC29; }
.v5-input.w-full { width: 100%; }
.v5-input.w-sm   { width: 100px; }
.v5-input.w-md   { width: 160px; }
.v5-select {
  background: #1f202c;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: #fff;
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
  cursor: pointer;
}
.v5-select:focus { border-color: #FFCC29; }
.v5-textarea {
  background: #1f202c;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: #fff;
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  resize: vertical;
  min-height: 70px;
  width: 100%;
  transition: border-color 0.2s;
  user-select: text;
}
.v5-textarea:focus { border-color: #FFCC29; }

/* ═══════════════════════════════════════════════════════════════════════════
   TRIGGER EDITOR ROW
   ═══════════════════════════════════════════════════════════════════════════ */
.trigger-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1f202c;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  padding: 10px 14px;
  flex-wrap: wrap;
}
.trigger-row-label {
  font-size: 12px;
  font-weight: 600;
  color: #9CA3AF;
  min-width: 100px;
}
.trigger-row-actions { display: flex; gap: 6px; align-items: center; margin-left: auto; }

/* ═══════════════════════════════════════════════════════════════════════════
   GRUPOS FACEBOOK — Panel status indicator y Gran Cronómetro Regresivo
   ═══════════════════════════════════════════════════════════════════════════ */
.groups-countdown-hero {
  background: linear-gradient(135deg, #181924 0%, #11121a 100%);
  border: 1px solid rgba(255, 204, 41, 0.25);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  position: relative;
  overflow: hidden;
}

.groups-countdown-hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, #FFCC29, #F59E0B, #10B981, #FFCC29);
  background-size: 300% 100%;
  animation: countdownGradient 4s ease infinite;
}

@keyframes countdownGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.countdown-next-label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #FFCC29;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.countdown-digits-wrapper {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 8px 0;
}

.countdown-digit-block {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.countdown-big-number {
  font-size: 54px;
  font-weight: 900;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, monospace;
  color: #FFFFFF;
  line-height: 1;
  text-shadow: 0 0 20px rgba(255, 204, 41, 0.4);
  background: #242636;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  min-width: 80px;
}

.countdown-unit-label {
  font-size: 11px;
  font-weight: 600;
  color: #9CA3AF;
  text-transform: uppercase;
  margin-top: 4px;
  letter-spacing: 1px;
}

.countdown-separator {
  font-size: 40px;
  font-weight: 900;
  color: #FFCC29;
  line-height: 1;
}

.countdown-group-target {
  font-size: 14px;
  color: #E5E7EB;
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.05);
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.groups-cycle-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1f202c;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  padding: 12px 16px;
}
.cycle-pulse {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #EF4444;
  flex-shrink: 0;
}
.cycle-pulse.running {
  background: #10B981;
  animation: pulseCycle 1.5s ease-in-out infinite;
}
@keyframes pulseCycle {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.8); }
}
.cycle-status-text { font-size: 13px; color: #9CA3AF; }
.cycle-counter     { font-size: 12px; color: #6B7280; margin-left: auto; }

/* ═══════════════════════════════════════════════════════════════════════════
   MODAL V5: Lead Detail
   ═══════════════════════════════════════════════════════════════════════════ */
.modal-overlay-v5 {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  backdrop-filter: blur(4px);
}
.modal-overlay-v5.open { display: flex; }

.modal-dialog-v5 {
  background: #181922;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 18px;
  width: 90%;
  max-width: 640px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  animation: modalSlideIn 0.25s ease;
}
.modal-dialog-v5.modal-lg { max-width: 820px; }

@keyframes modalSlideIn {
  from { opacity: 0; transform: scale(0.95) translateY(-10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header-v5 {
  padding: 18px 22px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title-v5 { font-size: 16px; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 8px; }
.modal-close-v5 {
  background: rgba(255,255,255,0.05);
  border: none;
  color: #9CA3AF;
  width: 30px; height: 30px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.modal-close-v5:hover { background: rgba(239,68,68,0.15); color: #EF4444; }
.modal-body-v5 {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal-footer-v5 {
  padding: 14px 22px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Timeline historial */
.lead-timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  position: relative;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 28px;
  bottom: -8px;
  width: 1px;
  background: rgba(255,255,255,0.08);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #FFCC29;
  flex-shrink: 0;
  margin-top: 5px;
  margin-left: 11px;
}
.timeline-content { flex: 1; }
.timeline-type {
  font-size: 11px;
  font-weight: 700;
  color: #FFCC29;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.timeline-note { font-size: 12px; color: #9CA3AF; margin-top: 2px; }
.timeline-date { font-size: 10px; color: #6B7280; margin-top: 2px; }

/* Trigger templates buttons */
.trigger-template-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.trigger-template-btn {
  background: #1f202c;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s;
}
.trigger-template-btn:hover { border-color: rgba(255,204,41,0.5); }
.trigger-template-day { font-size: 10px; color: #FFCC29; font-weight: 700; text-transform: uppercase; }
.trigger-template-title { font-size: 12px; color: #fff; font-weight: 600; margin-top: 3px; }
.trigger-template-preview { font-size: 11px; color: #6B7280; margin-top: 4px; line-height: 1.4; }

/* ═══════════════════════════════════════════════════════════════════════════
   NAVBAR V5 SEPARADOR
   ═══════════════════════════════════════════════════════════════════════════ */
.sidebar-nav-divider {
  height: 1px;
  background: rgba(255,255,255,0.07);
  margin: 8px 12px;
}
.sidebar-nav-label {
  font-size: 9px;
  font-weight: 700;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 2px 14px 4px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════════════════════ */
.v5-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  gap: 10px;
  color: #6B7280;
}
.v5-empty-state-icon { font-size: 36px; opacity: 0.5; }
.v5-empty-state-text { font-size: 13px; text-align: center; }

/* ═══════════════════════════════════════════════════════════════════════════
   SETTINGS ROW
   ═══════════════════════════════════════════════════════════════════════════ */
.v5-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
@media (max-width: 900px) { .v5-settings-grid { grid-template-columns: 1fr; } }

.v5-settings-label {
  font-size: 11px;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-bottom: 5px;
}

/* Badge de simulación */
.simulate-result {
  display: none;
  background: #1f202c;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 10px;
  font-size: 12px;
}
.simulate-result.show { display: block; }
.simulate-result.matched { border-color: rgba(16,185,129,0.4); }
.simulate-result.no-match { border-color: rgba(239,68,68,0.3); color: #EF4444; }

/* Interval slider */
.interval-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
input[type="range"].v5-range {
  flex: 1;
  -webkit-appearance: none;
  height: 4px;
  background: #2d2e3a;
  border-radius: 4px;
  outline: none;
}
input[type="range"].v5-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #FFCC29;
  cursor: pointer;
  transition: transform 0.15s;
}
input[type="range"].v5-range::-webkit-slider-thumb:hover { transform: scale(1.2); }
.range-value-badge {
  background: #1f202c;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 7px;
  padding: 4px 10px;
  font-size: 13px;
  color: #FFCC29;
  font-weight: 700;
  min-width: 60px;
  text-align: center;
}

/* ══════════════════════════════════════════════════════════════════════
   HISTORIAL DE CONVERSACIONES MESSENGER & CHAT VIEWER
   ══════════════════════════════════════════════════════════════════════ */
.conv-item {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.conv-item:hover {
  background: rgba(255,204,41,0.06);
  border-color: rgba(255,204,41,0.2);
}
.conv-item.active {
  background: rgba(255,204,41,0.12);
  border-color: #FFCC29;
}
.conv-item-name {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-item-meta {
  font-size: 10px;
  color: #6B7280;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.conv-badge {
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 6px;
  font-weight: 700;
  text-transform: uppercase;
}
.conv-badge.ACTIVO { background: rgba(16,185,129,0.15); color: #10B981; }
.conv-badge.IGNORADO { background: rgba(239,68,68,0.15); color: #EF4444; }
.conv-badge.INCORPORADO { background: rgba(59,130,246,0.15); color: #3B82F6; }

/* Burbujas de Chat */
.chat-bubble {
  max-width: 78%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.4;
  word-break: break-word;
}
.chat-bubble.incoming {
  align-self: flex-start;
  background: #242636;
  color: #E5E7EB;
  border-bottom-left-radius: 2px;
  border: 1px solid rgba(255,255,255,0.05);
}
.chat-bubble.outgoing {
  align-self: flex-end;
  background: #FFCC29;
  color: #12131a;
  font-weight: 500;
  border-bottom-right-radius: 2px;
}
.chat-bubble-time {
  font-size: 9px;
  margin-top: 3px;
  opacity: 0.7;
  text-align: right;
}
