The problem is almost certainly that tabled is measuring the string width without expecting there to be ANSI codes (thus including their data, that is invisible when sent to the terminal, in the width). To avoid this problem, you must do one of these things:
Use a width measurement that parses ANSI codes. Checking the documentation and source of tabled, it seems that enabling the ansi feature will do that, but the documentation isn’t clear about what it actually does.
Use a layout algorithm that is aware of styled text before it is formatted as ANSI codes (e.g. use ratatui instead of both libraries).
Measure the original string without any styling, then use that width for layout, but print the styled text. I don’t know if you can do this while still using tabled.