The U.S. Supreme Court has proven its mettle in its first important confrontation with the Trump administration — barely.