/* Auth pages share the workspace design language: tokens and component
   specs mirror onboarding.css (--ink, --card-radius, .btnBlack, pastel
   step tints) and dashboard.css (.softInput fields, --line hairlines). */
:root {
  color-scheme: light;
  --ink: #131a2e;
  --ink-soft: #5b6478;
  --line: rgba(15, 23, 42, 0.08);
  --card-radius: 26px;
  --accent-blue: #2e31ff;
  --good: #067647;
  --good-soft: #ecfdf3;
  --danger: #b42318;
  --danger-soft: #fef3f2;
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: #ffffff;
  overscroll-behavior: none;
}

body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font-family: "Google Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  /* Pastel tint pinned to the viewport, fading to white by 20% — same
     treatment as the onboarding steps this flow hands off to. */
  background: #ffffff;
  background-attachment: fixed;
  transition: background 600ms ease;
}

body[data-auth-view="sign-in"]        { background: linear-gradient(180deg, #e2f0ff 0%, #ffffff 20%) fixed; }
body[data-auth-view="sign-up"]        { background: linear-gradient(180deg, #fffce0 0%, #ffffff 20%) fixed; }
body[data-auth-view="forgot-password"],
body[data-auth-view="reset-password"] { background: linear-gradient(180deg, #efe6ff 0%, #ffffff 20%) fixed; }
body[data-auth-view="verify-email"]   { background: linear-gradient(180deg, #dcf6e3 0%, #ffffff 20%) fixed; }

button,
input { font: inherit; }

a { color: inherit; }

[hidden] { display: none !important; }

/* Brand centered above the card — same look as .obLogo on /onboarding. */
.authLogo {
  align-self: center;
  margin: 30px 0 0;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  text-decoration: none;
  font-size: 19px;
  font-weight: 700;
}

.authLogo img { width: 28px; height: 28px; }

.authStage {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 28px 24px 32px;
}

.authCard {
  width: min(430px, 100%);
  padding: 36px 34px 30px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  box-shadow: 0 18px 50px rgba(19, 26, 46, 0.08);
  animation: authEnter 460ms ease both;
}

.authHeading {
  margin-bottom: 26px;
  text-align: center;
}

.authEyebrow {
  margin: 0 0 8px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
}

.authHeading h1 {
  margin: 0;
  font-size: 29px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.authIntro {
  margin: 12px auto 0;
  max-width: 40ch;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.55;
}

.authAlert {
  margin: 0 0 20px;
  padding: 12px 14px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid #fecdca;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
}

.authAlert[data-tone="success"] {
  color: var(--good);
  background: var(--good-soft);
  border-color: #abefc6;
}

.providerSection {
  display: grid;
  gap: 10px;
}

/* White pill buttons — same spec as the dashboard's .installCta. */
.providerButton {
  position: relative;
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 48px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  transition: transform 140ms ease, background-color 140ms ease;
}

.providerButton:hover {
  transform: translateY(-1px);
  background: #fafbfc;
}

.providerButton:focus-visible,
.submitButton:focus-visible,
.visibilityButton:focus-visible,
input:focus-visible,
.debugLink:focus-visible,
.resultAction:focus-visible {
  outline: 3px solid rgba(19, 26, 46, 0.16);
  outline-offset: 2px;
}

.providerButton img,
.providerButton svg {
  position: absolute;
  left: 16px;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
}

.providerButton svg { fill: currentColor; }
.providerButton img { width: 22px; height: 22px; left: 17px; }

.authDivider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 22px 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.authDivider::before,
.authDivider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.authForm { display: grid; gap: 16px; }

.fieldGroup {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.fieldLabelRow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
}

.fieldLabelRow a {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  text-underline-offset: 3px;
}

.fieldLabelRow a:hover,
.authSwitch a:hover,
.authFooter a:hover { color: var(--accent-blue); }

/* Text fields — same spec as the dashboard's .softInput. */
.fieldGroup input {
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 16px;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.fieldGroup input:hover { border-color: rgba(15, 23, 42, 0.16); }
.fieldGroup input:focus {
  border-color: rgba(19, 26, 46, 0.32);
  box-shadow: 0 0 0 4px rgba(19, 26, 46, 0.05);
  outline: none;
}

.passwordControl { position: relative; display: block; }
.passwordControl input { padding-right: 50px; }

.visibilityButton {
  position: absolute;
  top: 50%;
  right: 6px;
  width: 38px;
  height: 38px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 140ms ease;
}

.visibilityButton:hover { color: var(--ink); background: rgba(16, 24, 40, 0.05); }
.visibilityButton svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.visibilityButton .eyeClosed { display: none; }
.visibilityButton[data-visible="true"] .eyeOpen { display: none; }
.visibilityButton[data-visible="true"] .eyeClosed { display: block; }

.fieldHint {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 400;
}

/* ---------- REUSABLE BLACK BUTTON ----------
   Shared spec (mirrored from onboarding.css / dashboard.css .btnBlack):
   fill #0A0920 + three inset white highlights for the glossy look. */
.btnBlack {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  background: #0a0920;
  color: #ffffff;
  font-weight: 600;
  cursor: pointer;
  box-shadow:
    inset 5px -2px 4px 0 rgba(255, 255, 255, 0.53),
    inset -2px 4px 4px 0 rgba(255, 255, 255, 0.35),
    inset -2px 19px 16px 0 rgba(255, 255, 255, 0.25),
    0 10px 22px rgba(10, 9, 32, 0.2);
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.btnBlack:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow:
    inset 5px -2px 4px 0 rgba(255, 255, 255, 0.53),
    inset -2px 4px 4px 0 rgba(255, 255, 255, 0.35),
    inset -2px 19px 16px 0 rgba(255, 255, 255, 0.25),
    0 14px 30px rgba(10, 9, 32, 0.28);
}

.btnBlack:active:not(:disabled) { transform: translateY(0); }

.submitButton {
  width: 100%;
  min-height: 50px;
  margin-top: 4px;
  font-size: 16px;
}

.submitButton:disabled { cursor: progress; opacity: 0.78; }

.submitSpinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: authSpin 700ms linear infinite;
}

.submitButton[data-loading="true"] .submitLabel { display: none; }
.submitButton[data-loading="true"] .submitSpinner { display: block; }

.authSwitch {
  margin: 22px 0 0;
  color: var(--ink-soft);
  text-align: center;
  font-size: 14px;
}

.authSwitch a,
.authFooter a {
  color: var(--ink);
  font-weight: 600;
  text-underline-offset: 3px;
}

.authResult { text-align: center; animation: authEnter 460ms ease both; }

.resultIcon {
  width: 52px;
  height: 52px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: #1f9d4d;
  border-radius: 50%;
}

.resultIcon svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.authResult h2 {
  margin: 0;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.authResult p {
  margin: 12px auto 24px;
  max-width: 38ch;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.55;
}

.debugLink,
.resultAction {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 140ms ease, background-color 140ms ease;
}

.debugLink { margin-bottom: 10px; color: #ffffff; background: var(--accent-blue); }
.debugLink:hover { transform: translateY(-1px); }

.resultAction {
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
}

.resultAction:hover { transform: translateY(-1px); background: #fafbfc; }

.authFooter {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  color: var(--ink-soft);
  text-align: center;
  font-size: 13px;
  line-height: 1.5;
}

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

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

@media (max-width: 560px) {
  .authLogo { margin-top: 22px; }
  .authStage { padding: 20px 16px 24px; }
  .authCard { padding: 28px 22px 24px; }
  .authHeading h1 { font-size: 26px; }
}

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