You could do a set-up like the one I always see on the offshore party boats. They have large bench seats that convert into bunks. The bottom of the bench seat stays put as the bottom bunk. The top edge of the backrest of the bench seat is hinged, and the bottom edge of the backrest pivots out and up. They have straps or cables that come down from the ceiling and attach to each corner (just the front two) of the backrest that has become the top bunk.
Okay, I might have made that a little confusing trying to explain it. Do you get the concept?