/* ==========================================================================
   VUNVAULT — AUTHENTICATION STYLESHEET
   --------------------------------------------------------------------------
   Pairs with login.html. Builds on the VUNVAULT design system:
     • primary brand      #3B99FC
     • brand strong       #1E7BE0
     • brand soft         #6FB6FF
     • deep surface       #0A0D12
   Covers:
     1.  Design tokens (mirrors vun1.css)
     2.  Reset & auth body
     3.  Ambient background (orbs + grid)
     4.  Blurred glassmorphic overlay + login card
     5.  Brand head
     6.  Social authentication buttons
     7.  OR divider
     8.  Credential form (inputs, eye toggle, validation)
     9.  Checkbox, submit button, sign-up, legal
     10. OTP modal (nested) + digit inputs + success view
     11. Toast stack
     12. Keyframes
     13. Responsive overrides
     14. Reduced motion & print
   ========================================================================== */


/* ==========================================================================
   1. DESIGN TOKENS
   ========================================================================== */
:root {
  /* Brand */
  --brand: #3B99FC;
  --brand-strong: #1E7BE0;
  --brand-soft: #6FB6FF;
  --brand-tint: rgba(59, 153, 252, 0.12);
  --brand-line: rgba(59, 153, 252, 0.28);
  --brand-glow: rgba(59, 153, 252, 0.45);

  /* Surfaces */
  --dark: #0A0D12;
  --dark-2: #10151D;
  --dark-3: #161C26;
  --black: #000000;
  --paper: #fcfbf9;
  --white: #ffffff;

  /* Ink (dark-theme inverts) */
  --ink: #171717;
  --ink-soft: #525252;
  --ink-muted: #737373;
  --ink-faint: #a3a3a3;

  /* Dark-theme text ramp */
  --txt-1: #eef2f7;
  --txt-2: #b9c4d4;
  --txt-3: #8593a6;
  --txt-4: #5a687d;

  /* Lines */
  --line: #e5e5e5;
  --line-soft: rgba(229, 229, 229, 0.8);
  --line-dark: #262626;
  --line-glass: rgba(255, 255, 255, 0.08);
  --line-glass-strong: rgba(255, 255, 255, 0.14);

  /* Status */
  --critical: #f43f5e;
  --high: #f59e0b;
  --medium: #eab308;
  --low: #3B99FC;
  --ok: #10b981;

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --dur: 200ms;

  /* Radii */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-2xl: 28px;
  --r-full: 9999px;

  /* Auth-specific */
  --auth-card-w: 460px;
  --auth-blur: 28px;
  --auth-scrim: rgba(5, 7, 10, 0.72);
}


/* ==========================================================================
   2. RESET & AUTH BODY
   ========================================================================== */
*,
::before,
::after {
  box-sizing: border-box;
  border-width: 0;
  border-style: solid;
  border-color: currentColor;
}

html {
  -webkit-text-size-adjust: 100%;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
}

body.vv-auth-body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--dark);
  color: var(--txt-1);
  font-family: inherit;
  line-height: inherit;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  position: relative;
}

body.vv-auth-body.vv-modal-open {
  overflow: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-size: inherit;
  font-weight: inherit;
  margin: 0;
}

p {
  margin: 0;
}

button,
input {
  font-family: inherit;
  font-size: 100%;
  font-weight: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  color: inherit;
  margin: 0;
  padding: 0;
}

button {
  -webkit-appearance: button;
  background-color: transparent;
  background-image: none;
  cursor: pointer;
  text-transform: none;
}

input {
  -webkit-appearance: none;
  appearance: none;
  background-color: transparent;
}

input::-ms-reveal,
input::-ms-clear {
  display: none;
}

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

svg {
  display: block;
  vertical-align: middle;
}

[hidden] {
  display: none !important;
}

::selection {
  background-color: var(--brand);
  color: #ffffff;
}

/* Focus ring — global */
:focus-visible {
  outline: none;
}

/* Scrollbar — slim, brand-tinted */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(59, 153, 252, 0.28);
  border-radius: 9999px;
  border: 3px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(59, 153, 252, 0.55);
  background-clip: padding-box;
}


/* ==========================================================================
   3. AMBIENT BACKGROUND — sits *behind* the blurred overlay
   ========================================================================== */
