/* ============================================================================
   Tensor Auth — Centered Glassmorphism SaaS Identity
   Aligned with Tensor's dual-theme Obsidian Violet / Cobalt Cyan (Dark) &
   Porcelain Frost (Light) glassmorphism architecture and flowing aurora waves.

   Preserved DOM hooks:
     username-auth.js:
       #container.sign-in / .sign-up
       .auth-col.sign-in / .auth-col.sign-up
       form#loginForm / form#signupForm
       #loginUsername #loginPassword #signupEmail #signupPassword
       #signupPasswordStep #loginPasswordStep
       #loginTurnstile #signupTurnstile
       #loginSubmit #signupSubmit
       #loginMessage #signupMessage
       #pwRuleLength #pwRuleLowercase #pwRuleUppercase #pwRuleNumber #pwRuleSpecial
       [data-auth-toggle] [data-show-password]
     forgot-password.js:
       #forgotForm #email #formMsg #requestBtn .notely-turnstile
   ========================================================================== */

:root,
html[data-theme="dark"] {
  --a-bg: #060c1c;
  --a-bg-soft: #091124;
  --a-surface: rgba(12, 20, 42, 0.62);
  --a-surface-solid: #0c152b;
  --a-surface-2: rgba(18, 28, 56, 0.72);
  --a-ink: #f4f6ff;
  --a-ink-2: #c9d4ea;
  --a-muted: #8b9bb8;
  --a-line: rgba(244, 246, 255, 0.12);
  --a-line-strong: rgba(143, 232, 248, 0.3);
  --a-accent: #8fe8f8;
  --a-accent-2: #2b5cd6;
  --a-accent-violet: #7c3aed;
  --a-accent-strong: #8fe8f8;
  --a-accent-soft: rgba(143, 232, 248, 0.12);
  --a-accent-ink: #051020;
  --a-grid: rgba(244, 246, 255, 0.045);
  --a-field: rgba(6, 12, 28, 0.58);
  --a-field-hover: rgba(143, 232, 248, 0.055);
  --a-err: #ff9cb5;
  --a-err-bg: rgba(255, 118, 152, 0.11);
  --a-err-line: rgba(255, 143, 171, 0.34);
  --a-ok: #7fe3c3;
  --a-ok-bg: rgba(127, 227, 195, 0.1);
  --a-ok-line: rgba(127, 227, 195, 0.3);
  --a-shadow:
    0 36px 96px -28px rgba(0, 0, 0, 0.88),
    0 0 42px -14px rgba(31, 111, 181, 0.32),
    0 0 0 1px rgba(143, 232, 248, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
  --a-wave-1: rgba(124, 58, 237, 0.38);
  --a-wave-2: rgba(43, 92, 214, 0.44);
  --a-wave-3: rgba(143, 232, 248, 0.24);
  color-scheme: dark;
}

html[data-theme="light"] {
  --a-bg: #f3f6fb;
  --a-bg-soft: #e9eff8;
  --a-surface: rgba(255, 255, 255, 0.78);
  --a-surface-solid: #ffffff;
  --a-surface-2: rgba(238, 244, 252, 0.88);
  --a-ink: #0b1220;
  --a-ink-2: #2b384e;
  --a-muted: #52627b;
  --a-line: rgba(11, 18, 32, 0.11);
  --a-line-strong: rgba(31, 111, 181, 0.28);
  --a-accent: #1f6fb5;
  --a-accent-2: #2563eb;
  --a-accent-violet: #7c3aed;
  --a-accent-strong: #155b96;
  --a-accent-soft: rgba(31, 111, 181, 0.09);
  --a-accent-ink: #ffffff;
  --a-grid: rgba(11, 18, 32, 0.055);
  --a-field: rgba(247, 250, 255, 0.84);
  --a-field-hover: rgba(31, 111, 181, 0.045);
  --a-err: #b4234b;
  --a-err-bg: rgba(180, 35, 75, 0.07);
  --a-err-line: rgba(180, 35, 75, 0.24);
  --a-ok: #08785d;
  --a-ok-bg: rgba(8, 120, 93, 0.07);
  --a-ok-line: rgba(8, 120, 93, 0.22);
  --a-shadow:
    0 32px 84px -26px rgba(15, 32, 68, 0.18),
    0 0 36px -14px rgba(31, 111, 181, 0.14),
    0 0 0 1px rgba(255, 255, 255, 0.86),
    inset 0 1px 0 rgba(255, 255, 255, 0.96);
  --a-wave-1: rgba(124, 58, 237, 0.16);
  --a-wave-2: rgba(37, 99, 235, 0.18);
  --a-wave-3: rgba(56, 189, 248, 0.16);
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--a-bg);
  color: var(--a-ink);
  font-family: "Inter", "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  position: relative;
}

