Cluster Cards Without rowspan
A rowspan matrix breaks every time a row count changes. The cluster map moved to a two-column card grid: table names become chips, ERD arrows become a legend.
TL;DR
A three-column matrix kept misaligning because the container forced fixed row counts onto uneven cluster data. Switching to a two-column card grid with flex-wrap chips, plus grouped banded table rows instead of merged cells, fixed the drift in both the overview and the inventory. Before recalculating a layout that keeps shifting, check whether the container's shape actually matches the data.
The cluster map in the architecture report shifted again. Five cluster boxes looked neat in three columns on screen, but once the PDF rendered, one cell in the second cluster row came out empty where a table name belonged. A table had just been added to that cluster, and every merged-row count below it drifted. The counts were right: five clusters, 35 tables. The structure holding them was wrong.
My first guess was arithmetic. The cluster overview was a three-column multi-row matrix, and every rerender shifted something new, so I recalculated the merged-cell values again and again: one column down, one row over, rerender to check. The empty cell simply moved. Whatever the numbers were adjusted to, a table added to one cluster pushed every other column out of alignment.
The container was wrong, not the numbers. A matrix with three columns and five clusters has to invent rows, and the cluster holding seven tables forced seven rows onto all three columns. 35 table names do not fit into cells sized for a fixed row count.
A matrix pretends cluster membership is two-dimensional. It is a list of clusters that happens to contain tables.
Two columns of cards and one full-width tail
The overview became a card grid. Grid is the honest fit here: the MDN grid documentation states that the grid value generates a block-level grid container box [1], so each cluster card is a block in a two-column track layout. minmax(0, 1fr) keeps a long table name from widening its column, and the 8px gap is the only spacing the cards need.
.cluster-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 8px;
}
.cluster-card:last-child {
grid-column: 1 / -1;
}
.cluster-tables {
display: flex;
flex-wrap: wrap;
}
The fifth card is odd, so it spans the full width instead of sitting alone in a half-empty row. Inside each card, the table names render as mono chips on a flex-wrap list. That choice follows the data too: the MDN flexbox basics describe flexbox as a one-dimensional layout model for distributing space between items [3], and a chip row is exactly one dimension. Names wrap to the next line as they run out, which is what a cluster with seven tables should do.
Banded rows and a legend instead of arrows
The inventory table dropped cell merging entirely. It is now a grouped table with tr.grp section rows, one per cluster, and plain rows beneath. Row counts change whenever a cluster gains or loses a table; with banded rows that change is local, and no column drifts when it happens. A merged cell would have to be recalculated across every affected row again.
table.groups tr {
break-inside: avoid;
}
table.groups tbody tr.grp > th {
break-after: avoid;
}
Two print rules keep the sections intact. break-inside tells the browser how page, column, or region breaks should behave within a generated box, per the MDN break-inside documentation [2], so a row is never split across pages. break-after: avoid on the section header keeps that header on the same page as its first table, which is the failure mode that produced stray one-line sections in earlier renders.
The ERD cluster map was redrawn with larger boxes, 330 by 96 pixels, and larger fonts. Crossing four zones with relation arrows made the diagram harder to read than the relations it described, so the arrows left the zone boundaries. They were replaced by a chip legend labelled "Relasi lintas klaster" (cross-cluster relations): four labelled chips, one per relation, with the caption height adjusted to hold them. The same four chips appear in the caption text, so the diagram and its caption share one vocabulary.
Arrows now appear only inside clusters. That was the decision the diagram needed.
The broader lesson sits one level above the CSS. When a diagram or a table is forced to hold more data than its shape allows, the numbers inside it will keep needing repair; the useful move is to inspect the container shape first and ask whether it matches the data. A list does not become two-dimensional by assigning row counts. This belongs on a layout checklist as a single item: before recalculating a layout that keeps drifting, measure the shape of the data against the shape of its container.
Sources
[1] MDN CSS grid, MDN CSS grid documentation
[2] MDN break-inside, MDN break-inside documentation
[3] MDN flexbox basics, MDN flexbox basics documentation