/* Acceso a ORQUEST2. El mismo recorrido que en ORQUEST (correo, y después contraseña o primer acceso) contado como lo
   que la app hace: un flujo. Detrás, un lienzo de nodos y cables; dentro del panel, tres nodos que se van encendiendo
   y por cuyos cables corre un pulso con cada tecla. El violeta sigue siendo solo acción y avance. */
.auth-gate {
  --field: rgba(14, 14, 17, .78);
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow-x: hidden;
  overflow-y: auto;
  padding: clamp(16px, 3vh, 28px) clamp(16px, 3vw, 40px);
  background: radial-gradient(ellipse 80% 70% at 50% 45%, var(--ground-lift) 0, var(--ground) 70%);
  /* El acceso es siempre oscuro: su tinta no depende del tema del espacio de trabajo. */
  color: var(--ink);
  isolation: isolate;
  scrollbar-width: none;
  transition: opacity .58s ease, filter .58s ease;
}
.auth-gate::-webkit-scrollbar { display: none; }
.auth-gate.is-opening { opacity: 0; filter: blur(7px); pointer-events: none; }

.auth-flow { position: fixed; inset: 0; z-index: -2; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 1.2s var(--ease-out); }
.auth-flow.is-ready { opacity: 1; }
.auth-veil { position: fixed; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(ellipse 75% 80% at 50% 52%, rgba(13, 14, 18, 0) 0, rgba(13, 14, 18, .2) 60%, rgba(13, 14, 18, .72) 100%); }

.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.auth-brand { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .08em; }
.auth-brand b { color: var(--muted); font-weight: 500; }
.auth-private { margin: 0; color: var(--muted); font-size: 13px; }

.auth-stage { display: grid; place-items: center; padding: 24px 0; perspective: 1100px; }