.vv-auth-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 15% 5%, rgba(59, 153, 252, 0.18), transparent 55%),
    radial-gradient(100% 80% at 85% 100%, rgba(111, 182, 255, 0.14), transparent 58%),
    linear-gradient(165deg, #0a0d12 0%, #05070a 55%, #000000 100%);
}

/* Floating luminous orbs */
.vv-orb {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
  will-change: transform;
}

.vv-orb--1 {
  top: -18%;
  left: -10%;
  width: 46vw;
  height: 46vw;
  max-width: 620px;
  max-height: 620px;
  background: radial-gradient(closest-side, rgba(59, 153, 252, 0.75), transparent 72%);
  animation: vvOrbFloat 22s var(--ease) infinite;
}

.vv-orb--2 {
  bottom: -22%;
  right: -12%;
  width: 52vw;
  height: 52vw;
  max-width: 680px;
  max-height: 680px;
  background: radial-gradient(closest-side, rgba(30, 123, 224, 0.7), transparent 72%);
  animation: vvOrbFloat 26s var(--ease) infinite reverse;
}

.vv-orb--3 {
  top: 38%;
  right: 22%;
  width: 26vw;
  height: 26vw;
  max-width: 340px;
  max-height: 340px;
  background: radial-gradient(closest-side, rgba(111, 182, 255, 0.55), transparent 74%);
  animation: vvOrbFloat 18s var(--ease) infinite;
  animation-delay: -6s;
}

/* Receding perspective grid */
.vv-auth-grid {
  position: absolute;
  inset: -20%;
  background-image:
    linear-gradient(to right, rgba(59, 153, 252, 0.10) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(59, 153, 252, 0.10) 1px, transparent 1px);
  background-size: 64px 64px;
  transform: rotateX(62deg) translateZ(-120px) scale(1.6);
  transform-origin: 50% 60%;
  -webkit-mask-image: radial-gradient(60% 55% at 50% 50%, #000 0%, transparent 78%);
  mask-image: radial-gradient(60% 55% at 50% 50%, #000 0%, transparent 78%);
  opacity: 0.45;
  animation: vvGridDrift 6s linear infinite;
}

/* Diagonal scanline sweep */
.vv-auth-scanline {
  position: absolute;
  left: -20%;
  right: -20%;
  height: 40vh;
  top: -40vh;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(59, 153, 252, 0.07),
    transparent
  );
  animation: vvAuthScan 9s linear infinite;
}


/* ==========================================================================
   4. BLURRED GLASSMORPHIC OVERLAY + LOGIN CARD
   ========================================================================== */
.vv-auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 20px;

  /* The signature blurred scrim */
  background: var(--auth-scrim);
  backdrop-filter: blur(var(--auth-blur)) saturate(1.35);
  -webkit-backdrop-filter: blur(var(--auth-blur)) saturate(1.35);

  /* Fallback for browsers without backdrop-filter */
  background-color: rgba(5, 7, 10, 0.86);

  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Restore the true transparent scrim where blur is supported */
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .vv-auth-overlay {
    background-color: var(--auth-scrim);
  }
}

/* ------------------------------- login card ------------------------------- */
.vv-auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--auth-card-w);
  padding: 38px 36px 30px;
  margin: auto;

  border-radius: var(--r-2xl);
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(59, 153, 252, 0.14), transparent 60%),
    linear-gradient(165deg, rgba(16, 21, 29, 0.92), rgba(8, 11, 16, 0.96));

  border: 1px solid var(--brand-line);
  box-shadow:
    0 50px 100px -40px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 0 60px -30px var(--brand-glow);

  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);

  animation: vvCardIn 0.55s var(--ease-out) both;
  transition: opacity 0.3s var(--ease), filter 0.3s var(--ease),
              transform 0.3s var(--ease);
}

/* When the OTP modal opens, dim the login card behind it */
.vv-auth-card.is-dimmed {
  opacity: 0.35;
  filter: blur(3px);
  transform: scale(0.985);
  pointer-events: none;
}

/* Decorative top hairline */
.vv-auth-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--brand), transparent);
  opacity: 0.75;
  border-radius: var(--r-full);
  pointer-events: none;
}


/* ==========================================================================
   5. BRAND HEAD
   ========================================================================== */
