We show that all Lindblad operators (i.e., generators of quantum Markov semigroups) on a finite-dimensional Hilbert space satisfying the detailed balance condition with respect to the thermal equilibrium state can be written as a gradient system with respect to the relative entropy. We discuss also thermodynamically consistent couplings to macroscopic systems, either as damped Hamiltonian systems with constant temperature or as GENERIC systems.