We are using //h:h1 etc for level 1 TOC.
When we have a style that includes a negative left or right margin on the h1,
e.g.
margin-left: -1em;
then the page numbering on the TOC
goes wrong.
The obvious workaround is to not use negative values for margin-left and margin-right, especially with TOC-level elements.
I have included a zip file that demonstrates the behaviour.
Line 270 of the style.css file switches the behaviour on and off.
We would love to have the ability to resolve this, but we know no python - we are merely humble users (and fans) of Calibre.