:root {
  --auth-shell-bg: #0d1b2a;
  --auth-shell-accent: #4f46e5;
  --auth-shell-accent-soft: rgba(79, 70, 229, 0.12);
  --auth-shell-text: #0f172a;
  --auth-shell-muted: #475569;
  --auth-shell-card: rgba(248, 250, 252, 0.9);
  --auth-shell-card-dark: rgba(15, 23, 42, 0.75);
  --auth-shell-border: rgba(148, 163, 184, 0.18);
  --auth-shell-shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.25);
  --auth-shell-shadow-md: 0 16px 35px rgba(15, 23, 42, 0.18);
  --auth-shell-radius-lg: 28px;
  --auth-shell-radius-md: 20px;
  --auth-shell-radius-sm: 14px;
  --auth-shell-transition: 180ms ease;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body.auth {
  margin: 0;
  font-family: "Manrope", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(79, 70, 229, 0.18), transparent 45%),
    radial-gradient(circle at bottom right, rgba(16, 185, 129, 0.18), transparent 50%),
    #f1f5f9;
  color: var(--auth-shell-text);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(32px, 6vw, 64px) clamp(18px, 5vw, 48px);
  line-height: 1.6;
}

.auth-shell {
  width: min(920px, 100%);
  display: grid;
  gap: clamp(18px, 3vw, 28px);
}

.auth-card {
  background: var(--auth-shell-card);
  backdrop-filter: blur(18px);
  border-radius: var(--auth-shell-radius-lg);
  box-shadow: var(--auth-shell-shadow-lg);
  padding: clamp(28px, 5vw, 48px);
  display: grid;
  gap: clamp(18px, 3vw, 28px);
}

.auth-card__header {
  display: grid;
  gap: 12px;
}

.auth-card__brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  color: var(--auth-shell-accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
}

.auth-card__brand::before {
  content: "";
  width: 36px;
  height: 36px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(129, 140, 248, 0.85), rgba(56, 189, 248, 0.75));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.auth-card__title {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.2rem);
  font-weight: 700;
  color: var(--auth-shell-text);
}

.auth-card__subtitle {
  margin: 0;
  color: var(--auth-shell-muted);
  font-size: clamp(0.95rem, 2vw, 1.05rem);
}

.auth-messages {
  display: grid;
  gap: 12px;
}

.auth-alert {
  border-radius: var(--auth-shell-radius-sm);
  padding: 14px 18px;
  font-weight: 500;
  box-shadow: var(--auth-shell-shadow-md);
}

.auth-alert--error {
  background: rgba(248, 113, 113, 0.16);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #b91c1c;
}

.auth-alert--info {
  background: rgba(96, 165, 250, 0.18);
  border: 1px solid rgba(59, 130, 246, 0.45);
  color: #1d4ed8;
}

.auth-alert--success {
  background: rgba(34, 197, 94, 0.16);
  border: 1px solid rgba(22, 163, 74, 0.45);
  color: #166534;
}

.auth-notice {
  border-radius: var(--auth-shell-radius-sm);
  padding: 18px 20px;
  border: 1px solid rgba(234, 179, 8, 0.45);
  background: rgba(253, 230, 138, 0.18);
  color: #92400e;
  font-weight: 600;
}

.auth-form {
  display: grid;
  gap: clamp(18px, 3vw, 28px);
}

.auth-fieldset {
  display: grid;
  gap: 14px;
}

.auth-field {
  display: grid;
  gap: 6px;
}

.auth-field label {
  font-weight: 600;
  color: var(--auth-shell-text);
}

.auth-field input[type="email"],
.auth-field input[type="password"],
.auth-field input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  border-radius: var(--auth-shell-radius-sm);
  border: 1px solid var(--auth-shell-border);
  background: rgba(255, 255, 255, 0.85);
  transition: border-color var(--auth-shell-transition), box-shadow var(--auth-shell-transition);
}

