/* Horus - VPN Mikrotik | ENI Networks
   Paleta compartida por todas las paginas. Siempre en modo claro --
   no se adapta a prefers-color-scheme, para que se vea igual en
   cualquier dispositivo (antes se ponia oscuro en celulares con tema
   oscuro y se veia mal). */
:root {
  --eni-verde: #2f7a1f;
  --eni-verde-fuerte: #235c17;
  --nb-morado: #5b21b6;
  --nb-morado-claro: #7c3aed;
  --fondo: #f5f6f4;
  --panel: #ffffff;
  --texto: #1c2321;
  --texto-suave: #5b665f;
  --borde: #dfe3dd;
  --peligro: #b3261e;
  --peligro-fondo: #fbe9e7;
  --exito: #1b7a3d;
  --exito-fondo: #e8f5e9;
  --advertencia: #8a6d1a;
  --advertencia-fondo: #fbf3d9;
  --sombra: 0 1px 2px rgba(20, 30, 20, 0.06), 0 8px 24px rgba(20, 30, 20, 0.06);
  --radio: 10px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font-family: "IBM Plex Sans", "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
code, pre, .mono { font-family: "IBM Plex Mono", "Consolas", monospace; }

a { color: var(--eni-verde); }

.marca {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
}
.marca .logo-marca {
  height: 52px;
  width: auto;
  display: block;
}
.marca .marca-separador {
  width: 1px;
  height: 40px;
  background: var(--borde);
}
.marca .marca-texto {
  font-size: 1.15rem;
  color: var(--texto);
}
.marca .logo-marca-horus {
  height: 52px;
  width: auto;
  display: block;
}

.pantalla-centrada {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.tarjeta {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 2rem;
}
.tarjeta h1 { font-size: 1.15rem; margin: 1.1rem 0 0.25rem; }
.tarjeta p.subtitulo { color: var(--texto-suave); margin: 0 0 1.4rem; font-size: 0.92rem; }

label { display: block; font-size: 0.85rem; font-weight: 600; margin: 0.9rem 0 0.3rem; }
input, select, textarea {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--borde);
  border-radius: 8px;
  background: var(--fondo);
  color: var(--texto);
  font-size: 0.95rem;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--eni-verde); outline-offset: 1px; }
textarea { resize: vertical; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 0.65rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
}
.btn-primario { width: 100%; margin-top: 1.3rem; background: var(--eni-verde); color: #fff; }
.btn-primario:hover { background: var(--eni-verde-fuerte); }
.btn-primario:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-secundario { background: transparent; color: var(--texto); border: 1px solid var(--borde); }
.btn-peligro { background: var(--peligro); color: #fff; }
.btn-link { background: none; padding: 0; color: var(--eni-verde); font-weight: 600; text-decoration: underline; }

/* Boton hecho de un <a> en vez de un <button> (ej. "Volver a routers" en
   control.html/actualizaciones.html). El selector "button" de arriba (que
   le da la forma: relleno, esquinas redondeadas, sin subrayado) solo
   aplica a elementos <button> -- sin esta clase, un <a class="btn-secundario">
   se queda solo con el color/borde y se ve como texto subrayado plano en
   vez de un boton real. Se usa junto con .btn-secundario (o el que sea). */
.enlace-boton {
  display: inline-block;
  text-decoration: none;
  cursor: pointer;
  border-radius: 8px;
  padding: 0.65rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.enlace-abajo { text-align: center; margin-top: 1.1rem; font-size: 0.88rem; color: var(--texto-suave); }

.mensaje { border-radius: 8px; padding: 0.7rem 0.9rem; font-size: 0.88rem; margin-top: 1rem; display: none; }
.mensaje.visible { display: block; }
.mensaje.error { background: var(--peligro-fondo); color: var(--peligro); }
.mensaje.exito { background: var(--exito-fondo); color: var(--exito); }

/* --- Layout de app (routers.html / router.html) --- */
.encabezado {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.9rem 1.5rem; background: var(--panel); border-bottom: 1px solid var(--borde);
}
.encabezado .usuario { display: flex; align-items: center; gap: 0.8rem; font-size: 0.88rem; color: var(--texto-suave); }
/* ANCHO ampliado 17-sep-2026 (Sal: "estamos desperdiciando mucho
   espacio hacia los costados") -- en monitores anchos (1920px+) el
   1100px de antes dejaba ~400px vacios de cada lado. 1400px sigue
   respetando el 92vw en pantallas mas chicas (tablets/laptops de
   13-14") gracias al min(). */
main.contenedor { max-width: min(1400px, 92vw); margin: 0 auto; padding: 1.6rem 1.5rem 3rem; }

.barra-titulo { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.2rem; flex-wrap: wrap; gap: 0.8rem; }
.barra-titulo h1 { font-size: 1.3rem; margin: 0; }

table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio); overflow: hidden; }
th, td { text-align: left; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--borde); font-size: 0.9rem; }
th { color: var(--texto-suave); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: none; }
/* OJO: nada de "display:flex" aqui -- un <td> con display:flex deja de
   comportarse como celda de tabla, y eso es justo lo que descuadraba la
   columna de acciones cuando el sitio ocupa 2 renglones (ej. "San Jose
   Iturbide") -- reportado por Sal, 15-sep-2026. Los botones ya son
   inline-flex (ver mas abajo), asi que se acomodan solos en linea. */
