/* ===== Captación CFTcenco - Estilos ===== */
:root {
  --azul: #0b3d91;
  --azul-oscuro: #082a66;
  --azul-claro: #eaf0fb;
  --acento: #f7941d;
  --verde: #1e8449;
  --rojo: #c0392b;
  --gris: #6b7280;
  --gris-claro: #f3f4f6;
  --borde: #d8dee9;
  --blanco: #ffffff;
  --sombra: 0 1px 3px rgba(0, 0, 0, .12), 0 1px 2px rgba(0, 0, 0, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  background: var(--gris-claro);
  color: #1f2937;
  line-height: 1.5;
}

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

/* ===== Login ===== */
.pagina-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--azul) 0%, var(--azul-oscuro) 100%);
  padding: 20px;
}

.login-tarjeta {
  background: var(--blanco);
  width: 100%;
  max-width: 400px;
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, .25);
}

.login-cabecera { text-align: center; margin-bottom: 24px; }

.login-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--acento);
  color: #fff;
  font-weight: 800;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 1px;
}

.login-cabecera h1 {
  margin: 0;
  font-size: 22px;
  color: var(--azul);
}

.login-cabecera p { margin: 4px 0 0; color: var(--gris); font-size: 14px; }

.login-tarjeta label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 14px 0 6px;
  color: #374151;
}

.login-tarjeta input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--borde);
  border-radius: 8px;
  font-size: 15px;
  transition: border-color .15s, box-shadow .15s;
}

.login-tarjeta input:focus {
  outline: none;
  border-color: var(--azul);
  box-shadow: 0 0 0 3px rgba(11, 61, 145, .15);
}

/* ===== Botones ===== */
.btn {
  display: inline-block;
  border: none;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  border-radius: 8px;
  padding: 11px 18px;
  transition: filter .15s, transform .05s;
}

.btn:active { transform: translateY(1px); }
.btn:hover { filter: brightness(1.08); }

.btn-primario { background: var(--azul); color: #fff; }
.btn-bloque { width: 100%; margin-top: 20px; }
.btn-cerrar {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 8px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 8px;
}

.btn-cerrar:hover { background: rgba(255, 255, 255, .22); }

/* ===== Alertas ===== */
.alerta {
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
}

.alerta-error { background: #fdecea; color: var(--rojo); border: 1px solid #f5c6cb; }

/* ===== Layout ===== */
.layout { display: flex; min-height: 100vh; }

/* ===== Sidebar ===== */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--azul);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-logo {
  padding: 22px 18px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .15);
}

.sidebar-logo span {
  display: inline-block;
  background: var(--acento);
  color: #fff;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 14px;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.sidebar-logo h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.menu { flex: 1; padding: 14px 10px; overflow-y: auto; }

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  margin-bottom: 4px;
  border-radius: 8px;
  color: rgba(255, 255, 255, .85);
  font-weight: 500;
  transition: background .15s, color .15s;
}

.menu-item:hover { background: rgba(255, 255, 255, .12); color: #fff; }

.menu-item.activo {
  background: rgba(255, 255, 255, .18);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--acento);
}

.menu-icono { font-size: 18px; }

.sidebar-pie {
  padding: 14px;
  border-top: 1px solid rgba(255, 255, 255, .15);
}

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

.usuario-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--acento);
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

