:root {
  --azul: #2563eb;
  --azul-osc: #1d4ed8;
  --verde: #16a34a;
  --verde-fondo: #ecfdf3;
  --verde-borde: #22c55e;
  --naranja: #ea580c;
  --naranja-fondo: #fff7ed;
  --naranja-borde: #f97316;
  --gris: #64748b;
  --gris-fondo: #f8fafc;
  --gris-borde: #cbd5e1;
  --texto: #1e293b;
  --texto-suave: #64748b;
  --fondo-pagina: #f1f5f9;
  --blanco: #ffffff;
  --sombra: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.06);
  --sombra-hover: 0 8px 20px rgba(15, 23, 42, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--fondo-pagina);
  color: var(--texto);
}

.topbar {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: white;
  padding: 20px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  box-shadow: var(--sombra);
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
}

.topbar-titulo p {
  margin: 4px 0 0;
  opacity: 0.9;
  font-size: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.08s ease, box-shadow 0.15s ease;
}

.btn:active { transform: scale(0.97); }

.btn-importar {
  background: white;
  color: var(--azul-osc);
}
.btn-importar:hover { box-shadow: var(--sombra-hover); }

.mensaje-flotante {
  position: fixed;
  top: 18px;
  right: 24px;
  background: #16a34a;
  color: white;
  padding: 12px 18px;
  border-radius: 10px;
  box-shadow: var(--sombra-hover);
  font-size: 14px;
  font-weight: 600;
  z-index: 50;
}
.mensaje-flotante.error { background: #dc2626; }

.btn-buscar-toggle {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.4);
}
.btn-buscar-toggle:hover { background: rgba(255, 255, 255, 0.25); }

.panel-buscar {
  background: #eef2ff;
  border-bottom: 1px solid #e2e8f0;
  padding: 18px 28px;
}

.bloque-seleccion {
  margin-bottom: 18px;
}

.bloque-cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.bloque-seleccion h3 {
  margin: 0 0 8px;
  font-size: 15px;
  color: var(--texto);
}

.subtitulo-bloque {
  margin: 10px 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--texto-suave);
}

.atajos {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.btn-atajo {
  background: white;
  border: 1px solid var(--gris-borde);
  color: var(--azul-osc);
  border-radius: 8px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.btn-atajo:hover { background: #e0e7ff; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip {
  background: white;
  border: 1px solid var(--gris-borde);
  color: var(--texto);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s ease;
}
.chip:hover { border-color: var(--azul); }

.chip-destacado { border-color: #c7d2fe; background: #f5f3ff; }

.chip-activo {
  background: var(--azul);
  border-color: var(--azul);
  color: white;
}
.chip-activo:hover { background: var(--azul-osc); }

.input-extra {
  margin-top: 10px;
  width: 100%;
  max-width: 520px;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--gris-borde);
  font-size: 13.5px;
  background: white;
}

.checkbox-linea {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13px;
  color: var(--texto);
  max-width: 640px;
  cursor: pointer;
}
.checkbox-linea input { margin-top: 2px; }

.resumen-busqueda {
  background: white;
  border: 1px dashed var(--gris-borde);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 13px;
  color: var(--texto-suave);
  margin-bottom: 14px;
}
.resumen-busqueda.resumen-listo {
  border-style: solid;
  border-color: #a5b4fc;
  color: var(--texto);
}

.btn-buscar {
  background: var(--azul);
  color: white;
}
.btn-buscar:hover { background: var(--azul-osc); }
.btn-buscar:disabled { opacity: 0.6; cursor: not-allowed; }

.ayuda-buscar {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--texto-suave);
}

.progreso-buscar {
  margin-top: 14px;
}

.barra-progreso {
  height: 10px;
  background: #dbeafe;
  border-radius: 999px;
  overflow: hidden;
}

.barra-progreso-relleno {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2563eb, #7c3aed);
  transition: width 0.3s ease;
}

#progreso-mensaje {
  margin: 8px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--azul-osc);
}

.filtros {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
  padding: 18px 28px;
  background: var(--blanco);
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.filtro {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filtro label {
  font-size: 12px;
  font-weight: 700;
  color: var(--texto-suave);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.filtro select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--gris-borde);
  font-size: 14px;
  min-width: 160px;
  background: var(--fondo-pagina);
}

.btn-limpiar {
  background: var(--gris-fondo);
  color: var(--texto);
  border: 1px solid var(--gris-borde);
}
.btn-limpiar:hover { background: #e2e8f0; }

.grid-leads {
  padding: 24px 28px 60px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}

.cargando, .sin-resultados {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--texto-suave);
  padding: 60px 0;
  font-size: 15px;
}

.card {
  background: var(--blanco);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--sombra);
  border-left: 6px solid var(--gris-borde);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow 0.15s ease;
}
.card:hover { box-shadow: var(--sombra-hover); }