/* --- Dynamic Flowing Silk Aurora Ambient Canvas -------------------------- */
.auth-ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  isolation: isolate;
}

.auth-grid-bg {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at center, var(--a-grid) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: radial-gradient(110% 80% at 50% 0%, #000 22%, transparent 82%);
  -webkit-mask-image: radial-gradient(110% 80% at 50% 0%, #000 22%, transparent 82%);
}

.auth-wave {
  position: absolute;
  border-radius: 44% 56% 52% 48% / 48% 42% 58% 52%;
  filter: blur(92px);
  will-change: transform;
}

.auth-wave-1 {
  width: 78vw;
  height: 44vh;
  top: -12vh;
  left: -14vw;
  background: linear-gradient(125deg, var(--a-wave-1) 0%, var(--a-wave-2) 55%, transparent 100%);
  transform: rotate(-14deg);
  animation: authWaveDriftA 18s ease-in-out infinite alternate;
}

.auth-wave-2 {
  width: 82vw;
  height: 46vh;
  top: 26vh;
  left: 12vw;
  background: linear-gradient(110deg, transparent 12%, var(--a-wave-2) 48%, var(--a-wave-3) 84%, transparent 100%);
  transform: rotate(-9deg);
  animation: authWaveDriftB 22s ease-in-out infinite alternate;
}

.auth-wave-3 {
  width: 72vw;
  height: 38vh;
  bottom: -14vh;
  right: -10vw;
  background: linear-gradient(135deg, var(--a-wave-3) 0%, var(--a-wave-1) 58%, transparent 100%);
  transform: rotate(12deg);
  animation: authWaveDriftC 20s ease-in-out infinite alternate;
}

@keyframes authWaveDriftA {
  0% { transform: translate3d(0, 0, 0) rotate(-14deg) scale(1); }
  100% { transform: translate3d(4vw, 3vh, 0) rotate(-9deg) scale(1.06); }
}

@keyframes authWaveDriftB {
  0% { transform: translate3d(0, 0, 0) rotate(-9deg) scale(1); }
  100% { transform: translate3d(-5vw, -2vh, 0) rotate(-14deg) scale(1.05); }
}

@keyframes authWaveDriftC {
  0% { transform: translate3d(0, 0, 0) rotate(12deg) scale(1); }
  100% { transform: translate3d(-3vw, -4vh, 0) rotate(7deg) scale(1.08); }
}

.auth-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(88px);
  opacity: 0.65;
}

.auth-orb-1 {
  width: 580px;
  height: 580px;
  top: -260px;
  left: -140px;
  background: radial-gradient(circle, var(--a-wave-2), transparent 70%);
}

.auth-orb-2 {
  width: 540px;
  height: 540px;
  bottom: -220px;
  right: -120px;
  background: radial-gradient(circle, var(--a-wave-3), var(--a-wave-1) 45%, transparent 72%);
}

.auth-orb-3 {
  display: none;
}

/* --- Glassmorphic Topbar ------------------------------------------------- */
.auth-topbar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 76px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 8px clamp(18px, 4vw, 36px) 0;
}

.auth-back-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--a-ink);
  white-space: nowrap;
  flex-shrink: 0;
}

.auth-back-brand img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  display: block;
}

.auth-back-brand span {
  font-family: "Plus Jakarta Sans", "Bricolage Grotesque", system-ui, sans-serif;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.auth-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.auth-home-link {
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--a-ink-2);
  text-decoration: none;
  white-space: nowrap;
  transition: color 160ms ease, background-color 160ms ease;
}

.auth-home-link:hover {
  color: var(--a-ink);
  background: var(--a-accent-soft);
}