.usuario-info strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.usuario-info span { font-size: 12px; color: rgba(255, 255, 255, .7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== Contenido ===== */
.contenido { flex: 1; padding: 24px; min-width: 0; }

.topbar {
  background: var(--blanco);
  border: 1px solid var(--borde);
  border-radius: 10px;
  padding: 16px 22px;
  margin-bottom: 20px;
  box-shadow: var(--sombra);
}

.topbar h2 { margin: 0; font-size: 20px; color: var(--azul); }

.panel {
  background: var(--blanco);
  border: 1px solid var(--borde);
  border-radius: 10px;
  padding: 22px;
  box-shadow: var(--sombra);
}

.panel h3 { margin: 0 0 6px; color: #111827; }
.panel p { margin: 0 0 20px; color: var(--gris); }

/* ===== Tarjetas de resumen ===== */
.tarjetas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.tarjeta {
  background: var(--azul-claro);
  border: 1px solid #d4e0f5;
  border-radius: 10px;
  padding: 18px;
  text-align: center;
}

.tarjeta-numero { font-size: 32px; font-weight: 800; color: var(--azul); }
.tarjeta-etiqueta { font-size: 14px; color: var(--gris); margin-top: 4px; }

/* ===== Mantenedor: filtro, tabla, paginación ===== */
.filtro-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filtro-form { display: flex; gap: 8px; flex-wrap: wrap; }

.filtro-input {
  width: 300px;
  max-width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--borde);
  border-radius: 8px;
  font-size: 14px;
}

.filtro-input:focus {
  outline: none;
  border-color: var(--azul);
  box-shadow: 0 0 0 3px rgba(11, 61, 145, .15);
}

.btn-acento { background: var(--acento); color: #fff; }
.btn-secundario {
  background: #eef1f6;
  color: #374151;
  border: 1px solid var(--borde);
}
.btn-secundario:hover { background: #e2e7ef; filter: none; }

.resumen { margin: 0 0 12px; font-size: 14px; color: var(--gris); }

/* ===== Tabla ===== */
.tabla-wrap { overflow-x: auto; border: 1px solid var(--borde); border-radius: 10px; }

.tabla {
  width: 100%;
  border-collapse: collapse;
  background: var(--blanco);
  font-size: 14px;
  min-width: 620px;
}

.tabla thead th {
  background: var(--azul-claro);
  color: var(--azul);
  text-align: left;
  padding: 12px 14px;
  font-weight: 700;
  border-bottom: 2px solid #d4e0f5;
  white-space: nowrap;
}

.tabla tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--gris-claro);
  vertical-align: middle;
}

.tabla tbody tr:hover { background: #f8fafd; }
.tabla tbody tr:last-child td { border-bottom: none; }

.th-acciones, .td-acciones { text-align: center; width: 110px; }
.td-acciones { white-space: nowrap; }

.tabla-vacia { text-align: center; color: var(--gris); padding: 26px !important; }

.ordenar { color: var(--azul); font-weight: 700; }
.ordenar:hover { text-decoration: underline; }

/* ===== Acciones de fila ===== */
.btn-accion {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 15px;
  margin: 0 2px;
  transition: filter .15s;
}
.btn-accion:hover { filter: brightness(.92); }
.btn-accion.ver { background: var(--azul-claro); }
.btn-accion.editar { background: #fdf2e3; }

/* ===== Paginador ===== */
.paginador-wrap {
  display: flex;
  justify-content: center;
  margin: 16px 0;
}

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

.pag-btn {
  min-width: 36px;
  padding: 7px 11px;
  text-align: center;
  border: 1px solid var(--borde);
  border-radius: 8px;
  font-size: 14px;
  color: var(--azul);
  background: var(--blanco);
  transition: background .15s, color .15s;
}
.pag-btn:hover { background: var(--azul-claro); }
.pag-btn.activo {
  background: var(--azul);
  color: #fff;
  border-color: var(--azul);
}
.pag-btn.desactivado { color: #b6becb; background: #f3f4f6; pointer-events: none; }

/* ===== Detalle de usuario ===== */
.detalle-acciones {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.detalle {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.detalle-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--acento);
  color: #fff;
  font-size: 30px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.detalle-campos { flex: 1; min-width: 260px; display: grid; gap: 14px; }

.detalle-campo { display: flex; flex-direction: column; }

.detalle-etiqueta { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--gris); font-weight: 600; }
.detalle-valor { font-size: 16px; color: #111827; }

/* ===== Formulario ===== */
.formulario { max-width: 520px; display: grid; gap: 16px; }

.form-campo label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: #374151;
}

.form-opcional { font-weight: 400; font-size: 12px; color: var(--gris); }

.form-campo input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--borde);
  border-radius: 8px;
  font-size: 15px;
}

.form-campo input:focus {
  outline: none;
  border-color: var(--azul);
  box-shadow: 0 0 0 3px rgba(11, 61, 145, .15);
}

.form-acciones { display: flex; gap: 10px; margin-top: 6px; }

/* ===== Alertas ===== */
.alerta-ok { background: #eaf6ef; color: var(--verde); border: 1px solid #bfe6cd; }
.alerta-ok a { font-weight: 600; text-decoration: underline; }

/* ===== Ajustes: conexiones API ===== */
.panel-cabecera {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.panel-cabecera h3 { margin: 0 0 4px; }
.panel-cabecera p { margin: 0; color: var(--gris); font-size: 14px; max-width: 620px; }

.celda-url { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: var(--azul-claro);
  color: var(--azul);
}
.badge-verde { background: #eaf6ef; color: var(--verde); }
.badge-rojo { background: #fdecea; color: var(--rojo); }

.btn-accion.probar { background: var(--azul-claro); }
.btn-accion.eliminar { background: #fdecea; }

.form-inline-accion { display: inline; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-campo select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--borde);
  border-radius: 8px;
  font-size: 15px;
  background: #fff;
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 8px;
  font-size: 14px !important;
  color: #374151;
  min-height: 44px;
  margin-top: 6px;
}

.codigo-esquema {
  background: #0f172a;
  color: #7dd3fc;
  padding: 16px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
}

@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }

/* ===== Selección de programas (packs) ===== */
.check-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--borde);
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  background: #fff;
}

.check-item:hover { background: var(--azul-claro); }

.check-item input { margin-top: 3px; accent-color: var(--azul); }

.check-cuerpo { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.check-titulo { font-size: 13px; line-height: 1.35; color: #111827; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
  }
  .menu { display: flex; flex-wrap: wrap; gap: 4px; }
  .menu-item { flex: 1 1 auto; justify-content: center; }
  .menu-icono { display: none; }
  .contenido { padding: 16px; }
}
