How does Turbotax Calculate Penalty for underpayment of taxes

Background: 

A. In 2023 I was working and retired in the middle of the year with a severance package. Let's say that year total income was 100k. Total taxes I owed was approximately: $28k.

B. In 2024, I only had investment income  such that: 5k for the first three quarters and 10k for the 4th quarter. 

C. In 2024, I had been making estimated tax payments for each of the quarter - $850 (17% of 5k) for the first three quarters and for the last quarter I used TurboTax itself to do a mock tax prep and ensured at least 90% of the total tax for 2024 was met. (In fact I paid lot more than 90%).

D. After all these, when I prepared my final tax return, Turbo Tax (2024 tax year, which comes out in late 2024/early 2025), calculated a penalty.  

 

The irony is, the final tax return, per Turbo Tax showed both a refund AND it also showed a penalty.

Here are my questions:

a. How does Turbotax calculate the penalty? Is it per quarter but based on the total AGI/MAGI/total taxable income for the whole year? 

b. How do you explain a refund and a penalty for the same tax year?

c. In general if the total tax payments for a tax year is $5000 (which comes to $1250 per quarter), but I made estimated tax payments of $850 for the first three quarters and $2600 for the fourth quarter, do you still calculate a penalty because at a quarter level, for the first three quarters, I would have underpaid?

d. Is this the way IRS determines the penalty?

Thanks in advance for your reply.