I want to draw the structure of my thesis with TikZ. A rough sketch in Paint:
The nodes have been easy so far, but I could not find a good solution for the dividing lines with the label. For example, I managed to place a node called "Preliminaries" above the "Introduction" node and some arbitrary distance to the left using the let solution from this question, and thought of drawing a line using its northwest anchor. But I don't know how to make sure that the line is at least as wide as the picture (as determined by the width of the widest row of chapter nodes) or how to calculate an endpoint for the line such that it extends the same distance right and left from the first chapter node's center.
How do I get the horizontal dividers between my nodes, extending for the whole width of the graphic?
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning, calc}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[
chapter/.style={
rectangle,
minimum width=8mm,
minimum height=3mm,
rounded corners=1mm,
align=center,
draw
},
font=\sffamily
]
\node [chapter](introduction){
\textbf{Introduction} \\
Motivation, goals and contribution
};
\node [chapter, below=4mm of introduction.south](background){
\textbf{Background} \\
Context and terms
};
% This tries to make ``Preliminaries'' a node, but maybe this is not the best approach anyway
%\draw ($(introduction.north west)+(-1,0.5)$) -- ($(introduction.north east)+(1,0.5)$);
%\path let \p1 = (introduction.north) in node (preliminaries) at (-5, \y1+10) {
% Preliminaries
%};
\end{tikzpicture}
\caption{Structure of the thesis}
\label{fig:structure-of-the-thesis}
\end{figure}
\end{document}


