New sidebar alignment logic (align to first title, button bar, or major box)