:root {
  color-scheme: light;
  --auth-bg: #f7f8f6;
  --auth-surface: rgba(255, 255, 255, 0.76);
  --auth-surface-strong: rgba(255, 255, 255, 0.92);
  --auth-surface-muted: rgba(243, 246, 244, 0.86);
  --auth-text: #1f2933;
  --auth-soft: #52616b;
  --auth-muted: #6d7b82;
  --auth-line: rgba(31, 41, 51, 0.12);
  --auth-line-strong: rgba(31, 41, 51, 0.2);
  --auth-green: #146b5c;
  --auth-teal: #2f7f8d;
  --auth-acid: #ebff32;
  --auth-ink: #20211f;
  --auth-danger: #b42318;
  --auth-success: #157347;
  --auth-shadow: 0 28px 90px rgba(31, 41, 51, 0.16);
  --auth-shadow-soft: 0 14px 36px rgba(31, 41, 51, 0.1);
  --auth-radius: 30px;
}

html[data-auth-theme="dark"] {
  color-scheme: dark;
  --auth-bg: #151716;
  --auth-surface: rgba(31, 36, 33, 0.76);
  --auth-surface-strong: rgba(31, 36, 33, 0.92);
  --auth-surface-muted: rgba(38, 44, 40, 0.86);
  --auth-text: #f4f7f5;
  --auth-soft: #ccd6d2;
  --auth-muted: #aab7b2;
  --auth-line: rgba(255, 255, 255, 0.12);
  --auth-line-strong: rgba(235, 255, 50, 0.24);
  --auth-green: #71c7ae;
  --auth-teal: #73bfcb;
  --auth-acid: #dfff35;
  --auth-ink: #111412;
  --auth-danger: #ff8a80;
  --auth-success: #78d69d;
  --auth-shadow: 0 28px 90px rgba(0, 0, 0, 0.44);
  --auth-shadow-soft: 0 14px 36px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--auth-text);
  background:
    radial-gradient(circle at 12% 4%, rgba(235, 255, 50, 0.18), transparent 22rem),
    radial-gradient(circle at 88% 8%, rgba(20, 107, 92, 0.12), transparent 24rem),
    linear-gradient(90deg, rgba(32, 33, 31, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, #eee9dc 0%, #e8dfcc 48%, #f4eedc 100%);
  background-size: 72px 100%, auto;
  font-family: "Manrope", system-ui, sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
}

html[data-auth-theme="dark"] body {
  background:
    radial-gradient(circle at 12% 4%, rgba(223, 255, 53, 0.08), transparent 22rem),
    radial-gradient(circle at 88% 8%, rgba(113, 199, 174, 0.11), transparent 24rem),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(180deg, #141715 0%, #1b1f1c 48%, #111412 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  max-width: 100%;
}

.skip-link {
  position: fixed;
  z-index: 50;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 999px;
  color: var(--auth-ink);
  background: var(--auth-acid);
  font-size: 0.78rem;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-0.7rem);
  transition: opacity 180ms ease, transform 180ms ease;
}

.skip-link:focus {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.auth-orbit {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.auth-orbit__glow {
  position: absolute;
  width: 24rem;
  height: 24rem;
  border-radius: 999px;
  filter: blur(32px);
  opacity: 0.22;
}

.auth-orbit__glow--one {
  top: 6%;
  left: -7rem;
  background: var(--auth-acid);
}

.auth-orbit__glow--two {
  right: -8rem;
  bottom: 10%;
  background: var(--auth-teal);
}

.auth-orbit__grid {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(31, 41, 51, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(31, 41, 51, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 42%, #000 0 38%, transparent 78%);
}

html[data-auth-theme="dark"] .auth-orbit__grid {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
}

.auth-stage {
  width: min(100%, 1280px);
  min-height: 100svh;
  display: grid;
  align-items: center;
  margin: 0 auto;
  padding: clamp(1rem, 2.5vw, 2rem);
}

.auth-shell {
  min-height: min(820px, calc(100svh - clamp(2rem, 5vw, 4rem)));
  display: grid;
  grid-template-columns: minmax(23rem, 0.95fr) minmax(24rem, 1.05fr);
  gap: clamp(0.75rem, 1.5vw, 1rem);
  overflow: hidden;
  border: 1px solid var(--auth-line);
  border-radius: var(--auth-radius);
  background: color-mix(in srgb, var(--auth-surface) 92%, transparent);
  box-shadow: var(--auth-shadow);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  opacity: 0;
  transform: translateY(18px) scale(0.985);
  animation: authEnter 680ms cubic-bezier(0.2, 0.8, 0.2, 1) 80ms forwards;
}

.auth-stage.loaded .auth-shell {
  animation-delay: 0ms;
}

.auth-visual {
  position: relative;
  min-height: 100%;
  overflow: hidden;
  border-radius: calc(var(--auth-radius) - 10px);
  isolation: isolate;
}

.auth-visual picture,
.auth-visual img {
  display: block;
  width: 100%;
  height: 100%;
}

.auth-visual img {
  object-fit: cover;
  object-position: center;
  transform: scale(1.02);
}

.auth-visual__shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(18, 25, 21, 0.14), rgba(18, 25, 21, 0.76)),
    radial-gradient(circle at 22% 12%, rgba(235, 255, 50, 0.3), transparent 17rem);
}

.auth-visual__content {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.5rem;
  padding: clamp(1.1rem, 3vw, 2rem);
  color: #fff;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.72rem;
}

.auth-brand__mark {
  width: 2.55rem;
  height: 2.55rem;
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 999px;
  color: var(--auth-ink);
  background: #7fd2c3;
  box-shadow: 0 12px 26px rgba(20, 107, 92, 0.2);
  font-size: 1rem;
  font-weight: 900;
}

.auth-brand strong {
  display: block;
  color: var(--auth-text);
  font-size: 0.88rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.auth-brand small {
  display: block;
  color: var(--auth-muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.auth-brand--light strong,
.auth-brand--light small {
  color: #fff;
}

.auth-story {
  max-width: 31rem;
}

.auth-kicker,
.auth-panel__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  width: max-content;
  max-width: 100%;
  margin: 0 0 0.68rem;
  padding: 0.34rem 0.62rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.11);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.auth-story h1 {
  max-width: 11ch;
  margin: 0;
  color: #fff;
  font-size: clamp(2.2rem, 4.7vw, 4.8rem);
  font-weight: 900;
  letter-spacing: -0.08em;
  line-height: 0.9;
}

.auth-story p:not(.auth-kicker) {
  max-width: 33rem;
  margin: 1rem 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(0.95rem, 1.3vw, 1.05rem);
  font-weight: 700;
}

.auth-visual__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.auth-visual__badges span {
  min-height: 2.15rem;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 0.45rem 0.72rem;
  color: rgba(255, 255, 255, 0.86);
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.78rem;
  font-weight: 900;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.auth-panel {
  min-width: 0;
  display: grid;
  align-items: center;
  padding: clamp(0.75rem, 1.8vw, 1.3rem);
}

.auth-card {
  width: min(100%, 35rem);
  margin: 0 auto;
  padding: clamp(1rem, 2.4vw, 1.65rem);
  border: 1px solid var(--auth-line);
  border-radius: 24px;
  background: color-mix(in srgb, var(--auth-surface-strong) 90%, transparent);
  box-shadow: var(--auth-shadow-soft);
}

.auth-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: clamp(1.15rem, 2vw, 1.7rem);
}

.auth-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.auth-theme-toggle,
.auth-icon-link {
  min-height: 2.55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid var(--auth-line);
  border-radius: 999px;
  padding: 0.55rem 0.72rem;
  color: var(--auth-soft);
  background: color-mix(in srgb, var(--auth-surface-muted) 88%, transparent);
  font-size: 0.78rem;
  font-weight: 900;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.auth-theme-toggle:hover,
.auth-theme-toggle:focus-visible,
.auth-icon-link:hover,
.auth-icon-link:focus-visible,
.footer-link:hover,
.footer-link:focus-visible {
  border-color: var(--auth-line-strong);
  background: var(--auth-surface-strong);
  transform: translateY(-1px);
  outline: none;
}

.auth-panel__header {
  margin-bottom: 1.15rem;
}

.auth-panel__eyebrow {
  border-color: var(--auth-line);
  color: var(--auth-muted);
  background: var(--auth-surface-muted);
}

.auth-panel__header h2 {
  margin: 0;
  color: var(--auth-text);
  font-size: clamp(2rem, 4vw, 3.15rem);
  font-weight: 900;
  letter-spacing: -0.075em;
  line-height: 0.92;
}

.auth-panel__header p {
  max-width: 31rem;
  margin: 0.78rem 0 0;
  color: var(--auth-soft);
  font-weight: 750;
}

.login-form-content,
.recovery-form-content {
  display: grid;
  gap: 0.92rem;
}

.form-group {
  display: grid;
  gap: 0.42rem;
  transition: transform 180ms ease;
}

.form-group label {
  color: var(--auth-text);
  font-size: 0.82rem;
  font-weight: 900;
}

.input-shell {
  min-height: 3.25rem;
  display: flex;
  align-items: center;
  gap: 0.72rem;
  border: 1px solid var(--auth-line);
  border-radius: 18px;
  padding: 0 0.72rem;
  background: color-mix(in srgb, var(--auth-surface-muted) 90%, transparent);
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.input-shell:focus-within {
  border-color: color-mix(in srgb, var(--auth-teal) 58%, var(--auth-line));
  background: var(--auth-surface-strong);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--auth-teal) 16%, transparent);
}

.input-shell > i {
  width: 1.1rem;
  color: var(--auth-muted);
  text-align: center;
}

.input-shell input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--auth-text);
  background: transparent;
  font-weight: 800;
}

.input-shell input::placeholder {
  color: color-mix(in srgb, var(--auth-muted) 74%, transparent);
}

.input-shell input.is-valid {
  color: var(--auth-success);
}

.input-shell input.is-invalid {
  color: var(--auth-danger);
}

.toggle-password {
  width: 2.15rem;
  height: 2.15rem;
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 999px;
  color: var(--auth-muted);
  background: transparent;
  transition: color 180ms ease, background 180ms ease;
}

.toggle-password:hover,
.toggle-password:focus-visible {
  color: var(--auth-text);
  background: var(--auth-surface-strong);
  outline: none;
}

.input-hint,
.auth-code-note,
.password-match {
  min-height: 1.15rem;
  color: var(--auth-muted);
  font-size: 0.76rem;
  font-weight: 750;
}

.submit-btn {
  min-height: 3.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  border: 0;
  border-radius: 18px;
  color: var(--auth-ink);
  background:
    linear-gradient(135deg, var(--auth-acid), #bff47b 52%, #72cfc0),
    var(--auth-acid);
  box-shadow: 0 16px 36px color-mix(in srgb, var(--auth-green) 22%, transparent);
  font-weight: 950;
  letter-spacing: -0.02em;
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.submit-btn:hover,
.submit-btn:focus-visible {
  box-shadow: 0 20px 44px color-mix(in srgb, var(--auth-green) 30%, transparent);
  filter: saturate(1.08);
  transform: translateY(-2px);
  outline: none;
}

.submit-btn:disabled {
  cursor: wait;
  filter: grayscale(0.25);
  opacity: 0.78;
}

.btn-loader {
  width: 1rem;
  height: 1rem;
  display: none;
  border: 2px solid rgba(32, 33, 31, 0.24);
  border-top-color: rgba(32, 33, 31, 0.82);
  border-radius: 999px;
  animation: spin 760ms linear infinite;
}

.submit-btn.loading .btn-loader {
  display: inline-block;
}

.form-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.2rem;
}

.footer-link {
  min-height: 2.55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex: 1 1 12rem;
  border: 1px solid var(--auth-line);
  border-radius: 999px;
  padding: 0.55rem 0.72rem;
  color: var(--auth-soft);
  background: color-mix(in srgb, var(--auth-surface-muted) 88%, transparent);
  font-size: 0.78rem;
  font-weight: 900;
}

button.footer-link {
  appearance: none;
}

.alert {
  display: block;
  margin: 0 0 0.85rem;
  border: 1px solid var(--auth-line);
  border-radius: 16px;
  padding: 0.75rem 0.85rem;
  color: var(--auth-soft);
  background: var(--auth-surface-muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.alert.is-hidden {
  display: none;
}

.alert-danger,
.alert-error {
  border-color: color-mix(in srgb, var(--auth-danger) 30%, var(--auth-line));
  color: var(--auth-danger);
  background: color-mix(in srgb, var(--auth-danger) 10%, var(--auth-surface-strong));
}

.alert-success {
  border-color: color-mix(in srgb, var(--auth-success) 28%, var(--auth-line));
  color: var(--auth-success);
  background: color-mix(in srgb, var(--auth-success) 10%, var(--auth-surface-strong));
}

.alert-info {
  border-color: color-mix(in srgb, var(--auth-teal) 24%, var(--auth-line));
  color: var(--auth-teal);
  background: color-mix(in srgb, var(--auth-teal) 10%, var(--auth-surface-strong));
}

.auth-progress {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.auth-progress__item {
  min-width: 0;
  display: grid;
  gap: 0.35rem;
  justify-items: center;
  border: 1px solid var(--auth-line);
  border-radius: 16px;
  padding: 0.58rem 0.45rem;
  color: var(--auth-muted);
  background: var(--auth-surface-muted);
}

.auth-progress__item span {
  width: 1.75rem;
  height: 1.75rem;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: var(--auth-muted);
  background: var(--auth-surface-strong);
  font-size: 0.75rem;
  font-weight: 950;
}

.auth-progress__item strong {
  font-size: 0.68rem;
  font-weight: 950;
  text-align: center;
  text-transform: uppercase;
}

.auth-progress__item.is-active {
  border-color: color-mix(in srgb, var(--auth-green) 38%, var(--auth-line));
  color: var(--auth-text);
}

.auth-progress__item.is-active span {
  color: var(--auth-ink);
  background: var(--auth-acid);
}

.auth-progress__item.is-complete {
  color: var(--auth-success);
}

.auth-progress__item.is-complete span {
  color: #fff;
  background: var(--auth-success);
}

.password-requirements {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
  margin-top: 0.15rem;
}

.requirement,
.match-text {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  border: 1px solid var(--auth-line);
  border-radius: 999px;
  padding: 0.4rem 0.56rem;
  color: var(--auth-muted);
  background: var(--auth-surface-muted);
  font-size: 0.72rem;
  font-weight: 850;
}

.requirement.met,
.match-text.valid {
  border-color: color-mix(in srgb, var(--auth-success) 28%, var(--auth-line));
  color: var(--auth-success);
}

.requirement.unmet,
.match-text.invalid {
  border-color: color-mix(in srgb, var(--auth-danger) 28%, var(--auth-line));
  color: var(--auth-danger);
}

.welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--auth-bg);
}

.welcome-content {
  display: grid;
  justify-items: center;
  gap: 0.7rem;
  text-align: center;
}

.welcome-logo {
  width: 5rem;
  height: 5rem;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 24px;
  background: var(--auth-surface-strong);
  box-shadow: var(--auth-shadow-soft);
}

.welcome-logo img {
  width: 72%;
  height: 72%;
  object-fit: contain;
}

.welcome-title {
  margin: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 950;
  letter-spacing: -0.08em;
}

.welcome-subtitle {
  margin: 0;
  color: var(--auth-soft);
  font-weight: 800;
}

.welcome-overlay.fade-out {
  opacity: 0;
  transition: opacity 500ms ease;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@keyframes authEnter {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1080px) {
  .auth-stage {
    padding: 1rem;
  }

  .auth-shell {
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .auth-visual {
    min-height: clamp(16rem, 34vw, 23rem);
  }

  .auth-visual img {
    object-position: center 42%;
  }

  .auth-story h1 {
    max-width: 15ch;
    font-size: clamp(2rem, 7vw, 3.3rem);
  }

  .auth-panel {
    padding-top: 0;
  }
}

@media (max-width: 760px) {
  body {
    background-size: 48px 100%, auto;
  }

  .auth-stage {
    min-height: 100svh;
    padding: 0.7rem;
  }

  .auth-shell {
    border-radius: 22px;
    gap: 0;
  }

  .auth-visual {
    min-height: 12.5rem;
    border-radius: 18px;
  }

  .auth-visual__content {
    padding: 0.9rem;
  }

  .auth-story {
    max-width: 22rem;
  }

  .auth-story h1 {
    max-width: 13ch;
    font-size: clamp(1.45rem, 8vw, 2rem);
    line-height: 0.96;
  }

  .auth-story p:not(.auth-kicker),
  .auth-visual__badges {
    display: none;
  }

  .auth-panel {
    padding: 0.72rem;
  }

  .auth-card {
    padding: 0.9rem;
    border-radius: 18px;
  }

  .auth-topbar {
    align-items: flex-start;
    margin-bottom: 1rem;
  }

  .auth-actions {
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
  }

  .auth-icon-link,
  .auth-theme-toggle {
    min-height: 2.2rem;
    padding: 0.45rem 0.56rem;
    font-size: 0.72rem;
  }

  .auth-panel__header h2 {
    font-size: clamp(1.68rem, 10vw, 2.25rem);
  }

  .auth-panel__header p {
    font-size: 0.9rem;
  }

  .auth-progress {
    grid-template-columns: none;
    grid-auto-columns: minmax(7.5rem, 1fr);
    grid-auto-flow: column;
    overflow-x: auto;
    padding-bottom: 0.1rem;
    scroll-snap-type: inline mandatory;
    scrollbar-width: none;
  }

  .auth-progress::-webkit-scrollbar {
    display: none;
  }

  .auth-progress__item {
    scroll-snap-align: start;
  }

  .password-requirements {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .auth-stage {
    padding: 0;
  }

  .auth-shell {
    min-height: 100svh;
    border-width: 0;
    border-radius: 0;
  }

  .auth-visual {
    min-height: 9.8rem;
    border-radius: 0 0 18px 18px;
  }

  .auth-brand__mark {
    width: 2.28rem;
    height: 2.28rem;
  }

  .auth-brand strong {
    font-size: 0.78rem;
  }

  .auth-brand small,
  .auth-icon-link span,
  .auth-theme-toggle__label {
    display: none;
  }

  .auth-card {
    width: 100%;
    border-width: 0;
    box-shadow: none;
    background: transparent;
  }

  .input-shell {
    min-height: 3.05rem;
    border-radius: 16px;
  }

  .submit-btn {
    min-height: 3.12rem;
  }

  .form-footer {
    display: grid;
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