.vv-auth-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  margin-bottom: 26px;
}

.vv-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 14px;
}

.vv-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--dark), #000000);
  border: 1px solid rgba(59, 153, 252, 0.38);
  box-shadow:
    0 0 0 1px rgba(59, 153, 252, 0.08),
    0 8px 22px -12px var(--brand-glow);
  transition: transform var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
}

.vv-brand-mark svg {
  width: 22px;
  height: 22px;
}

.vv-brand:hover .vv-brand-mark {
  transform: translateY(-2px);
  box-shadow:
    0 0 0 1px rgba(59, 153, 252, 0.25),
    0 12px 28px -14px var(--brand-glow);
}

.vv-brand-name {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: #ffffff;
  text-shadow: 0 0 24px rgba(59, 153, 252, 0.35);
}

.vv-auth-title {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--txt-1);
}

.vv-auth-sub {
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--txt-3);
}


/* ==========================================================================
   6. SOCIAL AUTHENTICATION BUTTONS
   ========================================================================== */
.vv-social-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.vv-social-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 10px;

  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--txt-2);

  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-glass);
  border-radius: var(--r-md);

  transition: background-color 0.22s var(--ease),
              border-color 0.22s var(--ease),
              color 0.22s var(--ease),
              transform 0.22s var(--ease),
              box-shadow 0.22s var(--ease);
}

.vv-social-btn:hover {
  color: #ffffff;
  background: rgba(59, 153, 252, 0.10);
  border-color: var(--brand-line);
  transform: translateY(-2px);
  box-shadow: 0 14px 28px -18px var(--brand-glow);
}

.vv-social-btn:active {
  transform: translateY(0) scale(0.98);
}

.vv-social-btn:focus-visible {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(59, 153, 252, 0.22);
}

.vv-social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
}

.vv-social-icon svg {
  width: 18px;
  height: 18px;
}

/* GitHub icon inherits currentColor */
.vv-social-btn[data-vv-provider="GitHub"] .vv-social-icon {
  color: #e6edf3;
}

.vv-social-label {
  white-space: nowrap;
}


/* ==========================================================================
   7. OR DIVIDER
   ========================================================================== */
.vv-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 22px 0;

  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--txt-4);
}

.vv-divider::before,
.vv-divider::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(59, 153, 252, 0.30),
    transparent
  );
}


/* ==========================================================================
   8. CREDENTIAL FORM
   ========================================================================== */
.vv-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.vv-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.vv-field-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.vv-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--txt-3);
}

/* ------------------------------ input wrap ------------------------------ */
.vv-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.vv-input-icon {
  position: absolute;
  left: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: var(--txt-4);
  pointer-events: none;
  transition: color 0.22s var(--ease);
}

.vv-input-wrap:focus-within .vv-input-icon {
  color: var(--brand);
}

.vv-input {
  width: 100%;
  padding: 13px 14px 13px 42px;

  font-size: 0.86rem;
  font-weight: 500;
  color: var(--txt-1);

  background: rgba(5, 8, 13, 0.72);
  border: 1px solid var(--line-glass);
  border-radius: var(--r-md);

  outline: none;
  transition: border-color 0.22s var(--ease),
              box-shadow 0.22s var(--ease),
              background-color 0.22s var(--ease);
}

.vv-input--pw {
  padding-right: 48px;
  letter-spacing: 0.02em;
}

.vv-input::placeholder {
  color: var(--txt-4);
  font-weight: 400;
}

.vv-input:hover {
  border-color: rgba(255, 255, 255, 0.16);
}

.vv-input:focus {
  background: rgba(5, 8, 13, 0.95);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(59, 153, 252, 0.18),
              0 0 24px -12px var(--brand-glow);
}

/* Autofill — Chromium repaint fix */
.vv-input:-webkit-autofill,
.vv-input:-webkit-autofill:hover,
.vv-input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--txt-1);
  -webkit-box-shadow: 0 0 0 1000px rgba(5, 8, 13, 0.98) inset;
  caret-color: var(--txt-1);
  border-color: var(--brand-line);
  transition: background-color 9999s ease-in-out 0s;
}

/* Invalid state */
.vv-input.is-invalid {
  border-color: var(--critical);
  box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.16);
  animation: vvShake 0.32s var(--ease);
}