td.acciones { white-space: nowrap; vertical-align: middle; }
td.acciones button { padding: 0.35rem 0.7rem; font-size: 0.82rem; }

/* --- Botones de accion con icono en tablas (Editar/Probar/Eliminar/
   Revocar) -- mismo patron que .btn-toggle-password: SVG outline,
   sin fondo, y solo se pinta al pasar el mouse. El texto va en
   title/aria-label (tooltip nativo), no visible, para que la fila no
   se sienta llena de letras. --- */
td.acciones .btn-icono {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; padding: 0; font-size: inherit;
  border-radius: 6px; background: transparent; border: 1px solid transparent;
  color: var(--texto-suave); cursor: pointer;
  margin-right: 0.3rem;
}
td.acciones .btn-icono:last-child { margin-right: 0; }
td.acciones .btn-icono:hover { background: var(--fondo); border-color: var(--borde); color: var(--eni-verde); }
td.acciones .btn-icono:disabled { opacity: 0.45; cursor: not-allowed; background: transparent; border-color: transparent; }
td.acciones .btn-icono.peligro:hover { background: var(--peligro-fondo); border-color: var(--peligro-fondo); color: var(--peligro); }
td.acciones .btn-icono svg { width: 18px; height: 18px; }

.chip { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.76rem; font-weight: 600; }
.chip.activo { background: var(--exito-fondo); color: var(--exito); }
.chip.revocado, .chip.expirado { background: var(--peligro-fondo); color: var(--peligro); }
.chip.advertencia { background: var(--advertencia-fondo); color: var(--advertencia); }
.chip.sin-datos { background: var(--borde); color: var(--texto-suave); }

.vacio { text-align: center; padding: 3rem 1rem; color: var(--texto-suave); }

/* --- Modal --- */
.fondo-modal {
  position: fixed; inset: 0; background: rgba(10, 15, 8, 0.45);
  display: none; align-items: flex-start; justify-content: center;
  padding: 3rem 1rem; overflow-y: auto; z-index: 50;
}
.fondo-modal.visible { display: flex; }
.modal {
  width: 100%; max-width: 480px; background: var(--panel); border: 1px solid var(--borde);
  border-radius: var(--radio); box-shadow: var(--sombra); padding: 1.6rem;
}
.modal h2 { margin: 0 0 0.2rem; font-size: 1.05rem; }
.modal p.ayuda { color: var(--texto-suave); font-size: 0.85rem; margin: 0.2rem 0 0; }
.modal .pie { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1.3rem; }

.rejilla-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 0.8rem; }
@media (max-width: 480px) { .rejilla-2 { grid-template-columns: 1fr; } }

.detalle-qr { text-align: center; }
.detalle-qr img { width: 220px; height: 220px; border: 1px solid var(--borde); border-radius: 8px; padding: 0.6rem; background: #fff; }
.detalle-qr textarea {
  width: 100%; min-height: 140px; margin-top: 0.9rem; font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem; padding: 0.6rem; border: 1px solid var(--borde); border-radius: 8px;
  background: var(--fondo); color: var(--texto); resize: vertical;
}

.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.5); border-top-color: #fff; border-radius: 50%; animation: girar 0.7s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }

