@font-face { font-family: 'Geo'; font-weight: 700; font-display: swap; src: url('assets/fonts/CalSansUI-GeoBold.woff2') format('woff2'); }
@font-face { font-family: 'Geo'; font-weight: 500; font-display: swap; src: url('assets/fonts/CalSansUI-GeoMedium.woff2') format('woff2'); }
@font-face { font-family: 'Text'; font-weight: 600; font-display: swap; src: url('assets/fonts/CalSansUI-TextSemiBold.woff2') format('woff2'); }
@font-face { font-family: 'Text'; font-weight: 400; font-display: swap; src: url('assets/fonts/CalSansUI-TextRegular.woff2') format('woff2'); }
@font-face { font-family: 'UI'; font-weight: 700; font-display: swap; src: url('assets/fonts/CalSansUI-UIBold.woff2') format('woff2'); }
@font-face { font-family: 'UI'; font-weight: 600; font-display: swap; src: url('assets/fonts/CalSansUI-UISemiBold.woff2') format('woff2'); }
@font-face { font-family: 'UI'; font-weight: 400; font-display: swap; src: url('assets/fonts/CalSansUI-UIRegular.woff2') format('woff2'); }

:root {
  --blue: #3358b8;
  --blue-bright: #5478d9;
  --ink: #14120f;
  --white: #fff;
  --muted-white: rgba(20, 18, 15, 0.68);
  --line: rgba(20, 18, 15, 0.2);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; overflow-x: hidden; }