/* El panel: cristal de grafito. Se inclina apenas hacia el puntero y un reflejo sigue al cursor por su borde. */
.auth-card {
  --mx: 50%; --my: 0px; --tilt-x: 0deg; --tilt-y: 0deg; --light: 0;
  position: relative;
  width: min(420px, 100%);
  padding: 32px 32px 28px;
  border: 1px solid var(--hairline);
  border-radius: 20px;
  background: rgba(30, 31, 35, .72);
  -webkit-backdrop-filter: blur(22px) saturate(110%);
  backdrop-filter: blur(22px) saturate(110%);
  box-shadow: 0 30px 70px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .08);
  text-align: center;
  transform: rotateX(var(--tilt-x)) rotateY(var(--tilt-y));
  transition: transform .35s var(--ease-out);
  animation: auth-arrive .7s var(--ease-out) both;
}
.auth-card::before, .auth-card::after { content: ''; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none; opacity: var(--light); transition: opacity .3s ease; }
.auth-card::before { background: radial-gradient(360px circle at var(--mx) var(--my), rgba(255, 255, 255, .055), transparent 65%); }
.auth-card::after {
  padding: 1px;
  background: radial-gradient(220px circle at var(--mx) var(--my), rgba(255, 255, 255, .55), transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.auth-card > * { position: relative; z-index: 1; }

.auth-card-logo { display: block; width: 52px; height: 52px; margin: 0 auto 18px; border-radius: 50%; }
#auth-title { margin: 0 0 8px; font-size: clamp(28px, 2.6vw, 32px); font-weight: 700; letter-spacing: -.03em; line-height: 1.1; text-wrap: balance; }
#auth-copy { margin: 0; color: var(--muted); }
#auth-title, #auth-copy { transition: opacity .14s ease, translate .14s ease; }
#auth-title.is-swapping, #auth-copy.is-swapping { opacity: 0; translate: 0 4px; }

/* El recorrido: tres nodos unidos por cables. */
.auth-rail { display: grid; grid-template-columns: repeat(3, 1fr); margin: 24px 0 0; padding: 0; list-style: none; }
.auth-rail li { position: relative; display: grid; justify-items: center; gap: 7px; color: var(--placeholder); font-size: 12px; font-weight: 500; transition: color .3s ease; }
.auth-node { position: relative; z-index: 1; display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid rgba(255, 255, 255, .18); border-radius: 50%; background: #17181c; color: var(--placeholder); transition: background-color .3s ease, border-color .3s ease, color .3s ease, box-shadow .3s ease; }
.auth-node svg { grid-area: 1 / 1; width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; transition: opacity .25s ease, scale .35s var(--ease-out); }
.auth-node .i-check { opacity: 0; scale: .4; stroke-width: 2.4; }
.auth-rail li.is-active { color: var(--ink); }
.auth-rail li.is-active .auth-node { border-color: var(--violet); color: var(--ink); box-shadow: 0 0 0 4px rgba(122, 90, 248, .2); }
.auth-rail li.is-active .auth-node::after { content: ''; position: absolute; inset: -1px; border: 1px solid var(--violet); border-radius: 50%; animation: auth-halo 2.4s ease-out infinite; }
.auth-rail li.is-done { color: var(--muted); }
.auth-rail li.is-done .auth-node { border-color: var(--violet); background: var(--violet); color: #fff; }
.auth-rail li.is-done .i-main { opacity: 0; scale: .4; }
.auth-rail li.is-done .i-check { opacity: 1; scale: 1; }
.auth-rail li.is-error .auth-node { border-color: #a8555c; background: #2c1c1f; color: #f6d2cc; box-shadow: 0 0 0 4px rgba(168, 85, 92, .18); }
.auth-rail li.is-error .auth-node::after { content: none; }
.auth-wire { position: absolute; top: 15px; left: calc(50% + 22px); width: calc(100% - 44px); height: 2px; border-radius: 1px; background: rgba(255, 255, 255, .14); }
.auth-wire::before { content: ''; position: absolute; inset: 0; border-radius: inherit; background: var(--violet); transform: scaleX(0); transform-origin: left; transition: transform .55s var(--ease-out); }
.auth-rail li.is-done .auth-wire::before { transform: scaleX(1); }
.auth-pulse { position: absolute; top: 0; left: 0; width: 16px; height: 2px; border-radius: 1px; background: var(--violet-soft); box-shadow: 0 0 8px 1px rgba(122, 90, 248, .9); animation: auth-pulse .5s cubic-bezier(.4, 0, .6, 1) both; }

/* Formulario: cada bloque se pliega y despliega con su altura real, sin saltos. */
.auth-form { margin: 8px 0 0; text-align: left; }
.auth-collapse { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .42s var(--ease-out), opacity .3s ease; }
.auth-collapse.is-open { grid-template-rows: 1fr; opacity: 1; }
.auth-clip { min-height: 0; overflow: hidden; margin: 0 -6px; padding: 0 6px; }
.auth-slot { padding: 10px 0 4px; }

.auth-field { position: relative; display: block; }
.auth-field input {
  width: 100%; height: 56px; margin: 0; padding: 22px 48px 6px 44px;
  border: 1px solid rgba(255, 255, 255, .16); border-radius: 14px;
  background: var(--field); color: var(--ink); caret-color: var(--violet);
  font: inherit; font-size: 15px;
  outline: 3px solid transparent; outline-offset: 1px;
  transition: border-color .18s ease, outline-color .18s ease;
}
.auth-field input::placeholder { color: transparent; transition: color .18s ease; }
.auth-field input:focus::placeholder { color: #7d7885; }
.auth-field input:hover { border-color: rgba(255, 255, 255, .26); }
.auth-field input:focus-visible { border-color: var(--violet); outline-color: rgba(122, 90, 248, .35); }
.auth-field input:-webkit-autofill { -webkit-text-fill-color: var(--ink); box-shadow: 0 0 0 40px #18181c inset; }
.auth-label { position: absolute; left: 44px; top: 17px; color: var(--placeholder); font-size: 15px; pointer-events: none; transform-origin: left top; transition: transform .2s var(--ease-out), color .2s ease; }
.auth-field input:focus ~ .auth-label, .auth-field input:not(:placeholder-shown) ~ .auth-label { transform: translateY(-9px) scale(.8); color: var(--muted); }
.auth-field input:-webkit-autofill ~ .auth-label { transform: translateY(-9px) scale(.8); color: var(--muted); }
.auth-icon { position: absolute; left: 15px; top: 19px; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: var(--placeholder); pointer-events: none; transition: color .2s ease; }
.auth-field:focus-within .auth-icon { color: var(--ink); }
.auth-trail { position: absolute; right: 8px; top: 8px; display: grid; place-items: center; width: 40px; height: 40px; }
.auth-trail svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* El visto se dibuja solo cuando el dato ya vale. */
.auth-valid { color: var(--violet-soft); pointer-events: none; }
.auth-valid path { stroke-dasharray: 22; stroke-dashoffset: 22; transition: stroke-dashoffset .35s var(--ease-out); }
.auth-field.is-valid .auth-valid path { stroke-dashoffset: 0; }

.auth-reveal { padding: 0; border: 0; border-radius: 10px; background: transparent; color: var(--placeholder); cursor: pointer; transition: color .18s ease, background-color .18s ease; }
.auth-reveal:hover { color: var(--ink); background: rgba(255, 255, 255, .06); }
.auth-reveal:focus-visible { outline: 3px solid rgba(122, 90, 248, .55); outline-offset: 0; color: var(--ink); }
.auth-reveal-strike { stroke-dasharray: 23; stroke-dashoffset: 23; transition: stroke-dashoffset .25s ease; }
.auth-reveal[aria-pressed="true"] .auth-reveal-strike { stroke-dashoffset: 0; }
.auth-caps { position: absolute; right: 52px; top: 17px; padding: 2px 8px; border: 1px solid rgba(255, 255, 255, .2); border-radius: 8px; background: #26272c; color: var(--ink); font-size: 11px; font-weight: 600; line-height: 16px; pointer-events: none; opacity: 0; translate: 4px 0; transition: opacity .18s ease, translate .18s ease; }
.auth-field.has-caps .auth-caps { opacity: 1; translate: 0 0; }
.auth-field.has-caps input { padding-right: 132px; }

.auth-identity { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 6px 0 12px; border: 1px solid var(--hairline); border-radius: 22px; background: rgba(14, 14, 17, .5); font-size: 14px; }
.auth-identity-mark { display: grid; place-items: center; flex: none; width: 20px; height: 20px; border-radius: 50%; background: var(--violet); color: #fff; }
.auth-identity-mark svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.auth-identity-email { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-identity-change { flex: none; height: 32px; padding: 0 12px; border: 0; border-radius: 16px; background: rgba(255, 255, 255, .08); color: var(--ink); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; transition: background-color .18s ease; }
.auth-identity-change:hover { background: rgba(255, 255, 255, .15); }
.auth-identity-change:focus-visible { outline: 3px solid rgba(122, 90, 248, .55); outline-offset: 1px; }

.auth-meter { display: flex; align-items: center; gap: 12px; margin: 0 2px 14px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.auth-meter-bar { flex: 1; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .14); overflow: hidden; }
.auth-meter-fill { display: block; height: 100%; border-radius: inherit; background: var(--violet); transform: scaleX(var(--fill, 0)); transform-origin: left; transition: transform .3s var(--ease-out); }
.auth-meter.is-complete .auth-meter-count { color: var(--ink); }

.auth-remember { display: flex; align-items: center; gap: 12px; padding: 2px; color: var(--ink); font-size: 14px; cursor: pointer; }
.auth-remember input { position: absolute; opacity: 0; pointer-events: none; }
.auth-switch { position: relative; flex: none; width: 38px; height: 22px; border-radius: 11px; background: rgba(255, 255, 255, .16); transition: background-color .22s ease; }
.auth-switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: translate .25s var(--ease-out); }
.auth-remember input:checked + .auth-switch { background: var(--violet); }
.auth-remember input:checked + .auth-switch::after { translate: 16px 0; }
.auth-remember input:focus-visible + .auth-switch { outline: 3px solid rgba(122, 90, 248, .55); outline-offset: 2px; }
.auth-remember-copy { display: grid; line-height: 1.35; }
.auth-remember-copy small { color: var(--muted); font-size: 12px; }

/* La acción: una luz sigue al puntero por dentro y la flecha avanza al acercarse. */
.auth-submit { --bx: 50%; position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 52px; margin: 14px 0 0; padding: 0 22px; border: 0; border-radius: 14px; background: var(--violet); color: #fff; font: inherit; font-size: 15px; font-weight: 650; cursor: pointer; overflow: hidden; transition: background-color .18s ease, translate .18s ease, scale .12s ease; }
.auth-submit::before { content: ''; position: absolute; inset: 0; background: radial-gradient(120px circle at var(--bx) 50%, rgba(255, 255, 255, .22), transparent 70%); opacity: 0; transition: opacity .25s ease; }
.auth-submit:hover:not(:disabled) { background: var(--violet-hover); translate: 0 -1px; }
.auth-submit:hover:not(:disabled)::before { opacity: 1; }
.auth-submit:active:not(:disabled) { scale: .985; translate: 0 0; }
.auth-submit:focus-visible { outline: 3px solid rgba(122, 90, 248, .55); outline-offset: 3px; }
.auth-submit:disabled { cursor: progress; }
.auth-submit > * { position: relative; }
.auth-submit svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.auth-submit-arrow { transition: translate .25s var(--ease-out); }
.auth-submit:hover:not(:disabled) .auth-submit-arrow { translate: 4px 0; }
.auth-submit-spinner { width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%; animation: auth-spin .7s linear infinite; }
.auth-submit-spinner, .auth-submit-check { display: none; }
.auth-submit.is-busy .auth-submit-arrow, .auth-submit.is-ok .auth-submit-arrow { display: none; }
.auth-submit.is-busy .auth-submit-spinner { display: block; }
.auth-submit.is-ok .auth-submit-check { display: block; animation: auth-pop .4s var(--ease-out) both; }

.auth-error { margin: 14px 0 0; padding: 10px 12px; border: 1px solid #6b3a3f; border-radius: 10px; background: rgba(44, 28, 31, .9); color: #f6d2cc; font-size: 13px; line-height: 1.45; text-align: left; animation: auth-error-in .3s var(--ease-out) both; }

/* Las entradas solo mueven: el contenido se ve desde el primer fotograma. */
@keyframes auth-arrive { from { translate: 0 14px; } to { translate: 0 0; } }
@keyframes auth-halo { from { scale: 1; opacity: .7; } 70%, to { scale: 1.7; opacity: 0; } }
@keyframes auth-pulse { from { left: 0; opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } to { left: calc(100% - 16px); opacity: 0; } }
@keyframes auth-spin { to { rotate: 360deg; } }
@keyframes auth-pop { from { scale: .4; } to { scale: 1; } }
@keyframes auth-error-in { from { translate: 0 -4px; } to { translate: 0 0; } }

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .auth-card { background: var(--panel); }
}

@media (max-width: 600px) {
  .auth-card { padding: 26px 20px 22px; }
}
@media (max-width: 460px) {
  .auth-private { display: none; }
}
@media (max-height: 700px) {
  .auth-card-logo, #auth-copy { display: none; }
  .auth-rail { margin-top: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-gate, .auth-gate *, .auth-gate *::before, .auth-gate *::after { animation: none !important; transition-duration: .01ms !important; }
  .auth-card { transform: none; }
}