.oculto { display: none !important; }
.enlace-superior { font-size: 0.85rem; color: var(--texto-suave); text-decoration: none; }
.enlace-superior:hover { text-decoration: underline; }

/* --- Campo de contraseña con boton de mostrar/ocultar (icono de ojo) --- */
.campo-password { position: relative; }
.campo-password input { padding-right: 2.6rem; }
.btn-toggle-password {
  position: absolute; right: 0.35rem; top: 50%; transform: translateY(-50%);
  background: transparent; border: none; color: var(--texto-suave);
  cursor: pointer; padding: 0.35rem; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
}
.btn-toggle-password:hover { color: var(--eni-verde); }
.btn-toggle-password[hidden] { display: none; }

/* --- Menu de usuario: avatar con iniciales + dropdown (mismo patron que
   Sistema de Folios) en vez de nombre+boton sueltos. --- */
.usuario-menu-envoltura { position: relative; }
.usuario-actual {
  display: flex; align-items: center; gap: 0.65rem;
  background: transparent; border: none; padding: 0.3rem 0.4rem;
  border-radius: 8px; cursor: pointer; color: var(--texto);
  font-family: inherit; text-align: left;
}
.usuario-actual:hover { background: var(--fondo); }
.avatar-imagen {
  flex-shrink: 0; width: 2.2rem; height: 2.2rem; border-radius: 50%;
  background: #fff; display: flex; align-items: center; justify-content: center;
  border: 2px solid rgba(255,255,255,0.45); box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  overflow: hidden;
}
.avatar-imagen img { width: 78%; height: 78%; object-fit: contain; }
.usuario-info { display: flex; flex-direction: column; min-width: 0; }
.usuario-nombre {
  font-size: 0.88rem; font-weight: 700; color: var(--texto);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 11rem;
}
.usuario-rol {
  font-size: 0.68rem; font-weight: 700; color: var(--eni-verde);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.usuario-dropdown {
  position: absolute; top: calc(100% + 0.6rem); right: 0; min-width: 200px;
  background: var(--panel); border: 1px solid var(--borde); border-radius: 10px;
  box-shadow: var(--sombra); overflow: hidden; z-index: 30;
}
.usuario-dropdown[hidden] { display: none; }
.usuario-dropdown button, .usuario-dropdown a {
  display: flex; align-items: center; gap: 0.6rem; width: 100%; text-align: left;
  background: none; border: none; padding: 0.7rem 0.9rem; font-size: 0.85rem;
  font-weight: 600; font-family: inherit; color: var(--texto); cursor: pointer;
  white-space: nowrap; text-decoration: none; box-sizing: border-box;
}
.usuario-dropdown button:hover, .usuario-dropdown a:hover { background: var(--fondo); }
@media (max-width: 480px) { .usuario-info { display: none; } }

/* --- Fondo con "halo" detras de la tarjeta en las pantallas de acceso
   (acceso/login/recuperar/restablecer) -- sin esto se ve como "un cuadro
   solo en un fondo enorme y vacio", que es justo la queja: se veia poco
   profesional. Mismo criterio que ya usa Sistema de Folios en su login,
   adaptado a la paleta verde de Horus (claro, no oscuro). --- */
body.fondo-auth {
  background:
    radial-gradient(720px 720px at 50% 32%, rgba(47, 122, 31, 0.12) 0%, rgba(47, 122, 31, 0) 62%),
    radial-gradient(1100px 650px at 10% -10%, rgba(47, 122, 31, 0.09) 0%, rgba(47, 122, 31, 0) 55%),
    radial-gradient(900px 550px at 92% -8%, rgba(91, 33, 182, 0.07) 0%, rgba(91, 33, 182, 0) 50%),
    var(--fondo);
  background-attachment: fixed;
}


/* Franja de marca en la orilla superior de la tarjeta de acceso. */
.tarjeta { position: relative; overflow: hidden; }
.tarjeta::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--eni-verde), var(--nb-morado-claro));
}
