President Donald Trump's immigration ideas may have already cost America trillions of dollars — with perhaps even more economic damage on the way.

See, America has a reputation. And that reputation is worth something. Quite a lot actually. A nation with a good reputation — such as one of tolerance and trustworthiness — has enhanced influence to achieve desired economic and geopolitical outcomes without force or cutting checks. A decent rep also makes a country a more attractive destination for capital, both financial and human.

So how do you think Brand America is doing these days?

It was actually pretty strong before the 2016 election, at least as imperfectly measured by Anholt-GfK Nation Brands Index. America's global ranking jumped from seventh to first when Barack Obama was elected and has remained at or near the top since. The U.S. was first last year, too, but still saw a sizable drop in global perceptions. It's hard to imagine that the Trump immigration and refugee travel ban — and the accompanying chaos — has done much to reverse that slide. If the Obama bump boosted the value of Brand America by some $2 trillion, how much has the Trump slump possibly hurt it?

But there's an even bigger risk to U.S. prosperity: What if foreigners no longer see America as a welcoming place? Many potential immigrants to America just might take "no" for an answer and decide to go elsewhere or stay home. Already, Canadian immigration lawyers have reportedly been flooded with inquiries from U.S.-based engineers and computer scientists.

This should all be alarming for an economy that has benefited so much from attracting the world's best and brightest. Roughly half of U.S.-based unicorns — technology startups worth at least $1 billion — were founded by immigrants, with India the top nation of origin. As venture capitalist Paul Graham tweets, "This is a good time to remember that without immigration the U.S. will only have 5 percent of the top people in each field." And more to the point regarding the Trump ban, as The Atlantic notes, "Iranian-Americans founded or hold leadership positions at Twitter, Dropbox, Oracle, Expedia, eBay, and Tinder."

The global race for talent is becoming ever more competitive, especially as Asian economies modernize and increase their demand for highly skilled labor. A 2014 University of Washington study, using LinkedIn data to monitor global worker migration, vividly shows how America is no longer the only game in town. While 27 percent of migrating professionals in its sample group chose the U.S. as a destination in 2000, just 13 percent did in 2012. The biggest drop was among those in the science, technology, engineering, and math fields — to 15 percent from 37 percent. In addition, the study found the share of graduates from the top 500 universities worldwide coming to America had also fallen by half.

Of course, almost every consultant and think-tank plan for boosting U.S. innovation and economic growth at least partly depends on sharply boosting high-skill immigration. Like this one from the McKinsey Global Institute:

The nation could generate tremendous impact on productivity in the near term and beyond 2020 by increasing the annual flow of high-skilled immigrants. This can be done by increasing the number of skilled H-1B visa holders, giving preference to visas for extended relatives of permanent residents who have specialized skills or tertiary degrees, and streamlining the visa process for skilled workers and entrepreneurs. [McKinsey Global Institute]

Sounds great, right? But pretty much every advanced economy is trying to play the same game. And probably none of those countries currently have their technology industry — a magnet for super-smart immigrants — physically protesting and legally attacking their nation's immigration policies. It's hard to see how America gets from Trump's immigration order to the expansive vision put forward by some of the most aggressive immigration advocates.

In his book The Upside of Inequality, former Bain Capital executive Edward Conard outlines a plan to supercharge U.S. growth by restricting immigration to top-scoring math and science majors from around the world, maybe 5 to 10 million immigrants. Team Trump can fiddle with immigration policy all it wants to attract potential superstar immigrants like Google's Sergey Brin or Tesla's Elon Musk. But the results may disappoint if America is now seen as deeply intolerant.

Then again, perhaps Team Trump could care less. Senior Trump adviser Stephen Bannon has complained that American engineering schools are "are all full of people from South Asia and East Asia. . . . They've come in here to take these jobs." He has also suggested it's a problem when "two-thirds or three-quarters of the CEOs in Silicon Valley are from South Asia or from Asia."

No worries, then. The Trump administration looks to be well on its way to finding a solution to Bannon's concerns.