Grain-size segregation and levee formation in geophysical mass flows