.vv-input.is-invalid + .vv-eye,
.vv-input-wrap:has(.vv-input.is-invalid) .vv-input-icon {
  color: var(--critical);
}

/* ------------------------------ eye toggle ------------------------------ */
.vv-eye {
  position: absolute;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;

  color: var(--txt-4);
  background: transparent;
  border: 1px solid transparent;

  transition: color 0.22s var(--ease),
              background-color 0.22s var(--ease),
              border-color 0.22s var(--ease);
}

.vv-eye:hover {
  color: var(--brand-soft);
  background: rgba(59, 153, 252, 0.10);
  border-color: var(--brand-line);
}

.vv-eye:focus-visible {
  color: var(--brand);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(59, 153, 252, 0.20);
}

.vv-eye svg {
  width: 17px;
  height: 17px;
  pointer-events: none;
}

/* Icon swap — default shows "eye on", toggled shows "eye off" */
.vv-eye .vv-eye-off { display: none; }
.vv-eye.is-visible .vv-eye-on { display: none; }
.vv-eye.is-visible .vv-eye-off { display: block; }

/* ------------------------------ inline error ------------------------------ */
.vv-error {
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.5;
  color: #fb7185;
  padding-left: 2px;
}

.vv-error:empty {
  display: none;
}

.vv-error--center {
  text-align: center;
  padding-left: 0;
  margin-top: 12px;
}

/* ------------------------------ inline link ------------------------------ */
.vv-link {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--brand-soft);
  border-radius: 4px;
  transition: color 0.2s var(--ease);
}

.vv-link:hover {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.vv-link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 153, 252, 0.22);
}


/* ==========================================================================
   9. CHECKBOX, SUBMIT, SIGN-UP, LEGAL
   ========================================================================== */

/* ------------------------------ checkbox ------------------------------ */
.vv-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.vv-checkbox input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.vv-checkmark {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;

  color: transparent;
  background: rgba(5, 8, 13, 0.72);
  border: 1px solid var(--line-glass-strong);
  border-radius: 6px;

  transition: background-color 0.2s var(--ease),
              border-color 0.2s var(--ease),
              color 0.2s var(--ease),
              box-shadow 0.2s var(--ease);
}

.vv-checkmark svg {
  width: 11px;
  height: 11px;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.18s var(--ease), transform 0.18s var(--ease);
}

.vv-checkbox:hover .vv-checkmark {
  border-color: var(--brand-line);
}

.vv-checkbox input:focus-visible + .vv-checkmark {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(59, 153, 252, 0.20);
}

.vv-checkbox input:checked + .vv-checkmark {
  color: #ffffff;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  border-color: transparent;
  box-shadow: 0 6px 16px -10px var(--brand-glow);
}

.vv-checkbox input:checked + .vv-checkmark svg {
  opacity: 1;
  transform: scale(1);
}

.vv-checkbox-text {
  font-size: 0.76rem;
  line-height: 1.5;
  color: var(--txt-3);
}

/* ------------------------------ submit ------------------------------ */
.vv-submit {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 6px;
  padding: 14px 24px;

  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #ffffff;

  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-strong) 100%);
  border: 1px solid rgba(59, 153, 252, 0.5);
  border-radius: var(--r-md);

  box-shadow:
    0 16px 36px -18px var(--brand-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);

  transition: transform 0.22s var(--ease),
              filter 0.22s var(--ease),
              box-shadow 0.22s var(--ease),
              opacity 0.22s var(--ease);
}

.vv-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow:
    0 22px 46px -20px var(--brand-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.vv-submit:active:not(:disabled) {
  transform: translateY(0) scale(0.99);
}

.vv-submit:focus-visible {
  box-shadow:
    0 0 0 3px rgba(59, 153, 252, 0.35),
    0 16px 36px -18px var(--brand-glow);
}

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

.vv-submit-label {
  transition: opacity 0.2s var(--ease);
}

/* Spinner */
.vv-spinner {
  position: absolute;
  right: 18px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.32);
  border-top-color: #ffffff;
  opacity: 0;
  animation: spin 0.7s linear infinite;
  transition: opacity 0.2s var(--ease);
}

.vv-submit.is-loading {
  pointer-events: none;
}

