Index: auth.config.ts
===================================================================
--- auth.config.ts	(revision f3370b14dc3bf9da4e4c7f5936861973fad08013)
+++ auth.config.ts	(revision 3d391828d902fe0c570f5748c209cad1e30ab60d)
@@ -1,5 +1,9 @@
 import type { NextAuthConfig } from 'next-auth';
 
+const AUTH_ROUTES = ['/login', '/register'];
+const PUBLIC_ROUTES = ['/'];
+
 export const authConfig = {
+
     pages: {
         signIn: '/login',
@@ -22,8 +26,18 @@
         authorized({ auth, request: { nextUrl } }) {
             const isLoggedIn = !!auth?.user;
-            const isOnApp = nextUrl.pathname.startsWith('/home');
+            const { pathname } = nextUrl;
 
-            if (isOnApp && !isLoggedIn) return false;
-            if (!isOnApp && isLoggedIn && nextUrl.pathname.startsWith('/login')) {
+            const isAuthRoute = AUTH_ROUTES.some((route) =>
+                pathname.startsWith(route)
+            );
+            const isPublicRoute = PUBLIC_ROUTES.includes(pathname);
+
+            // Not logged in & trying to access protected route
+            if (!isLoggedIn && !isAuthRoute && !isPublicRoute) {
+                return false; // NextAuth will redirect to /login
+            }
+
+            // Logged in & trying to access auth or landing pages
+            if (isLoggedIn && (isAuthRoute || isPublicRoute)) {
                 return Response.redirect(new URL('/home', nextUrl));
             }