.n-theme-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--a-line);
  background: var(--a-surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--a-ink-2);
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.n-theme-btn:hover {
  color: var(--a-ink);
  border-color: var(--a-line-strong);
  transform: translateY(-1px);
}

.n-theme-btn:focus-visible {
  outline: 2px solid var(--a-accent-strong);
  outline-offset: 3px;
}

.n-theme-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --- Centered Auth Layout (No Side Template / Balanced Glass Card) ------- */
.container {
  position: relative;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  max-width: 1240px;
  margin: 0 auto;
  min-height: calc(100vh - 70px);
  padding: clamp(20px, 4vw, 48px) clamp(16px, 4vw, 32px) clamp(40px, 6vw, 72px);
}

.auth-col {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.container.sign-in .auth-col.sign-up,
.container.sign-up .auth-col.sign-in {
  display: none;
}

.form-wrapper,
.verify-card {
  width: 100%;
  max-width: 468px;
  position: relative;
  overflow: visible;
  padding: clamp(26px, 3.6vw, 38px);
  border-radius: 24px;
  border: 1px solid var(--a-line);
  background: var(--a-surface);
  backdrop-filter: blur(28px) saturate(1.36);
  -webkit-backdrop-filter: blur(28px) saturate(1.36);
  box-shadow: var(--a-shadow);
  transition: border-color 240ms ease, box-shadow 260ms ease;
}

.form-wrapper::before,
.verify-card::before {
  content: "";
  position: absolute;
  inset: 0 24px auto 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(143, 232, 248, 0.5), transparent);
  opacity: 0.78;
  pointer-events: none;
  z-index: 2;
}

html[data-theme="light"] .form-wrapper::before,
html[data-theme="light"] .verify-card::before {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.98), transparent);
}

.form-wrapper:hover,
.form-wrapper:focus-within {
  border-color: var(--a-line-strong);
}

/* --- Form Chrome & Centered Switcher ------------------------------------- */
.form {
  display: grid;
  gap: 18px;
  position: relative;
  z-index: 1;
}

.auth-switch-bar {
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--a-line);
  background: var(--a-field);
}

.auth-mode-tab {
  border: 0;
  background: transparent;
  padding: 7px 15px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--a-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.auth-mode-tab:hover {
  color: var(--a-ink);
}

.container.sign-in .auth-mode-tab[data-auth-toggle="login"],
.container.sign-up .auth-mode-tab[data-auth-toggle="signup"] {
  background: var(--a-accent-soft);
  color: var(--a-accent-strong);
  box-shadow: inset 0 0 0 1px var(--a-line-strong);
}

html[data-theme="light"] .container.sign-in .auth-mode-tab[data-auth-toggle="login"],
html[data-theme="light"] .container.sign-up .auth-mode-tab[data-auth-toggle="signup"] {
  background: #ffffff;
  color: var(--a-accent-strong);
  box-shadow: 0 2px 8px -2px rgba(15, 32, 68, 0.14), inset 0 0 0 1px var(--a-line-strong);
}

.form-head--centered {
  text-align: center;
}

.form-head h1,
.form-head h3,
.verify-card h1 {
  margin: 0 0 8px;
  font-family: "Plus Jakarta Sans", "Bricolage Grotesque", system-ui, sans-serif;
  font-size: clamp(26px, 3vw, 32px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.12;
  color: var(--a-ink);
  text-wrap: balance;
}

.form-head p {
  margin: 0 auto;
  max-width: 38ch;
  font-size: 14px;
  line-height: 1.56;
  color: var(--a-muted);
}

/* Recovery Steps & Forgot Form */
.reset-steps {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.reset-step {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: "Inter", "DM Sans", system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--a-muted);
  border: 1px solid rgba(167, 139, 250, 0.25);
  border-radius: 12px;
  padding: 6px 12px;
  background: var(--a-field);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-theme="light"] .reset-step {
  border-color: rgba(37, 99, 235, 0.25);
}

.reset-step.is-active {
  color: var(--a-accent-strong);
  border-color: rgba(167, 139, 250, 0.55);
  background: var(--a-accent-soft);
  box-shadow: 0 0 18px rgba(124, 58, 237, 0.2), inset 0 1px 1px rgba(255, 255, 255, 0.2);
}

html[data-theme="light"] .reset-step.is-active {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 16px rgba(37, 99, 235, 0.16), inset 0 1px 1px rgba(255, 255, 255, 0.65);
}

.reset-step .num {
  font-family: "Geist Mono", ui-monospace, SFMono-Regular, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  opacity: 0.85;
}

.forgot-form {
  display: grid;
  gap: 16px;
}

/* Verify-email header chip compatibility */
.form-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.form-logo-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--a-ink);
}

