:root {
  color-scheme: dark;
  --auth-bg: #101822;
  --auth-bg-deep: #0d1520;
  --auth-bg-soft: #1f3044;
  --auth-surface: rgba(10, 18, 31, 0.78);
  --auth-panel: rgba(13, 24, 39, 0.92);
  --auth-panel-strong: rgba(18, 31, 49, 0.98);
  --auth-panel-muted: rgba(20, 34, 52, 0.78);
  --auth-border: rgba(176, 194, 220, 0.12);
  --auth-border-strong: rgba(176, 194, 220, 0.22);
  --auth-text: #edf3fb;
  --auth-text-soft: #b5c1d3;
  --auth-text-muted: #8d9cb4;
  --auth-brand: #8fa6cf;
  --auth-brand-deep: #4d6f99;
  --auth-brand-ink: #f4f7fc;
  --auth-accent: #6c84af;
  --auth-accent-deep: #385476;
  --auth-danger: #db7b78;
  --auth-danger-soft: rgba(219, 123, 120, 0.12);
  --auth-warn: #d0ab73;
  --auth-warn-soft: rgba(208, 171, 115, 0.12);
  --auth-success: #82ab98;
  --auth-success-soft: rgba(130, 171, 152, 0.12);
  --auth-shadow: 0 30px 80px rgba(1, 8, 18, 0.42);
  --auth-radius-xl: 28px;
  --auth-radius-lg: 20px;
  --auth-radius-md: 14px;
  --auth-radius-sm: 10px;
  --auth-font-body: 'Avenir Next', 'Segoe UI Variable Text', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --auth-font-display: 'Avenir Next Condensed', 'Avenir Next', 'Segoe UI Variable Display', 'Segoe UI',
    'Helvetica Neue', Arial, sans-serif;
  --auth-focus-ring: rgba(214, 228, 251, 0.96);
  --auth-focus-ring-soft: rgba(143, 166, 207, 0.32);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--auth-font-body);
  color: var(--auth-text);
  background:
    radial-gradient(circle at top right, rgba(108, 132, 175, 0.2), transparent 34%),
    radial-gradient(circle at bottom left, rgba(56, 84, 118, 0.18), transparent 30%),
    linear-gradient(180deg, var(--auth-bg-deep), var(--auth-bg) 48%, var(--auth-bg-soft));
  background-attachment: fixed;
}

body.auth-page {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px;
}

.auth-shell {
  position: relative;
  width: min(940px, 100%);
  display: grid;
  grid-template-columns: minmax(248px, 0.82fr) minmax(360px, 1fr);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--auth-radius-xl);
  background: var(--auth-surface);
  box-shadow: var(--auth-shadow);
  backdrop-filter: blur(20px);
}

.auth-shell::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 24%),
    linear-gradient(315deg, rgba(108, 132, 175, 0.12), transparent 34%);
  pointer-events: none;
}

.auth-brand {
  position: relative;
  padding: 32px 30px;
  background:
    linear-gradient(180deg, rgba(143, 166, 207, 0.16), rgba(10, 18, 31, 0.12)),
    linear-gradient(155deg, rgba(8, 18, 31, 0.96), rgba(18, 34, 52, 0.84));
  color: var(--auth-brand-ink);
}

.auth-brand::after {
  content: '';
  position: absolute;
  right: -64px;
  bottom: -92px;
  width: 220px;
  height: 220px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(143, 166, 207, 0.26), transparent 65%);
  pointer-events: none;
}

.auth-brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  margin-bottom: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.auth-brand-logo img {
  max-width: 48px;
  height: auto;
}

.auth-eyebrow {
  margin: 0 0 10px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(200, 214, 235, 0.68);
}

.auth-brand h1,
.auth-panel-heading h1,
.auth-panel-heading h2 {
  margin: 0;
  font-family: var(--auth-font-display);
  line-height: 1.1;
}

.auth-brand h1 {
  font-size: clamp(2rem, 4vw, 2.7rem);
}

.auth-brand-copy {
  margin: 14px 0 0;
  max-width: 30ch;
  line-height: 1.6;
  color: rgba(235, 242, 252, 0.78);
}

.auth-brand-list {
  display: grid;
  gap: 10px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.auth-brand-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(235, 242, 252, 0.88);
}

.auth-brand-list li::before {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--auth-brand), #d6e4fb);
  box-shadow: 0 0 0 5px rgba(108, 132, 175, 0.12);
  flex: 0 0 auto;
}

.auth-brand-footnote {
  margin-top: 22px;
  font-size: 0.88rem;
  color: rgba(214, 227, 246, 0.58);
}

.auth-panel {
  position: relative;
  padding: 30px 30px 28px;
  background: linear-gradient(180deg, var(--auth-panel), var(--auth-panel-strong));
}

.auth-panel-heading {
  margin-bottom: 18px;
}

