/* Login and registration only. Shared roles come from design-tokens/ui-primitives. */
.auth-page {
  min-height: calc(100vh - 90px);
  padding: var(--space-8) var(--space-3) var(--space-20);
  color: var(--color-text-primary);
}
.auth-page:is(.auth-login-page, .auth-register-page) { min-height: 0; padding-bottom: var(--space-6); }

.auth-shell { max-width: 520px; margin: 0 auto; }
/* Keep focused/scrolled-to controls below the sticky announcement/header stack. */
html:has(.auth-page) {
  scroll-padding-top: calc(var(--announcement-height, 0px) + 88px);
}
.auth-page .auth-breadcrumb { margin-bottom: var(--space-4); }
.auth-page .breadcrumb {
  padding: var(--space-2) var(--space-3);
  border: var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--color-surface-1);
  box-shadow: none;
  font-size: var(--text-sm);
}
.auth-card {
  border: var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--color-surface-1);
  color: var(--color-text-primary);
  box-shadow: var(--shadow-surface);
}
.auth-card-inner { padding: var(--space-6); }
.auth-title {
  margin: 0 0 var(--space-6);
  font-size: var(--text-2xl);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-2xl);
  letter-spacing: var(--letter-spacing-heading);
}
.auth-field { margin-bottom: var(--space-4); }

/* Local !important declarations are needed against legacy styles.css form rules. */
.auth-page .form-control {
  border: var(--border-default) !important;
  border-radius: var(--radius-sm) !important;
  background: var(--color-bg-subtle) !important;
  color: var(--color-text-primary) !important;
  box-shadow: none;
  font-size: var(--text-body-sm);
  caret-color: var(--color-text-primary);
}
.auth-page .form-control:hover { border-color: var(--color-border-strong) !important; }
.auth-page .form-control:focus {
  border-color: var(--color-border-accent) !important;
  background: var(--color-surface-2) !important;
  box-shadow: none !important;
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}
.auth-page .form-control::placeholder { color: var(--color-text-tertiary); }
.auth-page .form-floating > .form-control::placeholder { color: transparent; }
.auth-page .form-floating > label { color: var(--color-text-secondary) !important; }
.auth-page .form-floating > label::after { background: transparent !important; }
.auth-page .form-control:autofill {
  -webkit-text-fill-color: var(--color-text-primary);
  box-shadow: inset 0 0 0 1000px var(--color-surface-2) !important;
}
.auth-page :is(button, a, input[type="checkbox"]):focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}
.auth-page .password-wrap { position: relative; }
.auth-page :is(.password-toggle, .password-generate) {
  position: absolute;
  top: 50%;
  width: 44px;
  height: 44px;
  transform: translateY(-50%);
  border: var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  color: var(--color-text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 4;
}
.auth-page .password-toggle { right: var(--space-2); }
.auth-page .password-generate { right: 56px; }
.auth-page :is(.password-toggle, .password-generate):hover { background: var(--color-surface-hover); color: var(--color-text-primary); }
.auth-page :is(.password-toggle, .password-generate):active { background: var(--color-surface-selected); }
.auth-page .password-wrap .form-control { padding-right: 60px; }
.auth-register-page .password-wrap .form-control { padding-right: 108px; }
.auth-register-page :is(.password-toggle, .password-generate) .bi { font-size: var(--text-xl); }
.auth-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.auth-link-btn {
  min-height: 44px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--color-link);
  font-size: var(--text-ui);
  font-weight: var(--font-weight-medium);
}
.auth-link-btn:hover { color: var(--color-link-hover); text-decoration: underline; }
.auth-submit { min-width: 120px; min-height: 44px; }
.auth-page .q-button {
  border-radius: var(--radius-md);
  font: var(--font-weight-semibold) var(--text-ui) / var(--line-height-ui) var(--font-family-sans);
}
.auth-page :is(#auth_button, #registration_button) {
  font-size: var(--text-body);
  line-height: var(--line-height-body);
}
.auth-register-page .auth-submit { width: 100%; min-height: 48px; }
.auth-submit:disabled { cursor: wait; }
.magic-link-action { width: 100%; min-height: 44px; margin-top: var(--space-4); }
.auth-divider { height: 1px; margin: var(--space-6) 0; background: var(--color-border-subtle); }
.auth-register-page .auth-divider { margin-block: var(--space-4); }

.auth-page .password-generated-tools {
  display: none;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  color: var(--color-text-secondary);
  font-size: var(--text-xs);
}
.auth-page .password-copy { min-height: 44px; font-size: var(--text-xs); }
.auth-page .password-requirements { margin: 0 0 var(--space-3); color: var(--color-text-secondary); font-size: var(--text-xs); line-height: var(--line-height-sm); }
.auth-page .strength-box { display: none; margin-bottom: var(--space-4); }
.auth-page .strength-meter { height: var(--space-1); width: 100%; background: var(--color-border-default); border-radius: var(--radius-pill); overflow: hidden; }
.auth-page .strength-meter div { height: 100%; width: 0; border-radius: inherit; transition: width var(--duration-normal) var(--ease-standard), background-color var(--duration-normal) var(--ease-standard); }
.auth-page .strength-text { min-height: 18px; margin-top: var(--space-2); color: var(--color-text-secondary); font-size: var(--text-xs); font-weight: var(--font-weight-medium); }
.auth-page .recaptcha-container {
  --auth-recaptcha-scale: .9;
  display: flex;
  justify-content: center;
  max-width: 100%;
  overflow: visible;
  margin: var(--space-3) 0;
}
/* Scale the external widget as one unit; reserve its scaled height without
   clipping its iframe or introducing a nested scroll container. */
