﻿/* ============================================================
   CAPTBROKE â€” styles.css
   Sistema de estilos unificado: landing + auth + dashboard
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&family=DM+Mono:wght@400;500&display=swap');

/* ============================================================
   VARIABLES GLOBALES
   ============================================================ */
:root {
  --font-main: 'DM Sans', Arial, sans-serif;
  --font-mono: 'DM Mono', monospace;

  /* Paleta base oscura */
  --bg-page:       #0f172a;
  --bg-surface:    #1e293b;
  --bg-surface2:   #162032;
  --bg-surface3:   #243044;
  --bg-sidebar:    #080e1a;

  /* Texto */
  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;
  --text-inverse:   #0f172a;

  /* Bordes */
  --border:         #1e293b;
  --border-strong:  #334155;
  --border-sidebar: rgba(255,255,255,0.06);

  /* Acento principal */
  --accent:         #2563eb;
  --accent-hover:   #1d4ed8;
  --accent-light:   rgba(37,99,235,0.15);

  /* Estados captaciÃ³n */
  --color-captacion:  #378ADD;
  --color-gestion:    #EF9F27;
  --color-captada:    #4ade80;
  --color-desechada:  #f87171;

  --bg-captacion:  rgba(55,138,221,0.12);
  --bg-gestion:    rgba(239,159,39,0.12);
  --bg-captada:    rgba(74,222,128,0.12);
  --bg-desechada:  rgba(248,113,113,0.12);

  /* Layout dashboard */
  --sidebar-w:   200px;
  --topbar-h:    60px;
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;
  --radius-xl:   18px;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
}

/* ============================================================
   RESET
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: var(--font-main);
  font-size: 14px;
  background: var(--bg-page);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: var(--font-main); }
input, select, textarea { font-family: var(--font-main); }

/* ============================================================
   LANDING â€” LAYOUT GENERAL
   ============================================================ */
.container {
  width: 90%;
  max-width: 1100px;
  margin: auto;
}

.header {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

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

.logo {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.3px;
}

/* ============================================================
   LANDING â€” HERO
   ============================================================ */
.hero {
  padding: 80px 0;
  text-align: center;
}

.hero h2 {
  font-size: 36px;
  font-weight: 300;
  margin-bottom: 20px;
  letter-spacing: -0.5px;
}

.hero p {
  color: var(--text-secondary);
  margin-bottom: 30px;
}

.cta-buttons a {
  margin: 10px;
}

/* ============================================================
   LANDING â€” BOTONES GLOBALES
   ============================================================ */
.btn-primary {
  background: var(--accent);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s;
}

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

.btn-secondary {
  border: 1px solid var(--accent);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
  transition: background 0.15s;
}

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

.btn-outline {
  border: 1px solid var(--border-strong);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 13px;
  transition: border-color 0.15s, color 0.15s;
}

.btn-outline:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

/* ============================================================
   LANDING â€” FEATURES
   ============================================================ */
.features {
  padding: 60px 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.card {
  background: var(--bg-surface);
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.workflow {
  padding: 60px 0;
  text-align: center;
}

.steps { margin-top: 20px; }

.step {
  margin: 10px 0;
  color: var(--text-secondary);
}

/* ============================================================
   LANDING â€” FOOTER
   ============================================================ */
.footer {
  padding: 20px;
  text-align: center;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
}

/* ============================================================
   AUTH â€” LAYOUT
   ============================================================ */
.auth-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background: var(--bg-page);
}

.auth-card {
  background: var(--bg-surface);
  padding: 40px;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 420px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  border: 1px solid var(--border-strong);
}

.auth-card h2 {
  margin-bottom: 10px;
  font-weight: 500;
}

.subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 25px;
}

/* ============================================================
   AUTH â€” INPUTS
   ============================================================ */
.input-group {
  margin-bottom: 18px;
}

.input-group label {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
  color: #cbd5e1;
}

.input-group input {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-page);
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color 0.15s;
}

.input-group input:focus {
  outline: none;
  border-color: var(--accent);
}

.full { width: 100%; margin-top: 10px; }

.mensaje {
  margin-top: 15px;
  font-size: 14px;
  color: #38bdf8;
}

