”[the CBP agent] said if I didn’t give them my phone, my interrogation was going to take much longer and they could retain my phone indefinitely”
I would take a punt at filing a complaint about that. Threatening someone with selective enforcement must fall short of professional standards at CBP, as stated on their .gov page:
https://www.cbp.gov/sites/default/files/2024-09/exhibit_08_-...