| Share-based compensation - Share-based Compensation Expense (Details) - USD ($) $ in Thousands | 12 Months Ended | ||
|---|---|---|---|
| Dec. 31, 2018 | Dec. 31, 2017 | Dec. 31, 2016 | |
| Total share-based compensation expense included in the consolidated statements of operations | |||
| Total share-based compensation expense | $ 16,202 | $ 10,804 | $ 8,821 | 
| Research and development | |||
| Total share-based compensation expense included in the consolidated statements of operations | |||
| Total share-based compensation expense | 8,340 | 5,268 | 4,185 | 
| General and administrative | |||
| Total share-based compensation expense included in the consolidated statements of operations | |||
| Total share-based compensation expense | $ 7,862 | $ 5,536 | $ 4,636 | 
| X | ||||||||||
| 
- Definition Represents the expense recognized during the period arising from equity-based compensation arrangements (for example, shares of stock, unit, stock options or other equity instruments) with employees, directors and certain consultants qualifying for treatment as employees. Reference 1: http://fasb.org/us-gaap/role/ref/legacyRef 
 | 
| X | ||||||||||
| 
- References No definition available. 
 | 
| X | ||||||||||
| 
- Details 
 | 
| X | ||||||||||
| 
- Details 
 |