.vv-submit.is-loading .vv-submit-label {
  opacity: 0.72;
}

.vv-submit.is-loading .vv-spinner {
  opacity: 1;
}

/* ------------------------------ sign-up ------------------------------ */
.vv-signup {
  margin-top: 22px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--txt-3);
}

.vv-signup-link {
  margin-left: 5px;
  font-weight: 800;
  color: var(--brand-soft);
  border-radius: 4px;
  transition: color 0.2s var(--ease), text-shadow 0.2s var(--ease);
}

.vv-signup-link:hover {
  color: #ffffff;
  text-shadow: 0 0 18px var(--brand-glow);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.vv-signup-link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 153, 252, 0.22);
}

/* ------------------------------ legal / trust ------------------------------ */
.vv-legal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line-glass);

  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--txt-4);
  text-align: center;
}

.vv-legal svg {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  color: var(--ok);
}


/* ==========================================================================
   10. OTP MODAL (nested) + SUCCESS VIEW
   ========================================================================== */
.vv-otp-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;

  background: rgba(3, 5, 8, 0.78);
  backdrop-filter: blur(22px) saturate(1.3);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);

  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s var(--ease), visibility 0.28s var(--ease);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.vv-otp-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.vv-otp-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: auto;
  padding: 34px 32px 28px;

  border-radius: var(--r-2xl);
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(59, 153, 252, 0.16), transparent 60%),
    linear-gradient(165deg, rgba(16, 21, 29, 0.96), rgba(8, 11, 16, 0.98));

  border: 1px solid var(--brand-line);
  box-shadow:
    0 50px 100px -40px rgba(0, 0, 0, 0.95),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 0 60px -30px var(--brand-glow);

  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);

  transform: translateY(14px) scale(0.98);
  transition: transform 0.32s var(--ease-out);
}

.vv-otp-overlay.is-open .vv-otp-card {
  transform: translateY(0) scale(1);
}

.vv-otp-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--brand), transparent);
  opacity: 0.75;
  border-radius: var(--r-full);
  pointer-events: none;
}

/* Shake on invalid code */
.vv-otp-card.vv-shake {
  animation: vvShakeStrong 0.42s var(--ease);
}

/* ------------------------------ close button ------------------------------ */
.vv-otp-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;

  color: var(--txt-4);
  background: transparent;
  border: 1px solid transparent;

  transition: color 0.2s var(--ease),
              background-color 0.2s var(--ease),
              border-color 0.2s var(--ease);
}

.vv-otp-close:hover {
  color: #ffffff;
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.35);
}

.vv-otp-close:focus-visible {
  color: var(--brand);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(59, 153, 252, 0.22);
}

/* ------------------------------ views ------------------------------ */
.vv-otp-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  animation: vvFadeUp 0.35s var(--ease-out) both;
}

.vv-otp-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  margin-bottom: 16px;
  border-radius: 50%;

  color: var(--brand);
  background:
    radial-gradient(closest-side, rgba(59, 153, 252, 0.22), transparent 72%),
    rgba(59, 153, 252, 0.08);
  border: 1px solid var(--brand-line);
  box-shadow: 0 0 34px -12px var(--brand-glow);
}

.vv-otp-icon svg {
  width: 26px;
  height: 26px;
}

.vv-otp-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--txt-1);
}

.vv-otp-sub {
  margin-top: 8px;
  font-size: 0.82rem;
  line-height: 1.65;
  color: var(--txt-3);
  max-width: 34ch;
}

.vv-otp-sub strong {
  color: var(--brand-soft);
  font-weight: 700;
}

/* ------------------------------ digit inputs ------------------------------ */
.vv-otp-inputs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 9px;
  width: 100%;
  margin-top: 24px;
}

.vv-otp-digit {
  width: 100%;
  aspect-ratio: 1 / 1.15;
  min-width: 0;
  padding: 0;

  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 1.4rem;
  font-weight: 800;
  text-align: center;
  color: var(--txt-1);

  background: rgba(5, 8, 13, 0.75);
  border: 1px solid var(--line-glass-strong);
  border-radius: var(--r-md);
  outline: none;
  caret-color: var(--brand);

  transition: border-color 0.2s var(--ease),
              box-shadow 0.2s var(--ease),
              background-color 0.2s var(--ease),
              transform 0.2s var(--ease),
              color 0.2s var(--ease);
}