.auth-footer {
  margin-top: 20px;
  font-size: 13px;
  text-align: center;
  color: var(--text-secondary);
}

.auth-footer a {
  color: var(--accent);
}

.auth-footer a:hover { text-decoration: underline; }

/* ============================================================
   DASHBOARD â€” APP SHELL
   ============================================================ */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-page);
}

/* ============================================================
   DASHBOARD â€” SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--border-sidebar);
  z-index: 10;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border-sidebar);
  flex-shrink: 0;
}

.logo-mark {
  width: 30px;
  height: 30px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 500;
  color: #fff;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.logo-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.logo-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.logo-agency {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-group-label {
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 8px 4px;
  display: block;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}

.nav-item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
}

.nav-item.active {
  background: var(--accent-light);
  color: #7BBCF5;
}

.nav-badge {
  margin-left: auto;
  font-size: 10px;
  background: var(--color-desechada);
  color: var(--bg-page);
  padding: 1px 6px;
  border-radius: 20px;
  font-family: var(--font-mono);
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border-sidebar);
  flex-shrink: 0;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-light);
  color: #7BBCF5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 500;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: capitalize;
}

.logout-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  transition: color 0.15s;
  flex-shrink: 0;
}

.logout-btn svg { width: 13px; height: 13px; }
.logout-btn:hover { color: var(--text-primary); }

/* ============================================================
   DASHBOARD â€” MAIN + TOPBAR
   ============================================================ */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.page-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
}

.page-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ============================================================
   DASHBOARD â€” PERIOD SELECTOR
   ============================================================ */
.period-selector {
  display: flex;
  background: var(--bg-surface2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}

.period-btn {
  padding: 4px 12px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12px;
  background: none;
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s;
}

.period-btn.active {
  background: var(--bg-surface3);
  color: var(--text-primary);
}

/* ============================================================
   DASHBOARD â€” ALERTA DUPLICADOS
   ============================================================ */
.alert-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: var(--bg-gestion);
  border: 1px solid var(--color-gestion);
  border-radius: var(--radius-md);
  font-size: 11px;
  color: var(--color-gestion);
  cursor: pointer;
}

.alert-chip svg { width: 12px; height: 12px; stroke: var(--color-gestion); }

/* ============================================================
   DASHBOARD â€” MÃ‰TRICAS
   ============================================================ */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  padding: 16px 20px 0;
  flex-shrink: 0;
}

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-card);
}

.metric-label {
  font-size: 11px;
  color: var(--text-muted);
}

.metric-value {
  font-size: 26px;
  font-weight: 300;
  color: var(--text-primary);
  font-family: var(--font-mono);
  line-height: 1;
}

.metric-delta {
  font-size: 11px;
  color: var(--text-muted);
}

.metric-delta.up   { color: var(--color-captada); }
.metric-delta.down { color: var(--color-desechada); }

.estado-captacion { color: var(--color-captacion); }
.estado-gestion   { color: var(--color-gestion); }
.estado-captada   { color: var(--color-captada); }
.estado-desechada { color: var(--color-desechada); }

/* ============================================================
   DASHBOARD â€” BODY (mapa + panel)
   ============================================================ */
.dashboard-body {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 14px;
  padding: 14px 20px 20px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ============================================================
   DASHBOARD â€” MAPA
   ============================================================ */
.map-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.map-container {
  flex: 1;
  min-height: 0;
  z-index: 1;
}

.map-legend {
  display: flex;
  gap: 14px;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-secondary);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.map-filters {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.filter-tag {
  padding: 3px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  font-size: 11px;
  background: none;
  color: var(--text-secondary);
  transition: all 0.15s;
}

.filter-tag:hover { background: var(--bg-surface2); }

.filter-tag.active {
  background: var(--text-primary);
  color: var(--text-inverse);
  border-color: var(--text-primary);
}

/* ============================================================
   DASHBOARD â€” CARD HEADER
   ============================================================ */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 8px;
  flex-wrap: wrap;
}

.card-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
}

.card-link {
  font-size: 11px;
  color: var(--accent);
}

.card-link:hover { text-decoration: underline; }

/* ============================================================
   DASHBOARD â€” SIDE PANEL
   ============================================================ */
.side-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  min-height: 0;
}

.panel-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  flex-shrink: 0;
}

