Unread Message Count in Mail is Wrong for "Smart" Mailboxes
The unread message count for some of my "Smart" Mailboxes in Apple Mail is incorrect. I see that Mail users have been reporting this problem for several years. As per this thread, I have tried deleting all of the "Envelope" files in ~/Library/Mail/V10/MailData, which did not fix the problem but did delete all of my Contacts groups and caused all of my emails be downloaded again, creating duplicates of everything and a huge mess. I have also tried Safe Mode, and I still had the problem in that mode.
MacBook Pro 15″, macOS 13.2