Short version:
Considering that science is inevitably dependent on mathematics and metaphysics (Kant tried to raise metaphysics to the status of a science, which I find mandatory to improve the quality of scientific knowledge), and mathematics and metaphysics seem to fit better as matters of philosophy, what is the nature of mathematics? Some say it is an art, but that seems utterly wrong (science would depend on art). I ask this to understand what was Kant's path following in his attempt to give metaphysics an equivalent status of mathematics, how metaphysics would be equivalent of mathematics, and what class would mathematics (and so, metaphysics) belong to.
Long version:
Science is essentially the description of natural phenomena. That is, the description of what we perceive with our senses. So, as it is said commonly, science targets empirical truth (verifiable by experience, although not necessary and universal, like the earth being flat), not final truth (necessary and universal: there's no number which 1 can't be added to). The use of the scientific method is usually what allows knowledge to be qualified as scientific.
Final truths (even if they are unreachable in multiple cases) are the goal of philosophy. Remark that philosophy is said to be the mother of all sciences.
Mathematics seems to fit better on the last category: some part of philosophy. Logical and mathematical truths are necessary and universal (the Kantian definition of pure: non-empirical). Following the same logic, this question essentially shows that mathematics is NOT a science: Is Mathematics considered a science?
But the answer to such question seems just wrong: mathematics would be an art. What??? does it mean that all physical sciences depend on an art? Is art part of philosophy, and science a subset of art? This consideration is not acceptable, for any common definition of art.
The best definition of art that I know belongs to Mario Bunge: any branch of knowledge has three parts: science (the theoretical framework related to the discipline), technique (the application of science) and art (the social application of technique to fulfill some need, either emotional -"this song makes me cry"-, referring to the art or the artist, or functional -"this shoemaker is an artist, he makes the best shoes"-, -"making solid buildings is an art"-). Other definitions of art are trivial or superficial, mainly pointing to esthetics or ideals; in no case art is related to logic or the definition/search of truths.
So, mathematics cannot be an art. It clearly fits into philosophy, and it clearly makes most sciences dependent on it.
Another approach to the same problem is Kant's quest for making a science out of metaphysics. It seems quite clear to me that it is mandatory to define the axiomatic foundations of a metaphysical framework upon which further scientific knowledge would be developed. But Kant seems to have had the same problem: where to fit metaphysics? So, he accepted for his metaphysics to be considered a science. But due to translation and linguistic issues, metaphysics cannot be considered a science nowadays. Part of metaphysics should be at the same level of mathematics, science being dependent on both.
So, what exactly would be the role of mathematics in philosophy? What is the category it belongs to? What is the nature and class of mathematics as a branch of philosophical knowledge?
With this answers, I expect to understand better Kant's project and method to raise metaphysics to a higher philosophical status, perhaps equivalent to mathematics.
UPDATE-2021/07/23: A key attribute of scientific knowledge is testability, empiric observation and prediction. Mathematics being considered a 'formal science' implies that the principles of mathematics can be empirically tested, and that's evidently wrong. That's why it seems bizarre accepting maths to be a science. If you propose considering math a 'formal science', I have no problem accepting that mathematics is a science (yes, a formal one), please just provide an acceptable definition of science clarifying how the idea of a "mathematics science" fits empiric observations/predictions and testability.