import type { Metadata } from "next"; import { IBM_Plex_Sans, IBM_Plex_Mono, Space_Grotesk } from "next/font/google"; import "./globals.css"; import { configStore } from "@/lib/config/loader"; import { ThemeStyleInjector } from "@/components/layout/ThemeStyleInjector"; const plexSans = IBM_Plex_Sans({ variable: "--font-plex-sans", subsets: ["latin"], weight: ["400", "500", "600"], }); const plexMono = IBM_Plex_Mono({ variable: "--font-plex-mono", subsets: ["latin"], weight: ["400", "500"], }); const spaceGrotesk = Space_Grotesk({ variable: "--font-space-grotesk", subsets: ["latin"], weight: ["600"], }); export const metadata: Metadata = { title: "PulseNode", description: "Self-hosted infrastructure dashboard", }; const THEME_STORAGE_KEY = "pulsenode-theme"; const themeInitScript = `try{var t=localStorage.getItem(${JSON.stringify(THEME_STORAGE_KEY)});if(t==="dark"||t==="light"){document.documentElement.dataset.theme=t;}}catch(e){}`; export default function RootLayout({ children }: LayoutProps<"/">) { let mode: "dark" | "light" | "auto" = "dark"; let variables: Record = {}; let customCssPath: string | undefined; try { const config = configStore.get(); mode = config.theme.mode; variables = config.theme.variables; customCssPath = config.theme.customCssPath; } catch { // page.tsx surfaces the actual config error; layout falls back to defaults } return (