:root {
  --bg-main: #05070f;
  --bg-card: #0d1222;
  --bg-card-2: #0a0f1d;
  --bg-input: #121a2e;
  --ink: #ecf2ff;
  --ink-soft: #95a2c2;
  --ink-dim: #7e8bad;
  --line: rgba(129, 140, 248, 0.24);
  --line-2: rgba(255, 255, 255, 0.08);
  --accent: #5b74ff;
  --accent-2: #3b82f6;
  --success: #12d08f;
  --error: #ff5d73;
}

[data-theme="light"] {
  --bg-main: #edf2ff;
  --bg-card: #ffffff;
  --bg-card-2: #f6f8ff;
  --bg-input: #f2f5ff;
  --ink: #111c34;
  --ink-soft: #526287;
  --ink-dim: #68779c;
  --line: rgba(59, 89, 225, 0.24);
  --line-2: rgba(30, 58, 138, 0.16);
  --accent: #365ee8;
  --accent-2: #2446c9;
  --success: #0f9b6d;
  --error: #d8344c;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  font-family: "Outfit", sans-serif;
  color: var(--ink);
  background: var(--bg-main);
}

.login-scene {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(110% 60% at 50% -20%, rgba(91, 116, 255, 0.22), transparent 56%),
    radial-gradient(70% 45% at 100% 100%, rgba(18, 208, 143, 0.08), transparent 62%),
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: auto, auto, 26px 26px, 26px 26px;
  mask-image: radial-gradient(ellipse 120% 100% at center, #000 0%, transparent 85%);
  -webkit-mask-image: radial-gradient(ellipse 120% 100% at center, #000 0%, transparent 85%);
  animation: sceneDrift 18s ease-in-out infinite alternate;
}

[data-theme="light"] .login-scene {
  background:
    radial-gradient(110% 60% at 50% -20%, rgba(91, 116, 255, 0.2), transparent 56%),
    radial-gradient(70% 45% at 100% 100%, rgba(22, 163, 74, 0.08), transparent 62%),
    linear-gradient(rgba(30, 58, 138, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 58, 138, 0.05) 1px, transparent 1px);
}

.login-scene::before,
.login-scene::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(24px);
}

.login-scene::before {
  width: 340px;
  height: 340px;
  left: -90px;
  top: 14%;
  background: radial-gradient(circle, rgba(91, 116, 255, 0.36), rgba(91, 116, 255, 0));
  animation: orbFloatA 13s ease-in-out infinite;
}

.login-scene::after {
  width: 280px;
  height: 280px;
  right: -70px;
  bottom: 10%;
  background: radial-gradient(circle, rgba(18, 208, 143, 0.2), rgba(18, 208, 143, 0));
  animation: orbFloatB 15s ease-in-out infinite;
}

.login-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(460px, 100%);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 26px;
  background:
    linear-gradient(180deg, rgba(17, 23, 41, 0.96), rgba(10, 14, 27, 0.98));
  box-shadow:
    0 24px 48px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(129, 140, 248, 0.08) inset;
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
  transform-origin: center top;
  animation: cardReveal 700ms cubic-bezier(0.22, 0.9, 0.26, 1) both;
}

[data-theme="light"] .login-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(245, 248, 255, 0.98));
  box-shadow:
    0 18px 36px rgba(37, 60, 128, 0.14),
    0 0 0 1px rgba(99, 102, 241, 0.08) inset;
}

.login-card::before {
  content: "";
  position: absolute;
  left: -30%;
  top: -50%;
  width: 160%;
  height: 70%;
  background: linear-gradient(110deg, rgba(129, 140, 248, 0), rgba(129, 140, 248, 0.18), rgba(129, 140, 248, 0));
  transform: rotate(6deg);
  animation: cardSheen 6.4s ease-in-out infinite;
  pointer-events: none;
}

[data-theme="light"] .login-card::before {
  background: linear-gradient(110deg, rgba(129, 140, 248, 0), rgba(99, 102, 241, 0.24), rgba(129, 140, 248, 0));
}

.login-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  pointer-events: none;
}

.login-brand-wrap {
  width: 100%;
  margin: 0 0 12px;
  padding: 10px 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 16px;
  border: 1px solid rgba(129, 140, 248, 0.24);
  background:
    linear-gradient(180deg, rgba(27, 37, 62, 0.82), rgba(14, 20, 36, 0.86));
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.28),
    0 0 0 1px rgba(129, 140, 248, 0.08) inset;
  position: relative;
  overflow: hidden;
  animation: brandWrapIn 700ms cubic-bezier(0.22, 0.9, 0.26, 1) 110ms both;
}

[data-theme="light"] .login-brand-wrap {
  border-color: rgba(99, 102, 241, 0.22);
  background: linear-gradient(180deg, rgba(238, 243, 255, 0.94), rgba(248, 250, 255, 0.96));
  box-shadow:
    0 8px 18px rgba(58, 84, 170, 0.12),
    0 0 0 1px rgba(99, 102, 241, 0.1) inset;
}

