/*
 * ============================================================
 * ZoneGan — Estilos globales
 * ============================================================
 * Metodología: Mobile-first
 * Breakpoints:
 *   Mobile:  < 768px  (diseño base)
 *   Desktop: >= 768px
 * ============================================================
 */

/* ─────────────────────────────────────────────
   VARIABLES CSS
───────────────────────────────────────────── */
:root {
  --color-bg:            #050008;
  --color-bg-card:       #141414;
  --color-bg-card-2:     #1e1e1e;
  --color-accent:        #b44fff;
  --color-accent-glow:   rgba(180, 79, 255, 0.4);
  --color-whatsapp:      #25D366;
  --color-whatsapp-dark: #1da851;
  --color-telegram:      #229ED9;
  --color-telegram-dark: #1a7fb0;
  --color-text:          #ffffff;
  --color-text-muted:    #888888;
  --color-text-dark:     #444444;
  --color-success:       #22c55e;
  --color-error:         #ef4444;
  --color-warning:       #f59e0b;
  --color-info:          #3b82f6;
  --border-radius-sm:    8px;
  --border-radius-md:    12px;
  --border-radius-lg:    20px;
  --border-radius-xl:    50px;
  --shadow-card:         0 4px 24px rgba(0, 0, 0, 0.6);
  --shadow-accent:       0 0 30px var(--color-accent-glow);
  --transition-fast:     0.15s ease;
  --transition-mid:      0.3s ease;
}

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

html, body {
  height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Sin scroll solo en la landing (index.html) */
body:has(.main-container) {
  overflow: hidden;
}

body {
  background: radial-gradient(ellipse at 70% 50%,
    #2a0050 0%,
    #150025 35%,
    #0a000f 70%,
    #050008 100%
  );
  color: var(--color-text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

img {
  display: block;
  max-width: 100%;
}

button {
  cursor: pointer;
  border: none;
  font-family: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}


/* ─────────────────────────────────────────────
   ANIMACIONES
───────────────────────────────────────────── */

@keyframes twinkle {
  0%, 100% { opacity: 0.1; transform: scale(1); }
  50%       { opacity: 0.8; transform: scale(1.5); }
}

@keyframes float-heart {
  0%, 100% { transform: translateY(0px) rotate(-5deg); }
  50%       { transform: translateY(-10px) rotate(5deg); }
}

@keyframes float-shield {
  0%, 100% { transform: translateX(-50%) translateY(0px); }
  50%       { transform: translateX(-50%) translateY(-6px); }
}

@keyframes glow-logo {
  0%   { filter: drop-shadow(0 0 8px rgba(180, 79, 255, 0.4)); }
  50%  { filter: drop-shadow(0 0 22px rgba(180, 79, 255, 0.9)) drop-shadow(0 0 40px rgba(180, 79, 255, 0.4)); }
  100% { filter: drop-shadow(0 0 8px rgba(180, 79, 255, 0.4)); }
}

@keyframes pulse-whatsapp {
  0%, 100% { box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4); }
  50%       { box-shadow: 0 4px 35px rgba(37, 211, 102, 0.75); }
}

@keyframes pulse-telegram {
  0%, 100% { box-shadow: 0 4px 20px rgba(34, 158, 217, 0.4); }
  50%       { box-shadow: 0 4px 35px rgba(34, 158, 217, 0.75); }
}

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

@keyframes spin {
  to { transform: rotate(360deg); }
}

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


/* ─────────────────────────────────────────────
   PARTÍCULAS DE FONDO
───────────────────────────────────────────── */
.particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}


/* ─────────────────────────────────────────────
   HEADER — Logo GANAMOS.NET
───────────────────────────────────────────── */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 12px 20px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.logo-ganamos {
  height: 36px;
  width: auto;
  object-fit: contain;
  filter: brightness(1.3) contrast(1.1) drop-shadow(0 0 8px rgba(180, 79, 255, 0.3));
}


/* ─────────────────────────────────────────────
   LANDING — CONTENEDOR PRINCIPAL
───────────────────────────────────────────── */
.main-container {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 24px;
  padding-top: 60px;
  z-index: 1;
}


/* ─────────────────────────────────────────────
   BULLDOG — detrás de todo (z-index: 1)
───────────────────────────────────────────── */
.bulldog-wrapper {
  position: absolute;
  bottom: 80px;
  right: -20px;
  z-index: 1;
  width: 75vw;
  max-width: 340px;
  pointer-events: none;
}

.bulldog-img {
  width: 100%;
  height: auto;
  object-fit: contain;
  -webkit-mask-image: linear-gradient(
    to bottom,
    rgba(0,0,0,1) 0%,
    rgba(0,0,0,1) 60%,
    rgba(0,0,0,0.3) 85%,
    rgba(0,0,0,0) 100%
  );
  mask-image: linear-gradient(
    to bottom,
    rgba(0,0,0,1) 0%,
    rgba(0,0,0,1) 60%,
    rgba(0,0,0,0.3) 85%,
    rgba(0,0,0,0) 100%
  );
}


/* ─────────────────────────────────────────────
   CORAZÓN GEMA — flotando (z-index: 2)
───────────────────────────────────────────── */
.heart-wrapper {
  position: absolute;
  bottom: 220px;
  left: 16px;
  z-index: 2;
  width: 70px;
  animation: float-heart 3s ease-in-out infinite;
  pointer-events: none;
}

.heart-img {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 0 12px rgba(180, 79, 255, 0.8));
}


