Thermohaline circulation of shallow tidal seas