.auth-page .g-recaptcha {
  flex: 0 0 304px;
  height: 78px;
  transform: scale(var(--auth-recaptcha-scale));
  transform-origin: top center;
  margin-bottom: calc(78px * (var(--auth-recaptcha-scale) - 1));
}
.auth-page .privacy-consent {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin: var(--space-3) 0 var(--space-4);
  padding: var(--space-3);
  border: var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  font-size: var(--text-xs);
  line-height: var(--line-height-sm);
  cursor: pointer;
}
.auth-page .privacy-consent input { width: 20px; height: 20px; margin-top: 0; accent-color: var(--color-accent); flex: 0 0 auto; }
.auth-page .privacy-consent a { color: var(--color-link); text-underline-offset: 2px; }
.auth-page .privacy-consent a:hover { color: var(--color-link-hover); }
.auth-page .field-error { min-height: 18px; margin: 0 0 var(--space-2); color: var(--color-danger); font-size: var(--text-xs); line-height: var(--line-height-sm); overflow-wrap: anywhere; }
.auth-page .auth-field + .field-error { margin-top: calc(-1 * var(--space-2)); }
.auth-page #registration-status { margin-top: var(--space-2); }
/* Keep validation output intact, without blank reserved rows in the form. */
.auth-register-page :is(#email-error, #privacy-consent-error, #registration-status):empty {
  min-height: 0;
  margin: 0;
}

/* OAuth partial is also used elsewhere: scope its refinements to these pages. */
.auth-page #social-auth-block { padding: 0 !important; }
.auth-page #social-auth-block .social-auth-title { margin-bottom: var(--space-3); font-size: var(--text-sm); opacity: 1; }
.auth-page .google-legacy-note { padding: var(--space-3); border: var(--border-subtle); border-radius: var(--radius-sm); background: var(--color-surface-2); color: var(--color-text-secondary); line-height: var(--line-height-sm); }
.auth-page .google-login-link { color: var(--color-link); font-weight: var(--font-weight-medium); }
.auth-page #social-auth-block :is(.social-auth-btn, .vk-social-btn) {
  min-height: 44px;
  border: var(--border-default);
  border-radius: var(--radius-sm) !important;
  background: var(--color-surface-2);
  color: var(--color-text-primary);
  box-shadow: none;
  transform: none;
}
.auth-page #social-auth-block :is(.social-auth-btn, .vk-social-btn):hover { border-color: var(--color-border-strong); background: var(--color-surface-hover); box-shadow: none; transform: none; }
.auth-page #social-auth-block :is(.social-auth-btn, .vk-social-btn):active { background: var(--color-surface-selected); }
.auth-page .vk-social-grid { gap: var(--space-2); }

.auth-page .activation-card { display: none; border: 1px solid var(--color-success); border-radius: var(--radius-lg); background: var(--color-surface-1); color: var(--color-text-primary); box-shadow: var(--shadow-surface); }
.auth-page .activation-card .card-body { padding: var(--space-6); }
.auth-page .activation-email { color: var(--color-text-primary); overflow-wrap: anywhere; }
.auth-page .activation-progress { display: grid; gap: var(--space-2); margin: var(--space-4) 0; padding: 0; list-style: none; }
.auth-page .activation-progress li::before { content: "○"; margin-right: var(--space-2); color: var(--color-accent); }
.auth-page .activation-progress li.done::before { content: "✓"; color: var(--color-success); }
.auth-page .webmail-link { display: none; margin: var(--space-1) var(--space-2) var(--space-3) 0; }
.auth-page .resend-link-btn { display: inline; padding: 0; border: 0; background: transparent; color: var(--color-link); font-weight: var(--font-weight-medium); }
.auth-page .resend-link-btn:hover { text-decoration: underline; }

/* Existing ancillary dialog shells; Bootstrap continues to own their behavior. */
.auth-modal .modal-content { border-radius: 22px; border: 1px solid rgba(255,255,255,.12); background: linear-gradient(180deg, #111827, #070b13); color: #eef3ff; }
.auth-modal .modal-header { border-bottom-color: rgba(255,255,255,.08); }
.auth-modal .input-group-text { border-color: rgba(255,255,255,.12); background: rgba(255,255,255,.06); color: #cdd6ea; }
.auth-message-error { color: var(--color-warning); text-align: left; }
.auth-message-danger { color: var(--color-danger); text-align: left; }
.auth-message-success { color: var(--color-success); margin-top: var(--space-3); }

@media (max-width: 575.98px) {
  .auth-page { padding: var(--space-5) 0 var(--space-20); }
  .auth-card-inner { padding: var(--space-5) var(--space-4); }
  .auth-actions { flex-direction: column; align-items: stretch; }
  .auth-submit { width: 100%; }
}