.auth-panel-heading h1,
.auth-panel-heading h2 {
  font-size: clamp(1.7rem, 3.2vw, 2.2rem);
}

.auth-panel-copy {
  margin: 10px 0 0;
  color: var(--auth-text-soft);
  line-height: 1.55;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 18px;
  padding: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}

.auth-tab {
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--auth-text-muted);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.auth-tab:hover,
.auth-tab:focus-visible {
  color: var(--auth-text);
  outline: none;
}

.auth-tab[aria-selected='true'] {
  background: linear-gradient(135deg, rgba(108, 132, 175, 0.22), rgba(56, 84, 118, 0.26));
  color: var(--auth-brand-ink);
  box-shadow: 0 10px 22px rgba(1, 8, 18, 0.22);
}

.auth-tab:focus-visible,
.input-action:focus-visible,
.link-btn:focus-visible,
.text-link:focus-visible,
.submit-btn:focus-visible,
.secondary-btn:focus-visible,
.ghost-btn:focus-visible,
.mfa-method-btn:focus-visible {
  outline: 2px solid var(--auth-focus-ring);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px var(--auth-focus-ring-soft);
}

.auth-tab-panel {
  display: block;
}

.auth-tab-panel[hidden] {
  display: none;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.field-group {
  display: grid;
  gap: 7px;
}

.field-label {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--auth-text);
}

.field-hint {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--auth-text-muted);
}

.field-error {
  display: none;
  margin: 0;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--auth-danger);
}

.field-group.has-error .field-error {
  display: block;
}

.field-group.has-error .input-row {
  border-color: rgba(219, 123, 120, 0.52);
  box-shadow: 0 0 0 4px rgba(219, 123, 120, 0.12);
}

.input-row {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--auth-border-strong);
  border-radius: var(--auth-radius-md);
  background: rgba(7, 16, 27, 0.72);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.input-row:focus-within {
  border-color: rgba(108, 132, 175, 0.42);
  box-shadow: 0 0 0 4px rgba(108, 132, 175, 0.14);
}

.input-control {
  width: 100%;
  min-height: 50px;
  border: 0;
  background: transparent;
  padding: 0 15px;
  font: inherit;
  color: var(--auth-text);
}

.input-control::placeholder {
  color: #7f90a8;
}

.input-control:focus {
  outline: none;
}

.input-control[readonly] {
  color: var(--auth-text-soft);
}

.input-action {
  border: 0;
  border-left: 1px solid rgba(176, 194, 220, 0.12);
  background: transparent;
  padding: 0 14px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--auth-text-soft);
  cursor: pointer;
}

.input-action:hover,
.input-action:focus-visible {
  background: rgba(108, 132, 175, 0.12);
  outline: none;
}

.inline-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.link-btn,
.text-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--auth-brand);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
}

.link-btn:hover,
.link-btn:focus-visible,
.text-link:hover,
.text-link:focus-visible {
  text-decoration: underline;
  outline: none;
}

.submit-btn,
.secondary-btn,
.ghost-btn {
  min-height: 48px;
  border-radius: 999px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.submit-btn {
  width: 100%;
  border: 0;
  padding: 0 18px;
  background: linear-gradient(135deg, var(--auth-brand), var(--auth-accent-deep));
  color: #f5f9ff;
  box-shadow: 0 14px 26px rgba(56, 84, 118, 0.34);
}

.submit-btn:hover,
.secondary-btn:hover,
.ghost-btn:hover {
  transform: translateY(-1px);
}

.submit-btn:disabled,
.secondary-btn:disabled,
.ghost-btn:disabled,
.link-btn:disabled,
.input-action:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.secondary-btn,
.ghost-btn {
  padding: 0 18px;
}

.secondary-btn {
  border: 1px solid rgba(176, 194, 220, 0.18);
  background: rgba(108, 132, 175, 0.1);
  color: var(--auth-brand-ink);
}

.ghost-btn {
  border: 1px solid rgba(176, 194, 220, 0.14);
  background: rgba(255, 255, 255, 0.03);
  color: var(--auth-text-soft);
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.button-row > * {
  flex: 1 1 180px;
}

.status-banner {
  display: none;
  margin-bottom: 16px;
  padding: 14px 15px;
  border-radius: var(--auth-radius-md);
  border: 1px solid transparent;
  font-size: 0.94rem;
  line-height: 1.55;
}

.status-banner.is-visible {
  display: block;
}

.status-banner[data-status='info'] {
  background: rgba(108, 132, 175, 0.12);
  border-color: rgba(108, 132, 175, 0.18);
  color: var(--auth-brand-ink);
}

.status-banner[data-status='success'] {
  background: var(--auth-success-soft);
  border-color: rgba(22, 101, 52, 0.14);
  color: var(--auth-success);
}

.status-banner[data-status='warn'] {
  background: var(--auth-warn-soft);
  border-color: rgba(180, 83, 9, 0.14);
  color: var(--auth-warn);
}

.status-banner[data-status='error'] {
  background: var(--auth-danger-soft);
  border-color: rgba(180, 35, 24, 0.14);
  color: var(--auth-danger);
}

.auth-meta {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--auth-text-muted);
  font-size: 0.84rem;
}

.auth-meta a {
  color: inherit;
}

.auth-divider {
  height: 1px;
  margin: 8px 0 2px;
  background: linear-gradient(90deg, rgba(176, 194, 220, 0.16), rgba(176, 194, 220, 0));
}

.caps-warning,
.helper-message {
  display: none;
  margin: -3px 0 0;
  font-size: 0.84rem;
  font-weight: 700;
}

.caps-warning.is-visible,
.helper-message.is-visible {
  display: block;
}

.caps-warning {
  color: var(--auth-warn);
}

.helper-message {
  color: var(--auth-text-muted);
}

.quick-access {
  display: grid;
  gap: 10px;
  margin-top: 2px;
  padding: 14px;
  border: 1px solid rgba(176, 194, 220, 0.12);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(108, 132, 175, 0.06));
}

