:root {
  /* Paleta institucional de INCASE, compartida con reportes.css. */
  --brand:        #1B8A5A;
  --brand-strong: #146443;
  --brand-soft:   #DFF3E7;
  --paper:        #DDDEEA;
  --paper-raised: #FFFFFF;
  --ink:          #5C5A59;
  --ink-soft:     #807E7C;
  --ink-faint:    #A9A7A5;
  --line:         rgba(92, 90, 89, 0.14);
  --line-strong:  rgba(92, 90, 89, 0.30);
  --danger:       #A5303E;
  --danger-soft:  #F8D7DA;
  --focus-ring:   rgba(27, 138, 90, 0.28);
  --shadow-card:  0 24px 60px -20px rgba(16, 69, 47, 0.38);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14231C; --paper-raised: #1D3026;
    --brand: #5ECB91; --brand-strong: #8CDEB0; --brand-soft: #223E2F;
    --ink: #E9F0EB; --ink-soft: #B1C4B8; --ink-faint: #7F9989;
    --line: rgba(234,232,240,.10); --line-strong: rgba(234,232,240,.22);
    --danger: #F0899A; --danger-soft: rgba(240,137,154,.14);
    --focus-ring: rgba(94,203,145,.35);
    --shadow-card: 0 24px 60px -20px rgba(0,0,0,.6);
  }
}
:root[data-theme="dark"] {
  --paper: #14231C; --paper-raised: #1D3026;
  --brand: #5ECB91; --brand-strong: #8CDEB0; --brand-soft: #223E2F;
  --ink: #E9F0EB; --ink-soft: #B1C4B8; --ink-faint: #7F9989;
  --line: rgba(234,232,240,.10); --line-strong: rgba(234,232,240,.22);
  --danger: #F0899A; --danger-soft: rgba(240,137,154,.14);
  --focus-ring: rgba(94,203,145,.35);
  --shadow-card: 0 24px 60px -20px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; min-height: 100%;
  background: var(--paper); color: var(--ink);
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body { display: grid; place-items: center; padding: 2rem 1rem; }

.stage {
  position: relative;
  width: 100%; max-width: 1240px;
  display: grid; grid-template-columns: 1.35fr 1fr;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  min-height: 700px;
}

.theme-toggle {
  position: absolute; top: .8rem; right: .8rem; z-index: 6;
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--paper-raised); color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.theme-toggle:hover { background: var(--paper); color: var(--ink); }
.theme-toggle svg { display: none; }
.theme-toggle.mode-light .icon-moon { display: block; }
.theme-toggle.mode-dark .icon-sun { display: block; }

/* ---------- Panel de marca (izquierda) ---------- */
.brandside {
  position: relative;
  padding: 3rem 2.75rem;
  display: flex; flex-direction: column; justify-content: space-between;
  background: var(--brand-strong);
  color: #fff;
  overflow: hidden;
}
/* Fotos reales del equipo de INCASE: en reposo se ven en gris oscuro, y
   al pasar el mouse revelan su color real. El desvanecimiento cruzado
   entre las 6 fotos es lento a propósito. */
.photo-layer {
  position: absolute; inset: 0; z-index: 0;
  background-size: cover; background-position: center top;
  opacity: 0;
  filter: grayscale(.92) brightness(.68) contrast(1.08);
  animation: photoFade 33s ease-in-out infinite;
  transition: filter 1.1s ease;
}
.photo-layer:nth-of-type(1) { animation-delay: 0s; }
.photo-layer:nth-of-type(2) { animation-delay: -5.5s; }
.photo-layer:nth-of-type(3) { animation-delay: -11s; }
.photo-layer:nth-of-type(4) { animation-delay: -16.5s; }
.photo-layer:nth-of-type(5) { animation-delay: -22s; }
.photo-layer:nth-of-type(6) { animation-delay: -27.5s; }
@keyframes photoFade {
  0%, 100% { opacity: 0; }
  6%       { opacity: 1; }
  11%      { opacity: 1; }
  17%      { opacity: 0; }
}
.brandside:hover .photo-layer { filter: grayscale(0) brightness(1) contrast(1); }

/* Verde de INCASE en movimiento continuo — se atenúa al revelar la
   foto en hover, como si el color "pasara" por el verde. */
.brandside::before {
  content: ''; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(120deg,
    var(--brand) 0%, var(--brand-strong) 30%, #C9A227 50%,
    var(--brand-strong) 70%, var(--brand) 100%);
  background-size: 250% 250%;
  mix-blend-mode: multiply;
  opacity: .78;
  animation: colorShift 11s ease-in-out infinite;
  transition: opacity .8s ease;
}
.brandside:hover::before { opacity: .4; }
@keyframes colorShift {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}
.brandside::after {
  content: ''; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(to top, rgba(7,35,23,.78) 0%, rgba(7,35,23,.2) 45%, transparent 75%);
}
@media (prefers-reduced-motion: reduce) {
  .brandside::before { animation: none; background-position: 30% 50%; }
  .photo-layer { animation: none; opacity: 0; transition: filter .3s ease; }
  .photo-layer:nth-of-type(1) { opacity: 1; }
}

.brand-mark {
  display: flex; align-items: center; justify-content: space-between;
  gap: .65rem; position: relative; z-index: 2;
}
.brand-mark img { height: 22px; width: auto; filter: drop-shadow(0 2px 6px rgba(0,0,0,.35)) brightness(0) invert(1); }
.brand-mark span {
  font-weight: 500; font-size: .72rem; letter-spacing: .14em;
  text-transform: uppercase; color: rgba(255,255,255,.75);
}

.brand-headline { position: relative; z-index: 2; }
.brand-headline h1 {
  margin: 0 0 .9rem;
  font-size: clamp(1.8rem, 2.8vw, 2.4rem);
  line-height: 1.14; text-wrap: balance; letter-spacing: -.01em;
}
.brand-headline h1 b { font-weight: 900; }
.brand-headline p {
  margin: 0; max-width: 34ch;
  font-size: .95rem; line-height: 1.6; color: rgba(255,255,255,.82);
}

/* Lo que el sistema hace en concreto — reemplaza un párrafo largo por
   renglones cortos, grounded en los módulos reales (no una lista
   de features genérica). Le da estructura al panel y aprovecha el
   alto extra de la tarjeta en vez de dejarlo vacío. */
.brand-features {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; gap: .65rem;
  margin-top: 1.5rem;
  list-style: none; padding: 0;
}
.brand-features li {
  display: flex; align-items: center; gap: .6rem;
  font-size: .88rem; color: rgba(255,255,255,.92);
}
.brand-features svg { flex-shrink: 0; color: #C9A227; }

.brand-foot {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: .5rem;
  font-size: .72rem; color: rgba(255,255,255,.7);
}
.brand-foot .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #8FE3A8; box-shadow: 0 0 0 3px rgba(143,227,168,.25);
  flex-shrink: 0;
}

/* Velo de "Verificando…": aparece apenas se envía el form (submit
   nativo, sin AJAX). No afirma éxito — no sabemos el resultado hasta
   que el servidor responde. Si la clave está mal, la página recarga
   con el error y el velo ya desapareció solo; si está bien, el
   navegador ya está yéndose a dashboard.php. */
.submit-veil {
  position: absolute; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  background: linear-gradient(120deg, var(--brand) 0%, var(--brand-strong) 100%);
  color: #fff; font-weight: 700; font-size: 1.02rem;
  clip-path: circle(0% at 50% 50%);
  transition: clip-path .55s cubic-bezier(.65, 0, .35, 1);
  pointer-events: none;
}
.stage.is-submitting .submit-veil { clip-path: circle(75% at 50% 50%); }
.submit-veil .spinner { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .submit-veil { transition: none; }
  .submit-veil .spinner { animation: none; }
}

/* ---------- Panel de formulario (derecha) ---------- */
.formside {
  padding: 3rem 3.1rem;
  display: flex; flex-direction: column; justify-content: center;
  gap: 1.9rem;
}
@media (max-width: 480px) {
  .formside { padding: 2.6rem 1.4rem; }
}
.formside h2 { margin: 0 0 .3rem; font-size: 1.5rem; font-weight: 700; letter-spacing: -.01em; }
.formside .lede { margin: 0; color: var(--ink-soft); font-size: .88rem; }

/* Marca solo-móvil: cuando .brandside se esconde (ver media query al
   final), las fotos desaparecen pero el logo tiene que seguir
   diciendo que esto es de INCASE. Colores reales del logo, no
   forzados a blanco (acá el fondo es --paper, no la foto morada). */
.mobile-brand {
  display: none;
  align-items: center;
  gap: .6rem;
  margin-bottom: .3rem;
}
.mobile-brand img { height: 24px; width: auto; }
.mobile-brand span {
  font-size: .66rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--brand-strong);
}

