Improved dialog width calculations