.vv-otp-digit:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.20);
}

.vv-otp-digit:focus {
  background: rgba(5, 8, 13, 0.98);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(59, 153, 252, 0.20),
              0 0 28px -12px var(--brand-glow);
  transform: translateY(-2px);
}

/* Filled state */
.vv-otp-digit.is-filled {
  color: #ffffff;
  border-color: var(--brand-line);
  background: rgba(59, 153, 252, 0.10);
}

/* Error state */
.vv-otp-digit.is-error {
  color: #fb7185;
  border-color: var(--critical);
  background: rgba(244, 63, 94, 0.10);
  box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.16);
  animation: vvShake 0.32s var(--ease);
}

/* Success state */
.vv-otp-digit.is-ok {
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(16, 185, 129, 0.10);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.14);
}

.vv-otp-digit:disabled {
  cursor: default;
  opacity: 0.85;
}

/* OTP submit reuses .vv-submit with margin-top from .vv-form absence */
.vv-otp-view form {
  width: 100%;
}

.vv-otp-view .vv-submit {
  margin-top: 20px;
}

/* ------------------------------ OTP footer ------------------------------ */
.vv-otp-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 10px;
  margin-top: 20px;
  font-size: 0.76rem;
  color: var(--txt-3);
}

.vv-otp-foot-text {
  white-space: nowrap;
}

.vv-link-btn {
  padding: 4px 2px;
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--brand-soft);
  background: transparent;
  border: 0;
  border-radius: 6px;
  transition: color 0.2s var(--ease), text-shadow 0.2s var(--ease);
}

.vv-link-btn:hover:not(:disabled) {
  color: #ffffff;
  text-shadow: 0 0 16px var(--brand-glow);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.vv-link-btn:disabled {
  color: var(--txt-4);
  cursor: not-allowed;
  text-decoration: none;
  text-shadow: none;
}

.vv-link-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 153, 252, 0.22);
}

.vv-otp-timer {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--txt-4);
  white-space: nowrap;
}

.vv-otp-timer:empty {
  display: none;
}

/* ------------------------------ back button ------------------------------ */
.vv-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 20px;
  padding: 8px 12px;

  font-size: 0.74rem;
  font-weight: 700;
  color: var(--txt-3);

  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-full);

  transition: color 0.2s var(--ease),
              background-color 0.2s var(--ease),
              border-color 0.2s var(--ease);
}

.vv-back svg {
  transition: transform 0.2s var(--ease);
}

.vv-back:hover {
  color: #ffffff;
  background: rgba(59, 153, 252, 0.10);
  border-color: var(--brand-line);
}

.vv-back:hover svg {
  transform: translateX(-3px);
}

.vv-back:focus-visible {
  color: var(--brand);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(59, 153, 252, 0.22);
}

/* ------------------------------ success view ------------------------------ */
.vv-otp-success {
  animation: vvFadeUp 0.4s var(--ease-out) both;
}

.vv-success-ring {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  margin-bottom: 18px;
  border-radius: 50%;

  color: #ffffff;
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow:
    0 0 0 8px rgba(16, 185, 129, 0.12),
    0 20px 44px -18px rgba(16, 185, 129, 0.75);

  animation: vvSuccessPop 0.5s var(--ease-out) both;
}

.vv-success-ring svg {
  width: 30px;
  height: 30px;
}

.vv-otp-success .vv-otp-title {
  color: #ffffff;
}

.vv-success-bar {
  position: relative;
  width: 100%;
  height: 3px;
  margin-top: 24px;
  border-radius: var(--r-full);
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.vv-success-bar span {
  position: absolute;
  inset: 0 auto 0 0;
  display: block;
  width: 0;
  border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--brand-strong), var(--brand-soft));
  box-shadow: 0 0 14px var(--brand-glow);
  animation: vvSuccessBar 1.4s var(--ease) forwards;
}


/* ==========================================================================
   11. TOAST STACK
   ========================================================================== */
.vv-toast-stack {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(360px, calc(100vw - 40px));
  pointer-events: none;
}

