The only way you can lose metal or crystal is by spending it.
Now, it's theoretically possible that your credit income can become negative. You need to buy population infrastructure upgrades on your planets in order to make their credit income positive, otherwise they drain constantly from your treasury. This is a common beginner mistake.
If you highlight your resource counter with your cursor, it will show you your total income per second (as well as a per-planet breakdown).