"Teen Mom" Amber Portwood just lost primary custody of her baby daughter ... TMZ has learned.
Custody was awarded to baby daddy Gary Shirley instead -- after an Indiana judge decided he was a more suitable parent ... at least for the time being.
But it wasn't because Amber's an unfit mother -- according to court testimony today, Child Protective Services recommended that Gary have primary custody because of recent vandalism to Amber's house and car.
CPS was nervous about Amber's living conditions -- so both parties agreed it would be best for baby Leah to stay with Gary until further notice.
Amber will have visitation rights -- but we're told, CPS hasn't come up with a schedule yet. So far, no word from Amber's camp.