Auto-calculate input width