/* ─────────────────────────────────────────────
   LOGO ESCUDO ZONEGAN — centro (z-index: 10)
───────────────────────────────────────────── */
.logo-shield-wrapper {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  width: 90px;
  animation: float-shield 4s ease-in-out infinite;
  pointer-events: none;
}

.logo-shield {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 0 16px rgba(180, 79, 255, 0.8));
}


/* ─────────────────────────────────────────────
   TEXTO CTA — (z-index: 10)
───────────────────────────────────────────── */
.cta-text {
  position: absolute;
  bottom: 200px;
  left: 20px;
  z-index: 10;
  text-align: left;
}

.cta-text h1 {
  font-size: clamp(28px, 8vw, 42px);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -1px;
  text-shadow: 0 0 20px rgba(0,0,0,0.8);
}

.text-white { color: #ffffff; }

.text-purple {
  color: #b44fff;
  text-shadow: 0 0 20px rgba(180, 79, 255, 0.6);
}

.subtitle {
  font-size: 10px;
  letter-spacing: 3px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 6px;
  text-transform: uppercase;
}


/* ─────────────────────────────────────────────
   BOTONES — z-index: 20 (encima del bulldog)
───────────────────────────────────────────── */
.buttons-wrapper {
  position: relative;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  padding: 0 20px;
}

.btn-whatsapp,
.btn-telegram {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px 24px;
  border: none;
  border-radius: 50px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #ffffff;
  cursor: pointer;
  transition: transform var(--transition-fast), filter var(--transition-fast);
  text-transform: uppercase;
}

.btn-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.btn-whatsapp {
  background: var(--color-whatsapp);
  animation: pulse-whatsapp 2.5s ease-in-out infinite;
}

.btn-telegram {
  background: var(--color-telegram);
  animation: pulse-telegram 2.5s ease-in-out infinite;
  animation-delay: 0.5s;
}

.btn-whatsapp:hover:not(:disabled),
.btn-telegram:hover:not(:disabled) {
  filter: brightness(1.1);
  animation-play-state: paused;
}

.btn-whatsapp:active,
.btn-telegram:active {
  transform: scale(0.97);
}

.btn-whatsapp:disabled,
.btn-telegram:disabled {
  opacity: 0.85;
  animation: none;
  cursor: not-allowed;
}

/* Spinner de carga dentro del botón */
.btn-loading-spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

/* Botón instalación PWA */
.btn-install {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.5rem;
  background: transparent;
  border: 1px solid rgba(180, 79, 255, 0.4);
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 50px;
  transition: all var(--transition-mid);
  letter-spacing: 0.5px;
  width: 100%;
}

.btn-install:hover {
  background: rgba(180, 79, 255, 0.12);
  border-color: var(--color-accent);
  color: #fff;
}

.btn-install:active {
  transform: scale(0.98);
}


/* ─────────────────────────────────────────────
   DESKTOP (>= 768px)
───────────────────────────────────────────── */
@media (min-width: 768px) {
  .bulldog-wrapper {
    right: 0;
    bottom: 60px;
    width: 45vw;
    max-width: 480px;
  }

  .cta-text {
    bottom: 50%;
    left: 5%;
    transform: translateY(50%);
  }

  .cta-text h1 {
    font-size: 52px;
  }

  .buttons-wrapper {
    position: absolute;
    bottom: 40px;
    left: 5%;
    width: 380px;
    padding: 0;
  }

  .heart-wrapper {
    left: 38%;
    bottom: 300px;
    width: 90px;
  }

  .logo-shield-wrapper {
    top: 80px;
    width: 110px;
  }
}


/* ─────────────────────────────────────────────
   LOGIN PAGE (login.html)
───────────────────────────────────────────── */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.login-card {
  background: var(--color-bg-card);
  border: 1px solid rgba(180, 79, 255, 0.2);
  border-radius: var(--border-radius-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-card), var(--shadow-accent);
  animation: fadeInUp 0.4s ease;
}

.login-logo {
  width: 140px;
  margin: 0 auto 2rem;
  display: block;
}

.login-title {
  text-align: center;
  font-size: 1.1rem;
  color: var(--color-text-muted);
  margin-bottom: 2rem;
  letter-spacing: 2px;
  text-transform: uppercase;
}

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

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
  letter-spacing: 0.5px;
}

