
:root {
  --bg: #FFFFFF;
  --bg-secondary: #FAFAFA;
  --bg-hover: #F5F5F5;
  --text: #171717;
  --text-secondary: #525252;
  --text-muted: #A3A3A3;
  --accent: #171717;
  --accent-hover: #262626;
  --border: #E5E5E5;
  --border-light: #F5F5F5;
  --error-bg: #FEF2F2;
  --error-text: #991B1B;
  --error-border: rgba(153, 27, 27, 0.1);
  --success-bg: #F0FDF4;
  --success-text: #166534;
  --success-border: rgba(22, 101, 52, 0.12);
  --radius-sm: 10px;
  --radius-md: 12px;
  --radius-pill: 999px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}

a { color: var(--accent); text-decoration: none; transition: color 0.15s; font-weight: 600; }
a:hover { color: var(--text-secondary); }

/* ── Layout ── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: var(--bg);
}

.auth-box {
  width: 100%;
  max-width: 380px;
}

/* ── Logo ── */
.auth-brand {
  display: block;
  width: auto;
  height: 1.9rem;
  margin-bottom: 1.5rem;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 0.375rem;
  line-height: 1.2;
}

.auth-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  line-height: 1.5;
}

/* ── Inputs ── */
.auth-field {
  margin-bottom: 0.875rem;
}

.auth-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.auth-input {
  width: 100%;
  padding: 0.7rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
}

.auth-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 23, 23, 0.06);
}

.auth-input::placeholder { color: var(--text-muted); }

/* Email pill shown in step 2 */
.auth-email-pill {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.3rem 0.7rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.hint { font-size: 0.72rem; color: var(--text-muted); margin: 0; }

/* Step label — small "Step N of 3" chip above each step */
.auth-step-label {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.625rem;
}

/* aria-invalid styling on inputs */
.auth-input[aria-invalid="true"] {
  border-color: var(--error-text);
  box-shadow: 0 0 0 3px rgba(153, 27, 27, 0.08);
}

/* Password strength meter — 4-segment bar, color shifts with score */
.auth-strength {
  display: none;
  align-items: center;
  gap: 0.625rem;
  margin-top: 0.5rem;
}
.auth-strength-bar {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
  position: relative;
}
.auth-strength-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  transition: width 0.18s ease, background-color 0.18s ease;
  background: var(--error-text);
}
.auth-strength[data-score="0"] .auth-strength-fill { width: 8%;  background: var(--error-text); }
.auth-strength[data-score="1"] .auth-strength-fill { width: 25%; background: #DC2626; }
.auth-strength[data-score="2"] .auth-strength-fill { width: 50%; background: #D97706; }
.auth-strength[data-score="3"] .auth-strength-fill { width: 75%; background: #65A30D; }
.auth-strength[data-score="4"] .auth-strength-fill { width: 100%; background: #15803D; }
.auth-strength-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 3.5rem;
  text-align: right;
}
.auth-strength[data-score="0"] .auth-strength-label { color: var(--error-text); }
.auth-strength[data-score="1"] .auth-strength-label { color: #DC2626; }
.auth-strength[data-score="2"] .auth-strength-label { color: #D97706; }
.auth-strength[data-score="3"] .auth-strength-label { color: #65A30D; }
.auth-strength[data-score="4"] .auth-strength-label { color: #15803D; }

.auth-btn[aria-busy="true"] { opacity: 0.7; cursor: progress; }

/* ── Buttons ── */
.auth-btn-row {
  display: grid;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.auth-btn-row.two-col { grid-template-columns: auto 1fr; }

.auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.12s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.auth-btn:hover { text-decoration: none; }

.auth-btn-primary {
  background: var(--accent);
  color: #fff;
  padding-right: 0.85rem;
}
.auth-btn-primary:hover { background: var(--accent-hover); color: #fff; }
.auth-btn-primary::after {
  content: '';
  display: inline-block;
  width: 1.3125rem;
  height: 1.3125rem;
  flex-shrink: 0;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'><path fill-rule='evenodd' d='M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128ZM157.66,122.34a8,8,0,0,1,0,11.32l-40,40a8,8,0,0,1-11.32-11.32L140.69,128,106.34,93.66a8,8,0,0,1,11.32-11.32Z'/></svg>") no-repeat center / contain;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'><path fill-rule='evenodd' d='M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128ZM157.66,122.34a8,8,0,0,1,0,11.32l-40,40a8,8,0,0,1-11.32-11.32L140.69,128,106.34,93.66a8,8,0,0,1,11.32-11.32Z'/></svg>") no-repeat center / contain;
}

.auth-btn-secondary {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.auth-btn-secondary:hover { border-color: var(--text-muted); color: var(--text); background: var(--bg-secondary); }

.auth-btn-full { grid-column: 1 / -1; }

/* ── Alert ── */
.auth-alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid;
  font-size: 0.875rem;
  margin-bottom: 1rem;
  line-height: 1.5;
}
.auth-alert-e { background: var(--error-bg); border-color: var(--error-border); color: var(--error-text); }
.auth-alert-s { background: var(--success-bg); border-color: var(--success-border); color: var(--success-text); }

/* ── Footer links ── */
.auth-links {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.825rem;
  color: var(--text-secondary);
}

/* ── Divider ── */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
  color: var(--text-muted);
  font-size: 0.75rem;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Animations ── */
@keyframes auth-fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes auth-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes auth-pop-in {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes auth-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

.auth-brand    { animation: auth-pop-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both; }
.auth-title    { animation: auth-fade-up 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.05s both; }
.auth-subtitle { animation: auth-fade-up 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.10s both; }
.auth-box form { animation: auth-fade-up 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both; }
.auth-links    { animation: auth-fade-up 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.25s both; }

/* Step toggle: animation re-runs each time display flips from none → block */
#step1, #step2, #step3 { animation: auth-fade-up 0.35s cubic-bezier(0.22, 1, 0.36, 1) both; }

.auth-email-pill { animation: auth-pop-in 0.35s cubic-bezier(0.22, 1, 0.36, 1) 0.05s both; }

.auth-alert    { animation: auth-fade-up 0.3s cubic-bezier(0.22, 1, 0.36, 1) both; }
.auth-alert-e  { animation: auth-shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both; }

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

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

/* ── Accessibility ── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; top: -40px; left: 8px; z-index: 100; padding: 0.5rem 0.875rem; background: var(--accent); color: #fff; border-radius: var(--radius-pill); font-size: 0.8rem; font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 8px; color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }
