The Amazon Publishing Guidelines has sample code for making a nested html TOC.
It's on page 16
<div>Section 1</div>
<div style="margin-left:2%;">Chapter 1</div>
<div style="margin-left:2%;">Chapter 2</div>
<div style="margin-left:2%;">Chapter 3</div>
<div style="margin-left:4%;">Subchapter 1</div>
<div style="margin-left:4%;">Subchapter 2</div>
<div style="margin-left:2%;">Chapter 4</div>
<div style="margin-left:4%;">Subchapter 1</div>
<div>Section 2</div>
...
Now here's an alternate way to do the same thing:
<style> div.chapter { margin-left: 1em}
div.subchapter { margin-left: 2em} </style>
<div>Section 1</div>
<div class="chapter">Chapter 1</div>
<div class="chapter">Chapter 2</div>
<div class="chapter">Chapter 3</div>
<div class="subchapter">Subchapter 1</div>
<div class="subchapter">Subchapter 2</div>
<div class="chapter">Chapter 4</div>
<div class="subchapter">Subchapter 1</div>
<div>Section 2</div> ...
I've never tried it, but I assume it will work.
Also, I found another working example for nested TOC in the book EPUB3 Best Practices by Matt Garrish and Markus Gylling. The code they used depending on very sophisticated CSS for the NAV element. I'm guessing that this is only an EPUB solution and wouldn't work for the Kindle.
FURTHER THOUGHTS: It's not mentioned in the Amazon Publishing Guidelines, but I assume that all of this html is inside the <nav epub:type="toc">
element (leading me to wonder why the elements here are all DIVs instead of LIs).