What determines the use of 'ea' as opposed to 'is'

In chapter 10 Orberg’s LLPSI he has the following sentence: ‘Canis amicus hominis est, ea bestia fera non est.’ I don’t understand why he uses the feminine pronoun ‘ea’ to say that ‘it’ (the dog) is not a wild animal. I know that canis can be either masculine or feminine but here it’s clearly masculine. Or is it agreeing with ‘bestia’ feminine? But why would it…? It’s not an adjective? But then that would mean that to say ‘He (the man) is not a wild animal’ you would write ‘Ea bestia non est.’ Can anyone explain this?

See A&G, §296a
Vide illam grammaticam de A&G, sectio ducenti nonaginta sex pars a.

a. > An adjective pronoun usually agrees with an appositive or predicate noun, if there be one, rather than with the word to which it refers (cf. § 306):—
“> hīc > locus est ūnus quō perfugiant; hīc portus, haec arx, haec āra sociōrum ” (Verr. 5.126) , > this is the only place to which they can flee for refuge; this is the haven, this the citadel, this the altar of the allies.
“rērum caput > hōc > erat, > hīc > fōns ” (Hor. Ep. 1.17.45) , > this was the head of things, this the source.
“ > eam > sapientiam interpretantur > quam > adhūc mortālis nēmō est cōnsecūtus [for > id> …> quod> ] ” (Lael. 18) , > they explain that > [thing] > to be wisdom which no man ever yet attained> .

The demonstrative pronoun “is ea id” is indeed an adjective there before “bestia”"
“Ea” pronomen demonstrativum ante bestiae nomen illo loco adjectivum benè est:

Adrianus, Many thanks…