.quick-access-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.oauth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quick-access-btn {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
}

.passkey-btn {
  grid-column: 1 / -1;
}

.button-content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.button-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.button-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.button-label {
  display: inline-block;
  white-space: nowrap;
}

.oauth-provider {
  background: rgba(8, 16, 27, 0.66);
}

.provider-github .button-icon {
  color: #f6f8fa;
}

.provider-google .button-icon {
  color: #8ab4f8;
}

.provider-discord .button-icon {
  color: #9da8ff;
}

.passkey-btn .button-icon {
  color: #c3d3eb;
}

.password-strength {
  display: grid;
  gap: 8px;
}

.password-strength-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.password-strength-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(135deg, #e6553e, #f59e0b);
  transition: width 0.2s ease, background 0.2s ease;
}

.password-strength[data-score='3'] .password-strength-fill,
.password-strength[data-score='4'] .password-strength-fill {
  background: linear-gradient(135deg, #d48a12, #efc052);
}

.password-strength[data-score='5'] .password-strength-fill {
  background: linear-gradient(135deg, #5f84b2, #8fa6cf);
}

.password-strength-copy {
  font-size: 0.84rem;
  color: var(--auth-text-muted);
}

.mfa-step {
  display: none;
  margin-top: 6px;
  padding: 18px;
  border: 1px solid rgba(108, 132, 175, 0.18);
  border-radius: var(--auth-radius-lg);
  background: linear-gradient(180deg, rgba(108, 132, 175, 0.12), rgba(108, 132, 175, 0.04));
}

.mfa-step.is-visible {
  display: grid;
  gap: 16px;
}

.mfa-step-head {
  display: grid;
  gap: 6px;
}

.mfa-step-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.mfa-step-copy {
  margin: 0;
  color: var(--auth-text-soft);
  line-height: 1.55;
}

.mfa-switcher {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mfa-method-btn {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(176, 194, 220, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--auth-text-soft);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
}

.mfa-method-btn.is-active {
  border-color: rgba(108, 132, 175, 0.24);
  background: rgba(108, 132, 175, 0.16);
  color: var(--auth-brand-ink);
}

.mfa-method-panel[hidden] {
  display: none;
}

.mfa-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.mfa-actions > * {
  flex: 1 1 170px;
}

.verification-actions {
  display: none;
  margin-top: 16px;
}

.verification-actions.is-visible {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.verification-actions > * {
  flex: 1 1 170px;
}

.auth-single {
  width: min(560px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--auth-radius-xl);
  overflow: hidden;
  background: var(--auth-surface);
  box-shadow: var(--auth-shadow);
  backdrop-filter: blur(20px);
}

.auth-single .auth-brand {
  padding-bottom: 28px;
}

.auth-single .auth-panel {
  padding-top: 28px;
}

.page-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.page-links a {
  color: var(--auth-accent-deep);
  font-weight: 800;
  text-decoration: none;
}

.page-links a:hover,
.page-links a:focus-visible {
  text-decoration: underline;
  outline: none;
}

.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;
}

[hidden],
.hidden {
  display: none !important;
}

@media (max-width: 760px) {
  body.auth-page {
    padding: 14px;
  }

  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-brand,
  .auth-panel {
    padding: 24px 20px;
  }

  .auth-brand-list,
  .auth-brand-footnote {
    display: none;
  }

  .oauth-grid {
    grid-template-columns: 1fr;
  }

  .passkey-btn {
    grid-column: auto;
  }
}

@media (max-height: 860px) {
  .auth-brand-list,
  .auth-brand-footnote {
    display: none;
  }
}

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