Inventory (Details) - USD ($) $ in Thousands |
Dec. 31, 2016 |
Dec. 31, 2015 |
|---|---|---|
| Inventory. | ||
| Raw materials and supplies | $ 26,298 | $ 23,705 |
| Work-in-process | 1,865 | 5,567 |
| Finished goods | 1,777 | 3,480 |
| Total inventory | 29,940 | 32,752 |
| Inventory on consignment | $ 3,300 | $ 2,200 |