.vv-toast {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 14px 14px 14px;

  border-radius: var(--r-lg);
  background:
    radial-gradient(120% 100% at 100% 0%, rgba(59, 153, 252, 0.14), transparent 62%),
    linear-gradient(160deg, rgba(16, 21, 29, 0.97), rgba(8, 11, 16, 0.99));

  border: 1px solid var(--brand-line);
  box-shadow:
    0 28px 60px -28px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset;

  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);

  pointer-events: auto;
  opacity: 0;
  transform: translateX(28px) scale(0.97);
  transition: opacity 0.32s var(--ease-out), transform 0.32s var(--ease-out);
}

.vv-toast.is-in {
  opacity: 1;
  transform: translateX(0) scale(1);
}

.vv-toast.is-out {
  opacity: 0;
  transform: translateX(28px) scale(0.97);
}

/* Accent rail */
.vv-toast::before {
  content: "";
  position: absolute;
  top: 10%;
  bottom: 10%;
  left: 0;
  width: 3px;
  border-radius: var(--r-full);
  background: linear-gradient(180deg, var(--brand), var(--brand-strong));
  box-shadow: 0 0 18px var(--brand-glow);
}

.vv-toast--success::before {
  background: linear-gradient(180deg, #34d399, #059669);
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.6);
}

.vv-toast--info::before {
  background: linear-gradient(180deg, var(--brand-soft), var(--brand));
}

/* Icon */
.vv-toast-icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;

  color: var(--brand-soft);
  background: rgba(59, 153, 252, 0.12);
  border: 1px solid var(--brand-line);
}

.vv-toast--success .vv-toast-icon {
  color: #34d399;
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
}

.vv-toast-icon svg {
  width: 16px;
  height: 16px;
}

/* Body */
.vv-toast-body {
  flex: 1 1 auto;
  min-width: 0;
}

.vv-toast-title {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--txt-1);
  line-height: 1.35;
}

.vv-toast-msg {
  margin-top: 3px;
  font-size: 0.72rem;
  line-height: 1.55;
  color: var(--txt-3);
}

/* OTP code row */
.vv-toast-code-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.vv-toast-code {
  flex: 1 1 auto;
  display: block;
  padding: 9px 12px;

  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  text-align: center;
  color: #ffffff;

  background: rgba(59, 153, 252, 0.12);
  border: 1px dashed var(--brand-line);
  border-radius: var(--r-sm);
  user-select: all;
  -webkit-user-select: all;
}

.vv-toast-copy {
  flex: 0 0 auto;
  padding: 8px 12px;

  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-soft);

  background: rgba(59, 153, 252, 0.10);
  border: 1px solid var(--brand-line);
  border-radius: var(--r-sm);

  transition: color 0.2s var(--ease),
              background-color 0.2s var(--ease),
              border-color 0.2s var(--ease);
}

.vv-toast-copy:hover {
  color: #ffffff;
  background: rgba(59, 153, 252, 0.22);
  border-color: var(--brand);
}

.vv-toast-copy.is-copied {
  color: #34d399;
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.45);
}

.vv-toast-copy:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 153, 252, 0.22);
}

/* Close */
.vv-toast-close {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;

  color: var(--txt-4);
  background: transparent;
  border: 1px solid transparent;

  transition: color 0.2s var(--ease),
              background-color 0.2s var(--ease),
              border-color 0.2s var(--ease);
}

.vv-toast-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--line-glass-strong);
}

.vv-toast-close:focus-visible {
  color: var(--brand);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(59, 153, 252, 0.22);
}


/* ==========================================================================
   12. KEYFRAMES
   ========================================================================== */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes vvCardIn {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.965);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes vvFadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes vvShake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-4px); }
  75%      { transform: translateX(4px); }
}

@keyframes vvShakeStrong {
  0%, 100% { transform: translateX(0); }
  15%      { transform: translateX(-9px); }
  30%      { transform: translateX(8px); }
  45%      { transform: translateX(-6px); }
  60%      { transform: translateX(5px); }
  80%      { transform: translateX(-3px); }
}

@keyframes vvOrbFloat {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  33%      { transform: translate3d(4%, -6%, 0) scale(1.08); }
  66%      { transform: translate3d(-5%, 4%, 0) scale(0.95); }
}

