According to Rambam in Hilchot Tefilla 4:15, if one does not have Kavanat HaLev for the Amida, the recitation of words does not comprise Tefilla. Tefilla is defined by "standing in the presence of Shechina". Shulchan Aruch writes that minimally once must have Kavana for the first Beracha. The Rema writes, following the Tur, that nowadays we don't require one to repeat Amida even if he didn't have Kavana for the first Beracha, since the chances are that one won't have Kavana for the second time either.
If one inserted the Ata Chonantanu in the fourth beracha on Motzaei Shabbat, but failed to have the requisite Kavana for Amida, does the Havdala count or must one repeat Amida (or, conversely, make Havdala) before performing any מלאכה? Would there be any difference in the application of the law between Rambam, Shulchan Aruch and Rema? For example, would Sh"A hold that it's only a valid Havdala if one had Kavana during the first Beracha, whereas Rema would hold it's valid?