.card.lead-verde {
  border-left-color: var(--verde-borde);
  background: linear-gradient(180deg, var(--verde-fondo) 0%, var(--blanco) 90px);
}
.card.lead-naranja {
  border-left-color: var(--naranja-borde);
  background: linear-gradient(180deg, var(--naranja-fondo) 0%, var(--blanco) 90px);
}
.card.lead-gris {
  border-left-color: var(--gris-borde);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.nombre {
  font-weight: 700;
  font-size: 16px;
  line-height: 1.3;
}

.meta {
  font-size: 13px;
  color: var(--texto-suave);
  margin-top: 2px;
}

.badge-lead {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.lead-verde .badge-lead { background: #dcfce7; color: #15803d; }
.lead-naranja .badge-lead { background: #ffedd5; color: #c2410c; }
.lead-gris .badge-lead { background: #e2e8f0; color: #475569; }

.rating {
  font-size: 13px;
  color: #b45309;
  font-weight: 600;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  font-size: 11.5px;
  background: #fee2e2;
  color: #991b1b;
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 600;
}
.pill.pill-ok {
  background: #dcfce7;
  color: #166534;
}

.acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.acciones .btn {
  flex: 1 1 auto;
  justify-content: center;
  padding: 9px 10px;
  font-size: 13px;
}

.btn-whatsapp { background: #dcfce7; color: #15803d; }
.btn-whatsapp:hover { background: #bbf7d0; }
.btn-llamar { background: #dbeafe; color: #1d4ed8; }
.btn-llamar:hover { background: #bfdbfe; }
.btn-web { background: #f1f5f9; color: #334155; }
.btn-web:hover { background: #e2e8f0; }
.btn[disabled], .btn.oculto { display: none; }

.estado-select {
  margin-top: 6px;
  padding: 9px 10px;
  border-radius: 9px;
  border: 1px solid var(--gris-borde);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.estado-select.estado-no-contactado { background: #f1f5f9; color: #475569; }
.estado-select.estado-llamado { background: #dbeafe; color: #1d4ed8; }
.estado-select.estado-interesado { background: #ede9fe; color: #6d28d9; }
.estado-select.estado-mockup-enviado { background: #ffedd5; color: #c2410c; }
.estado-select.estado-pagado { background: #dcfce7; color: #15803d; }
.estado-select.estado-descartado { background: #fee2e2; color: #b91c1c; }

.zona-notas {
  margin-top: 8px;
  border-top: 1px dashed #e2e8f0;
  padding-top: 9px;
}

.notas-cabecera {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.notas-cabecera label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--texto-suave);
}

.aviso-guardado {
  font-size: 11px;
  font-weight: 700;
}
.aviso-guardado.guardando { color: var(--texto-suave); }
.aviso-guardado.guardado { color: var(--verde); }
.aviso-guardado.error-guardado { color: #dc2626; }

.notas-texto {
  width: 100%;
  border: 1px solid var(--gris-borde);
  border-radius: 9px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
  color: var(--texto);
  background: #fffdf5;
  resize: none;
  overflow: hidden;
  min-height: 42px;
}
.notas-texto:focus {
  outline: none;
  border-color: var(--azul);
  background: white;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.notas-texto::placeholder { color: #a0aec0; }

/* ---- Pantallas de entrar / equipo ---- */

.pagina-acceso {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  padding: 20px;
}

.caja-acceso {
  background: white;
  border-radius: 16px;
  padding: 32px 30px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.25);
}

.caja-acceso h1 {
  margin: 0 0 6px;
  font-size: 22px;
}

.subtitulo-acceso {
  margin: 0 0 20px;
  font-size: 13.5px;
  color: var(--texto-suave);
  line-height: 1.5;
}

.caja-acceso label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--texto-suave);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 5px;
}

.caja-acceso input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 9px;
  border: 1px solid var(--gris-borde);
  font-size: 15px;
  margin-bottom: 16px;
  background: var(--fondo-pagina);
}
.caja-acceso input:focus {
  outline: none;
  border-color: var(--azul);
  background: white;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.btn-acceso {
  width: 100%;
  justify-content: center;
  background: var(--azul);
  color: white;
  padding: 12px;
  font-size: 15px;
}
.btn-acceso:hover { background: var(--azul-osc); }

.error-acceso {
  background: #fee2e2;
  color: #991b1b;
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}

.aviso-ok {
  background: #dcfce7;
  color: #15803d;
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}

.usuario-actual {
  color: white;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: 4px;
}
.usuario-actual a {
  color: white;
  opacity: 0.85;
  text-decoration: underline;
}
.usuario-actual a:hover { opacity: 1; }

.contenido-pagina {
  padding: 24px 28px 60px;
  max-width: 820px;
}

.tarjeta-simple {
  background: white;
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow: var(--sombra);
  margin-bottom: 18px;
}
.tarjeta-simple h2 { margin: 0 0 12px; font-size: 16px; }

.tabla-usuarios {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.tabla-usuarios th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  color: var(--texto-suave);
  border-bottom: 1px solid #e2e8f0;
  padding: 6px 8px;
}
.tabla-usuarios td {
  padding: 10px 8px;
  border-bottom: 1px solid #f1f5f9;
}

.etiqueta-tu {
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
}

.btn-quitar {
  background: #fee2e2;
  color: #b91c1c;
  border: none;
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.btn-quitar:hover { background: #fecaca; }

.form-usuario {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
}
.form-usuario input {
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid var(--gris-borde);
  font-size: 14px;
  min-width: 170px;
  background: var(--fondo-pagina);
}

@media (max-width: 640px) {
  .topbar { padding: 16px; }
  .filtros { padding: 14px 16px; }
  .grid-leads { padding: 16px; }
}