.form-input {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--color-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius-sm);
  color: var(--color-text);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(180, 79, 255, 0.15);
}

.form-input::placeholder {
  color: var(--color-text-dark);
}

.btn-login {
  width: 100%;
  padding: 0.9rem;
  background: var(--color-accent);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--border-radius-sm);
  margin-top: 0.5rem;
  transition: background-color var(--transition-fast), opacity var(--transition-fast);
  letter-spacing: 1px;
}

.btn-login:hover:not(:disabled) {
  background: #7200d4;
}

.btn-login:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.login-error {
  color: var(--color-error);
  font-size: 0.875rem;
  text-align: center;
  margin-top: 1rem;
  padding: 0.75rem;
  background: rgba(239, 68, 68, 0.1);
  border-radius: var(--border-radius-sm);
  border: 1px solid rgba(239, 68, 68, 0.2);
  display: none;
}

.login-error.visible {
  display: block;
  animation: fadeInUp 0.2s ease;
}


/* ─────────────────────────────────────────────
   DASHBOARD (dashboard.html)
───────────────────────────────────────────── */
.dashboard-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: var(--color-bg-card);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  position: sticky;
  top: 0;
  z-index: 100;
}

.dashboard-header-logo {
  height: 40px;
  width: auto;
}

.dashboard-header-title {
  font-size: 1rem;
  color: var(--color-text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.btn-logout {
  padding: 0.5rem 1rem;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--color-text-muted);
  border-radius: var(--border-radius-sm);
  font-size: 0.85rem;
  transition: all var(--transition-fast);
}

.btn-logout:hover {
  border-color: var(--color-error);
  color: var(--color-error);
}

.dashboard-main {
  flex: 1;
  padding: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.dashboard-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.range-selector {
  display: flex;
  gap: 0.5rem;
  background: var(--color-bg-card);
  padding: 0.35rem;
  border-radius: var(--border-radius-sm);
  border: 1px solid rgba(255,255,255,0.08);
}

.range-btn {
  padding: 0.45rem 0.9rem;
  background: transparent;
  color: var(--color-text-muted);
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.range-btn:hover {
  color: var(--color-text);
  background: rgba(255,255,255,0.06);
}

.range-btn.active {
  background: var(--color-accent);
  color: #fff;
}

.refresh-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.refresh-countdown {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.btn-refresh {
  padding: 0.45rem 1rem;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--color-text-muted);
  border-radius: var(--border-radius-sm);
  font-size: 0.85rem;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-refresh:hover {
  border-color: var(--color-accent);
  color: var(--color-text);
}

/* ── KPI Cards ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: var(--color-bg-card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--border-radius-md);
  padding: 1.25rem;
  transition: border-color var(--transition-mid);
  animation: fadeInUp 0.4s ease;
}

.kpi-card:hover {
  border-color: rgba(180, 79, 255, 0.3);
}

.kpi-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.kpi-label {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
}

.kpi-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1;
  animation: countUp 0.5s ease;
}

.kpi-value.accent {
  color: var(--color-accent);
}

.kpi-sub {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 0.3rem;
}

/* ── Secciones del dashboard ── */
.dashboard-section {
  background: var(--color-bg-card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--border-radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

/* ── Tabla de agentes ── */
.agents-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.agents-table th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  color: var(--color-text-muted);
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.agents-table td {
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}

.agents-table tr:last-child td {
  border-bottom: none;
}

.agents-table tr:hover td {
  background: rgba(255,255,255,0.02);
}

.agent-bar-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.agent-bar-track {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.08);
  border-radius: 4px;
  overflow: hidden;
}

.agent-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent), var(--color-whatsapp));
  border-radius: 4px;
  transition: width 0.8s ease;
}

.agent-bar-pct {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  min-width: 40px;
  text-align: right;
}

/* ── Gráfico Chart.js ── */
.chart-container {
  position: relative;
  height: 280px;
}

/* ── Filtro UTM ── */
.utm-filter {
  margin-bottom: 1.5rem;
}

.utm-filter-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  user-select: none;
  padding: 0.75rem 1rem;
  background: var(--color-bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--border-radius-sm);
  transition: color var(--transition-fast);
}

.utm-filter-toggle:hover { color: var(--color-text); }

.utm-filter-toggle .arrow {
  transition: transform var(--transition-fast);
  margin-left: auto;
}

.utm-filter-toggle.open .arrow { transform: rotate(180deg); }

.utm-filter-content {
  display: none;
  padding: 1rem;
  background: var(--color-bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-top: none;
  border-radius: 0 0 var(--border-radius-sm) var(--border-radius-sm);
}

.utm-filter-content.open { display: block; }

/* ── Spinner de carga del dashboard ── */
.dashboard-loading {
  position: fixed;
  inset: 0;
  background: rgba(5,0,8,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-mid);
}

.dashboard-loading.visible {
  opacity: 1;
  pointer-events: all;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(180, 79, 255, 0.2);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Select estilo oscuro */
select.form-select {
  appearance: none;
  padding: 0.6rem 2rem 0.6rem 0.85rem;
  background: var(--color-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23888' d='M6 8L0 0h12z'/%3E%3C/svg%3E") no-repeat right 0.75rem center;
  background-size: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--border-radius-sm);
  color: var(--color-text);
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
}

select.form-select:focus {
  outline: none;
  border-color: var(--color-accent);
}


/* ─────────────────────────────────────────────
   DASHBOARD RESPONSIVE
───────────────────────────────────────────── */
@media (min-width: 768px) {
  .kpi-grid { grid-template-columns: repeat(5, 1fr); }
  .dashboard-main { padding: 2rem; }
}

@media (min-width: 1024px) {
  .chart-container { height: 350px; }
}


/* ─────────────────────────────────────────────
   UTILITARIOS
───────────────────────────────────────────── */
.text-gradient {
  background: linear-gradient(135deg, var(--color-accent), #b44fff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.divider {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 1rem 0;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border-width: 0;
}


/* ─────────────────────────────────────────────
   SECCIÓN GESTIÓN DE AGENTES (dashboard)
───────────────────────────────────────────── */

.agents-section {
  background: var(--color-bg-card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--border-radius-md);
  padding: 1.25rem;
  margin-top: 1.5rem;
}

/* Tabs WhatsApp / Telegram */
.agents-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 0.75rem;
}

.tab-btn {
  padding: 0.45rem 1.1rem;
  border-radius: var(--border-radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  transition: all var(--transition-fast);
}

.tab-btn:hover {
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.06);
}

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

/* Header de la sección */
.agents-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.btn-add-agent {
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: var(--border-radius-sm);
  padding: 0.5rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: opacity var(--transition-fast);
}

.btn-add-agent:hover { opacity: 0.85; }

/* Wrapper con scroll horizontal en mobile */
.agents-table-wrapper {
  overflow-x: auto;
}

/* Tabla de gestión (clase distinta para no pisar la tabla de métricas) */
.agents-mgmt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.agents-mgmt-table th {
  text-align: left;
  padding: 0.55rem 0.75rem;
  color: var(--color-text-muted);
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.agents-mgmt-table td {
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--color-text);
  vertical-align: middle;
}

.agents-mgmt-table tr:last-child td {
  border-bottom: none;
}

.agents-mgmt-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge-active {
  background: rgba(37, 211, 102, 0.15);
  color: #25D366;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-inactive {
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-text-muted);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
}

.badge-available {
  background: rgba(37, 211, 102, 0.15);
  color: #25D366;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
  display: inline-block;
  margin-top: 3px;
}

.badge-offline {
  background: rgba(255, 100, 100, 0.15);
  color: #ff6464;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
  display: inline-block;
  margin-top: 3px;
}

/* Botones de acción en la fila */
.action-btns {
  display: flex;
  gap: 0.5rem;
}

.btn-edit {
  background: rgba(180, 79, 255, 0.15);
  color: var(--color-accent);
  border: none;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.btn-edit:hover { background: rgba(180, 79, 255, 0.3); }

.btn-toggle-agent {
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-text-muted);
  border: none;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.btn-toggle-agent:hover { background: rgba(255, 255, 255, 0.15); }

.btn-delete {
  background: rgba(255, 60, 60, 0.12);
  color: #ff6b6b;
  border: none;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.btn-delete:hover { background: rgba(255, 60, 60, 0.28); }


/* ─────────────────────────────────────────────
   MODALES DE GESTIÓN (prefijo mgmt- para no pisar los existentes)
───────────────────────────────────────────── */

.mgmt-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.78);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(4px);
}

.mgmt-modal-card {
  background: #1a1a2e;
  border: 1px solid rgba(180, 79, 255, 0.3);
  border-radius: var(--border-radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  animation: fadeInUp 0.2s ease;
}

.mgmt-modal-small {
  max-width: 360px;
}

.mgmt-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem 0;
}

.mgmt-modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.mgmt-modal-close {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color var(--transition-fast);
}

.mgmt-modal-close:hover { color: #fff; }

.mgmt-modal-body {
  padding: 1.25rem 1.5rem;
}

.mgmt-modal-footer {
  padding: 0 1.5rem 1.25rem;
  display: flex;
  gap: 0.65rem;
  justify-content: flex-end;
}

/* Formulario dentro del modal */
.mgmt-form-group {
  margin-bottom: 1rem;
}

.mgmt-form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 0.35rem;
}

.mgmt-form-group input[type="text"],
.mgmt-form-group input[type="time"],
.mgmt-form-group textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--border-radius-sm);
  padding: 0.6rem 0.85rem;
  color: #fff;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition-fast);
}

