Selling a Rental Property & Depreciation Recapture

I'm definitely doing something wrong.  I sold a rental residential property in 2021 that I bought in 2007.  I depreciated it ever since, but lousy investor that I am, the property lost money every year with other expenses even aside from depreciation. I've got so $50K in non-allowable carryover losses.  But when I subtract the depreciation over the years from the original purchase price for the adjusted cost basis, Turbotax spits out that I had a gain of $77,000 or so that I owe taxes on.  I still had a mortgage of about $130,000 and only walk away with about $42K at settlement when all was said and done.  It seems at the very least that the carryover loss should be deducted from that "gain."  What am I missing???