I think you have it more or less straight, Pure_Yvesil, but just to prevent all ambiguity:
Ils étaient tout
seuls - they were completely
Ils étaient tous
seuls; Tous étaient seuls - all of them
were alone (pronoun - but this sentence isn't very logical, because each
should be alone, not "all").
Tous les hommes étaient seuls - All of the men were alone (adjective)
The rules are confusing, because this word can have so many different grammatical functions.
1. "Tout" is a masculine singular noun that means "everything"
.....Il a tout fait ; tout est prêt !
2. "Tout/tous/toute/toutes" is an adjective that means "all," "every," or "whole/entire." Like any adjective, it agrees in number and gender with the noun it modifies.
.....On a volé tous mes crayons et toutes mes gommes ! = Someone stole all my pencils and all my erasers
.... Je vais lire toute l'histoire. = I'm going to read the whole/entire story.
.....Tout homme est mortel. = Every man is mortal.
.....Il chante toute la journée. = He sings all day (long)
3. "Tous" and "toutes" are pronouns that mean "all (of them)" or "everyone"
Like any pronoun, it has the number and gender of the noun it replaces. Since "all" is by definition plural, it is logical that there is no singular form for this pronoun.
.....Ils ont tous fait la même erreur, Tous ont fait la même erreur. = Everyone / They all of them made the same mistake.
.....Toutes étaient très belles. = All of them (f.) were very beautiful, they were all very beautiful.
.....Nous le ferrons tous les quatre. = All four of us will do it.
.....Ils sont tous étonnés de te voir. = They (m.) are all of them astonished to see you.
.....Elles sont toutes contentes de te voir. = They (f.) are all of them happy to see you.
4. Tout is an adverb that means "entirely," "completely," or "quite." Adverbs are invariable... but "tout" has an exception, which comes about for phonetic reasons: so when the adverb "tout" is followed by a feminine adjective that starts with a consonant or an aspirate H, it will agree in number and gender with the adjective.
..... Ils sont tout étonnés de te voir. = They are quite astonished to see you.
..... Ils sont tout contents de te voir. = They are quite happy to see you.
..... Elle est tout étonnée de te voir.
..... Elles sont tout étonnées de te voir.
..... Elle est toute contente de te voir.
..... Elles sont toutes contentes de te voir. - (note that this last example is indistinguishable from the final example in category #3)
Does this help?