/* ============================================================
   DASHBOARD â€” AGENTES
   ============================================================ */
.agents-list { display: flex; flex-direction: column; }

.agent-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

.agent-row:last-child { border-bottom: none; }
.agent-row:hover { background: var(--bg-surface2); }

.agent-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 500;
  flex-shrink: 0;
}

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

.agent-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-zone { font-size: 10px; color: var(--text-muted); }

.agent-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.agent-count {
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.agent-bar-track {
  width: 40px;
  height: 3px;
  background: var(--bg-surface3);
  border-radius: 2px;
  overflow: hidden;
}

.agent-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
}

/* ============================================================
   DASHBOARD â€” ESTADO BARS
   ============================================================ */
.estado-bars {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.estado-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.estado-bar-label {
  font-size: 11px;
  color: var(--text-secondary);
  width: 70px;
  flex-shrink: 0;
}

.estado-bar-track {
  flex: 1;
  height: 6px;
  background: var(--bg-surface3);
  border-radius: 3px;
  overflow: hidden;
}

.estado-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.estado-bar-num {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  width: 20px;
  text-align: right;
}

/* ============================================================
   DASHBOARD â€” ÃšLTIMAS CAPTACIONES
   ============================================================ */
.recent-list { display: flex; flex-direction: column; }

.recent-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}

.recent-item:last-child { border-bottom: none; }
.recent-item:hover { background: var(--bg-surface2); }

.recent-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 3px;
}

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

.recent-nota {
  font-size: 12px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-meta {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ============================================================
   BADGES DE ESTADO (reutilizables en todo el proyecto)
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 500;
}

.badge--captacion { background: var(--bg-captacion); color: var(--color-captacion); }
.badge--gestion   { background: var(--bg-gestion);   color: var(--color-gestion); }
.badge--captada   { background: var(--bg-captada);   color: var(--color-captada); }
.badge--desechada { background: var(--bg-desechada); color: var(--color-desechada); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  padding: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
  overflow: hidden;
}

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

.modal-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  transition: color 0.15s;
}

.modal-close svg { width: 14px; height: 14px; }
.modal-close:hover { color: var(--text-primary); }

.modal-body { padding: 20px; }

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

.modal-field:last-child { margin-bottom: 0; }

.modal-field label {
  font-size: 11px;
  color: var(--text-muted);
}

.modal-field p {
  font-size: 13px;
  color: var(--text-primary);
}

.modal-field select,
.modal-field input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--bg-page);
  color: var(--text-primary);
  transition: border-color 0.15s;
}

.modal-field select:focus,
.modal-field input:focus {
  outline: none;
  border-color: var(--accent);
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* ============================================================
   BOTONES DASHBOARD (complementan btn-primary / btn-secondary)
   ============================================================ */
.btn {
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  border: 1px solid var(--border-strong);
  background: none;
  color: var(--text-primary);
  transition: background 0.15s;
}

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

.btn--primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

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

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-surface3);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  z-index: 200;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  animation: toastIn 0.2s ease;
}

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

/* ============================================================
   LEAFLET OVERRIDES
   ============================================================ */
.leaflet-container {
  background: var(--bg-surface2) !important;
  font-family: var(--font-main) !important;
}

.leaflet-popup-content-wrapper {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4) !important;
  color: var(--text-primary) !important;
}

.leaflet-popup-content {
  margin: 10px 14px !important;
  font-size: 12px !important;
  line-height: 1.6 !important;
  font-family: var(--font-main) !important;
  color: var(--text-primary) !important;
}

.leaflet-popup-tip { background: var(--bg-surface) !important; }

.leaflet-control-zoom a {
  background: var(--bg-surface) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-strong) !important;
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }

/* ============================================================
   SKELETON LOADER
   ============================================================ */
.skeleton {
  background: var(--bg-surface2);
  border-radius: var(--radius-sm);
  animation: pulse 1.4s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .sidebar        { display: none; }
  .metrics-grid   { grid-template-columns: repeat(3, 1fr); }
  .dashboard-body { grid-template-columns: 1fr; overflow-y: auto; }
  .grid           { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .hero h2      { font-size: 26px; }
}

/* ============================================================
   AGENTES â€” PAGE LAYOUT
   ============================================================ */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.agentes-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  flex-shrink: 0;
}