.form-kicker {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--a-accent-strong);
}

/* --- Fields & Progressive Password Reveal -------------------------------- */
.field {
  display: grid;
  gap: 7px;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.field label,
.field-label-row label {
  font-size: 13px;
  font-weight: 600;
  color: var(--a-ink-2);
}

.field-hint {
  font-size: 11.5px;
  color: var(--a-muted);
  white-space: nowrap;
}

.pw-label-group {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.pw-info-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.pw-info-btn {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  border: 1px solid var(--a-line-strong);
  background: var(--a-accent-soft);
  color: var(--a-accent-strong);
  font-family: "Bricolage Grotesque", system-ui, sans-serif;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1;
  display: inline-grid;
  place-items: center;
  cursor: help;
  padding: 0;
  transition: transform 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

.pw-info-btn:hover,
.pw-info-btn:focus-visible {
  transform: scale(1.08);
  border-color: var(--a-accent-strong);
  outline: none;
}

.pw-info-tooltip {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  width: min(296px, 76vw);
  padding: 12px 14px;
  border-radius: 13px;
  border: 1px solid var(--a-line-strong);
  background: var(--a-surface-solid);
  color: var(--a-ink-2);
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.55;
  box-shadow: 0 22px 48px -16px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(143, 232, 248, 0.14);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  pointer-events: none;
  z-index: 30;
  transition: opacity 180ms ease, transform 180ms cubic-bezier(0.16, 1, 0.3, 1), visibility 180ms ease;
}

html[data-theme="light"] .pw-info-tooltip {
  box-shadow: 0 18px 40px -14px rgba(15, 32, 68, 0.22), 0 0 0 1px rgba(31, 111, 181, 0.18);
}

.pw-info-wrap:hover .pw-info-tooltip,
.pw-info-wrap:focus-within .pw-info-tooltip,
.pw-info-wrap.is-open .pw-info-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.auth-step-collapse {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition:
    grid-template-rows 340ms cubic-bezier(0.16, 1, 0.3, 1),
    opacity 240ms ease,
    transform 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-step-collapse.is-revealed {
  grid-template-rows: 1fr;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.auth-continue-btn[hidden] {
  display: none;
}

.auth-step-inner {
  overflow: hidden;
  display: grid;
  gap: 15px;
}

.auth-step-collapse.is-revealed .auth-step-inner {
  overflow: visible;
}

.input-group {
  border-radius: 12px;
  position: relative;
  display: flex;
  align-items: center;
  border: 1px solid var(--a-line);
  background: var(--a-field);
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.input-group:hover {
  border-color: var(--a-line-strong);
  background: var(--a-field-hover);
}

.input-group:focus-within {
  border-color: var(--a-accent-strong);
  background: var(--a-surface-solid);
  box-shadow: 0 0 0 3px var(--a-accent-soft);
}

.input-icon {
  display: grid;
  place-items: center;
  width: 40px;
  flex: none;
  color: var(--a-muted);
  pointer-events: none;
}

.input-icon svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.input-group:focus-within .input-icon {
  color: var(--a-accent-strong);
}

.input-group input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 12px 10px 12px 0;
  font-family: inherit;
  font-size: 14.5px;
  color: var(--a-ink);
}

.input-group input::placeholder {
  color: var(--a-muted);
  opacity: 0.78;
}

.input-group input:-webkit-autofill,
.input-group input:-webkit-autofill:hover,
.input-group input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--a-ink);
  -webkit-box-shadow: 0 0 0 1000px var(--a-surface-solid) inset;
  caret-color: var(--a-ink);
  transition: background-color 9999s ease-out;
}

.input-group input:focus-visible {
  outline: none;
}

.pw-toggle {
  flex: none;
  margin-right: 7px;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--a-line);
  background: var(--a-surface-2);
  color: var(--a-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: color 150ms ease, border-color 150ms ease, background-color 150ms ease;
}

.pw-toggle:hover {
  color: var(--a-ink);
  border-color: var(--a-line-strong);
}

.pw-toggle:focus-visible {
  outline: 2px solid var(--a-accent-strong);
  outline-offset: 2px;
}

/* Password Rules Checklist — calm by default, quietly green once a rule is
   satisfied. Unmet rules never shout while the user is still typing; the
   checklist simply fades in with the password step and settles as rules pass. */
.pw-rules {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 14px;
  padding: 2px 2px 4px;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 200ms ease, max-height 240ms ease;
}

.pw-rules.is-visible {
  opacity: 1;
  max-height: 220px;
}

.pw-rule {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--a-muted);
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  transition: color 180ms ease;
}

.pw-rule::before {
  content: "";
  flex: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1px solid var(--a-line-strong);
  background: transparent;
  transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.pw-rule--span {
  grid-column: 1 / -1;
}

.pw-rule.is-met {
  color: var(--a-ok);
  font-weight: 500;
}

.pw-rule.is-met::before {
  border-color: var(--a-ok);
  background: var(--a-ok);
  box-shadow: inset 0 0 0 3px var(--a-surface-solid);
}

/* A rule the user typed past and then deleted stays neutral — never red. */
.pw-rule.is-mismatch {
  color: var(--a-muted);
  font-weight: 500;
}

/* Meta Row */
.form-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.session-note {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--a-muted);
}

.session-note svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: var(--a-accent-strong);
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.forgot-link {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--a-accent-strong);
  text-decoration: none;
  white-space: nowrap;
}

.forgot-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.forgot-link--subtle {
  color: var(--a-muted);
}

.forgot-link--subtle:hover {
  color: var(--a-accent-strong);
}

/* Turnstile Slot */
.captcha {
  min-height: 0;
  display: flex;
  justify-content: center;
}

.captcha:empty {
  display: none;
}

.captcha iframe {
  max-width: 100%;
}

.notely-turnstile {
  display: flex;
  justify-content: center;
}

.notely-turnstile:empty {
  display: none;
}

/* --- Glass Primary & Secondary Buttons + Micro-Interactions --------------- */
.glass-btn-primary {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s ease;
}

.glass-btn-primary::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    120deg,
    transparent,
    rgba(255, 255, 255, 0.35),
    transparent
  );
  transition: left 0.55s ease;
  pointer-events: none;
}