body { margin: 0; background: var(--white); font-family: 'Text', sans-serif; color: var(--ink); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.auth-shell {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  overflow-x: hidden;
  isolation: isolate;
  padding: 104px 24px 82px;
}
.auth-background {
  position: fixed;
  inset: 0;
  z-index: -3;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
}
.auth-scrim {
  display: none;
}

.brand {
  position: absolute;
  top: 24px;
  left: 50%;
  z-index: 3;
  transform: translateX(-50%);
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 10px 18px;
  border: 1px solid rgba(20, 18, 15, 0.18);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  font-family: 'Geo', sans-serif;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1;
  text-decoration: none;
}
.brand-name { color: var(--blue); }
.brand-domain { color: var(--ink); }
.back-link {
  position: absolute;
  top: 25px;
  left: 28px;
  z-index: 3;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 15px;
  border: 1px solid rgba(20, 18, 15, 0.25);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  font-family: 'UI', sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.back-link svg { width: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }

.auth-content {
  width: min(100%, 470px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: auth-content-in 1080ms both;
  will-change: transform;
}
.auth-intro { text-shadow: none; }
.eyebrow { margin: 0 0 13px; color: rgba(20, 18, 15, 0.64); font-family: 'UI', sans-serif; font-size: 10px; font-weight: 700; letter-spacing: 0.18em; }
h1 {
  margin: 0;
  font-family: 'Geo', sans-serif;
  font-size: clamp(32px, 2.8vw, 37px);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 0.98;
  white-space: nowrap;
}
h1 span { color: var(--blue); }
.auth-subtitle { margin: 18px 0 0; color: rgba(20, 18, 15, 0.7); font-size: 14px; line-height: 1.55; }

.mode-switch {
  width: 100%;
  max-width: 316px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-top: 27px;
  padding: 4px;
  border: 1px solid rgba(20, 18, 15, 0.22);
  border-radius: 999px;
  background: var(--white);
}
.mode-tab {
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(20, 18, 15, 0.7);
  cursor: pointer;
  font-family: 'UI', sans-serif;
  font-size: 13px;
  font-weight: 600;
  transition: color 180ms var(--ease), background-color 180ms var(--ease), transform 180ms var(--ease);
}
.mode-tab.is-active { background: var(--blue); color: var(--white); }
.mode-tab:active { transform: scale(0.98); }

.social-row { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.social-button {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid rgba(20, 18, 15, 0.24);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  font-family: 'UI', sans-serif;
  font-size: 12px;
  font-weight: 600;
  transition: transform 180ms var(--ease), background-color 180ms var(--ease), border-color 180ms var(--ease);
}
.social-button:hover { background: #f3f2ef; border-color: rgba(20, 18, 15, 0.42); transform: translateY(-1px); }
.social-button:active { transform: scale(0.98); }
.social-button svg { width: 19px; height: 19px; }
.divider { width: 100%; display: flex; align-items: center; gap: 12px; margin: 16px 0; color: rgba(20, 18, 15, 0.58); font-family: 'UI', sans-serif; font-size: 9px; font-weight: 700; letter-spacing: 0.12em; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.account-form { width: 100%; display: flex; flex-direction: column; gap: 11px; }
.form-field { width: 100%; }
.form-field[hidden], .signup-only[hidden], .login-only[hidden] { display: none !important; }
.form-field > label { display: block; margin: 0 0 6px 18px; color: rgba(20, 18, 15, 0.7); font-family: 'UI', sans-serif; font-size: 9px; font-weight: 700; letter-spacing: 0.08em; text-align: left; text-transform: uppercase; }
.input-shell {
  position: relative;
  min-height: 54px;
  display: flex;
  align-items: center;
  padding: 4px 5px 4px 17px;
  border: 1px solid rgba(20, 18, 15, 0.3);
  border-radius: 999px;
  background: var(--white);
  transition: border-color 180ms var(--ease), background-color 180ms var(--ease), box-shadow 180ms var(--ease);
}
.input-shell:focus-within { border-color: var(--ink); background: var(--white); }
.input-shell > svg { flex: 0 0 auto; width: 19px; height: 19px; fill: none; stroke: rgba(20, 18, 15, 0.68); stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.input-shell input { min-width: 0; flex: 1; height: 44px; padding: 0 11px; border: 0; outline: 0; background: transparent; color: var(--ink); font-family: 'Text', sans-serif; font-size: 14px; }
.input-shell input::placeholder { color: rgba(20, 18, 15, 0.5); }
.input-shell input:-webkit-autofill { -webkit-text-fill-color: var(--ink); -webkit-box-shadow: 0 0 0 1000px var(--white) inset; caret-color: var(--ink); }
.visibility-button {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}
.visibility-button { width: 40px; height: 40px; background: transparent; color: rgba(20, 18, 15, 0.65); }
.visibility-button:hover { color: var(--ink); background: rgba(20, 18, 15, 0.06); }
.visibility-button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.password-meta { min-height: 20px; display: flex; align-items: center; justify-content: flex-end; padding: 3px 14px 0; color: rgba(20, 18, 15, 0.62); font-family: 'UI', sans-serif; font-size: 10px; }
.password-meta > span { padding: 3px 8px; border-radius: 999px; background: var(--white); }
.forgot-button { min-height: 28px; margin: -2px -8px 0 0; padding: 0 10px; border: 1px solid rgba(20, 18, 15, 0.14); border-radius: 999px; background: var(--white); color: rgba(20, 18, 15, 0.75); cursor: pointer; font-family: 'UI', sans-serif; font-size: 11px; font-weight: 600; }
.forgot-button:hover { color: var(--ink); }
.consent-row { display: grid; grid-template-columns: 19px 1fr; gap: 10px; align-items: start; padding: 3px 12px 0; color: rgba(20, 18, 15, 0.7); cursor: pointer; font-family: 'UI', sans-serif; font-size: 10.5px; line-height: 1.45; text-align: left; }
.consent-row input { width: 18px; height: 18px; margin: 0; accent-color: var(--blue); }
.consent-row a { color: var(--ink); text-underline-offset: 2px; }
.form-error { min-height: 18px; margin: -2px 0 0; color: #9b2020; font-family: 'UI', sans-serif; font-size: 11px; font-weight: 600; }
.submit-button { min-height: 54px; display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: -2px; border: 0; border-radius: 999px; background: var(--blue); color: var(--white); cursor: pointer; font-family: 'UI', sans-serif; font-size: 14px; font-weight: 700; transition: background-color 180ms var(--ease), transform 180ms var(--ease); }
.submit-button:hover { background: var(--blue-bright); transform: translateY(-1px); }
.submit-button:active { transform: scale(0.985); }
.submit-button svg { width: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.9; }

.success-state { width: 100%; max-width: 380px; margin-top: 28px; animation: step-in 0.45s var(--ease) both; }
.success-state[hidden] { display: none; }
.success-mark { width: 48px; height: 48px; display: grid; place-items: center; margin: 0 auto 14px; border-radius: 50%; background: var(--blue); font-family: 'UI', sans-serif; font-weight: 700; }
.success-kicker { margin: 0 0 8px; color: var(--blue); font-family: 'UI', sans-serif; font-size: 9px; font-weight: 700; letter-spacing: 0.16em; }
.success-state h2 { margin: 0; font-family: 'Geo', sans-serif; font-size: 34px; }
.success-state > p:not(.success-kicker) { color: var(--muted-white); font-size: 14px; line-height: 1.5; }
.success-state button { min-height: 46px; padding: 0 22px; border: 1px solid rgba(20, 18, 15, 0.25); border-radius: 999px; background: var(--white); color: var(--ink); cursor: pointer; font-family: 'UI', sans-serif; font-size: 13px; font-weight: 600; }

.legal-links { position: absolute; right: 28px; bottom: 25px; z-index: 3; display: flex; align-items: center; gap: 20px; }
.legal-links a { color: rgba(20, 18, 15, 0.62); font-family: 'UI', sans-serif; font-size: 11px; font-weight: 600; text-decoration: none; transition: color 180ms var(--ease); }
.legal-links a:hover { color: var(--ink); }
.auth-toast { position: fixed; left: 50%; bottom: 28px; z-index: 8; max-width: calc(100% - 40px); transform: translate(-50%, 18px); padding: 11px 16px; border: 1px solid rgba(255, 255, 255, 0.24); border-radius: 999px; background: rgba(9, 10, 12, 0.86); backdrop-filter: blur(12px); color: var(--white); font-family: 'UI', sans-serif; font-size: 12px; opacity: 0; pointer-events: none; transition: opacity 180ms var(--ease), transform 180ms var(--ease); }
.auth-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

button:focus-visible, a:focus-visible { outline: 3px solid rgba(134, 164, 255, 0.92); outline-offset: 3px; }

@keyframes auth-content-in {
  0% {
    transform: translate3d(-110vw, 0, 0);
    animation-timing-function: cubic-bezier(0.12, 0.72, 0.18, 1);
  }
  70% {
    transform: translate3d(28px, 0, 0);
    animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);
  }
  84% {
    transform: translate3d(-11px, 0, 0);
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  }
  94% { transform: translate3d(4px, 0, 0); }
  100% { transform: translate3d(0, 0, 0); }
}
@keyframes step-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 640px) {
  .auth-shell { align-items: start; padding: 94px 18px 80px; }
  .auth-background { object-position: 64% 50%; }
  .brand { top: 18px; font-size: 18px; min-height: 44px; padding: 9px 15px; }
  .back-link { top: 18px; left: 14px; width: 44px; height: 44px; min-height: 44px; padding: 0; justify-content: center; }
  .back-link span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .auth-content { margin: 48px auto 0; }
  .eyebrow { margin-bottom: 9px; }
  h1 { font-size: clamp(22px, 7vw, 31px); }
  .auth-subtitle { max-width: 300px; margin: 12px auto 0; font-size: 13px; }
  .mode-switch { margin-top: 20px; }
  .social-row { grid-template-columns: 1fr; gap: 8px; }
  .social-button { min-height: 46px; }
  .divider { margin: 12px 0; }
  .account-form { gap: 10px; }
  .legal-links { right: auto; left: 50%; bottom: 20px; transform: translateX(-50%); }
  .auth-toast { bottom: 68px; }
}

@media (max-height: 720px) and (min-width: 641px) {
  .auth-shell { align-items: start; padding-top: 92px; padding-bottom: 54px; }
  .auth-content { margin: 10px auto 0; }
  h1 { font-size: 48px; }
  .auth-subtitle { margin-top: 10px; }
  .mode-switch { margin-top: 16px; }
  .social-row { margin-top: 10px; }
  .divider { margin: 10px 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
