.auth-page {
  min-height: calc(100vh - var(--navbar-height));
  padding: 1.5rem 0 2.5rem;
  background:
    radial-gradient(circle at top, color-mix(in srgb, var(--primary) 10%, transparent), transparent 38%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
}

.auth-page .container {
  min-height: calc(100vh - var(--navbar-height) - 4rem);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-page,
.auth-page button,
.auth-page input,
.auth-page textarea,
.auth-page select {
  font-family: var(--font-family-sans, "Inter", "Segoe UI", Arial, sans-serif);
}

.auth-shell {
  width: 100%;
  max-width: 460px;
}

.auth-card {
  width: 100%;
  padding: 1.2rem;
  border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
  border-radius: 28px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--section-panel-bg, var(--bg-elevated)) 96%, white 4%), color-mix(in srgb, var(--bg-elevated) 96%, transparent)),
    var(--section-panel-bg, var(--bg-elevated));
  box-shadow: var(--card-shadow);
}

.auth-card__header {
  display: grid;
  gap: 0.8rem;
  margin-bottom: 1rem;
  text-align: center;
}

.auth-card__eyebrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: fit-content;
  margin: 0 auto;
  padding: 0.38rem 0.72rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
  font-size: 0.73rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-card__header h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.55rem, 4vw, 1.95rem);
  font-weight: var(--font-weight-heavy, 800);
  line-height: var(--line-height-heading, 1.12);
  letter-spacing: var(--letter-spacing-heading, -0.02em);
}

.auth-card__header p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.55;
}

.auth-recommendation {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin: 0 auto;
  padding: 0.32rem 0.66rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--primary) 18%, transparent);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 700;
}

.auth-social-stack,
.auth-form,
.auth-card__footer {
  display: grid;
  gap: 0.9rem;
}

.auth-provider-button,
.auth-button {
  position: relative;
  width: 100%;
  min-height: 56px;
  padding: 0.9rem 1rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  font-weight: var(--font-weight-bold, 700);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease,
    background-color 0.2s ease,
    color 0.2s ease;
}

.auth-provider-button {
  text-decoration: none;
}

.auth-provider-button:focus-visible,
.auth-button:focus-visible,
.auth-accordion__trigger:focus-visible,
.toggle-password:focus-visible,
.auth-link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent);
}

.auth-provider-button:hover:not(:disabled),
.auth-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.auth-provider-button:active:not(:disabled),
.auth-button:active:not(:disabled) {
  transform: translateY(0);
}

.auth-provider-button:disabled,
.auth-button:disabled {
  cursor: not-allowed;
}

.auth-provider-button__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
}

.auth-provider-button__icon img {
  width: 100%;
  height: 100%;
  display: block;
}

.auth-provider-button__meta {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.auth-provider-button__tag {
  display: inline-flex;
  align-items: center;
  min-height: 1.45rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.auth-provider-button--google {
  border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--border));
  background:
    linear-gradient(135deg, color-mix(in srgb, white 88%, var(--bg-elevated)), color-mix(in srgb, var(--primary-soft) 56%, var(--bg-elevated)));
  color: #111827;
  box-shadow: var(--card-shadow);
}

html[data-theme="dark"] .auth-provider-button--google {
  color: #f8fafc;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--bg-elevated) 88%, white 12%), color-mix(in srgb, var(--primary) 14%, var(--bg-elevated)));
}

.auth-provider-button--google:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--primary) 42%, var(--border));
  box-shadow: var(--card-shadow);
}

.auth-provider-button--apple {
  border: 1px solid color-mix(in srgb, var(--border) 95%, transparent);
  background: color-mix(in srgb, var(--bg-soft) 84%, transparent);
  color: var(--text);
  opacity: 0.84;
}

.auth-provider-button--apple .auth-provider-button__icon {
  font-size: 1.05rem;
}

.auth-provider-button--apple:hover:not(:disabled) {
  border-color: var(--border);
}

.auth-provider-button[data-loading="true"] .auth-provider-button__icon {
  opacity: 0.6;
}

