:root {
  --bg: #eef2ff;
  --ink: #171717;
  --muted: rgba(23, 23, 23, 0.58);
  --line: rgba(23, 23, 23, 0.12);
  --panel-strong: rgba(255, 255, 255, 0.58);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
svg { display: block; }
[hidden] { display: none !important; }

.auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  display: grid;
  place-items: center;
  padding: 72px 24px 96px;
  overflow-x: hidden;
  isolation: isolate;
}

.auth-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(circle at 22% 22%, rgba(255, 255, 255, 0.72), transparent 30%),
    radial-gradient(circle at 82% 76%, rgba(199, 210, 254, 0.5), transparent 32%),
    #eef2ff;
}

.auth-shell::after {
  content: "";
  position: fixed;
  z-index: -1;
  left: 0;
  top: 0;
  width: 36vw;
  height: 100%;
  opacity: 0.28;
  pointer-events: none;
  background-image: linear-gradient(rgba(23, 23, 23, 0.055) 1px, transparent 1px), linear-gradient(90deg, rgba(23, 23, 23, 0.055) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: linear-gradient(90deg, #000, transparent);
  mask-image: linear-gradient(90deg, #000, transparent);
}

.auth-brand, .back-link {
  position: absolute;
  top: 30px;
  z-index: 5;
}
.auth-brand {
  left: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 82px;
  height: 58px;
  overflow: hidden;
}
.brand-logo,
.center-logo {
  display: block;
  width: 100%;
  height: 100%;
  background-image: url("assets/veiswap-logo.svg");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}
.center-logo { background-size: 118% auto; }

.back-link {
  right: 34px;
  min-height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: rgba(23, 23, 23, 0.7);
  font-size: 0.84rem;
  font-weight: 650;
}
.back-link:hover { color: #171717; transform: translateX(-2px); }
.back-link svg { width: 16px; height: 16px; }

.auth-card {
  width: min(100%, 430px);
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.auth-mark {
  width: 122px;
  height: 60px;
  margin: 0 auto 9px;
  overflow: hidden;
}
.auth-card h1 {
  margin: 0;
  text-align: center;
  font-family: "Inter Tight", "Arial Narrow", sans-serif;
  font-size: clamp(2.15rem, 5vw, 2.85rem);
  line-height: 1;
  letter-spacing: -0.055em;
  font-weight: 900;
}
.auth-subtitle {
  max-width: 310px;
  margin: 12px auto 28px;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}
.auth-form { display: grid; }
.field-label {
  margin: 0 0 8px;
  color: rgba(23,23,23,.72);
  font-size: .78rem;
  font-weight: 700;
}
.field-label:not(:first-child) { margin-top: 16px; }
.input-wrap {
  min-height: 50px;
  position: relative;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-strong);
}
.input-wrap:focus-within {
  border-color: rgba(23,23,23,.32);
  box-shadow: 0 0 0 4px rgba(23,23,23,.055);
  background: rgba(255,255,255,.78);
}
.input-wrap > svg {
  width: 17px;
  height: 17px;
  margin-left: 15px;
  flex: 0 0 auto;
  color: rgba(23,23,23,.48);
}
.input-wrap input {
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 0 14px 0 11px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: .92rem;
}
.input-wrap input::placeholder { color: rgba(23,23,23,.35); }
.input-wrap input[type="password"] { padding-right: 48px; }
.password-toggle {
  width: 42px;
  height: 42px;
  position: absolute;
  right: 3px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: rgba(23,23,23,.46);
}
.password-toggle svg { width: 17px; height: 17px; }
.form-message {
  min-height: 18px;
  margin: 10px 0 0;
  color: #a33a3a;
  font-size: .78rem;
  font-weight: 600;
}
.email-button, .google-button {
  width: 100%;
  min-height: 50px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
}
.email-button {
  margin-top: 4px;
  border: 1px solid #171717;
  background: #171717;
  color: #eef2ff;
  font-weight: 750;
}
.email-button:disabled { opacity: .55; cursor: wait; }
.email-button svg { width: 18px; height: 18px; }
.auth-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin: 22px 0;
  color: rgba(23,23,23,.4);
}
.auth-divider span { height: 1px; background: rgba(23,23,23,.1); }
.auth-divider small { font-size: .76rem; }
.google-button {
  border: 1px solid var(--line);
  background: rgba(255,255,255,.42);
  color: var(--ink);
  font-weight: 700;
}
.google-g { width: 19px; height: 19px; flex: 0 0 auto; }
.signin-copy {
  margin: 24px 0 0;
  text-align: center;
  color: rgba(23,23,23,.56);
  font-size: .84rem;
}
.signin-copy a { color: #171717; font-weight: 750; }

.otp-card { text-align: center; }
.otp-card .auth-mark { margin-bottom: 14px; }
.otp-badge {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(23,23,23,.13);
  border-radius: 18px;
  background: rgba(255,255,255,.55);
  box-shadow: 0 12px 34px rgba(23,23,23,.06);
  color: #171717;
  font-family: "Inter Tight", sans-serif;
  font-size: .92rem;
  font-weight: 900;
  letter-spacing: .08em;
}
.otp-subtitle {
  max-width: 350px;
  margin-bottom: 24px;
}
.otp-subtitle strong {
  display: block;
  margin-top: 3px;
  color: rgba(23,23,23,.82);
  font-weight: 750;
  overflow-wrap: anywhere;
}
.otp-form { display: grid; }
.otp-inputs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 9px;
}
.otp-input {
  width: 100%;
  aspect-ratio: 1 / 1;
  min-width: 0;
  border: 1px solid rgba(23,23,23,.14);
  border-radius: 14px;
  outline: 0;
  background: rgba(255,255,255,.62);
  color: #171717;
  text-align: center;
  font-family: "Inter Tight", sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  caret-color: #171717;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease, transform .16s ease;
}
.otp-input:focus {
  border-color: rgba(23,23,23,.48);
  background: rgba(255,255,255,.88);
  box-shadow: 0 0 0 4px rgba(23,23,23,.055);
  transform: translateY(-1px);
}
.otp-input.filled { border-color: rgba(23,23,23,.32); }
.otp-message { text-align: left; margin-top: 12px; }
.verify-button { margin-top: 2px; }
.otp-back {
  justify-self: center;
  margin-top: 16px;
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  background: transparent;
  color: rgba(23,23,23,.58);
  cursor: pointer;
  font-size: .8rem;
  font-weight: 700;
}
.otp-back:hover { color: #171717; }
.otp-back svg { width: 15px; height: 15px; }

.auth-legal {
  position: absolute;
  left: 50%;
  bottom: 24px;
  width: min(calc(100% - 36px), 620px);
  transform: translateX(-50%);
  margin: 0;
  text-align: center;
  color: rgba(23,23,23,.42);
  font-size: .72rem;
  line-height: 1.5;
}
.auth-legal a { color: rgba(23,23,23,.68); font-weight: 650; }

@media (max-width: 640px) {
  .auth-shell {
    display: block;
    min-height: 100dvh;
    padding: 64px 18px calc(30px + env(safe-area-inset-bottom));
  }
  .auth-brand { display: none; }
  .back-link { right: 16px; top: 18px; }
  .back-link span { display: none; }
  .auth-card { width: 100%; max-width: 430px; margin: 0 auto; }
  .auth-mark {
    width: 108px;
    height: 52px;
    margin: 0 auto 7px;
    overflow: hidden;
  }
  .center-logo { background-size: contain; background-position: center; }
  .auth-card h1 { font-size: clamp(2rem, 9.6vw, 2.55rem); line-height: .96; }
  .auth-subtitle { max-width: 290px; margin: 8px auto 18px; font-size: .84rem; line-height: 1.38; }
  .field-label { margin-bottom: 5px; font-size: .74rem; }
  .field-label:not(:first-child) { margin-top: 10px; }
  .input-wrap, .email-button, .google-button { min-height: 46px; border-radius: 11px; }
  .input-wrap input { height: 44px; font-size: .88rem; }
  .input-wrap > svg { margin-left: 13px; }
  .password-toggle { width: 38px; height: 38px; }
  .form-message { min-height: 12px; margin-top: 6px; font-size: .72rem; }
  .email-button { margin-top: 0; min-height: 46px; }
  .auth-divider { margin: 12px 0; }
  .google-button { min-height: 46px; }
  .signin-copy { margin-top: 14px; font-size: .8rem; }
  .auth-shell::after { width: 78vw; opacity: .2; }
  .auth-legal {
    position: static;
    width: min(100%, 620px);
    transform: none;
    margin: 20px auto 0;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    font-size: .66rem;
  }
  .otp-card { padding-top: 2px; }
  .otp-card .auth-mark { margin-bottom: 10px; }
  .otp-badge { width: 58px; height: 58px; margin-bottom: 16px; border-radius: 16px; }
  .otp-subtitle { margin-bottom: 20px; }
  .otp-inputs { gap: 6px; }
  .otp-input { border-radius: 12px; font-size: 1.2rem; }
  .otp-message { margin-top: 9px; }
}
