/* Keycloak supplies the credential forms and their actions. Keep each verification
   step on the same grid, including pages rendered with Bootstrap form offsets. */
body:has(#kc-passwd-update-form, #kc-form-webauthn, #kc-select-credential-form, #registerWebAuthn, #kc-recovery-codes-list, input[name=recoveryCodeInput]) {
  .login-pf-page {
    width: 100%;
    max-width: 504px;
    padding: clamp(24px, 8svh, 80px) 16px 24px;
  }
  #kc-header { margin: 0 0 24px; }
  #kc-header-wrapper { padding: 0; text-align: center; }
  #kc-header-wrapper img { margin-inline: auto; }
  .login-pf-page .card-pf {
    max-width: none;
    margin: 0;
    padding: clamp(20px, 5vw, 32px);
  }
  .login-pf-header { margin: 0 0 20px; }
  #kc-page-title { margin: 0; font-size: 22px; font-weight: 650; line-height: 1.3; }
  #kc-username {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0 12px;
    margin: 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
  }
  #kc-attempted-username {
    min-width: 0;
    margin: 0;
    font-size: 16px;
    font-weight: 650;
  }
  #reset-login {
    align-items: center;
    min-height: 44px;
    margin: 0;
    font-size: 13px;
  }
  #reset-login .kc-login-tooltip { display: flex; align-items: center; gap: 6px; }
  .form-horizontal .form-group { margin-inline: 0; }
  .select-auth-box-parent {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    align-items: start;
    gap: 12px;
    width: 100%;
    margin: 0;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-subtle);
    color: var(--ink);
    text-align: start;
    font: inherit;
  }
  .select-auth-box-parent + .select-auth-box-parent { margin-top: 8px; }
  .select-auth-box-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--selected);
    color: var(--brand);
  }
  .select-auth-box-icon i { font-size: 16px; }
  .select-auth-box-headline { font-family: inherit; font-size: 16px; font-weight: 650; line-height: 1.4; overflow-wrap: anywhere; }
  .select-auth-box-desc { color: var(--muted); font-size: 13px; line-height: 1.5; }
  .select-auth-box-headline + .select-auth-box-desc { margin-top: 4px; }
  .select-auth-box-parent > .pf-m-fill { display: none; }
  button.select-auth-box-parent { grid-template-columns: 36px minmax(0, 1fr) auto; }
  button.select-auth-box-parent:hover { border-color: var(--brand); background: var(--hover-surface); }
  .select-auth-box-arrow { align-self: center; color: var(--brand); }
  #kc-form-webauthn .form-group { margin: 0; }
  #kc-form-webauthn #kc-form-buttons { float: none; width: 100%; margin: 20px 0 0; padding: 0; }
  #kc-form-webauthn:not(:has(.select-auth-box-parent)) #kc-form-buttons { margin: 0; }
  #kc-form-options, div:has(> #kcRecoveryCodesConfirmationCheck) {
    float: none;
    width: 100%;
    padding: 0;
  }
  #kc-form-options .checkbox { margin: 0; padding: 0; }
  #kc-form-options label, div:has(> #kcRecoveryCodesConfirmationCheck) {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 0;
  }
  #kc-form-options input[type=checkbox], #kcRecoveryCodesConfirmationCheck {
    position: static;
    flex: none;
    margin: 0;
    width: 16px;
    height: 16px;
    accent-color: var(--brand);
  }
  label[for=kcRecoveryCodesConfirmationCheck] { margin: 0; }
  #saveRecoveryAuthnCodesBtn { margin-top: 12px; }
  #kc-select-try-another-way-form .form-group { margin: 8px 0 0; text-align: center; }
  #try-another-way { display: inline-flex; align-items: center; min-height: 44px; }
  .identity-appearance { position: static; display: flex; justify-content: center; margin: 0 auto 24px; }
}
