How is ISA bonus net contribution calculated

The Ts&Cs states that

The New Customer must maintain at least the Net Contribution as it stood at the Promotional Period End until 30/04/2025.

If I transfer in £5000 worth of shares, and months later the value goes up to £6000 and I sell £5000 worth of shares and withdraw the cash leaving £1000 worth of shares in the account, then the value goes down to £900. What’s the net contribution at this point?

£5,000 - £5,000 = £0

Does this mean that if I transfer in £5000 worth of shares, and the value goes down to £4000 and I sell and withdraw £4000 leaving nothing in the account, the net contribution at this point is £5000 - £4000 = £1000 even though there’s nothing left in the account?

Yes.

You contributed £5k, you took out £4k.