.auth-shell {
  background: #f2f4f8;
  color: #111827;
}

.auth-main-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.auth-main-panel {
  width: 100%;
  max-width: 520px;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.auth-form-shell {
  max-width: none;
}

.auth-brand-row {
  display: flex;
  justify-content: center;
  margin-bottom: 1.1rem;
}

.auth-brand-link {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: #0c1a4a;
  text-decoration: none;
  font-weight: 800;
  font-size: 2rem;
  letter-spacing: -0.02em;
}

.auth-brand-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
  display: block;
}

.auth-brand-word {
  display: inline-flex;
  align-items: baseline;
  font-size: 2.05rem;
  line-height: 1;
  letter-spacing: -0.02em;
}

.auth-brand-word-clear {
  color: #0c1a4a;
}

.auth-brand-word-binder {
  color: #2563eb;
}

.auth-card-shell {
  background: #fff;
  border: 1px solid #e7ecf4;
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  padding: 1.8rem 1.7rem 1.6rem;
}

.auth-title {
  margin: 0 0 0.35rem;
  font-size: 1.8rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.auth-subtitle {
  margin: 0 0 1.4rem;
  color: #6b7280;
  font-size: 0.98rem;
}

.auth-form-shell .form-label {
  font-weight: 500;
  margin-bottom: 0.35rem;
  color: #1f2937;
}

.auth-form-shell .form-control,
.auth-form-shell .form-select {
  min-height: 48px;
  border-radius: 11px;
  border: 1px solid #d6deea;
  background: #fff;
  font-size: 0.95rem;
}

.auth-form-shell .form-control::placeholder {
  color: #9ca3af;
}

.auth-form-shell .form-control:focus,
.auth-form-shell .form-select:focus {
  border-color: #6274f4;
  box-shadow: 0 0 0 0.18rem rgba(79, 70, 229, 0.13);
}

.auth-form-shell .form-check-input {
  border-radius: 5px;
}

.auth-primary-btn {
  min-height: 46px;
  border-radius: 11px;
  border: 0;
  background: linear-gradient(135deg, #5a6bf0 0%, #4058da 100%);
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
}

.auth-primary-btn:hover {
  background: linear-gradient(135deg, #5262df 0%, #364ecf 100%);
  color: #fff;
}

.auth-primary-btn:focus {
  box-shadow: 0 0 0 0.18rem rgba(79, 70, 229, 0.16);
}

.auth-links {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.auth-link-inline,
.auth-links a {
  color: #4f46e5;
  text-decoration: none;
  font-size: 0.92rem;
}

.auth-links a:hover,
.auth-link-inline:hover {
  text-decoration: underline;
}

.auth-muted-center {
  text-align: center;
  color: #6b7280;
  font-size: 0.93rem;
  margin-top: 0.85rem;
}

.auth-alert {
  border-radius: 10px;
  border-width: 1px;
  font-size: 0.92rem;
}

.auth-alert:empty {
  display: none;
}

.auth-password-hint {
  color: #6b7280;
  font-size: 0.82rem;
  margin-top: 0.35rem;
  line-height: 1.35;
}

.auth-form-shell .form-check-label a {
  color: #4f46e5;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
}

.auth-form-shell .form-check-label a:hover {
  color: #312e81;
}

.auth-form-shell .input-validation-error {
  border-color: #f87171 !important;
}

.auth-form-shell .field-validation-error,
.auth-form-shell .text-danger {
  color: #dc2626 !important;
  font-size: 0.82rem;
}

.auth-status-success {
  border-left: 4px solid #16a34a;
  background: #f0fdf4;
  padding: 0.85rem 0.9rem;
  border-radius: 8px;
}

.auth-status-info {
  border-left: 4px solid #4f46e5;
  background: #eef2ff;
  padding: 0.85rem 0.9rem;
  border-radius: 8px;
}

.auth-aux-link {
  text-align: center;
  margin-top: 0.9rem;
  font-size: 0.92rem;
}

/* ============================================================
   Mobile + tablet pass
   The auth pages are the first thing new users see, and most
   sign-ups happen on phones. Critical concerns addressed:
   1. iOS auto-zoom on input focus when font-size < 16px.
   2. Brand row overflow on small phones (logo + wordmark).
   3. Vertical real-estate — start the form closer to the top.
   4. Safe-area-inset for notched phones.
   5. Step actions stack instead of cramming side-by-side on
      narrow Register step 2.
   ============================================================ */
@media (max-width: 767.98px) {
  .auth-main-shell {
    padding: 1.5rem 0.9rem;
    /* Respect notched-phone insets so the form never hides under the
       status bar or home indicator. */
    padding-top: max(1.5rem, env(safe-area-inset-top));
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  }

  /* 16px form font prevents iOS Safari from auto-zooming on focus,
     which is a near-universal mobile gotcha. */
  .auth-form-shell .form-control,
  .auth-form-shell .form-select,
  .auth-form-shell input[type="text"],
  .auth-form-shell input[type="email"],
  .auth-form-shell input[type="password"],
  .auth-form-shell input[type="tel"],
  .auth-form-shell textarea {
    font-size: 16px;
    min-height: 48px;
  }

  .auth-title { font-size: 1.55rem; }
  .auth-subtitle { font-size: 0.92rem; margin-bottom: 1.1rem; }
}

@media (max-width: 576px) {
  .auth-main-shell {
    padding: 1.1rem 0.65rem;
    padding-top: max(1.1rem, env(safe-area-inset-top));
    padding-bottom: max(1.1rem, env(safe-area-inset-bottom));
    /* Keep the form vertically centered on phones. Modern svh unit
       accounts for the on-screen keyboard so the form doesn't get
       pushed off-screen when an input is focused; falls back to vh
       on older browsers. */
    min-height: 100vh;
    min-height: 100svh;
    align-items: center;
  }

  .auth-card-shell {
    padding: 1.2rem 0.95rem 1.05rem;
    border-radius: 12px;
  }

  /* Brand row shrinks so the wordmark doesn't overflow on 320–360px phones. */
  .auth-brand-row { margin-bottom: 0.85rem; }
  .auth-brand-link {
    font-size: 1.6rem;
    gap: 0.5rem;
  }
  .auth-brand-word { font-size: 1.6rem; }
  .auth-brand-logo { width: 28px; height: 28px; }

  .auth-title { font-size: 1.4rem; }

  /* Register step 2 has Back + Create account side-by-side via flex-fill.
     Stack them at phone widths so each button gets a real tap target. */
  #register-step-2 .d-flex.gap-2 {
    flex-direction: column;
  }
  #register-step-2 .d-flex.gap-2 .btn {
    width: 100%;
  }
  /* Visual hierarchy: primary action first, ghost action below. */
  #register-step-2 .d-flex.gap-2 #registerSubmit { order: 0; }
  #register-step-2 .d-flex.gap-2 #register-back-step { order: 1; }
}

@media (max-width: 360px) {
  /* Very narrow phones — drop the wordmark to icon-and-tiny-text so the
     register form's longer labels still fit at one line. */
  .auth-brand-link { font-size: 1.35rem; }
  .auth-brand-word { font-size: 1.35rem; }
  .auth-card-shell { padding: 1rem 0.8rem 0.95rem; }
}
