Oddly enough..Same experience, same airport.
As I was coming back from New Zealand, I was stopped, unlawfully searched and was told they found marijuana in my bag. I know for a fact I wasn't carrying anything, and they wouldn't let me see the tests, call a lawyer, call my friend to let her know I wasn't coming on the next flight etc. They made it clear that I had absolutely no rights, and there was no due process. I couldn't see a judge.... anyone. They confirmed that I would stay there until I coughed up $5000.
I held out for a little over 4 hours, before I was told I could pay $500 to leave if I "admitted guilt". I signed a form (that I wasn't allowed to take a photo of or consult my lawyer about). And I was set free after a $500 tab.
I followed up with US border and customs agents the day after and requested a copy of the form I signed, to no avail. I attempted to follow up, again, with no avail.
And i'm now perpetually flagged by US border and customs. Anytime I come back in the country I go through extra security. Thanks San Fran.