.mgmt-form-group input[type="text"]:focus,
.mgmt-form-group input[type="time"]:focus,
.mgmt-form-group textarea:focus {
  border-color: var(--color-accent);
}

.mgmt-form-group input[type="checkbox"] {
  accent-color: var(--color-accent);
  width: 15px;
  height: 15px;
  vertical-align: middle;
  margin-right: 6px;
}

.mgmt-input-hint {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  margin-bottom: 0.35rem;
}

.mgmt-optional {
  color: var(--color-text-muted);
  font-weight: 400;
  font-size: 0.72rem;
}

.mgmt-schedule-config {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--border-radius-sm);
  padding: 0.85rem;
  margin-top: 0.5rem;
}

.mgmt-days-grid {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.mgmt-days-grid label {
  display: flex;
  align-items: center;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.06);
  padding: 5px 10px;
  border-radius: 6px;
  font-weight: 400 !important;
  margin-bottom: 0 !important;
}

.mgmt-time-range {
  display: flex;
  gap: 1rem;
}

.mgmt-time-range > div { flex: 1; }

/* Botones del modal */
.mgmt-btn-cancel {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: none;
  border-radius: var(--border-radius-sm);
  padding: 0.6rem 1.1rem;
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.mgmt-btn-cancel:hover { background: rgba(255, 255, 255, 0.14); }

.mgmt-btn-save {
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: var(--border-radius-sm);
  padding: 0.6rem 1.4rem;
  font-size: 0.875rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

.mgmt-btn-save:hover:not(:disabled) { opacity: 0.85; }
.mgmt-btn-save:disabled { opacity: 0.5; cursor: not-allowed; }

.mgmt-btn-danger {
  background: #e53e3e;
  color: #fff;
  border: none;
  border-radius: var(--border-radius-sm);
  padding: 0.6rem 1.4rem;
  font-size: 0.875rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

.mgmt-btn-danger:hover { opacity: 0.85; }

.mgmt-text-muted {
  color: var(--color-text-muted);
  font-size: 0.82rem;
  margin-top: 0.5rem;
}

/* Toast de feedback */
#dashToast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a2e;
  border: 1px solid rgba(180, 79, 255, 0.4);
  color: #fff;
  padding: 0.7rem 1.5rem;
  border-radius: 50px;
  font-size: 0.875rem;
  z-index: 9999;
  transition: opacity 0.3s;
  pointer-events: none;
  white-space: nowrap;
}

/* Mobile: ocultar columna horario */
@media (max-width: 640px) {
  .agents-mgmt-table th:nth-child(3),
  .agents-mgmt-table td:nth-child(3) {
    display: none;
  }

  .action-btns {
    flex-direction: column;
    gap: 4px;
  }
}