.login-brand-wrap::before {
  content: "";
  position: absolute;
  left: -32%;
  top: -48%;
  width: 165%;
  height: 70%;
  background: linear-gradient(110deg, rgba(129, 140, 248, 0), rgba(129, 140, 248, 0.26), rgba(129, 140, 248, 0));
  transform: rotate(7deg);
  animation: brandSweep 6.2s ease-in-out infinite;
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 2px;
  color: #aeb9da;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-size: 0.72rem;
  font-family: "JetBrains Mono", monospace;
}

.login-brand-logo {
  display: block;
  height: 136px;
  width: auto;
  max-width: min(96%, 400px);
  object-fit: contain;
  margin: 0;
  filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.5));
  transform-origin: center;
  animation:
    logoIn 760ms cubic-bezier(0.22, 0.88, 0.27, 1) 170ms both,
    logoFloat 4.2s ease-in-out 980ms infinite,
    logoGlow 3.6s ease-in-out 1.2s infinite;
}

h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #f4f7ff;
  opacity: 0;
  transform: translateY(10px);
  animation: textIn 520ms ease forwards 200ms;
  text-align: center;
}

[data-theme="light"] h1 {
  color: #142348;
}

.sub {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 0.96rem;
  opacity: 0;
  transform: translateY(10px);
  animation: textIn 520ms ease forwards 300ms;
  text-align: center;
}

.login-form {
  margin-top: 16px;
  display: grid;
  gap: 12px;
  opacity: 0;
  transform: translateY(10px);
  animation: textIn 520ms ease forwards 390ms;
}

label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: #afbad8;
  font-size: 0.92rem;
  font-weight: 500;
}

input {
  border: 1px solid var(--line-2);
  border-radius: 13px;
  padding: 11px 12px;
  font: inherit;
  color: var(--ink);
  background: linear-gradient(180deg, rgba(20, 29, 50, 0.96), rgba(15, 22, 39, 0.96));
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

[data-theme="light"] input {
  background: linear-gradient(180deg, rgba(248, 250, 255, 0.98), rgba(242, 246, 255, 0.98));
  color: #16203a;
}

input::placeholder {
  color: #7380a3;
}

input:focus {
  outline: none;
  border-color: rgba(99, 118, 255, 0.62);
  box-shadow: 0 0 0 3px rgba(91, 116, 255, 0.2);
  background: linear-gradient(180deg, rgba(24, 34, 58, 0.98), rgba(17, 25, 44, 0.98));
}

.login-btn {
  margin-top: 4px;
  border: 1px solid rgba(122, 140, 255, 0.3);
  border-radius: 13px;
  padding: 11px 14px;
  font: inherit;
  font-weight: 700;
  color: #f6f9ff;
  background: linear-gradient(120deg, #5671ff, #2f58d8);
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: transform 0.14s ease, box-shadow 0.14s ease, filter 0.14s ease;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

[data-theme="light"] .login-btn {
  border-color: rgba(69, 101, 231, 0.24);
  color: #ffffff;
  background: linear-gradient(120deg, #4b6bf2, #2f58d8);
}

.login-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0) 20%, rgba(255, 255, 255, 0.34) 50%, rgba(255, 255, 255, 0) 80%);
  transform: translateX(-130%) skewX(-18deg);
  transition: transform 0.58s ease;
  pointer-events: none;
  z-index: -1;
}

.login-btn:hover {
  transform: translateY(-1px);
  box-shadow:
    0 10px 24px rgba(58, 89, 225, 0.42),
    0 0 0 1px rgba(160, 176, 255, 0.2) inset;
  filter: brightness(1.04);
}

.login-btn:hover::before {
  transform: translateX(130%) skewX(-18deg);
}

.login-btn:active {
  transform: translateY(0);
}

.login-btn:disabled {
  opacity: 0.7;
  cursor: default;
}

.status-line {
  margin: 13px 0 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-family: "JetBrains Mono", monospace;
  opacity: 0;
  transform: translateY(8px);
  animation: textIn 520ms ease forwards 510ms;
}

.status-line.error {
  color: var(--error);
}

.hint {
  margin: 8px 0 0;
  color: var(--ink-dim);
  font-size: 0.8rem;
  opacity: 0;
  transform: translateY(8px);
  animation: textIn 520ms ease forwards 590ms;
}

.otp-section {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  text-align: center;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(16, 23, 39, 0.92), rgba(10, 15, 29, 0.94));
  padding: 12px;
  animation: otpReveal 320ms ease both;
}

[data-theme="light"] .otp-section {
  background: linear-gradient(180deg, rgba(245, 248, 255, 0.96), rgba(238, 243, 255, 0.96));
}

.otp-icon {
  font-size: 1.85rem;
  line-height: 1;
  margin-bottom: 2px;
  animation: otpPulse 2.4s ease-in-out infinite;
}

.otp-label {
  margin: 0;
  color: #aeb9da;
  font-size: 0.9rem;
}

#passwordResetSection label {
  display: grid;
  gap: 6px;
  text-align: left;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 600;
}

#passwordResetSection .otp-input {
  letter-spacing: 0.04em;
  text-align: left;
  font-size: 1rem;
  font-family: "Outfit", sans-serif;
}

