:root {
  --bg: #f8f7ff;
  --bg-2: #eef0ff;
  --surface: rgba(255,255,255,.70);
  --surface-strong: rgba(255,255,255,.90);
  --text: #12172f;
  --muted: #6e7591;
  --line: rgba(91,77,163,.16);
  --input: rgba(255,255,255,.68);
  --purple: #7c45ff;
  --purple-2: #5f2ef5;
  --pink: #ca7bff;
  --cyan: #7fdcff;
  --shadow: 0 28px 72px rgba(56,36,119,.15);
  --error: #c72f4e;
  --success: #16845f;
  --mouse-x: 0px;
  --mouse-y: 0px;
}

html[data-theme="dark"] {
  --bg: #06091d;
  --bg-2: #0b0d2b;
  --surface: rgba(15,18,48,.70);
  --surface-strong: rgba(15,18,48,.90);
  --text: #f7f5ff;
  --muted: #a9aed0;
  --line: rgba(190,172,255,.18);
  --input: rgba(22,25,63,.74);
  --shadow: 0 32px 90px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100dvh;
  overflow: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 16%, rgba(151,118,255,.18), transparent 30%),
    radial-gradient(circle at 82% 20%, rgba(102,205,255,.13), transparent 29%),
    radial-gradient(circle at 70% 86%, rgba(222,139,255,.12), transparent 31%),
    linear-gradient(145deg, var(--bg), var(--bg-2));
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: color .35s ease, background .35s ease;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