.auth-provider-button__loading,
.btn-loading {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.auth-provider-button__loading::before,
.btn-loading::before {
  content: "";
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 999px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: auth-spin 0.7s linear infinite;
}

.auth-provider-button__loading[hidden],
.btn-loading[hidden] {
  display: none;
}

.auth-status,
.auth-error,
.auth-success,
.auth-google-feedback {
  padding: 0.85rem 0.95rem;
  border-radius: 16px;
  border: 1px solid transparent;
  font-size: 0.86rem;
  line-height: 1.5;
}

.auth-error,
.auth-google-feedback {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

.auth-success,
.auth-google-feedback.is-success {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.auth-google-note {
  margin: -0.15rem 0 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
}

.auth-accordion {
  margin-top: 1rem;
  border: 1px solid color-mix(in srgb, var(--border) 90%, transparent);
  border-radius: 22px;
  background: var(--section-panel-bg-subtle, color-mix(in srgb, var(--bg-soft) 75%, transparent));
  overflow: clip;
}

.auth-accordion__trigger {
  width: 100%;
  padding: 1rem 1.05rem;
  border: 0;
  background: transparent;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  text-align: left;
}

.auth-accordion__copy {
  display: grid;
  gap: 0.24rem;
}

.auth-accordion__label {
  font-size: 0.96rem;
  font-weight: 740;
}

.auth-accordion__hint {
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.auth-accordion__meta {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.auth-accordion__pill {
  display: inline-flex;
  align-items: center;
  min-height: 1.5rem;
  padding: 0 0.5rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.auth-accordion__chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
  color: var(--text-muted);
  transition: transform 0.22s ease;
}

.auth-accordion__trigger[aria-expanded="true"] .auth-accordion__chevron {
  transform: rotate(180deg);
}

.auth-accordion__panel {
  height: auto;
  overflow: hidden;
  transition: height 0.24s ease, opacity 0.24s ease;
  opacity: 0;
}

.auth-accordion__panel.is-open {
  opacity: 1;
}

.auth-accordion__inner {
  padding: 0 1.05rem 1.05rem;
  border-top: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
}

.auth-form {
  gap: 0.95rem;
}

.auth-field {
  display: grid;
  gap: 0.42rem;
}

.auth-field label {
  font-size: 0.88rem;
  font-weight: 680;
  color: var(--text);
}

.auth-field small {
  display: block;
  min-height: 1.1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.error-text {
  display: block;
  color: #dc2626;
}

.auth-input-wrap {
  position: relative;
}

.auth-input {
  width: 100%;
  min-height: 52px;
  padding: 0.88rem 0.95rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

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

.auth-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 14%, transparent);
}

.auth-input.is-invalid {
  border-color: #dc2626;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.1);
}

.auth-input.is-valid {
  border-color: #16a34a;
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.1);
}

.auth-input--with-icon {
  padding-right: 3.25rem;
}

.toggle-password {
  position: absolute;
  top: 50%;
  right: 0.65rem;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.toggle-password:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.toggle-password:active {
  transform: translateY(-50%) scale(0.97);
}

.toggle-password i {
  font-size: 1rem;
  line-height: 1;
  pointer-events: none;
}

.auth-form__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  font-size: 0.88rem;
}

.auth-check {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.55rem;
  color: var(--text-muted);
}

.auth-check input {
  margin-top: 0.2rem;
  accent-color: var(--primary);
}

.auth-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 680;
}

.auth-link:hover {
  text-decoration: underline;
}

.auth-button {
  border: 0;
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 76%, white 24%));
  color: white;
  box-shadow: var(--card-shadow);
}

.auth-button--secondary {
  background: color-mix(in srgb, var(--bg-elevated) 98%, transparent);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 1rem 0;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--border);
}

.auth-divider span {
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.password-rules {
  display: grid;
  gap: 0.42rem;
  padding: 0.9rem 0.95rem;
  border-radius: 16px;
  background: color-mix(in srgb, var(--bg-soft) 92%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
}

.password-rules span {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.password-rules span::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.35;
}

.password-rules span.valid {
  color: #15803d;
  font-weight: 650;
}

.password-rules span.invalid {
  color: #dc2626;
  font-weight: 650;
}

.auth-card__footer {
  margin-top: 1.15rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
}

.auth-card__footer p {
  margin: 0;
}

@media (max-width: 576px) {
  .auth-page {
    padding: 1rem 0 1.75rem;
  }

  .auth-page .container {
    min-height: calc(100vh - var(--navbar-height) - 2.25rem);
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .auth-card {
    padding: 1rem;
    border-radius: 24px;
  }

  .auth-accordion__trigger,
  .auth-accordion__inner {
    padding-left: 0.9rem;
    padding-right: 0.9rem;
  }

  .auth-form__meta {
    flex-direction: column;
    align-items: flex-start;
  }
}

@keyframes auth-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
