/* Seguimiento de clientes. Se apoya en styles.css: aqui solo esta lo que
   esa hoja no tiene (filtros, ficha lateral, linea de tiempo, badges). */

.chip.enlace {
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}
.chip.enlace:hover { background: rgba(255, 255, 255, .3); }

/* ------------------------------------------------------------- resumen */
.resumen-crm { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 900px) { .resumen-crm { grid-template-columns: repeat(2, 1fr); } }

.stat.pulsable { cursor: pointer; text-align: left; font: inherit; color: inherit; }
.stat.pulsable:hover { border-color: var(--azul); }
.stat.pulsable.activo { border-color: var(--azul); box-shadow: 0 0 0 2px #bfdbfe; }
.stat .valor.ambar { color: var(--ambar); }
.stat .valor.azul { color: var(--azul); }
.stat .valor.verde { color: var(--verde); }

/* ------------------------------------------------------------- filtros */
.filtros-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
@media (max-width: 980px) { .filtros-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .filtros-grid { grid-template-columns: 1fr; } }
.campo-ancho { grid-column: span 2; }
@media (max-width: 560px) { .campo-ancho { grid-column: span 1; } }

.filtros-pie {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--borde);
}
.filtros-botones { display: flex; gap: 8px; flex-wrap: wrap; }

.conteo { margin: 0; font-size: 14px; font-weight: 600; }
.conteo em { font-style: normal; font-weight: 400; color: var(--suave); }
.paginador { display: flex; align-items: center; gap: 10px; }
.paginador button:disabled { opacity: .45; cursor: default; }

/* --------------------------------------------------------------- tabla */
.col-acciones { width: 1%; }
#tabla td { vertical-align: middle; }
#tabla tbody tr { cursor: pointer; }
.celda-negocio { min-width: 210px; }
.celda-comentario { max-width: 320px; color: var(--suave); font-size: 12.5px; }

.tel {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-weight: 600;
}
.tel-tipo { display: block; font-size: 11px; color: var(--suave); font-weight: 400; }

.acciones-fila { display: flex; gap: 6px; white-space: nowrap; }
.mini {
  border: 1px solid var(--borde);
  background: #fff;
  border-radius: 7px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--texto);
  text-decoration: none;
  line-height: 1.2;
}
.mini:hover { background: var(--gris-suave); }
.mini.llamar { color: var(--azul); border-color: #bfdbfe; background: #eff6ff; }
.mini.wa { color: #166534; border-color: #bbf7d0; background: #f0fdf4; }
.mini.fallo { color: #92400e; border-color: #fde68a; background: #fffbeb; }

/* --------------------------------------------------------------- badges */
.badge.gris  { background: var(--gris-suave); color: var(--suave); }
.badge.ambar { background: var(--ambar-suave); color: #78350f; }
.badge.azul  { background: #dbeafe; color: #1e3a8a; }
.badge.verde { background: var(--verde-suave); color: #14532d; }
.badge.rojo  { background: var(--rojo-suave); color: #7f1d1d; }

.fecha-vencida { color: var(--rojo); font-weight: 600; }
.sin-dato { color: #cbd5e1; }

/* ------------------------------------------------------ ficha lateral */
.ficha-fondo {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  z-index: 90;
}
.ficha {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(560px, 100%);
  background: var(--panel);
  border-left: 1px solid var(--borde);
  box-shadow: -12px 0 40px rgba(15, 23, 42, .18);
  z-index: 95;
  display: flex;
  flex-direction: column;
}
.ficha-cabecera {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--borde);
}
.ficha-cabecera h2 { margin: 0; font-size: 19px; line-height: 1.25; }
.ficha-cabecera .sub { margin: 4px 0 0; }
.cerrar {
  border: none;
  background: var(--gris-suave);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 15px;
  color: var(--suave);
  flex-shrink: 0;
}
.cerrar:hover { background: #e2e8f0; }

.ficha-cuerpo { overflow-y: auto; padding: 20px 22px 40px; }

.bloque-telefono {
  background: var(--gris-suave);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.bloque-telefono .numero {
  font-size: 21px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: .5px;
}
.bloque-telefono .acciones-fila { flex-wrap: wrap; }

.ficha-datos {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 118px 1fr;
  gap: 7px 14px;
  font-size: 13.5px;
}
.ficha-datos dt { color: var(--suave); }
.ficha-datos dd { margin: 0; word-break: break-word; }
.ficha-datos a { color: var(--azul); }

.ficha-form {
  margin-top: 22px;
  padding: 18px;
  background: var(--gris-suave);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ficha-form h3, .ficha-historial h3 { margin: 0; font-size: 15px; }
.ficha-form-fila { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .ficha-form-fila { grid-template-columns: 1fr; } }
.ficha-form textarea, .ficha-form input[type="date"], .ficha-form input[type="text"] {
  padding: 10px 12px;
  border: 1px solid var(--borde);
  border-radius: 9px;
  font: inherit;
  font-size: 14px;
  background: #fff;
  color: var(--texto);
  resize: vertical;
}
.ficha-form select {
  padding: 10px 12px;
  border: 1px solid var(--borde);
  border-radius: 9px;
  font: inherit;
  font-size: 14px;
  background: #fff;
  color: var(--texto);
}
.primario.ancho { width: 100%; }

.canales { display: flex; gap: 7px; flex-wrap: wrap; }
.canal {
  border: 1px solid var(--borde);
  background: #fff;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--suave);
}
.canal.activo {
  background: var(--azul);
  border-color: var(--azul);
  color: #fff;
  font-weight: 600;
}

/* ------------------------------------------------------------ historial */
.ficha-historial { margin-top: 26px; }
.linea { list-style: none; margin: 14px 0 0; padding: 0 0 0 18px; border-left: 2px solid var(--borde); }
.linea li { position: relative; padding: 0 0 18px 16px; }
.linea li::before {
  content: "";
  position: absolute;
  left: -25px;
  top: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--azul);
  border: 2px solid var(--panel);
}
.linea .cuando { font-size: 12px; color: var(--suave); }
.linea .que { font-size: 13.5px; margin-top: 3px; }
.linea .comentario { font-size: 13.5px; margin-top: 5px; white-space: pre-wrap; }

.clave-error {
  background: var(--rojo-suave);
  color: #7f1d1d;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  margin: 12px 0 0;
}
#form-clave .campo { margin-top: 16px; }
#form-clave input[type="password"] {
  padding: 11px 13px;
  border: 1px solid var(--borde);
  border-radius: 9px;
  font: inherit;
  font-size: 15px;
}

.cargando-tabla { opacity: .45; transition: opacity .15s; }
