@fayz-ai/ui 0.17.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/analytics/derive.d.ts +1 -9
  2. package/dist/analytics/derive.d.ts.map +1 -1
  3. package/dist/{chunk-DFOAKWYB.js → chunk-5NEADAIP.js} +3 -3
  4. package/dist/{chunk-DFOAKWYB.js.map → chunk-5NEADAIP.js.map} +1 -1
  5. package/dist/{chunk-Z2ITFPGL.js → chunk-5WSKZU7M.js} +547 -74
  6. package/dist/chunk-5WSKZU7M.js.map +1 -0
  7. package/dist/{chunk-OBIU37AX.js → chunk-6YFPPK7X.js} +28 -14
  8. package/dist/chunk-6YFPPK7X.js.map +1 -0
  9. package/dist/{chunk-ZLPYNHXH.js → chunk-ERSX3C7T.js} +3 -3
  10. package/dist/{chunk-ZLPYNHXH.js.map → chunk-ERSX3C7T.js.map} +1 -1
  11. package/dist/{chunk-3OVZ5JJQ.js → chunk-GLRLWBBF.js} +4 -3
  12. package/dist/chunk-GLRLWBBF.js.map +1 -0
  13. package/dist/{chunk-AASANYXN.js → chunk-OB2ULDBD.js} +6 -4
  14. package/dist/chunk-OB2ULDBD.js.map +1 -0
  15. package/dist/chunk-SB6DWHXI.js +199 -0
  16. package/dist/chunk-SB6DWHXI.js.map +1 -0
  17. package/dist/dashboard/index.js +2 -2
  18. package/dist/icons.d.ts.map +1 -1
  19. package/dist/icons.js +1 -1
  20. package/dist/index.d.ts +2 -1
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +11 -25
  23. package/dist/index.js.map +1 -1
  24. package/dist/layout/AppShell.d.ts +7 -1
  25. package/dist/layout/AppShell.d.ts.map +1 -1
  26. package/dist/layout/SaveBar.d.ts +10 -1
  27. package/dist/layout/SaveBar.d.ts.map +1 -1
  28. package/dist/layout/Sidebar.d.ts.map +1 -1
  29. package/dist/layout/index.js +3 -3
  30. package/dist/lib/error-message.d.ts +2 -0
  31. package/dist/lib/error-message.d.ts.map +1 -0
  32. package/dist/primitives/brand-marks.d.ts +11 -0
  33. package/dist/primitives/brand-marks.d.ts.map +1 -0
  34. package/dist/primitives/button.d.ts +1 -1
  35. package/dist/primitives/dot-badge.d.ts +27 -0
  36. package/dist/primitives/dot-badge.d.ts.map +1 -0
  37. package/dist/primitives/draft-commit-bar.d.ts +27 -0
  38. package/dist/primitives/draft-commit-bar.d.ts.map +1 -0
  39. package/dist/primitives/filter-check-list.d.ts +65 -0
  40. package/dist/primitives/filter-check-list.d.ts.map +1 -0
  41. package/dist/primitives/header-tabs.d.ts +19 -0
  42. package/dist/primitives/header-tabs.d.ts.map +1 -1
  43. package/dist/primitives/image-drop.d.ts.map +1 -1
  44. package/dist/primitives/index.d.ts +6 -0
  45. package/dist/primitives/index.d.ts.map +1 -1
  46. package/dist/primitives/index.js +4 -4
  47. package/dist/primitives/list-chrome.d.ts +5 -1
  48. package/dist/primitives/list-chrome.d.ts.map +1 -1
  49. package/dist/primitives/mini-calendar.d.ts +36 -0
  50. package/dist/primitives/mini-calendar.d.ts.map +1 -0
  51. package/dist/primitives/multi-select.d.ts +21 -0
  52. package/dist/primitives/multi-select.d.ts.map +1 -0
  53. package/dist/primitives/select.d.ts.map +1 -1
  54. package/dist/primitives/stock-entry-form.d.ts +52 -0
  55. package/dist/primitives/stock-entry-form.d.ts.map +1 -0
  56. package/dist/styles.css +100 -0
  57. package/dist/tailwind.cjs +1 -1
  58. package/dist/tailwind.cjs.map +1 -1
  59. package/dist/tailwind.js +1 -1
  60. package/dist/tailwind.js.map +1 -1
  61. package/dist/wizard/index.js +2 -2
  62. package/dist/wizard/useWizard.d.ts.map +1 -1
  63. package/package.json +2 -2
  64. package/dist/chunk-3OVZ5JJQ.js.map +0 -1
  65. package/dist/chunk-4GK6IHOI.js +0 -177
  66. package/dist/chunk-4GK6IHOI.js.map +0 -1
  67. package/dist/chunk-AASANYXN.js.map +0 -1
  68. package/dist/chunk-OBIU37AX.js.map +0 -1
  69. package/dist/chunk-Z2ITFPGL.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/primitives/sheet.tsx","../src/layout/SaveBar.tsx","../src/layout/useCrossModuleBack.ts","../src/primitives/page-header.tsx","../src/layout/rail-flyout.tsx","../src/layout/Sidebar.tsx","../src/layout/Topbar.tsx","../src/layout/AppShell.tsx","../src/primitives/header-tabs.tsx","../src/layout/PageTransition.tsx","../src/layout/ModulePage.tsx"],"names":["React","jsx","jsxs","React3","React4","content","Fragment","useIsomorphicLayoutEffect","React5","ExternalLink","Crown","X","React6","Settings","getIcon","Home","ChevronDown","Search","React7","Menu","Sparkles","React8","useTranslation","React9","ChevronRight"],"mappings":";;;;;;;;;;;AAUA,IAAM,QAAA,GAAW,mBAAA;AACjB,IAAI,OAAO,QAAA,KAAa,WAAA,IAAe,CAAC,QAAA,CAAS,cAAA,CAAe,QAAQ,CAAA,EAAG;AACzE,EAAA,MAAM,KAAA,GAAQ,QAAA,CAAS,aAAA,CAAc,OAAO,CAAA;AAC5C,EAAA,KAAA,CAAM,EAAA,GAAK,QAAA;AACX,EAAA,KAAA,CAAM,WAAA,GAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAA,CAAA;AAUpB,EAAA,QAAA,CAAS,IAAA,CAAK,YAAY,KAAK,CAAA;AACjC;AAMA,IAAM,KAAA,GAAwB,eAAA,CAAA;AAC9B,IAAM,YAAA,GAA+B,eAAA,CAAA;AACrC,IAAM,UAAA,GAA6B,eAAA,CAAA;AACnC,IAAM,WAAA,GAA8B,eAAA,CAAA;AAMpC,IAAM,YAAA,GAAqBA,kBAGzB,CAAC,EAAE,WAAW,GAAG,KAAA,IAAS,GAAA,qBAC1B,GAAA;AAAA,EAAiB,eAAA,CAAA,OAAA;AAAA,EAAhB;AAAA,IACC,GAAA;AAAA,IACA,SAAA,EAAW,EAAA;AAAA,MACT,0EAAA;AAAA,MACA;AAAA,KACF;AAAA,IAC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U,gBAAgB,QAAA,EAAA,aAAA,EAAc;AAAA,KAAA,EACjE,CAAA,EACF,CAAA;AAAA,oBAGAC,IAAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,SAAA,EAMZ,QAAA,EAAA;AAAA,MAAA,UAAA,IAAc,YAAA,oBAAgBD,GAAAA,CAAC,iBAAA,EAAA,EAAmB,QAAA,EAAA,YAAA,EAAa,CAAA;AAAA,MAM/D,CAAC,SAAA,oBAAaA,GAAAA,CAAC,cAAW,GAAA,EAAU,CAAA;AAAA,sBACrCA,GAAAA,CAAC,cAAA,EAAA,EAAe,aAAA,EAA8B,WAC3C,QAAA,EACH;AAAA,KAAA,EACF;AAAA,GAAA,EACF,CAAA;AAEJ","file":"chunk-OBIU37AX.js","sourcesContent":["import * as React from 'react'\nimport * as DialogPrimitive from '@radix-ui/react-dialog'\nimport { X } from 'lucide-react'\n\nimport { cn } from '../lib/cn'\n\n// ---------------------------------------------------------------------------\n// Inject sheet animations once (module-level side effect)\n// ---------------------------------------------------------------------------\n\nconst STYLE_ID = 'saas-sheet-styles'\nif (typeof document !== 'undefined' && !document.getElementById(STYLE_ID)) {\n const style = document.createElement('style')\n style.id = STYLE_ID\n style.textContent = `\n @keyframes saas-sheet-fade-in { from { opacity: 0 } to { opacity: 1 } }\n @keyframes saas-sheet-fade-out { from { opacity: 1 } to { opacity: 0 } }\n @keyframes saas-sheet-slide-in { from { transform: translateX(100%) } to { transform: translateX(0) } }\n @keyframes saas-sheet-slide-out { from { transform: translateX(0) } to { transform: translateX(100%) } }\n .saas-sheet-overlay[data-state=\"open\"] { animation: saas-sheet-fade-in 200ms ease-out }\n .saas-sheet-overlay[data-state=\"closed\"] { animation: saas-sheet-fade-out 150ms ease-in }\n .saas-sheet-content[data-state=\"open\"] { animation: saas-sheet-slide-in 280ms cubic-bezier(0.16, 1, 0.3, 1) }\n .saas-sheet-content[data-state=\"closed\"] { animation: saas-sheet-slide-out 200ms ease-in }\n `\n document.head.appendChild(style)\n}\n\n// ---------------------------------------------------------------------------\n// Root, Trigger, Close — re-exported from Radix\n// ---------------------------------------------------------------------------\n\nconst Sheet = DialogPrimitive.Root\nconst SheetTrigger = DialogPrimitive.Trigger\nconst SheetClose = DialogPrimitive.Close\nconst SheetPortal = DialogPrimitive.Portal\n\n// ---------------------------------------------------------------------------\n// Overlay\n// ---------------------------------------------------------------------------\n\nconst SheetOverlay = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Overlay>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Overlay\n ref={ref}\n className={cn(\n 'saas-sheet-overlay fixed inset-0 z-[100] bg-black/40 backdrop-blur-[2px]',\n className\n )}\n {...props}\n />\n))\nSheetOverlay.displayName = 'SheetOverlay'\n\n// ---------------------------------------------------------------------------\n// Content — slides in from the right\n// ---------------------------------------------------------------------------\n\nconst SheetContent = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> & {\n /** Width class override — defaults to max-w-md */\n width?: string\n /** Hide the built-in close button */\n hideClose?: boolean\n /** Overlay style: \"blur\" (default), \"dim\" (no blur), \"none\" (transparent) */\n overlay?: 'blur' | 'dim' | 'none'\n }\n>(({ className, children, width, hideClose, overlay = 'blur', onPointerDownOutside, onInteractOutside, ...props }, ref) => (\n <SheetPortal>\n <SheetOverlay className={overlay === 'none' ? 'bg-transparent backdrop-blur-0' : overlay === 'dim' ? 'backdrop-blur-0' : undefined} />\n <DialogPrimitive.Content\n ref={ref}\n // Same passthrough Modal grants: a portaled dropdown (date picker,\n // combobox, status list) lands outside the sheet's DOM, and picking from\n // one must not read as clicking away from the sheet.\n onPointerDownOutside={(e) => {\n const target = e.target as HTMLElement\n if (target.closest('[data-modal-passthrough]') || target.closest('[data-radix-popper-content-wrapper]')) {\n e.preventDefault()\n }\n onPointerDownOutside?.(e)\n }}\n onInteractOutside={(e) => {\n const target = e.target as HTMLElement\n if (target.closest('[data-modal-passthrough]') || target.closest('[data-radix-popper-content-wrapper]')) {\n e.preventDefault()\n }\n onInteractOutside?.(e)\n }}\n className={cn(\n 'fayz-glass-surface saas-sheet-content fixed inset-y-0 right-0 z-[100] flex flex-col border-l bg-card shadow-2xl outline-none',\n 'w-full',\n width ?? 'max-w-md',\n className\n )}\n {...props}\n >\n {children}\n {!hideClose && (\n <DialogPrimitive.Close className=\"absolute right-4 top-4 z-10 flex h-7 w-7 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus:outline-none focus:ring-2 focus:ring-ring\">\n <X className=\"h-4 w-4\" />\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n )}\n </DialogPrimitive.Content>\n </SheetPortal>\n))\nSheetContent.displayName = 'SheetContent'\n\n// ---------------------------------------------------------------------------\n// Header — top section with title + description\n// ---------------------------------------------------------------------------\n\nfunction SheetHeader({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n className={cn('flex flex-col gap-1 px-5 py-4 border-b shrink-0', className)}\n {...props}\n />\n )\n}\nSheetHeader.displayName = 'SheetHeader'\n\n// ---------------------------------------------------------------------------\n// Footer — bottom section for actions\n// ---------------------------------------------------------------------------\n\nfunction SheetFooter({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n className={cn('flex items-center gap-2 px-5 py-3 border-t shrink-0', className)}\n {...props}\n />\n )\n}\nSheetFooter.displayName = 'SheetFooter'\n\n// ---------------------------------------------------------------------------\n// Title\n// ---------------------------------------------------------------------------\n\nconst SheetTitle = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Title>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Title\n ref={ref}\n className={cn('text-sm font-semibold leading-none tracking-tight', className)}\n {...props}\n />\n))\nSheetTitle.displayName = 'SheetTitle'\n\n// ---------------------------------------------------------------------------\n// Description\n// ---------------------------------------------------------------------------\n\nconst SheetDescription = React.forwardRef<\n React.ElementRef<typeof DialogPrimitive.Description>,\n React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n <DialogPrimitive.Description\n ref={ref}\n className={cn('text-xs text-muted-foreground', className)}\n {...props}\n />\n))\nSheetDescription.displayName = 'SheetDescription'\n\n// ---------------------------------------------------------------------------\n// Body — scrollable content area\n// ---------------------------------------------------------------------------\n\nfunction SheetBody({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n return (\n <div\n className={cn('flex-1 overflow-y-auto px-5 py-5', className)}\n {...props}\n />\n )\n}\nSheetBody.displayName = 'SheetBody'\n\nexport {\n Sheet,\n SheetPortal,\n SheetOverlay,\n SheetTrigger,\n SheetClose,\n SheetContent,\n SheetHeader,\n SheetBody,\n SheetFooter,\n SheetTitle,\n SheetDescription,\n}\n","import * as React from 'react'\nimport { Loader2 } from 'lucide-react'\nimport { useTranslation } from '@fayz-ai/core'\nimport { cn } from '../lib/cn'\n\n// ---------------------------------------------------------------------------\n// SaveBar — the single, app-wide \"Unsaved changes\" floating island. A form\n// declares its state via useSaveBar({ dirty, saving, onSave, onDiscard }); the\n// shell renders ONE <SaveBar/> (centered, floating above the content area) that\n// appears whenever the active form is dirty. Mirrors the BackStyleProvider /\n// PageHeaderActions idiom: decide-once at the shell, hook-in at the page.\n//\n// Handlers live in a ref (not state) so per-render closure changes never cause\n// re-render loops; only the primitive `dirty`/`saving` flags drive visibility.\n// ---------------------------------------------------------------------------\n\nexport interface SaveBarRegistration {\n /** Show the bar when true (form has unsaved changes). */\n dirty: boolean\n /** Save in progress — disables buttons and shows a spinner. */\n saving?: boolean\n onSave: () => void\n onDiscard?: () => void\n /** Override the \"Unsaved changes\" message. */\n message?: string\n /** Override the Save / Discard button labels. */\n saveLabel?: string\n discardLabel?: string\n}\n\ninterface SaveBarState {\n visible: boolean\n saving: boolean\n message?: string\n saveLabel?: string\n discardLabel?: string\n}\n\ninterface SaveBarApi {\n setState: React.Dispatch<React.SetStateAction<SaveBarState>>\n handlers: React.MutableRefObject<{ onSave?: () => void; onDiscard?: () => void }>\n}\n\n// Two contexts on purpose: the API context is STABLE (so useSaveBar's effect\n// deps don't change every render → no loop), the state context changes to\n// re-render only <SaveBar/>.\nconst SaveBarApiContext = React.createContext<SaveBarApi | null>(null)\nconst SaveBarStateContext = React.createContext<SaveBarState>({ visible: false, saving: false })\n\n// Module-level \"is the SaveBar showing\" signal so sibling UI that isn't a\n// descendant of SaveBarProvider (e.g. the ToastProvider) can react to it —\n// used to lift toasts above the bar so they stack instead of overlapping.\nlet _saveBarVisible = false\nconst _saveBarSubs = new Set<() => void>()\nfunction setSaveBarVisibleSignal(v: boolean) {\n if (v === _saveBarVisible) return\n _saveBarVisible = v\n _saveBarSubs.forEach((fn) => fn())\n}\n\n/** Subscribe to whether the floating SaveBar is currently on screen. */\nexport function useSaveBarVisible(): boolean {\n return React.useSyncExternalStore(\n (cb) => { _saveBarSubs.add(cb); return () => { _saveBarSubs.delete(cb) } },\n () => _saveBarVisible,\n () => false,\n )\n}\n\nexport function SaveBarProvider({ children }: { children: React.ReactNode }) {\n const [state, setState] = React.useState<SaveBarState>({ visible: false, saving: false })\n const handlers = React.useRef<{ onSave?: () => void; onDiscard?: () => void }>({})\n const api = React.useMemo<SaveBarApi>(() => ({ setState, handlers }), [])\n\n // Stack of registered back-navigation handlers (latest-mounted wins) so the\n // app-wide Escape key can navigate \"up\" to the parent route. Lives here, next\n // to the SaveBar handlers, so ONE keydown listener arbitrates both — Escape\n // discards a dirty form first, and only navigates back when none is open.\n const backStack = React.useRef<React.MutableRefObject<(() => void) | undefined>[]>([])\n const backApi = React.useMemo<BackNavApi>(() => ({ stack: backStack }), [])\n\n // Broadcast visibility to the module-level signal (for the ToastProvider).\n React.useEffect(() => { setSaveBarVisibleSignal(state.visible) }, [state.visible])\n\n // App-wide keyboard shortcuts, arbitrated in one place:\n // • Cmd/Ctrl+Enter → save the active (dirty) form\n // • Escape (form dirty) → discard the form\n // • Escape (no dirty form) → navigate back to the parent route\n React.useEffect(() => {\n function onKey(e: KeyboardEvent) {\n if (state.visible && !state.saving) {\n if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) {\n e.preventDefault()\n handlers.current.onSave?.()\n } else if (e.key === 'Escape') {\n e.preventDefault()\n handlers.current.onDiscard?.()\n }\n return\n }\n // No open/dirty form — Escape walks \"up\" via the topmost back handler.\n if (e.key === 'Escape' && !e.defaultPrevented && !isEditableTarget(e.target)) {\n for (let i = backStack.current.length - 1; i >= 0; i--) {\n const back = backStack.current[i].current\n if (back) { e.preventDefault(); back(); return }\n }\n }\n }\n window.addEventListener('keydown', onKey)\n return () => window.removeEventListener('keydown', onKey)\n }, [state.visible, state.saving])\n\n return (\n <SaveBarApiContext.Provider value={api}>\n <BackNavApiContext.Provider value={backApi}>\n <SaveBarStateContext.Provider value={state}>\n {children}\n </SaveBarStateContext.Provider>\n </BackNavApiContext.Provider>\n </SaveBarApiContext.Provider>\n )\n}\n\n// ---------------------------------------------------------------------------\n// Back-navigation registry — lets any subpage register its \"go to parent\" action\n// so the shell's single Escape handler can drive it (see SaveBarProvider above).\n// SubpageHeader already receives onBack, so wiring it there gives every plugin\n// detail page Escape-to-parent for free, with zero per-plugin code.\n// ---------------------------------------------------------------------------\n\ninterface BackNavApi {\n stack: React.MutableRefObject<React.MutableRefObject<(() => void) | undefined>[]>\n}\nconst BackNavApiContext = React.createContext<BackNavApi | null>(null)\n\n/** True when the keyboard event originates from a field where Escape has its\n * own meaning (clear/close), so we shouldn't hijack it for back-navigation. */\nfunction isEditableTarget(target: EventTarget | null): boolean {\n const el = target as HTMLElement | null\n if (!el || !el.tagName) return false\n const tag = el.tagName.toLowerCase()\n return tag === 'input' || tag === 'textarea' || tag === 'select' || el.isContentEditable\n}\n\n/**\n * Register a back-navigation handler with the app-wide Escape key. Call it in a\n * subpage (or pass through SubpageHeader's onBack); while mounted, pressing\n * Escape with no dirty form open invokes the most-recently-registered handler.\n * Pass `undefined` to opt out (e.g. a top-level page with nothing to go back to).\n */\nexport function useBackHandler(onBack?: () => void): void {\n const api = React.useContext(BackNavApiContext)\n // Hold the latest closure in a ref so re-renders don't churn the stack.\n const ref = React.useRef(onBack)\n React.useEffect(() => { ref.current = onBack })\n React.useEffect(() => {\n if (!api) return\n const stack = api.stack.current\n stack.push(ref)\n return () => {\n const i = stack.indexOf(ref)\n if (i !== -1) stack.splice(i, 1)\n }\n }, [api])\n}\n\n/**\n * Register the current form with the app-wide SaveBar. Call it unconditionally\n * in a form view; it shows the island while `dirty`, keeps handlers current, and\n * hides the island automatically when the form unmounts (e.g. on navigation).\n */\nexport function useSaveBar({ dirty, saving = false, onSave, onDiscard, message, saveLabel, discardLabel }: SaveBarRegistration): void {\n const api = React.useContext(SaveBarApiContext)\n\n // Keep latest handlers in the shared ref (no state churn from new closures).\n React.useEffect(() => {\n if (api) api.handlers.current = { onSave, onDiscard }\n })\n\n // Drive visibility from primitives only; `api` is stable → no render loops.\n React.useEffect(() => {\n if (!api) return\n api.setState({ visible: dirty, saving, message, saveLabel, discardLabel })\n return () => api.setState((s) => ({ ...s, visible: false }))\n }, [api, dirty, saving, message, saveLabel, discardLabel])\n}\n\n/** The floating island. Rendered once by the shell inside the content column. */\nexport function SaveBar({ className }: { className?: string }) {\n const state = React.useContext(SaveBarStateContext)\n const api = React.useContext(SaveBarApiContext)\n const t = useTranslation()\n\n // Keep the island mounted through its exit animation: `rendered` lags behind\n // `visible` so we can play fade-out before unmounting.\n const [rendered, setRendered] = React.useState(state.visible)\n const [closing, setClosing] = React.useState(false)\n\n React.useEffect(() => {\n if (state.visible) {\n setRendered(true)\n setClosing(false)\n return\n }\n if (!rendered) return\n setClosing(true)\n const id = setTimeout(() => { setRendered(false); setClosing(false) }, 200)\n return () => clearTimeout(id)\n }, [state.visible, rendered])\n\n if (!api || !rendered) return null\n const { saving, message, saveLabel, discardLabel } = state\n\n return (\n <div\n className={cn(\n // Above the tab bar (z-50), below a full-screen sheet (z-60), and lifted\n // clear of the bar's height so its actions are not sitting under it.\n 'pointer-events-none fixed inset-x-0 z-[55] flex justify-center px-4',\n 'bottom-[calc(var(--fz-bottom-bar,0px)+1.25rem)]',\n className,\n )}\n >\n {/* Dark island for strong contrast against the light page (auto-inverts in dark mode). */}\n <div className={cn(\n 'pointer-events-auto flex items-center gap-5 rounded-full bg-foreground py-2 pl-5 pr-2 text-background shadow-xl ring-1 ring-black/5 duration-200',\n closing ? 'animate-out fade-out slide-out-to-bottom-2' : 'animate-in fade-in slide-in-from-bottom-2',\n )}>\n <span className=\"flex items-center gap-2 text-sm font-medium\">\n <span className=\"h-2 w-2 shrink-0 rounded-full bg-amber-400\" />\n {message ?? t('saveBar.unsaved')}\n </span>\n <div className=\"flex items-center gap-1\">\n <button\n type=\"button\"\n disabled={saving}\n onClick={() => api.handlers.current.onDiscard?.()}\n className=\"rounded-full px-3 py-1.5 text-sm font-medium text-background/70 transition-colors hover:bg-background/10 hover:text-background disabled:opacity-50\"\n >\n {discardLabel ?? t('common.discard')}\n </button>\n <button\n type=\"button\"\n disabled={saving}\n onClick={() => api.handlers.current.onSave?.()}\n className=\"inline-flex items-center rounded-full bg-background px-4 py-1.5 text-sm font-semibold text-foreground transition-colors hover:bg-background/90 disabled:opacity-60\"\n >\n {saving && <Loader2 className=\"mr-1.5 h-3.5 w-3.5 animate-spin\" />}\n {saveLabel ?? t('common.save')}\n </button>\n </div>\n </div>\n </div>\n )\n}\n","import { useNavReferrer, navHistoryBack, routeModule } from '@fayz-ai/core'\n\n/**\n * Context-aware back target shared by all header/breadcrumb components.\n *\n * When the user arrived from a *different* module (tracked in the global\n * navigation history), a page's own onBack/parentLabel point at its local\n * parent — wrong for the referrer. In that case we return the referrer's label\n * and a back action that pops the browser history to the actual previous page.\n * Within the same module the page's own (more specific) values pass through\n * unchanged, so existing behavior is preserved.\n */\nexport function useCrossModuleBack(onBack?: () => void, parentLabel?: string): {\n onBack?: () => void\n parentLabel?: string\n isCrossModule: boolean\n} {\n const currentPath = typeof window !== 'undefined'\n ? ((window.location.hash ? window.location.hash.slice(1) : window.location.pathname) || '/')\n : '/'\n const referrer = useNavReferrer(currentPath)\n const cross = referrer && referrer.label && routeModule(referrer.path) !== routeModule(currentPath)\n ? referrer\n : null\n return {\n onBack: cross ? () => navHistoryBack(onBack) : onBack,\n parentLabel: cross ? cross.label : parentLabel,\n isCrossModule: !!cross,\n }\n}\n","import * as React from 'react'\nimport { ArrowLeft } from 'lucide-react'\nimport { usePageHeader, useHasPageHeaderHost, PageTitlePortal } from '../stores/page-header.store'\nimport { useBackHandler } from '../layout/SaveBar'\nimport { useCrossModuleBack } from '../layout/useCrossModuleBack'\n\n// ---------------------------------------------------------------------------\n// PageHeader — the header of ANY inner page, in one place.\n//\n// ← Orders / Order #1138 in the shell bar\n// ──────────────────────────\n// content, without repeating the title\n//\n// In the bar and not in the body because the bar exists anyway and already owns\n// the height: a header in the body spends a whole extra row saying what the bar\n// says for free — which is how screens ended up titled twice, \"Financial\" in the\n// bar and \"Payables\" right below it.\n//\n// With no bar (minimal layout, embedded form, modal) it draws inline, otherwise\n// the header would simply vanish.\n// ---------------------------------------------------------------------------\n\n/**\n * The header's markup, hook-free, so the shell can draw the SAME thing when the\n * title comes from the route instead of the page. Two copies of this markup is\n * how the app grew two different back arrows.\n */\nexport function PageHeaderCrumb({\n title,\n parentLabel,\n onBack,\n headingLevel = 'h2',\n}: {\n title?: React.ReactNode\n parentLabel?: string\n onBack?: () => void\n /** The shell passes 'h1': its page title IS the page's top-level heading, and\n * most screens render no other one, so h2 there is a skipped level. */\n headingLevel?: 'h1' | 'h2'\n}) {\n // `title` is a ReactNode, and screens do pass one — a status dropdown, a\n // chip. A heading must hold TEXT: wrapping an interactive node in an <h1>\n // nests a button inside a heading, which is both invalid and a lie to a\n // screen reader. Only a string becomes the heading; a node stays a span.\n const Heading = headingLevel\n const asHeading = typeof title === 'string' && title !== ''\n\n // No back path means a top-level page: just the title, at title size. No\n // point demoting it to a breadcrumb.\n if (!onBack) {\n if (!title) return null\n return asHeading\n ? <Heading className=\"min-w-0 truncate text-lg font-semibold\">{title}</Heading>\n : <span className=\"min-w-0 truncate text-lg font-semibold\">{title}</span>\n }\n\n return (\n <nav className=\"flex min-w-0 items-center gap-1.5 text-sm text-muted-foreground\">\n <button\n type=\"button\"\n onClick={onBack}\n className=\"inline-flex shrink-0 items-center gap-1 transition-colors hover:text-foreground\"\n >\n <ArrowLeft className=\"h-3.5 w-3.5\" />\n {parentLabel ?? 'Voltar'}\n </button>\n {title != null && (\n <>\n <span className=\"shrink-0\">/</span>\n {title === '' ? (\n // Title still waiting on data: a pulsing bar, otherwise the line\n // appears from nowhere and shoves the rest when the record lands.\n <span className=\"inline-block h-4 w-24 animate-pulse rounded bg-muted align-middle\" />\n ) : asHeading ? (\n // A heading, not a span, when it IS the screen's name: a subpage\n // that only ever renders a breadcrumb was leaving the page with no\n // heading for a screen reader to land on.\n <Heading className=\"min-w-0 truncate font-medium text-foreground\">{title}</Heading>\n ) : (\n <span className=\"min-w-0 truncate font-medium text-foreground\">{title}</span>\n )}\n </>\n )}\n </nav>\n )\n}\n\nexport interface PageHeaderProps {\n /** What THIS page is. Empty while loading → pulsing placeholder. */\n title: React.ReactNode\n /** Where the arrow goes back to. Without it there is no crumb, just the title. */\n onBack?: () => void\n /** Name of the arrow's destination (\"Orders\"), written before the slash. */\n parentLabel?: string\n /** Link text when there is no `parentLabel`. */\n backLabel?: string\n}\n\nexport function PageHeader({ title, onBack, parentLabel, backLabel }: PageHeaderProps) {\n const hasHost = useHasPageHeaderHost()\n\n // Arriving from another module goes back where you came from, not to this\n // screen's theoretical parent.\n const { onBack: effectiveOnBack, parentLabel: effectiveParent } = useCrossModuleBack(onBack, parentLabel)\n // The same action becomes the app's Escape, with no per-plugin code.\n useBackHandler(effectiveOnBack)\n\n const node = React.useMemo(() => (\n <PageHeaderCrumb\n title={title}\n parentLabel={effectiveParent ?? backLabel}\n onBack={effectiveOnBack}\n />\n ), [effectiveOnBack, effectiveParent, backLabel, title])\n\n // The claim is unconditional (hook order cannot change); what varies is\n // whether ANYONE is showing the bar.\n usePageHeader(hasHost, { back: !!effectiveOnBack })\n\n // Portalled, not handed over: the node keeps whatever providers wrote it.\n if (hasHost) return <PageTitlePortal>{node}</PageTitlePortal>\n return <div className=\"mb-4\">{node}</div>\n}\n","import * as React from 'react'\nimport { ChevronRight, Crown, ExternalLink, type LucideIcon } from 'lucide-react'\nimport { ICON_MAP } from '../icons'\nimport { cn } from '../lib/cn'\n\n// ---------------------------------------------------------------------------\n// Rail flyout — what the collapsed sidebar says when you point at it.\n//\n// One panel for the WHOLE rail, not one tooltip per row: it slides down the\n// rail to whichever item the pointer is on and swaps its contents on arrival,\n// so running down the menu reads as a single object following you instead of a\n// dozen bubbles blinking in and out. It also carries the item's children, which\n// a tooltip could not — a collapsed rail otherwise hides every sub-link behind\n// a click.\n//\n// The panel is painted in the SIDEBAR's tone (not the popover's): it is the\n// menu speaking, and a white card on a dark rail read as a foreign surface.\n// ---------------------------------------------------------------------------\n\nexport interface RailFlyoutEntry {\n id: string\n label: string\n icon?: string\n route?: string\n href?: string\n premium?: boolean\n badge?: string | number\n}\n\nexport interface RailFlyoutContent {\n /** Identity of the anchored item — a change is what triggers the swap. */\n key: string\n label: string\n route?: string\n href?: string\n premium?: boolean\n badge?: string | number\n entries?: RailFlyoutEntry[]\n}\n\nexport interface RailFlyoutHandle {\n /** Props to spread on a collapsed row so it anchors the panel. */\n rowProps: (content: RailFlyoutContent) => {\n onMouseEnter: (event: React.MouseEvent<HTMLElement>) => void\n onFocus: (event: React.FocusEvent<HTMLElement>) => void\n onMouseLeave: () => void\n }\n /** Rendered by the rail, as a sibling of its scrolling nav. */\n panel: React.ReactNode\n /** Close now (navigation, Escape, focus leaving the rail). */\n dismiss: () => void\n}\n\n/** Gap between the rail's edge and the panel — also the pointer's bridge, so\n * moving diagonally from the icon into the panel never crosses dead space. */\nconst GUTTER_PX = 8\nconst CLOSE_DELAY_MS = 140\n\n/** Layout effect on the client, plain effect during SSR (avoids the warning). */\nconst useIsomorphicLayoutEffect =\n typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect\n\nfunction iconOf(name?: string): LucideIcon | null {\n if (!name) return null\n return ICON_MAP[name] ?? null\n}\n\n// ---------------------------------------------------------------------------\n// Quem mais mora na trilha\n//\n// O painel é um só para o rail inteiro, e por isso o handle precisa alcançar\n// mais do que os links: um widget montado no pé da trilha (tarefas, um\n// interruptor de serviço) esconde o rótulo quando ela recolhe, e sem nada a\n// dizer no hover vira um ícone anônimo — enquanto o link ao lado abre um painel\n// com nome e filhos. O contexto entrega o MESMO painel a essas linhas.\n// ---------------------------------------------------------------------------\n\nconst RailFlyoutContext = React.createContext<RailFlyoutHandle | null>(null)\n\nexport const RailFlyoutProvider = RailFlyoutContext.Provider\n\n/**\n * Props de hover para uma linha da trilha que não é um link de navegação.\n * Espalhe no botão; fora de uma trilha (ou com ela aberta) não faz nada.\n */\nexport function useRailRow(content: RailFlyoutContent | null): {\n onMouseEnter?: (event: React.MouseEvent<HTMLElement>) => void\n onFocus?: (event: React.FocusEvent<HTMLElement>) => void\n onMouseLeave?: () => void\n} {\n const flyout = React.useContext(RailFlyoutContext)\n if (!flyout || !content) return {}\n return flyout.rowProps(content)\n}\n\nexport function useRailFlyout({\n enabled,\n railRef,\n activeRoute,\n onNavigate,\n}: {\n enabled: boolean\n railRef: React.RefObject<HTMLElement | null>\n activeRoute?: string | null\n onNavigate: (route: string) => void\n}): RailFlyoutHandle {\n const [state, setState] = React.useState<{ anchor: HTMLElement; content: RailFlyoutContent } | null>(null)\n const [pos, setPos] = React.useState({ top: 0, arrow: 20 })\n // Transitions are off while the panel is hidden: the first appearance would\n // otherwise fly in from wherever the previous item left it.\n const [animate, setAnimate] = React.useState(false)\n const panelRef = React.useRef<HTMLDivElement>(null)\n const closeTimer = React.useRef<ReturnType<typeof setTimeout> | null>(null)\n // Held so the panel can fade OUT still showing what it was showing.\n const lastContent = React.useRef<RailFlyoutContent | null>(null)\n\n const cancelClose = React.useCallback(() => {\n if (closeTimer.current) {\n clearTimeout(closeTimer.current)\n closeTimer.current = null\n }\n }, [])\n\n const show = React.useCallback(\n (anchor: HTMLElement, content: RailFlyoutContent) => {\n if (!enabled) return\n cancelClose()\n setState({ anchor, content })\n },\n [enabled, cancelClose],\n )\n\n const hide = React.useCallback(() => {\n cancelClose()\n closeTimer.current = setTimeout(() => setState(null), CLOSE_DELAY_MS)\n }, [cancelClose])\n\n const dismiss = React.useCallback(() => {\n cancelClose()\n setState(null)\n }, [cancelClose])\n\n React.useEffect(() => () => cancelClose(), [cancelClose])\n\n // Anything that isn't the rail anymore closes it: leaving the enabled state\n // (rail expanded) would otherwise strand an open panel over the content.\n React.useEffect(() => {\n if (!enabled) dismiss()\n }, [enabled, dismiss])\n\n // Position: aligned with the row, clamped so a long child list can't hang off\n // the top or bottom of the rail. The arrow keeps pointing at the row even\n // after the clamp moved the panel away from it.\n const reposition = React.useCallback(() => {\n const rail = railRef.current\n const anchor = state?.anchor\n if (!rail || !anchor) return\n const railRect = rail.getBoundingClientRect()\n const rect = anchor.getBoundingClientRect()\n const height = panelRef.current?.offsetHeight ?? 0\n const rowTop = rect.top - railRect.top\n const rowCenter = rowTop + rect.height / 2\n const max = Math.max(GUTTER_PX, railRect.height - height - GUTTER_PX)\n const top = Math.min(Math.max(GUTTER_PX, rowTop - 6), max)\n const arrow = Math.min(Math.max(rowCenter - top, 14), Math.max(14, height - 14))\n setPos({ top, arrow })\n }, [railRef, state])\n\n useIsomorphicLayoutEffect(reposition, [reposition, state?.content.key])\n\n // The rail scrolls under the panel: without this the panel stays pinned where\n // the row USED to be, which is the one thing a follower must never do.\n React.useEffect(() => {\n if (!state) return\n const rail = railRef.current\n const onScroll = () => reposition()\n rail?.addEventListener('scroll', onScroll, true)\n window.addEventListener('resize', onScroll)\n return () => {\n rail?.removeEventListener('scroll', onScroll, true)\n window.removeEventListener('resize', onScroll)\n }\n }, [state, railRef, reposition])\n\n const visible = !!state\n React.useEffect(() => {\n if (!visible) {\n setAnimate(false)\n return\n }\n const id = requestAnimationFrame(() => setAnimate(true))\n return () => cancelAnimationFrame(id)\n }, [visible])\n\n React.useEffect(() => {\n if (!visible) return\n const onKey = (event: KeyboardEvent) => {\n if (event.key === 'Escape') dismiss()\n }\n window.addEventListener('keydown', onKey)\n return () => window.removeEventListener('keydown', onKey)\n }, [visible, dismiss])\n\n const rowProps = React.useCallback(\n (content: RailFlyoutContent) => ({\n onMouseEnter: (event: React.MouseEvent<HTMLElement>) => show(event.currentTarget, content),\n onFocus: (event: React.FocusEvent<HTMLElement>) => show(event.currentTarget, content),\n onMouseLeave: hide,\n }),\n [show, hide],\n )\n\n if (state) lastContent.current = state.content\n const content = state?.content ?? lastContent.current\n\n const go = (entry: { route?: string; href?: string }) => {\n dismiss()\n if (entry.href) {\n window.open(entry.href, '_blank', 'noopener,noreferrer')\n return\n }\n if (entry.route) onNavigate(entry.route)\n }\n\n const entries = content?.entries ?? []\n const hasEntries = entries.length > 0\n\n const panel = enabled ? (\n <div\n // Outside the scrolling nav on purpose: inside it, the panel would be\n // clipped at the rail's 4rem edge and scroll away from its own anchor.\n style={{ transform: `translateY(${pos.top}px)`, paddingLeft: GUTTER_PX }}\n onMouseEnter={cancelClose}\n onMouseLeave={hide}\n className={cn(\n 'absolute left-full top-0 z-50 hidden md:block',\n animate && 'motion-safe:transition-[transform,opacity] motion-safe:duration-200 motion-safe:ease-out',\n visible ? 'opacity-100' : 'pointer-events-none opacity-0',\n )}\n aria-hidden={!visible}\n >\n <div\n ref={panelRef}\n className={cn(\n // Sidebar tone, sidebar border: the panel is the menu leaning out,\n // not a popover from the page underneath it.\n 'relative rounded-lg border border-sidebar-border bg-sidebar p-1 text-sidebar-foreground shadow-xl shadow-black/25',\n hasEntries ? 'min-w-[12.5rem] max-w-[16rem]' : 'max-w-[15rem]',\n )}\n >\n {/* Notch — a rotated square sharing the panel's fill and border, with\n the two inner edges masked by the panel itself. */}\n <span\n aria-hidden\n style={{ top: pos.arrow }}\n className=\"absolute -left-[5px] h-2.5 w-2.5 -translate-y-1/2 rotate-45 border-b border-l border-sidebar-border bg-sidebar\"\n />\n <div key={content?.key} className=\"saas-flyout-swap\">\n {content && <FlyoutBody content={content} entries={entries} activeRoute={activeRoute} onGo={go} />}\n </div>\n </div>\n </div>\n ) : null\n\n return { rowProps, panel, dismiss }\n}\n\nfunction FlyoutBody({\n content,\n entries,\n activeRoute,\n onGo,\n}: {\n content: RailFlyoutContent\n entries: RailFlyoutEntry[]\n activeRoute?: string | null\n onGo: (entry: { route?: string; href?: string }) => void\n}) {\n const hasEntries = entries.length > 0\n const headerActive = !!content.route && content.route === activeRoute\n const headerClickable = !!content.route || !!content.href\n\n const header = (\n <div\n className={cn(\n 'flex items-center gap-2 rounded-md px-2 py-1.5 text-[13px] font-semibold',\n hasEntries ? 'text-sidebar-foreground' : 'whitespace-nowrap',\n headerActive && 'text-sidebar-accent-foreground',\n headerClickable && 'transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',\n )}\n >\n <span className=\"min-w-0 flex-1 truncate\">{content.label}</span>\n {content.href && <ExternalLink className=\"h-3 w-3 shrink-0 opacity-50\" aria-hidden />}\n {content.premium && <Crown className=\"h-3 w-3 shrink-0 text-amber-500\" aria-hidden />}\n {content.badge !== undefined && (\n <span className=\"rounded-full bg-primary px-1.5 py-0.5 text-[10px] font-semibold text-primary-foreground\">\n {content.badge}\n </span>\n )}\n {hasEntries && headerClickable && (\n <ChevronRight className=\"h-3 w-3 shrink-0 text-sidebar-muted\" aria-hidden />\n )}\n </div>\n )\n\n return (\n <>\n {headerClickable ? (\n <button type=\"button\" onClick={() => onGo(content)} className=\"w-full text-left\">\n {header}\n </button>\n ) : (\n header\n )}\n {hasEntries && (\n <>\n <div className=\"my-1 h-px bg-sidebar-border\" />\n <div className=\"flex flex-col\">\n {entries.map((entry) => {\n const EntryIcon = iconOf(entry.icon)\n const isActive = !!entry.route && entry.route === activeRoute\n return (\n <button\n key={entry.id}\n type=\"button\"\n onClick={() => onGo(entry)}\n className={cn(\n 'flex items-center gap-2 rounded-md px-2 py-1.5 text-[12.5px] transition-colors',\n isActive\n ? 'bg-sidebar-accent font-medium text-sidebar-accent-foreground'\n : 'text-sidebar-foreground/75 hover:bg-sidebar-accent/60 hover:text-sidebar-accent-foreground',\n )}\n >\n {EntryIcon && <EntryIcon className=\"h-3.5 w-3.5 shrink-0 opacity-70\" />}\n <span className=\"min-w-0 flex-1 truncate text-left\">{entry.label}</span>\n {entry.href && <ExternalLink className=\"h-3 w-3 shrink-0 opacity-50\" aria-hidden />}\n {entry.premium && <Crown className=\"h-3 w-3 shrink-0 text-amber-500\" aria-hidden />}\n {entry.badge !== undefined && (\n <span className=\"rounded-full bg-primary px-1.5 py-0.5 text-[10px] font-semibold text-primary-foreground\">\n {entry.badge}\n </span>\n )}\n </button>\n )\n })}\n </div>\n </>\n )}\n </>\n )\n}\n","import * as React from 'react'\nimport {\n Bell, ChevronDown, Crown, ExternalLink, Home, PanelLeft, PanelLeftClose, Search, Settings, User, X,\n type LucideIcon,\n} from 'lucide-react'\nimport { ICON_MAP } from '../icons'\nimport { cn } from '../lib/cn'\nimport { useLayoutStore } from '../stores/layout.store'\nimport { useRailFlyout, RailFlyoutProvider, type RailFlyoutContent, type RailFlyoutHandle } from './rail-flyout'\n\nexport interface NavigationItem {\n id: string\n label: string\n icon: string\n route: string\n section: 'main' | 'secondary' | 'settings'\n /**\n * Heading this item sits under, WITHIN its section.\n *\n * `section` only ever offered two labelled runs, which is enough for an app\n * rail and not enough for the settings rail: a store console needs \"Loja\" and\n * \"Commerce\" as separate headings under the same section, and folding them\n * into main/secondary would spend the plugin run on one of them. Consecutive\n * items sharing a group render under one heading, in first-appearance order;\n * items with no group render first, headed by `sectionLabels`.\n */\n group?: string\n badge?: string | number\n permission?: { feature: string; action: 'read' | 'create' | 'edit' | 'delete' }\n /** Freemium discovery: the user's role allows this item, but their plan does\n * not entitle the feature. The item stays visible with a small Crown badge\n * and, on click, leads to the plan's UpgradePrompt. */\n premium?: boolean\n /** Sales-channel / external link: when set, the item opens this URL in a new\n * tab instead of navigating an internal route. Rendered as an anchor with an\n * external-link glyph. `route` is ignored for matching when `href` is set. */\n href?: string\n children?: NavigationItem[]\n}\n\nexport interface SidebarUser {\n fullName: string\n avatarUrl?: string\n email: string\n}\n\nexport interface SidebarProps {\n navigation: NavigationItem[]\n logo?: React.ReactNode\n collapsed: boolean\n onToggle: () => void\n onNavigate?: (route: string) => void\n currentPath?: string\n user?: SidebarUser\n onSignOut?: () => void\n onProfile?: () => void\n onSettings?: () => void\n onBilling?: () => void\n userMenuExtras?: { label: string; icon?: React.ReactNode; onClick: () => void }[]\n orgSwitcher?: React.ReactNode\n topContent?: React.ReactNode\n /**\n * A conta atual, na sua própria linha logo abaixo do cabeçalho e dentro do\n * mesmo bloco (uma borda só embaixo dos dois).\n *\n * Linha separada, e não ao lado da marca: no rail sobram ~200px, e marca +\n * avatar + nome na mesma linha reduzia o nome do cliente a \"Artorius S…\" —\n * o único dos três que o usuário não sabe de cor. Na topbar, onde a linha é a\n * tela inteira, os dois cabem lado a lado.\n */\n identity?: React.ReactNode\n /**\n * A saída do contexto (\"← Voltar para o início\"), no bloco fixo entre o\n * cabeçalho e a lista — o mesmo lugar da busca, e no lugar dela.\n *\n * Fixo e não no topo da lista: uma porta que rola para fora da tela com os\n * links deixa de ser porta, e Configurações tem lista mais alta que o rail.\n * E a busca sai enquanto ela está lá porque a paleta ⌘K procura no PRODUTO\n * inteiro — dentro de um contexto ela é a segunda coisa a prometer saída na\n * mesma linha, e a que não cumpre o que a outra diz.\n */\n navTop?: React.ReactNode\n footerContent?: React.ReactNode\n /** When true, removes all borders for a cleaner framed look */\n borderless?: boolean\n /** User menu component to render at the bottom */\n userMenuSlot?: React.ReactNode\n /** Notification slot to render at the bottom */\n notificationSlot?: React.ReactNode\n /** Unread notification count for the bell indicator */\n unreadCount?: number\n /** Placeholder on the rail's search field (\"Buscar\"). The shell passes the\n * translated word; the default keeps standalone mounts readable. */\n searchLabel?: string\n /** Optional headings above each nav section. Used by contextual sidebars\n * (e.g. /settings swaps the rail for \"Settings links\" + \"Plugins\"); the\n * normal app rail leaves them undefined and renders no headings. */\n sectionLabels?: { main?: string; secondary?: string; settings?: string }\n /** Identity of the current rail context. When it changes, the rail animates\n * as a push: the new nav slides in while the previous one slides out.\n * Leave undefined for a static rail (no swap animation). */\n navKey?: string\n /** Push direction for a `navKey` change. 'forward' pulls the new rail in\n * from the right (drilling in), 'back' from the left (returning). */\n navDirection?: 'forward' | 'back'\n /**\n * Render a group's children as bare labels with an elbow (↳) marking the\n * active one, instead of the icon-per-child list. Icons on children make a\n * group read as a second flat menu; the elbow says \"you are inside this one\"\n * with a single mark. Off by default — it changes every existing rail.\n */\n navChildConnector?: boolean\n /**\n * Mobile drawer mount. The rail's own collapse control makes no sense in a\n * sheet that is already either open or gone, so `onToggle` becomes a close\n * button in the identity row instead of the collapse toggle in the footer.\n */\n drawer?: boolean\n}\n\n// ICON_MAP now lives in ../icons (central curated registry, shared by every\n// string-name icon lookup in the SDK); re-exported here for compat.\nexport { ICON_MAP }\n\n/** Kept in sync with --saas-rail-duration in styles.css. */\nconst RAIL_PUSH_MS = 260\n\n/** Layout effect on the client, plain effect during SSR (avoids the warning).\n * The rail push needs the layout variant: the animation classes must be on\n * the DOM before paint, or the new rail shows one frame at its final spot. */\nconst useIsomorphicLayoutEffect =\n typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect\n\nfunction getIcon(name: string): LucideIcon {\n return ICON_MAP[name] ?? Home\n}\n\n/** \"⌘\" on a Mac, \"Ctrl \" everywhere else — the hint has to name the key the\n * reader actually has, or it is decoration. */\nfunction shortcutKey(): string {\n if (typeof navigator === 'undefined') return '⌘'\n return /Mac|iPhone|iPad/u.test(navigator.platform || navigator.userAgent) ? '⌘' : 'Ctrl '\n}\n\n/** What the collapsed rail hands the flyout for an item. */\nfunction flyoutContentOf(item: NavigationItem): RailFlyoutContent {\n return {\n key: item.id,\n label: item.label,\n route: item.route,\n href: item.href,\n premium: item.premium,\n badge: item.badge,\n entries: item.children?.map((child) => ({\n id: child.id,\n label: child.label,\n icon: child.icon,\n route: child.route,\n href: child.href,\n premium: child.premium,\n badge: child.badge,\n })),\n }\n}\n\nfunction NavItem({\n item,\n collapsed,\n isActive,\n onNavigate,\n flyout,\n}: {\n item: NavigationItem\n collapsed: boolean\n isActive: boolean\n onNavigate: (route: string) => void\n flyout?: RailFlyoutHandle\n}) {\n const Icon = getIcon(item.icon)\n const isExternal = !!item.href\n // Collapsed rail: the label (and any children) live in the shared flyout —\n // the rail itself shows nothing but the glyph.\n const hoverProps = collapsed && flyout ? flyout.rowProps(flyoutContentOf(item)) : undefined\n\n const className = cn(\n // 36px rows. The rail was condensed to 28px while it listed every\n // destination flat; with the destinations folded into collapsible groups it\n // shows a handful of rows at rest, and at that length the tight rhythm read\n // as cramped rather than as dense.\n 'flex w-full items-center gap-3 rounded-button px-2.5 py-2 text-[13px] font-medium transition-colors',\n 'hover:bg-sidebar-accent/60 hover:text-sidebar-accent-foreground',\n isActive\n // No shadow. The rail is a flat field of one tone and a drop shadow on it\n // reads as grime rather than as lift — the fill alone says \"here\".\n ? 'bg-sidebar-accent font-semibold text-sidebar-accent-foreground'\n : 'text-sidebar-foreground/80',\n collapsed && 'justify-center px-2',\n )\n\n const inner = (\n <>\n <Icon className=\"h-4 w-4 shrink-0\" />\n {!collapsed && (\n <>\n <span className=\"flex-1 truncate text-left\">{item.label}</span>\n {isExternal && (\n <ExternalLink className=\"ml-auto h-3.5 w-3.5 shrink-0 opacity-50\" aria-hidden />\n )}\n {item.premium && (\n <Crown className={cn('h-3.5 w-3.5 shrink-0 text-amber-500', !isExternal && 'ml-auto')} aria-hidden />\n )}\n {item.badge !== undefined && (\n <span className={cn('rounded-full bg-primary px-2 py-0.5 text-xs font-semibold text-primary-foreground', !isExternal && !item.premium && 'ml-auto')}>\n {item.badge}\n </span>\n )}\n </>\n )}\n </>\n )\n\n // Every menu entry is a tour anchor, keyed by its own route. It costs one\n // attribute and it is what lets the assistant point at \"Pedidos\" — the\n // alternative is a registry of hand-placed anchors that goes stale the first\n // time a plugin renames a page.\n const anchor = `nav.${item.route}`\n\n return isExternal ? (\n <a href={item.href} target=\"_blank\" rel=\"noopener noreferrer\" className={className} {...hoverProps}>\n {inner}\n </a>\n ) : (\n <button\n onClick={() => {\n flyout?.dismiss()\n onNavigate(item.route)\n }}\n className={className}\n data-tour={anchor}\n {...hoverProps}\n >\n {inner}\n </button>\n )\n}\n\n/** How specifically `route` matches `path` (-1 = no match; higher = more specific).\n * An exact match beats a prefix match; a longer prefix beats a shorter one. */\nfunction routeMatchScore(route: string, path: string): number {\n if (path === route) return route.length + 1\n if (route !== '/' && path.startsWith(route + '/')) return route.length\n return -1\n}\n\n/** The single most-specific nav route that matches the current path (longest wins).\n * Prevents a parent like `/courses` from staying active on `/courses/sales`. */\nfunction resolveActiveRoute(navigation: NavigationItem[], path: string): string | null {\n let best: string | null = null\n let bestScore = 0\n const consider = (route?: string) => {\n if (!route) return\n const score = routeMatchScore(route, path)\n if (score > bestScore) { bestScore = score; best = route }\n }\n for (const item of navigation) {\n consider(item.route)\n for (const child of item.children ?? []) consider(child.route)\n }\n return best\n}\n\nfunction NavGroup({\n item,\n collapsed,\n activeRoute,\n onNavigate,\n childConnector,\n flyout,\n}: {\n item: NavigationItem\n collapsed: boolean\n activeRoute: string | null\n onNavigate: (route: string) => void\n childConnector?: boolean\n flyout?: RailFlyoutHandle\n}) {\n const isChildActive = item.children?.some((c) => c.route === activeRoute)\n const [open, setOpen] = React.useState(() => isChildActive ?? false)\n const Icon = getIcon(item.icon)\n\n if (collapsed) {\n // The children are the whole point of pointing at a group in a 4rem rail:\n // clicking through to the parent to discover them is a round trip the\n // pointer already paid for.\n const hoverProps = flyout?.rowProps(flyoutContentOf(item))\n return (\n <button\n onClick={() => {\n flyout?.dismiss()\n onNavigate(item.route)\n }}\n data-tour={`nav.${item.route}`}\n className={cn(\n 'flex w-full items-center justify-center rounded-button px-2 py-2 text-sm font-medium transition-colors',\n 'hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',\n isChildActive ? 'bg-sidebar-accent text-sidebar-accent-foreground' : 'text-sidebar-muted'\n )}\n {...hoverProps}\n >\n <Icon className=\"h-4 w-4 shrink-0\" />\n </button>\n )\n }\n\n return (\n <div>\n {/* Metrics and resting colour are NavItem's, deliberately: a group header\n and a plain link are peers in the rail, and rendering the group in\n text-sidebar-muted read as \"disabled\" next to its own siblings. */}\n <button\n onClick={() => setOpen(!open)}\n className={cn(\n // Same metrics as NavItem — a group header and a plain link are peers\n // in the rail and must share a baseline.\n 'flex w-full items-center gap-3 rounded-button px-2.5 py-2 text-[13px] font-medium transition-colors',\n 'hover:bg-sidebar-accent/60 hover:text-sidebar-accent-foreground',\n isChildActive ? 'text-sidebar-accent-foreground' : 'text-sidebar-foreground/80'\n )}\n >\n <Icon className=\"h-4 w-4 shrink-0\" />\n <span className=\"flex-1 truncate text-left\">{item.label}</span>\n <ChevronDown className={cn('h-3.5 w-3.5 shrink-0 transition-transform', open && 'rotate-180')} />\n </button>\n {open && (\n <div className={cn(\n 'mt-0.5',\n // Connector mode has no per-child icon and no running rule: the line\n // is DRAWN, from the parent down to the active child and curving into\n // it. Extra left padding reserves the column that line lives in.\n //\n // No row gap (space-y-*) here: the line is assembled from one segment\n // per row, so any gap between rows shows up as a break in what has to\n // read as a single continuous stroke. Rows carry a fixed h-8 instead,\n // which is also what makes the elbow's y=16 land on their centre.\n //\n // The indent lives on the ROWS, not here: the connector is positioned\n // from this box's left edge, so padding it would push the line right\n // along with the labels and land the arrowhead on top of the text.\n childConnector ? 'relative' : 'ml-4 space-y-0.5 border-l border-sidebar-border/50 pl-3',\n )}>\n {item.children?.map((child, childIndex) => {\n const ChildIcon = getIcon(child.icon)\n const isActive = child.route === activeRoute\n const childExternal = !!child.href\n const childClass = cn(\n 'flex w-full items-center rounded-button text-sm transition-colors',\n // pl-11 clears the connector (whose arrowhead ends at ~24px) with\n // room to spare, so the children read as one clearly indented\n // column rather than crowding the line that points at them.\n childConnector ? 'h-8 gap-0 pl-11 pr-1' : 'gap-2.5 px-2 py-1.5',\n isActive\n ? 'font-medium text-sidebar-accent-foreground'\n : 'text-sidebar-foreground/70 hover:text-sidebar-accent-foreground'\n )\n const childInner = (\n <>\n {childConnector ? null : <ChildIcon className=\"mr-2.5 h-3.5 w-3.5 shrink-0\" />}\n <span className=\"flex-1 truncate text-left\">{child.label}</span>\n {childExternal && (\n <ExternalLink className=\"h-3 w-3 shrink-0 opacity-50\" aria-hidden />\n )}\n {child.premium && (\n <Crown className=\"h-3 w-3 shrink-0 text-amber-500\" aria-hidden />\n )}\n </>\n )\n const row = childExternal ? (\n <a href={child.href} target=\"_blank\" rel=\"noopener noreferrer\" className={childClass}>\n {childInner}\n </a>\n ) : (\n <button onClick={() => onNavigate(child.route)} className={childClass}>\n {childInner}\n </button>\n )\n\n if (!childConnector) return <React.Fragment key={child.id}>{row}</React.Fragment>\n\n // The line runs from the parent down to the active child and stops\n // there, curving in with an arrowhead. Children ABOVE the active one\n // carry the straight segment; the active one carries the elbow;\n // below it, nothing — a rule continuing past the destination would\n // be drawing a relationship that doesn't point anywhere.\n const activeIndex = item.children!.findIndex((c) => c.route === activeRoute)\n const onPath = activeIndex >= 0 && childIndex < activeIndex\n // The straight segment is butt-ended (no rounded cap) and spans the\n // row edge to edge, so consecutive rows join into one unbroken line.\n return (\n // The connector's colour is set HERE, on the wrapper, and BOTH\n // halves inherit it: the straight segments and the elbow are one\n // line, so a different opacity on either makes the stroke change\n // shade halfway down. Weight matches too — the span is 1.5px wide\n // and the path is stroke-width 1.5 on the same 13.75px centre.\n //\n // Set on the wrapper rather than inherited from the row: rows dim\n // to /70 when inactive, and a line fading along with the label it\n // points AT was nearly invisible on a dark rail.\n <div key={child.id} className=\"relative h-8 text-sidebar-foreground/45\">\n {onPath && (\n <span\n aria-hidden\n className=\"pointer-events-none absolute bottom-0 left-[13px] top-0 w-[1.5px] bg-current\"\n />\n )}\n {isActive && (\n <svg\n aria-hidden\n className=\"pointer-events-none absolute left-1 top-0\"\n width=\"21\" height=\"32\" viewBox=\"0 0 21 32\" fill=\"none\"\n >\n {/* Down the same 9.75px column the segments use, then a\n quarter-turn into the label's vertical centre (y=16 of\n the 32px row). */}\n <path d=\"M9.75 0 V11 Q9.75 16 14.75 16 H20\"\n stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" fill=\"none\" />\n <path d=\"M17 13 L20 16 L17 19\"\n stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" fill=\"none\" />\n </svg>\n )}\n {row}\n </div>\n )\n })}\n </div>\n )}\n </div>\n )\n}\n\n/**\n * Hand a sidebar slot the collapsed state — but only if it can receive it.\n *\n * The slots are `React.ReactNode`, so a host may pass a component OR a plain\n * `<button>`. Cloning a DOM element with `{ collapsed }` puts the prop on the\n * tag, and React warns: *Received `false` for a non-boolean attribute*. That is\n * exactly what the settings back-link did — a bare `<button>`, so the warning\n * appeared only inside Configurações and nowhere else.\n *\n * `typeof type === 'string'` is a DOM tag; anything else is a component, which\n * may or may not use the prop but will not leak it to the DOM by accident.\n */\nfunction withCollapsed(slot: React.ReactNode, collapsed: boolean): React.ReactNode {\n if (!React.isValidElement(slot)) return slot\n if (typeof slot.type === 'string') return slot\n return React.cloneElement(slot as React.ReactElement<any>, { collapsed })\n}\n\nexport function Sidebar({\n navigation,\n logo,\n collapsed,\n onToggle,\n onNavigate,\n currentPath: currentPathProp = '/',\n user: _user,\n orgSwitcher,\n topContent,\n identity,\n navTop,\n footerContent,\n borderless,\n userMenuSlot,\n notificationSlot,\n unreadCount = 0,\n searchLabel = 'Search',\n sectionLabels,\n navKey,\n navDirection = 'forward',\n navChildConnector,\n drawer,\n}: SidebarProps) {\n const currentPath = currentPathProp\n const setCommandPaletteOpen = useLayoutStore((s) => s.setCommandPaletteOpen)\n\n // Most-specific match wins, so sibling routes that share a prefix (e.g.\n // /courses vs /courses/sales) don't both light up.\n const activeRoute = resolveActiveRoute(navigation, currentPath)\n\n const railRef = React.useRef<HTMLElement | null>(null)\n const flyout = useRailFlyout({\n enabled: collapsed,\n railRef,\n activeRoute,\n onNavigate: (route) => onNavigate?.(route),\n })\n\n const mainItems = navigation.filter((item) => item.section === 'main')\n const secondaryItems = navigation.filter((item) => item.section === 'secondary')\n const settingsItems = navigation.filter((item) => item.section === 'settings')\n\n const handleNavigate = (route: string) => {\n onNavigate?.(route)\n }\n\n const sectionHeading = (label?: string) =>\n label && !collapsed ? (\n <p className=\"px-2.5 pb-0.5 pt-1 text-[10px] font-semibold uppercase tracking-wider text-sidebar-muted\">\n {label}\n </p>\n ) : null\n\n // Runs of consecutive items sharing a `group`, in first-appearance order. The\n // ungrouped run keeps `sectionLabels` as its heading, so a rail that declares\n // no groups renders byte-identically to before.\n const groupRuns = (items: NavigationItem[]): Array<{ group?: string; items: NavigationItem[] }> => {\n const runs: Array<{ group?: string; items: NavigationItem[] }> = []\n for (const item of items) {\n const last = runs[runs.length - 1]\n if (last && last.group === item.group) last.items.push(item)\n else runs.push({ group: item.group, items: [item] })\n }\n return runs\n }\n\n const renderSection = (items: NavigationItem[], label?: string) => {\n const runs = groupRuns(items)\n return runs.map((run, i) => (\n // 4px between rows, 20px between runs (a run being a `group` heading's\n // worth of entries — see NavigationItem.group).\n <div key={run.group ?? `ungrouped-${i}`} className={i === 0 ? 'space-y-1' : 'mt-5 space-y-1'}>\n {sectionHeading(run.group ?? label)}\n {run.items.map(renderItem)}\n </div>\n ))\n }\n\n const renderItem = (item: NavigationItem) =>\n item.children && item.children.length > 0 ? (\n <NavGroup key={item.id} item={item} collapsed={collapsed} activeRoute={activeRoute} onNavigate={handleNavigate} childConnector={navChildConnector} flyout={flyout} />\n ) : (\n <NavItem\n key={item.id}\n item={item}\n collapsed={collapsed}\n isActive={item.route === activeRoute}\n onNavigate={handleNavigate}\n flyout={flyout}\n />\n )\n\n // The swappable part of the rail (top slot + both nav sections). Kept as one\n // node so a context change can snapshot the outgoing rail and animate it out.\n const navBody = (\n <>\n {mainItems.length > 0 && renderSection(mainItems, sectionLabels?.main)}\n {secondaryItems.length > 0 && (\n <div className=\"mt-6\">{renderSection(secondaryItems, sectionLabels?.secondary)}</div>\n )}\n </>\n )\n\n // Rail push: when `navKey` changes, hold the previous rail on screen for one\n // animation cycle. `lastBodyRef` is refreshed after every render, so the\n // snapshot is the rail exactly as it looked before the swap (correct active\n // item included) rather than a stale one.\n const [outgoing, setOutgoing] = React.useState<{ body: React.ReactNode; direction: 'forward' | 'back' } | null>(null)\n const lastBodyRef = React.useRef<React.ReactNode>(null)\n const lastKeyRef = React.useRef(navKey)\n const timerRef = React.useRef<ReturnType<typeof setTimeout> | null>(null)\n\n useIsomorphicLayoutEffect(() => {\n if (lastKeyRef.current !== navKey) {\n const previousBody = lastBodyRef.current\n lastKeyRef.current = navKey\n if (previousBody) {\n setOutgoing({ body: previousBody, direction: navDirection })\n if (timerRef.current) clearTimeout(timerRef.current)\n timerRef.current = setTimeout(() => setOutgoing(null), RAIL_PUSH_MS)\n }\n }\n lastBodyRef.current = navBody\n })\n\n React.useEffect(() => () => { if (timerRef.current) clearTimeout(timerRef.current) }, [])\n\n return (\n // O handle do flyout desce por contexto para QUALQUER linha da trilha —\n // inclusive os widgets que os plugins montam no pé dela. Ver useRailRow.\n <RailFlyoutProvider value={flyout}>\n <aside\n ref={railRef}\n data-print=\"hide\"\n onBlur={(event) => {\n // Focus left the rail entirely (tabbing past it) — the panel goes with\n // it. Moving between rows / into the panel stays inside.\n if (!event.currentTarget.contains(event.relatedTarget as Node | null)) flyout.dismiss()\n }}\n className={cn(\n // `relative` anchors the flyout, which hangs off the rail's right edge\n // and has to escape the nav's own scroll box to do it.\n 'relative flex h-full flex-col bg-sidebar text-sidebar-foreground transition-all duration-200',\n !borderless && 'border-r border-sidebar-border',\n // 14rem expanded. It was 16rem, which is the width a rail needs when\n // its entries are sentences (\"GlossGenius Financing\", \"Configure your\n // payment methods\"); these are one or two words, so the extra 2rem was\n // paid for by the content column on every screen in every app. The\n // labels still truncate, and a long one now truncates 32px earlier —\n // which is the trade, taken deliberately.\n collapsed ? 'w-16' : 'w-56'\n )}\n >\n {/* Identity block — quem é o produto, e em qual conta você está.\n\n Uma linha só, quando não há conta a nomear: aí o `topContent` (ou o\n `logo`) fica no h-14, que é a altura do cabeçalho da página e da\n cabeça do painel do assistente — as três correm na mesma linha em vez\n de escadinha.\n\n Com conta, duas: a marca vira uma tira estreita em cima e a conta fica\n com uma linha inteira embaixo. Lado a lado só cabia \"Artorius S…\" — em\n ~200px, marca, avatar e nome disputam, e o nome é justamente o único\n dos três que o usuário não sabe de cor. Custa ~40px de cromo, pagos\n uma vez no topo; a alternativa é truncar a informação que muda.\n\n The collapse toggle moved to the footer — see the utility row at the\n bottom. It is chrome, and it was sitting inside the one row that has\n to say where you are. */}\n <div className={cn('shrink-0', !borderless && 'border-b border-sidebar-border')}>\n <div\n className={cn(\n 'flex items-center gap-1 px-2',\n // h-12 com a conta embaixo (48 + 44 + 8 = 100px, na régua de 4/8),\n // h-14 quando a marca é a única coisa aqui e a linha tem de bater\n // com o cabeçalho da página.\n identity ? 'h-12' : 'h-14',\n collapsed && 'justify-center',\n )}\n >\n {topContent ? (\n <div className={cn('min-w-0', collapsed ? 'flex justify-center' : 'flex-1')}>\n {withCollapsed(topContent, collapsed)}\n </div>\n ) : (\n !collapsed && (\n <div className=\"min-w-0 flex-1 px-1.5\">{logo ?? <span className=\"text-lg font-bold\">App</span>}</div>\n )\n )}\n {drawer && (\n <button\n onClick={onToggle}\n className=\"fz-tap shrink-0 rounded-button p-1.5 text-sidebar-muted transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground\"\n aria-label=\"Close menu\"\n >\n <X className=\"h-4 w-4\" />\n </button>\n )}\n </div>\n {identity && (\n <div className={cn('px-2 pb-2', collapsed && 'flex justify-center')}>\n {withCollapsed(identity, collapsed)}\n </div>\n )}\n </div>\n\n {/* O bloco fixo entre o cabeçalho e a lista. Dentro de um contexto\n (Configurações, um módulo que tomou o rail) ele é a saída; fora dele,\n a busca. Um de cada vez, no mesmo lugar: são as duas coisas que valem\n antes do primeiro destino, e empilhá-las afastava a lista do topo para\n hospedar uma promessa de saída que o contexto já faz. */}\n {navTop ? (\n <div className=\"px-2 pb-2 pt-2\">{withCollapsed(navTop, collapsed)}</div>\n ) : (\n /* Search — above the first destination. It used to be a 16px magnifier\n tucked beside the avatar at the very bottom, which is where you put\n something nobody is meant to find: the fastest way through an admin\n with thirty screens was the one control shaped like an afterthought.\n Here it reads as what it is — a field — and says which key opens it.\n Clicking it opens the same palette ⌘K does; it is a button, not an\n input, because typing happens there. */\n <div className=\"px-2 pb-2 pt-2\">\n <button\n onClick={() => setCommandPaletteOpen(true)}\n aria-keyshortcuts=\"Meta+K Control+K\"\n className={cn(\n // Tonal surface, no outline. On a dark rail a 1px border is a hard\n // edge competing with every other hard edge; a lighter fill of the\n // same hue reads as \"a field\" without drawing a box around it — and\n // leaves the outline treatment free to mean focus, which it must.\n 'fz-tap group flex items-center rounded-lg bg-sidebar-accent/40 text-sidebar-muted transition-colors',\n 'hover:bg-sidebar-accent/70 hover:text-sidebar-foreground',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sidebar-accent-foreground/50',\n collapsed ? 'h-9 w-9 justify-center' : 'h-9 w-full gap-2.5 px-2.5',\n )}\n aria-label={searchLabel}\n title={collapsed ? searchLabel : undefined}\n >\n <Search className=\"h-4 w-4 shrink-0\" />\n {!collapsed && (\n <>\n <span className=\"flex-1 truncate text-left text-[13px]\">{searchLabel}</span>\n {/* The shortcut is a hint, not a control: no chip, no border, and\n it steps aside on hover rather than sitting there as chrome. */}\n <span className=\"shrink-0 text-[11px] font-medium tabular-nums text-sidebar-muted/60 transition-opacity group-hover:opacity-100 md:opacity-70\">\n {shortcutKey()}K\n </span>\n </>\n )}\n </button>\n </div>\n )}\n\n {/* Main Navigation. During a rail swap the outgoing nav is pinned on\n top of the incoming one so the two cross-slide; overflow is clipped\n for the duration so neither pane can scroll the rail sideways. */}\n <nav\n className={cn(\n 'relative flex-1 p-2',\n // scrollbar-none: the rail still scrolls, but without the native\n // scrollbar gutter eating into the nav items.\n outgoing ? 'overflow-hidden' : 'overflow-y-auto scrollbar-none',\n )}\n >\n {outgoing && (\n <div\n aria-hidden\n className={cn(\n 'pointer-events-none absolute inset-x-2 top-2 space-y-1',\n outgoing.direction === 'back' ? 'saas-rail-out-back' : 'saas-rail-out-forward',\n )}\n >\n {outgoing.body}\n </div>\n )}\n <div\n key={navKey}\n className={cn(\n 'space-y-1',\n outgoing && (outgoing.direction === 'back' ? 'saas-rail-in-back' : 'saas-rail-in-forward'),\n )}\n >\n {navBody}\n </div>\n </nav>\n\n {/* Settings nav items */}\n {settingsItems.length > 0 && (\n <div className={cn('p-2 space-y-1', !borderless && 'border-t border-sidebar-border')}>\n {settingsItems.map((item) => (\n <NavItem\n key={item.id}\n item={item}\n collapsed={collapsed}\n isActive={item.route === activeRoute}\n onNavigate={handleNavigate}\n flyout={flyout}\n />\n ))}\n </div>\n )}\n\n {footerContent && (\n // `empty:hidden` — slot children may all render null (e.g. the\n // SeuSiteWidget self-hides when the tenant has no project); without\n // it the padded/bordered wrapper shows as a blank block.\n <div className={cn('space-y-2 p-2 empty:hidden', !borderless && 'border-t border-sidebar-border')}>\n {footerContent}\n </div>\n )}\n\n {/* Org Switcher — above user row */}\n {withCollapsed(orgSwitcher, collapsed)}\n\n {/* Bottom: User row with inline action icons */}\n {/* Sits ON the bottom edge. It used to reserve the tab bar's 64px, which\n was wrong twice over: the drawer is drawn ABOVE the bar and covers it\n across its own width, so the reservation bought nothing and left a\n band of empty drawer under the last row. Only the home indicator is\n real here, and env() is 0 wherever there is none. */}\n <div\n // No horizontal padding: the org switcher above renders bare, so its\n // own px-1.5 is the whole inset. Matching it here is what puts the two\n // avatars on one vertical line. `pr-2` keeps the bell off the edge.\n className={cn('py-2 pr-2', !borderless && 'border-t border-sidebar-border')}\n style={drawer ? { paddingBottom: 'calc(0.5rem + env(safe-area-inset-bottom))' } : undefined}\n >\n <div className={cn(\n 'flex items-center rounded-button',\n collapsed ? 'flex-col gap-1' : 'gap-1'\n )}>\n {/* User Menu slot */}\n {userMenuSlot}\n\n {/* Spacer pushes icons to right when expanded */}\n {!collapsed && <div className=\"flex-1\" />}\n\n {/* Notification slot or default bell */}\n {notificationSlot ?? (\n <button\n className=\"fz-tap relative inline-flex shrink-0 items-center justify-center rounded-button p-2 text-sidebar-muted transition-colors hover:bg-sidebar-accent/50 hover:text-sidebar-accent-foreground\"\n aria-label={unreadCount > 0 ? `${unreadCount} unread notifications` : 'Notifications'}\n >\n <Bell className=\"h-4 w-4\" />\n {unreadCount > 0 && (\n <span className=\"absolute right-1 top-1 h-2 w-2 rounded-full bg-destructive\" />\n )}\n </button>\n )}\n\n {/* Collapse — down here with the other utilities rather than in the\n identity row it used to share with the workspace name. Width is\n the rail's own setting, not something you say about the workspace\n you are in, and this is the corner every rail keeps it in. */}\n {!drawer && (\n <button\n onClick={onToggle}\n className=\"fz-tap inline-flex shrink-0 items-center justify-center rounded-button p-2 text-sidebar-muted transition-colors hover:bg-sidebar-accent/50 hover:text-sidebar-accent-foreground\"\n aria-label={collapsed ? 'Expand sidebar' : 'Collapse sidebar'}\n title={collapsed ? 'Expand sidebar' : 'Collapse sidebar'}\n >\n {collapsed ? <PanelLeft className=\"h-4 w-4\" /> : <PanelLeftClose className=\"h-4 w-4\" />}\n </button>\n )}\n </div>\n </div>\n\n {/* The rail's one flyout — anchored to whichever row is being pointed\n at, so it slides between them instead of blinking per row. */}\n {flyout.panel}\n </aside>\n </RailFlyoutProvider>\n )\n}\n","import * as React from 'react'\nimport * as Popover from '@radix-ui/react-popover'\nimport {\n Menu,\n Search,\n ChevronDown,\n Home,\n Settings,\n CreditCard,\n UserCog,\n Crown,\n Sparkles,\n LogOut,\n type LucideIcon,\n} from 'lucide-react'\nimport { ICON_MAP } from '../icons'\nimport { cn } from '../lib/cn'\nimport { useLayoutStore } from '../stores/layout.store'\n\nexport interface NavigationItem {\n id: string\n label: string\n icon: string\n route: string\n section: 'main' | 'secondary' | 'settings'\n /** Heading this item sits under within its section. Honoured by the sidebar\n * rail; the topbar has no headings and ignores it. */\n group?: string\n badge?: string | number\n children?: NavigationItem[]\n permission?: { feature: string; action: 'read' | 'create' | 'edit' | 'delete' }\n /** Freemium discovery: role-allowed but not entitled by the current plan.\n * Renders a small Crown badge; clicking leads to the plan's UpgradePrompt. */\n premium?: boolean\n}\n\nexport interface TopbarProps {\n navigation: NavigationItem[]\n logo?: React.ReactNode\n user?: { fullName: string; avatarUrl?: string; email: string }\n onMenuClick?: () => void\n /** Hide the chrome row on phones. Set when a bottom bar carries navigation:\n * what is left of this row on a phone is a logo the user cannot act on and\n * icons that the navigation sheet already offers, so it is 56px of nothing. */\n hideMobileChrome?: boolean\n /** Workspace/org switcher rendered with the right-side actions (desktop). */\n orgSwitcher?: React.ReactNode\n leftContent?: React.ReactNode\n rightContent?: React.ReactNode\n currentPath?: string\n onNavigate?: (route: string) => void\n searchPlaceholder?: string\n onSignOut?: () => void\n onProfile?: () => void\n onSettings?: () => void\n onBilling?: () => void\n /** Current-plan pill shown next to the user in the dropdown header. */\n userPlan?: { label: string; paid: boolean }\n /** i18n label for the billing/subscription menu item (host owns translation). */\n billingLabel?: string\n userMenuExtras?: { label: string; icon?: React.ReactNode; onClick: () => void }[]\n /**\n * O menu do usuário, quando o host desenha o dele — o MESMO que o rail\n * recebe. Sem isto, cada layout tinha o seu: o de topbar nasceu sem seletor\n * de tema nem de idioma e com \"Perfil\"/\"Sair\" escritos em português no\n * código, então trocar o produto de layout trocava o que o menu oferece.\n */\n userMenuSlot?: React.ReactNode\n}\n\nfunction TopbarUserMenu({\n user,\n userPlan,\n billingLabel = 'Subscription',\n onSignOut,\n onProfile,\n onSettings,\n onBilling,\n userMenuExtras,\n}: Pick<TopbarProps, 'user' | 'userPlan' | 'billingLabel' | 'onSignOut' | 'onProfile' | 'onSettings' | 'onBilling' | 'userMenuExtras'>) {\n const [open, setOpen] = React.useState(false)\n if (!user) return null\n const initial = (user.fullName?.trim()?.[0] ?? user.email?.[0] ?? '?').toUpperCase()\n const item = (label: string, onClick?: () => void, Icon?: LucideIcon) =>\n onClick ? (\n <button\n key={label}\n onClick={() => { setOpen(false); onClick() }}\n className=\"flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-sm text-popover-foreground transition-colors hover:bg-muted/70\"\n >\n {Icon && <Icon className=\"h-4 w-4 text-muted-foreground\" />}\n <span>{label}</span>\n </button>\n ) : null\n return (\n <Popover.Root open={open} onOpenChange={setOpen}>\n <Popover.Trigger asChild>\n <button\n aria-label=\"User menu\"\n className=\"ml-1 flex h-9 w-9 items-center justify-center overflow-hidden rounded-full bg-primary text-xs font-semibold text-primary-foreground ring-2 ring-transparent transition hover:ring-sidebar-border\"\n >\n {user.avatarUrl ? (\n // eslint-disable-next-line @next/next/no-img-element\n <img src={user.avatarUrl} alt=\"\" className=\"h-full w-full object-cover\" />\n ) : (\n initial\n )}\n </button>\n </Popover.Trigger>\n <Popover.Portal>\n <Popover.Content\n align=\"end\"\n sideOffset={8}\n className=\"fayz-glass-surface z-50 min-w-[220px] rounded-xl border border-border bg-popover p-1.5 shadow-lg animate-in fade-in-0 zoom-in-95\"\n >\n <div className=\"border-b border-border px-3 py-2\">\n <p className=\"truncate text-sm font-medium text-foreground\">{user.fullName || user.email}</p>\n <p className=\"truncate text-xs text-muted-foreground\">{user.email}</p>\n </div>\n <div className=\"mt-1 space-y-0.5\">\n {item('Perfil', onProfile, UserCog)}\n {item('Configurações', onSettings, Settings)}\n {onBilling && (\n <button\n key=\"billing\"\n onClick={() => { setOpen(false); onBilling() }}\n className=\"flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-sm text-popover-foreground transition-colors hover:bg-muted/70\"\n >\n <CreditCard className=\"h-4 w-4 text-muted-foreground\" />\n <span className=\"flex-1 text-left\">{billingLabel}</span>\n {userPlan && (\n <span\n className={\n userPlan.paid\n ? 'inline-flex items-center gap-1 rounded-full border border-amber-400/40 bg-amber-400/15 px-2 py-0.5 text-[10px] font-semibold text-amber-600 dark:text-amber-300'\n : 'inline-flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground'\n }\n >\n {userPlan.paid ? <Crown className=\"h-3 w-3\" /> : <Sparkles className=\"h-3 w-3\" />}\n {userPlan.label}\n </span>\n )}\n </button>\n )}\n {userMenuExtras?.map((e) => item(e.label, e.onClick))}\n {onSignOut && (\n <>\n <div className=\"my-1 border-t border-border\" />\n {item('Sair', onSignOut, LogOut)}\n </>\n )}\n </div>\n </Popover.Content>\n </Popover.Portal>\n </Popover.Root>\n )\n}\n\n// Um mapa só. A barra do topo mantinha o seu, menor: um nome que existia apenas\n// no registro central (User, Palette, ShieldCheck) desenhava ícone num lugar e\n// nenhum no outro — as linhas de Configurações apareciam sem ícone.\nexport { ICON_MAP }\n\nfunction getIcon(name: string): LucideIcon {\n return ICON_MAP[name] ?? Home\n}\n\nfunction NavDropdown({ item, currentPath, onNavigate }: {\n item: NavigationItem\n currentPath: string\n onNavigate: (route: string) => void\n}) {\n const [open, setOpen] = React.useState(false)\n const Icon = getIcon(item.icon)\n const isChildActive = item.children?.some(\n (child) => currentPath === child.route || currentPath.startsWith(child.route + '/')\n )\n\n return (\n <Popover.Root open={open} onOpenChange={setOpen}>\n <Popover.Trigger asChild>\n <button\n data-nav-active={isChildActive || undefined}\n className={cn(\n 'flex items-center gap-1.5 whitespace-nowrap border-b-2 px-3 py-2 text-sm transition-colors',\n isChildActive\n ? 'border-sidebar-accent-foreground font-semibold text-sidebar-foreground'\n : 'border-transparent text-sidebar-muted hover:text-sidebar-foreground'\n )}\n >\n <Icon className=\"h-4 w-4\" />\n <span>{item.label}</span>\n <ChevronDown className={cn('h-3 w-3 transition-transform', open && 'rotate-180')} />\n </button>\n </Popover.Trigger>\n <Popover.Portal>\n <Popover.Content\n align=\"start\"\n sideOffset={4}\n className=\"fayz-glass-surface z-50 min-w-[200px] rounded-xl border border-border bg-popover p-1.5 shadow-lg animate-in fade-in-0 zoom-in-95\"\n >\n {item.children?.map((child) => {\n const ChildIcon = getIcon(child.icon)\n const isActive = currentPath === child.route || currentPath.startsWith(child.route + '/')\n return (\n <button\n key={child.id}\n onClick={() => {\n onNavigate(child.route)\n setOpen(false)\n }}\n className={cn(\n 'flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-sm transition-colors',\n isActive\n ? 'bg-muted font-medium text-foreground'\n : 'text-popover-foreground hover:bg-muted/70'\n )}\n >\n <ChildIcon className=\"h-4 w-4 text-muted-foreground\" />\n <span>{child.label}</span>\n </button>\n )\n })}\n </Popover.Content>\n </Popover.Portal>\n </Popover.Root>\n )\n}\n\nexport function Topbar({\n navigation,\n logo,\n user,\n onMenuClick,\n hideMobileChrome,\n orgSwitcher,\n leftContent,\n rightContent,\n currentPath = '/',\n onNavigate,\n searchPlaceholder = 'Search...',\n onSignOut,\n onProfile,\n onSettings,\n onBilling,\n userPlan,\n billingLabel,\n userMenuExtras,\n userMenuSlot,\n}: TopbarProps) {\n const setCommandPaletteOpen = useLayoutStore((s) => s.setCommandPaletteOpen)\n\n const mainNav = navigation.filter((item) => item.section === 'main')\n const secondaryNav = navigation.filter((item) => item.section === 'secondary')\n const allNav = [...mainNav, ...secondaryNav]\n\n const handleNavigate = (route: string) => {\n onNavigate?.(route)\n }\n\n return (\n <header data-print=\"hide\" className=\"sticky top-0 z-50 w-full shrink-0\">\n {/* Row 1: Logo + Search + Actions */}\n <div className={cn('border-b border-sidebar-border bg-sidebar text-sidebar-foreground', hideMobileChrome && 'hidden md:block')}>\n <div className=\"flex h-14 w-full items-center justify-between px-4 md:px-6\">\n {/* Left: Mobile menu + workspace (ou o logo) — the hamburger is only\n rendered when an onMenuClick handler is supplied. Mobile-first apps\n with a bottom nav omit it so the bottom bar is the primary\n navigation.\n\n O canto esquerdo é o lugar de \"onde eu estou\": o seletor de\n workspace quando existe (o shell manda a marca do produto dentro\n dele, como ícone), senão o logo. O wordmark sozinho não respondia a\n pergunta — ele é o mesmo em toda conta. */}\n <div className=\"flex min-w-0 items-center gap-3\">\n {onMenuClick && (\n <button\n onClick={onMenuClick}\n className=\"inline-flex items-center justify-center rounded-md p-2 text-sidebar-foreground/70 hover:bg-sidebar/30 hover:text-sidebar-foreground md:hidden\"\n aria-label=\"Open menu\"\n >\n <Menu className=\"h-5 w-5\" />\n </button>\n )}\n <div className=\"hidden min-w-0 shrink-0 items-center md:flex\">\n {orgSwitcher ?? logo ?? <span className=\"text-lg font-bold\">App</span>}\n </div>\n </div>\n\n {/* Center: Search (desktop only) */}\n <div className=\"mx-8 hidden max-w-sm flex-1 md:flex\">\n <button\n onClick={() => setCommandPaletteOpen(true)}\n className=\"relative flex h-8 w-full items-center rounded-md border border-sidebar-border bg-sidebar-accent px-3 pl-8 text-sm text-sidebar-muted shadow-sm transition-colors hover:border-sidebar-foreground/25 hover:bg-sidebar-foreground/10 hover:text-sidebar-foreground\"\n >\n <Search className=\"absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-sidebar-muted\" />\n <span className=\"text-xs\">{searchPlaceholder}</span>\n <kbd className=\"ml-auto hidden rounded border border-sidebar-border bg-sidebar-accent px-1.5 py-0.5 text-[10px] font-medium text-sidebar-muted sm:inline-block\">\n ⌘K\n </kbd>\n </button>\n </div>\n\n {/* Right: Actions — tarefas, avisos e conta. */}\n <div className=\"flex min-w-0 items-center gap-1\">\n {leftContent}\n {rightContent}\n {/* O menu do host quando existe — é o mesmo objeto do rail, com\n tema e idioma dentro. O daqui é o fallback para quem monta a\n Topbar sem shell. */}\n {userMenuSlot ?? (\n <TopbarUserMenu\n user={user}\n userPlan={userPlan}\n billingLabel={billingLabel}\n onSignOut={onSignOut}\n onProfile={onProfile}\n onSettings={onSettings}\n onBilling={onBilling}\n userMenuExtras={userMenuExtras}\n />\n )}\n </div>\n </div>\n </div>\n\n {/* Row 2: Navigation — desktop only */}\n <div className=\"hidden md:block bg-sidebar\">\n <div className=\"flex h-11 w-full items-center px-4 md:px-6\">\n <nav ref={(el) => {\n if (!el) return\n const active = el.querySelector('[data-nav-active=\"true\"]') as HTMLElement\n if (active) {\n const left = active.offsetLeft - el.offsetWidth / 2 + active.offsetWidth / 2\n el.scrollTo({ left: Math.max(0, left), behavior: 'smooth' })\n }\n }} className=\"flex items-center gap-0.5 overflow-x-auto scrollbar-none\">\n {allNav.map((item) => {\n if (item.children && item.children.length > 0) {\n return (\n <NavDropdown\n key={item.id}\n item={item}\n currentPath={currentPath}\n onNavigate={handleNavigate}\n />\n )\n }\n\n const Icon = getIcon(item.icon)\n const isActive =\n item.route === '/'\n ? currentPath === '/'\n : currentPath === item.route || currentPath.startsWith(item.route + '/')\n\n return (\n <button\n key={item.id}\n data-nav-active={isActive || undefined}\n onClick={() => handleNavigate(item.route)}\n className={cn(\n 'flex items-center gap-1.5 whitespace-nowrap border-b-2 px-3 py-2 text-sm transition-colors',\n isActive\n ? 'border-primary font-semibold text-sidebar-foreground'\n : 'border-transparent text-sidebar-muted hover:text-sidebar-foreground'\n )}\n >\n <Icon className=\"h-4 w-4\" />\n <span>{item.label}</span>\n {item.premium && (\n <Crown className=\"h-3 w-3 text-amber-500\" aria-hidden />\n )}\n {item.badge !== undefined && (\n <span className=\"rounded-full bg-primary px-1.5 py-0.5 text-[10px] font-semibold text-primary-foreground\">\n {item.badge}\n </span>\n )}\n </button>\n )\n })}\n </nav>\n </div>\n </div>\n </header>\n )\n}\n","import * as React from 'react'\nimport {\n Menu,\n Home,\n Receipt,\n ArrowLeftRight,\n Calendar,\n CreditCard,\n Settings,\n MessageCircle,\n Wallet,\n PiggyBank,\n Plus,\n Sparkles,\n ArrowLeft,\n type LucideIcon,\n} from 'lucide-react'\nimport { Sidebar, type NavigationItem, type SidebarUser, type SidebarProps } from './Sidebar'\nimport { Topbar } from './Topbar'\nimport { SaveBar, SaveBarProvider } from './SaveBar'\nimport { useLayoutStore } from '../stores/layout.store'\nimport { usePageHeaderClaimed, usePageTitleSlotHost, usePageHeaderHost, useHasPageHeaderOutlet, useHasPageActions, useHasPageHeaderBack } from '../stores/page-header.store'\nimport { PageHeaderCrumb } from '../primitives/page-header'\nimport { cn } from '../lib/cn'\nimport { ICON_MAP } from '../icons'\n\n// ---------------------------------------------------------------------------\n// Module header slot — the page top-bar exposes a DOM node that module pages\n// (ModulePage 'tabs' variant) portal their title + sub-nav into, so the module\n// header lives in the shell's top-of-page container (GoHighLevel style).\n// ---------------------------------------------------------------------------\n\nconst ModuleHeaderSlotContext = React.createContext<HTMLElement | null>(null)\n\nexport function useModuleHeaderSlot(): HTMLElement | null {\n return React.useContext(ModuleHeaderSlotContext)\n}\n\n// Right-aligned slot for a page's primary action buttons (e.g. \"New campaign\").\nconst ModuleHeaderActionsSlotContext = React.createContext<HTMLElement | null>(null)\n\nexport function useModuleHeaderActionsSlot(): HTMLElement | null {\n return React.useContext(ModuleHeaderActionsSlotContext)\n}\n\n// ---------------------------------------------------------------------------\n// A coluna de menu que ALGUMAS páginas trazem (as seções de um módulo, os links\n// de Configurações). Ela é entregue à shell em vez de desenhada no corpo, e a\n// shell a põe ANTES da barra de página: assim o menu encosta no topo do quadro\n// e a barra começa onde o conteúdo começa, em vez de atravessar por cima dos\n// dois e empurrar o menu para baixo do seu próprio título.\n// ---------------------------------------------------------------------------\nconst PageRailSlotContext = React.createContext<HTMLElement | null>(null)\n\nexport function usePageRailSlot(): HTMLElement | null {\n return React.useContext(PageRailSlotContext)\n}\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport interface AppShellUser {\n fullName: string\n avatarUrl?: string\n email: string\n}\n\n// ---------------------------------------------------------------------------\n// Bottom-nav item model\n//\n// Four kinds share the mobile tab bar:\n// - route (default): a normal tab that navigates to `route`.\n// - action: a NON-route item rendered as a raised, elevated circular center\n// button (Mobills style). It fires `onBottomNavAction(id)` instead of\n// navigating — e.g. a global quick-add \"+\".\n// - more: opens the full navigation drawer. The shell owns this one, because\n// five slots can never hold a whole product: without it, every destination\n// outside the bar is unreachable on a phone.\n// - assistant: toggles the assistant rail. Also shell-owned — the corner FAB\n// stands down when a bar is present, so without this tab the assistant has\n// no entry point at all on mobile.\n// ---------------------------------------------------------------------------\n\nexport interface BottomNavRouteItem {\n kind?: 'route'\n label: string\n icon: string\n route: string\n}\n\nexport interface BottomNavActionItem {\n kind: 'action'\n /** Identifier passed to onBottomNavAction. */\n id: string\n icon: string\n /** Optional accessible label. */\n label?: string\n}\n\nexport interface BottomNavMoreItem {\n kind: 'more'\n label?: string\n icon?: string\n}\n\nexport interface BottomNavAssistantItem {\n kind: 'assistant'\n label?: string\n icon?: string\n}\n\nexport type BottomNavItem =\n | BottomNavRouteItem\n | BottomNavActionItem\n | BottomNavMoreItem\n | BottomNavAssistantItem\n\n/** True when the bar itself can reach the full navigation, which is what lets\n * the shell retire the hamburger without stranding a destination. */\nexport function bottomNavReachesAll(items?: BottomNavItem[]): boolean {\n return !!items?.some((i) => 'kind' in i && i.kind === 'more')\n}\n\n/** Mobile header treatment (small screens, <md). Desktop is unaffected.\n * - 'minimal' : a small top header bar (the default / today's behavior).\n * - 'transparent' : NO header bar; content is edge-to-edge with a floating\n * profile avatar pinned top-right (calls onProfile).\n * - 'hidden' : no header bar and no floating avatar. */\nexport type MobileHeaderVariant = 'transparent' | 'minimal' | 'hidden'\n\nexport interface AppShellProps {\n /** Layout variant */\n variant: 'sidebar' | 'topbar' | 'minimal'\n /** Wrap the main content in an inset framed card. The sidebar is always\n * flush/full-height (GoHighLevel style). */\n contentFrame?: boolean\n navigation?: NavigationItem[]\n logo?: React.ReactNode\n user?: AppShellUser\n children?: React.ReactNode\n onNavigate?: (route: string) => void\n onSignOut?: () => void\n onProfile?: () => void\n onSettings?: () => void\n onBilling?: () => void\n /** Current-plan pill shown next to the user in the topbar menu. */\n userPlan?: { label: string; paid: boolean }\n /** i18n label for the billing/subscription user-menu item. */\n billingLabel?: string\n pageTitle?: string\n /**\n * Seta de voltar da barra, quando a ROTA declara um pai. É o caminho sem\n * código de página: `parentRoute` no manifesto e pronto. Uma página que\n * reivindica o slot (PageHeader) ganha desta — o cabeçalho dela sabe mais,\n * porque tem o dado carregado.\n */\n pageBack?: { onBack: () => void; label?: string }\n currentPath?: string\n userMenuExtras?: { label: string; icon?: React.ReactNode; onClick: () => void }[]\n orgSwitcher?: React.ReactNode\n topbarStart?: React.ReactNode\n topbarEnd?: React.ReactNode\n sidebarTopContent?: React.ReactNode\n /** A conta atual, na linha logo abaixo do cabeçalho do rail. Ver `identity`\n * em Sidebar: no layout de topbar o equivalente vai em `orgSwitcher`. */\n sidebarIdentity?: React.ReactNode\n sidebarNavTop?: React.ReactNode\n sidebarFooterContent?: React.ReactNode\n bottomNav?: BottomNavItem[]\n /** Fired when a bottom-nav `action` item (e.g. the center \"+\") is tapped. */\n onBottomNavAction?: (id: string) => void\n /** Fired by the bottom bar's `assistant` tab. */\n onAssistantToggle?: () => void\n /** Drives the `assistant` tab's active state. */\n assistantOpen?: boolean\n /** Mobile header treatment (<md). Default: 'minimal'. Desktop unaffected. */\n mobileHeader?: MobileHeaderVariant\n /** O menu do usuário. No rail é a última linha da coluna; na topbar é o\n * avatar da direita. Um nó para os dois, para que trocar o layout do produto\n * não troque o que o menu oferece. */\n userMenuSlot?: React.ReactNode\n /** Row-shaped user menu for the mobile drawer. The topbar layout's own\n * `userMenuSlot` is an avatar built for the corner of a bar; the drawer needs\n * the same menu as a full-width row. Without it the drawer falls back to a\n * display-only row, which was invisible while the chrome row still carried\n * the real one and became the only — dead — user menu once it did not. */\n drawerUserMenuSlot?: React.ReactNode\n /** Rendered in sidebar bottom notification slot */\n notificationSlot?: React.ReactNode\n /** Unread notification count */\n unreadCount?: number\n /** Placeholder on the rail's search field. Translated by the shell. */\n searchLabel?: string\n /** Optional headings above the sidebar nav sections (contextual sidebars). */\n sidebarSectionLabels?: { main?: string; secondary?: string; settings?: string }\n /** Identity of the current sidebar context — changing it animates the rail\n * swap as a push (new nav in, previous nav out). */\n sidebarNavKey?: string\n /** Push direction for a `sidebarNavKey` change. Default 'forward'. */\n sidebarNavDirection?: 'forward' | 'back'\n /** Render nav-group children as bare labels with an elbow marking the active\n * one, instead of an icon each. See Sidebar's `navChildConnector`. */\n sidebarNavChildConnector?: boolean\n /**\n * Full-height column pinned to the right (the assistant dock, a tasks\n * panel). Rendered as a flex SIBLING of the layout, so the app narrows to\n * make room instead of being covered — the difference between a split view\n * and a modal that happens to be tall.\n *\n * Falsy renders nothing and costs nothing: no wrapper, no divider, the\n * layout element stands alone exactly as before.\n */\n rightRail?: React.ReactNode\n /** Whether the rail is showing. Separate from `rightRail` so the column can\n * animate its width instead of snapping when it closes. */\n rightRailOpen?: boolean\n /** Starting width in px. Ignored once the user drags. Default 380. */\n defaultRightRailWidth?: number\n /** Fired after every drag so the host can persist the preference. */\n onRightRailWidthChange?: (width: number) => void\n /** Drag bounds in px. Defaults 300 / 720. */\n rightRailMinWidth?: number\n rightRailMaxWidth?: number\n /** Accessible name for the drag handle. */\n rightRailResizeLabel?: string\n}\n\n// ---------------------------------------------------------------------------\n// ShellPageTitle — o que a barra mostra quando NENHUMA página reivindicou o\n// slot: o título da rota/menu e, se a rota declarou um pai, o caminho de volta.\n//\n// Reusa o traço de `PageHeaderCrumb`, o mesmo que o componente `PageHeader`\n// usa. A seta tem que ser a MESMA seta, venha ela do manifesto ou da própria\n// página — dois desenhos foi exatamente o que este trabalho veio desfazer.\n// ---------------------------------------------------------------------------\n\nfunction ShellPageTitle({\n title,\n back,\n}: {\n title?: string\n back?: AppShellProps['pageBack']\n}) {\n if (!title && !back) return null\n return <PageHeaderCrumb title={title} parentLabel={back?.label} onBack={back?.onBack} headingLevel=\"h1\" />\n}\n\n// ---------------------------------------------------------------------------\n// Sidebar layout\n// ---------------------------------------------------------------------------\n\nfunction SidebarLayout({\n navigation = [],\n logo,\n user,\n children,\n onNavigate,\n onSignOut,\n onProfile,\n onSettings,\n onBilling,\n userMenuExtras: _userMenuExtras,\n orgSwitcher,\n sidebarTopContent,\n sidebarIdentity,\n sidebarNavTop,\n sidebarFooterContent,\n frame,\n currentPath,\n pageTitle,\n pageBack,\n topbarStart,\n topbarEnd,\n userMenuSlot,\n notificationSlot,\n unreadCount = 0,\n searchLabel,\n hasBottomNav = false,\n barOwnsNav = false,\n mobileHeader = 'minimal',\n sidebarSectionLabels,\n sidebarNavKey,\n sidebarNavDirection,\n sidebarNavChildConnector,\n railOpen,\n}: {\n navigation?: NavigationItem[]\n logo?: React.ReactNode\n user?: AppShellUser\n children?: React.ReactNode\n onNavigate?: (route: string) => void\n onSignOut?: () => void\n onProfile?: () => void\n onSettings?: () => void\n onBilling?: () => void\n userMenuExtras?: AppShellProps['userMenuExtras']\n orgSwitcher?: React.ReactNode\n sidebarTopContent?: React.ReactNode\n sidebarIdentity?: React.ReactNode\n sidebarNavTop?: React.ReactNode\n sidebarFooterContent?: React.ReactNode\n frame?: boolean\n currentPath?: string\n pageTitle?: string\n pageBack?: AppShellProps['pageBack']\n topbarStart?: React.ReactNode\n topbarEnd?: React.ReactNode\n userMenuSlot?: React.ReactNode\n notificationSlot?: React.ReactNode\n unreadCount?: number\n /** Placeholder on the rail's search field. Translated by the shell. */\n searchLabel?: string\n /** When a mobile bottom-nav bar is present, the mobile hamburger is\n * suppressed so the bottom nav is the primary mobile navigation. */\n hasBottomNav?: boolean\n /** The bar carries a \"Mais\" tab, so the hamburger is redundant. */\n barOwnsNav?: boolean\n /** Mobile header treatment (<md). Desktop keeps its top bar untouched. */\n mobileHeader?: MobileHeaderVariant\n sidebarSectionLabels?: AppShellProps['sidebarSectionLabels']\n sidebarNavKey?: string\n sidebarNavDirection?: 'forward' | 'back'\n sidebarNavChildConnector?: boolean\n /** A companion rail is open to the right of the content. The content card\n * then opens its right edge so the two share one surface and one seam. */\n railOpen?: boolean\n}) {\n const sidebarCollapsed = useLayoutStore((s) => s.sidebarCollapsed)\n const pageHeaderClaimed = usePageHeaderClaimed()\n const setTitleSlot = usePageTitleSlotHost()\n // Declara que ESTA shell mostra o slot — é o que deixa PageHeader saber que\n // pode entregar o cabeçalho para a barra em vez de desenhá-lo no corpo.\n usePageHeaderHost()\n const setSidebarCollapsed = useLayoutStore((s) => s.setSidebarCollapsed)\n // Drawer state lives in the store, not locally: the bottom bar's \"Mais\"\n // tab is rendered by the parent shell and has to open this same drawer.\n const mobileMenuOpen = useLayoutStore((st) => st.mobileDrawerOpen)\n const setMobileMenuOpen = useLayoutStore((st) => st.setMobileDrawerOpen)\n const [headerSlot, setHeaderSlot] = React.useState<HTMLElement | null>(null)\n const [actionsSlot, setActionsSlot] = React.useState<HTMLElement | null>(null)\n const [pageRailSlot, setPageRailSlot] = React.useState<HTMLElement | null>(null)\n const hasPageActions = useHasPageActions()\n\n return (\n <SaveBarProvider>\n <ModuleHeaderSlotContext.Provider value={headerSlot}>\n <ModuleHeaderActionsSlotContext.Provider value={actionsSlot}>\n <PageRailSlotContext.Provider value={pageRailSlot}>\n <div className={cn(\n 'shell-enter fz-viewport-h flex overflow-hidden bg-background',\n hasBottomNav && 'fz-has-bottom-bar',\n // Frame mode: the inset gap around the framed card takes the sidebar (menu)\n // color, so the white card reads as a panel floating on the same tone as the\n // left menu. The card's own md:m-2 margin reveals this behind it.\n frame && 'md:bg-sidebar',\n )}>\n {/* Desktop Sidebar — always flush / full-height (GoHighLevel style) */}\n <div className=\"hidden md:flex\">\n <Sidebar\n navigation={navigation}\n logo={logo}\n collapsed={sidebarCollapsed}\n onToggle={() => setSidebarCollapsed(!sidebarCollapsed)}\n onNavigate={onNavigate}\n currentPath={currentPath}\n user={user}\n onSignOut={onSignOut}\n onProfile={onProfile}\n onSettings={onSettings}\n onBilling={onBilling}\n orgSwitcher={orgSwitcher}\n topContent={sidebarTopContent}\n identity={sidebarIdentity}\n navTop={sidebarNavTop}\n footerContent={sidebarFooterContent}\n // Framed shells already draw the rail's edge — twice over. The inset\n // gap around the card is painted in the SIDEBAR's own colour (see the\n // `md:bg-sidebar` above), so the rail's right border ends up as a\n // hairline inside a solid field of its own tone, a couple of pixels\n // from the card's real border: two lines stating one boundary. The\n // internal separators (under the logo, above the settings block and\n // the footer) read the same way — rules ruled across a slab that is\n // already visibly a slab.\n //\n // Unframed shells keep them: there the rail meets the content with no\n // gap and no card edge, and the border IS the boundary.\n borderless={frame}\n userMenuSlot={userMenuSlot}\n notificationSlot={notificationSlot}\n unreadCount={unreadCount}\n searchLabel={searchLabel}\n sectionLabels={sidebarSectionLabels}\n navKey={sidebarNavKey}\n navDirection={sidebarNavDirection}\n navChildConnector={sidebarNavChildConnector}\n />\n </div>\n\n {/* Main content — optionally wrapped in an inset framed card.\n The inset/rounding is suppressed on mobile so the content stays\n edge-to-edge (the framed card only reads well on larger screens). */}\n <div className={cn(\n 'relative flex flex-1 overflow-hidden',\n // `content`, not `card`: this is the page's own surface, and cards have\n // to sit ON it. Painted card, the frame was the same tone as everything\n // inside it and the page read as one flat sheet.\n frame && 'md:my-2 md:ml-2 md:rounded-xl md:border md:border-border md:bg-content',\n // With a companion rail open, the page and the rail are ONE card: the\n // right edge opens and the rail closes it. Two cards with a strip of\n // chrome between them made the assistant read as a separate window\n // parked next to the app rather than as a column of it — the rail's own\n // left border is then the single seam between the two.\n frame && (railOpen ? 'md:rounded-r-none md:border-r-0' : 'md:mr-2'),\n )}>\n {/* The page's own menu column, when it has one — see PageRail. Empty on\n every other screen, and an empty div is zero wide. */}\n <div ref={setPageRailSlot} className=\"flex shrink-0 empty:hidden\" />\n <div className=\"relative flex min-w-0 flex-1 flex-col overflow-hidden\">\n {/* Top bar — mobile hamburger + module header slot (title + sub-nav) + actions.\n On mobile the bar is suppressed for the 'transparent' / 'hidden' header\n treatments (content goes edge-to-edge); desktop keeps it always. The\n portal targets below stay mounted (display:none on mobile) so module\n pages can still portal their sub-nav on desktop without crashing. */}\n {/* No surface of its own: the band takes whatever the content column\n paints (the page background, or the card when framed). Painting it\n card over an unframed page made a lighter strip across the top that\n read as a widget laid on the content — the hairline below is what\n separates it. */}\n <div className={cn(\n 'flex min-h-14 shrink-0 items-center justify-between gap-3 border-b border-border px-4 py-2',\n // …unless the page put its actions in it. Hiding the bar on mobile\n // used to hide the only \"Novo\" the screen had.\n mobileHeader !== 'minimal' && !hasPageActions && 'hidden md:flex',\n )}>\n <div className=\"flex min-w-0 flex-1 items-center gap-3\">\n {/* Mobile hamburger — suppressed when a bottom-nav bar owns mobile\n navigation (mobile-first apps). Desktop sidebar is untouched. */}\n {!barOwnsNav && (\n <button\n onClick={() => setMobileMenuOpen(true)}\n className=\"inline-flex items-center justify-center rounded-md p-2 text-muted-foreground hover:bg-accent md:hidden\"\n aria-label=\"Open menu\"\n >\n <Menu className=\"h-5 w-5\" />\n </button>\n )}\n {/* A sub-page (form, detail) claims this slot with its own back\n link / breadcrumb — it already says where you are, and printing\n the section title above it spent a whole row repeating a word. */}\n {/* The page draws its own header INTO this element, from its own\n tree. The shell only names the screen when nobody claimed it. */}\n {!pageHeaderClaimed && <ShellPageTitle title={pageTitle} back={pageBack} />}\n <div ref={setTitleSlot} className=\"flex min-w-0 items-center empty:hidden\" />\n {topbarStart}\n {/* Module pages (tabs variant) portal their sub-nav here */}\n <div ref={setHeaderSlot} className=\"flex min-w-0 flex-1 items-center\" />\n </div>\n <div className=\"flex shrink-0 items-center gap-2\">\n {/* Pages portal their primary action buttons here */}\n <div ref={setActionsSlot} className=\"flex items-center gap-2\" />\n {topbarEnd}\n </div>\n </div>\n\n {/* Page content */}\n <main className=\"min-w-0 flex-1 overflow-y-auto pb-16 md:pb-0\">\n {children}\n </main>\n\n {/* App-wide floating SaveBar (spans the content column, not the sidebar) */}\n <SaveBar />\n </div>\n </div>\n\n {/* Mobile drawer — animated, owns its own close transition. */}\n {mobileMenuOpen && (\n <MobileOverlay\n navigation={navigation}\n logo={logo}\n user={user}\n currentPath={currentPath}\n onNavigate={onNavigate}\n onSignOut={onSignOut}\n onProfile={onProfile}\n onSettings={onSettings}\n onBilling={onBilling}\n orgSwitcher={orgSwitcher}\n topContent={sidebarTopContent}\n identity={sidebarIdentity}\n navTop={sidebarNavTop}\n footerContent={sidebarFooterContent}\n userMenuSlot={userMenuSlot}\n notificationSlot={notificationSlot}\n unreadCount={unreadCount}\n searchLabel={searchLabel}\n onClose={() => setMobileMenuOpen(false)}\n />\n )}\n </div>\n </PageRailSlotContext.Provider>\n </ModuleHeaderActionsSlotContext.Provider>\n </ModuleHeaderSlotContext.Provider>\n </SaveBarProvider>\n )\n}\n\n// ---------------------------------------------------------------------------\n// Topbar layout\n// ---------------------------------------------------------------------------\n\nfunction TopbarLayout({\n navigation = [],\n logo,\n user,\n children,\n onNavigate,\n onSignOut,\n onProfile,\n onSettings,\n onBilling,\n userPlan,\n billingLabel,\n userMenuExtras,\n userMenuSlot,\n drawerUserMenuSlot,\n orgSwitcher,\n frame,\n currentPath,\n topbarStart,\n topbarEnd,\n pageTitle,\n pageBack,\n notificationSlot,\n unreadCount = 0,\n hasBottomNav = false,\n barOwnsNav = false,\n}: {\n navigation?: NavigationItem[]\n logo?: React.ReactNode\n user?: AppShellUser\n children?: React.ReactNode\n onNavigate?: (route: string) => void\n onSignOut?: () => void\n onProfile?: () => void\n onSettings?: () => void\n onBilling?: () => void\n userPlan?: AppShellProps['userPlan']\n billingLabel?: AppShellProps['billingLabel']\n userMenuExtras?: AppShellProps['userMenuExtras']\n /** O menu do usuário do host — o mesmo nó que o rail recebe. */\n userMenuSlot?: React.ReactNode\n drawerUserMenuSlot?: React.ReactNode\n /** Workspace switcher — rendered with the right-side actions (desktop) and in the mobile drawer. */\n orgSwitcher?: React.ReactNode\n frame?: boolean\n currentPath?: string\n topbarStart?: React.ReactNode\n topbarEnd?: React.ReactNode\n pageTitle?: string\n pageBack?: AppShellProps['pageBack']\n /** Bell/inbox slot — in the topbar layout it renders with the right-side actions. */\n notificationSlot?: React.ReactNode\n unreadCount?: number\n /** When a mobile bottom-nav bar is present, the mobile hamburger is\n * suppressed so the bottom nav is the primary mobile navigation. */\n hasBottomNav?: boolean\n /** The bar carries a \"Mais\" tab, so the hamburger is redundant. */\n barOwnsNav?: boolean\n}) {\n // Drawer state lives in the store, not locally: the bottom bar's \"Mais\"\n // tab is rendered by the parent shell and has to open this same drawer.\n const mobileMenuOpen = useLayoutStore((st) => st.mobileDrawerOpen)\n const setMobileMenuOpen = useLayoutStore((st) => st.setMobileDrawerOpen)\n const [headerSlot, setHeaderSlot] = React.useState<HTMLElement | null>(null)\n const [actionsSlot, setActionsSlot] = React.useState<HTMLElement | null>(null)\n const [pageRailSlot, setPageRailSlot] = React.useState<HTMLElement | null>(null)\n const rawClaimed = usePageHeaderClaimed()\n const setTitleSlot = usePageTitleSlotHost()\n const hasOutlet = useHasPageHeaderOutlet()\n const hasPageActions = useHasPageActions()\n usePageHeaderHost()\n // Um outlet mais fundo (a coluna de conteúdo de um módulo com trilha) já\n // desenha o cabeçalho no lugar certo — a barra larga aqui seria a segunda.\n const pageHeaderClaimed = hasOutlet ? false : rawClaimed\n\n // Same page title the sidebar layout draws. The horizontal nav marks the\n // GROUP (\"Registry\"), not the screen (\"Categories\").\n const showTitle = !hasOutlet && !!pageTitle\n\n // Topbar is full-bleed (edge to edge); only the content area gets the frame.\n return (\n <SaveBarProvider>\n <ModuleHeaderSlotContext.Provider value={headerSlot}>\n <ModuleHeaderActionsSlotContext.Provider value={actionsSlot}>\n <PageRailSlotContext.Provider value={pageRailSlot}>\n <div className={cn('shell-enter fz-viewport-h relative flex flex-col overflow-hidden bg-background', hasBottomNav && 'fz-has-bottom-bar')}>\n <Topbar\n navigation={navigation}\n logo={logo}\n user={user}\n currentPath={currentPath}\n onNavigate={onNavigate}\n onSignOut={onSignOut}\n onProfile={onProfile}\n onSettings={onSettings}\n onBilling={onBilling}\n userPlan={userPlan}\n billingLabel={billingLabel}\n userMenuExtras={userMenuExtras}\n userMenuSlot={userMenuSlot}\n orgSwitcher={orgSwitcher}\n leftContent={topbarStart}\n rightContent={(topbarEnd || notificationSlot) ? <>{topbarEnd}{notificationSlot}</> : undefined}\n onMenuClick={barOwnsNav ? undefined : () => setMobileMenuOpen(true)}\n hideMobileChrome={barOwnsNav}\n />\n {/* Frame inset/border only from md up, so mobile stays edge-to-edge. The\n inset gap behind the framed card is the header color (bg-sidebar), so the\n white card reads as a panel floating on the same navy as the topbar. */}\n {/* The frame is fixed to the viewport and the content scrolls INSIDE it,\n mirroring SidebarLayout. With `main` as the scroller the card grew with\n the page and its bottom edge rode off-screen. */}\n <main className={cn('flex min-w-0 min-h-0 flex-1 flex-col overflow-hidden', frame && 'md:bg-sidebar md:p-2')}>\n <div className={cn('flex min-w-0 min-h-0 flex-1 overflow-hidden', frame && 'md:rounded-xl md:border md:border-border md:bg-content')}>\n {/* The page's own menu column, when it has one — see PageRail. */}\n <div ref={setPageRailSlot} className=\"flex shrink-0 empty:hidden\" />\n <div className=\"flex min-w-0 min-h-0 flex-1 flex-col overflow-hidden\">\n {/* Page header — a barra só existe quando tem o que a navegação de topo\n não tem: ações, ou o \"← voltar\" de uma subpágina. O nome da tela\n sozinho não paga a linha AQUI, porque o menu horizontal logo acima\n já marca em qual item você está — \"Painel\" ficava escrito duas\n vezes, uma sob a outra, antes de qualquer conteúdo. (No layout de\n sidebar a barra fica: lá o menu é uma coluna e a barra é a única\n superfície que nomeia a tela.) */}\n {/* On a phone the horizontal nav row above is hidden, so nothing else\n names the screen — the reason this bar was optional only holds on\n desktop. It renders always and hides itself from md up when the\n title is all it would carry. */}\n {(pageHeaderClaimed || pageBack || hasPageActions || barOwnsNav) && (\n <div\n className={cn(\n 'flex min-h-12 shrink-0 items-center justify-between gap-3 border-b border-border px-4 py-2',\n !(pageHeaderClaimed || pageBack || hasPageActions) && 'md:hidden',\n )}\n >\n <div className=\"flex min-w-0 flex-1 items-center gap-3\">\n {!pageHeaderClaimed && <ShellPageTitle title={showTitle ? pageTitle : undefined} back={pageBack} />}\n <div ref={setTitleSlot} className=\"flex min-w-0 items-center empty:hidden\" />\n <div ref={setHeaderSlot} className=\"flex min-w-0 flex-1 items-center\" />\n </div>\n <div ref={setActionsSlot} className=\"flex shrink-0 items-center gap-2\" />\n </div>\n )}\n <div className=\"min-h-0 flex-1 overflow-y-auto pb-16 md:pb-0\">\n {children}\n </div>\n </div>\n </div>\n </main>\n\n {/* App-wide floating SaveBar */}\n <SaveBar />\n\n {/* Mobile drawer — topbar has no persistent sidebar, so the burger opens\n the same animated nav drawer used by the sidebar layout. */}\n {mobileMenuOpen && (\n <MobileOverlay\n navigation={navigation}\n logo={logo}\n user={user}\n currentPath={currentPath}\n onNavigate={onNavigate}\n onSignOut={onSignOut}\n onProfile={onProfile}\n onSettings={onSettings}\n onBilling={onBilling}\n orgSwitcher={orgSwitcher}\n userMenuSlot={drawerUserMenuSlot ?? (user ? <DrawerUserRow user={user} /> : undefined)}\n notificationSlot={notificationSlot}\n unreadCount={unreadCount}\n onClose={() => setMobileMenuOpen(false)}\n />\n )}\n </div>\n </PageRailSlotContext.Provider>\n </ModuleHeaderActionsSlotContext.Provider>\n </ModuleHeaderSlotContext.Provider>\n </SaveBarProvider>\n )\n}\n\n// Compact user identity for the mobile drawer's bottom row.\nfunction DrawerUserRow({ user }: { user: AppShellUser }) {\n const label = user.fullName || user.email\n return (\n <div className=\"flex min-w-0 items-center gap-2 px-1\">\n {user.avatarUrl ? (\n <img src={user.avatarUrl} alt=\"\" className=\"h-7 w-7 shrink-0 rounded-full object-cover\" />\n ) : (\n <span className=\"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-primary text-xs font-semibold text-primary-foreground\">\n {(label || '?').charAt(0).toUpperCase()}\n </span>\n )}\n <span className=\"truncate text-sm font-medium text-sidebar-foreground\">{label}</span>\n </div>\n )\n}\n\n// ---------------------------------------------------------------------------\n// Minimal layout\n// ---------------------------------------------------------------------------\n\nfunction MinimalLayout({\n logo,\n user: _user,\n children,\n headerEnd,\n hasBottomNav = false,\n}: {\n logo?: React.ReactNode\n user?: AppShellUser\n children?: React.ReactNode\n headerEnd?: React.ReactNode\n hasBottomNav?: boolean\n}) {\n return (\n <div className={cn('shell-enter fz-viewport-h flex flex-col', hasBottomNav && 'fz-has-bottom-bar')}>\n <header className=\"flex h-14 shrink-0 items-center justify-between border-b border-border bg-card px-4 md:px-6\">\n <div className=\"flex items-center gap-3\">\n {logo ?? <span className=\"text-lg font-bold\">App</span>}\n </div>\n {headerEnd && <div className=\"flex items-center gap-2\">{headerEnd}</div>}\n </header>\n <main className=\"min-w-0 flex-1 overflow-y-auto pb-16 md:pb-0\">\n {children}\n </main>\n </div>\n )\n}\n\n// ---------------------------------------------------------------------------\n// Mobile overlay drawer\n// ---------------------------------------------------------------------------\n\ntype MobileOverlayProps = Omit<SidebarProps, 'collapsed' | 'onToggle'> & {\n onClose: () => void\n}\n\nfunction MobileOverlay({ onClose, onNavigate, ...sidebarProps }: MobileOverlayProps) {\n // Mount hidden, then flip to visible on the next frame so the CSS transition\n // plays on open. On dismiss we play the exit transition first, then unmount.\n const [visible, setVisible] = React.useState(false)\n\n React.useEffect(() => {\n const id = requestAnimationFrame(() => setVisible(true))\n return () => cancelAnimationFrame(id)\n }, [])\n\n const close = React.useCallback(() => {\n setVisible(false)\n window.setTimeout(onClose, 250)\n }, [onClose])\n\n // Lock body scroll while the drawer is open.\n React.useEffect(() => {\n const previous = document.body.style.overflow\n document.body.style.overflow = 'hidden'\n return () => {\n document.body.style.overflow = previous\n }\n }, [])\n\n // Dismiss on Escape.\n React.useEffect(() => {\n const onKey = (e: KeyboardEvent) => {\n if (e.key === 'Escape') close()\n }\n window.addEventListener('keydown', onKey)\n return () => window.removeEventListener('keydown', onKey)\n }, [close])\n\n return (\n <div className=\"fixed inset-0 z-[60] md:hidden\">\n {/* Backdrop — fades in/out */}\n <div\n className={cn(\n 'absolute inset-0 bg-black/50 transition-opacity duration-300 ease-out',\n visible ? 'opacity-100' : 'opacity-0',\n )}\n onClick={close}\n />\n {/* Drawer — slides in from the left, reusing the real Sidebar for full\n design parity (icons, active state, org switcher, bottom user row). */}\n <div\n className={cn(\n 'absolute inset-y-0 left-0 shadow-2xl transition-transform duration-300 ease-out will-change-transform',\n visible ? 'translate-x-0' : '-translate-x-full',\n )}\n >\n <Sidebar\n {...sidebarProps}\n collapsed={false}\n onToggle={close}\n drawer\n borderless\n onNavigate={(route) => {\n onNavigate?.(route)\n close()\n }}\n />\n </div>\n </div>\n )\n}\n\n// ---------------------------------------------------------------------------\n// Mobile bottom tab bar — rendered for every variant on small screens.\n// ui must NOT import from saas, so the icon lookup is a small local map (a\n// mirror of the saas icon convention). Unknown icon names fall back to Home.\n// ---------------------------------------------------------------------------\n\n// The bar used to carry its own 11-entry icon map while the sidebar read the\n// full registry, so any other icon name silently degraded to a house.\nconst bottomNavIcon = (name?: string, fallback: LucideIcon = Home): LucideIcon =>\n (name ? ICON_MAP[name] : undefined) ?? fallback\n\n// Floating profile avatar — mobile-only (md:hidden), pinned top-right over the\n// content. Used with the 'transparent' mobile header treatment so there is no\n// header bar but the user still has a one-tap route into their profile.\nfunction FloatingProfileAvatar({ user, onClick }: { user?: AppShellUser; onClick?: () => void }) {\n if (!user) return null\n const label = user.fullName || user.email\n return (\n <button\n type=\"button\"\n onClick={onClick}\n aria-label=\"Profile\"\n className=\"fixed right-3 top-3 z-40 md:hidden\"\n >\n {user.avatarUrl ? (\n <img\n src={user.avatarUrl}\n alt=\"\"\n className=\"h-9 w-9 rounded-full object-cover shadow-md ring-2 ring-background\"\n />\n ) : (\n <span className=\"flex h-9 w-9 items-center justify-center rounded-full bg-primary text-sm font-semibold text-primary-foreground shadow-md ring-2 ring-background\">\n {(label || '?').charAt(0).toUpperCase()}\n </span>\n )}\n </button>\n )\n}\n\nfunction MobileBottomNav({\n items,\n currentPath,\n onNavigate,\n onAction,\n onMore,\n onAssistant,\n assistantOpen,\n moreOpen,\n retracted,\n}: {\n items: NonNullable<AppShellProps['bottomNav']>\n currentPath?: string\n onNavigate?: (route: string) => void\n onAction?: (id: string) => void\n onMore?: () => void\n onAssistant?: () => void\n assistantOpen?: boolean\n moreOpen?: boolean\n retracted?: boolean\n}) {\n const path = currentPath ?? ''\n\n // The bar is the last thing above the home indicator, so it pads itself out\n // of the inset rather than sitting under it. min-h keeps the 64px bar height\n // while the padding grows the element on devices that have an inset.\n return (\n <nav\n aria-label=\"Navegação principal\"\n aria-hidden={retracted || undefined}\n className={cn(\n 'fz-safe-b fixed inset-x-0 bottom-0 z-50 flex min-h-16 items-stretch justify-around border-t border-border bg-background md:hidden',\n 'motion-safe:transition-transform motion-safe:duration-200 motion-safe:ease-out',\n retracted && 'pointer-events-none translate-y-full',\n )}\n >\n {items.map((item, i) => {\n // Elevated center ACTION button (Mobills style) — raised above the bar,\n // circular, primary-filled; fires onBottomNavAction instead of routing.\n if ('kind' in item && item.kind === 'action') {\n const ActionIcon = bottomNavIcon(item.icon, Plus)\n return (\n <div key={item.id} className=\"flex flex-1 items-start justify-center\">\n <button\n type=\"button\"\n onClick={() => onAction?.(item.id)}\n aria-label={item.label ?? 'Add'}\n className=\"-mt-6 flex h-14 w-14 items-center justify-center rounded-full bg-primary text-primary-foreground shadow-lg shadow-primary/30 ring-4 ring-background transition-transform active:scale-95\"\n >\n <ActionIcon className=\"h-6 w-6\" />\n </button>\n </div>\n )\n }\n\n const isMore = 'kind' in item && item.kind === 'more'\n const isAssistant = 'kind' in item && item.kind === 'assistant'\n\n const label = isMore\n ? (item.label ?? 'Mais')\n : isAssistant\n ? (item.label ?? 'IA')\n : (item as BottomNavRouteItem).label\n\n const Icon = bottomNavIcon(\n item.icon,\n isMore ? Menu : isAssistant ? Sparkles : Home,\n )\n\n const route = isMore || isAssistant ? undefined : (item as BottomNavRouteItem).route\n const isActive = isMore\n ? !!moreOpen\n : isAssistant\n ? !!assistantOpen\n : route === '/'\n ? path === '/' || path === ''\n : !!route && (path === route || path.startsWith(route + '/'))\n\n return (\n <button\n key={isMore ? 'more' : isAssistant ? 'assistant' : `${route}-${i}`}\n type=\"button\"\n onClick={() => (isMore ? onMore?.() : isAssistant ? onAssistant?.() : onNavigate?.(route!))}\n aria-current={isActive && route ? 'page' : undefined}\n aria-expanded={isMore || isAssistant ? isActive : undefined}\n className={cn(\n // min-h-[44px] is the floor a finger needs; the bar was letting\n // content decide and landing around 40.\n 'relative flex min-h-[44px] flex-1 flex-col items-center justify-center gap-0.5 px-1 py-2 transition-colors',\n isActive ? 'text-primary' : 'text-muted-foreground',\n )}\n >\n {/* Colour alone is not a state indicator — the bar carries a rule\n above the active tab so the current place survives a glance. */}\n <span\n aria-hidden\n className={cn(\n 'absolute inset-x-3 top-0 h-0.5 rounded-full transition-opacity',\n isActive ? 'bg-primary opacity-100' : 'opacity-0',\n )}\n />\n <Icon className=\"h-5 w-5 shrink-0\" />\n <span className=\"max-w-full truncate text-[11px] leading-tight\">{label}</span>\n </button>\n )\n })}\n </nav>\n )\n}\n\n// ---------------------------------------------------------------------------\n// AppShell — main entry point\n// ---------------------------------------------------------------------------\n\nexport function AppShell({\n variant,\n contentFrame,\n navigation = [],\n logo,\n user,\n children,\n onNavigate,\n onSignOut,\n onProfile,\n onSettings,\n onBilling,\n userPlan,\n billingLabel,\n pageTitle,\n pageBack,\n currentPath,\n userMenuExtras,\n orgSwitcher,\n topbarStart,\n topbarEnd,\n sidebarTopContent,\n sidebarIdentity,\n sidebarNavTop,\n sidebarFooterContent,\n bottomNav,\n onBottomNavAction,\n onAssistantToggle,\n assistantOpen,\n mobileHeader = 'minimal',\n userMenuSlot,\n drawerUserMenuSlot,\n notificationSlot,\n unreadCount = 0,\n searchLabel,\n sidebarSectionLabels,\n sidebarNavKey,\n sidebarNavDirection,\n sidebarNavChildConnector,\n rightRail,\n rightRailOpen = true,\n defaultRightRailWidth,\n onRightRailWidthChange,\n rightRailMinWidth,\n rightRailMaxWidth,\n rightRailResizeLabel,\n}: AppShellProps) {\n const hasBottomNav = !!bottomNav?.length\n const barOwnsNav = bottomNavReachesAll(bottomNav)\n // A screen with a back affordance is somewhere the user went ON PURPOSE — a\n // form, a settings tab, a record. Top-level tabs are not the way out of it,\n // the back arrow is, and a phone has too little height to spend 64px on a\n // control that does not apply. The bar slides away and comes back on the way\n // out. `--fz-bottom-bar` goes with it, so the save bar drops down to meet it.\n // Two sources say \"you are one level down\": the route's own parent (settings\n // tabs) and a page that claimed the header with a back (a form reached from a\n // module tab). The module tab band already steps aside on the second one —\n // the bar reads the same signal rather than inventing a third.\n const pageClaimedBack = useHasPageHeaderBack()\n const barRetracted = !!pageBack || pageClaimedBack\n const mobileDrawerOpen = useLayoutStore((st) => st.mobileDrawerOpen)\n const setMobileDrawerOpen = useLayoutStore((st) => st.setMobileDrawerOpen)\n\n // Going anywhere closes the drawer. Nav items already closed it themselves,\n // but the user menu inside it (Perfil, Configurações, Assinatura) navigates\n // through its own handlers and left the drawer standing over the screen it\n // had just opened. Keyed on the route rather than on each control, so the\n // next thing added in there does not have to remember.\n React.useEffect(() => {\n setMobileDrawerOpen(false)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [currentPath])\n const bottomBar = hasBottomNav ? (\n <MobileBottomNav\n items={bottomNav!}\n currentPath={currentPath}\n onNavigate={onNavigate}\n onAction={onBottomNavAction}\n onMore={() => setMobileDrawerOpen(!mobileDrawerOpen)}\n moreOpen={mobileDrawerOpen}\n onAssistant={onAssistantToggle}\n assistantOpen={assistantOpen}\n retracted={barRetracted}\n />\n ) : null\n // Transparent mobile header → no bar, a floating avatar top-right instead.\n const floatingAvatar =\n mobileHeader === 'transparent' && user ? (\n <FloatingProfileAvatar user={user} onClick={onProfile} />\n ) : null\n\n let layoutElement: React.ReactNode\n switch (variant) {\n case 'sidebar':\n layoutElement = (\n <SidebarLayout\n navigation={navigation}\n logo={logo}\n user={user}\n onNavigate={onNavigate}\n onSignOut={onSignOut}\n onProfile={onProfile}\n onSettings={onSettings}\n onBilling={onBilling}\n userMenuExtras={userMenuExtras}\n orgSwitcher={orgSwitcher}\n sidebarTopContent={sidebarTopContent}\n sidebarIdentity={sidebarIdentity}\n sidebarNavTop={sidebarNavTop}\n sidebarFooterContent={sidebarFooterContent}\n frame={contentFrame}\n currentPath={currentPath}\n pageTitle={pageTitle}\n pageBack={pageBack}\n topbarStart={topbarStart}\n topbarEnd={topbarEnd}\n userMenuSlot={userMenuSlot}\n notificationSlot={notificationSlot}\n unreadCount={unreadCount}\n searchLabel={searchLabel}\n hasBottomNav={hasBottomNav && !barRetracted}\n barOwnsNav={barOwnsNav}\n mobileHeader={mobileHeader}\n sidebarSectionLabels={sidebarSectionLabels}\n sidebarNavKey={sidebarNavKey}\n sidebarNavDirection={sidebarNavDirection}\n sidebarNavChildConnector={sidebarNavChildConnector}\n railOpen={!!rightRail && rightRailOpen}\n >\n {children}\n </SidebarLayout>\n )\n break\n\n case 'topbar':\n layoutElement = (\n <TopbarLayout\n navigation={navigation}\n logo={logo}\n user={user}\n onNavigate={onNavigate}\n onSignOut={onSignOut}\n onProfile={onProfile}\n onSettings={onSettings}\n onBilling={onBilling}\n userPlan={userPlan}\n billingLabel={billingLabel}\n userMenuExtras={userMenuExtras}\n userMenuSlot={userMenuSlot}\n drawerUserMenuSlot={drawerUserMenuSlot}\n orgSwitcher={orgSwitcher}\n frame={contentFrame}\n currentPath={currentPath}\n topbarStart={topbarStart}\n topbarEnd={topbarEnd}\n pageTitle={pageTitle}\n pageBack={pageBack}\n notificationSlot={notificationSlot}\n hasBottomNav={hasBottomNav && !barRetracted}\n barOwnsNav={barOwnsNav}\n >\n {children}\n </TopbarLayout>\n )\n break\n\n case 'minimal':\n layoutElement = (\n <MinimalLayout logo={logo} user={user} headerEnd={topbarEnd} hasBottomNav={hasBottomNav && !barRetracted}>\n {children}\n </MinimalLayout>\n )\n break\n\n default: {\n const _exhaustive: never = variant\n return null\n }\n }\n\n return (\n <>\n {rightRail ? (\n <SplitWithRightRail\n rail={rightRail}\n open={rightRailOpen}\n frame={contentFrame}\n defaultWidth={defaultRightRailWidth}\n onWidthChange={onRightRailWidthChange}\n minWidth={rightRailMinWidth}\n maxWidth={rightRailMaxWidth}\n resizeLabel={rightRailResizeLabel}\n >\n {layoutElement}\n </SplitWithRightRail>\n ) : (\n layoutElement\n )}\n {floatingAvatar}\n {bottomBar}\n </>\n )\n}\n\n// ---------------------------------------------------------------------------\n// SplitWithRightRail — the app on the left, a full-height rail on the right,\n// a divider the user owns between them.\n//\n// The layouts all root at `h-screen overflow-hidden`, so putting them in a\n// `flex-1 min-w-0` cell keeps their height and lets them shrink. `min-w-0` is\n// load-bearing: without it a flex child refuses to go below its content width\n// and the rail gets pushed off-screen instead of the content reflowing.\n// ---------------------------------------------------------------------------\n\nfunction SplitWithRightRail({\n children,\n rail,\n open,\n frame,\n defaultWidth = 380,\n onWidthChange,\n minWidth = 300,\n maxWidth = 720,\n resizeLabel = 'Resize panel',\n}: {\n children: React.ReactNode\n rail: React.ReactNode\n open: boolean\n /** Frame mode: the gutter between content and rail takes the sidebar tone,\n * the same surface the content card floats on. Without this the split shows\n * a bare strip of page background and the rail reads as bolted on. */\n frame?: boolean\n defaultWidth?: number\n onWidthChange?: (width: number) => void\n minWidth?: number\n maxWidth?: number\n resizeLabel?: string\n}) {\n const [width, setWidth] = React.useState(defaultWidth)\n const [dragging, setDragging] = React.useState(false)\n\n const clamp = React.useCallback(\n (value: number) => Math.min(maxWidth, Math.max(minWidth, value)),\n [minWidth, maxWidth],\n )\n\n // The app follows the pointer to the pixel, so the drag runs on window\n // listeners rather than on the handle: the cursor routinely outruns a 6px\n // target, and a resize that stops when you move too fast feels broken.\n React.useEffect(() => {\n if (!dragging) return\n const onMove = (event: PointerEvent) => {\n event.preventDefault()\n setWidth(clamp(window.innerWidth - event.clientX))\n }\n const stop = () => setDragging(false)\n window.addEventListener('pointermove', onMove)\n window.addEventListener('pointerup', stop)\n window.addEventListener('pointercancel', stop)\n // Text selection across the whole app while dragging a divider is pure\n // noise, and iframes/canvases would otherwise swallow the pointer.\n const previousSelect = document.body.style.userSelect\n const previousCursor = document.body.style.cursor\n document.body.style.userSelect = 'none'\n document.body.style.cursor = 'col-resize'\n return () => {\n window.removeEventListener('pointermove', onMove)\n window.removeEventListener('pointerup', stop)\n window.removeEventListener('pointercancel', stop)\n document.body.style.userSelect = previousSelect\n document.body.style.cursor = previousCursor\n }\n }, [dragging, clamp])\n\n // Report only on release: firing per pointer frame would write to\n // localStorage ~60×/second for one gesture.\n React.useEffect(() => {\n if (dragging) return\n onWidthChange?.(width)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [dragging])\n\n const nudge = (delta: number) => setWidth((current) => clamp(current + delta))\n\n return (\n // Sidebar tone always: the gutter and the divider sit in the shell's\n // chrome, next to the menu — painting them page-white put a bright strip\n // between the dark chrome and the rail, which read as a seam rather than\n // as space.\n <div className={cn('fz-viewport-h flex w-full overflow-hidden bg-sidebar', !frame && 'md:bg-background')}>\n <div className=\"min-w-0 flex-1\">{children}</div>\n\n {/* Divider — desktop only; on a phone the rail is a sheet over the app,\n and there is nothing to divide. */}\n <div\n role=\"separator\"\n aria-orientation=\"vertical\"\n aria-label={resizeLabel}\n aria-valuenow={width}\n aria-valuemin={minWidth}\n aria-valuemax={maxWidth}\n tabIndex={0}\n onPointerDown={(event) => {\n event.preventDefault()\n setDragging(true)\n }}\n onDoubleClick={() => setWidth(clamp(defaultWidth))}\n onKeyDown={(event) => {\n // Keyboard resize: a pointer-only divider makes the split view\n // unusable for anyone not using a mouse.\n if (event.key === 'ArrowLeft') { event.preventDefault(); nudge(24) }\n else if (event.key === 'ArrowRight') { event.preventDefault(); nudge(-24) }\n else if (event.key === 'Home') { event.preventDefault(); setWidth(maxWidth) }\n else if (event.key === 'End') { event.preventDefault(); setWidth(minWidth) }\n }}\n className={cn(\n // Zero width: the divider USED to be a 4px gutter, which meant the\n // page and the rail could never touch — there was always a strip of\n // chrome between them. It now sits exactly on the seam the rail's own\n // left border draws, and lights that border up when you reach for it.\n 'group relative hidden w-0 shrink-0 cursor-col-resize focus-visible:outline-none',\n open && 'md:block',\n )}\n >\n {/* Invisible at rest: the seam is already drawn by the rail's border,\n and a second rule beside it is just a line to look at. */}\n <span\n className={cn(\n 'absolute inset-y-6 -left-px w-0.5 rounded-full bg-transparent transition-colors',\n 'group-hover:bg-primary/60 group-focus-visible:bg-primary',\n dragging && 'bg-primary',\n )}\n />\n {/* Hit area wider than the line: 1px is honest visually and hostile\n to aim for. */}\n <span className=\"absolute inset-y-0 -left-1.5 -right-1.5\" />\n </div>\n\n {/* Rendered once: two copies would mount the rail's contents twice. On a\n phone the box collapses to zero width and the rail positions itself\n `fixed` over the screen. The frame inset is padding HERE rather than\n margin on the rail — a full-height child plus vertical margins\n overflows its own box. */}\n <aside\n style={{ ['--fayz-rail-w' as string]: `${width}px` }}\n className={cn(\n 'w-0 shrink-0 overflow-hidden',\n // Animating WIDTH is what makes the app glide back instead of\n // snapping; skipped mid-drag so the divider stays glued to the cursor.\n !dragging && 'motion-safe:transition-[width] motion-safe:duration-200 motion-safe:ease-out',\n open && 'md:w-[var(--fayz-rail-w)]',\n frame && 'md:py-2 md:pr-2',\n )}\n >\n {rail}\n </aside>\n </div>\n )\n}\n","import * as React from 'react'\nimport { cn } from '../lib/cn'\n\nexport interface HeaderTab<T extends string = string> {\n value: T\n label: React.ReactNode\n /** Rendered before the label (already-sized lucide component or node). */\n icon?: React.ComponentType<{ className?: string }>\n /** Small trailing count chip — omit for none (0 still renders). */\n count?: number\n /** Trailing adornment (e.g. a plan-gate badge). Rendered after the count. */\n badge?: React.ReactNode\n}\n\nexport interface HeaderTabsProps<T extends string = string> {\n tabs: ReadonlyArray<HeaderTab<T>>\n value: T\n onChange: (value: T) => void\n className?: string\n 'aria-label'?: string\n /**\n * The strip IS the band, rather than sitting inside one under a title.\n *\n * Rows stretch to the strip's full height and the active underline hangs on\n * its bottom edge, so a caller that gives the strip `self-stretch -mb-px`\n * inside a bordered header lands the underline ON that border. Default (off)\n * keeps the underline 6px under the label, which is right when a title sits\n * above and the band is only as tall as the labels.\n */\n fill?: boolean\n}\n\n/**\n * The list-header tab strip: plain text tabs where only the active one is\n * marked, by an underline beneath it.\n *\n * It used to be a bordered group with the active item raised onto a card — a\n * control with a box around it, which at the top of a page reads as a widget\n * sitting on the content instead of as the page's own navigation. Tabs are\n * navigation: the quietest thing that can still say \"you are here\" is a rule\n * under one word, so the page title above and the action buttons beside it stay\n * the loud parts of the row.\n *\n * Distinct from SegmentedControl on purpose. SegmentedControl is a compact\n * inline toggle (7d/30d) that inverts to a solid foreground pill — a choice you\n * flip inside a card; this switches what the page is showing.\n */\nexport function HeaderTabs<T extends string = string>({\n tabs, value, onChange, className, fill, ...rest\n}: HeaderTabsProps<T>) {\n return (\n <div\n role=\"tablist\"\n aria-label={rest['aria-label']}\n className={cn(\n 'inline-flex max-w-full gap-5 overflow-x-auto scrollbar-none',\n fill ? 'items-stretch' : 'items-center',\n className,\n )}\n >\n {tabs.map((tab) => {\n const active = tab.value === value\n const Icon = tab.icon\n return (\n <button\n key={tab.value}\n type=\"button\"\n role=\"tab\"\n aria-selected={active}\n onClick={() => onChange(tab.value)}\n className={cn(\n 'relative flex shrink-0 items-center gap-1.5 whitespace-nowrap text-sm transition-colors',\n // Filled: the row owns the band's height and the underline sits on\n // its bottom edge. Otherwise the underline trails the label by 6px.\n fill ? 'h-full' : 'pb-1.5',\n active\n ? 'font-medium text-foreground'\n : 'text-muted-foreground hover:text-foreground',\n )}\n >\n {Icon ? <Icon className=\"h-4 w-4 shrink-0\" /> : null}\n <span>{tab.label}</span>\n {tab.count != null && (\n <span className={cn(\n 'ml-0.5 rounded-full px-1.5 text-[11px] tabular-nums',\n active ? 'bg-muted text-foreground' : 'bg-muted/70 text-muted-foreground',\n )}>\n {tab.count}\n </span>\n )}\n {tab.badge}\n {active && <span className=\"absolute inset-x-0 bottom-0 h-0.5 rounded-full bg-foreground\" />}\n </button>\n )\n })}\n </div>\n )\n}\n\nexport interface PageTabsProps<T extends string = string> extends Omit<HeaderTabsProps<T>, 'className'> {\n /** Right side of the band (e.g. a status filter or a secondary action). */\n actions?: React.ReactNode\n /** Applied to the band, not to the tab strip. */\n className?: string\n}\n\n/**\n * A page's tab band: the tab strip closed by a hairline that runs edge to edge,\n * directly under the shell bar — the sub-header of a screen whose sections are\n * tabs (a module, a record with several faces).\n *\n * The rule bleeds past the page padding and pays it back as inset, so it lines\n * up with the shell bar above instead of stopping 24px short of both sides; the\n * strip's `-mb-px` puts the active underline ON the rule rather than floating\n * above it. Bleed values match the shell's page padding (`p-3` / `md:px-6\n * md:pt-4`) — change one and this has to follow, or the rule stops short of the\n * edge or overshoots it.\n *\n * The bleed is vertical too, and for the same reason: the underline has to land\n * on the rule, so the space under a label is fixed at 6px, and leaving the whole\n * page padding above it left the labels pinned to the bottom of their own band.\n * The band cancels that padding and pays back its own, which is what centers the\n * labels between the shell bar and the rule.\n */\nexport function PageTabs<T extends string = string>({ actions, className, ...props }: PageTabsProps<T>) {\n return (\n <div\n className={cn(\n '-mx-3 -mt-3 mb-4 flex flex-wrap items-end justify-between gap-3 border-b border-border px-3 pt-2 md:-mx-6 md:-mt-4 md:px-6',\n className,\n )}\n >\n <HeaderTabs {...props} className=\"-mb-px\" />\n {actions && <div className=\"flex shrink-0 items-center gap-2 pb-1.5\">{actions}</div>}\n </div>\n )\n}\n","import * as React from 'react'\nimport { cn } from '../lib/cn'\n\n// ---------------------------------------------------------------------------\n// PageTransition — the single, SDK-owned animation applied to every nested\n// navigation (route changes in the shell + module-internal view changes).\n// Plugins never implement transitions themselves; they render content and the\n// shell/ModulePage wrap it in <PageTransition>. The style is provided app-wide\n// via NavTransitionProvider so different products/repos can ship a different\n// feel (slide | fade | none | future custom) without touching plugins.\n// ---------------------------------------------------------------------------\n\nexport type NavTransition = 'slide' | 'fade' | 'none'\n\nconst NavTransitionContext = React.createContext<NavTransition>('slide')\n\nexport function NavTransitionProvider({ value, children }: { value: NavTransition; children: React.ReactNode }) {\n return <NavTransitionContext.Provider value={value}>{children}</NavTransitionContext.Provider>\n}\n\nexport function useNavTransition(): NavTransition {\n return React.useContext(NavTransitionContext)\n}\n\nfunction resolveTransitionClass(transition: NavTransition, direction?: 'forward' | 'back'): string {\n if (transition === 'none') return ''\n if (transition === 'fade') return 'saas-page-enter'\n // slide (default) — direction-aware, falls back to a plain enter.\n if (direction === 'back') return 'saas-nav-back'\n if (direction === 'forward') return 'saas-nav-forward'\n return 'saas-page-enter'\n}\n\n/**\n * Wraps content and re-fires the active transition whenever `transitionKey`\n * changes (the key swap forces the node to remount, restarting the CSS\n * animation). Direction is optional and only used by the 'slide' transition.\n */\nexport function PageTransition({\n transitionKey,\n direction,\n className,\n children,\n}: {\n transitionKey: string | number\n direction?: 'forward' | 'back'\n className?: string\n children: React.ReactNode\n}) {\n const transition = useNavTransition()\n const animClass = resolveTransitionClass(transition, direction)\n return (\n <div key={transitionKey} className={cn(animClass, className)}>\n {children}\n </div>\n )\n}\n","import * as React from 'react'\nimport { createPortal } from 'react-dom'\nimport { ChevronDown, ChevronRight, ChevronLeft, Crown, type LucideIcon } from 'lucide-react'\nimport { useTranslation } from '@fayz-ai/core'\nimport { cn } from '../lib/cn'\nimport { ICON_MAP } from '../icons'\nimport { useModuleHeaderActionsSlot, usePageRailSlot } from './AppShell'\nimport { PageTabs, type HeaderTab } from '../primitives/header-tabs'\nimport { PageTransition } from './PageTransition'\nimport { useBackHandler } from './SaveBar'\nimport { usePageHeader, useHasPageHeaderHost, useHasPageHeaderBack, useRegisterPageActions, PageTitlePortal } from '../stores/page-header.store'\nimport { PageHeaderCrumb } from '../primitives/page-header'\nimport { useCrossModuleBack } from './useCrossModuleBack'\n\n// ---------------------------------------------------------------------------\n// PageHeaderActions — portals a page's primary action button(s) into the shell\n// top-bar's right-aligned actions slot. Falls back to a right-aligned inline row\n// when there's no slot (e.g. topbar layout). Any page can use it:\n// <PageHeaderActions><Button>New campaign</Button></PageHeaderActions>\n// ---------------------------------------------------------------------------\n\n/**\n * A coluna de menu desta página — as seções de um módulo, os links de\n * Configurações — entregue à shell em vez de desenhada no corpo.\n *\n * A shell a põe ANTES da barra de página, encostada no topo do quadro. Desenhada\n * aqui dentro, ela nascia abaixo de uma barra que atravessava a largura toda:\n * o menu ficava empurrado para baixo do título da tela que ele mesmo governa. Do\n * lado de fora, a barra começa onde o conteúdo começa, que é o que ela nomeia.\n *\n * Sem shell (modal, layout minimal) desenha no lugar, como qualquer fallback.\n */\nexport function PageRail({ children }: { children: React.ReactNode }) {\n const slot = usePageRailSlot()\n if (slot) return createPortal(children, slot)\n return <>{children}</>\n}\n\nexport function PageHeaderActions({ children }: { children: React.ReactNode }) {\n const slot = useModuleHeaderActionsSlot()\n // The bar reads this to decide whether it exists at all — see the store. It\n // has to be registered before the portal target is asked for, not after.\n useRegisterPageActions()\n if (slot) return createPortal(children, slot)\n return <div className=\"mb-4 flex items-center justify-end gap-2\">{children}</div>\n}\n\nexport interface ModuleNavItem {\n id: string\n label: string\n icon?: string\n active?: boolean\n onClick?: () => void\n /** Where tapping the PARENT lands. Without it the shell prefers the child\n * whose id ends in `-list`: a group called \"Contas a Pagar\" opens the\n * accounts, not a blank form for a new one. */\n defaultChild?: boolean\n /** Feature id for the access gate. When set, `useModuleNavAccess` (in\n * @fayz-ai/admin) resolves this link's role (hide) and plan (Crown) state. */\n feature?: string\n /** Freemium discovery: the user's role allows this link but their plan does\n * not entitle `feature`. Renders a small Crown badge (same vocabulary as the\n * Sidebar top-level nav); the click still navigates and the gated CONTENT\n * shows the UpgradePrompt. Typically set by `useModuleNavAccess`. */\n premium?: boolean\n children?: ModuleNavItem[]\n}\n\n// ---------------------------------------------------------------------------\n// PremiumBadge — the small Crown affordance shared by every module-nav renderer\n// (rail, mobile tabs, GHL header). Same vocabulary as the Sidebar top-level nav\n// so a plan-gated sub-module link reads identically wherever it appears.\n// ---------------------------------------------------------------------------\n\nfunction PremiumBadge({ className }: { className?: string }) {\n const t = useTranslation()\n const tip = t('upgrade.badgeTooltip')\n return (\n <span title={tip} aria-label={tip} className={cn('inline-flex shrink-0', className)}>\n <Crown className=\"h-3.5 w-3.5 text-amber-500\" aria-hidden />\n </span>\n )\n}\n\nexport interface ModulePageProps {\n title: string\n subtitle?: string\n nav: ModuleNavItem[]\n children: React.ReactNode\n className?: string\n /** Optional action element rendered next to the title (e.g. settings gear) */\n headerAction?: React.ReactNode\n /** Show the title/subtitle header. Default: true */\n showHeader?: boolean\n /** Optional content pinned to the bottom of the sidebar (e.g. \"Powered by X\") */\n sidebarFooter?: React.ReactNode\n /** How the module-internal nav renders. Falls back to the ModuleLayout context\n * (set by the app shell from its layout), then 'rail'. */\n navVariant?: ModuleNavVariant\n /** Active sub-view id — drives the SDK page transition when it changes.\n * Plugins pass their `useModuleNavigation().view`; they no longer animate themselves. */\n viewKey?: string\n /** Navigation direction for the transition (from `useModuleNavigation`). */\n direction?: 'forward' | 'back'\n}\n\n// ---------------------------------------------------------------------------\n// ModuleLayout context — lets the app shell decide how every module's internal\n// navigation renders ('rail' for topbar products, 'tabs' for sidebar/GHL-style\n// products), so plugins stay agnostic and products feel distinct.\n// ---------------------------------------------------------------------------\n\n/**\n * Onde a sub-navegação de um módulo mora.\n * rail — coluna à esquerda, dentro da página.\n * tabs — faixa de abas na primeira linha do corpo (HeaderTabs).\n * sidebar — em lugar nenhum da página: a sidebar da shell carrega as sub-views\n * como filhas do item do módulo. Para módulos cujas sub-views são\n * DESTINOS (Funil, Leads, Orçamentos) e não recortes de uma mesma\n * tela — listar as duas coisas seria a mesma navegação duas vezes.\n */\nexport type ModuleNavVariant = 'rail' | 'tabs' | 'sidebar'\n\nconst ModuleLayoutContext = React.createContext<ModuleNavVariant>('rail')\n\nexport function ModuleLayoutProvider({ variant, children }: { variant: ModuleNavVariant; children: React.ReactNode }) {\n return <ModuleLayoutContext.Provider value={variant}>{children}</ModuleLayoutContext.Provider>\n}\n\nexport function useModuleLayout(): ModuleNavVariant {\n return React.useContext(ModuleLayoutContext)\n}\n\n/**\n * Uma linha de trilha de página — a coluna de seções de um módulo, os links de\n * Configurações. Exportada porque essas duas colunas são a MESMA coisa e\n * estavam desenhadas duas vezes: o item ativo do módulo vinha tingido da marca\n * e o de Configurações, cinza. Duas gramáticas para \"você está aqui\".\n */\nexport function RailNavItem({ item }: { item: ModuleNavItem }) {\n const [expanded, setExpanded] = React.useState(true)\n const Icon = item.icon ? (ICON_MAP[item.icon] ?? null) : null\n const hasChildren = item.children && item.children.length > 0\n const hasActiveChild = hasChildren && item.children!.some((c) => c.active)\n const isActive = item.active || hasActiveChild\n\n return (\n <div>\n <button\n type=\"button\"\n onClick={() => hasChildren ? setExpanded(!expanded) : item.onClick?.()}\n className={cn(\n 'flex items-center gap-2 w-full rounded-md px-2.5 py-1.5 text-sm transition-colors',\n isActive\n ? 'bg-primary/10 text-primary font-medium'\n : 'text-muted-foreground hover:text-foreground hover:bg-muted/50'\n )}\n >\n {Icon && <Icon className=\"h-4 w-4 shrink-0\" />}\n <span className=\"flex-1 text-left truncate\">{item.label}</span>\n {item.premium && <PremiumBadge className=\"ml-1\" />}\n {hasChildren && (\n expanded\n ? <ChevronDown className=\"h-3.5 w-3.5 shrink-0 opacity-50\" />\n : <ChevronRight className=\"h-3.5 w-3.5 shrink-0 opacity-50\" />\n )}\n </button>\n {hasChildren && expanded && (\n <div className=\"ml-4 mt-0.5 space-y-0.5 border-l pl-2\">\n {item.children!.map((child) => (\n <button\n key={child.id}\n type=\"button\"\n onClick={child.onClick}\n className={cn(\n 'flex items-center w-full rounded-md px-2.5 py-1 text-xs transition-colors',\n child.active\n ? 'text-primary font-medium bg-primary/5'\n : 'text-muted-foreground hover:text-foreground hover:bg-muted/50'\n )}\n >\n <span className=\"flex-1 text-left truncate\">{child.label}</span>\n {child.premium && <PremiumBadge className=\"ml-1\" />}\n </button>\n ))}\n </div>\n )}\n </div>\n )\n}\n\n/** Horizontal scrollable tabs for mobile — with expandable children */\n/**\n * Where a parent tab goes when tapped.\n *\n * It used to only expand, so \"Contas a Pagar\" answered with a choice between\n * \"Novo\" and \"Lista\" — and a group named after a set of records should open the\n * records, not ask. The create route stays reachable in the row that opens\n * underneath, which is the right weight for it.\n */\nfunction defaultChildOf(item: ModuleNavItem): ModuleNavItem | undefined {\n const kids = item.children ?? []\n return (\n kids.find((c) => c.defaultChild)\n ?? kids.find((c) => /(^|-)list$/i.test(c.id))\n ?? kids.find((c) => !/(^|-)(new|novo|nova|create)$/i.test(c.id))\n ?? kids[0]\n )\n}\n\nfunction MobileTabs({ nav }: { nav: ModuleNavItem[] }) {\n const scrollRef = React.useRef<HTMLDivElement>(null)\n const [expandedId, setExpandedId] = React.useState<string | null>(null)\n\n // Auto-scroll to active tab on mount\n React.useEffect(() => {\n const container = scrollRef.current\n if (!container) return\n const activeEl = container.querySelector('[data-active=\"true\"]') as HTMLElement\n if (activeEl) {\n const left = activeEl.offsetLeft - container.offsetWidth / 2 + activeEl.offsetWidth / 2\n container.scrollTo({ left: Math.max(0, left), behavior: 'smooth' })\n }\n }, [nav])\n\n return (\n <div className=\"md:hidden -mx-1 mb-4 no-print\">\n <div ref={scrollRef} className=\"flex gap-1 px-1 pb-2 overflow-x-auto scrollbar-none\">\n {nav.map((item) => {\n const Icon = item.icon ? (ICON_MAP[item.icon] ?? null) : null\n const hasChildren = item.children && item.children.length > 0\n const isActive = item.active || item.children?.some((c) => c.active)\n const isExpanded = expandedId === item.id\n\n return (\n <button\n key={item.id}\n type=\"button\"\n data-active={isActive || undefined}\n onClick={() => {\n if (hasChildren) {\n // Land somewhere useful AND show the siblings: the group opens\n // its list, and the row underneath keeps the rest reachable.\n if (!isExpanded) defaultChildOf(item)?.onClick?.()\n setExpandedId(isExpanded ? null : item.id)\n } else {\n item.onClick?.()\n setExpandedId(null)\n }\n }}\n className={cn(\n // This strip is the most-tapped control in most modules and it\n // was 28px tall — a third under the comfortable minimum. Height\n // and text step up on touch; the desktop rail is unaffected.\n 'flex shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full px-4 text-sm font-medium transition-colors',\n 'min-h-[2.75rem] active:scale-[0.98]',\n isActive\n ? 'bg-primary text-primary-foreground'\n : 'bg-muted text-muted-foreground hover:text-foreground'\n )}\n >\n {Icon && <Icon className=\"h-3.5 w-3.5\" />}\n {item.label}\n {item.premium && <PremiumBadge />}\n {hasChildren && <ChevronDown className={cn('h-2.5 w-2.5 transition-transform', isExpanded && 'rotate-180')} />}\n </button>\n )\n })}\n </div>\n\n {/* Expanded children dropdown */}\n {expandedId && (() => {\n const item = nav.find((n) => n.id === expandedId)\n if (!item?.children) return null\n return (\n <div className=\"flex gap-1 px-2 pb-2 animate-in fade-in-0 slide-in-from-top-1\">\n {item.children.map((child) => (\n <button\n key={child.id}\n type=\"button\"\n onClick={() => { child.onClick?.(); setExpandedId(null) }}\n className={cn(\n 'whitespace-nowrap rounded-full px-2.5 py-1 text-[11px] font-medium transition-colors shrink-0',\n child.active\n ? 'bg-foreground/10 text-foreground'\n : 'text-muted-foreground hover:text-foreground'\n )}\n >\n {child.label}\n {child.premium && <PremiumBadge />}\n </button>\n ))}\n </div>\n )\n })()}\n </div>\n )\n}\n\n// ---------------------------------------------------------------------------\n// SubpageHeader\n// ---------------------------------------------------------------------------\n\n// ---------------------------------------------------------------------------\n// Back-button style — the SINGLE, app-wide affordance for returning from a\n// detail/subpage. Set once by the product via <BackStyleProvider>, NOT chosen\n// per-plugin (mirrors NavTransitionProvider for page transitions). Plugins just\n// pass `onBack` + `parentLabel` to SubpageHeader and inherit whatever style the\n// app picked:\n// 'link' → subtle \"← Back to {parent}\" above the title (default)\n// 'breadcrumb' → \"{parent} › Title\"\n// 'icon' → square chevron button beside the title\n// ---------------------------------------------------------------------------\n\nexport type BackButtonStyle = 'link' | 'breadcrumb' | 'icon'\n\nconst BackStyleContext = React.createContext<BackButtonStyle>('link')\n\nexport function BackStyleProvider({ style, children }: { style: BackButtonStyle; children: React.ReactNode }) {\n return <BackStyleContext.Provider value={style}>{children}</BackStyleContext.Provider>\n}\n\nexport function useBackStyle(): BackButtonStyle {\n return React.useContext(BackStyleContext)\n}\n\nexport interface SubpageHeaderProps {\n /** Page title */\n title: string\n /** Short description */\n subtitle?: string\n /** Lucide icon name */\n icon?: string\n /** Back button handler */\n onBack?: () => void\n /** Parent label (e.g. \"Invoices\") — used by every back style (\"Back to Invoices\", breadcrumb root, etc.) */\n parentLabel?: string\n /** Actions rendered on the right */\n actions?: React.ReactNode\n /** Override the app-wide back style for this one header. Rarely needed. */\n backStyle?: BackButtonStyle\n /** Keep the header where it renders instead of hoisting the back link into\n * the shell bar. For a detail opened INSIDE a tab the page never changed, so\n * the bar must keep saying where the user still is. */\n inline?: boolean\n}\n\nexport function SubpageHeader({ title, subtitle, icon, onBack, parentLabel, actions, backStyle, inline }: SubpageHeaderProps) {\n const t = useTranslation()\n const appStyle = useBackStyle()\n const hasShellBar = useHasPageHeaderHost() && !inline\n\n // Defer to the global navigation history when the user came from another\n // module, so the back link points at the actual previous page. Within the\n // same module the page's own onBack/parentLabel pass through unchanged.\n const cross = useCrossModuleBack(onBack, parentLabel)\n\n // …exceto quando o cabeçalho é `inline`. Aí ele não é uma PÁGINA: é um\n // detalhe aberto dentro de uma aba, e a rota nunca mudou. O histórico global\n // ainda aponta para de onde a pessoa veio ANTES de abrir a ficha — então,\n // quem chegasse ao cliente vindo da Agenda via, dentro da aba de gravações,\n // um \"← Voltar para Agenda\" que ao ser clicado saía do cliente inteiro em vez\n // de fechar a gravação. O voltar de um detalhe inline é sempre local.\n const effectiveOnBack = inline ? onBack : cross.onBack\n const effectiveParentLabel = inline ? parentLabel : cross.parentLabel\n\n // Wire this page's back action into the app-wide Escape key (no per-plugin code).\n useBackHandler(effectiveOnBack)\n const Icon = icon ? (ICON_MAP[icon] ?? null) : null\n\n // ---------------------------------------------------------------------------\n // Com barra de shell, o cabeçalho SOBE: \"← Título\" vai para a barra e aqui\n // fica só o que ela não carrega (subtítulo, ações).\n //\n // Era esta a origem do título duplicado — a barra escrevia \"Financeiro\" e a\n // página, uma linha abaixo, \"‹ Voltar para Contas a Pagar / Contas a Pagar\".\n // Três linhas para dizer duas coisas. Os estilos 'link' | 'breadcrumb' |\n // 'icon' continuam existindo para quem não tem barra (modal, layout minimal).\n // ---------------------------------------------------------------------------\n // Detalhe aberto DENTRO de uma aba: o mesmo \"← Pai / Título\" que a barra da\n // shell desenha, só que aqui, em tamanho de linha.\n //\n // Antes esta situação caía no estilo 'link', que é um cabeçalho de PÁGINA:\n // \"← Voltar para Gravações\" numa linha e, embaixo, um <h2 text-xl font-bold>.\n // Dentro da ficha do cliente isso dava dois títulos grandes empilhados — o\n // nome da pessoa e o da gravação — e um voltar com desenho que não existe em\n // nenhum outro lugar do app. `PageHeaderCrumb` é o MESMO componente do\n // \"← Clientes / Patricia Braga\" lá de cima: um desenho de voltar, não dois.\n if (inline && effectiveOnBack) {\n return (\n <div className=\"space-y-1\">\n <div className=\"flex flex-wrap items-center justify-between gap-3\">\n <PageHeaderCrumb title={title} parentLabel={effectiveParentLabel} onBack={effectiveOnBack} />\n {actions && <div className=\"no-print\">{actions}</div>}\n </div>\n {subtitle && <p className=\"text-sm text-muted-foreground\">{subtitle}</p>}\n </div>\n )\n }\n\n if (hasShellBar) {\n return (\n <ShellSubpageHeader\n title={title}\n subtitle={subtitle}\n icon={Icon}\n onBack={effectiveOnBack}\n parentLabel={effectiveParentLabel}\n actions={actions}\n />\n )\n }\n // Breadcrumb/link need a parent label; without one we fall back to the icon button.\n const style: BackButtonStyle = !effectiveOnBack ? 'icon' : (backStyle ?? appStyle)\n const effectiveStyle: BackButtonStyle = style !== 'icon' && !effectiveParentLabel ? 'icon' : style\n\n const titleBlock = (\n <div className=\"flex items-center justify-between gap-4\">\n <div className=\"flex items-center gap-3\">\n {effectiveStyle === 'icon' && effectiveOnBack && (\n <button\n onClick={effectiveOnBack}\n className=\"flex h-8 w-8 items-center justify-center rounded-lg border hover:bg-muted bg-card shadow-button active:shadow-button-inset transition-colors\"\n >\n <ChevronLeft className=\"h-4 w-4\" />\n </button>\n )}\n {Icon && (\n <div className=\"flex h-10 w-10 items-center justify-center rounded-xl bg-muted\">\n <Icon className=\"h-5 w-5 text-muted-foreground\" />\n </div>\n )}\n <div>\n <h2 className=\"text-xl font-bold\">{title}</h2>\n {subtitle && <p className=\"text-sm text-muted-foreground\">{subtitle}</p>}\n </div>\n </div>\n {actions && <div className=\"no-print\">{actions}</div>}\n </div>\n )\n\n if (effectiveStyle === 'breadcrumb') {\n return (\n <div className=\"space-y-4 mb-6\">\n <div className=\"flex items-center justify-between gap-4\">\n <div className=\"flex items-center gap-2 text-sm text-muted-foreground\">\n <button onClick={effectiveOnBack} className=\"hover:text-foreground transition-colors\">{effectiveParentLabel}</button>\n <ChevronRight className=\"h-3.5 w-3.5\" />\n <span className=\"text-foreground font-medium\">{title}</span>\n </div>\n {actions && <div className=\"no-print\">{actions}</div>}\n </div>\n {subtitle && <p className=\"text-sm text-muted-foreground -mt-2\">{subtitle}</p>}\n </div>\n )\n }\n\n if (effectiveStyle === 'link') {\n return (\n <div className=\"space-y-3 mb-6\">\n <button\n onClick={effectiveOnBack}\n className=\"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors\"\n >\n <ChevronLeft className=\"h-4 w-4\" />\n {t('crud.detail.backTo', { entities: effectiveParentLabel as string })}\n </button>\n {titleBlock}\n </div>\n )\n }\n\n // icon (default fallback)\n return <div className=\"space-y-4 mb-6\">{titleBlock}</div>\n}\n\n/**\n * SubpageHeader quando existe barra de shell: o título e o voltar vão para a\n * barra; o corpo fica com o subtítulo e as ações — as duas coisas que a barra\n * não tem onde pôr.\n *\n * Renderiza um <div> vazio? Não: quando não sobra nada, não sobra elemento\n * nenhum, para a página não começar com uma margem fantasma.\n */\nfunction ShellSubpageHeader({\n title, subtitle, icon: Icon, onBack, parentLabel, actions,\n}: {\n title: string\n subtitle?: string\n icon: LucideIcon | null\n onBack?: () => void\n parentLabel?: string\n actions?: React.ReactNode\n}) {\n // Mesmo traço que PageHeader — \"← Pai / Título\". Desenhado por PORTAL: o\n // título pode ser um nó do plugin (o status de um orçamento), e entregue à\n // shell por um store ele perdia os providers que o escreveram.\n usePageHeader(true, { back: !!onBack })\n const crumb = (\n <PageTitlePortal>\n <div className=\"flex min-w-0 items-center gap-2\">\n {Icon && !onBack && <Icon className=\"h-4 w-4 shrink-0 text-muted-foreground\" />}\n <PageHeaderCrumb title={title} parentLabel={parentLabel} onBack={onBack} />\n </div>\n </PageTitlePortal>\n )\n\n // `subtitle` continua na API (o chamador declara), mas não é desenhado: a\n // barra nomeia a tela e a frase abaixo dela era uma linha inteira antes do\n // conteúdo, dizendo o que o conteúdo já diz.\n if (!actions) return crumb\n // As ações vão para a direita da barra — o mesmo canto de toda tela do\n // produto. Aqui embaixo elas abriam uma linha só delas entre o nome da tela e\n // o conteúdo, e cada página escolhia a altura dessa linha.\n return <>{crumb}<PageHeaderActions><div className=\"no-print flex shrink-0 items-center gap-2\">{actions}</div></PageHeaderActions></>\n}\n\n// ---------------------------------------------------------------------------\n// ModuleHeader — a module's horizontal sub-nav (Painel · Funil · Leads · …).\n//\n// Renders the SAME `PageTabs` band as every other screen whose sections are\n// tabs (the course record, list views' tab strip): the first row of the page\n// body, tabs on the left, closed by a full-bleed hairline. It used to be tabs\n// portalled into the shell's top bar, which put it next to the page title — a\n// second navigation surface, in a different position and a different visual\n// language from the tab strip one click away on any list. One tab language,\n// one position.\n// ---------------------------------------------------------------------------\n\nfunction ModuleHeader({ nav }: { nav: ModuleNavItem[] }) {\n // Tabs are flat: a parent with children navigates straight to its default\n // \"list\" view (sub-actions like \"New\" live as a button inside that list).\n function defaultChild(item: ModuleNavItem) {\n const kids = item.children ?? []\n return kids.find((c) => /list/i.test(c.id) || /^list$/i.test(c.label)) ?? kids[kids.length - 1]\n }\n\n const activeItem = nav.find((item) => item.active || item.children?.some((c) => c.active))\n\n const tabs: HeaderTab[] = nav.map((item) => ({\n value: item.id,\n label: item.label,\n icon: item.icon ? (ICON_MAP[item.icon] ?? undefined) : undefined,\n // Plan-gated views keep their upgrade marker — dropping it would hide the\n // only signal that the tab costs an upgrade.\n badge: item.premium ? <PremiumBadge /> : undefined,\n }))\n\n const onChange = (id: string) => {\n const item = nav.find((n) => n.id === id)\n if (!item) return\n const hasChildren = item.children && item.children.length > 0\n if (hasChildren) defaultChild(item)?.onClick?.()\n else item.onClick?.()\n }\n\n return <PageTabs tabs={tabs} value={activeItem?.id ?? nav[0]?.id ?? ''} onChange={onChange} />\n}\n\n// ---------------------------------------------------------------------------\n// ModulePage\n// ---------------------------------------------------------------------------\n\n// `title` stays in the props (every caller declares it, and it is what the route\n// registers in the nav) but no variant prints it any more — the shell bar does.\nexport function ModulePage({ title: _title, subtitle, nav, children, className, headerAction, showHeader = true, sidebarFooter, navVariant, viewKey, direction }: ModulePageProps) {\n const ctxVariant = useModuleLayout()\n const variant = navVariant ?? ctxVariant\n const transitionKey = viewKey ?? 'view'\n // A subpage claimed the bar (\"← Contas a Pagar / Nova\"): the band steps aside\n // for as long as it is up. The tab strip marks WHERE YOU ARE, and on a form\n // opened from a tab you are no longer in any of them — the same reason the\n // orders detail shows no strip. The back link is the way out; the strip\n // beside it was a second, contradictory one.\n const onSubpage = useHasPageHeaderBack()\n\n // Sidebar variant — the shell's sidebar lists this module's sub-views as\n // children of its nav entry, so the page renders NO sub-nav of its own.\n if (variant === 'sidebar') {\n return (\n <>\n {showHeader && headerAction && <PageHeaderActions>{headerAction}</PageHeaderActions>}\n <PageTransition transitionKey={transitionKey} direction={direction} className={cn('min-w-0', className)}>\n {children}\n </PageTransition>\n </>\n )\n }\n\n // Tabs variant — the module sub-nav is the first row of the content area (the\n // same slot and primitive every list uses), actions go to the shell's right\n // slot, and the shell owns the page title.\n if (variant === 'tabs') {\n return (\n <>\n {!onSubpage && <ModuleHeader nav={nav} />}\n {/* Header actions belong to the module overview only; internal sub-views\n (showHeader=false) carry their own actions. */}\n {showHeader && headerAction && <PageHeaderActions>{headerAction}</PageHeaderActions>}\n <PageTransition transitionKey={transitionKey} direction={direction} className={cn('min-w-0', className)}>\n {children}\n </PageTransition>\n </>\n )\n }\n\n // Rail variant (default) — left sub-nav column, handed to the shell so it\n // reaches the top of the frame instead of starting under the page bar.\n return (\n <div className={cn('min-w-0', className)}>\n <PageRail>\n <div className=\"hidden w-48 shrink-0 flex-col overflow-y-auto border-r border-border p-3 no-print md:flex\">\n {/* No heading over the links: the page bar to the right already says\n \"Estoque\", and the rail was printing the same word in caps. */}\n <nav className=\"space-y-0.5\">\n {nav.map((item) => (\n <RailNavItem key={item.id} item={item} />\n ))}\n </nav>\n {sidebarFooter && <div className=\"mt-auto pt-3\">{sidebarFooter}</div>}\n </div>\n </PageRail>\n\n {/* Content */}\n <div className=\"min-w-0\">\n {/* O cabeçalho da página NÃO mora aqui: quem nomeia a tela é a barra da\n shell, em todos os layouts, e a trilha ao lado é navegação. Esta\n coluna desenhava um <h1> com o mesmo nome que a barra — o módulo\n aparecia escrito três vezes (barra, caps na trilha, título) antes de\n qualquer conteúdo. Sobra o subtítulo, que a barra não carrega. */}\n {showHeader && headerAction && <PageHeaderActions>{headerAction}</PageHeaderActions>}\n {/* Mobile tabs — hidden on a subpage for the same reason the `tabs`\n variant hides its strip: a form or a record reached FROM a tab is not\n one of the tabs, so leaving the strip up marks a place the user is no\n longer at, one line under a back link that says so. The guard existed\n and only the tabs variant was applying it. */}\n {!onSubpage && <MobileTabs nav={nav} />}\n <PageTransition transitionKey={transitionKey} direction={direction}>\n {children}\n </PageTransition>\n </div>\n </div>\n )\n}\n"]}