.glass-btn-primary:hover {
  transform: translateY(-2px);
}

.glass-btn-primary:hover::before {
  left: 140%;
}

.glass-btn-primary:active {
  transform: scale(0.97);
}

.glass-btn-secondary {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(167, 139, 250, 0.25);
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-theme="light"] .glass-btn-secondary {
  border-color: rgba(37, 99, 235, 0.25);
}

.glass-btn-secondary:hover {
  border-color: rgba(167, 139, 250, 0.7);
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.25), inset 0 1px 1px rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

html[data-theme="light"] .glass-btn-secondary:hover {
  border-color: rgba(37, 99, 235, 0.65);
  box-shadow: 0 0 20px rgba(37, 99, 235, 0.2), inset 0 1px 1px rgba(255, 255, 255, 0.75);
}

/* --- Submit Button ------------------------------------------------------- */
.submit-btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 46px;
  padding: 13px 20px;
  border: 1px solid rgba(143, 232, 248, 0.45);
  border-radius: 12px;
  background: linear-gradient(135deg, var(--a-accent) 0%, #5fd3ee 50%, var(--a-accent-2) 100%);
  color: var(--a-accent-ink);
  cursor: pointer;
  font-family: "Inter", "DM Sans", system-ui, sans-serif;
  font-size: 14.5px;
  font-weight: 700;
  box-shadow: 0 14px 32px -12px rgba(31, 111, 181, 0.56);
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s ease, filter 160ms ease;
}

.submit-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    120deg,
    transparent,
    rgba(255, 255, 255, 0.35),
    transparent
  );
  transition: left 0.55s ease;
  pointer-events: none;
}

html[data-theme="light"] .submit-btn {
  border-color: rgba(21, 91, 150, 0.38);
  background: linear-gradient(135deg, #1f6fb5 0%, #115896 100%);
  color: #ffffff;
  box-shadow: 0 12px 26px -10px rgba(31, 111, 181, 0.42);
}

.submit-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 18px 36px -10px rgba(143, 232, 248, 0.48);
  filter: brightness(1.03);
}

