Rank
Winning a stage earns a rank of S, A or B. It exists to show that some wins are better than others. Losing earns no rank at all.
Two Measures
Two things are measured: how many turns you used and how many units survived. Each gives its own S, A or B and the lower of the two becomes the final rank. Finishing fast does not help if you spent units, and fighting carefully does not help if you took too long.
Survival is counted in units, not soldiers — a unit that is down to its last soldier still counts as alive. Units inside transports and inside bases are counted too, so pulling a damaged unit back into a base does not read as a loss.
War Machines (barricades and ballistae) are not counted. They are there to be placed and broken, and they cannot be pulled back, so losing one does not lower your rank. Destroying an enemy's does not add to your tally either.
Records
The best rank you have achieved is kept for each stage, and replaying to a better one replaces it.