.field { display: flex; flex-direction: column; gap: .4rem; }
.field label {
  font-size: .68rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--brand-strong);
}
.input-shell { position: relative; display: flex; align-items: center; }
.input-shell .leading { position: absolute; left: .9rem; color: var(--ink-faint); pointer-events: none; }
.field input {
  width: 100%;
  padding: .78rem .9rem .78rem 2.35rem;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--paper); color: var(--ink);
  font-family: inherit; font-size: 1rem;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.field input::placeholder { color: var(--ink-faint); }
.field input:focus {
  outline: none; border-color: var(--brand); background: var(--paper-raised);
  box-shadow: 0 0 0 4px var(--focus-ring);
}
.toggle-visibility {
  position: absolute; right: .35rem;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: none; background: transparent; color: var(--ink-faint);
  cursor: pointer; border-radius: 8px;
}
.toggle-visibility:hover { color: var(--ink-soft); background: var(--paper); }
.toggle-visibility:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

.row-between { display: flex; align-items: center; justify-content: flex-end; font-size: .82rem; }
.row-between a { color: var(--brand-strong); text-decoration: none; font-weight: 500; }
.row-between a:hover { text-decoration: underline; }

.error-banner {
  display: flex; align-items: flex-start; gap: .6rem;
  padding: .7rem .85rem; border-radius: 10px;
  background: var(--danger-soft); color: var(--danger);
  font-size: .82rem; line-height: 1.4;
}