.otp-setup-block {
  border: 1px solid var(--line-2);
  border-radius: 12px;
  padding: 10px;
  background: rgba(20, 29, 50, 0.5);
  display: grid;
  gap: 6px;
  justify-items: center;
}

.otp-setup-qr {
  width: 170px;
  height: 170px;
  border-radius: 10px;
  background: #fff;
  padding: 6px;
  border: 1px solid rgba(129, 140, 248, 0.28);
}

.otp-setup-title {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.otp-setup-secret {
  margin: 0;
  font-size: 0.75rem;
  font-family: "JetBrains Mono", monospace;
  color: var(--ink-dim);
  word-break: break-all;
  text-align: center;
}

.otp-input {
  width: 100%;
  border: 2px solid rgba(91, 116, 255, 0.52);
  border-radius: 13px;
  padding: 13px 10px;
  font-family: "JetBrains Mono", monospace;
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-align: center;
  color: var(--ink);
  background: linear-gradient(180deg, rgba(21, 31, 53, 0.98), rgba(15, 22, 40, 0.98));
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

[data-theme="light"] .otp-input {
  background: linear-gradient(180deg, rgba(250, 252, 255, 0.98), rgba(243, 247, 255, 0.98));
  color: #132243;
}

.otp-input:focus {
  border-color: rgba(104, 126, 255, 0.82);
  box-shadow: 0 0 0 4px rgba(91, 116, 255, 0.18);
}

.otp-timer {
  margin: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.79rem;
  color: var(--ink-soft);
}

.otp-timer.expired {
  color: var(--error);
  font-weight: 700;
}

.back-btn {
  border: 1px solid rgba(129, 140, 248, 0.26);
  border-radius: 11px;
  color: #b8c3e2;
  background: rgba(19, 27, 46, 0.92);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 9px 12px;
  transition: background 0.14s ease, border-color 0.14s ease;
}

[data-theme="light"] .back-btn {
  color: #2e3f66;
  background: rgba(238, 244, 255, 0.96);
}

.back-btn:hover {
  border-color: rgba(129, 140, 248, 0.44);
  background: rgba(28, 39, 66, 0.96);
}

@keyframes cardReveal {
  0% {
    opacity: 0;
    transform: translateY(26px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes textIn {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes logoIn {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.93);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes logoFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

@keyframes logoGlow {
  0%, 100% {
    filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.5));
  }
  50% {
    filter: drop-shadow(0 16px 34px rgba(91, 116, 255, 0.34));
  }
}

@keyframes brandWrapIn {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes brandSweep {
  0%, 100% {
    transform: translateX(-22%) rotate(7deg);
    opacity: 0.2;
  }
  50% {
    transform: translateX(20%) rotate(7deg);
    opacity: 0.38;
  }
}

@keyframes cardSheen {
  0%, 100% {
    transform: translateX(-18%) rotate(6deg);
    opacity: 0.18;
  }
  50% {
    transform: translateX(18%) rotate(6deg);
    opacity: 0.34;
  }
}

@keyframes sceneDrift {
  0% {
    transform: scale(1) translateY(0);
  }
  100% {
    transform: scale(1.02) translateY(-6px);
  }
}

@keyframes orbFloatA {
  0%, 100% {
    transform: translateY(0) translateX(0);
  }
  50% {
    transform: translateY(-18px) translateX(16px);
  }
}

@keyframes orbFloatB {
  0%, 100% {
    transform: translateY(0) translateX(0);
  }
  50% {
    transform: translateY(14px) translateX(-14px);
  }
}

@keyframes otpReveal {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes otpPulse {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 0 rgba(91, 116, 255, 0));
  }
  50% {
    transform: scale(1.08);
    filter: drop-shadow(0 0 10px rgba(91, 116, 255, 0.36));
  }
}

@media (max-width: 760px) {
  .login-shell {
    padding: 12px;
  }

  .login-card {
    border-radius: 16px;
    padding: 18px;
  }

  .login-brand-logo {
    height: 116px;
    max-width: min(96%, 340px);
  }

  h1 {
    font-size: 1.55rem;
  }

  .sub {
    font-size: 0.89rem;
  }

  input,
  .login-btn {
    min-height: 44px;
    font-size: 16px;
  }

  .otp-input {
    font-size: 1.38rem;
    letter-spacing: 0.2em;
  }
}

@media (max-width: 420px) {
  .login-shell {
    padding: 10px;
  }

  .login-card {
    border-radius: 14px;
    padding: 15px;
  }

  .login-brand-logo {
    height: 98px;
    max-width: min(98%, 292px);
  }

  h1 {
    font-size: 1.34rem;
  }

  .otp-input {
    font-size: 1.22rem;
    letter-spacing: 0.16em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-scene,
  .login-scene::before,
  .login-scene::after,
  .login-card,
  .login-card::before,
  .login-brand-wrap,
  .login-brand-wrap::before,
  .login-brand-logo,
  h1,
  .sub,
  .login-form,
  .status-line,
  .hint,
  .otp-section,
  .otp-icon {
    animation: none !important;
  }

  input,
  .login-btn,
  .back-btn {
    transition: none !important;
  }
}
