Add the Custom Variant for Dark Mode: Open your global CSS file (usually styles/globals.css) and add this line at the top of the file. see the docs https://tailwindcss.com/docs/dark-mode
CSS
@import "tailwindcss";
@custom-variant dark (&:where(.dark, .dark *));