.auth-field input:focus {
  outline: none;
  border-color: var(--auth-shell-accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.18);
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.auth-button {
  border-radius: 999px;
  border: none;
  padding: 12px 22px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform var(--auth-shell-transition), box-shadow var(--auth-shell-transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.auth-button--primary {
  background: var(--auth-shell-accent);
  color: #fff;
  box-shadow: 0 16px 30px rgba(79, 70, 229, 0.35);
}

.auth-button--primary:hover,
.auth-button--primary:focus {
  transform: translateY(-1px);
  box-shadow: 0 20px 40px rgba(79, 70, 229, 0.38);
}

.auth-button--ghost {
  background: transparent;
  color: var(--auth-shell-accent);
  border: 1px solid rgba(79, 70, 229, 0.35);
  box-shadow: none;
}

.auth-button--ghost:hover,
.auth-button--ghost:focus {
  border-color: var(--auth-shell-accent);
  box-shadow: 0 10px 30px rgba(79, 70, 229, 0.18);
}

.auth-note {
  margin: 0;
  color: var(--auth-shell-muted);
  font-size: 0.95rem;
}

.auth-link {
  color: var(--auth-shell-accent);
  font-weight: 600;
  text-decoration: none;
  transition: color var(--auth-shell-transition);
}

.auth-link:hover,
.auth-link:focus {
  color: #312e81;
}

.auth-app-promo {
  display: grid;
  gap: 16px;
  grid-template-columns: 90px 1fr;
  align-items: center;
  background: rgba(79, 70, 229, 0.08);
  border: 1px solid rgba(79, 70, 229, 0.28);
  border-radius: var(--auth-shell-radius-md);
  padding: 18px 20px;
}

.auth-app-icon {
  width: 90px;
  height: 90px;
  border-radius: 24px;
  background-image: url(/images/logo_stealthsafe.png);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0f172a;
  font-weight: 700;
  font-size: 1.35rem;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.48);
}

.auth-app-copy {
  display: grid;
  gap: 10px;
}

.auth-app-copy strong {
  font-size: 1.05rem;
  color: var(--auth-shell-text);
}

.auth-app-copy p {
  margin: 0;
  color: var(--auth-shell-muted);
}

.auth-app-store {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #0f172a;
  color: #f8fafc;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.35);
  transition: transform var(--auth-shell-transition), box-shadow var(--auth-shell-transition);
}

.auth-app-store:hover,
.auth-app-store:focus {
  transform: translateY(-1px);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.38);
}

.auth-app-store[aria-disabled="true"] {
  opacity: 0.7;
}

.auth-app-alt {
  display: grid;
  gap: 10px;
  border-radius: var(--auth-shell-radius-md);
  padding: 18px 20px;
  border: 1px dashed rgba(148, 163, 184, 0.45);
  background: rgba(255, 255, 255, 0.6);
}

.auth-app-alt h3 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--auth-shell-text);
}

.auth-app-alt ul {
  margin: 0;
  padding-left: 18px;
  color: var(--auth-shell-muted);
}

.auth-step-label {
  text-transform: uppercase;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--auth-shell-muted);
}

.auth-step-title {
  margin: 4px 0 0;
  font-size: clamp(1.2rem, 2.5vw, 1.5rem);
  font-weight: 600;
}

.auth-step-description {
  margin: 8px 0 0;
  color: var(--auth-shell-muted);
}

.auth-divider {
  height: 1px;
  background: var(--auth-shell-border);
}

.auth-otp-block {
  display: grid;
  gap: 16px;
  border-radius: var(--auth-shell-radius-md);
  padding: 18px 20px 22px;
  background: rgba(79, 70, 229, 0.05);
  border: 1px solid rgba(79, 70, 229, 0.18);
}

.has-js .auth-otp-block:not(.is-visible) {
  display: none;
}

.auth-form[data-step="2"] .auth-fieldset[data-step="basic"],
.auth-form[data-step="2"] .auth-divider {
  display: none;
}

.auth-form[data-step="1"] .auth-otp-block {
  display: none;
}

.auth-secret {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: var(--auth-shell-radius-sm);
  background: rgba(15, 23, 42, 0.06);
  font-family: "SFMono-Regular", ui-monospace, "SFMono", "Roboto Mono", monospace;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  color: #0f172a;
}

.auth-secret--wide {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
  letter-spacing: 0.05em;
}

.auth-qr {
  width: min(240px, 70vw);
  border-radius: 18px;
  box-shadow: var(--auth-shell-shadow-md);
}

.auth-footnote {
  text-align: center;
  color: rgba(15, 23, 42, 0.65);
  font-size: 0.95rem;
}

.auth-footnote a {
  color: var(--auth-shell-accent);
  font-weight: 600;
  text-decoration: none;
}

.auth-footnote a:hover,
.auth-footnote a:focus {
  color: #312e81;
}

@media (max-width: 720px) {
  .auth-app-promo {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .auth-app-icon {
    margin: 0 auto;
  }

  .auth-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .auth-button {
    width: 100%;
  }
}

@media (max-width: 520px) {
  body.auth {
    padding: 24px 16px;
  }

  .auth-card {
    padding: 24px 20px;
  }
}
