Which of the following is a primary function of the kidneys in maintaining fluid and electrolyte balance?