.submit-btn:hover:not(:disabled)::before {
  left: 140%;
}

html[data-theme="light"] .submit-btn:hover:not(:disabled) {
  box-shadow: 0 16px 32px -10px rgba(31, 111, 181, 0.48);
}

.submit-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.submit-btn:focus-visible {
  outline: 2px solid var(--a-accent-strong);
  outline-offset: 3px;
}

.submit-btn:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.submit-btn.is-loading {
  color: transparent;
  pointer-events: none;
}

.submit-btn.is-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--a-accent-ink);
  border-top-color: transparent;
  animation: authSpin 700ms linear infinite;
}

html[data-theme="light"] .submit-btn.is-loading::after {
  border-color: #ffffff;
  border-top-color: transparent;
}

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

/* --- Inline field errors ------------------------------------------------- */
/* One line, quiet, directly under the field it belongs to. It only exists
   while a real, user-actionable problem exists — never while typing. */
.field-error {
  margin: -1px 0 0;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 12px;
  line-height: 1.5;
  font-weight: 500;
  color: var(--a-err);
  animation: fieldErrorIn 160ms cubic-bezier(0.16, 1, 0.3, 1);
}

.field-error[hidden] { display: none !important; }

@keyframes fieldErrorIn {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Red border is applied only by the field machinery in username-auth.js /
   forgot-password.js, and removed again the moment the user edits. */
.input-group.is-invalid {
  border-color: var(--a-err-line);
  background: color-mix(in srgb, var(--a-err-bg) 68%, transparent);
}

.input-group.is-invalid:focus-within {
  border-color: var(--a-err);
  background: var(--a-surface-solid);
  box-shadow: 0 0 0 3px var(--a-err-bg);
}

.input-group.is-valid {
  border-color: color-mix(in srgb, var(--a-ok) 42%, transparent);
}

input[aria-invalid="true"] { color: var(--a-ink); }

/* --- Inline alert banner ------------------------------------------------ */
/* Backend failures (invalid credentials, email already registered, …) land
   here: one dismissible banner inside the card, above the fields. */
.auth-alert {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--a-err-line);
  background: var(--a-err-bg);
  color: var(--a-err);
  font-size: 12.8px;
  line-height: 1.5;
  font-weight: 500;
  animation: authAlertIn 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-alert[hidden] { display: none !important; }

.auth-alert[data-type="success"] {
  border-color: var(--a-ok-line);
  background: var(--a-ok-bg);
  color: var(--a-ok);
}

.auth-alert[data-type="info"] {
  border-color: var(--a-line-strong);
  background: var(--a-accent-soft);
  color: var(--a-ink-2);
}

.auth-alert-ico {
  display: inline-flex;
  flex: none;
  margin-top: 1px;
}

.auth-alert-ico svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-alert-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }

.auth-alert-close {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin: -2px -3px 0 0;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  opacity: 0.68;
  cursor: pointer;
  transition: opacity 140ms ease, background-color 140ms ease;
}

.auth-alert-close:hover { opacity: 1; background: color-mix(in srgb, currentColor 12%, transparent); }
.auth-alert-close:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; opacity: 1; }

.auth-alert-close svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
}

@keyframes authAlertIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Legacy hooks kept so older embeds (verify-email) still render. */
.message,
.form-msg {
  font-size: 13px;
  line-height: 1.55;
  color: var(--a-muted);
  border-radius: 10px;
}

.message:empty,
.form-msg:not(.show) { display: none; }

.message[data-type="error"],
.form-msg.error {
  color: var(--a-err);
  background: var(--a-err-bg);
  border: 1px solid var(--a-err-line);
  padding: 10px 13px;
}

.message[data-type="success"],
.form-msg.success {
  color: var(--a-ok);
  background: var(--a-ok-bg);
  border: 1px solid var(--a-ok-line);
  padding: 10px 13px;
}

/* --- Footer Link Row ----------------------------------------------------- */
.form-foot {
  border-top: 1px solid var(--a-line);
  padding-top: 14px;
}

.form-foot p {
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--a-muted);
}