/* ============================================================
   AGENTES â€” TOPBAR EXTRAS
   ============================================================ */
.search-box {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 6px 10px;
}

.search-box svg {
  width: 13px;
  height: 13px;
  stroke: var(--text-muted);
  flex-shrink: 0;
}

.search-box input {
  background: none;
  border: none;
  outline: none;
  font-size: 13px;
  color: var(--text-primary);
  width: 160px;
}

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

.filter-tabs {
  display: flex;
  background: var(--bg-surface2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}

.filter-tab {
  padding: 4px 12px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 12px;
  background: none;
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s;
}

.filter-tab.active {
  background: var(--bg-surface3);
  color: var(--text-primary);
}

/* ============================================================
   AGENTES â€” TABLA
   ============================================================ */
.table-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.table-wrap {
  overflow: auto;
  flex: 1;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-surface2);
}

.data-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--bg-surface2); }

.data-table td.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
}

.agent-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.agent-avatar--sm {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-light);
  color: #7BBCF5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 500;
  flex-shrink: 0;
}

.agent-cell-name {
  font-weight: 500;
  color: var(--text-primary);
}

.text-muted { color: var(--text-muted); }
.text-sm    { font-size: 12px; }

.codigo-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-surface3);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
}

.caps-count {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-captacion);
}

.row-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  opacity: 0;
  transition: opacity 0.15s;
}

.data-table tbody tr:hover .row-actions { opacity: 1; }

.action-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: none;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.action-btn svg { width: 13px; height: 13px; }

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

.action-btn--danger:hover {
  background: var(--bg-desechada);
  color: var(--color-desechada);
  border-color: var(--color-desechada);
}

/* ============================================================
   TOGGLE SWITCH
   ============================================================ */
.toggle {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 18px;
  flex-shrink: 0;
}

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

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border-strong);
  border-radius: 18px;
  transition: background 0.2s;
  cursor: pointer;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle input:checked + .toggle-slider { background: var(--color-captada); }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); }

.toggle--sm { width: 30px; height: 16px; }
.toggle--sm .toggle-slider::before { width: 10px; height: 10px; }
.toggle--sm input:checked + .toggle-slider::before { transform: translateX(14px); }

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

.toggle-label {
  font-size: 13px;
  color: var(--text-secondary);
  min-width: 45px;
}

/* ============================================================
   MODAL â€” INFO BOX y ERRORES
   ============================================================ */
.modal-info {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--accent-light);
  border: 1px solid rgba(37,99,235,0.3);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 12px;
  color: #7BBCF5;
  line-height: 1.5;
  margin-bottom: 4px;
}

.modal-info svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin-top: 1px;
  stroke: #7BBCF5;
}

.required { color: var(--color-desechada); }

.field-error {
  font-size: 11px;
  color: var(--color-desechada);
  min-height: 14px;
  display: block;
}

.modal--sm { max-width: 340px; }

.confirm-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 4px;
}

.confirm-text strong { color: var(--text-primary); }

.btn--danger {
  background: var(--bg-desechada);
  color: var(--color-desechada);
  border-color: var(--color-desechada);
}

.btn--danger:hover {
  background: var(--color-desechada);
  color: #fff;
}

/* ============================================================
   FIX TOPBAR AGENTES â€” botÃ³n y alineaciÃ³n
   ============================================================ */
.topbar {
  flex-wrap: nowrap;
  overflow: hidden;
}

.topbar-right {
  flex-wrap: nowrap;
  overflow: hidden;
}

/* BotÃ³n nuevo agente â€” tamaÃ±o controlado */
.btn.btn--primary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  font-size: 13px;
  white-space: nowrap;
  flex-shrink: 0;
  height: 34px;
}

.btn.btn--primary svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

/* Search box altura consistente */
.search-box {
  height: 34px;
}

/* Filter tabs altura consistente */
.filter-tabs {
  height: 34px;
  align-items: center;
}

.filter-tab {
  height: 26px;
  display: inline-flex;
  align-items: center;
}

/* ============================================================
   AUTH â€” LOGO
   ============================================================ */
.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.auth-logo-name {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
}