button.submit {
  appearance: none; border: none; border-radius: 10px;
  padding: .85rem 1rem;
  font-family: inherit; font-weight: 700; font-size: .92rem; letter-spacing: .01em;
  color: #fff;
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-strong) 100%);
  cursor: pointer;
  transition: filter .15s ease, transform .1s ease;
}
button.submit:hover { filter: brightness(1.06); }
button.submit:active { transform: translateY(1px); }
button.submit:focus-visible { outline: 2px solid var(--brand-strong); outline-offset: 2px; }

.back-link { text-align: center; font-size: .8rem; }
.back-link a { color: var(--ink-soft); text-decoration: none; }
.back-link a:hover { color: var(--ink); text-decoration: underline; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Al final del cascade a propósito: si va antes de la regla base
   .brandside{display:flex}, esa regla posterior le gana aunque la
   media query aplique (misma especificidad, gana el orden). */
@media (max-width: 760px) {
  .stage { grid-template-columns: 1fr; min-height: 0; border-radius: 16px; }
  .brandside { display: none; }
  .mobile-brand { display: flex; }
}



/* Wordmark textual: INCASE aún no tiene un logotipo web dentro de assets. */
.brand-wordmark {
  color: #fff;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-shadow: 0 2px 6px rgba(0,0,0,.35);
  white-space: nowrap;
}
.mobile-brand strong {
  color: var(--brand-strong);
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: .06em;
  white-space: nowrap;
}
.form-fields { display: flex; flex-direction: column; gap: 1.1rem; }
.toggle-visibility.is-visible { color: var(--brand-strong); }
button.submit:disabled { cursor: wait; opacity: .78; }
.row-between a.is-message { color: var(--ink-soft); cursor: default; text-align: right; }
.row-between a.is-message:hover { text-decoration: none; }
.error-banner { margin-bottom: 1.1rem; }
@media (max-width: 480px) {
  .mobile-brand { align-items: flex-start; flex-direction: column; gap: .25rem; }
}
