This case has a very specific legal framing to it, but border agents don't actually need anything more than suspicion to keep you locked for a day or two.
Then it could last a lot longer. Technically they don't have the right to do that, but you won't have any physical mean to enforce your rights, and suing afterwards won't lead you anywhere in the current climate.
We'e had a few of these stories in HN before.