Gear grows three ways: a grade roll that raises its grade, stones in its sockets, and an enchant scroll on top.
Open a slot and click UPGRADE (1): it names the next grade, the Scrap it costs and the chance it lands. A miss costs the Scrap and nothing else.
The upgrade window shows the piece, the grade it goes to, the chance and the Scrap. ATTEMPT rolls once; ALL-IN! (1), open from floor 40, keeps rolling until the grade lands or the Scrap runs out.
Each gear row has a GEM and a RUNE socket (1). A stone has to match the piece's stat, and a tier-T stone needs level (T-1)x10. When a piece leaves its slot its gems and runes come back loose in the bag; its scroll stays on it.
Scrolls (1) drop from floor 30: click one in the bag and pick the piece it enchants; the scroll stays on that piece even when the piece comes off.
Screenshots are taken from the live game by tools/tutorial_shots.py (dfmc-client) and regenerated after interface changes. The rules behind each screen: upgrading, system-grade, system-sockets.