css does not have a selector that allows you to specify that all / none of the ancestor elements must meet certain criteria (i.e. not be a list), for this you need xpath.
but you can do the following:
ul > li {
// top level list item styles here
}
li ul > li {
all: initial;
// nested item styles here
}
. MDN all . unset .