/* ============================================================
   AUTH â€” CARD CENTRADA (verificaciÃ³n / error)
   ============================================================ */
.auth-card--center {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-card--center .subtitle {
  margin-bottom: 24px;
}

/* ============================================================
   AUTH â€” STATUS ICON
   ============================================================ */
.status-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.status-icon svg {
  width: 26px;
  height: 26px;
}

.status-icon--success {
  background: var(--bg-captada);
}

.status-icon--success svg {
  stroke: var(--color-captada);
}

.status-icon--error {
  background: var(--bg-desechada);
}

.status-icon--error svg {
  stroke: var(--color-desechada);
}

/* ============================================================
   AUTH â€” INPUT PASSWORD CON OJO
   ============================================================ */
.input-password {
  position: relative;
}

.input-password input {
  width: 100%;
  padding: 12px 40px 12px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-page);
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color 0.15s;
}

.input-password input:focus {
  outline: none;
  border-color: var(--accent);
}

.toggle-pass {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  padding: 4px;
  transition: color 0.15s;
}

.toggle-pass svg {
  width: 15px;
  height: 15px;
}

.toggle-pass:hover { color: var(--text-secondary); }

/* ============================================================
   AUTH LOGIN - Captbrokecity estilo Brokecity
   ============================================================ */
.capt-login-page {
  min-height: 100vh;
  background: #f7fafc;
  color: #0f172a;
}

.capt-login-page::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.035) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.capt-auth-screen {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.capt-auth-card {
  width: min(760px, 100%);
  background: #ffffff;
  border: 1px solid #dbe4ee;
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 18px 60px rgba(15, 23, 42, 0.08);
}

.capt-brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.capt-brand-logo { width: 58px; height: 58px; object-fit: cover; border-radius: 15px; box-shadow: 0 12px 28px rgba(15, 23, 42, .18); flex: 0 0 auto; }
.capt-brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #2563eb;
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
}

.capt-brand-row strong {
  display: block;
  color: #0f172a;
  font-size: 18px;
}

.capt-brand-row span {
  display: block;
  margin-top: 2px;
  color: #64748b;
  font-size: 13px;
}

.capt-login-header {
  margin-bottom: 18px;
}

.capt-login-header h1 {
  margin: 0;
  color: #0f172a;
  font-size: 26px;
  line-height: 1.15;
}

.capt-login-header p {
  margin: 8px 0 0;
  color: #64748b;
  font-size: 14px;
}

.capt-role-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.capt-role-option {
  text-align: left;
  border: 1px solid #dbe4ee;
  border-radius: 12px;
  padding: 12px;
  background: #f8fafc;
  color: #0f172a;
  cursor: pointer;
}

.capt-role-option strong {
  display: block;
  font-size: 14px;
}

.capt-role-option span {
  display: block;
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.capt-role-option.active {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.capt-form-stack {
  display: grid;
  gap: 14px;
}

.capt-form-stack label {
  display: grid;
  gap: 7px;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

.capt-form-stack input {
  width: 100%;
  min-height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px 12px;
  background: #ffffff;
  color: #0f172a;
  font-size: 14px;
}

.capt-form-stack input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.capt-password-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.capt-password-row button,
.capt-primary-btn {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.capt-password-row button {
  background: #eaf2ff;
  color: #1d4ed8;
}

.capt-primary-btn {
  width: 100%;
  background: #2563eb;
  color: #ffffff;
}

.capt-primary-btn:hover {
  background: #1d4ed8;
}

.capt-check-row {
  display: flex !important;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.capt-check-row input {
  width: auto;
  min-height: auto;
}

.capt-login-page .mensaje {
  min-height: 20px;
  margin: 14px 0 0;
  color: #1d4ed8;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
}

.capt-auth-footer {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
  text-align: center;
  color: #64748b;
  font-size: 13px;
}

.capt-auth-footer a {
  color: #1d4ed8;
  font-weight: 900;
  text-decoration: none;
}

.capt-auth-footer a:hover {
  text-decoration: underline;
}

@media (max-width: 760px) {
  .capt-auth-screen {
    padding: 16px;
  }

  .capt-auth-card {
    padding: 20px;
  }

  .capt-role-switch {
    grid-template-columns: 1fr;
  }
}

