/* Pantalla de acceso: un mazo de hilos del que salen tres conductores, uno por
   cada control del formulario. Los colores recuerdan a los de norma: fase,
   neutro y tierra. Solo la carga views/seguridad/login.php. */

.acceso {
  --noche: #121826;
  --noche-hilo: #8fa3c8;
  --hoja: #ffffff;
  --tinta: #141a26;
  --tinta-suave: #5b6478;
  --campo: #f3f5fa;
  --campo-borde: #dde2ee;
  --foco: #3b63f0;
  --fase: #c9743a;
  --neutro: #4f7cff;
  --tierra: #8fae1a;

  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(460px, 1fr);
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  background: var(--hoja);
  color: var(--tinta);
}

:root[data-theme="dark"] .acceso {
  --noche: #0a0d13;
  --hoja: #151820;
  --tinta: #e8ecf5;
  --tinta-suave: #9aa4b8;
  --campo: #1d212c;
  --campo-borde: #2f3545;
}

/* Panel de los hilos */
.acceso-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 36px 44px;
  background: var(--noche);
}
.acceso-nombre,
.acceso-lema { position: relative; z-index: 2; }
.acceso-nombre {
  font-family: 'Syne', var(--fuente);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .08em;
  color: #eef1f7;
}
.acceso-lema { font-size: 14px; color: #aab3c5; }

/* Formulario */
.acceso-hoja {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 64px 48px 88px;
  background: var(--hoja);
}
.acceso-contenido { position: relative; z-index: 2; width: 100%; max-width: 360px; }
.acceso-titulo {
  margin-bottom: 30px;
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -.02em;
  color: var(--tinta);
}
.acceso-contenido .form-group { margin-bottom: 20px; gap: 7px; }
.acceso-contenido .form-label {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--tinta);
}
.acceso-contenido .form-control {
  height: 48px;
  padding: 0 15px;
  font-size: 15.5px;
  color: var(--tinta);
  background: var(--campo);
  border: 1px solid var(--campo-borde);
  border-radius: 12px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.acceso-contenido .form-control:focus {
  background: var(--hoja);
  border-color: var(--foco);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--foco) 22%, transparent);
}
.acceso-contenido .btn-primary {
  width: 100%;
  height: 48px;
  justify-content: center;
  margin-top: 8px;
  font-size: 15.5px;
  font-weight: 600;
  color: #fff;
  background: var(--foco);
  border-color: var(--foco);
  border-radius: 12px;
  transition: background .2s, box-shadow .35s;
}
.acceso-contenido .btn-primary:hover { background: #2c50d6; border-color: #2c50d6; }
.acceso-contenido .btn:focus-visible { outline: 2px solid var(--foco); outline-offset: 2px; }
/* Con los tres conductores conectados, el botón se enciende */
.acceso-contenido form.con-tension .btn-primary { box-shadow: 0 8px 24px color-mix(in srgb, var(--foco) 42%, transparent); }

.acceso-contenido .alert { margin-bottom: 20px; border-radius: 12px; }
.acceso-volver { margin-top: 10px; }
.acceso-volver .btn-ghost { width: 100%; justify-content: center; color: var(--tinta-suave); }

/* Hilos y conductores */
.acceso-hilos { position: absolute; top: 0; left: 0; z-index: 1; display: block; pointer-events: none; }
.acceso-hilos path { fill: none; stroke-linecap: round; }

.hilo {
  stroke: var(--noche-hilo);
  stroke-width: 1;
  stroke-opacity: .26;
  stroke-dasharray: var(--largo) var(--largo);
  stroke-dashoffset: var(--largo);
  transition: stroke-dashoffset 1.5s cubic-bezier(.3, .7, .2, 1) calc(var(--i) * 16ms), stroke-opacity .6s;
}
.acceso-hilos.tendido .hilo { stroke-dashoffset: 0; }
.acceso-hilos.con-tension .hilo { stroke-opacity: .46; }

/* Corriente de fondo: unos pocos destellos lentos */
.chispa {
  stroke: #cfdcff;
  stroke-opacity: .5;
  stroke-width: 1.4;
  stroke-dasharray: 90px var(--largo);
  stroke-dashoffset: 90px;
  animation: corriente var(--t) linear var(--d) infinite;
}
@keyframes corriente {
  from { stroke-dashoffset: 90px; }
  to { stroke-dashoffset: calc(var(--largo) * -1); }
}

.cable-L { --color: var(--fase); }
.cable-N { --color: var(--neutro); }
.cable-PE { --color: var(--tierra); }
.cable .base { stroke: var(--color); stroke-width: 1.5; stroke-opacity: 0; transition: stroke-opacity .8s .9s; }
.acceso-hilos.tendido .cable .base { stroke-opacity: .75; }
.cable .vivo {
  stroke: var(--color);
  stroke-width: 2.5;
  stroke-dasharray: var(--largo) var(--largo);
  stroke-dashoffset: var(--largo);
  transition: stroke-dashoffset .8s cubic-bezier(.4, .1, .2, 1);
}
.cable.conectado .vivo { stroke-dashoffset: 0; }

.cable .nodo { fill: var(--hoja); stroke: var(--color); stroke-width: 2; opacity: 0; transition: fill .25s, opacity .8s .9s; }
.acceso-hilos.tendido .cable .nodo { opacity: 1; }
.cable.conectado .nodo { fill: var(--color); transition: fill .25s .6s, opacity .8s .9s; }

.acceso-hilos.midiendo path { transition: none; }

/* Móvil: los hilos cruzan una banda superior y los conductores bajan por el margen */
@media (max-width: 860px) {
  .acceso { grid-template-columns: minmax(0, 1fr); grid-template-rows: 168px 1fr; }
  .acceso-panel { padding: 22px 20px 18px 44px; }
  .acceso-hoja { align-items: flex-start; padding: 34px 20px 40px 44px; }
  .acceso-contenido { max-width: 460px; }
  .acceso-titulo { margin-bottom: 24px; font-size: 24px; }
  .acceso-lema { font-size: 13px; }
}

@media (max-width: 860px) and (max-height: 500px) {
  .acceso { grid-template-rows: 88px 1fr; }
  .acceso-panel { padding-top: 14px; padding-bottom: 12px; }
  .acceso-hoja { padding-top: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .hilo, .cable .base, .cable .vivo, .cable .nodo { transition: none !important; }
  .chispa { display: none; }
}