.form-foot--split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.form-foot--split p {
  justify-content: flex-start;
}

.pointer {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--a-accent-strong);
  text-decoration: none;
}

.pointer:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.pointer:focus-visible {
  outline: 2px solid var(--a-accent-strong);
  outline-offset: 3px;
}

/* --- Responsive ---------------------------------------------------------- */
@media (max-width: 560px) {
  .auth-topbar {
    height: 60px;
  }

  .auth-home-link {
    display: none;
  }

  .container {
    min-height: calc(100vh - 60px);
    padding: 18px 14px 36px;
  }

  .form-wrapper,
  .verify-card {
    padding: 22px 18px;
    border-radius: 20px;
  }

  .pw-rules {
    grid-template-columns: 1fr;
  }

  .pw-rule--span {
    grid-column: auto;
  }

  .form-foot--split {
    justify-content: center;
  }

  .pw-info-tooltip {
    left: -52px;
    width: min(272px, 74vw);
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-wave,
  .auth-step-collapse,
  .submit-btn,
  .input-group,
  .pw-rule,
  .pw-rules,
  .field-error,
  .auth-alert,
  .pw-info-tooltip {
    animation: none !important;
    transition: none !important;
  }

  .submit-btn.is-loading::after {
    animation-duration: 1.6s;
  }
}


/* --- Unified three-step OTP password recovery ---------------------------- */
.reset-flow { position: relative; }
.reset-panel { display: grid; gap: 18px; animation: resetPanelIn 220ms ease both; }
.reset-panel[hidden] { display: none !important; }
@keyframes resetPanelIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.reset-code-caption {
  color: var(--a-ink-2);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  letter-spacing: .02em;
}
.reset-otp-slots {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(7px, 2vw, 12px);
}
.reset-otp-input {
  width: 100%;
  min-width: 0;
  height: clamp(48px, 12vw, 62px);
  border: 1px solid var(--a-line-strong);
  border-radius: 12px;
  outline: none;
  background: var(--a-field);
  color: var(--a-ink);
  font: 700 22px/1 "Geist Mono", monospace;
  text-align: center;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.reset-otp-input:focus {
  border-color: var(--a-accent);
  box-shadow: 0 0 0 3px var(--a-accent-soft);
  background: var(--a-field-hover);
}
.reset-resend-line {
  margin: -2px 0 0;
  color: var(--a-muted);
  font-size: 12px;
  text-align: center;
}
.reset-text-button, .reset-back-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--a-accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.reset-text-button:disabled {
  color: var(--a-muted);
  cursor: not-allowed;
}
.reset-back-button {
  justify-self: center;
  color: var(--a-muted);
  font-size: 12px;
}
.reset-eye-button {
  flex: 0 0 auto;
  border: 0;
  padding: 0 12px;
  background: transparent;
  color: var(--a-accent);
  font: 600 12px/1 "Inter", sans-serif;
  cursor: pointer;
}
.reset-strength-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin: -4px 0 0;
  padding: 0;
  list-style: none;
}
.reset-strength-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--a-muted);
  font-size: 11.5px;
  line-height: 1.45;
  transition: color 180ms ease;
}
.reset-strength-list li::before {
  content: "";
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  border: 1px solid var(--a-line-strong);
  border-radius: 50%;
  transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}
.reset-strength-list li.is-met { color: var(--a-ok); }
.reset-strength-list li.is-met::before {
  border-color: var(--a-ok);
  background: var(--a-ok);
  box-shadow: inset 0 0 0 3px var(--a-surface-solid);
}
/* The hint only turns red once a mismatch has actually been confirmed (blur or
   submit). Before that it stays quiet, matching the in-card banner language. */
.reset-match-hint {
  min-height: 14px;
  margin: -10px 0 0;
  color: var(--a-muted);
  font-size: 11.5px;
  font-weight: 500;
}
.reset-match-hint.is-mismatch { color: var(--a-err); }
.reset-match-hint.is-match { color: var(--a-ok); }
@media (max-width: 420px) {
  .reset-otp-slots { gap: 6px; }
  .reset-otp-input { border-radius: 9px; font-size: 19px; }
  .reset-strength-list { grid-template-columns: 1fr; gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .reset-panel { animation: none; }
}
