Detention has two parts: the time lost at the dock, and whether you get paid for it. They need different responses.
To lose less time, book appointments you can actually hit, arrive within the window, and have the BOL, PO, and any appointment number ready so check-in is quick. Facilities work on-time, prepared trucks first. Track which shippers and receivers routinely run long and either price that in or push back on the appointment.
To collect what you cannot avoid, start from the rate confirmation: know the free window and the hourly rate before the truck arrives, and negotiate them if the broker’s standard terms are unfavorable. Then capture proof — arrival and departure times from a gate system, a driver app, or the BOL annotated and signed by the facility. Detention billed with times that match the receiver’s records gets paid; detention billed from the driver’s memory usually does not.
Terms in this answer: Detention, Dwell Time, Rate Confirmation, Accessorial Charge
In Trailflow: the driver app.