@keyframes vvGridDrift {
  from { background-position: 0 0, 0 0; }
  to   { background-position: 0 64px, 64px 0; }
}

@keyframes vvAuthScan {
  0%   { transform: translateY(0); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translateY(180vh); opacity: 0; }
}

@keyframes vvSuccessPop {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  60% {
    opacity: 1;
    transform: scale(1.08);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes vvSuccessBar {
  from { width: 0%; }
  to   { width: 100%; }
}


/* ==========================================================================
   13. RESPONSIVE OVERRIDES
   ========================================================================== */

/* ---- <= 640px : tablet-ish ---- */
@media (max-width: 640px) {
  .vv-auth-overlay {
    padding: 20px 14px;
    align-items: flex-start;
  }

  .vv-auth-card {
    margin-top: 6vh;
    padding: 30px 24px 24px;
    border-radius: var(--r-xl);
  }

  .vv-auth-title {
    font-size: 1.4rem;
  }

  .vv-social-label {
    display: none;
  }

  .vv-social-btn {
    padding: 13px 10px;
  }

  .vv-social-icon,
  .vv-social-icon svg {
    width: 20px;
    height: 20px;
  }

  .vv-otp-card {
    padding: 28px 22px 24px;
    border-radius: var(--r-xl);
  }

  .vv-otp-inputs {
    gap: 7px;
  }

  .vv-otp-digit {
    font-size: 1.15rem;
    border-radius: var(--r-sm);
  }

  .vv-toast-stack {
    top: 12px;
    right: 12px;
    left: 12px;
    width: auto;
  }

  .vv-toast {
    transform: translateY(-16px) scale(0.98);
  }

  .vv-toast.is-in {
    transform: translateY(0) scale(1);
  }

  .vv-toast.is-out {
    transform: translateY(-16px) scale(0.98);
  }
}

/* ---- <= 420px : tight phones ---- */
@media (max-width: 420px) {
  .vv-auth-overlay {
    padding: 14px 10px;
  }

  .vv-auth-card {
    margin-top: 3vh;
    padding: 26px 18px 22px;
    border-radius: var(--r-lg);
  }

  .vv-auth-title {
    font-size: 1.25rem;
  }

  .vv-auth-sub {
    font-size: 0.76rem;
  }

  .vv-divider {
    margin: 18px 0;
  }

  .vv-otp-card {
    padding: 26px 16px 22px;
  }

  .vv-otp-inputs {
    gap: 5px;
  }

  .vv-otp-digit {
    font-size: 1.02rem;
    border-radius: 8px;
  }

  .vv-otp-icon {
    width: 52px;
    height: 52px;
    margin-bottom: 12px;
  }

  .vv-otp-icon svg {
    width: 22px;
    height: 22px;
  }

  .vv-otp-title {
    font-size: 1.15rem;
  }

  .vv-toast-code {
    font-size: 0.92rem;
    letter-spacing: 0.24em;
    text-indent: 0.24em;
  }
}

/* ---- Landscape phones ---- */
@media (max-height: 560px) and (orientation: landscape) {
  .vv-auth-overlay {
    align-items: flex-start;
    padding-top: 24px;
    padding-bottom: 24px;
  }

  .vv-auth-card {
    margin-top: 0;
    padding: 24px 26px 22px;
  }

  .vv-brand {
    margin-bottom: 8px;
  }

  .vv-auth-head {
    margin-bottom: 18px;
  }
}


/* ==========================================================================
   14. REDUCED MOTION & PRINT
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  ::before,
  ::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .vv-orb,
  .vv-auth-grid,
  .vv-auth-scanline,
  .vv-spinner,
  .vv-success-ring,
  .vv-success-bar span {
    animation: none !important;
  }

  .vv-auth-card,
  .vv-otp-card,
  .vv-toast {
    opacity: 1 !important;
    transform: none !important;
  }

  .vv-otp-overlay {
    transition: none !important;
  }
}

@media print {
  .vv-auth-bg,
  .vv-toast-stack {
    display: none !important;
  }

  body.vv-auth-body {
    background: #ffffff;
  }

  .vv-auth-overlay {
    position: static;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 0;
  }

  .vv-auth-card {
    box-shadow: none;
    border: 1px solid #ddd;
    background: #ffffff;
    color: #000;
  }
}