/* Pantalla de entrada (rediseño 2026-10-16). A la izquierda, el arco de la marca con
   las rutas del día en los colores de cada área del menú; a la derecha, el formulario.
   Las animaciones se apagan con prefers-reduced-motion. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("/static/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("/static/fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/static/fonts/fraunces-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Fraunces";
  font-style: italic;
  font-weight: 300 700;
  font-display: swap;
  src: url("/static/fonts/fraunces-italic-latin.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --ink: #1E2427;
  --ink-2: #3B4548;
  --muted: #5E6B70;
  --line: #D4D8D6;
  --paper: #F3F4F2;
  --panel: #FFFFFF;
  --sage: #9DABA6;
  --night: #152022;
  --danger: #9A2E25;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
  line-height: 1.45;
}
button, input { font: inherit; }

/* ---------- distribución ---------- */
.login-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
}
.login-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px 24px;
  gap: 18px;
}

/* ---------- panel de marca ---------- */
.login-brand {
  position: relative;
  overflow: hidden;
  background: var(--night);
  color: #EEF1EF;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px clamp(28px, 5vw, 64px);
  isolation: isolate;
  --mx: 0;
  --my: 0;
}
/* auroras lentas al fondo */
.login-brand::before, .login-brand::after {
  content: "";
  position: absolute;
  width: 70vmax;
  height: 70vmax;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .32;
  z-index: -2;
  pointer-events: none;
}
.login-brand::before { background: radial-gradient(circle, #3F6345 0%, transparent 60%); left: -30vmax; top: -30vmax; animation: drift 26s ease-in-out infinite alternate; }
.login-brand::after { background: radial-gradient(circle, #7A4A6E 0%, transparent 60%); right: -34vmax; bottom: -36vmax; animation: drift 32s ease-in-out infinite alternate-reverse; }
.brand-grid {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(80% 70% at 50% 55%, #000 35%, transparent 100%);
  -webkit-mask-image: radial-gradient(80% 70% at 50% 55%, #000 35%, transparent 100%);
}
.brand-top { display: flex; align-items: baseline; gap: 12px; animation: rise 700ms var(--ease) both; }
.brand-word { font-family: "Fraunces", Georgia, serif; font-size: 26px; font-weight: 500; letter-spacing: -.01em; }
.brand-tag { font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--sage); }
.brand-art {
  position: relative;
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 18px 0;
}
.brand-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  transform: translate3d(calc(var(--mx) * -6px), calc(var(--my) * -4px), 0);
  transition: transform 600ms var(--ease);
  animation: rise 900ms var(--ease) .1s both;
}

/* arco y tarjetas forman un solo bloque, centrado, que crece con la pantalla */
.scene {
  position: relative;
  width: min(520px, calc(50vw - 330px), calc(62vh * .85));
  min-width: 300px;
}

/* el arco */
.arch { fill: none; stroke-linecap: round; }
.arch-line { stroke: var(--sage); stroke-width: 3; stroke-dasharray: 1300; stroke-dashoffset: 1300; animation: draw 2.2s var(--ease) .15s forwards; }
.arch-glow { stroke: rgba(157,171,166,.16); stroke-width: 28; opacity: 0; animation: fade 1.6s ease 1.2s forwards; }
.arch-run {
  /* una luz que recorre el arco */
  stroke: #F2E3C6;
  stroke-width: 3.5;
  stroke-dasharray: 70 1230;
  stroke-dashoffset: 1300;
  opacity: 0;
  filter: drop-shadow(0 0 6px #F2E3C6);
  animation: fade .6s ease 2.2s forwards, run 7s linear 2.2s infinite;
}
.ground { stroke: rgba(157,171,166,.35); stroke-width: 1.5; stroke-dasharray: 360; stroke-dashoffset: 360; animation: draw 1.6s var(--ease) .4s forwards; }

/* el cielo cambia despacio: atardecer → noche → atardecer */
.sky-a { stop-color: #1B2A2E; animation: skyA 24s ease-in-out infinite alternate; }
.sky-b { stop-color: #31504B; animation: skyB 24s ease-in-out infinite alternate; }
.sky-c { stop-color: #C98F6B; animation: skyC 24s ease-in-out infinite alternate; }
.sun { transform-box: fill-box; transform-origin: center; animation: sunset 24s ease-in-out infinite alternate; }
.stars circle { fill: #F4EEDD; opacity: 0; animation: twinkle 5s ease-in-out var(--d) infinite; }

/* la ciudad */
.skyline { fill: #0F1A1C; stroke: rgba(157,171,166,.12); stroke-width: .8; transform: translateY(40px); opacity: 0; animation: city 1.4s var(--ease) .6s forwards; }
.skyline, .windows { translate: calc(var(--mx) * 4px) 0; transition: translate 600ms var(--ease); }
.windows rect { fill: #F3D9A4; opacity: 0; animation: lit var(--t) ease-in-out calc(1.6s + var(--d)) infinite; }

/* estelas entre tejados */
.layer-far { translate: calc(var(--mx) * -3px) calc(var(--my) * -2px); transition: translate 600ms var(--ease); }
.arc { fill: none; stroke: var(--c); stroke-width: 1.2; stroke-linecap: round; opacity: .28; stroke-dasharray: 600; stroke-dashoffset: 600; animation: draw 1.8s var(--ease) var(--d) forwards; }
.layer-near { translate: calc(var(--mx) * -8px) calc(var(--my) * -5px); transition: translate 600ms var(--ease); }
.comet { fill: none; stroke: var(--c); stroke-width: 2.6; stroke-linecap: round; stroke-dasharray: 46 600; stroke-dashoffset: 46; opacity: 0; animation: comet var(--t) cubic-bezier(.45,.05,.35,1) var(--d) infinite; }
.land { fill: var(--c); opacity: 0; transform-box: fill-box; transform-origin: center; animation: land var(--t) ease-out var(--d) infinite; }

/* tarjetas de «lo que va pasando» */
.brand-events {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  transform: translate3d(calc(var(--mx) * -12px), calc(var(--my) * -8px), 0);
  transition: transform 600ms var(--ease);
}
.ev {
  position: absolute;
  width: 180px;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(21, 32, 34, .72);
  border: 1px solid rgba(255,255,255,.09);
  box-shadow: 0 12px 30px rgba(0,0,0,.28);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 13px;
  line-height: 1.3;
  color: #E7ECEA;
  animation: evIn 620ms var(--ease) both, float 5s ease-in-out 620ms infinite alternate;
}
.ev.out { animation: evOut 520ms var(--ease) forwards; }
.ev i { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 22%, transparent); }
.ev i::before { content: ""; width: 8px; height: 8px; border-radius: 99px; background: var(--c); box-shadow: 0 0 10px var(--c); }
.ev b { display: block; font-weight: 700; font-size: 13px; }
.ev small { color: #9FB0AB; font-size: 11.5px; }

.brand-copy { animation: rise 800ms var(--ease) .5s both; }
.brand-claim {
  margin: 0 0 10px;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(28px, 3.1vw, 40px);
  line-height: 1.12;
  font-weight: 400;
  letter-spacing: -.015em;
}
.brand-claim em { font-style: italic; color: var(--sage); }
.brand-sub { margin: 0 0 22px; color: #B9C3C0; font-size: 15px; }
.brand-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: #C9D1CE; }
.brand-legend li { display: inline-flex; align-items: center; gap: 8px; }
.brand-legend span { width: 8px; height: 8px; border-radius: 99px; display: inline-block; }

/* ---------- formulario ---------- */
.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid #E1E4E2;
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(30,36,39,.04), 0 24px 60px rgba(30,36,39,.10);
  padding: 34px 32px 26px;
  animation: rise 600ms var(--ease) .1s both;
}
.login-card.has-error { animation: rise 600ms var(--ease) .1s both, shake 420ms ease .75s; }
.login-logo { display: block; width: 168px; max-width: 70%; height: auto; margin: 0 0 22px; }
.login-title { margin-bottom: 22px; }
.login-eyebrow { display: block; font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: #3F6345; margin-bottom: 4px; }
.login-title h1 { margin: 0 0 6px; font-family: "Fraunces", Georgia, serif; font-weight: 500; font-size: 34px; letter-spacing: -.015em; line-height: 1.1; }
.meta, .help, .login-help { color: var(--muted); font-size: 14px; margin: 0; }
form { display: grid; gap: 16px; margin: 0; }
.field { display: grid; gap: 7px; font-weight: 700; font-size: 14px; color: var(--ink-2); }
form > * { animation: rise 500ms var(--ease) both; }
form > :nth-child(2) { animation-delay: .25s; }
form > :nth-child(3) { animation-delay: .32s; }
form > :nth-child(4) { animation-delay: .39s; }
form > :nth-child(5) { animation-delay: .46s; }
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px 13px 44px;
  background: #FBFBFA no-repeat 14px center / 18px;
  color: var(--ink);
  min-height: 50px;
  outline: none;
  font-size: 16px;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}
input:hover { border-color: #B4BCB8; background-color: #fff; }
input:focus { border-color: #3F6345; background-color: #fff; box-shadow: 0 0 0 4px rgba(63, 99, 69, .15); }
input[name="username"] { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237A868A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 20c1.5-4 5-6 8-6s6.5 2 8 6'/%3E%3C/svg%3E"); }
input[name="password"] { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237A868A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='11' width='14' height='9' rx='2'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E"); }
.has-error input { border-color: #B4443B; }
.password-field { display: grid; grid-template-columns: 1fr 52px; align-items: stretch; }
.password-field input { border-radius: 12px 0 0 12px; border-right: 0; }
.password-field:focus-within .password-toggle { border-color: #3F6345; background: #fff; }
.password-toggle {
  border: 1px solid var(--line);
  border-radius: 0 12px 12px 0;
  background: #FBFBFA;
  color: var(--ink-2);
  cursor: pointer;
  min-height: 50px;
  display: grid;
  place-items: center;
  transition: background-color 160ms ease, border-color 160ms ease;
}
.password-toggle:hover { background: #EEF0EE; }
.password-toggle:focus-visible { outline: 3px solid rgba(59,69,72,.35); outline-offset: 2px; }
.password-toggle svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.password-toggle .eye-open, .password-toggle .eye-closed { transform-origin: center; transition: opacity 160ms ease, transform 180ms ease; }
.password-toggle .eye-open { opacity: 0; transform: scale(.82); }
.password-toggle .eye-closed { opacity: 1; transform: scale(1); }
.password-toggle[aria-pressed="true"] .eye-open { opacity: 1; transform: scale(1); }
.password-toggle[aria-pressed="true"] .eye-closed { opacity: 0; transform: scale(.82); }
.caps-hint { margin: -6px 0 0; font-size: 13px; font-weight: 700; color: #8A5200; }

button[type="submit"] {
  position: relative;
  overflow: hidden;
  border: 0;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  padding: 14px 18px;
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 4px;
  transition: background-color 160ms ease, box-shadow 200ms ease, transform 160ms ease;
}
button[type="submit"] .arrow { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform 200ms var(--ease); }
button[type="submit"]::after {
  /* brillo que cruza el botón al pasar el ratón */
  content: "";
  position: absolute;
  inset: 0 auto 0 -40%;
  width: 40%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.16), transparent);
  transform: skewX(-20deg);
  transition: left 600ms var(--ease);
}
@media (hover: hover) and (pointer: fine) {
  button[type="submit"]:hover { background: #2C3538; box-shadow: 0 10px 24px rgba(30,36,39,.18); transform: translateY(-1px); }
  button[type="submit"]:hover .arrow { transform: translateX(3px); }
  button[type="submit"]:hover::after { left: 120%; }
}
button[type="submit"]:active { transform: translateY(0); }
button[type="submit"]:focus-visible { outline: 3px solid rgba(59,69,72,.4); outline-offset: 3px; }
button[type="submit"].is-submitting { cursor: wait; opacity: .94; }
.button-spinner { width: 16px; height: 16px; border-radius: 999px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; animation: spin .72s linear infinite; }

.alert.danger {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #FBE9E7;
  border: 1px solid #F0C4BE;
  color: var(--danger);
  border-radius: 10px;
  padding: 11px 13px;
  margin: 0 0 16px;
  font-weight: 700;
  font-size: 14.5px;
}
.login-help { margin-top: 18px; text-align: center; font-size: 13px; }
.login-copyright { color: var(--muted); font-size: 12.5px; text-align: center; margin: 0; animation: fade 1s ease .8s both; }

.local-admin-login { margin-top: 14px; padding-top: 14px; border-top: 1px solid #E1E4E2; }
.local-admin-login .help { text-align: center; margin: 8px 0 0; }
.secondary-submit { background: #E7EBE9 !important; color: var(--ink) !important; }
.secondary-submit:hover { background: #DCE2DF !important; }

/* ---------- animaciones ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.2); } to { opacity: 1; transform: scale(1); } }
@keyframes pulse { 0%, 100% { stroke-width: 2; } 50% { stroke-width: 4; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes run { to { stroke-dashoffset: 0; } }
@keyframes drift { from { transform: translate(0, 0) scale(1); } to { transform: translate(6vmax, 4vmax) scale(1.15); } }
@keyframes skyA { 0%, 30% { stop-color: #1B2A2E; } 100% { stop-color: #0E1719; } }
@keyframes skyB { 0%, 30% { stop-color: #31504B; } 100% { stop-color: #1A2C30; } }
@keyframes skyC { 0%, 30% { stop-color: #C98F6B; } 100% { stop-color: #3D3A52; } }
@keyframes sunset { 0%, 25% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(70px); opacity: .25; } }
@keyframes twinkle { 0%, 100% { opacity: 0; } 50% { opacity: .85; } }
@keyframes city { to { transform: none; opacity: 1; } }
@keyframes lit { 0%, 30% { opacity: 0; } 45%, 85% { opacity: .9; } 100% { opacity: 0; } }
@keyframes comet { 0% { stroke-dashoffset: 46; opacity: 0; } 8% { opacity: 1; } 80% { opacity: 1; } 100% { stroke-dashoffset: -560; opacity: 0; } }
@keyframes land { 0%, 72% { opacity: 0; transform: scale(.4); } 82% { opacity: 1; transform: scale(1.6); } 100% { opacity: 0; transform: scale(2.4); } }
@keyframes evIn { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes float { from { translate: 0 0; } to { translate: 0 -6px; } }
@keyframes evOut { to { opacity: 0; transform: translateY(-10px) scale(.96); } }
@keyframes shake { 10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(3px); } 30%, 50%, 70% { transform: translateX(-6px); } 40%, 60% { transform: translateX(6px); } }

/* ---------- tableta y móvil ---------- */
@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { padding: 22px 20px 0; min-height: 0; flex-direction: row; align-items: flex-end; justify-content: space-between; gap: 12px; overflow: hidden; height: 168px; }
  .brand-top { flex-direction: column; gap: 2px; align-self: center; }
  .brand-word { font-size: 24px; }
  .brand-art { flex: 0 0 auto; width: 150px; padding: 0; align-self: flex-end; }
  .scene { width: 150px; min-width: 0; margin: 0; }
  .brand-svg { width: 150px; margin-bottom: -28px; }
  .brand-copy, .brand-events { display: none; }
  .login-main { padding: 0 16px 24px; justify-content: flex-start; }
  .login-card { margin-top: -22px; position: relative; padding: 28px 22px 22px; border-radius: 18px; }
  .login-logo { display: none; }
}
@media (max-width: 380px) {
  .login-title h1 { font-size: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .arch-line, .ground { stroke-dashoffset: 0 !important; }
  .arch-glow { opacity: 1 !important; }
  .arch-run, .comet, .land { display: none; }
  .windows rect:nth-child(3n) { opacity: .8 !important; }
  .skyline { opacity: 1 !important; transform: none !important; }
  .arc { stroke-dashoffset: 0 !important; }
}