/* Destello orbital animado detrás del login. */
.ada-scene { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.ada-scene::before,
.ada-scene::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(88vh, 820px);
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.ada-scene::before {
  background:
    conic-gradient(from 0deg,
      transparent 0 11%,
      rgba(255,255,255,.06) 14%,
      rgba(194,139,255,.50) 18%,
      rgba(248,233,255,.98) 21%,
      rgba(120,77,255,.72) 24%,
      transparent 30% 62%,
      rgba(107,206,255,.22) 69%,
      rgba(181,103,255,.78) 74%,
      transparent 79% 100%);
  -webkit-mask: radial-gradient(circle, transparent 0 61%, #000 62% 65%, transparent 66%);
  mask: radial-gradient(circle, transparent 0 61%, #000 62% 65%, transparent 66%);
  filter: drop-shadow(0 0 10px rgba(128,75,255,.62)) drop-shadow(0 0 24px rgba(169,103,255,.34));
  opacity: .95;
  animation: adaOrbit 8.5s linear infinite;
}
.ada-scene::after {
  width: min(96vh, 900px);
  background:
    conic-gradient(from 180deg,
      transparent 0 24%,
      rgba(99,77,255,.15) 30%,
      rgba(198,135,255,.55) 35%,
      transparent 42% 70%,
      rgba(105,206,255,.16) 76%,
      rgba(255,255,255,.48) 81%,
      transparent 87% 100%);
  -webkit-mask: radial-gradient(circle, transparent 0 67%, #000 68% 69.2%, transparent 70%);
  mask: radial-gradient(circle, transparent 0 67%, #000 68% 69.2%, transparent 70%);
  filter: blur(.2px) drop-shadow(0 0 15px rgba(119,72,255,.36));
  opacity: .54;
  animation: adaOrbitReverse 13s linear infinite;
}

.ada-aurora {
  position: absolute;
  width: 46vw;
  height: 34vh;
  border-radius: 50%;
  filter: blur(86px);
  opacity: .18;
  will-change: transform;
}
.ada-aurora--one { left: -15vw; top: 34vh; background: #8058ff; animation: auroraFloatOne 12s ease-in-out infinite alternate; }
.ada-aurora--two { right: -17vw; top: 12vh; background: #c160ff; animation: auroraFloatTwo 15s ease-in-out infinite alternate; }

/* Arcos secundarios: se desplazan y giran para producir el destello que va y vuelve. */
.ada-streak {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(84vh, 780px);
  aspect-ratio: 1;
  border-radius: 50%;
  transform-origin: center;
  opacity: .72;
  will-change: transform, opacity;
}
.ada-streak::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 15deg,
    transparent 0 67%,
    rgba(122,79,255,.10) 70%,
    rgba(185,112,255,.72) 76%,
    rgba(255,241,255,.95) 80%,
    rgba(103,182,255,.38) 83%,
    transparent 88% 100%);
  -webkit-mask: radial-gradient(circle, transparent 0 64%, #000 65% 66.6%, transparent 67.5%);
  mask: radial-gradient(circle, transparent 0 64%, #000 65% 66.6%, transparent 67.5%);
  filter: drop-shadow(0 0 9px rgba(145,86,255,.62));
}
.ada-streak--one { transform: translate(-50%, -50%); animation: streakOrbitOne 6.6s ease-in-out infinite alternate; }
.ada-streak--two { width: min(74vh, 700px); opacity: .46; transform: translate(-50%, -50%); animation: streakOrbitTwo 9.2s ease-in-out infinite alternate; }
.ada-streak--three { width: min(92vh, 860px); opacity: .28; transform: translate(-50%, -50%); animation: streakOrbitThree 11.4s ease-in-out infinite alternate; }

.ada-stars {
  position: absolute; inset: 0; opacity: .34;
  background-image:
    radial-gradient(circle at 11% 20%, rgba(147,92,255,.9) 0 1px, transparent 2px),
    radial-gradient(circle at 21% 71%, rgba(255,255,255,.8) 0 1px, transparent 2px),
    radial-gradient(circle at 77% 26%, rgba(177,117,255,.9) 0 1px, transparent 2px),
    radial-gradient(circle at 88% 73%, rgba(255,255,255,.85) 0 1px, transparent 2px),
    radial-gradient(circle at 52% 12%, rgba(114,203,255,.75) 0 1px, transparent 2px);
  animation: starsPulse 5s ease-in-out infinite alternate;
}

.ada-topbar {
  position: fixed; z-index: 10; inset: 0 0 auto 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px clamp(16px, 3vw, 40px);
}
.ada-mini-brand {
  display: flex; align-items: center; gap: 9px;
  color: var(--text); text-decoration: none; font-weight: 760; letter-spacing: -.02em;
}
.ada-mini-brand img {
  width: 31px; height: 31px; border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(126,74,255,.13);
}

.ada-theme-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 11px; color: var(--text); background: var(--surface);
  box-shadow: 0 8px 22px rgba(45,31,91,.1); cursor: pointer;
  backdrop-filter: blur(18px); transition: transform .2s ease, background .3s ease;
}
.ada-theme-toggle:hover { transform: translateY(-2px); }
.ada-theme-icon { color: var(--purple); font-size: 16px; }
.ada-theme-label { min-width: 42px; font-size: 12px; font-weight: 750; }

.ada-login-shell {
  position: relative; z-index: 2;
  min-height: 100dvh;
  display: grid; place-items: center;
  padding: 64px 16px 18px;
}
.ada-login-card {
  width: min(100%, 390px);
  padding: 22px 28px 18px;
  border: 1px solid var(--line); border-radius: 30px;
  background: linear-gradient(150deg, var(--surface-strong), var(--surface));
  box-shadow: var(--shadow);
  backdrop-filter: blur(28px) saturate(125%);
  animation: cardEnter .7s cubic-bezier(.22,1,.36,1) both;
}

.ada-logo-wrap {
  position: relative; width: 86px; height: 86px;
  margin: 0 auto 8px; display: grid; place-items: center;
  isolation: isolate;
}
.ada-logo-wrap::before {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 112px; height: 28px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(156,96,255,.78), rgba(255,239,255,.96), rgba(92,83,255,.68), transparent);
  filter: blur(7px);
  opacity: .72;
  z-index: -1;
  animation: logoSweep 4.2s ease-in-out infinite alternate;
}
.ada-logo-wrap::before {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 112px; height: 28px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(156,96,255,.78), rgba(255,239,255,.96), rgba(92,83,255,.68), transparent);
  filter: blur(7px);
  opacity: .72;
  z-index: -1;
  animation: logoSweep 4.2s ease-in-out infinite alternate;
}

.ada-logo {
  position: relative; z-index: 2;
  width: 76px; height: 76px; object-fit: cover; border-radius: 50%;
  box-shadow: 0 12px 30px rgba(69,35,174,.26), 0 0 0 2px rgba(143,87,255,.24);
  animation: logoFloat 4s ease-in-out infinite;
}
.ada-logo-halo {
  display: none;
  position: absolute;
  width: 106px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(90deg, transparent, #7b47ff, #e2adff, #6540ff, transparent);
  filter: blur(10px);
  opacity: .44;
  z-index: 1;
  animation: haloTravel 5.2s ease-in-out infinite alternate;
}

.ada-heading { text-align: center; margin-bottom: 18px; }
.ada-heading h1 {
  margin: 0; font-size: clamp(38px, 5vw, 48px); line-height: 1;
  letter-spacing: -.055em; font-weight: 520;
}
.ada-tagline { margin: 8px 0 0; color: var(--muted); font-size: 12.5px; }
.ada-tagline span { color: var(--purple); }

.ada-login-form { display: grid; gap: 12px; }
.ada-field { display: grid; gap: 5px; }
.ada-field label { color: var(--muted); font-size: 11px; font-weight: 760; padding-left: 3px; }
.ada-input-wrap { position: relative; display: flex; align-items: center; }
.ada-input-wrap > svg {
  position: absolute; left: 14px; width: 18px; height: 18px;
  fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  pointer-events: none;
}
.ada-input-wrap input {
  width: 100%; height: 47px; padding: 0 46px 0 43px;
  border: 1px solid var(--line); border-radius: 14px;
  outline: none; color: var(--text); background: var(--input);
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.ada-input-wrap input::placeholder { color: color-mix(in srgb, var(--muted) 72%, transparent); }
.ada-input-wrap input:focus {
  border-color: rgba(124,69,255,.64);
  box-shadow: 0 0 0 4px rgba(124,69,255,.12), 0 8px 22px rgba(80,46,173,.08);
  transform: translateY(-1px);
}
.ada-password-toggle {
  position: absolute; right: 7px; width: 36px; height: 36px;
  display: grid; place-items: center; border: 0; background: transparent;
  color: var(--muted); cursor: pointer; border-radius: 9px;
}
.ada-password-toggle:hover { background: rgba(125,80,255,.08); color: var(--purple); }
.ada-password-toggle svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; }

.ada-login-options {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; font-size: 11px;
}
.ada-check { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); cursor: pointer; }
.ada-check input { position: absolute; opacity: 0; pointer-events: none; }
.ada-check span {
  width: 17px; height: 17px; border: 1px solid var(--line); border-radius: 5px;
  background: var(--input); display: grid; place-items: center;
}
.ada-check input:checked + span { background: linear-gradient(135deg, var(--purple), var(--purple-2)); border-color: transparent; }
.ada-check input:checked + span::after { content: "✓"; color: white; font-size: 11px; font-weight: 900; }
.ada-text-button { border: 0; background: transparent; color: var(--purple); padding: 3px; cursor: pointer; font-size: 11px; font-weight: 700; }
.ada-text-button:hover { text-decoration: underline; }

.ada-submit {
  position: relative; height: 49px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  border: 0; border-radius: 14px; color: #fff; cursor: pointer;
  background: linear-gradient(110deg, #6532f5, #914dff 52%, #6a38f4);
  box-shadow: 0 14px 28px rgba(105,54,242,.27);
  font-weight: 780; overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
}
.ada-submit::before {
  content: ""; position: absolute; inset: 0; transform: translateX(-120%);
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.26), transparent);
  transition: transform .65s ease;
}
.ada-submit:hover { transform: translateY(-2px); box-shadow: 0 19px 36px rgba(105,54,242,.34); }
.ada-submit:hover::before { transform: translateX(120%); }
.ada-submit:disabled { opacity: .65; cursor: wait; transform: none; }
.ada-submit svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.ada-message { min-height: 17px; margin: 0; text-align: center; font-size: 11px; line-height: 1.35; color: var(--muted); }
.ada-message.is-error { color: var(--error); }
.ada-message.is-ok { color: var(--success); }
.ada-status { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 0; color: var(--muted); font-size: 10px; }
.ada-status-dot { width: 6px; height: 6px; border-radius: 50%; background: #daa934; box-shadow: 0 0 0 4px rgba(218,169,52,.1); }
.ada-status.is-online .ada-status-dot { background: #20b77a; box-shadow: 0 0 0 4px rgba(32,183,122,.12); }
.ada-status.is-offline .ada-status-dot { background: #d94d69; box-shadow: 0 0 0 4px rgba(217,77,105,.12); }

.ada-card-footer {
  display: flex; justify-content: space-between; gap: 12px;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 9px;
}
.ada-card-footer a { color: var(--purple); text-decoration: none; }

@keyframes streakOrbitOne { 0% { transform: translate(-50%, -50%) rotate(-28deg) scale(.97); opacity: .34; } 50% { opacity: .96; } 100% { transform: translate(-50%, -50%) rotate(40deg) scale(1.04); opacity: .68; } }
@keyframes streakOrbitTwo { 0% { transform: translate(-50%, -50%) rotate(82deg) scale(1.03); } 100% { transform: translate(-50%, -50%) rotate(150deg) scale(.96); } }
@keyframes streakOrbitThree { 0% { transform: translate(-50%, -50%) rotate(210deg); opacity: .14; } 100% { transform: translate(-50%, -50%) rotate(300deg); opacity: .42; } }
@keyframes adaOrbit { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes adaOrbitReverse { to { transform: translate(-50%, -50%) rotate(-360deg); } }
@keyframes auroraFloatOne { from { transform: translate3d(-5%, -3%, 0) scale(.90); } to { transform: translate3d(22%, 8%, 0) scale(1.12); } }
@keyframes auroraFloatTwo { from { transform: translate3d(5%, -2%, 0) scale(1.06); } to { transform: translate3d(-18%, 10%, 0) scale(.91); } }
@keyframes starsPulse { to { opacity: .66; transform: scale(1.01); } }
@keyframes logoSweep { 0% { transform: translate(-78%, -50%) rotate(-10deg) scaleX(.72); opacity: .26; } 100% { transform: translate(-22%, -50%) rotate(10deg) scaleX(1.08); opacity: .88; } }
@keyframes haloTravel {
  0% { transform: translateX(-24px) rotate(-10deg) scaleX(.72); }
  100% { transform: translateX(24px) rotate(10deg) scaleX(1.05); }
}
@keyframes logoBreathe { 0%,100% { transform: scale(.94); opacity: .48; } 50% { transform: scale(1.06); opacity: .92; } }
@keyframes logoFloat { 0%,100% { transform: translateY(-2px); } 50% { transform: translateY(3px); } }
@keyframes cardEnter { from { opacity: 0; transform: translateY(20px) scale(.975); } to { opacity: 1; transform: none; } }

@media (max-height: 720px) and (min-width: 621px) {
  .ada-topbar { padding-top: 10px; padding-bottom: 10px; }
  .ada-login-shell { padding-top: 52px; padding-bottom: 10px; }
  .ada-login-card { transform: scale(.91); transform-origin: center; }
}

@media (max-width: 620px) {
  body { overflow-y: auto; }
  .ada-topbar { padding: 12px 14px; }
  .ada-mini-brand span { display: none; }
  .ada-login-shell { min-height: 100dvh; padding: 62px 12px 16px; }
  .ada-login-card { padding: 22px 20px 17px; border-radius: 26px; }
  .ada-login-options { align-items: flex-start; }
  .ada-card-footer { flex-direction: column; align-items: center; gap: 4px; }
  .ada-scene::before { width: 96vh; }
  .ada-scene::after { width: 104vh; }
  .ada-streak { width: 92vh; }
  .ada-streak--two { width: 82vh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
